From 8fc30896db3fa35dbd79905e2d96f54fe2873c64 Mon Sep 17 00:00:00 2001 From: "Xamarin Public Jenkins (auto-signing)" Date: Tue, 24 Apr 2018 09:31:23 +0000 Subject: [PATCH] Imported Upstream version 5.12.0.220 Former-commit-id: c477e03582759447177c6d4bf412cd2355aad476 --- Makefile.am | 11 +- Makefile.in | 34 +- README.md | 37 +- acceptance-tests/Makefile.in.REMOVED.git-id | 2 +- acceptance-tests/coreclr.mk.REMOVED.git-id | 2 +- aclocal.m4 | 1 + config.h.in | 33 + configure.REMOVED.git-id | 2 +- configure.ac.REMOVED.git-id | 2 +- data/Makefile.in | 23 +- data/net_2_0/Browsers/Makefile.in | 23 +- data/net_2_0/Makefile.in | 23 +- data/net_4_0/Browsers/Makefile.in | 23 +- data/net_4_0/Makefile.in | 23 +- data/net_4_5/Browsers/Makefile.in | 23 +- data/net_4_5/Makefile.in | 23 +- docs/Makefile.in | 23 +- docs/deploy/mono-api-domains.html | 8 +- docs/deploy/mono-api-internal.html | 10 +- docs/deploy/mono-api-methods.html | 10 + external/api-snapshot/profiles/Makefile | 21 - external/api-snapshot/profiles/ecma.pub | Bin 16 -> 0 bytes .../monodroid/Facades/System.Memory.cs | 5 + .../Facades/System.Resources.Reader.cs | 17 + .../Facades/System.Resources.Writer.cs | 17 + .../profiles/monodroid/I18N.Rare.cs | 28 + .../monodroid/System.Data.cs.REMOVED.git-id | 2 +- .../monodroid/System.cs.REMOVED.git-id | 2 +- .../monodroid/mscorlib.cs.REMOVED.git-id | 2 +- .../monotouch/Facades/System.Memory.cs | 5 + .../Facades/System.Resources.Reader.cs | 17 + .../Facades/System.Resources.Writer.cs | 17 + .../profiles/monotouch/I18N.Rare.cs | 28 + .../monotouch/System.Data.cs.REMOVED.git-id | 2 +- .../monotouch/System.cs.REMOVED.git-id | 2 +- .../monotouch/mscorlib.cs.REMOVED.git-id | 2 +- external/api-snapshot/profiles/msfinal.pub | Bin 160 -> 0 bytes .../net_4_x/Facades/System.Net.Http.Rtc.cs | 16 + .../net_4_x/Facades/System.Net.Ping.cs | 21 + .../Facades/System.Resources.Reader.cs | 17 + .../Facades/System.Resources.Writer.cs | 17 + ...System.Runtime.Serialization.Formatters.cs | 24 + .../System.Security.Cryptography.Csp.cs | 22 + .../profiles/net_4_x/I18N.Rare.cs | 28 + .../net_4_x/System.Data.cs.REMOVED.git-id | 2 +- .../profiles/net_4_x/System.Security.cs | 8 +- .../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 +- .../api-snapshot/profiles/silverlight.pub | Bin 160 -> 0 bytes external/bockbuild/README.md | 2 +- .../boringssl/.github/PULL_REQUEST_TEMPLATE | 8 +- external/boringssl/CMakeLists.txt | 2 + external/boringssl/crypto/ec/p224-64.c | 34 +- external/boringssl/crypto/ec/p256-64.c | 30 +- .../src/CoreLib/System/Buffers/IRetainable.cs | 2 +- .../CoreLib/System/Buffers/MemoryHandle.cs | 2 +- .../src/CoreLib/System/Buffers/OwnedMemory.cs | 2 +- .../Generic/KeyNotFoundException.cs | 2 + .../System/Collections/Generic/List.cs | 10 + .../Collections/ObjectModel/Collection.cs | 2 + .../ObjectModel/ReadOnlyCollection.cs | 2 + .../Globalization/CompareInfo.Invariant.cs | 2 +- .../System/Globalization/CompareInfo.cs | 12 +- .../src/Common/src/CoreLib/System/Memory.cs | 2 +- .../src/CoreLib/System/ReadOnlyMemory.cs | 2 +- .../AsyncStateMachineAttribute.cs | 3 + .../CompilerGeneratedAttribute.cs | 3 + .../CompilerGlobalScopeAttribute.cs | 3 + .../CustomConstantAttribute.cs | 3 + .../DateTimeConstantAttribute.cs | 3 + .../DecimalConstantAttribute.cs | 3 + .../FixedAddressValueTypeAttribute.cs | 3 + .../CompilerServices/IndexerNameAttribute.cs | 3 + .../IteratorStateMachineAttribute.cs | 3 + .../ReferenceAssemblyAttribute.cs | 3 + .../RuntimeCompatibilityAttribute.cs | 3 + .../RuntimeWrappedException.cs | 2 + .../CompilerServices/StateMachineAttribute.cs | 3 + .../UnsafeValueTypeAttribute.cs | 3 + .../Runtime/InteropServices/MemoryMarshal.cs | 2 +- .../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 | 8 + .../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 + .../src/System/IO/StringBuilderCache.cs | 7 + .../tests/System/Net/Configuration.Http.cs | 2 + .../src/System/Buffers/Utilities.cs | 4 + .../src/System/Collections/SortedList.cs | 1 + .../Specialized/NameObjectCollectionBase.cs | 2 +- .../Specialized/NameValueCollection.cs | 2 +- .../Specialized/StringDictionary.cs | 9 +- .../src/System/Collections/BitArray.cs | 1 + .../src/System/IO/Compression/GZipStream.cs | 2 +- .../src/System/IO/FileSystemWatcher.Linux.cs | 8 + .../src/System/IO/FileSystemWatcher.OSX.cs | 8 + .../IO/FileSystemWatcher.UnknownUnix.cs | 7 + .../src/System/IO/FileSystemWatcher.Win32.cs | 8 + .../src/System/IO/FileSystemWatcher.cs | 14 + .../tests/FileSystemWatcher.cs | 2 + .../tests/FileSystemWatcher.unit.cs | 8 + .../src/System/Buffers/Binary/Reader.cs | 2 +- .../System/Buffers/Binary/ReaderBigEndian.cs | 2 +- .../Buffers/Binary/ReaderLittleEndian.cs | 2 +- .../src/System/Buffers/Binary/Writer.cs | 2 +- .../System/Buffers/Binary/WriterBigEndian.cs | 2 +- .../Buffers/Binary/WriterLittleEndian.cs | 2 +- .../src/System/Buffers/StandardFormat.cs | 2 +- .../src/System/MemoryExtensions.Portable.cs | 2 +- .../src/System/MemoryExtensions.cs | 2 +- .../ObjectModel/KeyedCollection.cs | 1 + .../src/System/Collections/Hashtable.cs | 1 + .../System/Collections/IHashCodeProvider.cs | 2 + .../src/System/Globalization/Extensions.cs | 1 + .../RegexCompilationInfo.cs | 3 + .../TaskCancelWaitTests.cs.REMOVED.git-id | 2 +- external/linker/.github/CONTRIBUTING.md | 10 +- external/linker/.gitignore | 6 +- external/linker/Contributing.md | 73 - external/linker/README.md | 16 +- .../linker/analyzer/ConsoleDependencyGraph.cs | 19 +- .../LinkerAnalyzerCore/DependencyGraph.cs | 1 + .../LinkerAnalyzerCore/SpaceAnalyzer.cs | 153 + external/linker/analyzer/Main.cs | 10 +- external/linker/analyzer/README.md | 21 +- external/linker/analyzer/analyzer.csproj | 5 + .../cecil/Mono.Cecil.Cil/PortablePdb.cs | 3 + .../linker/cecil/Mono.Cecil.Cil/Symbols.cs | 2 +- external/linker/cecil/Mono.Cecil.PE/Image.cs | 1 + .../linker/cecil/Mono.Cecil.PE/ImageReader.cs | 12 +- .../linker/cecil/Mono.Cecil.PE/ImageWriter.cs | 5 +- .../linker/cecil/Mono.Cecil/AssemblyWriter.cs | 10 +- .../cecil/Mono.Cecil/CustomAttribute.cs | 3 +- .../cecil/Mono.Cecil/ModuleDefinition.cs | 4 +- .../linker/cecil/Mono.Cecil/ModuleKind.cs | 1 + .../cecil/Mono.Cecil/SecurityDeclaration.cs | 3 +- .../ILLink.CustomSteps/ClearInitLocals.cs | 29 +- .../ILLink.CustomSteps.csproj | 6 + .../integration/ILLink.Tasks/AdapterLogger.cs | 37 + .../ILLink.Tasks/FindNativeDeps.cs | 88 +- .../ILLink.Tasks/ILLink.Tasks.csproj | 3 +- .../ILLink.Tasks/ILLink.Tasks.targets | 73 +- .../integration/ILLink.Tasks/LinkTask.cs | 25 +- .../integration/test/CommandRunner.cs | 146 + .../integration/test/HelloWorldTest.cs | 34 +- .../integration/test/IntegrationTestBase.cs | 134 +- .../integration/test/MusicStoreTest.cs | 190 +- .../corebuild/integration/test/WebApiTest.cs | 41 +- .../corebuild/integration/test/test.csproj | 1 + external/linker/corebuild/linker.sln | 14 + external/linker/linker.sln | 18 + .../linker/linker/Linker.Steps/MarkStep.cs | 229 +- .../linker/linker/Linker.Steps/OutputStep.cs | 53 +- .../linker/Linker.Steps/RemoveSecurityStep.cs | 68 + .../Linker.Steps/ResolveFromAssemblyStep.cs | 7 +- .../linker/Linker.Steps/ResolveFromXmlStep.cs | 75 +- .../linker/linker/Linker.Steps/SweepStep.cs | 90 +- .../linker/linker/Linker/AssemblyResolver.cs | 33 +- external/linker/linker/Linker/Driver.cs | 40 +- external/linker/linker/Linker/LinkContext.cs | 45 +- external/linker/linker/Mono.Linker.csproj | 11 +- external/linker/linker/{README => README.md} | 246 +- .../Tests/Extensions/CecilExtensions.cs | 122 - .../linker/linker/Tests/Extensions/NiceIO.cs | 922 ---- .../BaseExpectedLinkedBehaviorAttribute.cs | 11 - .../Assertions/BaseInAssemblyAttribute.cs | 5 - .../Assertions/IgnoreTestCaseAttribute.cs | 13 - .../Assertions/KeptAssemblyAttribute.cs | 16 - .../Assertions/KeptAttribute.cs | 7 - .../Assertions/KeptAttributeAttribute.cs | 21 - .../Assertions/KeptBackingFieldAttribute.cs | 7 - .../Assertions/KeptBaseTypeAttribute.cs | 22 - .../Assertions/KeptInterfaceAttribute.cs | 15 - .../Assertions/KeptMemberAttribute.cs | 13 - .../KeptMemberInAssemblyAttribute.cs | 28 - .../Assertions/KeptResourceAttribute.cs | 15 - .../KeptResourceInAssemblyAttribute.cs | 18 - .../Assertions/KeptSecurityAttribute.cs | 18 - .../Assertions/KeptTypeInAssemblyAttribute.cs | 23 - .../Assertions/RemovedAssemblyAttribute.cs | 16 - .../Assertions/RemovedForwarderAttribute.cs | 15 - .../RemovedMemberInAssemblyAttribute.cs | 27 - .../RemovedResourceInAssemblyAttribute.cs | 18 - .../RemovedTypeInAssemblyAttribute.cs | 23 - .../Assertions/SkipPeVerifyAttribute.cs | 25 - .../Metadata/BaseMetadataAttribute.cs | 9 - .../Metadata/DefineAttribute.cs | 12 - .../Metadata/Il8nAttribute.cs | 13 - .../Metadata/IncludeBlacklistStepAttribute.cs | 10 - ...eepTypeForwarderOnlyAssembliesAttribute.cs | 12 - .../Metadata/NotATestCaseAttribute.cs | 7 - .../Metadata/ReferenceAttribute.cs | 13 - .../Metadata/SandboxDependencyAttribute.cs | 13 - .../Metadata/SetupCompileAfterAttribute.cs | 18 - .../Metadata/SetupCompileArgumentAttribute.cs | 12 - .../SetupCompileAssemblyNameAttribute.cs | 12 - .../Metadata/SetupCompileBeforeAttribute.cs | 18 - .../Metadata/SetupCompileResourceAttribute.cs | 12 - .../Metadata/SetupLinkerActionAttribute.cs | 18 - .../Metadata/SetupLinkerArgumentAttribute.cs | 21 - .../SetupLinkerCoreActionAttribute.cs | 20 - ...ono.Linker.Tests.Cases.Expectations.csproj | 86 - .../Advanced/DeadCodeElimination1.cs | 19 - .../Advanced/FieldThatOnlyGetsSetIsRemoved.cs | 21 - ...ibuteIsRemovedIfOnlyTypesUsedInAssembly.cs | 16 - .../AssemblyAttributeKeptInComplexCase.cs | 41 - .../Attributes/AttributeOnAssemblyIsKept.cs | 22 - .../AttributeOnParameterInUsedMethodIsKept.cs | 22 - .../AttributeOnPreservedTypeIsKept.cs | 20 - ...rvedTypeWithTypeUsedInConstructorIsKept.cs | 27 - ...eWithTypeUsedInDifferentNamespaceIsKept.cs | 33 - ...nPreservedTypeWithTypeUsedInFieldIsKept.cs | 26 - ...dTypeWithTypeUsedInPropertySetterIsKept.cs | 27 - .../AttributeOnPreservedTypeWithUsedSetter.cs | 20 - .../Attributes/AttributeOnUsedFieldIsKept.cs | 25 - .../Attributes/AttributeOnUsedMethodIsKept.cs | 27 - .../AttributeOnUsedPropertyIsKept.cs | 27 - ...eIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs | 6 - .../AssemblyAttributeKeptInComplexCase_Lib.cs | 12 - .../SecurityAttributesOnUsedMethodAreKept.cs | 23 - .../SecurityAttributesOnUsedTypeAreKept.cs | 19 - .../ComplexNestedClassesHasUnusedRemoved.cs | 26 - ...mplementedOnBaseClassDoesNotGetStripped.cs | 37 - ...LevelNestedClassesAllRemovedWhenNonUsed.cs | 19 - .../NestedDelegateInvokeMethodsPreserved.cs | 24 - .../UninvokedInterfaceMemberGetsRemoved.cs | 24 - .../Basic/UnusedClassGetsRemoved.cs | 10 - .../Basic/UnusedFieldGetsRemoved.cs | 20 - .../Basic/UnusedMethodGetsRemoved.cs | 22 - .../Basic/UnusedNestedClassGetsRemoved.cs | 11 - .../Basic/UnusedPropertyGetsRemoved.cs | 20 - .../Basic/UnusedPropertySetterRemoved.cs | 17 - .../Basic/UsedInterfaceIsKept.cs | 24 - .../Basic/UsedPropertyIsKept.cs | 19 - .../Basic/UsedStructIsKept.cs | 21 - .../CopyOfCoreLibrariesKeepsUnusedTypes.cs | 22 - ...kingOfCoreLibrariesRemovesUnusedMethods.cs | 27 - ...inkingOfCoreLibrariesRemovesUnusedTypes.cs | 38 - ...rloadedMethodGetsStrippedInGenericClass.cs | 37 - ...ntGenericArgumentNameDoesNotGetStripped.cs | 30 - ...deUsesADifferentNameForGenericParameter.cs | 28 - ...hodOfSameNameWithDifferentParameterType.cs | 34 - ...enericMethodInGenericClassIsNotStripped.cs | 21 - ...thodInstanceInGenericClassIsNotStripped.cs | 21 - ...ericMethodWithNoParametersIsNotStripped.cs | 27 - ...TypeMarkedSequentialLayoutAreNotRemoved.cs | 17 - .../DefaultConstructorOfParameterIsRemoved.cs | 23 - ...DefaultConstructorOfReturnTypeIsRemoved.cs | 23 - .../Com/FieldsOfParameterAreRemoved.cs | 24 - .../Com/FieldsOfReturnTypeAreRemoved.cs | 24 - .../Com/FieldsOfThisAreRemoved.cs | 25 - ...aultConstructorOfReturnTypeIsNotRemoved.cs | 22 - .../UnusedDefaultConstructorIsRemoved.cs | 27 - ...onstructorOfTypePassedByRefIsNotRemoved.cs | 28 - .../UnusedFieldsOfTypesAreNotRemoved.cs | 23 - ...edFieldsOfTypesPassedByRefAreNotRemoved.cs | 23 - ...edFieldsOfTypesWhenHasThisAreNotRemoved.cs | 21 - .../DefaultConstructorOfParameterIsRemoved.cs | 23 - ...DefaultConstructorOfReturnTypeIsRemoved.cs | 23 - .../Com/FieldsOfParameterAreRemoved.cs | 24 - .../Com/FieldsOfReturnTypeAreRemoved.cs | 24 - .../PInvoke/Com/FieldsOfThisAreRemoved.cs | 25 - ...aultConstructorOfReturnTypeIsNotRemoved.cs | 22 - .../UnusedDefaultConstructorIsRemoved.cs | 27 - ...onstructorOfTypePassedByRefIsNotRemoved.cs | 28 - .../UnusedFieldsOfTypesAreNotRemoved.cs | 23 - ...edFieldsOfTypesPassedByRefAreNotRemoved.cs | 23 - ...UnusedTypeWithSequentialLayoutIsRemoved.cs | 15 - .../LinkXml/CanPreserveAnExportedType.cs | 19 - .../LinkXml/CanPreserveAnExportedType.xml | 6 - .../CanPreserveExportedTypesUsingRegex.cs | 19 - .../CanPreserveExportedTypesUsingRegex.xml | 6 - .../LinkXml/CanPreserveTypesUsingRegex.cs | 20 - .../LinkXml/CanPreserveTypesUsingRegex.xml | 5 - .../CanPreserveAnExportedType_Forwarder.cs | 3 - .../CanPreserveAnExportedType_Library.cs | 11 - .../PreserveBackingFieldWhenPropertyIsKept.cs | 18 - ...PreserveBackingFieldWhenPropertyIsKept.xml | 6 - ...eldsHasBackingFieldsOfPropertiesRemoved.cs | 72 - ...ldsHasBackingFieldsOfPropertiesRemoved.xml | 6 - ...thNoDefinedPreserveHasAllTypesPreserved.cs | 15 - ...hNoDefinedPreserveHasAllTypesPreserved.xml | 4 - .../UnusedEventPreservedByLinkXmlIsKept.cs | 23 - .../UnusedEventPreservedByLinkXmlIsKept.xml | 8 - .../UnusedFieldPreservedByLinkXmlIsKept.cs | 17 - .../UnusedFieldPreservedByLinkXmlIsKept.xml | 7 - .../UnusedMethodPreservedByLinkXmlIsKept.cs | 21 - .../UnusedMethodPreservedByLinkXmlIsKept.xml | 7 - ...nusedNestedTypePreservedByLinkXmlIsKept.cs | 14 - ...usedNestedTypePreservedByLinkXmlIsKept.xml | 5 - .../UnusedPropertyPreservedByLinkXmlIsKept.cs | 42 - ...UnusedPropertyPreservedByLinkXmlIsKept.xml | 15 - ...PresservedWhenEntireAssemblyIsPreserved.cs | 20 - ...resservedWhenEntireAssemblyIsPreserved.xml | 3 - .../UnusedTypePreservedByLinkXmlIsKept.cs | 14 - .../UnusedTypePreservedByLinkXmlIsKept.xml | 5 - ...TypePreservedByLinkXmlWithCommentIsKept.cs | 15 - ...ypePreservedByLinkXmlWithCommentIsKept.xml | 6 - ...NoDefinedPreserveHasAllMembersPreserved.cs | 86 - ...oDefinedPreserveHasAllMembersPreserved.xml | 5 - ...peWithPreserveAllHasAllMembersPreserved.cs | 85 - ...eWithPreserveAllHasAllMembersPreserved.xml | 5 - ...TypeWithPreserveFieldsHasMethodsRemoved.cs | 66 - ...ypeWithPreserveFieldsHasMethodsRemoved.xml | 7 - ...TypeWithPreserveMethodsHasFieldsRemoved.cs | 74 - ...ypeWithPreserveMethodsHasFieldsRemoved.xml | 5 - ...peWithPreserveNothingAndPreserveMembers.cs | 26 - ...eWithPreserveNothingAndPreserveMembers.xml | 8 - ...ypeWithPreserveNothingHasMembersRemoved.cs | 50 - ...peWithPreserveNothingHasMembersRemoved.xml | 5 - .../Mono.Linker.Tests.Cases.csproj | 219 - ...erAssembliesAreLinkedByDefault_Library1.cs | 15 - .../Individual/CanSkipUnresolved.cs | 18 - .../Dependencies/CanSkipUnresolved_Library.cs | 19 - ...rencesAreRemovedWhenAllUsagesAreRemoved.cs | 25 - .../UserAssembliesAreLinkedByDefault.cs | 18 - ...tProcessedIfNameDoesNotMatchAnAssembly.xml | 5 - ...otProcessedWhenBlacklistStepIsDisabled.xml | 5 - ...IsNotProcessedWhenCoreLinkActionIsSkip.xml | 5 - .../EmbeddedLinkXmlFileIsProcessed.xml | 5 - .../NonLinkerEmbeddedResourceHasNoImpact.xml | 2 - ...otProcessedIfNameDoesNotMatchAnAssembly.cs | 19 - ...NotProcessedWhenBlacklistStepIsDisabled.cs | 21 - ...eIsNotProcessedWhenCoreLinkActionIsSkip.cs | 23 - .../EmbeddedLinkXmlFileIsProcessed.cs | 22 - .../NonLinkerEmbeddedResourceHasNoImpact.cs | 18 - .../UnusedStaticConstructorGetsRemoved.cs | 20 - .../Statics/UnusedStaticMethodGetsRemoved.cs | 23 - .../TestFramework/CanCompileILAssembly.cs | 19 - .../CanCompileTestCaseWithDebugPdbs.cs | 25 - .../Dependencies/ILAssemblySample.il | 42 - ...fyResourceInAssemblyAttributesBehavior.txt | 1 - .../VerifyDefineAttributeBehavior.cs | 26 - ...ifyResourceInAssemblyAttributesBehavior.cs | 18 - .../CanDumpDependenciesToUncompressedXml.cs | 13 - .../Individual/CanEnableDependenciesDump.cs | 12 - .../Individual/CanEnableReducedTracing.cs | 16 - .../Dependencies/ForwarderLibrary.cs | 3 - .../Dependencies/ImplementationLibrary.cs | 14 - .../Dependencies/LibraryUsingForwarder.cs | 12 - .../ReferenceImplementationLibrary.cs | 17 - .../TypeForwarderMissingReference.il | 37 - .../TypeForwarding/MissingTargetReference.cs | 23 - .../TypeForwarderOnlyAssembliesKept.cs | 26 - .../TypeForwarderOnlyAssembliesRemoved.cs | 27 - ...emtingInterfaceMethodsThroughBaseClass2.cs | 29 - ...emtingInterfaceMethodsThroughBaseClass3.cs | 26 - ...emtingInterfaceMethodsThroughBaseClass4.cs | 30 - ...emtingInterfaceMethodsThroughBaseClass5.cs | 29 - ...emtingInterfaceMethodsThroughBaseClass6.cs | 38 - ...omConcreteTypeHasInterfaceMethodRemoved.cs | 26 - ...UsedFromInterfaceHasInterfaceMethodKept.cs | 27 - ...rToDetectUnusedVirtualMethodGetsRemoved.cs | 30 - ...omConcreteTypeHasInterfaceMethodRemoved.cs | 26 - ...UsedFromInterfaceHasInterfaceMethodKept.cs | 27 - ...tImplementsAlreadyMarkedInterfaceMethod.cs | 35 - .../UnusedVirtualMethodRemoved.cs | 24 - .../UsedVirtualMethodNotRemoved.cs | 29 - ...hodGetsPerservedIfBaseMethodGetsInvoked.cs | 28 - ...IfImplementingMethodGetsInvokedDirectly.cs | 27 - .../linker/Tests/Mono.Linker.Tests.csproj | 103 - .../linker/Tests/TestCases/IndividualTests.cs | 92 - .../linker/linker/Tests/TestCases/TestCase.cs | 42 - .../linker/Tests/TestCases/TestDatabase.cs | 131 - .../linker/Tests/TestCases/TestSuites.cs | 94 - .../Tests/TestCasesRunner/AssemblyChecker.cs | 420 -- .../Tests/TestCasesRunner/CompilerOptions.cs | 13 - .../TestCasesRunner/ExpectationsProvider.cs | 12 - .../Tests/TestCasesRunner/ILCompiler.cs | 72 - .../Tests/TestCasesRunner/LinkXmlHelpers.cs | 30 - .../TestCasesRunner/LinkedTestCaseResult.cs | 19 - .../TestCasesRunner/LinkerArgumentBuilder.cs | 108 - .../Tests/TestCasesRunner/LinkerDriver.cs | 8 - .../ManagedCompilationResult.cs | 15 - .../Tests/TestCasesRunner/ObjectFactory.cs | 31 - .../Tests/TestCasesRunner/PeVerifier.cs | 147 - .../Tests/TestCasesRunner/ResultChecker.cs | 297 -- .../Tests/TestCasesRunner/SetupCompileInfo.cs | 12 - .../SourceAndDestinationPair.cs | 9 - .../TestCasesRunner/TestCaseCollector.cs | 162 - .../Tests/TestCasesRunner/TestCaseCompiler.cs | 195 - .../TestCasesRunner/TestCaseLinkerOptions.cs | 16 - .../TestCasesRunner/TestCaseMetadaProvider.cs | 160 - .../Tests/TestCasesRunner/TestCaseSandbox.cs | 111 - .../Tests/TestCasesRunner/TestRunner.cs | 89 - .../Tests/PreserveActionComparisonTests.cs | 30 - external/linker/linker/Tests/packages.config | 6 - external/linker/monobuild/Makefile | 1 + ...oft.CodeAnalysis.CSharp.dll.REMOVED.git-id | 1 + .../Microsoft.CodeAnalysis.dll.REMOVED.git-id | 1 + ...m.Collections.Immutable.dll.REMOVED.git-id | 1 + ...tem.Reflection.Metadata.dll.REMOVED.git-id | 1 + .../DefaultInterfaceImplementation/csc.exe | Bin 0 -> 46080 bytes .../csc.exe.config | 149 + .../DefaultInterfaceImplementation/csc.rsp | 46 + ikvm-native/Makefile.in | 23 +- libgc/Makefile.am | 2 +- libgc/Makefile.in | 19 +- libgc/configure.REMOVED.git-id | 2 +- libgc/configure.ac | 4 + libgc/dyn_load.c | 19 +- libgc/include/gc_config_macros.h | 2 +- libgc/include/private/gc_priv.h | 2 + libgc/include/private/gcconfig.h | 33 +- libgc/include/private/openbsd_stop_world.h | 12 - libgc/include/private/pthread_support.h | 2 - libgc/openbsd_stop_world.c | 161 - libgc/os_dep.c.REMOVED.git-id | 2 +- libgc/pthread_stop_world.c | 3 +- libgc/pthread_support.c | 2 +- llvm/Makefile.in | 23 +- m4/Makefile.in | 23 +- m4/ax_check_compile_flag.m4 | 74 + man/Makefile.am | 1 + man/Makefile.in | 24 +- man/illinkanalyzer.1 | 132 + man/mono.1 | 44 +- man/monolinker.1 | 2 +- man/sqlsharp.1 | 4 +- mcs/build/common/Consts.cs | 4 +- mcs/build/common/basic-profile-check.cs | 2 +- mcs/build/library.make | 10 +- mcs/build/profiles/build.make | 2 + mcs/build/rules.make | 21 +- mcs/build/tests.make | 22 +- .../Facades/System.Memory/TypeForwarders.cs | 10 +- .../System.Net.Http.Rtc/AssemblyInfo.cs | 35 + .../Facades/System.Net.Http.Rtc/Makefile | 21 + .../System.Net.Http.Rtc.dll.sources | 2 + .../System.Net.Http.Rtc/TypeForwarders.cs} | 37 +- .../System.Resources.Reader/AssemblyInfo.cs | 35 + .../Facades/System.Resources.Reader/Makefile | 23 + .../System.Resources.Reader.dll.sources | 3 + .../System.Resources.Reader/TypeForwarders.cs | 25 + .../System.Resources.Writer/AssemblyInfo.cs | 35 + .../Facades/System.Resources.Writer/Makefile | 23 + .../System.Resources.Writer.dll.sources | 3 + .../System.Resources.Writer/TypeForwarders.cs | 25 + mcs/class/Facades/subdirs.make | 7 +- mcs/class/I18N/CJK/CP51932.cs | 7 +- mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs | 9 + mcs/class/I18N/CJK/jis.table | Bin 101572 -> 101572 bytes mcs/class/I18N/Common/Handlers.cs | 4 + mcs/class/I18N/Rare/CP737.cs | 462 ++ mcs/class/I18N/Rare/CP775.cs | 451 ++ mcs/class/I18N/Rare/I18N.Rare.dll.sources | 2 + mcs/class/I18N/Rare/ibm-737.ucm | 411 ++ mcs/class/I18N/Rare/ibm-775.ucm | 408 ++ mcs/class/I18N/tools/cvt.sh | 16 +- mcs/class/I18N/tools/uni2tab.c | 22 +- .../BuildSubmissionTest.cs | 4 +- .../Mono.Debugger.Soft/EnumMirror.cs | 3 +- .../Mono.Debugger.Soft/Test/dtest-app.cs | 16 + .../Test/dtest.cs.REMOVED.git-id | 2 +- .../Mono.Options/Mono.Options/Options.cs | 39 +- .../Test/Mono.Options/OptionSetTest.cs | 4 + mcs/class/Mono.Profiler.Log/Makefile | 2 +- .../Mono.Profiler.Log/LogEnums.cs | 24 + .../Mono.Profiler.Log/LogEventVisitor.cs | 12 + .../Mono.Profiler.Log/LogEvents.cs | 53 + .../Mono.Profiler.Log/LogProcessor.cs | 58 +- .../Mono.Profiler.Log/LogStreamHeader.cs | 2 +- .../AuthenticodeBase.cs | 138 +- .../AuthenticodeFormatter.cs | 65 +- .../AuthenticodeDeformatterTest.cs | 2 +- mcs/class/System.Core/Makefile | 6 +- .../System.Core/System.IO.Pipes/PipeStream.cs | 2 +- .../MemoryMappedFileTest.cs | 1 + .../ExpressionTest_Call.cs | 3 +- .../ExpressionTest_Equal.cs | 2 +- .../System.Linq/EnumerableAsQueryableTest.cs | 2 +- .../TaskExtensionsTests.cs | 1 + .../ReaderWriterLockSlimTest.cs | 9 + .../SqlCommand.platformnotsupported.cs | 3 - .../corefx/SqlConnectionStringBuilder.cs | 2 +- ...ouch_watch_System.Data.dll.exclude.sources | 1 - .../System.Drawing/FontFamily.cs | 10 +- .../System.Drawing/gdipFunctions.cs | 2 +- .../System.Net.Http/HttpClientHandler.cs | 2 +- .../Test/System.Net.Http/HttpClientTest.cs | 30 +- mcs/class/System.Numerics/Makefile | 2 +- mcs/class/System.Security/Makefile | 5 +- .../KeyInfoX509Data.cs | 285 -- .../Manifest.cs | 119 - .../Signature.cs | 221 - .../SignedInfo.cs | 219 - .../SignedXml.cs | 1517 +++--- .../X509IssuerSerial.cs | 56 - .../XmlSignature.cs | 128 - .../System.Security.dll.sources | 15 +- .../EncryptedXmlTest.cs | 19 +- .../SignedXmlTest.cs | 200 +- .../common_System.Security.dll.sources | 9 +- .../System.ServiceModel.dll.sources | 1 + .../SessionStateModule.cs | 51 +- mcs/class/System.Windows.Forms/README | 17 +- .../Enums.cs | 17 + .../DataGridView.cs.REMOVED.git-id | 2 +- .../System.Windows.Forms/MimeIcon.cs | 15 +- .../System.Windows.Forms/XplatUICarbon.cs | 10 +- mcs/class/System/Makefile | 6 +- .../MonoTlsProviderFactory.cs | 130 +- .../System/Mono.Net.Security/MonoTlsStream.cs | 23 +- .../ReferenceSources/SR.cs.REMOVED.git-id | 2 +- .../ReferenceSources/SecureStringHelper.cs | 14 +- .../CompilerCollection.cs | 27 +- .../ApplicationSettingsBase.cs | 77 +- .../CustomizableFileSettingsProvider.cs | 5 + .../SettingsPropertyValue.cs | 11 +- .../System.Diagnostics/PerformanceCounter.cs | 11 +- .../PerformanceCounterCategory.cs | 53 +- mcs/class/System/System.Net.Sockets/Socket.cs | 11 +- mcs/class/System/System.Net/HttpWebRequest.cs | 1456 +++--- .../System/System.Net/HttpWebResponse.cs | 58 +- mcs/class/System/System.Net/ServicePoint.cs | 239 +- .../System.Net/ServicePointScheduler.cs | 646 +++ .../System/System.Net/SimpleAsyncResult.cs | 232 - mcs/class/System/System.Net/WebAsyncResult.cs | 132 - .../System/System.Net/WebCompletionSource.cs | 155 + mcs/class/System/System.Net/WebConnection.cs | 1337 ++---- .../System/System.Net/WebConnectionData.cs | 80 - .../System/System.Net/WebConnectionGroup.cs | 292 -- .../System/System.Net/WebConnectionStream.cs | 819 +--- .../System/System.Net/WebConnectionTunnel.cs | 271 ++ mcs/class/System/System.Net/WebOperation.cs | 349 ++ .../System/System.Net/WebRequestStream.cs | 449 ++ .../System/System.Net/WebResponseStream.cs | 739 +++ .../X509Helper2.cs | 6 + mcs/class/System/System_test.dll.sources | 1 + .../BlockingCollectionTests.cs | 2 + .../ConcurrentBagTests.cs | 5 + .../ApplicationSettingsBaseTest.cs | 231 + .../SettingsPropertyValueTest.cs | 45 + .../System.Net.Sockets/SocketAsyncTest.cs | 1 + .../SocketTest.cs.REMOVED.git-id | 2 +- .../System.Net.Sockets/TcpListenerTest.cs | 5 +- .../Test/System.Net/FileWebRequestTest.cs | 2 + .../Test/System.Net/FileWebResponseTest.cs | 1 + .../HttpWebRequestTest.cs.REMOVED.git-id | 2 +- .../Test/System.Net/HttpWebResponseTest.cs | 9 +- .../System/Test/System.Net/WebClientTest.cs | 74 +- .../X509Certificate2Test.cs.REMOVED.git-id | 2 +- .../Test/System.Threading/WaitHandleTests.cs | 68 + mcs/class/System/common.sources | 9 +- mcs/class/System/common_networking.sources | 10 +- mcs/class/System/corefx/SR.cs | 62 + .../System.IO.Packaging/ZipPackage.cs | 2 +- mcs/class/corlib/Assembly/AssemblyInfo.cs | 1 - .../corlib/LinkerDescriptor/mscorlib.xml | 9 + mcs/class/corlib/Makefile | 7 +- .../corlib/ReferenceSources/EncodingTable.cs | 4 +- mcs/class/corlib/ReferenceSources/String.cs | 15 +- .../corlib/System.Diagnostics/StackTrace.cs | 63 +- .../IsolatedStorageFile.cs | 19 +- .../corlib/System.Reflection/AssemblyName.cs | 5 +- .../X509Certificate.cs | 7 +- .../X509Helper.cs | 4 +- ...nfig.fullaot.cs => CryptoConfig.Mobile.cs} | 50 +- .../CryptoConfig.common.cs | 36 +- .../CryptoConfig.cs | 26 +- mcs/class/corlib/System.Threading/Thread.cs | 4 +- .../corlib/System.Threading/WaitHandle.cs | 104 +- mcs/class/corlib/System/Console.cs | 15 +- mcs/class/corlib/System/Delegate.cs | 2 + mcs/class/corlib/System/TimeZoneInfo.cs | 3 +- .../RegistryKeyTest.cs.REMOVED.git-id | 2 +- .../ConcurrentDictionaryTests.cs | 19 + .../ConcurrentQueueTests.cs | 3 + .../ConcurrentStackTests.cs | 2 + .../ParallelConcurrentQueueTests.cs | 1 + .../ParallelConcurrentStackTests.cs | 1 + .../PartitionerTests.cs | 4 +- .../System.Globalization/CultureInfoTest.cs | 1 + .../IsolatedStorageFileTest.cs | 12 + .../corlib/Test/System.IO/DriveInfoTest.cs | 2 +- mcs/class/corlib/Test/System.IO/FileTest.cs | 51 + .../DynamicMethodTest.cs | 10 +- .../MethodBuilderTest.cs | 2 +- .../TypeBuilderTest.cs.REMOVED.git-id | 2 +- .../System.Reflection/AssemblyNameTest.cs | 10 + .../ConditionalWeakTableTest.cs | 4 + .../RuntimeHelpersTest.cs | 1 + .../ExceptionDispatchInfoTest.cs | 22 +- .../MarshalTest.cs | 2 +- .../RealProxyTest.cs | 2 +- .../System.Runtime.Remoting/ContextTest.cs | 4 +- .../SynchronizationAttributeTest.cs | 26 +- .../SerializationTest.cs | 2 +- .../X509CertificateTest.cs.REMOVED.git-id | 2 +- .../CryptoConfigTest.cs | 36 +- .../SignatureDescriptionTest.cs | 13 +- .../Test/System.Threading.Tasks/TaskTest.cs | 1 + .../System.Threading/CountdownEventTests.cs | 2 + .../Test/System.Threading/InterlockedTest.cs | 2 +- .../ManualResetEventSlimTests.cs | 1 + .../corlib/Test/System.Threading/MutexTest.cs | 2 + .../System.Threading/ReaderWriterLockTest.cs | 9 + .../System.Threading/SemaphoreSlimTests.cs | 1 + .../Test/System.Threading/SpinLockTests.cs | 1 + .../Test/System.Threading/ThreadLocalTests.cs | 2 + .../Test/System.Threading/ThreadPoolTest.cs | 28 +- .../Test/System.Threading/ThreadTest.cs | 24 +- .../Test/System.Threading/WaitHandleTest.cs | 10 + .../Test/System/ConvertTest.cs.REMOVED.git-id | 2 +- .../Test/System/DecimalTest-Microsoft.cs | 4 +- mcs/class/corlib/Test/System/DecimalTest.cs | 12 +- mcs/class/corlib/Test/System/DelegateTest.cs | 31 +- mcs/class/corlib/Test/System/ExceptionTest.cs | 4 +- mcs/class/corlib/Test/System/GCTest.cs | 2 +- mcs/class/corlib/Test/System/LazyTest.cs | 2 + .../NumberFormatterTest.cs.REMOVED.git-id | 2 +- .../corlib/Test/System/TimeZoneInfoTest.cs | 4 +- mcs/class/corlib/Test/System/TimeZoneTest.cs | 2 +- .../corlib/Test/System/TypedReferenceCas.cs | 2 +- .../corlib/Test/System/TypedReferenceTest.cs | 2 +- mcs/class/corlib/Test/System/ValueTypeTest.cs | 2 +- mcs/class/corlib/corert/Stream.cs | 2 +- mcs/class/corlib/corlib.dll.sources | 3 +- .../Mono.Security.dll.REMOVED.git-id | 1 - .../System.Configuration.dll.REMOVED.git-id | 1 - .../1051000004/System.Core.dll.REMOVED.git-id | 1 - .../System.Numerics.dll.REMOVED.git-id | 1 - .../System.Security.dll.REMOVED.git-id | 1 - .../1051000004/System.Xml.dll.REMOVED.git-id | 1 - .../1051000004/System.dll.REMOVED.git-id | 1 - .../1051000004/mcs.exe.REMOVED.git-id | 1 - .../1051000004/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.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../1051200002/System.Core.dll.REMOVED.git-id | 1 + .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 0 .../1051200002/System.Xml.dll.REMOVED.git-id | 1 + .../1051200002/System.dll.REMOVED.git-id | 1 + .../1051200002/mcs.exe.REMOVED.git-id | 1 + .../1051200002/mscorlib.dll.REMOVED.git-id | 1 + .../Mono.Security.dll.REMOVED.git-id | 1 - .../System.Configuration.dll.REMOVED.git-id | 1 - .../1051000004/System.Core.dll.REMOVED.git-id | 1 - .../System.Numerics.dll.REMOVED.git-id | 1 - .../System.Security.dll.REMOVED.git-id | 1 - .../1051000004/System.Xml.dll.REMOVED.git-id | 1 - .../1051000004/System.dll.REMOVED.git-id | 1 - .../1051000004/mcs.exe.REMOVED.git-id | 1 - .../1051000004/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.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../1051200002/System.Core.dll.REMOVED.git-id | 1 + .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 0 .../1051200002/System.Xml.dll.REMOVED.git-id | 1 + .../1051200002/System.dll.REMOVED.git-id | 1 + .../1051200002/mcs.exe.REMOVED.git-id | 1 + .../1051200002/mscorlib.dll.REMOVED.git-id | 1 + .../Mono.Security.dll.REMOVED.git-id | 1 - .../System.Configuration.dll.REMOVED.git-id | 1 - .../1051000004/System.Core.dll.REMOVED.git-id | 1 - .../System.Numerics.dll.REMOVED.git-id | 1 - .../System.Security.dll.REMOVED.git-id | 1 - .../1051000004/System.Xml.dll.REMOVED.git-id | 1 - .../1051000004/System.dll.REMOVED.git-id | 1 - .../1051000004/mcs.exe.REMOVED.git-id | 1 - .../1051000004/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.Security.dll.REMOVED.git-id | 1 + .../System.Configuration.dll.REMOVED.git-id | 1 + .../1051200002/System.Core.dll.REMOVED.git-id | 1 + .../System.Numerics.dll.REMOVED.git-id | 1 + .../System.Security.dll.REMOVED.git-id | 1 + .../System.Xml.Linq.dll.REMOVED.git-id | 0 .../1051200002/System.Xml.dll.REMOVED.git-id | 1 + .../1051200002/System.dll.REMOVED.git-id | 1 + .../1051200002/mcs.exe.REMOVED.git-id | 1 + .../1051200002/mscorlib.dll.REMOVED.git-id | 1 + .../System/Net/webclient.cs.REMOVED.git-id | 2 +- .../mscorlib/system/diagnostics/assert.cs | 8 +- .../mscorlib/system/exception.cs | 16 +- .../referencesource/mscorlib/system/gc.cs | 2 + .../mscorlib/system/missingmemberexception.cs | 9 +- .../exceptionservicescommon.cs | 4 + .../mscorlib/system/string.cs.REMOVED.git-id | 2 +- .../threading/synchronizationcontext.cs | 6 +- .../mscorlib/system/threading/threadpool.cs | 11 +- .../mscorlib/system/throwhelper.cs | 3 + .../mscorlib/system/timespan.cs | 6 + mcs/errors/cs0151-4.cs | 3 +- mcs/errors/cs0273-2.cs | 9 + mcs/errors/cs1013-1.cs | 8 + mcs/errors/cs1013-2.cs | 7 + mcs/errors/cs1021-4.cs | 8 + mcs/errors/cs1061-18.cs | 10 + mcs/errors/cs1527-2.cs | 2 +- mcs/errors/cs1527-3.cs | 2 +- mcs/errors/cs1527.cs | 5 +- mcs/errors/cs1644-61.cs | 11 + mcs/errors/cs1644-62.cs | 10 + mcs/errors/cs1763-2.cs | 2 +- mcs/errors/cs1763.cs | 2 +- mcs/errors/cs8326.cs | 13 + mcs/errors/cs8327.cs | 14 + mcs/errors/known-issues-net_4_x | 3 + mcs/ilasm/codegen/MethodDef.cs | 3 - mcs/ilasm/codegen/TypeDef.cs | 6 +- mcs/jay/closure.c | 39 +- mcs/jay/defs.h | 159 +- mcs/jay/error.c | 162 +- mcs/jay/lalr.c | 130 +- mcs/jay/lr0.c | 113 +- mcs/jay/main.c | 68 +- mcs/jay/mkpar.c | 92 +- mcs/jay/output.c | 192 +- mcs/jay/reader.c | 208 +- mcs/jay/symtab.c | 32 +- mcs/jay/verbose.c | 82 +- mcs/jay/warshall.c | 10 +- mcs/mcs/convert.cs | 7 + mcs/mcs/cs-parser.jay.REMOVED.git-id | 2 +- mcs/mcs/cs-tokenizer.cs | 4276 ----------------- mcs/mcs/cs-tokenizer.cs.REMOVED.git-id | 1 + mcs/mcs/ecore.cs.REMOVED.git-id | 2 +- mcs/mcs/expression.cs.REMOVED.git-id | 2 +- mcs/mcs/modifiers.cs | 50 +- mcs/mcs/parameter.cs | 4 +- mcs/mcs/tuples.cs | 1 + mcs/packages/Makefile | 8 +- mcs/tests/gtest-647.cs | 34 + mcs/tests/known-issues-interp-net_4_x | 2 - mcs/tests/test-948.cs | 12 +- mcs/tests/test-950.cs | 12 + mcs/tests/test-960.cs | 20 + mcs/tests/test-binaryliteral.cs | 57 + mcs/tests/test-decl-expr-06.cs | 17 + mcs/tests/test-default-01.cs | 14 +- mcs/tests/test-pattern-13.cs | 19 + mcs/tests/test-ref-11.cs | 13 + mcs/tests/test-tuple-08.cs | 24 + mcs/tests/ver-il-net_4_x.xml.REMOVED.git-id | 2 +- .../linker-analyzer/ConsoleDependencyGraph.cs | 146 - .../LinkerAnalyzerCore/DependencyGraph.cs | 118 - mcs/tools/linker-analyzer/Main.cs | 86 - mcs/tools/linker-analyzer/Makefile | 4 +- .../illinkanalyzer.exe.sources | 4 + .../linkeranalyzer.exe.sources | 5 - mcs/tools/linker/Makefile | 10 +- mcs/tools/linker/monolinker.exe.sources | 1 + .../Mono.DocTest.Generic/GenericBase`1.xml | 40 +- .../Mono.DocTest/Widget.xml | 40 +- .../Mono.DocTest.Generic/GenericBase`1.xml | 40 +- .../Mono.DocTest/Widget.xml | 40 +- .../Mono.DocTest.Generic/GenericBase`1.xml | 40 +- .../en.expected.since/Mono.DocTest/Widget.xml | 40 +- .../Mono.DocTest.Generic/GenericBase`1.xml | 40 +- .../Test/en.expected/Mono.DocTest/Widget.xml | 40 +- mcs/tools/mono-api-html/ClassComparer.cs | 7 +- mcs/tools/mono-api-html/MemberComparer.cs | 2 +- mcs/tools/security/README | 6 +- mcs/tools/sgen/sgen.cs | 14 +- .../xbuild/data/deniedAssembliesList.txt | 11 + mono/Makefile.am | 8 +- mono/Makefile.in | 31 +- mono/arch/Makefile.in | 23 +- mono/arch/amd64/Makefile.in | 23 +- mono/arch/arm/Makefile.in | 23 +- mono/arch/arm/arm-codegen.h | 1 + mono/arch/arm64/Makefile.in | 23 +- mono/arch/mips/Makefile.in | 23 +- mono/arch/ppc/Makefile.in | 23 +- mono/arch/s390x/Makefile.in | 23 +- mono/arch/sparc/Makefile.in | 23 +- mono/arch/x86/Makefile.in | 23 +- mono/benchmark/Makefile.in | 23 +- mono/btls/Makefile.in | 23 +- mono/cil/Makefile.in | 23 +- mono/dis/Makefile.am | 6 +- mono/dis/Makefile.in | 32 +- mono/dis/dump.c | 29 +- mono/dis/get.c.REMOVED.git-id | 2 +- mono/dis/main.c | 46 +- mono/eglib/Makefile.in | 23 +- mono/eglib/gdir-unix.c | 8 +- mono/eglib/gdir-win32.c | 12 +- mono/eglib/gerror.c | 16 +- mono/eglib/gfile-posix.c | 28 +- mono/eglib/gfile-unix.c | 13 + mono/eglib/gfile.c | 2 +- mono/eglib/giconv.c | 236 +- mono/eglib/glib.h | 79 +- mono/eglib/gmarkup.c | 63 +- mono/eglib/gshell.c | 24 +- mono/eglib/gspawn.c | 36 +- mono/eglib/gstr.c | 44 +- mono/eglib/gunicode.c | 12 +- mono/metadata/Makefile.am | 116 +- mono/metadata/Makefile.in.REMOVED.git-id | 2 +- mono/metadata/appdomain.c | 312 +- mono/metadata/assembly.c.REMOVED.git-id | 2 +- mono/metadata/attach.c | 46 +- mono/metadata/boehm-gc.c | 34 +- mono/metadata/class-internals.h | 38 +- mono/metadata/class.c.REMOVED.git-id | 2 +- mono/metadata/class.h | 8 + mono/metadata/cominterop.c.REMOVED.git-id | 2 +- mono/metadata/cominterop.h | 1 + mono/metadata/console-unix.c | 58 +- mono/metadata/coree.c | 10 +- mono/metadata/custom-attrs.c | 110 +- mono/metadata/debug-helpers.c | 51 +- mono/metadata/decimal-ms.c | 7 +- mono/metadata/domain-internals.h | 8 +- mono/metadata/domain.c | 59 +- mono/metadata/dynamic-image.c | 8 +- mono/metadata/exception.c | 150 +- mono/metadata/file-mmap-posix.c | 20 +- mono/metadata/file-mmap-windows.c | 26 +- mono/metadata/filewatcher.c | 12 +- mono/metadata/gc-internals.h | 18 +- mono/metadata/gc.c | 100 +- mono/metadata/handle.c | 10 +- mono/metadata/handle.h | 8 +- mono/metadata/icall-def.h | 23 +- mono/metadata/icall-table.c | 433 ++ mono/metadata/icall-table.h | 27 + mono/metadata/icall-windows.c | 8 +- mono/metadata/icall.c.REMOVED.git-id | 2 +- mono/metadata/image.c | 23 +- mono/metadata/jit-info.c | 61 +- mono/metadata/loader.c | 80 +- mono/metadata/locales.c | 160 +- mono/metadata/marshal-ilgen.c.REMOVED.git-id | 1 + mono/metadata/marshal-ilgen.h | 12 + mono/metadata/marshal-internals.h | 6 + mono/metadata/marshal-windows.c | 16 +- mono/metadata/marshal.c.REMOVED.git-id | 2 +- mono/metadata/marshal.h | 216 + mono/metadata/metadata-internals.h | 11 +- .../metadata/metadata-verify.c.REMOVED.git-id | 2 +- mono/metadata/metadata.c.REMOVED.git-id | 2 +- mono/metadata/metadata.h | 3 + .../metadata/method-builder-ilgen-internals.h | 33 + mono/metadata/method-builder-ilgen.c | 619 +++ mono/metadata/method-builder-ilgen.h | 125 + mono/metadata/method-builder-internals.h | 24 + mono/metadata/method-builder.c | 635 +-- mono/metadata/method-builder.h | 133 +- mono/metadata/mono-conc-hash.c | 12 +- mono/metadata/mono-conc-hash.h | 2 +- mono/metadata/mono-config.c | 24 +- mono/metadata/mono-gc.h | 83 +- mono/metadata/mono-hash.c | 18 +- mono/metadata/mono-hash.h | 2 +- mono/metadata/mono-mlist.c | 22 +- mono/metadata/mono-perfcounters.c | 173 +- mono/metadata/mono-perfcounters.h | 14 +- mono/metadata/mono-ptr-array.h | 8 +- mono/metadata/mono-route.c | 16 +- mono/metadata/mono-route.h | 1 + mono/metadata/mono-security-windows.c | 16 +- mono/metadata/mono-security.c | 18 +- mono/metadata/null-gc-handles.c | 4 +- mono/metadata/null-gc.c | 18 +- mono/metadata/object-forward.h | 13 + mono/metadata/object-internals.h | 45 +- mono/metadata/object-offsets.h | 13 +- mono/metadata/object.c.REMOVED.git-id | 2 +- mono/metadata/object.h | 13 + mono/metadata/profiler-events.h | 29 +- mono/metadata/profiler-private.h | 10 +- mono/metadata/profiler.c | 24 +- mono/metadata/profiler.h | 24 +- mono/metadata/rand.c | 6 +- mono/metadata/reflection-cache.h | 4 +- mono/metadata/reflection.c | 123 +- mono/metadata/remoting.c | 109 +- mono/metadata/remoting.h | 8 +- mono/metadata/runtime.c | 6 +- mono/metadata/security-core-clr.c | 26 +- mono/metadata/sgen-client-mono.h | 38 +- mono/metadata/sgen-mono-ilgen.c | 545 +++ mono/metadata/sgen-mono-ilgen.h | 13 + mono/metadata/sgen-mono.c | 1007 ++-- mono/metadata/sgen-mono.h | 20 + mono/metadata/sgen-stw.c | 13 +- mono/metadata/sre-encode.c | 6 +- mono/metadata/sre-save.c.REMOVED.git-id | 2 +- mono/metadata/sre.c.REMOVED.git-id | 2 +- mono/metadata/string-icalls.c | 12 +- mono/metadata/threadpool-io.c | 43 +- mono/metadata/threadpool-worker-default.c | 123 +- mono/metadata/threadpool-worker-wasm.c | 77 + mono/metadata/threadpool.c | 44 +- mono/metadata/threadpool.h | 2 + mono/metadata/threads-types.h | 27 +- mono/metadata/threads.c.REMOVED.git-id | 2 +- mono/metadata/verify.c.REMOVED.git-id | 2 +- mono/metadata/w32error-unix.c | 5 + mono/metadata/w32file-unix.c.REMOVED.git-id | 2 +- mono/metadata/w32file-win32.c | 10 - mono/metadata/w32file.c | 8 +- mono/metadata/w32file.h | 3 - mono/metadata/w32handle.c | 144 +- mono/metadata/w32mutex-unix.c | 9 +- mono/metadata/w32mutex.h | 2 +- mono/metadata/w32process-unix-bsd.c | 1 + .../metadata/w32process-unix.c.REMOVED.git-id | 2 +- mono/metadata/w32process-win32.c | 8 +- mono/metadata/w32process.c | 44 +- mono/mini/Makefile.am | 95 +- mono/mini/Makefile.am.in | 95 +- mono/mini/Makefile.in.REMOVED.git-id | 2 +- mono/mini/aot-compiler.c.REMOVED.git-id | 2 +- mono/mini/aot-runtime-wasm.c | 17 +- mono/mini/aot-runtime.c.REMOVED.git-id | 2 +- mono/mini/aot-tests.cs | 1 + mono/mini/branch-opts.c | 1 + mono/mini/builtin-types.cs | 23 +- mono/mini/debug-mini.c | 13 +- mono/mini/debugger-agent.c.REMOVED.git-id | 2 +- mono/mini/decompose.c | 6 +- mono/mini/driver.c | 130 +- mono/mini/dwarfwriter.c | 34 +- mono/mini/ee.h | 59 + mono/mini/exceptions-amd64.c | 23 +- mono/mini/exceptions-arm.c | 6 +- mono/mini/exceptions-arm64.c | 6 +- mono/mini/exceptions-mips.c | 6 +- mono/mini/exceptions-ppc.c | 6 +- mono/mini/exceptions-s390x.c | 6 +- mono/mini/exceptions-sparc.c | 6 +- mono/mini/exceptions-x86.c | 26 +- mono/mini/genmdesc.py | 3 +- mono/mini/gshared.cs | 24 + mono/mini/interp-stubs.c | 10 +- mono/mini/interp/interp-internals.h | 3 - mono/mini/interp/interp.c.REMOVED.git-id | 2 +- mono/mini/interp/interp.h | 45 +- mono/mini/interp/mintops.def | 8 + mono/mini/interp/transform.c.REMOVED.git-id | 2 +- mono/mini/ir-emit.h | 4 +- mono/mini/jit-icalls.c | 288 +- mono/mini/main.c | 58 + mono/mini/method-to-ir.c.REMOVED.git-id | 2 +- mono/mini/mini-amd64-gsharedvt.c | 2 + mono/mini/mini-amd64-gsharedvt.h | 14 - mono/mini/mini-amd64.c.REMOVED.git-id | 2 +- mono/mini/mini-amd64.h | 17 +- mono/mini/mini-arm.c.REMOVED.git-id | 2 +- mono/mini/mini-arm.h | 19 +- mono/mini/mini-arm64.c.REMOVED.git-id | 2 +- mono/mini/mini-arm64.h | 11 + mono/mini/mini-codegen.c | 1 + mono/mini/mini-darwin.c | 1 + mono/mini/mini-exceptions.c | 3436 +++++++++++++ mono/mini/mini-exceptions.c.REMOVED.git-id | 1 - mono/mini/mini-gc.c | 1 + .../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-posix.c | 24 + mono/mini/mini-ppc.c.REMOVED.git-id | 2 +- mono/mini/mini-ppc.h | 34 +- mono/mini/mini-profiler.c | 6 +- mono/mini/mini-runtime.c.REMOVED.git-id | 2 +- mono/mini/mini-runtime.h | 306 +- mono/mini/mini-s390x.c.REMOVED.git-id | 2 +- mono/mini/mini-sparc.c.REMOVED.git-id | 2 +- mono/mini/mini-trampolines.c | 104 +- mono/mini/mini-wasm.h | 3 + mono/mini/mini-x86.c.REMOVED.git-id | 2 +- mono/mini/mini-x86.h | 1 - mono/mini/mini.c.REMOVED.git-id | 2 +- mono/mini/mini.h.REMOVED.git-id | 2 +- mono/mini/objects.cs | 24 + mono/mini/simd-intrinsics.c | 7 +- mono/mini/ssa.c | 1 + mono/mini/tasklets.c | 2 +- mono/mini/trace.c | 9 +- mono/mini/tramp-amd64.c | 161 +- mono/mini/tramp-arm-gsharedvt.c | 1 + mono/mini/tramp-arm.c | 167 +- mono/mini/tramp-arm64.c | 143 +- mono/mini/tramp-ppc.c | 2 +- mono/mini/tramp-s390x.c | 4 +- mono/mini/tramp-wasm.c | 6 +- mono/mini/tramp-x86.c | 4 +- mono/mini/type-checking.c | 14 +- mono/mini/version.h | 2 +- mono/mini/wasm_m2n_invoke.g.h | 28 + mono/mini/xdebug.c | 1 + mono/profiler/Makefile.in | 23 +- mono/profiler/aot.c | 7 +- mono/profiler/coverage.c | 312 +- mono/profiler/log.c.REMOVED.git-id | 2 +- mono/profiler/log.h | 50 +- mono/profiler/mprof-report.c.REMOVED.git-id | 2 +- mono/sgen/Makefile.am | 15 - mono/sgen/Makefile.in | 290 +- mono/sgen/sgen-client.h | 31 +- mono/sgen/sgen-debug.c | 6 +- mono/sgen/sgen-descriptor.h | 1 + mono/sgen/sgen-gc.c.REMOVED.git-id | 2 +- mono/sgen/sgen-gc.h | 8 +- mono/sgen/sgen-gchandles.c | 29 +- mono/sgen/sgen-marksweep.c | 1 + mono/sgen/sgen-pinning.c | 2 + mono/tests/Makefile.am | 62 +- mono/tests/Makefile.in.REMOVED.git-id | 2 +- mono/tests/bug-59400.cs | 96 + mono/tests/bug-60848.cs | 66 + mono/tests/bug-60862.cs | 54 + mono/tests/dim-constrainedcall.il | 456 ++ mono/tests/dim-diamondshape.il | 944 ++++ mono/tests/dim-genericmethods.il | 357 ++ mono/tests/dim-methodimpl.il | 1677 +++++++ mono/tests/dim-sharedgenerics.il | 275 ++ mono/tests/dim-simple.il | 397 ++ mono/tests/dim-valuetypes.il | 252 + mono/tests/even-odd.il | 2 +- mono/tests/gc-descriptors/Makefile.in | 23 +- mono/tests/libtest.c.REMOVED.git-id | 2 +- mono/tests/test-runner.cs | 22 +- mono/tests/testing_gac/Makefile.in | 23 +- mono/tests/threads-init.cs | 29 + mono/tests/{vararg.il => vararg3.il} | 0 mono/unit-tests/Makefile.am | 30 +- mono/unit-tests/Makefile.in | 229 +- mono/unit-tests/test-mono-callspec.c | 7 +- mono/unit-tests/test-mono-string.c | 65 + mono/unit-tests/test-sgen-qsort.c | 4 +- mono/utils/Makefile.am | 11 + mono/utils/Makefile.in | 1170 ----- mono/utils/Makefile.in.REMOVED.git-id | 1 + mono/utils/checked-build.c | 4 +- mono/utils/jemalloc/Makefile.am | 49 + mono/utils/jemalloc/Makefile.in | 721 +++ mono/utils/jemalloc/SUBMODULES.json | 10 + mono/utils/mono-context.c | 42 + mono/utils/mono-context.h | 22 +- mono/utils/mono-counters.c | 7 + mono/utils/mono-dl-posix.c | 12 + mono/utils/mono-error-internals.h | 98 +- mono/utils/mono-error.c | 23 +- mono/utils/mono-error.h | 14 +- mono/utils/mono-hwcap-ppc.c | 14 + mono/utils/mono-jemalloc.c | 19 + mono/utils/mono-jemalloc.h | 36 + mono/utils/mono-machine.h | 11 + mono/utils/mono-mmap.c | 3 +- mono/utils/mono-proclib.c | 41 +- mono/utils/mono-sigcontext.h | 7 + mono/utils/mono-stack-unwinding.h | 9 + mono/utils/mono-threads-aix.c | 41 + mono/utils/mono-threads-openbsd.c | 14 +- mono/utils/mono-threads-wasm.c | 34 +- mono/utils/mono-threads.c | 10 +- mono/utils/mono-threads.h | 8 +- mono/utils/mono-time.c | 83 +- mono/utils/networking-posix.c | 3 + msvc/Makefile.in | 23 +- po/Makefile.in | 23 +- 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 | 288 +- po/mcs/pt_BR.gmo | Bin 72806 -> 72806 bytes po/mcs/pt_BR.po.REMOVED.git-id | 2 +- runtime/Makefile.in | 23 +- samples/Makefile.in | 23 +- scripts/Makefile.am | 7 + scripts/Makefile.in | 31 +- scripts/csc-dim.in | 2 + scripts/mono-package-runtime | 6 +- support/Makefile.in | 23 +- support/fstab.c | 20 + support/serial.c | 8 +- support/signal.c | 12 + support/sys-stat.c | 37 +- support/sys-statvfs.c | 12 + support/sys-time.c | 14 +- support/syslog.c | 10 + support/time.c | 5 + support/unistd.c | 10 + tools/Makefile.in | 23 +- tools/locale-builder/Makefile.in | 23 +- tools/monograph/Makefile.am | 2 +- tools/monograph/Makefile.in | 27 +- tools/pedump/Makefile.am | 4 +- tools/pedump/Makefile.in | 31 +- tools/pedump/pedump.c | 34 +- tools/sgen/Makefile.in | 23 +- winconfig.h | 3 + 1200 files changed, 29534 insertions(+), 26161 deletions(-) delete mode 100644 external/api-snapshot/profiles/Makefile delete mode 100644 external/api-snapshot/profiles/ecma.pub create mode 100644 external/api-snapshot/profiles/monodroid/Facades/System.Resources.Reader.cs create mode 100644 external/api-snapshot/profiles/monodroid/Facades/System.Resources.Writer.cs create mode 100644 external/api-snapshot/profiles/monotouch/Facades/System.Resources.Reader.cs create mode 100644 external/api-snapshot/profiles/monotouch/Facades/System.Resources.Writer.cs delete mode 100644 external/api-snapshot/profiles/msfinal.pub create mode 100644 external/api-snapshot/profiles/net_4_x/Facades/System.Net.Http.Rtc.cs create mode 100644 external/api-snapshot/profiles/net_4_x/Facades/System.Net.Ping.cs create mode 100644 external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Reader.cs create mode 100644 external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Writer.cs create mode 100644 external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Formatters.cs create mode 100644 external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Csp.cs delete mode 100644 external/api-snapshot/profiles/silverlight.pub delete mode 100644 external/linker/Contributing.md create mode 100644 external/linker/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs create mode 100644 external/linker/corebuild/integration/ILLink.Tasks/AdapterLogger.cs create mode 100644 external/linker/corebuild/integration/test/CommandRunner.cs create mode 100644 external/linker/linker/Linker.Steps/RemoveSecurityStep.cs rename external/linker/linker/{README => README.md} (72%) delete mode 100644 external/linker/linker/Tests/Extensions/CecilExtensions.cs delete mode 100644 external/linker/linker/Tests/Extensions/NiceIO.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedForwarderAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerActionAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerCoreActionAttribute.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/FieldsOfTypeMarkedSequentialLayoutAreNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/UnusedTypeWithSequentialLayoutIsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Forwarder.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsProcessed.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/ILAssemblySample.il delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyResourceInAssemblyAttributesBehavior.txt delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromInterfaceHasInterfaceMethodKept.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UnusedVirtualMethodRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UsedVirtualMethodNotRemoved.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs delete mode 100644 external/linker/linker/Tests/Mono.Linker.Tests.csproj delete mode 100644 external/linker/linker/Tests/TestCases/IndividualTests.cs delete mode 100644 external/linker/linker/Tests/TestCases/TestCase.cs delete mode 100644 external/linker/linker/Tests/TestCases/TestDatabase.cs delete mode 100644 external/linker/linker/Tests/TestCases/TestSuites.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/AssemblyChecker.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/CompilerOptions.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/ExpectationsProvider.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/ILCompiler.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/LinkXmlHelpers.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/LinkedTestCaseResult.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/LinkerArgumentBuilder.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/LinkerDriver.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/ManagedCompilationResult.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/ObjectFactory.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/PeVerifier.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/ResultChecker.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/SetupCompileInfo.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/SourceAndDestinationPair.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/TestCaseCollector.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/TestCaseCompiler.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/TestCaseLinkerOptions.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/TestCaseSandbox.cs delete mode 100644 external/linker/linker/Tests/TestCasesRunner/TestRunner.cs delete mode 100644 external/linker/linker/Tests/Tests/PreserveActionComparisonTests.cs delete mode 100644 external/linker/linker/Tests/packages.config create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.CSharp.dll.REMOVED.git-id create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.dll.REMOVED.git-id create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Collections.Immutable.dll.REMOVED.git-id create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Reflection.Metadata.dll.REMOVED.git-id create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe.config create mode 100644 external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.rsp delete mode 100644 libgc/include/private/openbsd_stop_world.h delete mode 100644 libgc/openbsd_stop_world.c create mode 100644 m4/ax_check_compile_flag.m4 create mode 100644 man/illinkanalyzer.1 create mode 100644 mcs/class/Facades/System.Net.Http.Rtc/AssemblyInfo.cs create mode 100644 mcs/class/Facades/System.Net.Http.Rtc/Makefile create mode 100644 mcs/class/Facades/System.Net.Http.Rtc/System.Net.Http.Rtc.dll.sources rename mcs/class/{System/System.Net/IWebConnectionState.cs => Facades/System.Net.Http.Rtc/TypeForwarders.cs} (71%) create mode 100644 mcs/class/Facades/System.Resources.Reader/AssemblyInfo.cs create mode 100644 mcs/class/Facades/System.Resources.Reader/Makefile create mode 100644 mcs/class/Facades/System.Resources.Reader/System.Resources.Reader.dll.sources create mode 100644 mcs/class/Facades/System.Resources.Reader/TypeForwarders.cs create mode 100644 mcs/class/Facades/System.Resources.Writer/AssemblyInfo.cs create mode 100644 mcs/class/Facades/System.Resources.Writer/Makefile create mode 100644 mcs/class/Facades/System.Resources.Writer/System.Resources.Writer.dll.sources create mode 100644 mcs/class/Facades/System.Resources.Writer/TypeForwarders.cs create mode 100644 mcs/class/I18N/Rare/CP737.cs create mode 100644 mcs/class/I18N/Rare/CP775.cs create mode 100644 mcs/class/I18N/Rare/ibm-737.ucm create mode 100644 mcs/class/I18N/Rare/ibm-775.ucm delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/Manifest.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/X509IssuerSerial.cs delete mode 100644 mcs/class/System.Security/System.Security.Cryptography.Xml/XmlSignature.cs create mode 100644 mcs/class/System/System.Net/ServicePointScheduler.cs delete mode 100644 mcs/class/System/System.Net/SimpleAsyncResult.cs delete mode 100644 mcs/class/System/System.Net/WebAsyncResult.cs create mode 100644 mcs/class/System/System.Net/WebCompletionSource.cs delete mode 100644 mcs/class/System/System.Net/WebConnectionData.cs delete mode 100644 mcs/class/System/System.Net/WebConnectionGroup.cs create mode 100644 mcs/class/System/System.Net/WebConnectionTunnel.cs create mode 100644 mcs/class/System/System.Net/WebOperation.cs create mode 100644 mcs/class/System/System.Net/WebRequestStream.cs create mode 100644 mcs/class/System/System.Net/WebResponseStream.cs create mode 100644 mcs/class/System/Test/System.Threading/WaitHandleTests.cs rename mcs/class/corlib/System.Security.Cryptography/{CryptoConfig.fullaot.cs => CryptoConfig.Mobile.cs} (90%) delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/Mono.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/System.Configuration.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/System.Core.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/System.Numerics.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/System.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/System.Xml.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/System.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/mcs.exe.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-darwin/1051000004/mscorlib.dll.REMOVED.git-id rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Collections.Concurrent.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Collections.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Diagnostics.Debug.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Diagnostics.FileVersionInfo.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Diagnostics.Tools.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Dynamic.Runtime.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Globalization.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.IO.FileSystem.Primitives.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.IO.FileSystem.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.IO.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Linq.Expressions.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Linq.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Reflection.Extensions.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Reflection.Primitives.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Reflection.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Resources.ResourceManager.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Runtime.Extensions.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Runtime.InteropServices.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Runtime.Numerics.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Runtime.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Security.Cryptography.Algorithms.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Security.Cryptography.Primitives.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Text.Encoding.CodePages.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Text.Encoding.Extensions.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Text.Encoding.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Threading.Tasks.Parallel.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Threading.Tasks.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Threading.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.ValueTuple.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Xml.ReaderWriter.dll (100%) rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/Facades/System.Xml.XDocument.dll (100%) create mode 100644 mcs/class/lib/monolite-darwin/1051200002/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/System.Core.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/System.Security.dll.REMOVED.git-id rename mcs/class/lib/monolite-darwin/{1051000004 => 1051200002}/System.Xml.Linq.dll.REMOVED.git-id (100%) create mode 100644 mcs/class/lib/monolite-darwin/1051200002/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-darwin/1051200002/mscorlib.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/Mono.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/System.Configuration.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/System.Core.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/System.Numerics.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/System.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/System.Xml.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/System.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/mcs.exe.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-linux/1051000004/mscorlib.dll.REMOVED.git-id rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Collections.Concurrent.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Collections.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Diagnostics.Debug.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Diagnostics.FileVersionInfo.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Diagnostics.Tools.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Dynamic.Runtime.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Globalization.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.IO.FileSystem.Primitives.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.IO.FileSystem.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.IO.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Linq.Expressions.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Linq.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Reflection.Extensions.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Reflection.Primitives.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Reflection.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Resources.ResourceManager.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Runtime.Extensions.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Runtime.InteropServices.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Runtime.Numerics.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Runtime.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Security.Cryptography.Algorithms.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Security.Cryptography.Primitives.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Text.Encoding.CodePages.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Text.Encoding.Extensions.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Text.Encoding.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Threading.Tasks.Parallel.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Threading.Tasks.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Threading.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.ValueTuple.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Xml.ReaderWriter.dll (100%) rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/Facades/System.Xml.XDocument.dll (100%) create mode 100644 mcs/class/lib/monolite-linux/1051200002/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/System.Core.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/System.Security.dll.REMOVED.git-id rename mcs/class/lib/monolite-linux/{1051000004 => 1051200002}/System.Xml.Linq.dll.REMOVED.git-id (100%) create mode 100644 mcs/class/lib/monolite-linux/1051200002/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-linux/1051200002/mscorlib.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/Mono.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/System.Configuration.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/System.Core.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/System.Numerics.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/System.Security.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/System.Xml.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/System.dll.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/mcs.exe.REMOVED.git-id delete mode 100644 mcs/class/lib/monolite-win32/1051000004/mscorlib.dll.REMOVED.git-id rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Collections.Concurrent.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Collections.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Diagnostics.Debug.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Diagnostics.FileVersionInfo.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Diagnostics.Tools.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Dynamic.Runtime.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Globalization.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.IO.FileSystem.Primitives.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.IO.FileSystem.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.IO.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Linq.Expressions.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Linq.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Reflection.Extensions.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Reflection.Primitives.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Reflection.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Resources.ResourceManager.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Runtime.Extensions.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Runtime.InteropServices.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Runtime.Numerics.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Runtime.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Security.Cryptography.Algorithms.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Security.Cryptography.Primitives.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Text.Encoding.CodePages.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Text.Encoding.Extensions.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Text.Encoding.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Threading.Tasks.Parallel.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Threading.Tasks.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Threading.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.ValueTuple.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Xml.ReaderWriter.dll (100%) rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/Facades/System.Xml.XDocument.dll (100%) create mode 100644 mcs/class/lib/monolite-win32/1051200002/Mono.Security.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/System.Configuration.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/System.Core.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/System.Numerics.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/System.Security.dll.REMOVED.git-id rename mcs/class/lib/monolite-win32/{1051000004 => 1051200002}/System.Xml.Linq.dll.REMOVED.git-id (100%) create mode 100644 mcs/class/lib/monolite-win32/1051200002/System.Xml.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/System.dll.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/mcs.exe.REMOVED.git-id create mode 100644 mcs/class/lib/monolite-win32/1051200002/mscorlib.dll.REMOVED.git-id create mode 100644 mcs/errors/cs0273-2.cs create mode 100644 mcs/errors/cs1013-1.cs create mode 100644 mcs/errors/cs1013-2.cs create mode 100644 mcs/errors/cs1021-4.cs create mode 100644 mcs/errors/cs1061-18.cs create mode 100644 mcs/errors/cs1644-61.cs create mode 100644 mcs/errors/cs1644-62.cs create mode 100644 mcs/errors/cs8326.cs create mode 100644 mcs/errors/cs8327.cs delete mode 100644 mcs/mcs/cs-tokenizer.cs create mode 100644 mcs/mcs/cs-tokenizer.cs.REMOVED.git-id create mode 100644 mcs/tests/gtest-647.cs create mode 100644 mcs/tests/test-950.cs create mode 100644 mcs/tests/test-960.cs create mode 100644 mcs/tests/test-binaryliteral.cs create mode 100644 mcs/tests/test-decl-expr-06.cs create mode 100644 mcs/tests/test-pattern-13.cs create mode 100644 mcs/tests/test-ref-11.cs create mode 100644 mcs/tests/test-tuple-08.cs delete mode 100644 mcs/tools/linker-analyzer/ConsoleDependencyGraph.cs delete mode 100644 mcs/tools/linker-analyzer/LinkerAnalyzerCore/DependencyGraph.cs delete mode 100644 mcs/tools/linker-analyzer/Main.cs create mode 100644 mcs/tools/linker-analyzer/illinkanalyzer.exe.sources delete mode 100644 mcs/tools/linker-analyzer/linkeranalyzer.exe.sources create mode 100644 mono/metadata/icall-table.c create mode 100644 mono/metadata/icall-table.h create mode 100644 mono/metadata/marshal-ilgen.c.REMOVED.git-id create mode 100644 mono/metadata/marshal-ilgen.h create mode 100644 mono/metadata/method-builder-ilgen-internals.h create mode 100644 mono/metadata/method-builder-ilgen.c create mode 100644 mono/metadata/method-builder-ilgen.h create mode 100644 mono/metadata/method-builder-internals.h create mode 100644 mono/metadata/object-forward.h create mode 100644 mono/metadata/sgen-mono-ilgen.c create mode 100644 mono/metadata/sgen-mono-ilgen.h create mode 100644 mono/metadata/sgen-mono.h create mode 100644 mono/metadata/threadpool-worker-wasm.c create mode 100644 mono/mini/ee.h mode change 100644 => 100755 mono/mini/genmdesc.py create mode 100644 mono/mini/mini-exceptions.c delete mode 100644 mono/mini/mini-exceptions.c.REMOVED.git-id create mode 100644 mono/tests/bug-59400.cs create mode 100644 mono/tests/bug-60848.cs create mode 100644 mono/tests/bug-60862.cs create mode 100644 mono/tests/dim-constrainedcall.il create mode 100644 mono/tests/dim-diamondshape.il create mode 100644 mono/tests/dim-genericmethods.il create mode 100644 mono/tests/dim-methodimpl.il create mode 100644 mono/tests/dim-sharedgenerics.il create mode 100644 mono/tests/dim-simple.il create mode 100644 mono/tests/dim-valuetypes.il create mode 100644 mono/tests/threads-init.cs rename mono/tests/{vararg.il => vararg3.il} (100%) create mode 100644 mono/unit-tests/test-mono-string.c delete mode 100644 mono/utils/Makefile.in create mode 100644 mono/utils/Makefile.in.REMOVED.git-id create mode 100644 mono/utils/jemalloc/Makefile.am create mode 100644 mono/utils/jemalloc/Makefile.in create mode 100644 mono/utils/jemalloc/SUBMODULES.json create mode 100644 mono/utils/mono-jemalloc.c create mode 100644 mono/utils/mono-jemalloc.h create mode 100644 mono/utils/mono-threads-aix.c create mode 100644 scripts/csc-dim.in diff --git a/Makefile.am b/Makefile.am index 12b27f14b0..5976e456b4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,6 +44,7 @@ dist-hook: rm -rf `find $(top_distdir)/external -path '*\.git'` rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'` rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*'` + rm -rf "$(top_distdir)/external/linker/linker/Tests" pkgconfigdir = $(libdir)/pkgconfig noinst_DATA = mono-uninstalled.pc @@ -114,7 +115,7 @@ update-csproj: -rm msvc/scripts/order.xml -rm -rf msvc/scripts/inputs -mkdir msvc/scripts/inputs - (cd runtime; make V=1 extra_targets=csproj-local) + (cd runtime; $(MAKE) V=1 extra_targets=csproj-local) package-inputs: echo '' > msvc/scripts/order.xml @@ -143,9 +144,9 @@ update-llvm-version: update-solution-files: - make update-csproj - make package-inputs - (cd msvc/scripts; make genproj.exe; mono genproj.exe $(GENPROJ_ARGS)) + $(MAKE) update-csproj + $(MAKE) package-inputs + (cd msvc/scripts; $(MAKE) genproj.exe; mono genproj.exe $(GENPROJ_ARGS)) update-solution-files-with-tests: - make "GENPROJ_ARGS=2012 true true" update-solution-files + $(MAKE) "GENPROJ_ARGS=2012 true true" update-solution-files diff --git a/Makefile.in b/Makefile.in index 9c6afa43c4..a0ff1c491a 100644 --- a/Makefile.in +++ b/Makefile.in @@ -87,14 +87,14 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ config.guess config.rpath config.sub install-sh missing \ ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ @@ -286,6 +286,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -314,6 +318,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -965,6 +972,7 @@ dist-hook: rm -rf `find $(top_distdir)/external -path '*\.git'` rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'` rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*'` + rm -rf "$(top_distdir)/external/linker/linker/Tests" # building with monolite .PHONY: get-monolite-latest @@ -1024,7 +1032,7 @@ update-csproj: -rm msvc/scripts/order.xml -rm -rf msvc/scripts/inputs -mkdir msvc/scripts/inputs - (cd runtime; make V=1 extra_targets=csproj-local) + (cd runtime; $(MAKE) V=1 extra_targets=csproj-local) package-inputs: echo '' > msvc/scripts/order.xml @@ -1052,12 +1060,12 @@ 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: - make update-csproj - make package-inputs - (cd msvc/scripts; make genproj.exe; mono genproj.exe $(GENPROJ_ARGS)) + $(MAKE) update-csproj + $(MAKE) package-inputs + (cd msvc/scripts; $(MAKE) genproj.exe; mono genproj.exe $(GENPROJ_ARGS)) update-solution-files-with-tests: - make "GENPROJ_ARGS=2012 true true" update-solution-files + $(MAKE) "GENPROJ_ARGS=2012 true true" update-solution-files # 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/README.md b/README.md index 9ba3c4fc98..09f2613f79 100644 --- a/README.md +++ b/README.md @@ -19,30 +19,30 @@ The Mono project is part of the [.NET Foundation](http://www.dotnetfoundation.or | OS | Architecture | Status | |--------------|--------------------|------------------------------| -| Ubuntu 14.04 | amd64 | [![ubuntu-1404-amd64][1]][2] | -| Ubuntu 14.04 | i386 | [![ubuntu-1404-i386][3]][4] | -| Debian 8 | armel | [![debian-8-armel][5]][6] | -| Debian 8 | armhf | [![debian-8-armhf][7]][8] | -| Debian 8 | arm64 | [![debian-8-arm64][9]][10] | +| Debian 9 | amd64 | [![debian-9-amd64][1]][2] | +| Debian 9 | i386 | [![debian-9-i386][3]][4] | +| Debian 9 | armel | [![debian-9-armel][5]][6] | +| Debian 9 | armhf | [![debian-9-armhf][7]][8] | +| Debian 9 | arm64 | [![debian-9-arm64][9]][10] | | OS X | amd64 | [![osx-amd64][11]][12] | | OS X | i386 | [![osx-i386][13]][14] | | Windows | amd64 | [![windows-amd64][15]][16] | -| Windows | i386 | [![windows-amd64][17]][18] | +| Windows | i386 | [![windows-i386][17]][18] | | CentOS | s390x (cs) | [![centos-s390x][19]][20] | | Debian 8 | ppc64el (cs) | [![debian-8-ppc64el][21]][22]| _(cs) = community supported architecture_ -[1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64/badge/icon -[2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-amd64 -[3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/badge/icon -[4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=ubuntu-1404-i386/ -[5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/badge/icon -[6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armel/ -[7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/badge/icon -[8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-armhf/ -[9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/badge/icon -[10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-8-arm64/ +[1]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64/badge/icon +[2]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-amd64 +[3]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/badge/icon +[4]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-i386/ +[5]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/badge/icon +[6]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armel/ +[7]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/badge/icon +[8]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-armhf/ +[9]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/badge/icon +[10]: https://jenkins.mono-project.com/job/test-mono-mainline-linux/label=debian-9-arm64/ [11]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/badge/icon [12]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-amd64/ [13]: https://jenkins.mono-project.com/job/test-mono-mainline/label=osx-i386/badge/icon @@ -174,8 +174,7 @@ section. Reporting bugs ============== -To submit bug reports, please use [Xamarin's -Bugzilla](https://bugzilla.xamarin.com/) +To submit bug reports, please [open an issue on the mono GitHub repo](https://github.com/mono/mono/issues/new). Please use the search facility to ensure the same bug hasn't already been submitted and follow our @@ -542,7 +541,7 @@ file for information about Microsoft's patent grant. Mono Trademark Use Policy ========================= -The use of trademarks and logos for Mono can be found [here] (http://www.dotnetfoundation.org/legal/mono-tm). +The use of trademarks and logos for Mono can be found [here](http://www.dotnetfoundation.org/legal/mono-tm). Maintaining the Class Library Solution Files ============================================ diff --git a/acceptance-tests/Makefile.in.REMOVED.git-id b/acceptance-tests/Makefile.in.REMOVED.git-id index 2cface7357..346758c2a8 100644 --- a/acceptance-tests/Makefile.in.REMOVED.git-id +++ b/acceptance-tests/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -1f1cceb22b20c4572e28fe691242ed1310de17b6 \ No newline at end of file +9196f4b94d89c752be303d5fd83b1fe324a94e16 \ 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 8f6757275d..24fc4e461e 100644 --- a/acceptance-tests/coreclr.mk.REMOVED.git-id +++ b/acceptance-tests/coreclr.mk.REMOVED.git-id @@ -1 +1 @@ -4cc234e1abb16add35f675272bf36aa78fb4f1b9 \ No newline at end of file +8ee906d13b88beee5805c9fd4e7e8fbfd7e7063d \ No newline at end of file diff --git a/aclocal.m4 b/aclocal.m4 index ae4bfc4914..de1772c2f2 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1203,6 +1203,7 @@ AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR +m4_include([m4/ax_check_compile_flag.m4]) m4_include([m4/iconv.m4]) m4_include([m4/lib-ld.m4]) m4_include([m4/lib-link.m4]) diff --git a/config.h.in b/config.h.in index 90d71a108f..74ae8bf4f0 100644 --- a/config.h.in +++ b/config.h.in @@ -146,6 +146,9 @@ /* Icall symbol map enabled */ #undef ENABLE_ICALL_SYMBOL_MAP +/* Some VES is available at runtime */ +#undef ENABLE_ILGEN + /* Enable the LLVM back end */ #undef ENABLE_LLVM @@ -219,6 +222,12 @@ /* Use classic Windows API support */ #undef HAVE_CLASSIC_WINAPI_SUPPORT +/* CLOCK_MONOTONIC */ +#undef HAVE_CLOCK_MONOTONIC + +/* CLOCK_MONOTONIC_COARSE */ +#undef HAVE_CLOCK_MONOTONIC_COARSE + /* Define to 1 if you have the `clock_nanosleep' function. */ #undef HAVE_CLOCK_NANOSLEEP @@ -383,6 +392,9 @@ /* Define to 1 if you have the `gethostid' function. */ #undef HAVE_GETHOSTID +/* gethrtime */ +#undef HAVE_GETHRTIME + /* Have getifaddrs */ #undef HAVE_GETIFADDRS @@ -533,6 +545,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_MACHINE_ENDIAN_H +/* mach_absolute_time */ +#undef HAVE_MACH_ABSOLUTE_TIME + /* Define to 1 if you have the `madvise' function. */ #undef HAVE_MADVISE @@ -657,6 +672,9 @@ /* Define to 1 if you have the `readv' function. */ #undef HAVE_READV +/* read_real_time */ +#undef HAVE_READ_REAL_TIME + /* Define to 1 if you have the `remap_file_pages' function. */ #undef HAVE_REMAP_FILE_PAGES @@ -843,6 +861,9 @@ /* Define to 1 if `st_atim' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_ATIM +/* Define to 1 if `st_atimespec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIMESPEC + /* Define to 1 if `st_ctim' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_CTIM @@ -1047,6 +1068,9 @@ /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF +/* Define to 1 if you have the `vsyslog' function. */ +#undef HAVE_VSYSLOG + /* Define to 1 if you have the header file. */ #undef HAVE_WCHAR_H @@ -1146,6 +1170,15 @@ /* Disable banned functions from being used by the runtime */ #undef MONO_INSIDE_RUNTIME +/* Make jemalloc assert for mono */ +#undef MONO_JEMALLOC_ASSERT + +/* Make jemalloc default for mono */ +#undef MONO_JEMALLOC_DEFAULT + +/* Enable jemalloc usage for mono */ +#undef MONO_JEMALLOC_ENABLED + /* The LLVM back end is dynamically loaded */ #undef MONO_LLVM_LOADED diff --git a/configure.REMOVED.git-id b/configure.REMOVED.git-id index 51267ddba7..56e6251c0f 100644 --- a/configure.REMOVED.git-id +++ b/configure.REMOVED.git-id @@ -1 +1 @@ -31c9c0c18d9cc40bd2b449ac26706c7f885740a0 \ No newline at end of file +a702007e45ef02d80b53178a93f12a0e4161387a \ No newline at end of file diff --git a/configure.ac.REMOVED.git-id b/configure.ac.REMOVED.git-id index ea91ace4a2..e8a05c2911 100644 --- a/configure.ac.REMOVED.git-id +++ b/configure.ac.REMOVED.git-id @@ -1 +1 @@ -655f1b7536d2075ab15a6a2e57533b0ecdf93c10 \ No newline at end of file +f46a6ca9ae078dba035c97088989d5ebd33252b1 \ No newline at end of file diff --git a/data/Makefile.in b/data/Makefile.in index 583d89ff9d..7d705db3ad 100644 --- a/data/Makefile.in +++ b/data/Makefile.in @@ -94,14 +94,14 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/system.web.mvc3.pc.in $(srcdir)/aspnetwebstack.pc.in \ $(srcdir)/reactive.pc.in $(srcdir)/config.in README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -309,6 +309,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -337,6 +341,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/data/net_2_0/Browsers/Makefile.in b/data/net_2_0/Browsers/Makefile.in index 052c7f110f..bdc22ae982 100644 --- a/data/net_2_0/Browsers/Makefile.in +++ b/data/net_2_0/Browsers/Makefile.in @@ -83,14 +83,14 @@ subdir = data/net_2_0/Browsers DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -231,6 +231,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -259,6 +263,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/data/net_2_0/Makefile.in b/data/net_2_0/Makefile.in index 8e8c03e234..d5d040c5a8 100644 --- a/data/net_2_0/Makefile.in +++ b/data/net_2_0/Makefile.in @@ -83,14 +83,14 @@ subdir = data/net_2_0 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -291,6 +291,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -319,6 +323,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/data/net_4_0/Browsers/Makefile.in b/data/net_4_0/Browsers/Makefile.in index d65f4ba585..c6edc0471b 100644 --- a/data/net_4_0/Browsers/Makefile.in +++ b/data/net_4_0/Browsers/Makefile.in @@ -83,14 +83,14 @@ subdir = data/net_4_0/Browsers DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -231,6 +231,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -259,6 +263,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/data/net_4_0/Makefile.in b/data/net_4_0/Makefile.in index 10ae2fd9e9..0f58377469 100644 --- a/data/net_4_0/Makefile.in +++ b/data/net_4_0/Makefile.in @@ -83,14 +83,14 @@ subdir = data/net_4_0 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -291,6 +291,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -319,6 +323,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/data/net_4_5/Browsers/Makefile.in b/data/net_4_5/Browsers/Makefile.in index b7c16cef7a..df9fd89466 100644 --- a/data/net_4_5/Browsers/Makefile.in +++ b/data/net_4_5/Browsers/Makefile.in @@ -83,14 +83,14 @@ subdir = data/net_4_5/Browsers DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -231,6 +231,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -259,6 +263,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/data/net_4_5/Makefile.in b/data/net_4_5/Makefile.in index 3a89756e59..366ad98077 100644 --- a/data/net_4_5/Makefile.in +++ b/data/net_4_5/Makefile.in @@ -83,14 +83,14 @@ subdir = data/net_4_5 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -291,6 +291,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -319,6 +323,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/docs/Makefile.in b/docs/Makefile.in index 3eada2e7ac..0c8de4e4f8 100644 --- a/docs/Makefile.in +++ b/docs/Makefile.in @@ -83,14 +83,14 @@ subdir = docs DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs README TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -231,6 +231,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -259,6 +263,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/docs/deploy/mono-api-domains.html b/docs/deploy/mono-api-domains.html index c0f41a6b52..539a77f6ea 100644 --- a/docs/deploy/mono-api-domains.html +++ b/docs/deploy/mono-api-domains.html @@ -664,21 +664,19 @@ mono_domain_set (MonoDomain *domain, gboolean force)
Syntax
MonoReflectionAssembly* -mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb) +mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *typebuilder)

Parameters
-
domain application domainwhere the name where the type is going to be resolved
name the name of the type to resolve or NULL.
tb A System.Reflection.Emit.TypeBuilder, used if name is NULL.
Return value
+
domain application domain in which to resolve the type
name the name of the type to resolve or NULL.
typebuilder A System.Reflection.Emit.TypeBuilder, used if name is NULL.
Return value
A MonoReflectionAssembly or NULL if not found
Description

This routine invokes the internal System.AppDomain.DoTypeResolve and returns - the assembly that matches name. -

- If name is null, the value of ((TypeBuilder)tb).FullName is used instead + the assembly that matches name, or ((TypeBuilder)typebuilder).FullName.

diff --git a/docs/deploy/mono-api-internal.html b/docs/deploy/mono-api-internal.html index 842c01c23b..7808614b55 100644 --- a/docs/deploy/mono-api-internal.html +++ b/docs/deploy/mono-api-internal.html @@ -640,7 +640,7 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
Syntax
MonoMethod* -mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type) +mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type, MonoError *error)

@@ -658,7 +658,7 @@ mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTar

Syntax
MonoMethod* -mono_marshal_get_remoting_invoke (MonoMethod *method) +mono_marshal_get_remoting_invoke (MonoMethod *method, MonoError *error)

@@ -676,7 +676,7 @@ mono_marshal_get_remoting_invoke (MonoMethod *method)

Syntax
MonoMethod* -mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) +mono_marshal_get_remoting_invoke_with_check (MonoMethod *method, MonoError *error)

@@ -833,7 +833,7 @@ mono_marshal_get_unbox_wrapper (MonoMethod *method)

Syntax
MonoMethod* -mono_marshal_get_xappdomain_invoke (MonoMethod *method) +mono_marshal_get_xappdomain_invoke (MonoMethod *method, MonoError *error)

@@ -993,7 +993,7 @@ mono_loader_unlock (void)

Syntax
void* -mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg) +mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg)

diff --git a/docs/deploy/mono-api-methods.html b/docs/deploy/mono-api-methods.html index 264ea5b075..0c2d1ce457 100644 --- a/docs/deploy/mono-api-methods.html +++ b/docs/deploy/mono-api-methods.html @@ -412,6 +412,16 @@ mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method)

+

Parameters
+
desc A method description that you created with mono_method_desc_new
method a MonoMethod instance that you want to match against
Return value
+
TRUE if the specified method matches the specified description, FALSE otherwise. +
+
Description
+
+

+ This method is used to check whether the method matches the provided + description, by making sure that the method matches both the class and the method parameters. +

diff --git a/external/api-snapshot/profiles/Makefile b/external/api-snapshot/profiles/Makefile deleted file mode 100644 index e1a3c09874..0000000000 --- a/external/api-snapshot/profiles/Makefile +++ /dev/null @@ -1,21 +0,0 @@ - -CSC=csc -nostdlib -noconfig -unsafe -t:library -nologo -deterministic -publicsign -nowarn:436,618,809,3001 -ECMA_KEY:=ecma.pub -MS_KEY:=msfinal.pub -MOBILE_KEY:=silverlight.pub - -all: build-net_4_x build-mobile-monotouch build-mobile-monodroid - -build-mobile-%: - $(CSC) $*/mscorlib.cs /out:$*/mscorlib.dll -runtimemetadataversion:v4.0.30319 -keyfile:$(MOBILE_KEY) - $(CSC) $*/System.cs /out:$*/System.dll -keyfile:$(MOBILE_KEY) -r:$*/mscorlib.dll /r:System.Xml.dll - $(CSC) $*/System.Core.cs /out:$*/System.Core.dll -keyfile:$(MOBILE_KEY) -r:$*/mscorlib.dll -r:$*/System.dll - $(CSC) $*/System.Net.Http.cs /out:$*/System.Net.Http.dll -keyfile:$(MS_KEY) -r:$*/mscorlib.dll -r:$*/System.Core.dll -r:$*/System.dll - $(CSC) $*/System.Numerics.cs /out:$*/System.Numerics.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll -r:System.dll - -build-%: - $(CSC) $*/mscorlib.cs /out:$*/mscorlib.dll -runtimemetadataversion:v4.0.30319 -keyfile:$(ECMA_KEY) - $(CSC) $*/System.cs /out:$*/System.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll /r:System.Configuration.dll /r:System.Xml.dll - $(CSC) $*/System.Core.cs /out:$*/System.Core.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll -r:System.dll - $(CSC) $*/System.Net.Http.cs /out:$*/System.Net.Http.dll -keyfile:$(MS_KEY) -r:$*/mscorlib.dll -r:$*/System.Core.dll -r:System.dll - $(CSC) $*/System.Numerics.cs /out:$*/System.Numerics.dll -keyfile:$(ECMA_KEY) -r:$*/mscorlib.dll -r:System.dll diff --git a/external/api-snapshot/profiles/ecma.pub b/external/api-snapshot/profiles/ecma.pub deleted file mode 100644 index efafe9240e0e5075416511b89966fb35149274fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16 NcmZQzfB+UK4FCWz00jU5 diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Memory.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Memory.cs index b61fe5187c..aa8f28c0e2 100644 --- a/external/api-snapshot/profiles/monodroid/Facades/System.Memory.cs +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Memory.cs @@ -14,8 +14,13 @@ [assembly:System.Reflection.AssemblyTitleAttribute("System.Memory")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.Binary.BinaryPrimitives))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.MemoryHandle))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.OperationStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.StandardFormat))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Memory<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MemoryExtensions))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ReadOnlyMemory<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ReadOnlySpan<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.MemoryMarshal))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Span<>))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Resources.Reader.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.Reader.cs new file mode 100644 index 0000000000..1c0315c8e5 --- /dev/null +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.Reader.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[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("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Reader")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/api-snapshot/profiles/monodroid/Facades/System.Resources.Writer.cs b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.Writer.cs new file mode 100644 index 0000000000..b5d9eb6711 --- /dev/null +++ b/external/api-snapshot/profiles/monodroid/Facades/System.Resources.Writer.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[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("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Writer")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))] diff --git a/external/api-snapshot/profiles/monodroid/I18N.Rare.cs b/external/api-snapshot/profiles/monodroid/I18N.Rare.cs index 3614448f97..334ba8d640 100644 --- a/external/api-snapshot/profiles/monodroid/I18N.Rare.cs +++ b/external/api-snapshot/profiles/monodroid/I18N.Rare.cs @@ -253,6 +253,24 @@ namespace I18N.Rare protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } } [System.SerializableAttribute] + public partial class CP737 : I18N.Common.ByteEncoding + { + public CP737() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } + public override int GetByteCount(string s) { throw null; } + public unsafe override int GetByteCountImpl(char* chars, int count) { throw null; } + public unsafe override int GetBytesImpl(char* chars, int charCount, byte* bytes, int byteCount) { throw null; } + protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } + } + [System.SerializableAttribute] + public partial class CP775 : I18N.Common.ByteEncoding + { + public CP775() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } + public override int GetByteCount(string s) { throw null; } + public unsafe override int GetByteCountImpl(char* chars, int count) { throw null; } + public unsafe override int GetBytesImpl(char* chars, int charCount, byte* bytes, int byteCount) { throw null; } + protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } + } + [System.SerializableAttribute] public partial class CP852 : I18N.Common.ByteEncoding { public CP852() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } @@ -478,6 +496,16 @@ namespace I18N.Rare public ENCibm500() { } } [System.SerializableAttribute] + public partial class ENCibm737 : I18N.Rare.CP737 + { + public ENCibm737() { } + } + [System.SerializableAttribute] + public partial class ENCibm775 : I18N.Rare.CP775 + { + public ENCibm775() { } + } + [System.SerializableAttribute] public partial class ENCibm852 : I18N.Rare.CP852 { public ENCibm852() { } diff --git a/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id b/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id index d2effc73bd..dffd8fb6ca 100644 --- a/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monodroid/System.Data.cs.REMOVED.git-id @@ -1 +1 @@ -234bce4aa119ca31f0bfe7d703f5e629a69e3811 \ No newline at end of file +274af052eceb5c59cf4900049c94a24b6978bf0e \ No newline at end of file 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 4dd08040fb..d1c3cbf384 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 @@ -b7c15b7b9fa8148f527c4a789c88891b3083d91e \ No newline at end of file +715bb57073b8a2870f37ffde44c9c05c221ef92c \ 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 5357538f09..3b4dd8bb2f 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 @@ -0b5f3952cc382be37d272154abe74be5a66a17ec \ No newline at end of file +4a6825fa570dca67303aca29491b1368004c6eee \ No newline at end of file diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Memory.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Memory.cs index b61fe5187c..aa8f28c0e2 100644 --- a/external/api-snapshot/profiles/monotouch/Facades/System.Memory.cs +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Memory.cs @@ -14,8 +14,13 @@ [assembly:System.Reflection.AssemblyTitleAttribute("System.Memory")] [assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] [assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.Binary.BinaryPrimitives))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.MemoryHandle))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.OperationStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Buffers.StandardFormat))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Memory<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.MemoryExtensions))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ReadOnlyMemory<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ReadOnlySpan<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.InteropServices.MemoryMarshal))] [assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Span<>))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Resources.Reader.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.Reader.cs new file mode 100644 index 0000000000..1c0315c8e5 --- /dev/null +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.Reader.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[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("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Reader")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/api-snapshot/profiles/monotouch/Facades/System.Resources.Writer.cs b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.Writer.cs new file mode 100644 index 0000000000..b5d9eb6711 --- /dev/null +++ b/external/api-snapshot/profiles/monotouch/Facades/System.Resources.Writer.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[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("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Writer")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))] diff --git a/external/api-snapshot/profiles/monotouch/I18N.Rare.cs b/external/api-snapshot/profiles/monotouch/I18N.Rare.cs index 3614448f97..334ba8d640 100644 --- a/external/api-snapshot/profiles/monotouch/I18N.Rare.cs +++ b/external/api-snapshot/profiles/monotouch/I18N.Rare.cs @@ -253,6 +253,24 @@ namespace I18N.Rare protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } } [System.SerializableAttribute] + public partial class CP737 : I18N.Common.ByteEncoding + { + public CP737() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } + public override int GetByteCount(string s) { throw null; } + public unsafe override int GetByteCountImpl(char* chars, int count) { throw null; } + public unsafe override int GetBytesImpl(char* chars, int charCount, byte* bytes, int byteCount) { throw null; } + protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } + } + [System.SerializableAttribute] + public partial class CP775 : I18N.Common.ByteEncoding + { + public CP775() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } + public override int GetByteCount(string s) { throw null; } + public unsafe override int GetByteCountImpl(char* chars, int count) { throw null; } + public unsafe override int GetBytesImpl(char* chars, int charCount, byte* bytes, int byteCount) { throw null; } + protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } + } + [System.SerializableAttribute] public partial class CP852 : I18N.Common.ByteEncoding { public CP852() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } @@ -478,6 +496,16 @@ namespace I18N.Rare public ENCibm500() { } } [System.SerializableAttribute] + public partial class ENCibm737 : I18N.Rare.CP737 + { + public ENCibm737() { } + } + [System.SerializableAttribute] + public partial class ENCibm775 : I18N.Rare.CP775 + { + public ENCibm775() { } + } + [System.SerializableAttribute] public partial class ENCibm852 : I18N.Rare.CP852 { public ENCibm852() { } diff --git a/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id b/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id index d2effc73bd..dffd8fb6ca 100644 --- a/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/monotouch/System.Data.cs.REMOVED.git-id @@ -1 +1 @@ -234bce4aa119ca31f0bfe7d703f5e629a69e3811 \ No newline at end of file +274af052eceb5c59cf4900049c94a24b6978bf0e \ No newline at end of file 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 cb7d3c34a2..10fa13b75b 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 @@ -e666675a5e7c7a12e9a991ff5c40ea2427b626d2 \ No newline at end of file +a4f7bcc187e2d92981b872a5ef20e5bc0cf311f7 \ 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 42e7491c3e..b3ce3c8e80 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 @@ -1f3ffce45e728f3afdbcc4f62441ec66b01d28b9 \ No newline at end of file +8ba95ce82ff14d35d267993fc549a54bc93c9b99 \ No newline at end of file diff --git a/external/api-snapshot/profiles/msfinal.pub b/external/api-snapshot/profiles/msfinal.pub deleted file mode 100644 index 110b59c7b0d27388353dcf4116f721595f473e58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa500968(fU`!uG#RTE`+KN zuKf+^=>2N!kB9pMc5H)8nUWr|JLj6&)!f0|n$k8CAp(#KayILlN=pn$R@96PlTucm;!K;}lU1BV%Wh@=~);)AxZ!P8VeqOH+#FjlK9EuV{ OWf&lBz>_phTGEsG5JRQ_ diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Http.Rtc.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Http.Rtc.cs new file mode 100644 index 0000000000..af6505bc76 --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Http.Rtc.cs @@ -0,0 +1,16 @@ +// 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.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[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("System.Net.Http.Rtc")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Http.Rtc")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Http.Rtc")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Ping.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Ping.cs new file mode 100644 index 0000000000..d5715a9caa --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Net.Ping.cs @@ -0,0 +1,21 @@ +// 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.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[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("System.Net.Ping")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Net.Ping")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Net.Ping")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.IPStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.Ping))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingException))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingOptions))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.NetworkInformation.PingReply))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Reader.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Reader.cs new file mode 100644 index 0000000000..1c0315c8e5 --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Reader.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[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("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Reader")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Reader")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Writer.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Writer.cs new file mode 100644 index 0000000000..b5d9eb6711 --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Resources.Writer.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.2.0")] +[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("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Resources.Writer")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Resources.Writer")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Formatters.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Formatters.cs new file mode 100644 index 0000000000..dd13005228 --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Runtime.Serialization.Formatters.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. + +[assembly:System.Reflection.AssemblyVersionAttribute("4.0.1.0")] +[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("System.Runtime.Serialization.Formatters")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Runtime.Serialization.Formatters")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.NonSerializedAttribute))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IDeserializationCallback))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.IFormatterConverter))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.ISerializable))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationEntry))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.Serialization.SerializationInfoEnumerator))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.SerializableAttribute))] diff --git a/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Csp.cs b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Csp.cs new file mode 100644 index 0000000000..ad6934aee4 --- /dev/null +++ b/external/api-snapshot/profiles/net_4_x/Facades/System.Security.Cryptography.Csp.cs @@ -0,0 +1,22 @@ +// 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.Reflection.AssemblyVersionAttribute("4.0.0.0")] +[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("System.Security.Cryptography.Csp")] +[assembly:System.Reflection.AssemblyDescriptionAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Reflection.AssemblyFileVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyInformationalVersionAttribute("4.0.0.0")] +[assembly:System.Reflection.AssemblyProductAttribute("Mono Common Language Infrastructure")] +[assembly:System.Reflection.AssemblyTitleAttribute("System.Security.Cryptography.Csp")] +[assembly:System.Runtime.CompilerServices.CompilationRelaxationsAttribute(8)] +[assembly:System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows=true)] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspKeyContainerInfo))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspParameters))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CspProviderFlags))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ICspAsymmetricAlgorithm))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.KeyNumber))] +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSACryptoServiceProvider))] diff --git a/external/api-snapshot/profiles/net_4_x/I18N.Rare.cs b/external/api-snapshot/profiles/net_4_x/I18N.Rare.cs index 92f647813a..eda236b3b3 100644 --- a/external/api-snapshot/profiles/net_4_x/I18N.Rare.cs +++ b/external/api-snapshot/profiles/net_4_x/I18N.Rare.cs @@ -253,6 +253,24 @@ namespace I18N.Rare protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } } [System.SerializableAttribute] + public partial class CP737 : I18N.Common.ByteEncoding + { + public CP737() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } + public override int GetByteCount(string s) { throw null; } + public unsafe override int GetByteCountImpl(char* chars, int count) { throw null; } + public unsafe override int GetBytesImpl(char* chars, int charCount, byte* bytes, int byteCount) { throw null; } + protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } + } + [System.SerializableAttribute] + public partial class CP775 : I18N.Common.ByteEncoding + { + public CP775() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } + public override int GetByteCount(string s) { throw null; } + public unsafe override int GetByteCountImpl(char* chars, int count) { throw null; } + public unsafe override int GetBytesImpl(char* chars, int charCount, byte* bytes, int byteCount) { throw null; } + protected unsafe override void ToBytes(char* chars, int charCount, byte* bytes, int byteCount) { } + } + [System.SerializableAttribute] public partial class CP852 : I18N.Common.ByteEncoding { public CP852() : base (default(int), default(char[]), default(string), default(string), default(string), default(string), default(bool), default(bool), default(bool), default(bool), default(int)) { } @@ -478,6 +496,16 @@ namespace I18N.Rare public ENCibm500() { } } [System.SerializableAttribute] + public partial class ENCibm737 : I18N.Rare.CP737 + { + public ENCibm737() { } + } + [System.SerializableAttribute] + public partial class ENCibm775 : I18N.Rare.CP775 + { + public ENCibm775() { } + } + [System.SerializableAttribute] public partial class ENCibm852 : I18N.Rare.CP852 { public ENCibm852() { } diff --git a/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id b/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id index 19397025c8..09176d3468 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id +++ b/external/api-snapshot/profiles/net_4_x/System.Data.cs.REMOVED.git-id @@ -1 +1 @@ -77d88765c83696d7661b6c4006c00ad031464996 \ No newline at end of file +5e5914acc31e1bb832c5e1d9c94cb8d7fd4de4bc \ 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 ddf912d812..cedcb3ce9a 100644 --- a/external/api-snapshot/profiles/net_4_x/System.Security.cs +++ b/external/api-snapshot/profiles/net_4_x/System.Security.cs @@ -716,7 +716,6 @@ namespace System.Security.Cryptography.Xml public void AddCertificate(System.Security.Cryptography.X509Certificates.X509Certificate certificate) { } public void AddIssuerSerial(string issuerName, string serialNumber) { } public void AddSubjectKeyId(byte[] subjectKeyId) { } - [System.Runtime.InteropServices.ComVisibleAttribute(false)] public void AddSubjectKeyId(string subjectKeyId) { } public void AddSubjectName(string subjectName) { } public override System.Xml.XmlElement GetXml() { throw null; } @@ -789,8 +788,6 @@ namespace System.Security.Cryptography.Xml { public SignedInfo() { } public string CanonicalizationMethod { get { throw null; } set { } } - [System.MonoTODOAttribute] - [System.Runtime.InteropServices.ComVisibleAttribute(false)] public System.Security.Cryptography.Xml.Transform CanonicalizationMethodObject { get { throw null; } } public int Count { get { throw null; } } public string Id { get { throw null; } set { } } @@ -837,11 +834,12 @@ namespace System.Security.Cryptography.Xml public SignedXml() { } public SignedXml(System.Xml.XmlDocument document) { } public SignedXml(System.Xml.XmlElement elem) { } - [System.Runtime.InteropServices.ComVisibleAttribute(false)] public System.Security.Cryptography.Xml.EncryptedXml EncryptedXml { get { throw null; } set { } } public System.Security.Cryptography.Xml.KeyInfo KeyInfo { get { throw null; } set { } } public System.Xml.XmlResolver Resolver { set { } } + public System.Collections.ObjectModel.Collection SafeCanonicalizationMethods { get { throw null; } } public System.Security.Cryptography.Xml.Signature Signature { get { throw null; } } + public System.Func SignatureFormatValidator { get { throw null; } set { } } public string SignatureLength { get { throw null; } } public string SignatureMethod { get { throw null; } } public byte[] SignatureValue { get { throw null; } } @@ -853,8 +851,6 @@ namespace System.Security.Cryptography.Xml public bool CheckSignature() { throw null; } public bool CheckSignature(System.Security.Cryptography.AsymmetricAlgorithm key) { throw null; } public bool CheckSignature(System.Security.Cryptography.KeyedHashAlgorithm macAlg) { throw null; } - [System.MonoTODOAttribute] - [System.Runtime.InteropServices.ComVisibleAttribute(false)] public bool CheckSignature(System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, bool verifySignatureOnly) { throw null; } public bool CheckSignatureReturningKey(out System.Security.Cryptography.AsymmetricAlgorithm signingKey) { signingKey = default(System.Security.Cryptography.AsymmetricAlgorithm); throw null; } public void ComputeSignature() { } 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 f42a7a8455..a27170f743 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 @@ -c546502619ff17d47da893765d85efbafa7f3091 \ No newline at end of file +b55591aadca2cd6118105d99f75b0cd2df89b0ea \ 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 0c4204dcab..1d2a1f2c44 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 @@ -7f3bafeaee74306109dc28c841c32bf76b62e0a2 \ No newline at end of file +b09677c78004a91a3d87bb964cf9a79ac800fab4 \ 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 503977db2f..61748bdbab 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 @@ -4aceab7b6bffa92aab373aabde9c34d48d497e91 \ No newline at end of file +9a68bbd21ee9196ff71f50bc108c1324eae4f4f9 \ No newline at end of file diff --git a/external/api-snapshot/profiles/silverlight.pub b/external/api-snapshot/profiles/silverlight.pub deleted file mode 100644 index 60146e8891ac5524e748144448c6a97179ed889b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 160 zcmV;R0AK$ABme*efB*oL000060ssI2Bme+XQ$aBR1ONa50097vR>yCihDkUuN%Mom zOW^DvL4krQY%$MXx9>=4M9?xAj-k_%2V-$8%M#aLw|^t2bdB7m zo*?fNT@13%^1tjo5m*qz*#?$4{!8K&+xL}*86f4WZ+)`j&hHay!aZHmzXKNluEH|* O#<9nRv@l!}J2$Hb>Omd= diff --git a/external/bockbuild/README.md b/external/bockbuild/README.md index d8ccd8197f..c39a499ed7 100644 --- a/external/bockbuild/README.md +++ b/external/bockbuild/README.md @@ -1,6 +1,6 @@ Note: This is the actively maintained version of Bockbuild, used to put together the Mono SDK package for macOS. The legacy versions (used for Banshee and older Mono versions) are available here: https://github.com/mono/bockbuild/tree/legacy -Please file issues with the Mono SDK package for macOS on [Xamarin's Bugzilla](https://bugzilla.xamarin.com/enter_bug.cgi?product=Mono%20Installers). +Please file issues with the Mono SDK package for macOS on the [Mono GitHub issues](https://github.com/mono/mono/issues) page. The Mono macOS SDK ------------------ diff --git a/external/boringssl/.github/PULL_REQUEST_TEMPLATE b/external/boringssl/.github/PULL_REQUEST_TEMPLATE index 6c101eabca..3b7e94d07e 100644 --- a/external/boringssl/.github/PULL_REQUEST_TEMPLATE +++ b/external/boringssl/.github/PULL_REQUEST_TEMPLATE @@ -1,7 +1,3 @@ -Please do not send pull requests to the BoringSSL repository. +This is mono's fork of the BoringSSL repository. -We do, however, take contributions gladly. - -See https://boringssl.googlesource.com/boringssl/+/master/CONTRIBUTING.md - -Thanks! +We accept PRs for build issues, general code changes should go to the upstream repo. diff --git a/external/boringssl/CMakeLists.txt b/external/boringssl/CMakeLists.txt index 296d0106a1..2ba98c0db4 100644 --- a/external/boringssl/CMakeLists.txt +++ b/external/boringssl/CMakeLists.txt @@ -164,6 +164,8 @@ elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7-a") set(ARCH "arm") elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64") set(ARCH "aarch64") +elseif (${CMAKE_SYSTEM_PROCESSOR} STREQUAL "s390x") + set(ARCH "s390x") else() message(FATAL_ERROR "Unknown processor:" ${CMAKE_SYSTEM_PROCESSOR}) endif() diff --git a/external/boringssl/crypto/ec/p224-64.c b/external/boringssl/crypto/ec/p224-64.c index 7bf889c969..795e964005 100644 --- a/external/boringssl/crypto/ec/p224-64.c +++ b/external/boringssl/crypto/ec/p224-64.c @@ -185,19 +185,33 @@ static const felem g_pre_comp[2][16][3] = { /* Helper functions to convert field elements to/from internal representation */ static void bin28_to_felem(felem out, const u8 in[28]) { - out[0] = *((const uint64_t *)(in)) & 0x00ffffffffffffff; - out[1] = (*((const uint64_t *)(in + 7))) & 0x00ffffffffffffff; - out[2] = (*((const uint64_t *)(in + 14))) & 0x00ffffffffffffff; - out[3] = (*((const uint64_t *)(in + 20))) >> 8; +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + out[0] = (*((const uint64_t *)(in + 20))) << 8 >> 8; + out[1] = (*((const uint64_t *)(in + 14))) >> 8; + out[2] = (*((const uint64_t *)(in + 7))) >> 8; + out[3] = *((const uint64_t *)(in)) >>8; +#else + out[0] = *((const uint64_t *)(in)) & 0x00ffffffffffffff; + out[1] = (*((const uint64_t *)(in + 7))) & 0x00ffffffffffffff; + out[2] = (*((const uint64_t *)(in + 14))) & 0x00ffffffffffffff; + out[3] = (*((const uint64_t *)(in + 20))) >> 8; +#endif } static void felem_to_bin28(u8 out[28], const felem in) { size_t i; for (i = 0; i < 7; ++i) { +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + out[i] = *((u8 *)&in[3] + i + 1); + out[i + 7] = *((u8 *)&in[2] + i + 1); + out[i + 14] = *((u8 *)&in[1] + i + 1); + out[i + 21] = *((u8 *)&in[0] + i + 1); +#else out[i] = in[0] >> (8 * i); out[i + 7] = in[1] >> (8 * i); out[i + 14] = in[2] >> (8 * i); out[i + 21] = in[3] >> (8 * i); +#endif } } @@ -223,16 +237,26 @@ static int BN_to_felem(felem out, const BIGNUM *bn) { felem_bytearray b_in; num_bytes = BN_bn2bin(bn, b_in); +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + memcpy(b_out+sizeof(b_out)-num_bytes, b_in, num_bytes); + memset(b_out, 0, sizeof(b_out)-num_bytes); +#else flip_endian(b_out, b_in, num_bytes); +#endif bin28_to_felem(out, b_out); return 1; } /* From internal representation to OpenSSL BIGNUM */ static BIGNUM *felem_to_BN(BIGNUM *out, const felem in) { - felem_bytearray b_in, b_out; + felem_bytearray b_out; +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + felem_to_bin28(b_out, in); +#else + felem_bytearray b_in; felem_to_bin28(b_in, in); flip_endian(b_out, b_in, sizeof(b_out)); +#endif return BN_bin2bn(b_out, sizeof(b_out), out); } diff --git a/external/boringssl/crypto/ec/p256-64.c b/external/boringssl/crypto/ec/p256-64.c index c4259b629f..d3b413b20e 100644 --- a/external/boringssl/crypto/ec/p256-64.c +++ b/external/boringssl/crypto/ec/p256-64.c @@ -75,21 +75,35 @@ static const u64 kPrime[4] = {0xfffffffffffffffful, 0xffffffff, 0, static const u64 bottom63bits = 0x7ffffffffffffffful; /* bin32_to_felem takes a little-endian byte array and converts it into felem - * form. This assumes that the CPU is little-endian. */ + * form. This assumes no particular CPU endianess. */ static void bin32_to_felem(felem out, const u8 in[32]) { +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + out[0] = *((const u64 *)&in[24]); + out[1] = *((const u64 *)&in[16]); + out[2] = *((const u64 *)&in[8]); + out[3] = *((const u64 *)&in[0]); +#else out[0] = *((const u64 *)&in[0]); out[1] = *((const u64 *)&in[8]); out[2] = *((const u64 *)&in[16]); out[3] = *((const u64 *)&in[24]); +#endif } /* smallfelem_to_bin32 takes a smallfelem and serialises into a little endian, - * 32 byte array. This assumes that the CPU is little-endian. */ + * 32 byte array. This assumes no particular CPU endianess. */ static void smallfelem_to_bin32(u8 out[32], const smallfelem in) { +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + *((u64 *)&out[0]) = in[3]; + *((u64 *)&out[8]) = in[2]; + *((u64 *)&out[16]) = in[1]; + *((u64 *)&out[24]) = in[0]; +#else *((u64 *)&out[0]) = in[0]; *((u64 *)&out[8]) = in[1]; *((u64 *)&out[16]) = in[2]; *((u64 *)&out[24]) = in[3]; +#endif } /* To preserve endianness when using BN_bn2bin and BN_bin2bn. */ @@ -118,16 +132,26 @@ static int BN_to_felem(felem out, const BIGNUM *bn) { felem_bytearray b_in; num_bytes = BN_bn2bin(bn, b_in); +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + memcpy(b_out+sizeof(b_out)-num_bytes, b_in, num_bytes); + memset(b_out, 0, sizeof(b_out)-num_bytes); +#else flip_endian(b_out, b_in, num_bytes); bin32_to_felem(out, b_out); +#endif return 1; } /* felem_to_BN converts an felem into an OpenSSL BIGNUM. */ static BIGNUM *smallfelem_to_BN(BIGNUM *out, const smallfelem in) { - felem_bytearray b_in, b_out; + felem_bytearray b_out; +#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ + smallfelem_to_bin32(b_out, in); +#else + felem_bytearray b_in; smallfelem_to_bin32(b_in, in); flip_endian(b_out, b_in, sizeof(b_out)); +#endif return BN_bin2bn(b_out, sizeof(b_out), out); } diff --git a/external/corefx/src/Common/src/CoreLib/System/Buffers/IRetainable.cs b/external/corefx/src/Common/src/CoreLib/System/Buffers/IRetainable.cs index 92641cf354..6ac508859c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Buffers/IRetainable.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Buffers/IRetainable.cs @@ -10,7 +10,7 @@ namespace System.Buffers /// /// Provides a mechanism for manual lifetime management. /// - interface IRetainable + public interface IRetainable { /// /// Call this method to indicate that the IRetainable object is in use. diff --git a/external/corefx/src/Common/src/CoreLib/System/Buffers/MemoryHandle.cs b/external/corefx/src/Common/src/CoreLib/System/Buffers/MemoryHandle.cs index b3f666c51d..7544038629 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Buffers/MemoryHandle.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Buffers/MemoryHandle.cs @@ -10,7 +10,7 @@ namespace System.Buffers /// /// A handle for the memory. /// - unsafe struct MemoryHandle : IDisposable + public unsafe struct MemoryHandle : IDisposable { private IRetainable _retainable; private void* _pointer; diff --git a/external/corefx/src/Common/src/CoreLib/System/Buffers/OwnedMemory.cs b/external/corefx/src/Common/src/CoreLib/System/Buffers/OwnedMemory.cs index 9bbb2dc2b7..6946addc80 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Buffers/OwnedMemory.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Buffers/OwnedMemory.cs @@ -10,7 +10,7 @@ namespace System.Buffers /// /// Owner of Memory that provides appropriate lifetime management mechanisms for it. /// - abstract class OwnedMemory : IDisposable, IRetainable + public abstract class OwnedMemory : IDisposable, IRetainable { /// /// The number of items in the Memory. diff --git a/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/KeyNotFoundException.cs b/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/KeyNotFoundException.cs index 48eddb8745..1ecf15f010 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/KeyNotFoundException.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Collections/Generic/KeyNotFoundException.cs @@ -8,7 +8,9 @@ using System.Runtime.Serialization; namespace System.Collections.Generic { [Serializable] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public class KeyNotFoundException : SystemException { public KeyNotFoundException() 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 56bbea895e..1426d84021 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,6 +4,7 @@ using System.Collections.ObjectModel; using System.Diagnostics; +using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Collections.Generic @@ -17,7 +18,9 @@ namespace System.Collections.Generic [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] [Serializable] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public class List : IList, System.Collections.IList, IReadOnlyList { private const int DefaultCapacity = 4; @@ -445,7 +448,11 @@ namespace System.Collections.Generic int newCapacity = _items.Length == 0 ? DefaultCapacity : _items.Length * 2; // Allow the list to grow to maximum possible capacity (~2G elements) before encountering overflow. // Note that this check works even when _items.Length overflowed thanks to the (uint) cast +#if MONO //in mono we don't want to add additional fields to Array + if ((uint)newCapacity > Array_ReferenceSources.MaxArrayLength) newCapacity = Array_ReferenceSources.MaxArrayLength; +#else if ((uint)newCapacity > Array.MaxArrayLength) newCapacity = Array.MaxArrayLength; +#endif if (newCapacity < min) newCapacity = min; Capacity = newCapacity; } @@ -1170,6 +1177,9 @@ namespace System.Collections.Generic } } +#if MONO + [System.Serializable] +#endif public struct Enumerator : IEnumerator, System.Collections.IEnumerator { private List _list; diff --git a/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs b/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs index 1e1b2c7959..99def02bfd 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/Collection.cs @@ -10,7 +10,9 @@ namespace System.Collections.ObjectModel [Serializable] [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public class Collection : IList, IList, IReadOnlyList { private IList items; // Do not rename (binary serialization) diff --git a/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/ReadOnlyCollection.cs b/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/ReadOnlyCollection.cs index dbf88d8b8d..c2ef36565f 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/ReadOnlyCollection.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Collections/ObjectModel/ReadOnlyCollection.cs @@ -10,7 +10,9 @@ namespace System.Collections.ObjectModel [Serializable] [DebuggerTypeProxy(typeof(ICollectionDebugView<>))] [DebuggerDisplay("Count = {Count}")] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public class ReadOnlyCollection : IList, IList, IReadOnlyList { private IList list; // Do not rename (binary serialization) 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 13725bcc51..c47db7b0fd 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; +using System.Diagnostics.Private; 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 aa7e908561..38201530e8 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; +using System.Diagnostics.Private; using System.Runtime.InteropServices; using System.Runtime.Serialization; @@ -34,7 +34,9 @@ namespace System.Globalization } [Serializable] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public partial class CompareInfo : IDeserializationCallback { // Mask used to check if IndexOf()/LastIndexOf()/IsPrefix()/IsPostfix() has the right flags. @@ -344,7 +346,11 @@ namespace System.Globalization return String.CompareOrdinal(string1, string2); } +#if MONO + return internal_compare_switch(string1, 0, string1.Length, string2, 0, string2.Length, options); +#else return CompareString(string1.AsReadOnlySpan(), string2.AsReadOnlySpan(), options); +#endif } // TODO https://github.com/dotnet/coreclr/issues/13827: @@ -525,10 +531,14 @@ namespace System.Globalization return CompareOrdinal(string1, offset1, length1, string2, offset2, length2); } +#if MONO + return internal_compare_switch(string1, offset1, length1, string2, offset2, length2, options); +#else return CompareString( string1.AsReadOnlySpan().Slice(offset1, length1), string2.AsReadOnlySpan().Slice(offset2, length2), options); +#endif } private static int CompareOrdinal(string string1, int offset1, int length1, string string2, int offset2, int length2) diff --git a/external/corefx/src/Common/src/CoreLib/System/Memory.cs b/external/corefx/src/Common/src/CoreLib/System/Memory.cs index 4d1caea82a..40c4cd9e53 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Memory.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Memory.cs @@ -239,7 +239,7 @@ namespace System /// Returns a handle for the array. /// If pin is true, the GC will not move the array and hence its address can be taken /// - unsafe MemoryHandle Retain(bool pin = false) + public unsafe MemoryHandle Retain(bool pin = false) { MemoryHandle memoryHandle = default; if (pin) diff --git a/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs b/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs index e261b242bf..de423bbd06 100644 --- a/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs +++ b/external/corefx/src/Common/src/CoreLib/System/ReadOnlyMemory.cs @@ -217,7 +217,7 @@ namespace System /// If pin is true, the GC will not move the array until the returned /// is disposed, enabling the memory's address can be taken and used. /// - unsafe MemoryHandle Retain(bool pin = false) + public unsafe MemoryHandle Retain(bool pin = false) { MemoryHandle memoryHandle = default; if (pin) diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs index 66c9175ee7..344a11f9b1 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class AsyncStateMachineAttribute : StateMachineAttribute { public AsyncStateMachineAttribute(Type stateMachineType) diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs index 1c05abd1fe..107ad0c9e4 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.All, Inherited = true)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class CompilerGeneratedAttribute : Attribute { public CompilerGeneratedAttribute() { } diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs index 752295e876..567d1c6f14 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs @@ -7,6 +7,9 @@ namespace System.Runtime.CompilerServices // Attribute used to communicate to the VS7 debugger that a class should be treated as if it has global scope. [AttributeUsage(AttributeTargets.Class)] +#if MONO + [System.SerializableAttribute] +#endif public class CompilerGlobalScopeAttribute : Attribute { public CompilerGlobalScopeAttribute() { } diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CustomConstantAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CustomConstantAttribute.cs index f75693eb40..cbb52ccd11 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CustomConstantAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/CustomConstantAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +#if MONO + [System.SerializableAttribute] +#endif public abstract class CustomConstantAttribute : Attribute { public abstract Object Value { get; } diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs index 813e6803bf..9a61a43632 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class DateTimeConstantAttribute : CustomConstantAttribute { private DateTime _date; diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DecimalConstantAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DecimalConstantAttribute.cs index 19db84eb43..51409b3306 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DecimalConstantAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/DecimalConstantAttribute.cs @@ -7,6 +7,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class DecimalConstantAttribute : Attribute { private Decimal _dec; diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs index 8dc6c43126..41acb80fa7 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Field)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class FixedAddressValueTypeAttribute : Attribute { public FixedAddressValueTypeAttribute() { } diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IndexerNameAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IndexerNameAttribute.cs index ea843b3daa..1aea92b75c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IndexerNameAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IndexerNameAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Property, Inherited = true)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class IndexerNameAttribute : Attribute { public IndexerNameAttribute(String indexerName) diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs index 53afc95664..4dbc95327c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class IteratorStateMachineAttribute : StateMachineAttribute { public IteratorStateMachineAttribute(Type stateMachineType) diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs index f3842ec562..ff2b212e1b 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs @@ -16,6 +16,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = false)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class ReferenceAssemblyAttribute : Attribute { public ReferenceAssemblyAttribute() diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs index 609c560330..97cfe94d12 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs @@ -14,6 +14,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] +#if MONO + [System.SerializableAttribute] +#endif public sealed class RuntimeCompatibilityAttribute : Attribute { public RuntimeCompatibilityAttribute() diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeWrappedException.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeWrappedException.cs index 72996c6dfc..b78775e601 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeWrappedException.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/RuntimeWrappedException.cs @@ -10,7 +10,9 @@ namespace System.Runtime.CompilerServices /// Exception used to wrap all non-CLS compliant exceptions. /// [Serializable] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public sealed class RuntimeWrappedException : Exception { private object _wrappedException; // EE expects this name diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/StateMachineAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/StateMachineAttribute.cs index e081d63e71..f89d8a2b87 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/StateMachineAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/StateMachineAttribute.cs @@ -7,6 +7,9 @@ using System; namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)] +#if MONO + [System.SerializableAttribute] +#endif public class StateMachineAttribute : Attribute { public StateMachineAttribute(Type stateMachineType) diff --git a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs index f049c89b3f..907a05321c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs @@ -5,6 +5,9 @@ namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Struct)] +#if MONO + [System.SerializableAttribute] +#endif sealed public class UnsafeValueTypeAttribute : Attribute { } 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 4fff48ca7a..63e301beca 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 @@ -14,7 +14,7 @@ namespace System.Runtime.InteropServices /// Provides a collection of methods for interoperating with , , /// , and . /// - static class MemoryMarshal + public static class MemoryMarshal { /// Creates a from a . /// The . 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 e89943a192..2c1b67563d 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/ASCIIEncoding.cs @@ -4,6 +4,7 @@ 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 b827648fc1..94d88b126f 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Decoder.cs @@ -5,6 +5,7 @@ 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 30c817c91a..00233f7aab 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderBestFitFallback.cs @@ -7,6 +7,7 @@ // 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 11b9539b5c..21104805bf 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderFallback.cs @@ -3,6 +3,7 @@ // 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 422b80bb2f..df45706b25 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/DecoderReplacementFallback.cs @@ -3,6 +3,7 @@ // 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 fb1bdb8038..d3b96198c4 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Encoder.cs @@ -5,6 +5,7 @@ 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 7f3be2a7a6..7687f3a70b 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderBestFitFallback.cs @@ -7,6 +7,7 @@ // 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 d860a02a76..aa6e049b0a 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderFallback.cs @@ -3,6 +3,7 @@ // 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 a1d0bbcd95..50e8eab14c 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/EncoderReplacementFallback.cs @@ -5,6 +5,7 @@ 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 e469180ce6..8d7e0c7ebb 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Encoding.cs @@ -3,6 +3,7 @@ // 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 335eb76e3c..04661a71f3 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/Latin1Encoding.cs @@ -4,6 +4,7 @@ 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 19c15498af..c4b99e9a00 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/StringBuilder.cs @@ -13,6 +13,7 @@ using System.Security; using System.Threading; using System.Globalization; using System.Diagnostics; +using System.Diagnostics.Private; using System.Collections.Generic; namespace System.Text @@ -1029,6 +1030,12 @@ namespace System.Text [CLSCompliant(false)] public StringBuilder Append(ulong value) => AppendSpanFormattable(value); +#if MONO + private StringBuilder AppendSpanFormattable(T value) where T : IFormattable + { + return Append(value.ToString(null, CultureInfo.CurrentCulture)); + } +#else private StringBuilder AppendSpanFormattable(T value) where T : ISpanFormattable { if (value.TryFormat(RemainingCurrentChunk, out int charsWritten, format: default, provider: null)) @@ -1039,6 +1046,7 @@ namespace System.Text return Append(value.ToString()); } +#endif public StringBuilder Append(object value) => (value == null) ? this : Append(value.ToString()); 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 7828775ea0..7df6695f07 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UTF32Encoding.cs @@ -8,6 +8,7 @@ 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 0246c28915..ef85d06482 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UTF7Encoding.cs @@ -8,6 +8,7 @@ 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 6176a63d8f..82dfec5db9 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 @@ -a89af8edb0b2b357812747b41f60144b3881dee9 \ No newline at end of file +914651fdd0d8b62fd9117b901908f3ba65fb2ecc \ 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 342bf53d62..bdc0cb6d43 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/UnicodeEncoding.cs @@ -9,6 +9,7 @@ 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 0a91eb0f63..f391346cbf 100644 --- a/external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs +++ b/external/corefx/src/Common/src/CoreLib/System/Text/ValueStringBuilder.cs @@ -4,6 +4,7 @@ using System.Buffers; using System.Diagnostics; +using System.Diagnostics.Private; using System.Runtime.CompilerServices; namespace System.Text diff --git a/external/corefx/src/Common/src/System/IO/StringBuilderCache.cs b/external/corefx/src/Common/src/System/IO/StringBuilderCache.cs index d0300a4e24..118090734a 100644 --- a/external/corefx/src/Common/src/System/IO/StringBuilderCache.cs +++ b/external/corefx/src/Common/src/System/IO/StringBuilderCache.cs @@ -36,7 +36,14 @@ using System.Threading; using System.Text; +#if MONO +// in MONO we still use reference-sources for the following types which want StringBuilderCache to be under System.Text: +// Version, ApplicationId, BinaryReader.cs, BinaryObjectWriter.cs, DateTimeFormat.cs, String.cs, TimeZoneInfo.cs, TimeSpanFormat.cs, KeyValuePair.cs +// once we move them to corefx we can safely remove this condition and move StringBuilderCache back to System.IO. +namespace System.Text +#else namespace System.IO +#endif { internal static class StringBuilderCache { diff --git a/external/corefx/src/Common/tests/System/Net/Configuration.Http.cs b/external/corefx/src/Common/tests/System/Net/Configuration.Http.cs index e10cfe7b4c..94c2c31f23 100644 --- a/external/corefx/src/Common/tests/System/Net/Configuration.Http.cs +++ b/external/corefx/src/Common/tests/System/Net/Configuration.Http.cs @@ -62,11 +62,13 @@ namespace System.Net.Test.Common public static readonly Uri RemoteDeflateServer = new Uri("http://" + Host + "/" + DeflateHandler); public static readonly Uri RemoteGZipServer = new Uri("http://" + Host + "/" + GZipHandler); +#if !MONO public static readonly object[][] EchoServers = { new object[] { RemoteEchoServer }, new object[] { SecureRemoteEchoServer } }; 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) } }; +#endif public static Uri NegotiateAuthUriForDefaultCreds(bool secure) { 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 63ae1a99c7..5fe6af5281 100644 --- a/external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs +++ b/external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs @@ -2,7 +2,11 @@ // 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.NonGeneric/src/System/Collections/SortedList.cs b/external/corefx/src/System.Collections.NonGeneric/src/System/Collections/SortedList.cs index d44054713f..a8203471ca 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,6 +13,7 @@ ===========================================================*/ using System.Diagnostics; +using System.Diagnostics.Private; using System.Diagnostics.CodeAnalysis; using System.Globalization; diff --git a/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs b/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs index ba1dd69864..e49d64cc06 100644 --- a/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs +++ b/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameObjectCollectionBase.cs @@ -22,7 +22,7 @@ namespace System.Collections.Specialized /// the key or with the index. /// [Serializable] - public abstract class NameObjectCollectionBase : ICollection, ISerializable, IDeserializationCallback + public abstract partial class NameObjectCollectionBase : ICollection, ISerializable, IDeserializationCallback { private bool _readOnly = false; private ArrayList _entriesArray; diff --git a/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameValueCollection.cs b/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameValueCollection.cs index b3c0b9e0c2..0025f6566e 100644 --- a/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameValueCollection.cs +++ b/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/NameValueCollection.cs @@ -18,7 +18,7 @@ namespace System.Collections.Specialized /// can be accessed either with the hash code of the key or with the index. /// [Serializable] - public class NameValueCollection : NameObjectCollectionBase + public partial class NameValueCollection : NameObjectCollectionBase { private String[] _all; // Do not rename (binary serialization) private String[] _allKeys; // Do not rename (binary serialization) diff --git a/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/StringDictionary.cs b/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/StringDictionary.cs index 986fc6666e..86205db0c5 100644 --- a/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/StringDictionary.cs +++ b/external/corefx/src/System.Collections.Specialized/src/System/Collections/Specialized/StringDictionary.cs @@ -15,13 +15,18 @@ namespace System.Collections.Specialized #if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] #endif - public class StringDictionary : IEnumerable + public partial class StringDictionary : IEnumerable { // For compatibility, we want the Keys property to return values in lower-case. // That means using ToLower in each property on this type. Also for backwards // compatibility, we will be converting strings to lower-case, which has a // problem for some Georgian alphabets. - private readonly Hashtable contents = new Hashtable(); // Do not rename (binary serialization) +#if MONO + internal +#else + private readonly +#endif + Hashtable contents = new Hashtable(); // Do not rename (binary serialization) /// 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 c33fff93bb..9e05b0291b 100644 --- a/external/corefx/src/System.Collections/src/System/Collections/BitArray.cs +++ b/external/corefx/src/System.Collections/src/System/Collections/BitArray.cs @@ -3,6 +3,7 @@ // 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.IO.Compression/src/System/IO/Compression/GZipStream.cs b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs index a70012ebb8..4796b9b39b 100644 --- a/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs +++ b/external/corefx/src/System.IO.Compression/src/System/IO/Compression/GZipStream.cs @@ -180,7 +180,7 @@ namespace System.IO.Compression return _deflateStream.WriteAsync(array, offset, count, cancellationToken); } - internal override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) + public override Task WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) { if (GetType() != typeof(GZipStream)) { diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs index 04cdfb9c2a..1460de92e2 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Linux.cs @@ -9,7 +9,15 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +#if MONO + +using System; +using System.IO; +namespace System.IO.CoreFX +#else + namespace System.IO +#endif { // Note: This class has an OS Limitation where the inotify API can miss events if a directory is created and immediately has // changes underneath. This is due to the inotify* APIs not being recursive and needing to call inotify_add_watch on diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs index a72be37f5a..d86b5781ea 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.OSX.cs @@ -14,7 +14,15 @@ using FSEventStreamEventId = System.UInt64; using CFRunLoopRef = System.IntPtr; using Microsoft.Win32.SafeHandles; +#if MONO + +using System; +using System.IO; +namespace System.IO.CoreFX +#else + namespace System.IO +#endif { public partial class FileSystemWatcher { diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs index b4f75c99d4..26ecd256a8 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.UnknownUnix.cs @@ -1,8 +1,15 @@ // 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. +#if MONO + +using System; +using System.IO; +namespace System.IO.CoreFX +#else namespace System.IO +#endif { public partial class FileSystemWatcher { diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs index 8ba4600cad..583df7976f 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.Win32.cs @@ -7,7 +7,15 @@ using System.ComponentModel; using System.Diagnostics; using System.Threading; +#if MONO + +using System; +using System.IO; +namespace System.IO.CoreFX +#else + namespace System.IO +#endif { public partial class FileSystemWatcher { diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs index 89c5adb413..ae3f5557d6 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs @@ -8,7 +8,15 @@ using System.Diagnostics.CodeAnalysis; using System.Threading; using System.Threading.Tasks; +#if MONO + +using System; +using System.IO; +namespace System.IO.CoreFX +#else + namespace System.IO +#endif { /// /// Listens to the system directory change notifications and @@ -599,9 +607,15 @@ namespace System.IO } // Return the results. +#if MONO + return tcs.Task.Status == TaskStatus.RanToCompletion ? + tcs.Task.Result : + WaitForChangedResult.TimedOutResult; +#else return tcs.Task.IsCompletedSuccessfully ? tcs.Task.Result : WaitForChangedResult.TimedOutResult; +#endif } /// diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.cs index 34347fd98e..53baf740f8 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.cs @@ -197,6 +197,7 @@ namespace System.IO.Tests /// EndInit will begin EnableRaisingEvents if we previously set EnableRaisingEvents=true /// [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void EndInit_ResumesPausedEnableRaisingEvents() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -215,6 +216,7 @@ namespace System.IO.Tests [Theory] [InlineData(true)] [InlineData(false)] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void EndInit_ResumesPausedEnableRaisingEvents(bool setBeforeBeginInit) { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs index 1b7914b255..f10331a097 100644 --- a/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs +++ b/external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs @@ -25,6 +25,7 @@ namespace System.IO.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_NewFileInfoAction_TriggersNothing() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -38,6 +39,7 @@ namespace System.IO.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_FileInfoGetter_TriggersNothing() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -180,6 +182,7 @@ namespace System.IO.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_EnableRaisingEvents() { using (var testDirectory = new TempDirectory(GetTestFilePath())) @@ -292,6 +295,7 @@ namespace System.IO.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_NotifyFilter() { FileSystemWatcher watcher = new FileSystemWatcher(); @@ -370,6 +374,7 @@ namespace System.IO.Tests [Fact] [PlatformSpecific(TestPlatforms.OSX | TestPlatforms.Windows)] // Casing matters on Linux + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_OnCreatedWithMismatchedCasingGivesExpectedFullPath() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -463,6 +468,7 @@ namespace System.IO.Tests [Fact] [PlatformSpecific(TestPlatforms.Windows)] // Unix FSW don't trigger on a file rename. + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_Windows_OnRenameGivesExpectedFullPath() { using (var dir = new TempDirectory(GetTestFilePath())) @@ -589,6 +595,7 @@ namespace System.IO.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_StopCalledOnBackgroundThreadDoesNotDeadlock() { // Check the case where Stop or Dispose (they do the same thing) is called from @@ -614,6 +621,7 @@ namespace System.IO.Tests } [Fact] + [SkipOnTargetFramework(TargetFrameworkMonikers.Mono, "Not working")] public void FileSystemWatcher_WatchingAliasedFolderResolvesToRealPathWhenWatching() { using (var testDirectory = new TempDirectory(GetTestFilePath())) diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs index 52f3e10eaf..599bcf27f8 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Reader.cs @@ -18,7 +18,7 @@ namespace System.Buffers.Binary /// For native formats, MemoryExtensions.Read{T}; should be used. /// Use these helpers when you need to read specific endinanness. /// - static partial class BinaryPrimitives + public static partial class BinaryPrimitives { /// /// This is a no-op and added only for consistency. diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs index a450f58475..54cef4eb1f 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderBigEndian.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; namespace System.Buffers.Binary { - static partial class BinaryPrimitives + public static partial class BinaryPrimitives { /// /// Reads an Int16 out of a read-only span of bytes as big endian. diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs index 7fa7c256b8..17cebf1f27 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/ReaderLittleEndian.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; namespace System.Buffers.Binary { - static partial class BinaryPrimitives + public static partial class BinaryPrimitives { /// /// Reads an Int16 out of a read-only span of bytes as little endian. diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs index dc28ae0aae..fe59623138 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/Writer.cs @@ -11,7 +11,7 @@ using Internal.Runtime.CompilerServices; namespace System.Buffers.Binary { - static partial class BinaryPrimitives + public static partial class BinaryPrimitives { /// /// Writes a structure of type T into a span of bytes. diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs index 1b926cc40b..fa7228ba3b 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterBigEndian.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; namespace System.Buffers.Binary { - static partial class BinaryPrimitives + public static partial class BinaryPrimitives { /// /// Writes an Int16 into a span of bytes as big endian. diff --git a/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs index f87eeea19a..22bbe070eb 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/Binary/WriterLittleEndian.cs @@ -6,7 +6,7 @@ using System.Runtime.CompilerServices; namespace System.Buffers.Binary { - static partial class BinaryPrimitives + public static partial class BinaryPrimitives { /// /// Writes an Int16 into a span of bytes as little endian. 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 afc4ad3465..58c6514d3c 100644 --- a/external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs +++ b/external/corefx/src/System.Memory/src/System/Buffers/StandardFormat.cs @@ -10,7 +10,7 @@ namespace System.Buffers /// Represents a standard formatting string without using an actual String. A StandardFormat consists of a character (such as 'G', 'D' or 'X') /// and an optional precision ranging from 0..99, or the special value NoPrecision. /// - readonly struct StandardFormat : IEquatable + public readonly struct StandardFormat : IEquatable { /// /// Precision values for format that don't use a precision, or for when the precision is to be unspecified. 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 f700d02d34..dc3ffad9ba 100644 --- a/external/corefx/src/System.Memory/src/System/MemoryExtensions.Portable.cs +++ b/external/corefx/src/System.Memory/src/System/MemoryExtensions.Portable.cs @@ -10,7 +10,7 @@ namespace System /// /// Extension methods for Span{T}, Memory{T}, and friends. /// - static partial class MemoryExtensions + public static partial class MemoryExtensions { /// /// Casts a Span of one primitive type to Span of bytes. diff --git a/external/corefx/src/System.Memory/src/System/MemoryExtensions.cs b/external/corefx/src/System.Memory/src/System/MemoryExtensions.cs index a851f00790..d886fd5864 100644 --- a/external/corefx/src/System.Memory/src/System/MemoryExtensions.cs +++ b/external/corefx/src/System.Memory/src/System/MemoryExtensions.cs @@ -15,7 +15,7 @@ namespace System /// /// Extension methods for Span{T}, Memory{T}, and friends. /// - static partial class MemoryExtensions + public static partial class MemoryExtensions { /// /// Searches for the specified value and returns the index of its first occurrence. If not found, returns -1. Values are compared using IEquatable{T}.Equals(T). 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 149ac1dd5a..9097d09348 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,6 +5,7 @@ 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 996fee0615..7449e90345 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,6 +13,7 @@ ===========================================================*/ 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/Collections/IHashCodeProvider.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/IHashCodeProvider.cs index 70316f10ef..a7c892941d 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Collections/IHashCodeProvider.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Collections/IHashCodeProvider.cs @@ -9,7 +9,9 @@ namespace System.Collections /// GetHashCode() function on Objects, providing their own hash function. /// [Obsolete("Please use IEqualityComparer instead.")] +#if !MONO [System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] +#endif public interface IHashCodeProvider { /// Returns a hash code for the given object. diff --git a/external/corefx/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs b/external/corefx/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs index bf48d06e06..080dd877e1 100644 --- a/external/corefx/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs +++ b/external/corefx/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics; +using System.Diagnostics.Private; namespace System.Globalization { diff --git a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs index 1c4106b870..2f27e09f40 100644 --- a/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs +++ b/external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCompilationInfo.cs @@ -4,6 +4,9 @@ namespace System.Text.RegularExpressions { +#if MONO + [System.Serializable] +#endif public class RegexCompilationInfo { private string _pattern; diff --git a/external/corefx/src/System.Threading.Tasks/tests/Task/TaskCancelWaitTests.cs.REMOVED.git-id b/external/corefx/src/System.Threading.Tasks/tests/Task/TaskCancelWaitTests.cs.REMOVED.git-id index ad0352f4d8..9ed9f1f229 100644 --- a/external/corefx/src/System.Threading.Tasks/tests/Task/TaskCancelWaitTests.cs.REMOVED.git-id +++ b/external/corefx/src/System.Threading.Tasks/tests/Task/TaskCancelWaitTests.cs.REMOVED.git-id @@ -1 +1 @@ -d0848664b34f24dceeff57468988e52aa486b0a1 \ No newline at end of file +f103178e31df172d54c81614cbd615b07eff7f74 \ No newline at end of file diff --git a/external/linker/.github/CONTRIBUTING.md b/external/linker/.github/CONTRIBUTING.md index ed8d6fe7cc..0c71729b40 100644 --- a/external/linker/.github/CONTRIBUTING.md +++ b/external/linker/.github/CONTRIBUTING.md @@ -21,18 +21,12 @@ investigate bugs, regressions and problems. License ======= -The Mono runtime, compilers, and tools and most of the class libraries -are licensed under the MIT license. But include some bits of code -licensed under different licenses. The exact list is [available here] (https://github.com/mono/mono/blob/master/LICENSE). - -Different parts of Mono use different licenses. The actual details of -which licenses are used for which parts are detailed on the LICENSE -file in this directory. +Check the [LICENSE](https://github.com/mono/linker/blob/master/LICENSE) file. CLA ======= -Contributions are now taken under the [.NET Foundation CLA] (https://cla2.dotnetfoundation.org/). +Contributions are now taken under the [.NET Foundation CLA](https://cla.dotnetfoundation.org/). Testing ======= diff --git a/external/linker/.gitignore b/external/linker/.gitignore index 9e7d6f197a..ca173b5c41 100644 --- a/external/linker/.gitignore +++ b/external/linker/.gitignore @@ -27,6 +27,10 @@ bin/ **/Dependencies/*.dll +# corebuild build/test artifacts corebuild/Tools corebuild/bootstrap.log -/corebuild/global.json +corebuild/global.json +corebuild/**/bin +corebuild/**/obj +corebuild/testbin diff --git a/external/linker/Contributing.md b/external/linker/Contributing.md deleted file mode 100644 index ed8d6fe7cc..0000000000 --- a/external/linker/Contributing.md +++ /dev/null @@ -1,73 +0,0 @@ -Guidelines -========== - -When contributing to the Mono project, please follow the [Mono Coding -Guidelines][1]. We have been using a coding style for many years, -please make your patches conform to these guidelines. - -[1]: http://www.mono-project.com/community/contributing/coding-guidelines/ - -Etiquette -========= - -In general, we do not accept patches that merely shuffle code around, -split classes in multiple files, reindent the code or are the result -of running a refactoring tool on the source code. This is done for -three reasons: (a) we have our own coding guidelines; (b) Some modules -are imported from upstream sources and we want to respect their coding -guidelines and (c) it destroys valuable history that is often used to -investigate bugs, regressions and problems. - -License -======= - -The Mono runtime, compilers, and tools and most of the class libraries -are licensed under the MIT license. But include some bits of code -licensed under different licenses. The exact list is [available here] (https://github.com/mono/mono/blob/master/LICENSE). - -Different parts of Mono use different licenses. The actual details of -which licenses are used for which parts are detailed on the LICENSE -file in this directory. - -CLA -======= - -Contributions are now taken under the [.NET Foundation CLA] (https://cla2.dotnetfoundation.org/). - -Testing -======= - -Pull requests go through testing on our [Jenkins server][2]. We will -usually only merge a pull request if it causes no regressions in a -test run there. - -When you submit a pull request, one of two things happens: - -* If you are a new contributor, Jenkins will ask for permissions (on - the pull request) to test it. A maintainer will reply to approve - the test run if they find the patch appropriate. After you have - submitted a few patches, a maintainer will whitelist you so that - all of your future pull requests are tested automatically. -* If you are a well-known, whitelisted contributor, Jenkins will go - ahead and test your pull request as soon as a test machine is - available. - -When your pull request has been built, Jenkins will update the build -status of your pull request. If it succeeded and we like the changes, -a maintainer will likely merge it. Otherwise, you can amend your pull -request to fix build breakage and Jenkins will test it again. - -[2]: http://jenkins.mono-project.com/ - -# Inactivity - -Occasionally, a pull request sits for several months without any -response from the author. This isn't necessarily an issue, but we may -sometimes decide to close pull requests that have not seen any -progress for a long time. This is in interest of keeping the pull -request list clean so that other pull requests don't get lost in the -clutter. - -If we do close your pull request due to inactivity, you're more than -welcome to submit it anew after you address any comments or issues that -were brought up on the original pull request. diff --git a/external/linker/README.md b/external/linker/README.md index dcf7c8eb76..be887510ef 100644 --- a/external/linker/README.md +++ b/external/linker/README.md @@ -1,11 +1,21 @@ -# IL linker +# [IL Linker](linker/README.md) -The linker is a tool one can use to only ship the minimal possible IL code and metadata that a set of +The IL Linker is a tool one can use to only ship the minimal possible IL code and metadata that a set of programs might require to run as opposed to the full libraries. It is used by the various Xamarin products to extract only the bits of code that are needed to run an application on Android, iOS and other platforms. -### Build & Test Status +# [Analyzer](analyzer/README.md) + +The analyzer is a tool to analyze dependencies which were recorded during linker processing and led linker to mark an item to keep it in the resulting linked assembly. + +It can be used to better understand dependencies between different metadata members to help further reduce the linked output. + +## How to build the IL Linker + +TODO + +## Build & Test Status [![Build Status](https://jenkins.mono-project.com/buildStatus/icon?job=test-linker-mainline)](https://jenkins.mono-project.com/job/test-linker-mainline/) diff --git a/external/linker/analyzer/ConsoleDependencyGraph.cs b/external/linker/analyzer/ConsoleDependencyGraph.cs index f733b1efde..d5fe86de2a 100644 --- a/external/linker/analyzer/ConsoleDependencyGraph.cs +++ b/external/linker/analyzer/ConsoleDependencyGraph.cs @@ -15,7 +15,7 @@ namespace LinkerAnalyzer { public class ConsoleDependencyGraph : DependencyGraph { - public bool Tree = false; + public bool Tree; public bool FlatDeps; public void ShowDependencies (string raw, List verticesList, string searchString) @@ -48,16 +48,25 @@ namespace LinkerAnalyzer Console.WriteLine (); foreach (var d in flatDeps) { + var dSize = SpaceAnalyzer == null ? 0 : SpaceAnalyzer.GetSize (d.Item1); if (first) { - Console.WriteLine ($"Distance | {d.Item1.value} [total deps: {flatDeps.Count}]"); + var sizeStr = dSize > 0 ? $" [size: {dSize}]" : ""; + Console.WriteLine ($"Distance | {d.Item1.value} [total deps: {flatDeps.Count}]{sizeStr}"); Line (); first = false; continue; } - Console.WriteLine ($"{string.Format ("{0,8}", d.Item2)} | {d.Item1.value}"); + var sizeStr2 = dSize > 0 ? $" [size: {dSize}]" : ""; + Console.WriteLine ($"{string.Format ("{0,8}", d.Item2)} | {d.Item1.value}{d.Item1.DepsCount}{sizeStr2}"); } } + string SizeString (VertexData vertex) + { + return SpaceAnalyzer == null ? + "" : string.Format (" size: {0}", SpaceAnalyzer.GetSize (vertex)); + } + public void ShowDependencies (VertexData vertex) { if (FlatDeps) { @@ -73,7 +82,7 @@ namespace LinkerAnalyzer int i = 0; foreach (int index in vertex.parentIndexes) { Console.WriteLine ("Dependency #{0}", ++i); - Console.WriteLine ("\t{0}", vertex.value); + Console.WriteLine ($"\t{vertex.value}{SizeString (vertex)}"); var childVertex = Vertex (index); Console.WriteLine ("\t| {0}{1}", childVertex.value, childVertex.DepsCount); while (childVertex.parentIndexes != null) { @@ -166,7 +175,7 @@ namespace LinkerAnalyzer Console.WriteLine (); } - void Header (string header, params object[] values) + static public void Header (string header, params object[] values) { string formatted = string.Format (header, values); Console.WriteLine (); diff --git a/external/linker/analyzer/LinkerAnalyzerCore/DependencyGraph.cs b/external/linker/analyzer/LinkerAnalyzerCore/DependencyGraph.cs index 3ab825d2b1..7fff87922e 100644 --- a/external/linker/analyzer/LinkerAnalyzerCore/DependencyGraph.cs +++ b/external/linker/analyzer/LinkerAnalyzerCore/DependencyGraph.cs @@ -34,6 +34,7 @@ namespace LinkerAnalyzer.Core public List Types = new List (); Dictionary indexes = new Dictionary (); protected Dictionary counts = new Dictionary (); + internal SpaceAnalyzer SpaceAnalyzer { get; set; } public void Load (string filename) { diff --git a/external/linker/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs b/external/linker/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs new file mode 100644 index 0000000000..a66cbce09c --- /dev/null +++ b/external/linker/analyzer/LinkerAnalyzerCore/SpaceAnalyzer.cs @@ -0,0 +1,153 @@ +// SpaceAnalyzer.cs +// +// Author: +// Radek Doulik +// +// Copyright (C) 2018 Microsoft Corporation (http://www.microsoft.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 Mono.Cecil; + +namespace LinkerAnalyzer.Core +{ + public class SpaceAnalyzer + { + string assembliesDirectory; + List assemblies = new List (); + readonly Dictionary sizes = new Dictionary (); + + public SpaceAnalyzer (string assembliesDirectory) + { + this.assembliesDirectory = assembliesDirectory; + } + + static bool IsAssemblyBound (TypeDefinition td) + { + do { + if (td.IsNestedPrivate || td.IsNestedAssembly || td.IsNestedFamilyAndAssembly) + return true; + + td = td.DeclaringType; + } while (td != null); + + return false; + } + + string GetTypeKey (TypeDefinition td) + { + if (td == null) + return ""; + + var addAssembly = td.IsNotPublic || IsAssemblyBound (td); + + var addition = addAssembly ? $":{td.Module}" : ""; + return $"{td.MetadataToken.TokenType}:{td}{addition}"; + } + + string GetKey (IMetadataTokenProvider provider) + { + return $"{provider.MetadataToken.TokenType}:{provider}"; + } + + int GetMethodSize (MethodDefinition method) + { + var key = GetKey (method); + + if (sizes.ContainsKey (key)) + return sizes [key]; + + var msize = method.Body.CodeSize; + msize += method.Name.Length; + + sizes.Add (key, msize); + + return msize; + } + + int ProcessType (TypeDefinition type) + { + int size = type.Name.Length; + + foreach (var field in type.Fields) + size += field.Name.Length; + + foreach (var method in type.Methods) { + method.Resolve (); + if (method.Body != null) + size += GetMethodSize (method); + } + + var resolvedType = type.Resolve (); + try { + sizes.Add (GetTypeKey (type), size); + } catch (ArgumentException e) { + Console.WriteLine ($"\nWarning: duplicated type '{type}' scope '{type.Scope}'\n{e}"); + } + return size; + } + + public void LoadAssemblies (bool verbose = true) + { + if (verbose) { + ConsoleDependencyGraph.Header ("Space analyzer"); + Console.WriteLine ("Load assemblies from {0}", assembliesDirectory); + } else + Console.Write ("Analyzing assemblies ."); + + var resolver = new DefaultAssemblyResolver (); + resolver.AddSearchDirectory (assembliesDirectory); + + int totalSize = 0; + foreach (var file in System.IO.Directory.GetFiles (assembliesDirectory, "*.dll")) { + if (verbose) + Console.WriteLine ($"Analyzing {file}"); + else + Console.Write ("."); + + ReaderParameters parameters = new ReaderParameters () { ReadingMode = ReadingMode.Immediate, AssemblyResolver = resolver}; + var assembly = AssemblyDefinition.ReadAssembly (file, parameters); + assemblies.Add (assembly); + foreach (var module in assembly.Modules) { + foreach (var type in module.Types) { + totalSize += ProcessType (type); + foreach (var child in type.NestedTypes) + totalSize += ProcessType (child); + } + } + } + + if (verbose) + Console.WriteLine ("Total known size: {0}", totalSize); + else + System.Console.WriteLine (); + } + + public int GetSize (VertexData vertex) + { + if (sizes.ContainsKey (vertex.value)) + return sizes [vertex.value]; + return 0; + } + } +} diff --git a/external/linker/analyzer/Main.cs b/external/linker/analyzer/Main.cs index a5d7b877da..9e9b31cacb 100644 --- a/external/linker/analyzer/Main.cs +++ b/external/linker/analyzer/Main.cs @@ -23,23 +23,23 @@ namespace LinkerAnalyzer bool showRawDeps = false; string rawName = null; bool showRoots = false; - bool showSpaceUsage = false; bool showStat = false; bool showTypes = false; bool reduceToTree = false; bool verbose = false; bool flatDeps = false; + string linkedPath = null; var optionsParser = new OptionSet () { { "a|alldeps", "show all dependencies", v => { showAllDeps = v != null; } }, { "h|help", "show this message and exit.", v => showUsage = v != null }, + { "l|linkedpath=", "sets the linked assemblies directory path. Enables displaying size estimates.", v => { linkedPath = v; } }, { "r|rawdeps=", "show raw vertex dependencies. Raw vertex VALUE is in the raw format written by linker to the dependency XML file. VALUE can be regular expression", v => { showRawDeps = v != null; rawName = v; } }, { "roots", "show root dependencies.", v => showRoots = v != null }, { "stat", "show statistic of loaded dependencies.", v => showStat = v != null }, { "tree", "reduce the dependency graph to the tree.", v => reduceToTree = v != null }, { "types", "show all types dependencies.", v => showTypes = v != null }, { "t|typedeps=", "show type dependencies. The VALUE can be regular expression", v => { showTypeDeps = v != null; typeName = v; } }, - //{ "u|spaceusage", "show space analysis.", v => showSpaceUsage = v != null }, { "f|flat", "show all dependencies per vertex and their distance", v => flatDeps = v != null }, { "v|verbose", "be more verbose. Enables stat and roots options.", v => verbose = v != null }, }; @@ -61,9 +61,9 @@ namespace LinkerAnalyzer ConsoleDependencyGraph deps = new ConsoleDependencyGraph () { Tree = reduceToTree, FlatDeps = flatDeps }; deps.Load (dependencyFile); - if (showSpaceUsage) { -// SpaceAnalyzer sa = new SpaceAnalyzer (System.IO.Path.GetDirectoryName (dependencyFile)); -// sa.LoadAssemblies (verbose); + if (linkedPath != null) { + deps.SpaceAnalyzer = new SpaceAnalyzer (linkedPath); + deps.SpaceAnalyzer.LoadAssemblies (verbose); } if (verbose) { diff --git a/external/linker/analyzer/README.md b/external/linker/analyzer/README.md index b5c0427daa..ed0787a968 100644 --- a/external/linker/analyzer/README.md +++ b/external/linker/analyzer/README.md @@ -1,3 +1,5 @@ +# Linker Analyzer + Linker analyzer is a command line tool to analyze dependencies, which were recorded during linker processing, and led linker to mark an item to keep it in the resulting linked assembly. @@ -7,8 +9,7 @@ dumped during the linker run. The vertices of this graph are the items of interest like assemblies, types, methods, fields, linker steps, etc. The edges represent the dependencies. -How to dump dependencies ------------------------- +## How to dump dependencies The linker analyzer needs a linker dependencies file as an input. It can be retrieved by enabling dependencies dumping during linking of a @@ -25,8 +26,7 @@ the project like this: After a successful build, there will be a linker-dependencies.xml.gz file created, containing the information for the analyzer. -How to use the analyzer ------------------------ +## How to use the analyzer Let say you would like to know, why a type, Android.App.Activity for example, was marked by the linker. So run the analyzer like this: @@ -48,11 +48,7 @@ Dependency #1 | Other:Mono.Linker.Steps.ResolveFromAssemblyStep ``` -The output contains dependencies string(s), starting with the type and -continuing with the item of interest, which depends on the type. The -dependency could be result of multiple reasons. For example the type -was referenced from a method, or the type was listed in the linker xml -file to be protected. +The output contains dependencies string(s), starting with the type and continuing with the item of interest, which depends on the type. The dependency could be a result of multiple reasons. For example, the type was referenced from a method, or the type was listed in the linker XML descriptor file. In our example there is only one dependency string called `Dependency #1`. It shows us that the type `Android.App.Activity` was marked @@ -91,8 +87,7 @@ Dependency #2 | Other:Mono.Linker.Steps.ResolveFromAssemblyStep ``` -Known issues ------------- +### Known issues Sometimes the linker processing is not straight forward and the marking is postponed, like processing of some of the methods. They are @@ -100,8 +95,8 @@ queued to be processed later. In such case the dependencies are "interrupted" and the dependecy string for the method usually shows just dependency on the Mark step. -Command line help ------------------ +# Command line help + ``` Usage: diff --git a/external/linker/analyzer/analyzer.csproj b/external/linker/analyzer/analyzer.csproj index 40ce78281a..5bb3d338e9 100644 --- a/external/linker/analyzer/analyzer.csproj +++ b/external/linker/analyzer/analyzer.csproj @@ -31,11 +31,16 @@ + + {D68133BD-1E63-496E-9EDE-4FBDBF77B486} + Mono.Cecil + + Options.cs diff --git a/external/linker/cecil/Mono.Cecil.Cil/PortablePdb.cs b/external/linker/cecil/Mono.Cecil.Cil/PortablePdb.cs index 717249e909..a7883e71d1 100644 --- a/external/linker/cecil/Mono.Cecil.Cil/PortablePdb.cs +++ b/external/linker/cecil/Mono.Cecil.Cil/PortablePdb.cs @@ -569,6 +569,9 @@ namespace Mono.Cecil.Cil { if (hash_algo == DocumentHashAlgorithm.SHA1) return hash_sha1; + if (hash_algo == DocumentHashAlgorithm.SHA256) + return hash_sha256; + return new Guid (); } diff --git a/external/linker/cecil/Mono.Cecil.Cil/Symbols.cs b/external/linker/cecil/Mono.Cecil.Cil/Symbols.cs index 4c4a8b0306..c47761dd90 100644 --- a/external/linker/cecil/Mono.Cecil.Cil/Symbols.cs +++ b/external/linker/cecil/Mono.Cecil.Cil/Symbols.cs @@ -1000,7 +1000,7 @@ namespace Mono.Cecil { public static bool IsPortablePdb (string fileName) { - using (var file = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.Read)) + using (var file = new FileStream (fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) return IsPortablePdb (file); } diff --git a/external/linker/cecil/Mono.Cecil.PE/Image.cs b/external/linker/cecil/Mono.Cecil.PE/Image.cs index d9d182ad7e..25ea1869ed 100644 --- a/external/linker/cecil/Mono.Cecil.PE/Image.cs +++ b/external/linker/cecil/Mono.Cecil.PE/Image.cs @@ -28,6 +28,7 @@ namespace Mono.Cecil.PE { public string RuntimeVersion; public TargetArchitecture Architecture; public ModuleCharacteristics Characteristics; + public ushort LinkerVersion; public ImageDebugHeader DebugHeader; diff --git a/external/linker/cecil/Mono.Cecil.PE/ImageReader.cs b/external/linker/cecil/Mono.Cecil.PE/ImageReader.cs index 63213f3941..f3f3d2641a 100644 --- a/external/linker/cecil/Mono.Cecil.PE/ImageReader.cs +++ b/external/linker/cecil/Mono.Cecil.PE/ImageReader.cs @@ -81,8 +81,8 @@ namespace Mono.Cecil.PE { // Characteristics 2 ushort characteristics = ReadUInt16 (); - ushort subsystem, dll_characteristics; - ReadOptionalHeaders (out subsystem, out dll_characteristics); + ushort subsystem, dll_characteristics, linker_version; + ReadOptionalHeaders (out subsystem, out dll_characteristics, out linker_version); ReadSections (sections); ReadCLIHeader (); ReadMetadata (); @@ -90,6 +90,7 @@ namespace Mono.Cecil.PE { image.Kind = GetModuleKind (characteristics, subsystem); image.Characteristics = (ModuleCharacteristics) dll_characteristics; + image.LinkerVersion = linker_version; } TargetArchitecture ReadArchitecture () @@ -108,7 +109,7 @@ namespace Mono.Cecil.PE { return ModuleKind.Console; } - void ReadOptionalHeaders (out ushort subsystem, out ushort dll_characteristics) + void ReadOptionalHeaders (out ushort subsystem, out ushort dll_characteristics, out ushort linker) { // - PEOptionalHeader // - StandardFieldsHeader @@ -118,8 +119,7 @@ namespace Mono.Cecil.PE { // pe32 || pe64 - // LMajor 1 - // LMinor 1 + linker = ReadUInt16 (); // CodeSize 4 // InitializedDataSize 4 // UninitializedDataSize4 @@ -142,7 +142,7 @@ namespace Mono.Cecil.PE { // ImageSize 4 // HeaderSize 4 // FileChecksum 4 - Advance (66); + Advance (64); // SubSystem 2 subsystem = ReadUInt16 (); diff --git a/external/linker/cecil/Mono.Cecil.PE/ImageWriter.cs b/external/linker/cecil/Mono.Cecil.PE/ImageWriter.cs index f69e134677..366f4f4205 100644 --- a/external/linker/cecil/Mono.Cecil.PE/ImageWriter.cs +++ b/external/linker/cecil/Mono.Cecil.PE/ImageWriter.cs @@ -218,9 +218,8 @@ namespace Mono.Cecil.PE { void WriteOptionalHeaders () { - WriteUInt16 ((ushort) (!pe64 ? 0x10b : 0x20b)); // Magic - WriteByte (8); // LMajor - WriteByte (0); // LMinor + WriteUInt16 ((ushort) (!pe64 ? 0x10b : 0x20b)); // Magic + WriteUInt16 (module.linker_version); WriteUInt32 (text.SizeOfRawData); // CodeSize WriteUInt32 ((reloc != null ? reloc.SizeOfRawData : 0) + (rsrc != null ? rsrc.SizeOfRawData : 0)); // InitializedDataSize diff --git a/external/linker/cecil/Mono.Cecil/AssemblyWriter.cs b/external/linker/cecil/Mono.Cecil/AssemblyWriter.cs index 52c601c742..7b3710e2fd 100644 --- a/external/linker/cecil/Mono.Cecil/AssemblyWriter.cs +++ b/external/linker/cecil/Mono.Cecil/AssemblyWriter.cs @@ -2414,10 +2414,12 @@ namespace Mono.Cecil { var signature = CreateSignatureWriter (); signature.WriteUInt32 ((uint) async_method.catch_handler.Offset + 1); - for (int i = 0; i < async_method.yields.Count; i++) { - signature.WriteUInt32 ((uint) async_method.yields [i].Offset); - signature.WriteUInt32 ((uint) async_method.resumes [i].Offset); - signature.WriteCompressedUInt32 (async_method.resume_methods [i].MetadataToken.RID); + if (!async_method.yields.IsNullOrEmpty ()) { + for (int i = 0; i < async_method.yields.Count; i++) { + signature.WriteUInt32 ((uint) async_method.yields [i].Offset); + signature.WriteUInt32 ((uint) async_method.resumes [i].Offset); + signature.WriteCompressedUInt32 (async_method.resume_methods [i].MetadataToken.RID); + } } AddCustomDebugInformation (provider, async_method, signature); diff --git a/external/linker/cecil/Mono.Cecil/CustomAttribute.cs b/external/linker/cecil/Mono.Cecil/CustomAttribute.cs index 135f8b7247..d64411fc22 100644 --- a/external/linker/cecil/Mono.Cecil/CustomAttribute.cs +++ b/external/linker/cecil/Mono.Cecil/CustomAttribute.cs @@ -9,7 +9,7 @@ // using System; - +using System.Diagnostics; using Mono.Collections.Generic; namespace Mono.Cecil { @@ -68,6 +68,7 @@ namespace Mono.Cecil { Collection ConstructorArguments { get; } } + [DebuggerDisplay ("{AttributeType}")] public sealed class CustomAttribute : ICustomAttribute { internal CustomAttributeValueProjection projection; diff --git a/external/linker/cecil/Mono.Cecil/ModuleDefinition.cs b/external/linker/cecil/Mono.Cecil/ModuleDefinition.cs index d82db4e490..85381c0bbd 100644 --- a/external/linker/cecil/Mono.Cecil/ModuleDefinition.cs +++ b/external/linker/cecil/Mono.Cecil/ModuleDefinition.cs @@ -276,6 +276,7 @@ namespace Mono.Cecil { TargetArchitecture architecture; ModuleAttributes attributes; ModuleCharacteristics characteristics; + internal ushort linker_version = 8; Guid mvid; internal uint timestamp; @@ -350,7 +351,7 @@ namespace Mono.Cecil { set { characteristics = value; } } - [Obsolete("Use FileName")] + [Obsolete ("Use FileName")] public string FullyQualifiedName { get { return file_name; } } @@ -607,6 +608,7 @@ namespace Mono.Cecil { this.architecture = image.Architecture; this.attributes = image.Attributes; this.characteristics = image.Characteristics; + this.linker_version = image.LinkerVersion; this.file_name = image.FileName; this.timestamp = image.Timestamp; diff --git a/external/linker/cecil/Mono.Cecil/ModuleKind.cs b/external/linker/cecil/Mono.Cecil/ModuleKind.cs index a5aa2274a4..2cd084db5a 100644 --- a/external/linker/cecil/Mono.Cecil/ModuleKind.cs +++ b/external/linker/cecil/Mono.Cecil/ModuleKind.cs @@ -38,6 +38,7 @@ namespace Mono.Cecil { public enum ModuleAttributes { ILOnly = 1, Required32Bit = 2, + ILLibrary = 4, StrongNameSigned = 8, Preferred32Bit = 0x00020000, } diff --git a/external/linker/cecil/Mono.Cecil/SecurityDeclaration.cs b/external/linker/cecil/Mono.Cecil/SecurityDeclaration.cs index 2762d08b39..a18d14f25a 100644 --- a/external/linker/cecil/Mono.Cecil/SecurityDeclaration.cs +++ b/external/linker/cecil/Mono.Cecil/SecurityDeclaration.cs @@ -9,7 +9,7 @@ // using System; - +using System.Diagnostics; using Mono.Collections.Generic; namespace Mono.Cecil { @@ -38,6 +38,7 @@ namespace Mono.Cecil { Collection SecurityDeclarations { get; } } + [DebuggerDisplay ("{AttributeType}")] public sealed class SecurityAttribute : ICustomAttribute { TypeReference attribute_type; diff --git a/external/linker/corebuild/integration/ILLink.CustomSteps/ClearInitLocals.cs b/external/linker/corebuild/integration/ILLink.CustomSteps/ClearInitLocals.cs index e3bee0baa5..5a3b32374d 100644 --- a/external/linker/corebuild/integration/ILLink.CustomSteps/ClearInitLocals.cs +++ b/external/linker/corebuild/integration/ILLink.CustomSteps/ClearInitLocals.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Mono.Linker; using Mono.Linker.Steps; @@ -8,17 +9,41 @@ namespace ILLink.CustomSteps { public class ClearInitLocalsStep : BaseStep { - protected override void ProcessAssembly(AssemblyDefinition assembly) + HashSet _assemblies; + + protected override void Process () { + string parameterName = "ClearInitLocalsAssemblies"; + + if (Context.HasParameter (parameterName)) { + string parameter = Context.GetParameter (parameterName); + _assemblies = new HashSet (parameter.Split(','), StringComparer.OrdinalIgnoreCase); + } + } + + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + if ((_assemblies != null) && (!_assemblies.Contains (assembly.Name.Name))) { + return; + } + + bool changed = false; + foreach (ModuleDefinition module in assembly.Modules) { foreach (TypeDefinition type in module.Types) { foreach (MethodDefinition method in type.Methods) { if (method.Body != null) { - method.Body.InitLocals = false; + if (method.Body.InitLocals) { + method.Body.InitLocals = false; + changed = true; + } } } } } + + if (changed && (Annotations.GetAction (assembly) == AssemblyAction.Copy)) + Annotations.SetAction (assembly, AssemblyAction.Save); } } } diff --git a/external/linker/corebuild/integration/ILLink.CustomSteps/ILLink.CustomSteps.csproj b/external/linker/corebuild/integration/ILLink.CustomSteps/ILLink.CustomSteps.csproj index c90895967f..1eb2d728da 100644 --- a/external/linker/corebuild/integration/ILLink.CustomSteps/ILLink.CustomSteps.csproj +++ b/external/linker/corebuild/integration/ILLink.CustomSteps/ILLink.CustomSteps.csproj @@ -45,6 +45,12 @@ Configuration=net_4_0_Release Configuration=netstandard_Release + + Configuration=net_4_0_Debug + Configuration=netstandard_Debug + Configuration=net_4_0_Release + Configuration=netstandard_Release + diff --git a/external/linker/corebuild/integration/ILLink.Tasks/AdapterLogger.cs b/external/linker/corebuild/integration/ILLink.Tasks/AdapterLogger.cs new file mode 100644 index 0000000000..c36c4bffb2 --- /dev/null +++ b/external/linker/corebuild/integration/ILLink.Tasks/AdapterLogger.cs @@ -0,0 +1,37 @@ +using System; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +namespace ILLink.Tasks +{ + class AdapterLogger : Mono.Linker.ILogger + { + private TaskLoggingHelper log; + + public AdapterLogger (TaskLoggingHelper log) + { + this.log = log; + } + + public void LogMessage (Mono.Linker.MessageImportance importance, string message, params object[] values) + { + Microsoft.Build.Framework.MessageImportance msBuildImportance; + switch (importance) + { + case Mono.Linker.MessageImportance.High: + msBuildImportance = MessageImportance.High; + break; + case Mono.Linker.MessageImportance.Normal: + msBuildImportance = MessageImportance.Normal; + break; + case Mono.Linker.MessageImportance.Low: + msBuildImportance = MessageImportance.Low; + break; + default: + throw new ArgumentException ($"Unrecognized importance level {importance}", nameof(importance)); + } + + log.LogMessageFromText (String.Format (message, values), msBuildImportance); + } + } +} diff --git a/external/linker/corebuild/integration/ILLink.Tasks/FindNativeDeps.cs b/external/linker/corebuild/integration/ILLink.Tasks/FindNativeDeps.cs index 86d59c08c5..30d52847d5 100644 --- a/external/linker/corebuild/integration/ILLink.Tasks/FindNativeDeps.cs +++ b/external/linker/corebuild/integration/ILLink.Tasks/FindNativeDeps.cs @@ -17,13 +17,13 @@ namespace ILLink.Tasks /// dependencies. /// [Required] - public ITaskItem[] ManagedAssemblyPaths { get; set; } + public ITaskItem [] ManagedAssemblyPaths { get; set; } /// /// The set of native dependencies to keep even if they - /// aren't found to be referenced by a managed assembly.. + /// aren't found to be referenced by a managed assembly. /// - public ITaskItem[] NativeDepsToKeep { get; set; } + public ITaskItem [] NativeDepsToKeep { get; set; } /// /// The paths to the available native dependencies. We @@ -31,7 +31,7 @@ namespace ILLink.Tasks /// native files. /// [Required] - public ITaskItem[] NativeDepsPaths { get; set; } + public ITaskItem [] NativeDepsPaths { get; set; } /// /// The set of native dependencies to keep, including those @@ -40,67 +40,51 @@ namespace ILLink.Tasks /// input NativeDepsToKeep. /// [Output] - public ITaskItem[] KeptNativeDepsPaths { get; set; } + public ITaskItem [] KeptNativeDepsPaths { get; set; } - public override bool Execute() + public override bool Execute () { - var allNative = new Dictionary (); - foreach (var n in NativeDepsPaths) - { - var fileName = Path.GetFileName(n.ItemSpec); - if (!allNative.ContainsKey(fileName)) - { - allNative.Add(fileName, n); - } - } - var keptNative = new List (); - var managedAssemblies = ManagedAssemblyPaths.Select (i => i.ItemSpec).ToArray(); - foreach (string managedAssembly in managedAssemblies) - { - using (var peReader = new PEReader(new FileStream(managedAssembly, FileMode.Open, FileAccess.Read, FileShare.Read))) - { - if (peReader.HasMetadata) - { - var reader = peReader.GetMetadataReader(); - for (int i = 1, count = reader.GetTableRowCount(TableIndex.ModuleRef); i <= count; i++) - { - var moduleRef = reader.GetModuleReference(MetadataTokens.ModuleReferenceHandle(i)); - var moduleName = reader.GetString(moduleRef.Name); + var allNativeNames = new HashSet (); + foreach (var nativeDep in NativeDepsPaths) + allNativeNames.Add (Path.GetFileName (nativeDep.ItemSpec)); + var keptNativeNames = new HashSet (); + foreach (var nativeDep in NativeDepsToKeep) + keptNativeNames.Add (Path.GetFileName (nativeDep.ItemSpec)); - var moduleRefCandidates = new[] { moduleName, moduleName + ".dll", moduleName + ".so", moduleName + ".dylib" }; + var managedAssemblies = ManagedAssemblyPaths.Select (i => i.ItemSpec).ToArray (); + foreach (string managedAssembly in managedAssemblies) { + using (var peReader = new PEReader(new FileStream (managedAssembly, FileMode.Open, FileAccess.Read, FileShare.Read))) { + if (peReader.HasMetadata) { + var reader = peReader.GetMetadataReader (); + for (int i = 1, count = reader.GetTableRowCount (TableIndex.ModuleRef); i <= count; i++) { + var moduleRef = reader.GetModuleReference (MetadataTokens.ModuleReferenceHandle (i)); + var moduleName = reader.GetString (moduleRef.Name); - ITaskItem referencedNativeFile = null; - foreach (string moduleRefCandidate in moduleRefCandidates) - { - if (allNative.TryGetValue (moduleRefCandidate, out referencedNativeFile)) - { - break; + var moduleRefCandidates = new [] { moduleName, moduleName + ".dll", moduleName + ".so", moduleName + ".dylib" }; + + bool foundModuleRef = false; + foreach (string moduleRefCandidate in moduleRefCandidates) { + if (allNativeNames.Contains (moduleRefCandidate)) { + keptNativeNames.Add (moduleRefCandidate); + foundModuleRef = true; } } - if (referencedNativeFile != null) - { - keptNative.Add(referencedNativeFile); - } - else - { - // DLLImport that wasn't satisfied - Log.LogMessage(MessageImportance.High, "unsatisfied DLLImport: " + managedAssembly + " -> " + moduleName); - } + if (!foundModuleRef) + Log.LogMessage("unsatisfied DLLImport: " + managedAssembly + " -> " + moduleName); } } } } - foreach (var n in NativeDepsToKeep) - { - ITaskItem nativeFile = null; - if (allNative.TryGetValue (n.ItemSpec, out nativeFile)) - { - keptNative.Add(nativeFile); - } + var keptNativeDeps = new List (); + foreach (var nativeDep in NativeDepsPaths) { + var fileName = Path.GetFileName (nativeDep.ItemSpec); + if (keptNativeNames.Contains (fileName)) + keptNativeDeps.Add (nativeDep); } - KeptNativeDepsPaths = keptNative.ToArray(); + + KeptNativeDepsPaths = keptNativeDeps.ToArray (); return true; } } diff --git a/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj b/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj index f86fe1c6a0..b5e37eebcd 100644 --- a/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj +++ b/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.csproj @@ -97,6 +97,7 @@ + @@ -195,7 +196,7 @@ - + Configuration=net_4_0_$(Configuration) Configuration=netstandard_$(Configuration) diff --git a/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets b/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets index 5a9af26124..e4938b8362 100644 --- a/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets +++ b/external/linker/corebuild/integration/ILLink.Tasks/ILLink.Tasks.targets @@ -18,10 +18,15 @@ false Copy Delete - Link - Delete + AddBypassNGen + Skip + Delete + Skip true false + true + false + false @@ -110,7 +115,7 @@ <_DebugSymbolsIntermediatePath Include="@(_LinkedDebugSymbols)" Condition=" '$(_DebugSymbolsProduced)' == 'true' " /> - + - -t -l none -b true + -t -l none -b true --skip-unresolved true --verbose @@ -241,6 +248,7 @@ <_NativeResolvedDepsToPublish Include="@(ResolvedAssembliesToPublish)" /> <_NativeResolvedDepsToPublish Remove="@(_ManagedResolvedAssembliesToPublish)" /> + <_NativeResolvedDepsToPublish Remove="@(_NativeResolvedDepsToPublish->WithMetadataValue('AssetType', 'resources'))" /> @@ -255,11 +263,15 @@ <_NativeDepsToAlwaysKeep Include="hostpolicy.dll;libhostpolicy.dylib;libhostpolicy.so" /> - + + <_NativeKeptDepsToPublish Condition=" '$(LinkerTrimNativeDeps)' != 'true' ">"@(_NativeResolvedDepsToPublish)" + @@ -272,6 +284,26 @@ <_ManagedAssembliesToLink Include="@(IntermediateAssembly)" /> <_ManagedAssembliesToLink Include="@(_ManagedResolvedAssembliesToPublish)" /> + + + + + + + <_ReferencedLibraries Include="@(ReferencePath->'%(ResolvedPath)')" Exclude="@(_ReferencedLibrariesToExclude)" /> + <_ManagedAssembliesToLink Include="@(_ReferencedLibraries)" /> + + @@ -298,7 +330,7 @@ output and the generated deps.json file. Excluding it from _ManagedResolvedAssembliesToPublish will prevent it from getting filtered out of the publish output later. - + In the future we may want to detect ngen assemblies and filter them more robustly. --> - @@ -354,7 +387,7 @@ - @@ -364,13 +397,19 @@ - - + + + + + @@ -416,7 +455,7 @@ <_RemovedNativeDeps Include="@(_NativeResolvedDepsToPublish)" /> <_RemovedNativeDeps Remove="@(_NativeKeptDepsToPublish)" /> - + <_PublishConflictPackageFiles Include="@(_RemovedManagedAssemblies)" /> <_PublishConflictPackageFiles Include="@(_RemovedNativeDeps)" /> diff --git a/external/linker/corebuild/integration/ILLink.Tasks/LinkTask.cs b/external/linker/corebuild/integration/ILLink.Tasks/LinkTask.cs index acca123913..b6fb017630 100644 --- a/external/linker/corebuild/integration/ILLink.Tasks/LinkTask.cs +++ b/external/linker/corebuild/integration/ILLink.Tasks/LinkTask.cs @@ -46,6 +46,17 @@ namespace ILLink.Tasks /// public ITaskItem [] RootDescriptorFiles { get; set; } + /// + /// Boolean specifying whether to clear initlocals flag on methods. + /// + public bool ClearInitLocals { get; set; } + + /// + /// A comma-separated list of assemblies whose methods + /// should have initlocals flag cleared if ClearInitLocals is true. + /// + public string ClearInitLocalsAssemblies { get; set; } + /// /// Extra arguments to pass to illink, delimited by spaces. /// @@ -61,7 +72,8 @@ namespace ILLink.Tasks string [] args = GenerateCommandLineCommands (); var argsString = String.Join (" ", args); Log.LogMessageFromText ($"illink {argsString}", MessageImportance.Normal); - int ret = Mono.Linker.Driver.Main (args); + var logger = new AdapterLogger (Log); + int ret = Mono.Linker.Driver.Execute (args, logger); return ret == 0; } @@ -104,6 +116,17 @@ namespace ILLink.Tasks args.Add (OutputDirectory.ItemSpec); } + if (ClearInitLocals) { + args.Add ("-s"); + // Version of ILLink.CustomSteps is passed as a workaround for msbuild issue #3016 + args.Add ("ILLink.CustomSteps.ClearInitLocalsStep,ILLink.CustomSteps,Version=0.0.0.0:OutputStep"); + if ((ClearInitLocalsAssemblies != null) && (ClearInitLocalsAssemblies.Length > 0)) { + args.Add ("-m"); + args.Add ("ClearInitLocalsAssemblies"); + args.Add (ClearInitLocalsAssemblies); + } + } + if (ExtraArgs != null) { args.AddRange (ExtraArgs.Split (' ')); } diff --git a/external/linker/corebuild/integration/test/CommandRunner.cs b/external/linker/corebuild/integration/test/CommandRunner.cs new file mode 100644 index 0000000000..efee6cbbd7 --- /dev/null +++ b/external/linker/corebuild/integration/test/CommandRunner.cs @@ -0,0 +1,146 @@ +using System; +using System.Diagnostics; +using System.Text; +using Xunit; +using Xunit.Abstractions; + +namespace ILLink.Tests +{ + public class CommandRunner + { + protected readonly ITestOutputHelper outputHelper; + + private string command; + private string args; + private string workingDir; + private string additionalPath; + private int timeout = Int32.MaxValue; + private string terminatingOutput; + + public CommandRunner(string command, ITestOutputHelper outputHelper) { + this.command = command; + this.outputHelper = outputHelper; + } + + public CommandRunner WithArguments(string args) { + this.args = args; + return this; + } + + public CommandRunner WithWorkingDir(string workingDir) { + this.workingDir = workingDir; + return this; + } + + public CommandRunner WithAdditionalPath(string additionalPath) { + this.additionalPath = additionalPath; + return this; + } + + public CommandRunner WithTimeout(int timeout) { + this.timeout = timeout; + return this; + } + + public CommandRunner WithTerminatingOutput(string terminatingOutput) { + this.terminatingOutput = terminatingOutput; + return this; + } + + public int Run() + { + return Run(out string commandOutputUnused); + } + + public int Run(out string commandOutput) + { + if (String.IsNullOrEmpty(command)) { + throw new Exception("No command was specified specified."); + } + if (outputHelper == null) { + throw new Exception("No output helper present."); + } + var psi = new ProcessStartInfo + { + FileName = command, + UseShellExecute = false, + RedirectStandardOutput = true, + RedirectStandardError = true, + }; + outputHelper.WriteLine($"caller working directory: {Environment.CurrentDirectory}"); + if (!String.IsNullOrEmpty(args)) { + psi.Arguments = args; + outputHelper.WriteLine($"{command} {args}"); + } else { + outputHelper.WriteLine($"{command}"); + } + if (!String.IsNullOrEmpty(workingDir)) { + outputHelper.WriteLine($"working directory: {workingDir}"); + psi.WorkingDirectory = workingDir; + } + if (!String.IsNullOrEmpty(additionalPath)) { + string path = psi.Environment["PATH"]; + psi.Environment["PATH"] = path + ";" + additionalPath; + } + var process = new Process(); + process.StartInfo = psi; + + // dotnet sets some environment variables that + // may cause problems in the child process. + psi.Environment.Remove("MSBuildExtensionsPath"); + psi.Environment.Remove("MSBuildLoadMicrosoftTargetsReadOnly"); + psi.Environment.Remove("MSBuildSDKsPath"); + psi.Environment.Remove("VbcToolExe"); + psi.Environment.Remove("CscToolExe"); + psi.Environment.Remove("MSBUILD_EXE_PATH"); + + outputHelper.WriteLine("environment:"); + foreach (var item in psi.Environment) { + outputHelper.WriteLine($"\t{item.Key}={item.Value}"); + } + + StringBuilder processOutput = new StringBuilder(); + DataReceivedEventHandler handler = (sender, e) => { + processOutput.Append(e.Data); + processOutput.AppendLine(); + }; + StringBuilder processError = new StringBuilder(); + DataReceivedEventHandler ehandler = (sender, e) => { + processError.Append(e.Data); + processError.AppendLine(); + }; + process.OutputDataReceived += handler; + process.ErrorDataReceived += ehandler; + + // terminate process if output contains specified string + if (!String.IsNullOrEmpty(terminatingOutput)) { + DataReceivedEventHandler terminatingOutputHandler = (sender, e) => { + if (!String.IsNullOrEmpty(e.Data) && e.Data.Contains(terminatingOutput)) { + process.Kill(); + } + }; + process.OutputDataReceived += terminatingOutputHandler; + } + + // start the process + process.Start(); + process.BeginOutputReadLine(); + process.BeginErrorReadLine(); + if (!process.WaitForExit(timeout)) { + outputHelper.WriteLine($"killing process after {timeout} ms"); + process.Kill(); + } + // WaitForExit with timeout doesn't guarantee + // that the async output handlers have been + // called, so WaitForExit needs to be called + // afterwards. + process.WaitForExit(); + string processOutputStr = processOutput.ToString(); + string processErrorStr = processError.ToString(); + outputHelper.WriteLine(processOutputStr); + outputHelper.WriteLine(processErrorStr); + commandOutput = processOutputStr; + return process.ExitCode; + } + } +} diff --git a/external/linker/corebuild/integration/test/HelloWorldTest.cs b/external/linker/corebuild/integration/test/HelloWorldTest.cs index 009601e887..23e4662c20 100644 --- a/external/linker/corebuild/integration/test/HelloWorldTest.cs +++ b/external/linker/corebuild/integration/test/HelloWorldTest.cs @@ -7,11 +7,21 @@ namespace ILLink.Tests { public class HelloWorldTest : IntegrationTestBase { - public HelloWorldTest(ITestOutputHelper output) : base(output) {} + private string csproj; + + public HelloWorldTest(ITestOutputHelper output) : base(output) { + csproj = SetupProject(); + } public string SetupProject() { string projectRoot = "helloworld"; + string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj"); + + if (File.Exists(csproj)) { + output.WriteLine($"using existing project {csproj}"); + return csproj; + } if (Directory.Exists(projectRoot)) { Directory.Delete(projectRoot, true); @@ -24,20 +34,28 @@ namespace ILLink.Tests Assert.True(false); } - string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj"); + AddLinkerReference(csproj); + return csproj; } [Fact] - public void RunHelloWorld() + public void RunHelloWorldStandalone() { - string csproj = SetupProject(); + string executablePath = BuildAndLink(csproj, selfContained: true); + CheckOutput(executablePath, selfContained: true); + } - AddLinkerReference(csproj); + [Fact] + public void RunHelloWorldPortable() + { + string target = BuildAndLink(csproj, selfContained: false); + CheckOutput(target, selfContained: false); + } - BuildAndLink(csproj, null); - - int ret = RunApp(csproj, out string commandOutput); + void CheckOutput(string target, bool selfContained = false) + { + int ret = RunApp(target, out string commandOutput, selfContained: selfContained); Assert.True(ret == 0); Assert.True(commandOutput.Contains("Hello World!")); } diff --git a/external/linker/corebuild/integration/test/IntegrationTestBase.cs b/external/linker/corebuild/integration/test/IntegrationTestBase.cs index 52057553a0..99218ba3e3 100644 --- a/external/linker/corebuild/integration/test/IntegrationTestBase.cs +++ b/external/linker/corebuild/integration/test/IntegrationTestBase.cs @@ -30,7 +30,7 @@ namespace ILLink.Tests protected int Dotnet(string args, string workingDir, string additionalPath = null) { return RunCommand(Path.GetFullPath(context.DotnetToolPath), args, - workingDir, additionalPath, out string commandOutput); + workingDir, additionalPath, out string commandOutput); } protected int RunCommand(string command, string args, int timeout = Int32.MaxValue) @@ -43,71 +43,16 @@ namespace ILLink.Tests return RunCommand(command, args, workingDir, null, out string commandOutput); } - protected int RunCommand(string command, string args, string workingDir, string additionalPath, out string commandOutput, int timeout = Int32.MaxValue) + protected int RunCommand(string command, string args, string workingDir, string additionalPath, + out string commandOutput, int timeout = Int32.MaxValue, string terminatingOutput = null) { - output.WriteLine($"{command} {args}"); - if (workingDir != null) - output.WriteLine($"working directory: {workingDir}"); - var psi = new ProcessStartInfo - { - FileName = command, - Arguments = args, - UseShellExecute = false, - RedirectStandardOutput = true, - RedirectStandardError = true, - WorkingDirectory = workingDir, - }; - - if (additionalPath != null) { - string path = psi.Environment["PATH"]; - psi.Environment["PATH"] = path + ";" + additionalPath; - } - var process = new Process(); - process.StartInfo = psi; - - // dotnet sets some environment variables that - // may cause problems in the child process. - psi.Environment.Remove("MSBuildExtensionsPath"); - psi.Environment.Remove("MSBuildLoadMicrosoftTargetsReadOnly"); - psi.Environment.Remove("MSBuildSDKsPath"); - psi.Environment.Remove("VbcToolExe"); - psi.Environment.Remove("CscToolExe"); - psi.Environment.Remove("MSBUILD_EXE_PATH"); - - StringBuilder processOutput = new StringBuilder(); - DataReceivedEventHandler handler = (sender, e) => { - processOutput.Append(e.Data); - processOutput.AppendLine(); - }; - StringBuilder processError = new StringBuilder(); - DataReceivedEventHandler ehandler = (sender, e) => { - processError.Append(e.Data); - processError.AppendLine(); - }; - process.OutputDataReceived += handler; - process.ErrorDataReceived += ehandler; - output.WriteLine("environment:"); - foreach (var item in psi.Environment) { - output.WriteLine($"\t{item.Key}={item.Value}"); - } - process.Start(); - process.BeginOutputReadLine(); - process.BeginErrorReadLine(); - if (!process.WaitForExit(timeout)) { - output.WriteLine($"killing process after {timeout} ms"); - process.Kill(); - } - // WaitForExit with timeout doesn't guarantee - // that the async output handlers have been - // called, so WaitForExit needs to be called - // afterwards. - process.WaitForExit(); - string processOutputStr = processOutput.ToString(); - string processErrorStr = processError.ToString(); - output.WriteLine(processOutputStr); - output.WriteLine(processErrorStr); - commandOutput = processOutputStr; - return process.ExitCode; + return (new CommandRunner(command, output)) + .WithArguments(args) + .WithWorkingDir(workingDir) + .WithAdditionalPath(additionalPath) + .WithTimeout(timeout) + .WithTerminatingOutput(terminatingOutput) + .Run(out commandOutput); } /// @@ -115,14 +60,18 @@ namespace ILLink.Tests /// that the project already contains a reference to the /// linker task package. /// Optionally takes a list of root descriptor files. + /// Returns the path to the built app, either the renamed + /// host for self-contained publish, or the dll containing + /// the entry point. /// - public void BuildAndLink(string csproj, List rootFiles = null, Dictionary extraPublishArgs = null) + public string BuildAndLink(string csproj, List rootFiles = null, Dictionary extraPublishArgs = null, bool selfContained = false) { - string rid = context.RuntimeIdentifier; - string config = context.Configuration; string demoRoot = Path.GetDirectoryName(csproj); - string publishArgs = $"publish -r {rid} -c {config} /v:n /p:ShowLinkerSizeComparison=true"; + string publishArgs = $"publish -c {context.Configuration} /v:n /p:ShowLinkerSizeComparison=true"; + if (selfContained) { + publishArgs += $" -r {context.RuntimeIdentifier}"; + } string rootFilesStr; if (rootFiles != null && rootFiles.Any()) { rootFilesStr = String.Join(";", rootFiles); @@ -138,28 +87,45 @@ namespace ILLink.Tests if (ret != 0) { output.WriteLine("publish failed, returning " + ret); Assert.True(false); - return; } - } - public int RunApp(string csproj, out string processOutput, int timeout = Int32.MaxValue) - { - string demoRoot = Path.GetDirectoryName(csproj); // detect the target framework for which the app was published string tfmDir = Path.Combine(demoRoot, "bin", context.Configuration); string tfm = Directory.GetDirectories(tfmDir).Select(p => Path.GetFileName(p)).Single(); - string executablePath = Path.Combine(tfmDir, tfm, - context.RuntimeIdentifier, "publish", - Path.GetFileNameWithoutExtension(csproj) - ); - if (context.RuntimeIdentifier.Contains("win")) { - executablePath += ".exe"; + string builtApp = Path.Combine(tfmDir, tfm); + if (selfContained) { + builtApp = Path.Combine(builtApp, context.RuntimeIdentifier); } - Assert.True(File.Exists(executablePath)); + builtApp = Path.Combine(builtApp, "publish", + Path.GetFileNameWithoutExtension(csproj)); + if (selfContained) { + if (context.RuntimeIdentifier.Contains("win")) { + builtApp += ".exe"; + } + } else { + builtApp += ".dll"; + } + Assert.True(File.Exists(builtApp)); + return builtApp; + } - int ret = RunCommand(executablePath, null, - Directory.GetParent(executablePath).FullName, - null, out processOutput, timeout); + public int RunApp(string target, out string processOutput, int timeout = Int32.MaxValue, + string terminatingOutput = null, bool selfContained = false) + { + Assert.True(File.Exists(target)); + int ret; + if (selfContained) { + ret = RunCommand( + target, null, + Directory.GetParent(target).FullName, + null, out processOutput, timeout, terminatingOutput); + } else { + ret = RunCommand( + Path.GetFullPath(context.DotnetToolPath), + Path.GetFullPath(target), + Directory.GetParent(target).FullName, + null, out processOutput, timeout, terminatingOutput); + } return ret; } diff --git a/external/linker/corebuild/integration/test/MusicStoreTest.cs b/external/linker/corebuild/integration/test/MusicStoreTest.cs index 7aa53d414a..a28e996d24 100644 --- a/external/linker/corebuild/integration/test/MusicStoreTest.cs +++ b/external/linker/corebuild/integration/test/MusicStoreTest.cs @@ -10,8 +10,6 @@ namespace ILLink.Tests { public class MusicStoreTest : IntegrationTestBase { - public MusicStoreTest(ITestOutputHelper output) : base(output) {} - private static List rootFiles = new List { "MusicStoreReflection.xml" }; private static string gitRepo = "http://github.com/aspnet/JitBench"; @@ -34,40 +32,140 @@ namespace ILLink.Tests // The version of Microsoft.AspNetCore.All to publish with. private static string aspNetVersion = "2.1.0-preview1-27654"; - [Fact] - public void RunMusicStore() + private static Dictionary versionPublishArgs; + private static Dictionary VersionPublishArgs { - string csproj = SetupProject(); + get { + if (versionPublishArgs != null) { + return versionPublishArgs; + } + versionPublishArgs = new Dictionary(); + versionPublishArgs.Add("JITBENCH_FRAMEWORK_VERSION", runtimeVersion); + versionPublishArgs.Add("JITBENCH_ASPNET_VERSION", aspNetVersion); + return versionPublishArgs; + } + } - // Copy root files into the project directory - string demoRoot= Path.GetDirectoryName(csproj); - CopyRootFiles(demoRoot); + private static string csproj; - // This is necessary because JitBench comes with a - // NuGet.Config that has a line, preventing - // NuGet.Config sources defined in outer directories from - // applying. - string nugetConfig = Path.Combine("JitBench", "NuGet.config"); - AddLocalNugetFeedAfterClear(nugetConfig); + public MusicStoreTest(ITestOutputHelper output) : base(output) { + csproj = SetupProject(); - AddLinkerReference(csproj); + // MusicStore targets .NET Core 2.1, so it must be built + // using an SDK that can target 2.1. We obtain that SDK + // here. + context.DotnetToolPath = ObtainSDK(context.TestBin, repoName); + } - Dictionary extraPublishArgs = new Dictionary(); - extraPublishArgs.Add("JITBENCH_FRAMEWORK_VERSION", runtimeVersion); - extraPublishArgs.Add("JITBENCH_ASPNET_VERSION", aspNetVersion); - BuildAndLink(csproj, rootFiles, extraPublishArgs); + [Fact] + public void RunMusicStoreStandalone() + { + string executablePath = BuildAndLink(csproj, rootFiles, VersionPublishArgs, selfContained: true); + CheckOutput(executablePath, selfContained: true); + } + + [Fact] + public void RunMusicStorePortable() + { + Dictionary extraPublishArgs = new Dictionary(VersionPublishArgs); + extraPublishArgs.Add("PublishWithAspNetCoreTargetManifest", "false"); + string target = BuildAndLink(csproj, null, extraPublishArgs, selfContained: false); + CheckOutput(target, selfContained: false); + } + + void CheckOutput(string target, bool selfContained = false) + { + int ret = RunApp(target, out string commandOutput, selfContained: selfContained); - int ret = RunApp(csproj, out string commandOutput); Assert.True(commandOutput.Contains("Starting request to http://localhost:5000")); Assert.True(commandOutput.Contains("Response: OK")); Assert.True(commandOutput.Contains("Running 100 requests")); Assert.True(ret == 0); } + // returns path to .csproj project file + string SetupProject() + { + int ret; + string demoRoot = Path.Combine(repoName, Path.Combine("src", "MusicStore")); + string csproj = Path.Combine(demoRoot, "MusicStore.csproj"); + + if (File.Exists(csproj)) { + output.WriteLine($"using existing project {csproj}"); + return csproj; + } + + if (Directory.Exists(repoName)) { + Directory.Delete(repoName, true); + } + + ret = RunCommand("git", $"clone {gitRepo} {repoName}"); + if (ret != 0) { + output.WriteLine("git failed"); + Assert.True(false); + } + + if (!Directory.Exists(demoRoot)) { + output.WriteLine($"{demoRoot} does not exist"); + Assert.True(false); + } + + ret = RunCommand("git", $"checkout {gitRevision}", demoRoot); + if (ret != 0) { + output.WriteLine($"problem checking out revision {gitRevision}"); + Assert.True(false); + } + + // Copy root files into the project directory + CopyRootFiles(demoRoot); + + // This is necessary because JitBench comes with a + // NuGet.Config that has a line, preventing + // NuGet.Config sources defined in outer directories from + // applying. + string nugetConfig = Path.Combine(repoName, "NuGet.config"); + AddLocalNugetFeedAfterClear(nugetConfig); + + AddLinkerReference(csproj); + + AddGlobalJson(repoName); + + return csproj; + } + + void AddGlobalJson(string repoDir) + { + string globalJson = Path.Combine(repoDir, "global.json"); + string globalJsonContents = "{ \"sdk\": { \"version\": \"" + sdkVersion + "\" } }\n"; + File.WriteAllText(globalJson, globalJsonContents); + } + + + string GetDotnetToolPath(string dotnetDir) + { + string dotnetToolName = Directory.GetFiles(dotnetDir) + .Select(p => Path.GetFileName(p)) + .Where(p => p.Contains("dotnet")) + .Single(); + string dotnetToolPath = Path.Combine(dotnetDir, dotnetToolName); + + if (!File.Exists(dotnetToolPath)) { + output.WriteLine("repo-local dotnet tool does not exist."); + Assert.True(false); + } + + return dotnetToolPath; + } + string ObtainSDK(string rootDir, string repoDir) { int ret; string dotnetDirName = ".dotnet"; + string dotnetDir = Path.Combine(rootDir, dotnetDirName); + if (Directory.Exists(dotnetDir)) { + return GetDotnetToolPath(dotnetDir); + } + string dotnetInstall = Path.Combine(Path.GetFullPath(repoDir), "dotnet-install"); if (context.RuntimeIdentifier.Contains("win")) { dotnetInstall += ".ps1"; @@ -103,57 +201,7 @@ namespace ILLink.Tests } } - string dotnetDir = Path.Combine(rootDir, dotnetDirName); - string dotnetToolName = Directory.GetFiles(dotnetDir) - .Select(p => Path.GetFileName(p)) - .Where(p => p.Contains("dotnet")) - .Single(); - string dotnetToolPath = Path.Combine(dotnetDir, dotnetToolName); - if (!File.Exists(dotnetToolPath)) { - output.WriteLine("repo-local dotnet tool does not exist."); - Assert.True(false); - } - - string globalJson = Path.Combine(repoDir, "global.json"); - string globalJsonContents = "{ \"sdk\": { \"version\": \"" + sdkVersion + "\" } }\n"; - File.WriteAllText(globalJson, globalJsonContents); - - return dotnetToolPath; - } - - // returns path to .csproj project file - string SetupProject() - { - int ret; - if (Directory.Exists(repoName)) { - Directory.Delete(repoName, true); - } - - ret = RunCommand("git", $"clone {gitRepo}"); - if (ret != 0) { - output.WriteLine("git failed"); - Assert.True(false); - } - - string demoRoot = Path.Combine("JitBench", Path.Combine("src", "MusicStore")); - if (!Directory.Exists(demoRoot)) { - output.WriteLine($"{demoRoot} does not exist"); - Assert.True(false); - } - - ret = RunCommand("git", $"checkout {gitRevision}", demoRoot); - if (ret != 0) { - output.WriteLine($"problem checking out revision {gitRevision}"); - Assert.True(false); - } - - // MusicStore targets .NET Core 2.1, so it must be built - // using an SDK that can target 2.1. We obtain that SDK - // here. - context.DotnetToolPath = ObtainSDK(context.TestBin, repoName); - - string csproj = Path.Combine(demoRoot, "MusicStore.csproj"); - return csproj; + return GetDotnetToolPath(dotnetDir); } static void CopyRootFiles(string demoRoot) diff --git a/external/linker/corebuild/integration/test/WebApiTest.cs b/external/linker/corebuild/integration/test/WebApiTest.cs index 733dc16ae7..c7e8683e02 100644 --- a/external/linker/corebuild/integration/test/WebApiTest.cs +++ b/external/linker/corebuild/integration/test/WebApiTest.cs @@ -8,11 +8,21 @@ namespace ILLink.Tests { public class WebApiTest : IntegrationTestBase { - public WebApiTest(ITestOutputHelper output) : base(output) {} + private string csproj; + + public WebApiTest(ITestOutputHelper output) : base(output) { + csproj = SetupProject(); + } public string SetupProject() { string projectRoot = "webapi"; + string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj"); + + if (File.Exists(csproj)) { + output.WriteLine($"using existing project {csproj}"); + return csproj; + } if (Directory.Exists(projectRoot)) { Directory.Delete(projectRoot, true); @@ -25,7 +35,10 @@ namespace ILLink.Tests Assert.True(false); } - string csproj = Path.Combine(projectRoot, $"{projectRoot}.csproj"); + PreventPublishFiltering(csproj); + + AddLinkerReference(csproj); + return csproj; } @@ -49,19 +62,25 @@ namespace ILLink.Tests } [Fact] - public void RunWebApi() + public void RunWebApiStandalone() { - string csproj = SetupProject(); + string executablePath = BuildAndLink(csproj, selfContained: true); + CheckOutput(executablePath, selfContained: true); + } - PreventPublishFiltering(csproj); + [Fact] + public void RunWebApiPortable() + { + string target = BuildAndLink(csproj, selfContained: false); + CheckOutput(target, selfContained: false); + } - AddLinkerReference(csproj); - - BuildAndLink(csproj); - - int ret = RunApp(csproj, out string commandOutput, 10000); + void CheckOutput(string target, bool selfContained = false) + { + string terminatingOutput = "Now listening on: http://localhost:5000"; + int ret = RunApp(target, out string commandOutput, 60000, terminatingOutput, selfContained: selfContained); Assert.True(commandOutput.Contains("Application started. Press Ctrl+C to shut down.")); - Assert.True(commandOutput.Contains("Now listening on: http://localhost:5000")); + Assert.True(commandOutput.Contains(terminatingOutput)); } } } diff --git a/external/linker/corebuild/integration/test/test.csproj b/external/linker/corebuild/integration/test/test.csproj index 329e2c8741..8e077be556 100644 --- a/external/linker/corebuild/integration/test/test.csproj +++ b/external/linker/corebuild/integration/test/test.csproj @@ -22,6 +22,7 @@ + diff --git a/external/linker/corebuild/linker.sln b/external/linker/corebuild/linker.sln index 9e53fd6717..7bc5da4f1f 100644 --- a/external/linker/corebuild/linker.sln +++ b/external/linker/corebuild/linker.sln @@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil", "..\cecil\Mono EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Pdb", "..\cecil\symbols\pdb\Mono.Cecil.Pdb.csproj", "{63E6915C-7EA4-4D76-AB28-0D7191EEA626}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Mdb", "..\cecil\symbols\mdb\Mono.Cecil.Mdb.csproj", "{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ILLink.CustomSteps", "integration\ILLink.CustomSteps\ILLink.CustomSteps.csproj", "{275C1D10-168A-4AC4-8F3E-AD969F580B9C}" EndProject Global @@ -59,6 +61,18 @@ Global {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x64.Build.0 = netstandard_Release|x64 {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x86.ActiveCfg = netstandard_Release|x86 {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|x86.Build.0 = netstandard_Release|x86 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|x64.ActiveCfg = netstandard_Debug|x64 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|x64.Build.0 = netstandard_Debug|x64 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|x86.ActiveCfg = netstandard_Debug|x86 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|x86.Build.0 = netstandard_Debug|x86 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Any CPU.Build.0 = netstandard_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|x64.ActiveCfg = netstandard_Release|x64 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|x64.Build.0 = netstandard_Release|x64 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|x86.ActiveCfg = netstandard_Release|x86 + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|x86.Build.0 = netstandard_Release|x86 {275C1D10-168A-4AC4-8F3E-AD969F580B9C}.Debug|Any CPU.ActiveCfg = illink_Debug|Any CPU {275C1D10-168A-4AC4-8F3E-AD969F580B9C}.Debug|Any CPU.Build.0 = illink_Debug|Any CPU {275C1D10-168A-4AC4-8F3E-AD969F580B9C}.Debug|x64.ActiveCfg = illink_Debug|x64 diff --git a/external/linker/linker.sln b/external/linker/linker.sln index f38356fea5..5f575ae570 100644 --- a/external/linker/linker.sln +++ b/external/linker/linker.sln @@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Linker.Tests.Cases", " EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Linker.Tests.Cases.Expectations", "linker\Tests\Mono.Linker.Tests.Cases.Expectations\Mono.Linker.Tests.Cases.Expectations.csproj", "{2C26601F-3E2F-45B9-A02F-58EE9296E19E}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Cecil.Mdb", "cecil\symbols\mdb\Mono.Cecil.Mdb.csproj", "{8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -91,6 +93,22 @@ Global {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.netstandard_Release|Any CPU.Build.0 = netstandard_Release|Any CPU {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|Any CPU.ActiveCfg = Release|Any CPU {63E6915C-7EA4-4D76-AB28-0D7191EEA626}.Release|Any CPU.Build.0 = Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Debug|Any CPU.ActiveCfg = net_3_5_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Debug|Any CPU.Build.0 = net_3_5_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Release|Any CPU.ActiveCfg = net_3_5_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_3_5_Release|Any CPU.Build.0 = net_3_5_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Debug|Any CPU.ActiveCfg = net_4_0_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Debug|Any CPU.Build.0 = net_4_0_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Release|Any CPU.ActiveCfg = net_4_0_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.net_4_0_Release|Any CPU.Build.0 = net_4_0_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Debug|Any CPU.ActiveCfg = netstandard_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Debug|Any CPU.Build.0 = netstandard_Debug|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Release|Any CPU.ActiveCfg = netstandard_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.netstandard_Release|Any CPU.Build.0 = netstandard_Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8559DD7F-A16F-46D0-A05A-9139FAEBA8FD}.Release|Any CPU.Build.0 = Release|Any CPU {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.Debug|Any CPU.Build.0 = Debug|Any CPU {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5}.net_3_5_Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/external/linker/linker/Linker.Steps/MarkStep.cs b/external/linker/linker/Linker.Steps/MarkStep.cs index 0a3211cade..b63d8e48b9 100644 --- a/external/linker/linker/Linker.Steps/MarkStep.cs +++ b/external/linker/linker/Linker.Steps/MarkStep.cs @@ -46,6 +46,7 @@ namespace Mono.Linker.Steps { protected Dictionary _assemblyDebuggerDisplayAttributes; protected Dictionary _assemblyDebuggerTypeProxyAttributes; protected Queue _topLevelAttributes; + protected Queue _lateMarkedAttributes; public AnnotationStore Annotations { get { return _context.Annotations; } @@ -62,6 +63,7 @@ namespace Mono.Linker.Steps { _methods = new Queue (); _virtual_methods = new List (); _topLevelAttributes = new Queue (); + _lateMarkedAttributes = new Queue (); _assemblyDebuggerDisplayAttributes = new Dictionary (); _assemblyDebuggerTypeProxyAttributes = new Dictionary (); @@ -131,7 +133,7 @@ namespace Mono.Linker.Steps { if (QueueIsEmpty ()) throw new InvalidOperationException ("No entry methods"); - while (ProcessPrimaryQueue () || ProcessLazyAttributes ()) + while (ProcessPrimaryQueue () || ProcessLazyAttributes () || ProcessLateMarkedAttributes ()) // deal with [TypeForwardedTo] pseudo-attributes foreach (AssemblyDefinition assembly in _context.GetAssemblies ()) { @@ -148,13 +150,9 @@ namespace Mono.Linker.Steps { if (!isForwarder) continue; - TypeDefinition type = null; - try { - type = exported.Resolve (); - } - catch (AssemblyResolutionException) { + TypeDefinition type = exported.Resolve (); + if (type == null) continue; - } if (!Annotations.IsMarked (type)) continue; Tracer.Push (type); @@ -260,10 +258,15 @@ namespace Mono.Linker.Steps { Tracer.Push (provider); try { foreach (CustomAttribute ca in provider.CustomAttributes) { - if (!ShouldMarkCustomAttribute (ca)) - continue; - MarkCustomAttribute (ca); + if (_context.KeepUsedAttributeTypesOnly) { + _lateMarkedAttributes.Enqueue (ca); + } else { + if (!ShouldMarkCustomAttribute (ca)) + continue; + + MarkCustomAttribute (ca); + } } } finally { Tracer.Pop (); @@ -305,11 +308,16 @@ namespace Mono.Linker.Steps { protected virtual bool ShouldMarkCustomAttribute (CustomAttribute ca) { + if (_context.KeepUsedAttributeTypesOnly && !Annotations.IsMarked (ca.AttributeType.Resolve ())) + return false; return true; } protected virtual bool ShouldMarkTopLevelCustomAttribute (CustomAttribute ca, MethodDefinition resolvedConstructor) { + if (!ShouldMarkCustomAttribute (ca)) + return false; + // If an attribute's module has not been marked after processing all types in all assemblies and the attribute itself has not been marked, // then surely nothing is using this attribute and there is no need to mark it if (!Annotations.IsMarked (resolvedConstructor.Module) && !Annotations.IsMarked (ca.AttributeType)) @@ -574,6 +582,40 @@ namespace Mono.Linker.Steps { return markOccurred; } + bool ProcessLateMarkedAttributes () + { + var startingQueueCount = _lateMarkedAttributes.Count; + if (startingQueueCount == 0) + return false; + + var skippedItems = new List (); + var markOccurred = false; + + while (_lateMarkedAttributes.Count != 0) { + var customAttribute = _lateMarkedAttributes.Dequeue (); + + var resolved = customAttribute.Constructor.Resolve (); + if (resolved == null) { + HandleUnresolvedMethod (customAttribute.Constructor); + continue; + } + + if (!ShouldMarkCustomAttribute (customAttribute)) { + skippedItems.Add (customAttribute); + continue; + } + + markOccurred = true; + MarkCustomAttribute (customAttribute); + } + + // requeue the items we skipped in case we need to make another pass + foreach (var item in skippedItems) + _lateMarkedAttributes.Enqueue (item); + + return markOccurred; + } + protected void MarkField (FieldReference reference) { // if (IgnoreScope (reference.DeclaringType.Scope)) @@ -663,7 +705,7 @@ namespace Mono.Linker.Steps { MarkSecurityDeclarations (type); if (IsMulticastDelegate (type)) { - MarkMethodCollection (type.Methods); + MarkMulticastDelegate (type); } if (IsSerializable (type)) @@ -1104,6 +1146,11 @@ namespace Mono.Linker.Steps { } } + protected virtual void MarkMulticastDelegate (TypeDefinition type) + { + MarkMethodCollection (type.Methods); + } + protected TypeDefinition ResolveTypeDefinition (TypeReference type) { TypeDefinition td = type as TypeDefinition; @@ -1541,7 +1588,7 @@ namespace Mono.Linker.Steps { MarkCustomAttributes (prop); } - protected void MarkEvent (EventDefinition evt) + protected virtual void MarkEvent (EventDefinition evt) { MarkCustomAttributes (evt); MarkMethodIfNotNull (evt.AddMethod); @@ -1568,6 +1615,17 @@ namespace Mono.Linker.Steps { foreach (Instruction instruction in body.Instructions) MarkInstruction (instruction); + + MarkThingsUsedViaReflection (body); + } + + protected virtual void MarkThingsUsedViaReflection (MethodBody body) + { + MarkSomethingUsedViaReflection ("GetConstructor", MarkConstructorsUsedViaReflection, body.Instructions); + MarkSomethingUsedViaReflection ("GetMethod", MarkMethodsUsedViaReflection, body.Instructions); + MarkSomethingUsedViaReflection ("GetProperty", MarkPropertyUsedViaReflection, body.Instructions); + MarkSomethingUsedViaReflection ("GetField", MarkFieldUsedViaReflection, body.Instructions); + MarkSomethingUsedViaReflection ("GetEvent", MarkEventUsedViaReflection, body.Instructions); } protected virtual void MarkInstruction (Instruction instruction) @@ -1615,5 +1673,152 @@ namespace Mono.Linker.Steps { MarkCustomAttributes (iface); MarkType (iface.InterfaceType); } + + + void MarkSomethingUsedViaReflection (string reflectionMethod, Action, string, TypeDefinition, BindingFlags> markMethod, Collection instructions) + { + for (var i = 0; i < instructions.Count; i++) { + var instruction = instructions [i]; + if (instruction.OpCode != OpCodes.Call && instruction.OpCode != OpCodes.Callvirt) + continue; + + var methodBeingCalled = instruction.Operand as MethodReference; + if (methodBeingCalled == null || methodBeingCalled.DeclaringType.Name != "Type" || methodBeingCalled.DeclaringType.Namespace != "System") + continue; + + if (methodBeingCalled.Name != reflectionMethod) + continue; + + _context.Tracer.Push ($"Reflection-{methodBeingCalled}"); + var nameOfThingUsedViaReflection = OperandOfNearestInstructionBefore (i, OpCodes.Ldstr, instructions); + var bindingFlags = (BindingFlags) OperandOfNearestInstructionBefore (i, OpCodes.Ldc_I4_S, instructions); + + // There might be more than one ldtoken opcode above the call in the IL stream. Be conservative and check all of + // the types which were loaded for the method being used. + var declaringTypesOfThingInvokedViaReflection = OperandsOfInstructionsBefore (i, OpCodes.Ldtoken, instructions); + foreach (var declaringTypeOfThingInvokedViaReflection in declaringTypesOfThingInvokedViaReflection) { + var typeDefinition = declaringTypeOfThingInvokedViaReflection?.Resolve (); + if (typeDefinition != null) + markMethod (instructions, nameOfThingUsedViaReflection, typeDefinition, bindingFlags); + } + _context.Tracer.Pop (); + } + } + + void MarkConstructorsUsedViaReflection (Collection instructions, string unused, TypeDefinition declaringType, BindingFlags bindingFlags) + { + foreach (var method in declaringType.Methods) { + if ((bindingFlags == BindingFlags.Default || bindingFlags.IsSet(BindingFlags.Public) == method.IsPublic) && method.Name == ".ctor") + MarkMethod (method); + } + } + + void MarkMethodsUsedViaReflection (Collection instructions, string name, TypeDefinition declaringType, BindingFlags bindingFlags) + { + if (name == null) + return; + + foreach (var method in declaringType.Methods) { + if ((bindingFlags == BindingFlags.Default || bindingFlags.IsSet(BindingFlags.Public) == method.IsPublic && bindingFlags.IsSet(BindingFlags.Static) == method.IsStatic) + && method.Name == name) + MarkMethod (method); + } + } + + void MarkPropertyUsedViaReflection (Collection instructions, string name, TypeDefinition declaringType, BindingFlags unused) + { + if (name == null) + return; + + foreach (var property in declaringType.Properties) { + if (property.Name == name) { + // It is not easy to reliably detect in the IL code whether the getter or setter (or both) are used. + // Be conservative and mark everything for the property. + MarkProperty (property); + MarkMethodIfNotNull (property.GetMethod); + MarkMethodIfNotNull (property.SetMethod); + } + } + } + + void MarkFieldUsedViaReflection (Collection instructions, string name, TypeDefinition declaringType, BindingFlags unused) + { + if (name == null) + return; + + foreach (var field in declaringType.Fields) { + if (field.Name == name) + MarkField (field); + } + } + + void MarkEventUsedViaReflection (Collection instructions, string name, TypeDefinition declaringType, BindingFlags unused) + { + if (name == null) + return; + + foreach (var eventInfo in declaringType.Events) { + if (eventInfo.Name == name) + MarkEvent (eventInfo); + } + } + + static TOperand OperandOfNearestInstructionBefore (int startingInstructionIndex, OpCode opCode, IList instructions) + { + for (var i = startingInstructionIndex; i >= 0; i--) { + if (instructions [i].OpCode == opCode) + return (TOperand) instructions [i].Operand; + } + + return default (TOperand); + } + + static List OperandsOfInstructionsBefore (int startingInstructionIndex, OpCode opCode, IList instructions) + { + var operands = new List (); + for (var i = startingInstructionIndex; i >= 0; i--) { + if (instructions [i].OpCode == opCode) { + var type = instructions [i].Operand as TypeReference; + if (type != null) + operands.Add (type); + } + } + + return operands; + } + } + + // Make our own copy of the BindingFlags enum, so that we don't depend on System.Reflection. + [Flags] + enum BindingFlags + { + Default = 0, + IgnoreCase = 1, + DeclaredOnly = 2, + Instance = 4, + Static = 8, + Public = 16, + NonPublic = 32, + FlattenHierarchy = 64, + InvokeMethod = 256, + CreateInstance = 512, + GetField = 1024, + SetField = 2048, + GetProperty = 4096, + SetProperty = 8192, + PutDispProperty = 16384, + PutRefDispProperty = 32768, + ExactBinding = 65536, + SuppressChangeType = 131072, + OptionalParamBinding = 262144, + IgnoreReturn = 16777216 + } + + static class BindingFlagsExtensions + { + public static bool IsSet(this BindingFlags flags, BindingFlags check) + { + return (flags & check) == check; + } } } diff --git a/external/linker/linker/Linker.Steps/OutputStep.cs b/external/linker/linker/Linker.Steps/OutputStep.cs index 05d8c4e25c..dd70965de2 100644 --- a/external/linker/linker/Linker.Steps/OutputStep.cs +++ b/external/linker/linker/Linker.Steps/OutputStep.cs @@ -93,7 +93,12 @@ namespace Mono.Linker.Steps { (module.Attributes & (ModuleAttributes) 0x04) != 0; } - void WriteAssembly (AssemblyDefinition assembly, string directory) + protected void WriteAssembly (AssemblyDefinition assembly, string directory) + { + WriteAssembly (assembly, directory, SaveSymbols (assembly)); + } + + protected virtual void WriteAssembly (AssemblyDefinition assembly, string directory, WriterParameters writerParameters) { foreach (var module in assembly.Modules) { // Write back pure IL even for R2R assemblies @@ -104,7 +109,7 @@ namespace Mono.Linker.Steps { } } - assembly.Write (GetAssemblyFileName (assembly, directory), SaveSymbols (assembly)); + assembly.Write (GetAssemblyFileName (assembly, directory), writerParameters); } void OutputAssembly (AssemblyDefinition assembly) @@ -126,17 +131,11 @@ namespace Mono.Linker.Steps { case AssemblyAction.Copy: Context.Tracer.AddDependency (assembly); CloseSymbols (assembly); - CopyAssembly (GetOriginalAssemblyFileInfo (assembly), directory, Context.LinkSymbols); + CopyAssembly (assembly, directory); break; case AssemblyAction.Delete: CloseSymbols (assembly); - var target = GetAssemblyFileName (assembly, directory); - if (File.Exists (target)) { - File.Delete (target); - File.Delete (target + ".mdb"); - File.Delete (Path.ChangeExtension (target, "pdb")); - File.Delete (GetConfigFile (target)); - } + DeleteAssembly (assembly, directory); break; default: CloseSymbols (assembly); @@ -144,6 +143,17 @@ namespace Mono.Linker.Steps { } } + protected virtual void DeleteAssembly(AssemblyDefinition assembly, string directory) + { + var target = GetAssemblyFileName (assembly, directory); + if (File.Exists (target)) { + File.Delete (target); + File.Delete (target + ".mdb"); + File.Delete (Path.ChangeExtension (target, "pdb")); + File.Delete (GetConfigFile (target)); + } + } + void CloseSymbols (AssemblyDefinition assembly) { Annotations.CloseSymbolReader (assembly); @@ -158,6 +168,12 @@ namespace Mono.Linker.Steps { if (!assembly.MainModule.HasSymbols) return parameters; +#if NATIVE_READER_SUPPORT + // NativePdb's can't be written on non-windows platforms + if (Environment.OSVersion.Platform != PlatformID.Win32NT && assembly.MainModule.SymbolReader is Mono.Cecil.Pdb.NativePdbReader) + return parameters; +#endif + if (Context.SymbolWriterProvider != null) parameters.SymbolWriterProvider = Context.SymbolWriterProvider; else @@ -165,7 +181,7 @@ namespace Mono.Linker.Steps { return parameters; } - static void CopyConfigFileIfNeeded (AssemblyDefinition assembly, string directory) + void CopyConfigFileIfNeeded (AssemblyDefinition assembly, string directory) { string config = GetConfigFile (GetOriginalAssemblyFileInfo (assembly).FullName); if (!File.Exists (config)) @@ -189,8 +205,17 @@ namespace Mono.Linker.Steps { return new FileInfo (assembly.MainModule.FileName); } - static void CopyAssembly (FileInfo fi, string directory, bool symbols) + protected virtual void CopyAssembly (AssemblyDefinition assembly, string directory) { + // Special case. When an assembly has embedded pdbs, link symbols is not enabled, and the assembly's action is copy, + // we want to match the behavior of assemblies with the other symbol types and end up with an assembly that does not have symbols. + // In order to do that, we can't simply copy files. We need to write the assembly without symbols + if (assembly.MainModule.HasSymbols && !Context.LinkSymbols && assembly.MainModule.SymbolReader is EmbeddedPortablePdbReader) { + WriteAssembly (assembly, directory, new WriterParameters ()); + return; + } + + FileInfo fi = GetOriginalAssemblyFileInfo (assembly); string target = Path.GetFullPath (Path.Combine (directory, fi.Name)); string source = fi.FullName; if (source == target) @@ -198,7 +223,7 @@ namespace Mono.Linker.Steps { File.Copy (source, target, true); - if (!symbols) + if (!Context.LinkSymbols) return; var mdb = source + ".mdb"; @@ -210,7 +235,7 @@ namespace Mono.Linker.Steps { File.Copy (pdb, Path.ChangeExtension (target, "pdb"), true); } - static string GetAssemblyFileName (AssemblyDefinition assembly, string directory) + protected virtual string GetAssemblyFileName (AssemblyDefinition assembly, string directory) { string file = GetOriginalAssemblyFileInfo (assembly).Name; return Path.Combine (directory, file); diff --git a/external/linker/linker/Linker.Steps/RemoveSecurityStep.cs b/external/linker/linker/Linker.Steps/RemoveSecurityStep.cs new file mode 100644 index 0000000000..df2e984374 --- /dev/null +++ b/external/linker/linker/Linker.Steps/RemoveSecurityStep.cs @@ -0,0 +1,68 @@ +using System; +using System.Linq; +using Mono.Cecil; + +namespace Mono.Linker.Steps { + public class RemoveSecurityStep : BaseStep { + protected override void ProcessAssembly (AssemblyDefinition assembly) + { + if (Annotations.GetAction (assembly) == AssemblyAction.Link) { + ClearSecurityDeclarations (assembly); + RemoveCustomAttributesThatAreForSecurity (assembly); + + foreach (var type in assembly.MainModule.Types) + ProcessType (type); + } + } + + static void ProcessType (TypeDefinition type) + { + RemoveCustomAttributesThatAreForSecurity (type); + ClearSecurityDeclarations (type); + type.HasSecurity = false; + + foreach (var field in type.Fields) + RemoveCustomAttributesThatAreForSecurity (field); + + foreach (var method in type.Methods) { + ClearSecurityDeclarations (method); + RemoveCustomAttributesThatAreForSecurity (method); + method.HasSecurity = false; + } + + foreach (var nested in type.NestedTypes) + ProcessType (nested); + } + + static void ClearSecurityDeclarations (ISecurityDeclarationProvider provider) + { + provider.SecurityDeclarations.Clear (); + } + + /// + /// We have to remove some security attributes, otherwise pe verify will complain that a type has HasSecurity = false + /// + /// + static void RemoveCustomAttributesThatAreForSecurity (ICustomAttributeProvider provider) + { + if (!provider.HasCustomAttributes) + return; + + var attrsToRemove = provider.CustomAttributes.Where (IsCustomAttributeForSecurity).ToArray (); + foreach (var remove in attrsToRemove) + provider.CustomAttributes.Remove (remove); + } + + static bool IsCustomAttributeForSecurity (CustomAttribute attr) + { + switch (attr.AttributeType.FullName) { + case "System.Security.SecurityCriticalAttribute": + case "System.Security.SecuritySafeCriticalAttribute": + case "System.Security.SuppressUnmanagedCodeSecurityAttribute": + return true; + } + + return false; + } + } +} \ No newline at end of file diff --git a/external/linker/linker/Linker.Steps/ResolveFromAssemblyStep.cs b/external/linker/linker/Linker.Steps/ResolveFromAssemblyStep.cs index 4e852bd0e2..cdd206cc81 100644 --- a/external/linker/linker/Linker.Steps/ResolveFromAssemblyStep.cs +++ b/external/linker/linker/Linker.Steps/ResolveFromAssemblyStep.cs @@ -117,12 +117,7 @@ namespace Mono.Linker.Steps if (!isForwarder) continue; - TypeDefinition resolvedExportedType = null; - try { - resolvedExportedType = exported.Resolve (); - } catch (AssemblyResolutionException) { - continue; - } + TypeDefinition resolvedExportedType = exported.Resolve (); if (resolvedExportedType == null) { // diff --git a/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs b/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs index d18795478d..4f80896aca 100644 --- a/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs +++ b/external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs @@ -108,7 +108,7 @@ namespace Mono.Linker.Steps { } } - protected void ProcessAssembly (AssemblyDefinition assembly, XPathNodeIterator iterator) + protected virtual void ProcessAssembly (AssemblyDefinition assembly, XPathNodeIterator iterator) { Tracer.Push (assembly); if (GetTypePreserve (iterator.Current) == TypePreserve.All) { @@ -213,12 +213,7 @@ namespace Mono.Linker.Steps { { if (regex.Match (exportedType.FullName).Success) { MarkingHelpers.MarkExportedType (exportedType, module); - TypeDefinition type = null; - try { - type = exportedType.Resolve (); - } - catch (AssemblyResolutionException) { - } + TypeDefinition type = exportedType.Resolve (); if (type != null) { ProcessType (type, nav); } @@ -241,7 +236,7 @@ namespace Mono.Linker.Steps { } } - void ProcessType (TypeDefinition type, XPathNavigator nav) + protected virtual void ProcessType (TypeDefinition type, XPathNavigator nav) { TypePreserve preserve = GetTypePreserve (nav); @@ -323,15 +318,19 @@ namespace Mono.Linker.Steps { void ProcessFields (TypeDefinition type, XPathNodeIterator iterator) { - while (iterator.MoveNext ()) { - string value = GetSignature (iterator.Current); - if (!String.IsNullOrEmpty (value)) - ProcessFieldSignature (type, value); + while (iterator.MoveNext ()) + ProcessField (type, iterator); + } - value = GetAttribute (iterator.Current, "name"); - if (!String.IsNullOrEmpty (value)) - ProcessFieldName (type, value); - } + protected virtual void ProcessField (TypeDefinition type, XPathNodeIterator iterator) + { + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessFieldSignature (type, value); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessFieldName (type, value); } void ProcessFieldSignature (TypeDefinition type, string signature) @@ -375,13 +374,13 @@ namespace Mono.Linker.Steps { return field.FieldType.FullName + " " + field.Name; } - protected virtual void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator) + void ProcessMethods (TypeDefinition type, XPathNodeIterator iterator) { while (iterator.MoveNext ()) ProcessMethod (type, iterator); } - protected void ProcessMethod(TypeDefinition type, XPathNodeIterator iterator) + protected virtual void ProcessMethod (TypeDefinition type, XPathNodeIterator iterator) { string value = GetSignature (iterator.Current); if (!String.IsNullOrEmpty (value)) @@ -462,15 +461,19 @@ namespace Mono.Linker.Steps { void ProcessEvents (TypeDefinition type, XPathNodeIterator iterator) { - while (iterator.MoveNext ()) { - string value = GetSignature (iterator.Current); - if (!String.IsNullOrEmpty (value)) - ProcessEventSignature (type, value); + while (iterator.MoveNext ()) + ProcessEvent (type, iterator); + } - value = GetAttribute (iterator.Current, "name"); - if (!String.IsNullOrEmpty (value)) - ProcessEventName (type, value); - } + protected virtual void ProcessEvent (TypeDefinition type, XPathNodeIterator iterator) + { + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessEventSignature (type, value); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessEventName (type, value); } void ProcessEventSignature (TypeDefinition type, string signature) @@ -520,15 +523,19 @@ namespace Mono.Linker.Steps { void ProcessProperties (TypeDefinition type, XPathNodeIterator iterator) { - while (iterator.MoveNext ()) { - string value = GetSignature (iterator.Current); - if (!String.IsNullOrEmpty (value)) - ProcessPropertySignature (type, value, GetAccessors (iterator.Current)); + while (iterator.MoveNext ()) + ProcessProperty (type, iterator); + } - value = GetAttribute (iterator.Current, "name"); - if (!String.IsNullOrEmpty (value)) - ProcessPropertyName (type, value, _accessorsAll); - } + protected virtual void ProcessProperty (TypeDefinition type, XPathNodeIterator iterator) + { + string value = GetSignature (iterator.Current); + if (!String.IsNullOrEmpty (value)) + ProcessPropertySignature (type, value, GetAccessors (iterator.Current)); + + value = GetAttribute (iterator.Current, "name"); + if (!String.IsNullOrEmpty (value)) + ProcessPropertyName (type, value, _accessorsAll); } void ProcessPropertySignature (TypeDefinition type, string signature, string[] accessors) diff --git a/external/linker/linker/Linker.Steps/SweepStep.cs b/external/linker/linker/Linker.Steps/SweepStep.cs index 5250852473..d364a7fd67 100644 --- a/external/linker/linker/Linker.Steps/SweepStep.cs +++ b/external/linker/linker/Linker.Steps/SweepStep.cs @@ -124,6 +124,9 @@ namespace Mono.Linker.Steps { SweepResources (assembly); SweepCustomAttributes (assembly); + + foreach (var module in assembly.Modules) + SweepCustomAttributes (module); } bool IsMarkedAssembly (AssemblyDefinition assembly) @@ -169,13 +172,9 @@ namespace Mono.Linker.Steps { var references = assembly.MainModule.AssemblyReferences; for (int i = 0; i < references.Count; i++) { var reference = references [i]; - AssemblyDefinition r = null; - try { - r = Context.Resolver.Resolve (reference); - } - catch (AssemblyResolutionException) { + AssemblyDefinition r = Context.Resolver.Resolve (reference); + if (r == null) continue; - } if (!AreSameReference (r.Name, target.Name)) continue; @@ -282,6 +281,9 @@ namespace Mono.Linker.Steps { if (type.HasProperties) SweepCustomAttributeCollection (type.Properties); + + if (type.HasEvents) + SweepCustomAttributeCollection (type.Events); } protected void SweepNestedTypes (TypeDefinition type) @@ -308,15 +310,70 @@ namespace Mono.Linker.Steps { } } - protected void SweepCustomAttributes (ICustomAttributeProvider provider) + protected void SweepCustomAttributes (TypeDefinition type) { + var removed = SweepCustomAttributes (type as ICustomAttributeProvider); + + if (ShouldSetHasSecurityToFalse (type, type, type.HasSecurity, removed)) + type.HasSecurity = false; + } + + protected void SweepCustomAttributes (MethodDefinition method) + { + var removed = SweepCustomAttributes (method as ICustomAttributeProvider); + + if (ShouldSetHasSecurityToFalse (method, method, method.HasSecurity, removed)) + method.HasSecurity = false; + } + + bool ShouldSetHasSecurityToFalse (ISecurityDeclarationProvider providerAsSecurity, ICustomAttributeProvider provider, bool existingHasSecurity, IList removedAttributes) + { + if (existingHasSecurity && removedAttributes.Count > 0 && !providerAsSecurity.HasSecurityDeclarations) { + // If the method or type had security before and all attributes were removed, or no remaining attributes are security attributes, + // then we need to set HasSecurity to false + if (provider.CustomAttributes.Count == 0 || provider.CustomAttributes.All (attr => !IsSecurityAttributeType (attr.AttributeType.Resolve ()))) + return true; + } + + return false; + } + + static bool IsSecurityAttributeType (TypeDefinition definition) + { + if (definition == null) + return false; + + if (definition.Namespace == "System.Security") { + switch (definition.FullName) { + // This seems to be one attribute in the System.Security namespace that doesn't count + // as an attribute that requires HasSecurity to be true + case "System.Security.SecurityCriticalAttribute": + return false; + } + + return true; + } + + if (definition.BaseType == null) + return false; + + return IsSecurityAttributeType (definition.BaseType.Resolve ()); + } + + protected IList SweepCustomAttributes (ICustomAttributeProvider provider) + { + var removed = new List(); + for (int i = provider.CustomAttributes.Count - 1; i >= 0; i--) { var attribute = provider.CustomAttributes [i]; if (!Annotations.IsMarked (attribute)) { CustomAttributeUsageRemoved (provider, attribute); + removed.Add (provider.CustomAttributes [i]); provider.CustomAttributes.RemoveAt (i); } } + + return removed; } protected void SweepCustomAttributeCollection (Collection providers) where T : ICustomAttributeProvider @@ -330,6 +387,14 @@ namespace Mono.Linker.Steps { SweepCollection (methods); if (sweepSymbols) SweepDebugInfo (methods); + + foreach (var method in methods) { + if (!method.HasParameters) + continue; + + foreach (var parameter in method.Parameters) + SweepCustomAttributes (parameter); + } } void SweepDebugInfo (Collection methods) @@ -377,6 +442,17 @@ namespace Mono.Linker.Steps { } } + protected void SweepCollection (IList list) + { + for (int i = 0; i < list.Count; i++) + if (ShouldRemove (list [i])) { + ElementRemoved (list [i]); + list.RemoveAt (i--); + } else { + SweepCustomAttributes (list [i]); + } + } + protected void SweepCollection (IList list) where T : ICustomAttributeProvider { for (int i = 0; i < list.Count; i++) diff --git a/external/linker/linker/Linker/AssemblyResolver.cs b/external/linker/linker/Linker/AssemblyResolver.cs index b10bb53746..72ac6e2923 100644 --- a/external/linker/linker/Linker/AssemblyResolver.cs +++ b/external/linker/linker/Linker/AssemblyResolver.cs @@ -40,6 +40,9 @@ namespace Mono.Linker { #endif readonly Dictionary _assemblies; + HashSet _unresolvedAssemblies; + bool _ignoreUnresolved; + LinkContext _context; public IDictionary AssemblyCache { get { return _assemblies; } @@ -55,12 +58,32 @@ namespace Mono.Linker { _assemblies = assembly_cache; } + public bool IgnoreUnresolved { + get { return _ignoreUnresolved; } + set { _ignoreUnresolved = value; } + } + + public LinkContext Context { + get { return _context; } + set { _context = value; } + } + public override AssemblyDefinition Resolve (AssemblyNameReference name, ReaderParameters parameters) { - AssemblyDefinition asm; - if (!_assemblies.TryGetValue (name.Name, out asm)) { - asm = base.Resolve (name, parameters); - _assemblies [asm.Name.Name] = asm; + AssemblyDefinition asm = null; + if (!_assemblies.TryGetValue (name.Name, out asm) && (_unresolvedAssemblies == null || !_unresolvedAssemblies.Contains (name.Name))) { + try { + asm = base.Resolve (name, parameters); + _assemblies [name.Name] = asm; + } catch (AssemblyResolutionException) { + if (!_ignoreUnresolved) + throw; + + _context.LogMessage ($"warning: unresolved assembly {name.Name}"); + if (_unresolvedAssemblies == null) + _unresolvedAssemblies = new HashSet (); + _unresolvedAssemblies.Add (name.Name); + } } return asm; @@ -80,6 +103,8 @@ namespace Mono.Linker { } _assemblies.Clear (); + if (_unresolvedAssemblies != null) + _unresolvedAssemblies.Clear (); } } } diff --git a/external/linker/linker/Linker/Driver.cs b/external/linker/linker/Linker/Driver.cs index 8f79783b67..699a34f447 100644 --- a/external/linker/linker/Linker/Driver.cs +++ b/external/linker/linker/Linker/Driver.cs @@ -44,6 +44,11 @@ namespace Mono.Linker { #endif public static int Main (string [] args) + { + return Execute (args); + } + + public static int Execute (string[] args, ILogger customLogger = null) { if (args.Length == 0) Usage ("No parameters specified"); @@ -51,7 +56,7 @@ namespace Mono.Linker { try { Driver driver = new Driver (args); - driver.Run (); + driver.Run (customLogger); } catch (Exception e) { Console.WriteLine ("Fatal error in {0}", _linker); @@ -75,10 +80,13 @@ namespace Mono.Linker { return _queue.Count > 0; } - void Run () + public void Run (ILogger customLogger = null) { Pipeline p = GetStandardPipeline (); using (LinkContext context = GetDefaultContext (p)) { + if (customLogger != null) + context.Logger = customLogger; + I18nAssemblies assemblies = I18nAssemblies.All; var custom_steps = new List (); bool dumpDependencies = false; @@ -98,12 +106,18 @@ namespace Mono.Linker { Usage ("Option is too short"); if (token == "--skip-unresolved") { - context.IgnoreUnresolved = bool.Parse (GetParam ()); + bool ignoreUnresolved = bool.Parse (GetParam ()); + context.IgnoreUnresolved = ignoreUnresolved; + context.Resolver.IgnoreUnresolved = ignoreUnresolved; continue; } - if (token == "--dependencies-file") - { + if (token == "--verbose") { + context.LogMessages = true; + continue; + } + + if (token == "--dependencies-file") { context.Tracer.DependenciesFileName = GetParam (); continue; } @@ -118,6 +132,17 @@ namespace Mono.Linker { continue; } + if (token == "--used-attrs-only") { + context.KeepUsedAttributeTypesOnly = bool.Parse (GetParam ()); + continue; + } + + if (token == "--strip-security") { + if (bool.Parse (GetParam ())) + p.AddStepBefore (typeof (MarkStep), new RemoveSecurityStep ()); + continue; + } + switch (token [2]) { case 'v': Version (); @@ -330,10 +355,13 @@ namespace Mono.Linker { Console.WriteLine (" --about About the {0}", _linker); Console.WriteLine (" --version Print the version number of the {0}", _linker); - Console.WriteLine (" --skip-unresolved Ignore unresolved types and methods (true or false)"); + Console.WriteLine (" --skip-unresolved Ignore unresolved types, methods, and assemblies (true or false)"); + Console.WriteLine (" --verbose Log messages indicating progress and warnings"); Console.WriteLine (" --dependencies-file Specify the dependencies file path, if unset the default path is used: /linker-dependencies.xml.gz"); Console.WriteLine (" --dump-dependencies Dump dependencies for the linker analyzer tool"); Console.WriteLine (" --reduced-tracing Reduces dependency output related to assemblies that will not be modified"); + Console.WriteLine (" --used-attrs-only Attributes on types, methods, etc will be removed if the attribute type is not used"); + Console.WriteLine (" --strip-security In linked assemblies, attributes on assemblies, types, and methods related to security will be removed"); Console.WriteLine (" -out Specify the output directory, default to `output'"); Console.WriteLine (" -c Action on the core assemblies, skip, copy, copyused, addbypassngen, addbypassngenused or link, default to skip"); Console.WriteLine (" -u Action on the user assemblies, skip, copy, copyused, addbypassngen, addbypassngenused or link, default to link"); diff --git a/external/linker/linker/Linker/LinkContext.cs b/external/linker/linker/Linker/LinkContext.cs index 543589a793..c8594464ff 100644 --- a/external/linker/linker/Linker/LinkContext.cs +++ b/external/linker/linker/Linker/LinkContext.cs @@ -109,6 +109,8 @@ namespace Mono.Linker { public bool EnableReducedTracing { get; set; } + public bool KeepUsedAttributeTypesOnly { get; set; } + public System.Collections.IDictionary Actions { get { return _actions; } } @@ -131,7 +133,7 @@ namespace Mono.Linker { set { _symbolWriterProvider = value; } } - public bool LogInternalExceptions { get; set; } = false; + public bool LogMessages { get; set; } = false; public ILogger Logger { get; set; } = new ConsoleLogger (); @@ -156,9 +158,12 @@ namespace Mono.Linker { { _pipeline = pipeline; _resolver = resolver; + _resolver.Context = this; _actions = new Dictionary (); _parameters = new Dictionary (); _readerParameters = readerParameters; + + SymbolReaderProvider = new DefaultSymbolReaderProvider (false); if (factory == null) throw new ArgumentNullException (nameof (factory)); @@ -204,7 +209,7 @@ namespace Mono.Linker { try { AssemblyDefinition assembly = _resolver.Resolve (reference, _readerParameters); - if (SeenFirstTime (assembly)) { + if (assembly != null && SeenFirstTime (assembly)) { SafeReadSymbols (assembly); SetAction (assembly); } @@ -223,34 +228,32 @@ namespace Mono.Linker { public virtual void SafeReadSymbols (AssemblyDefinition assembly) { - if (!_linkSymbols) - return; - if (assembly.MainModule.HasSymbols) return; - try { - if (_symbolReaderProvider != null) { - var symbolReader = _symbolReaderProvider.GetSymbolReader ( - assembly.MainModule, - assembly.MainModule.FileName); + if (_symbolReaderProvider == null) + throw new ArgumentNullException (nameof (_symbolReaderProvider)); - _annotations.AddSymbolReader (assembly, symbolReader); - assembly.MainModule.ReadSymbols (symbolReader); - } else - assembly.MainModule.ReadSymbols (); - } catch {} + try { + var symbolReader = _symbolReaderProvider.GetSymbolReader ( + assembly.MainModule, + assembly.MainModule.FileName); + + if (symbolReader == null) + return; + + _annotations.AddSymbolReader (assembly, symbolReader); + assembly.MainModule.ReadSymbols (symbolReader); + } catch { } } public virtual ICollection ResolveReferences (AssemblyDefinition assembly) { List references = new List (); foreach (AssemblyNameReference reference in assembly.MainModule.AssemblyReferences) { - try { - references.Add (Resolve (reference)); - } - catch (AssemblyResolutionException) { - } + AssemblyDefinition definition = Resolve (reference); + if (definition != null) + references.Add (definition); } return references; } @@ -341,7 +344,7 @@ namespace Mono.Linker { public void LogMessage (MessageImportance importance, string message, params object [] values) { - if (LogInternalExceptions && Logger != null) + if (LogMessages && Logger != null) Logger.LogMessage (importance, message, values); } } diff --git a/external/linker/linker/Mono.Linker.csproj b/external/linker/linker/Mono.Linker.csproj index 5cbf016280..d8c9d24508 100644 --- a/external/linker/linker/Mono.Linker.csproj +++ b/external/linker/linker/Mono.Linker.csproj @@ -33,7 +33,7 @@ full False bin\Debug\ - DEBUG;TRACE + DEBUG;TRACE;NATIVE_READER_SUPPORT prompt 4 @@ -41,7 +41,7 @@ pdbonly True bin\Release\ - TRACE + TRACE;NATIVE_READER_SUPPORT prompt 4 @@ -64,6 +64,7 @@ + @@ -110,6 +111,12 @@ {D68133BD-1E63-496E-9EDE-4FBDBF77B486} Mono.Cecil + + Configuration=netstandard_Debug + Configuration=netstandard_Release + {8559dd7f-a16f-46d0-a05a-9139faeba8fd} + Mono.Cecil.Mdb + Configuration=netstandard_Debug Configuration=netstandard_Release diff --git a/external/linker/linker/README b/external/linker/linker/README.md similarity index 72% rename from external/linker/linker/README rename to external/linker/linker/README.md index 95b8a92d38..35591daeaa 100644 --- a/external/linker/linker/README +++ b/external/linker/linker/README.md @@ -1,164 +1,102 @@ -monolinker -==== - -monolinker is the Mono CIL Linker. +# IL Linker The linker is a tool one can use to only ship the minimal possible set of functions that a set of programs might require to run as opposed to the full libraries. -* How does the linker work? +## How does the linker work? The linker analyses the intermediate code (CIL) produced by every compiler -targeting the Mono platform like mcs, gmcs, vbnc, booc or others. It will walk +targeting the .NET platform like mcs, csc, vbnc, booc or others. It will walk through all the code that it is given to it, and basically, perform a mark and sweep operations on all the code that it is referenced, to only keep what is necessary for the source program to run. -* Usage +## Usage -1) Linking from a source assembly +### Linking from a source assembly The command: -monolinker -a Program.exe +`illinker -a Program.exe` will use the assembly Program.exe as a source. That means that the linker will walk through all the methods of Program.exe to generate only what is necessary for this assembly to run. -2) Linking from an xml descriptor +### Linking from an [XML descriptor](#syntax-of-xml-descriptor) The command: -monolinker -x desc.xml +`illinker -x desc.xml` will use the XML descriptor as a source. That means that the linker will use this file to decide what to link in a set of assemblies. The format of the descriptors is described further on in this document. -3) Linking from an api info file +### Linking from an API info file The command: -monolinker -i assembly.info +`illinker -i assembly.info` -will use a file produced by mono-api-info as a source. The linker will use +will use a file produced by `mono-api-info` as a source. The linker will use this file to link only what is necessary to match the public API defined in the info file. -4) Actions on the assemblies +### Actions on the assemblies You can specify what the linker should do exactly per assembly. The linker can do 3 things: - - skip them, and do nothing with them, - - copy them to the output directory, - - link them, to reduce their size. +- skip them, and do nothing with them, +- copy them to the output directory, +- link them, to reduce their size. You can specify an action per assembly like this: -monolinker -p link Foo +`illinker -p link Foo` or -monolinker -p skip System.Windows.Forms +`illinker -p skip System.Windows.Forms` Or you can specify what to do for the core assemblies. -Core assemblies are the assemblies that belongs to the base class library, +Core assemblies are the assemblies that belong to the base class library, like mscorlib.dll, System.dll or System.Windows.Forms.dll. You can specify what action to do on the core assemblies with the option: --c skip|copy|link +`-c skip|copy|link` -5) The output directory +### The output directory -By default, the linker will create an `output' directory in the current +By default, the linker will create an `output` directory in the current directory where it will emit the linked files, to avoid erasing source assemblies. You can specify the output directory with the option: --o output_directory +`-o output_directory` If you specify the directory `.', please ensure that you won't write over important assemblies of yours. -* Syntax of a xml descriptor +### Specifying directories where the linker should look for assemblies -Here is an example that shows all the possibilities of this format: - ---- - - - - - - - - - - - ---- - -In this example, the linker will link the types Foo, Bar, Baz and Gazonk. - -The fullname attribute specifies the fullname of the type in the format -specified by ECMA-335. This is in Mono and certain cases not the same -as the one reported by Type.FullName (nested classes e.g.). - -The preserve attribute ensures that all the fields of the type Baz will be -always be linked, not matter if they are used or not, but that neither the -fields or the methods of Bar will be linked if they are not used. Not -specifying a preserve attribute implies that we are preserving everything in -the specified type. - -The required attribute specifies that if the type is not marked, during the -mark operation, it will not be linked. - -The type Gazonk will be linked, as well as its constructor taking a string as a -parameter, and it's _blah field. - -You can have multiple assembly nodes. - -6) The i18n Assemblies - -Mono have a few assemblies which contains everything region specific: - - I18N.CJK.dll - I18N.MidEast.dll - I18N.Other.dll - I18N.Rare.dll - I18N.West.dll - -By default, they will all be copied to the output directory. But you can -specify which one you want using the command: - -monolinker -l choice - -Where choice can either be: none, all, cjk, mideast, other, rare or west. You can -combine the values with a comma. +By default, the linker will first look for assemblies in the directories `.` +and `bin`. You can specify Example: -monolinker -a assembly -l mideast,cjk +`illinker -d ../../libs -a program.exe` -7) Specifying directories where the linker should look for assemblies - -By default, the linker will first look for assemblies in the directories `.' -and `bin'. You can specify - -Example: - -monolinker -d ../../libs -a program.exe - -8) Adding custom steps to the linker. +### Adding custom steps to the linker. You can write custom steps for the linker and tell the linker to use them. Let's take a simple example: +```csharp using System; using Mono.Linker; @@ -176,58 +114,120 @@ namespace Foo { } } } +``` - -That is compiled against the linker to a Foo.dll assembly. +That is compiled against the linker to `Foo.dll` assembly. You can ask the linker to add it at the end of the pipeline: -monolinker -s Foo.FooStep,Foo -a program.exe +`illinker -s Foo.FooStep,Foo -a program.exe` Or you can ask the linker to add it after a specific step: -monolinker -s MarkStep:Foo.FooStep,Foo -a program.exe +`illinker -s MarkStep:Foo.FooStep,Foo -a program.exe` Or before a specific step: -monolinker -s Foo.FooStep,Foo:MarkStep +`illinker -s Foo.FooStep,Foo:MarkStep` -* Inside the linker +## Mono specific options + +### The i18n Assemblies + +Mono has a few assemblies which contains everything region specific: + + I18N.CJK.dll + I18N.MidEast.dll + I18N.Other.dll + I18N.Rare.dll + I18N.West.dll + +By default, they will all be copied to the output directory. But you can +specify which one you want using the command: + +`illinker -l choice` + +Where choice can either be: none, all, cjk, mideast, other, rare or west. You can +combine the values with a comma. + +Example: + +`illinker -a assembly -l mideast,cjk` + +## Syntax of xml descriptor + +Here is an example that shows all the possibilities of this format: + +```xml + + + + + + + + + + + +``` + +In this example, the linker will link the types Foo, Bar, Baz and Gazonk. + +The fullname attribute specifies the fullname of the type in the format +specified by ECMA-335. This is in certain cases not the same +as the one reported by Type.FullName (nested classes e.g.). + +The preserve attribute ensures that all the fields of the type Baz will be +always be linked, not matter if they are used or not, but that neither the +fields or the methods of Bar will be linked if they are not used. Not +specifying a preserve attribute implies that we are preserving everything in +the specified type. + +The required attribute specifies that if the type is not marked, during the +mark operation, it will not be linked. + +The type Gazonk will be linked, as well as its constructor taking a string as a +parameter, and it's _blah field. + +You can have multiple assembly nodes. + +# Inside the linker The linker is a quite small piece of code, and it pretty simple to address. -Its only dependency is Mono.Cecil, that is used to read, modify and write back +Its only dependency is `Mono.Cecil`, that is used to read, modify and write back the assemblies. -Everything is located in the namespace Mono.Linker, or in sub namespaces. +Everything is located in the namespace Linker, or in sub namespaces. Being a command line utility, its entry point function is in the class Driver. This class is in charge of analyzing the command line, and to instantiate two important objects, a LinkContext, and a Pipeline. -The LinkContext contains all the informations that will be used during the +The LinkContext contains all the information that will be used during the linking process, such as the assemblies involved, the output directory and probably other useful stuff. The Pipeline is simply a queue of actions (steps), to be applied to the current -context. The whole process of linking is split into those differents steps -that are all located in the Mono.Linker.Steps namespace. +context. The whole process of linking is split into those different steps +that are all located in the Linker.Steps namespace. Here are the current steps that are implemented, in the order they are used: -1) ResolveFromAssembly or ResolveFromXml +## ResolveFromAssembly or ResolveFromXml -Those steps are used to initialize the context, and pre-mark the root code +Those steps are used to initialize the context and pre-mark the root code that will be used as a source for the linker. -Resolving from an assembly or resolving from a xml descriptor is a decision +Resolving from an assembly or resolving from an xml descriptor is a decision taken in the command line parsing. -2) LoadReferences +## LoadReferences This step will load all the references of all the assemblies involved in the current context. -3) Blacklist +## Blacklist This step is used if and only if you have specified that the core should be linked. It will load a bunch of resources from the assemblies, that are @@ -237,7 +237,7 @@ that are used from inside the runtime are properly linked and not removed. It is doing so by inserting a ResolveFromXml step per blacklist in the pipeline. -4) Mark +## Mark This is the most complex step. The linker will get from the context the list of types, fields and methods that have been pre-marked in the resolve steps, @@ -252,53 +252,47 @@ mscorlib assembly, and add it to the queue. When this WriteLine method will be dequeued, and processed, the linker will go through everything that is used in it, and add it to the queue, if they have not been processed already. -To know if something have been marked to be linked, or processed, the linker +To know if something has been marked to be linked, or processed, the linker is using a functionality of Cecil called annotations. Almost everything in -Cecil can be annotated. Concretely, it means that almost everything own an +Cecil can be annotated. Concretely, it means that almost everything owns an Hashtable in which you can add what you want, using the keys and the values you want. So the linker will annotate assemblies, types, methods and fields to know -what should be linked or not, and what have been processed, and how it should +what should be linked or not, and what has been processed, and how it should process them. This is really useful as we don't have to recreate a full hierarchy of classes -to encapsulate the different Cecil types to add the few informations we want. +to encapsulate the different Cecil types to add the few pieces of information we want. -5) Sweep +## Sweep This simple step will walk through all the elements of an assembly, and based on their annotations, remove them or keep them. -6) Clean +## Clean -This step will clean parts of the assemblies, like properties. If a proprety +This step will clean parts of the assemblies, like properties. If a property used to have a getter and a setter, and that after the mark & sweep steps, only the getter is linked, it will update the property to reflect that. -There is a few things to keep clean like properties has we've seen, events, +There are a few things to keep clean like properties we've seen, events, nested classes, and probably a few others. -7) Output +## Output For each assembly in the context, this step will act on the action associated -to the assembly. If the assembly is marked as skip, it won't do anything, +with the assembly. If the assembly is marked as skip, it won't do anything, if it's marked as copy, it will copy the assembly to the output directory, and if it's link, it will save the modified assembly to the output directory. -* Reporting a bug +# Reporting a bug -If you face a bug in the linker, please report it to: +If you face a bug in the linker, please report it using GitHub issues -http://bugzilla.ximian.com - -Product: Mono tools, Component: linker. - -* Mailing lists +# Mailing lists You can ask questions about the linker of the cecil Google Group: http://groups.google.com/group/mono-cecil --- -Jb Evain diff --git a/external/linker/linker/Tests/Extensions/CecilExtensions.cs b/external/linker/linker/Tests/Extensions/CecilExtensions.cs deleted file mode 100644 index 747abf5709..0000000000 --- a/external/linker/linker/Tests/Extensions/CecilExtensions.cs +++ /dev/null @@ -1,122 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Mono.Cecil; - -namespace Mono.Linker.Tests.Extensions { - public static class CecilExtensions { - public static IEnumerable AllDefinedTypes (this AssemblyDefinition assemblyDefinition) - { - return assemblyDefinition.Modules.SelectMany (m => m.AllDefinedTypes ()); - } - - public static IEnumerable AllDefinedTypes (this ModuleDefinition moduleDefinition) - { - foreach (var typeDefinition in moduleDefinition.Types) { - yield return typeDefinition; - - foreach (var definition in typeDefinition.AllDefinedTypes ()) - yield return definition; - } - } - - public static IEnumerable AllDefinedTypes (this TypeDefinition typeDefinition) - { - foreach (var nestedType in typeDefinition.NestedTypes) { - yield return nestedType; - - foreach (var definition in nestedType.AllDefinedTypes ()) - yield return definition; - } - } - - public static IEnumerable AllMembers (this ModuleDefinition module) - { - foreach (var type in module.AllDefinedTypes ()) { - yield return type; - - foreach (var member in type.AllMembers ()) - yield return member; - } - } - - public static IEnumerable AllMembers (this TypeDefinition type) - { - foreach (var field in type.Fields) - yield return field; - - foreach (var prop in type.Properties) - yield return prop; - - foreach (var method in type.Methods) - yield return method; - - foreach (var @event in type.Events) - yield return @event; - } - - public static bool HasAttribute (this ICustomAttributeProvider provider, string name) - { - return provider.CustomAttributes.Any (ca => ca.AttributeType.Name == name); - } - - public static bool HasAttributeDerivedFrom (this ICustomAttributeProvider provider, string name) - { - return provider.CustomAttributes.Any (ca => ca.AttributeType.Resolve ().DerivesFrom (name)); - } - - public static bool DerivesFrom (this TypeDefinition type, string baseTypeName) - { - if (type.Name == baseTypeName) - return true; - - if (type.BaseType == null) - return false; - - if (type.BaseType.Name == baseTypeName) - return true; - - return type.BaseType.Resolve ().DerivesFrom (baseTypeName); - } - - public static PropertyDefinition GetPropertyDefinition (this MethodDefinition method) - { - if (!method.IsSetter && !method.IsGetter) - throw new ArgumentException (); - - var propertyName = method.Name.Substring (4); - return method.DeclaringType.Properties.First (p => p.Name == propertyName); - } - - public static string GetSignature (this MethodDefinition method) - { - var builder = new StringBuilder (); - builder.Append (method.Name); - if (method.HasGenericParameters) { - builder.Append ('<'); - - for (int i = 0; i < method.GenericParameters.Count - 1; i++) - builder.Append ($"{method.GenericParameters [i]},"); - - builder.Append ($"{method.GenericParameters [method.GenericParameters.Count - 1]}>"); - } - - builder.Append ("("); - - if (method.HasParameters) { - for (int i = 0; i < method.Parameters.Count - 1; i++) { - // TODO: modifiers - // TODO: default values - builder.Append ($"{method.Parameters [i].ParameterType},"); - } - - builder.Append (method.Parameters [method.Parameters.Count - 1].ParameterType); - } - - builder.Append (")"); - - return builder.ToString (); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Extensions/NiceIO.cs b/external/linker/linker/Tests/Extensions/NiceIO.cs deleted file mode 100644 index 69b6f30f4f..0000000000 --- a/external/linker/linker/Tests/Extensions/NiceIO.cs +++ /dev/null @@ -1,922 +0,0 @@ -// The MIT License(MIT) -// ===================== -// -// Copyright © `2015-2017` `Lucas Meijer` -// -// 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.Linq; -using System.Text; - -namespace Mono.Linker.Tests.Extensions -{ - public class NPath : IEquatable, IComparable - { - private static readonly StringComparison PathStringComparison = IsLinux() ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; - - private readonly string[] _elements; - private readonly bool _isRelative; - private readonly string _driveLetter; - - #region construction - - public NPath(string path) - { - if (path == null) - throw new ArgumentNullException(); - - path = ParseDriveLetter(path, out _driveLetter); - - if (path == "/") - { - _isRelative = false; - _elements = new string[] { }; - } - else - { - var split = path.Split('/', '\\'); - - _isRelative = _driveLetter == null && IsRelativeFromSplitString(split); - - _elements = ParseSplitStringIntoElements(split.Where(s => s.Length > 0).ToArray()); - } - } - - private NPath(string[] elements, bool isRelative, string driveLetter) - { - _elements = elements; - _isRelative = isRelative; - _driveLetter = driveLetter; - } - - private string[] ParseSplitStringIntoElements(IEnumerable inputs) - { - var stack = new List(); - - foreach (var input in inputs.Where(input => input.Length != 0)) - { - if (input == ".") - { - if ((stack.Count > 0) && (stack.Last() != ".")) - continue; - } - else if (input == "..") - { - if (HasNonDotDotLastElement(stack)) - { - stack.RemoveAt(stack.Count - 1); - continue; - } - if (!_isRelative) - throw new ArgumentException("You cannot create a path that tries to .. past the root"); - } - stack.Add(input); - } - return stack.ToArray(); - } - - private static bool HasNonDotDotLastElement(List stack) - { - return stack.Count > 0 && stack[stack.Count - 1] != ".."; - } - - private string ParseDriveLetter(string path, out string driveLetter) - { - if (path.Length >= 2 && path[1] == ':') - { - driveLetter = path[0].ToString(); - return path.Substring(2); - } - - driveLetter = null; - return path; - } - - private static bool IsRelativeFromSplitString(string[] split) - { - if (split.Length < 2) - return true; - - return split[0].Length != 0 || !split.Any(s => s.Length > 0); - } - - public NPath Combine(params string[] append) - { - return Combine(append.Select(a => new NPath(a)).ToArray()); - } - - public NPath Combine(params NPath[] append) - { - if (!append.All(p => p.IsRelative)) - throw new ArgumentException("You cannot .Combine a non-relative path"); - - return new NPath(ParseSplitStringIntoElements(_elements.Concat(append.SelectMany(p => p._elements))), _isRelative, _driveLetter); - } - - public NPath Parent - { - get - { - if (_elements.Length == 0) - throw new InvalidOperationException("Parent is called on an empty path"); - - var newElements = _elements.Take(_elements.Length - 1).ToArray(); - - return new NPath(newElements, _isRelative, _driveLetter); - } - } - - public NPath RelativeTo(NPath path) - { - if (!IsChildOf(path)) - { - if (!IsRelative && !path.IsRelative && _driveLetter != path._driveLetter) - throw new ArgumentException("Path.RelativeTo() was invoked with two paths that are on different volumes. invoked on: " + ToString() + " asked to be made relative to: " + path); - - NPath commonParent = null; - foreach (var parent in RecursiveParents) - { - commonParent = path.RecursiveParents.FirstOrDefault(otherParent => otherParent == parent); - - if (commonParent != null) - break; - } - - if (commonParent == null) - throw new ArgumentException("Path.RelativeTo() was unable to find a common parent between " + ToString() + " and " + path); - - if (IsRelative && path.IsRelative && commonParent.IsEmpty()) - throw new ArgumentException("Path.RelativeTo() was invoked with two relative paths that do not share a common parent. Invoked on: " + ToString() + " asked to be made relative to: " + path); - - var depthDiff = path.Depth - commonParent.Depth; - return new NPath(Enumerable.Repeat("..", depthDiff).Concat(_elements.Skip(commonParent.Depth)).ToArray(), true, null); - } - - return new NPath(_elements.Skip(path._elements.Length).ToArray(), true, null); - } - - public NPath ChangeExtension(string extension) - { - ThrowIfRoot(); - - var newElements = (string[])_elements.Clone(); - newElements[newElements.Length - 1] = Path.ChangeExtension(_elements[_elements.Length - 1], WithDot(extension)); - if (extension == string.Empty) - newElements[newElements.Length - 1] = newElements[newElements.Length - 1].TrimEnd('.'); - return new NPath(newElements, _isRelative, _driveLetter); - } - #endregion construction - - #region inspection - - public bool IsRelative - { - get { return _isRelative; } - } - - public string FileName - { - get - { - ThrowIfRoot(); - - return _elements.Last(); - } - } - - public string FileNameWithoutExtension - { - get { return Path.GetFileNameWithoutExtension(FileName); } - } - - public IEnumerable Elements - { - get { return _elements; } - } - - public int Depth - { - get { return _elements.Length; } - } - - public bool Exists(string append = "") - { - return Exists(new NPath(append)); - } - - public bool Exists(NPath append) - { - return FileExists(append) || DirectoryExists(append); - } - - public bool DirectoryExists(string append = "") - { - return DirectoryExists(new NPath(append)); - } - - public bool DirectoryExists(NPath append) - { - return Directory.Exists(Combine(append).ToString()); - } - - public bool FileExists(string append = "") - { - return FileExists(new NPath(append)); - } - - public bool FileExists(NPath append) - { - return File.Exists(Combine(append).ToString()); - } - - public string ExtensionWithDot - { - get - { - if (IsRoot) - throw new ArgumentException("A root directory does not have an extension"); - - var last = _elements.Last(); - var index = last.LastIndexOf("."); - if (index < 0) return String.Empty; - return last.Substring(index); - } - } - - public string InQuotes() - { - return "\"" + ToString() + "\""; - } - - public string InQuotes(SlashMode slashMode) - { - return "\"" + ToString(slashMode) + "\""; - } - - public override string ToString() - { - return ToString(SlashMode.Native); - } - - public string ToString(SlashMode slashMode) - { - // Check if it's linux root / - if (IsRoot && string.IsNullOrEmpty(_driveLetter)) - return Slash(slashMode).ToString(); - - if (_isRelative && _elements.Length == 0) - return "."; - - var sb = new StringBuilder(); - if (_driveLetter != null) - { - sb.Append(_driveLetter); - sb.Append(":"); - } - if (!_isRelative) - sb.Append(Slash(slashMode)); - var first = true; - foreach (var element in _elements) - { - if (!first) - sb.Append(Slash(slashMode)); - - sb.Append(element); - first = false; - } - return sb.ToString(); - } - - public static implicit operator string(NPath path) - { - return path.ToString(); - } - - static char Slash(SlashMode slashMode) - { - switch (slashMode) - { - case SlashMode.Backward: - return '\\'; - case SlashMode.Forward: - return '/'; - default: - return Path.DirectorySeparatorChar; - } - } - - public override bool Equals(Object obj) - { - if (obj == null) - return false; - - // If parameter cannot be cast to Point return false. - var p = obj as NPath; - if ((Object)p == null) - return false; - - return Equals(p); - } - - public bool Equals(NPath p) - { - if (p._isRelative != _isRelative) - return false; - - if (!string.Equals(p._driveLetter, _driveLetter, PathStringComparison)) - return false; - - if (p._elements.Length != _elements.Length) - return false; - - for (var i = 0; i != _elements.Length; i++) - if (!string.Equals(p._elements[i], _elements[i], PathStringComparison)) - return false; - - return true; - } - - public static bool operator ==(NPath a, NPath b) - { - // If both are null, or both are same instance, return true. - if (ReferenceEquals(a, b)) - return true; - - // If one is null, but not both, return false. - if (((object)a == null) || ((object)b == null)) - return false; - - // Return true if the fields match: - return a.Equals(b); - } - - public override int GetHashCode() - { - unchecked - { - int hash = 17; - // Suitable nullity checks etc, of course :) - hash = hash * 23 + _isRelative.GetHashCode(); - foreach (var element in _elements) - hash = hash * 23 + element.GetHashCode(); - if (_driveLetter != null) - hash = hash * 23 + _driveLetter.GetHashCode(); - return hash; - } - } - - public int CompareTo(object obj) - { - if (obj == null) - return -1; - - return this.ToString().CompareTo(((NPath)obj).ToString()); - } - - public static bool operator !=(NPath a, NPath b) - { - return !(a == b); - } - - public bool HasExtension(params string[] extensions) - { - var extensionWithDotLower = ExtensionWithDot.ToLower(); - return extensions.Any(e => WithDot(e).ToLower() == extensionWithDotLower); - } - - private static string WithDot(string extension) - { - return extension.StartsWith(".") ? extension : "." + extension; - } - - private bool IsEmpty() - { - return _elements.Length == 0; - } - - public bool IsRoot - { - get { return _elements.Length == 0 && !_isRelative; } - } - - #endregion inspection - - #region directory enumeration - - public IEnumerable Files(string filter, bool recurse = false) - { - return Directory.GetFiles(ToString(), filter, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Select(s => new NPath(s)); - } - - public IEnumerable Files(bool recurse = false) - { - return Files("*", recurse); - } - - public IEnumerable Contents(string filter, bool recurse = false) - { - return Files(filter, recurse).Concat(Directories(filter, recurse)); - } - - public IEnumerable Contents(bool recurse = false) - { - return Contents("*", recurse); - } - - public IEnumerable Directories(string filter, bool recurse = false) - { - return Directory.GetDirectories(ToString(), filter, recurse ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).Select(s => new NPath(s)); - } - - public IEnumerable Directories(bool recurse = false) - { - return Directories("*", recurse); - } - - #endregion - - #region filesystem writing operations - public NPath CreateFile() - { - ThrowIfRelative(); - ThrowIfRoot(); - EnsureParentDirectoryExists(); - File.WriteAllBytes(ToString(), new byte[0]); - return this; - } - - public NPath CreateFile(string file) - { - return CreateFile(new NPath(file)); - } - - public NPath CreateFile(NPath file) - { - if (!file.IsRelative) - throw new ArgumentException("You cannot call CreateFile() on an existing path with a non relative argument"); - return Combine(file).CreateFile(); - } - - public NPath CreateDirectory() - { - ThrowIfRelative(); - - if (IsRoot) - throw new NotSupportedException("CreateDirectory is not supported on a root level directory because it would be dangerous:" + ToString()); - - Directory.CreateDirectory(ToString()); - return this; - } - - public NPath CreateDirectory(string directory) - { - return CreateDirectory(new NPath(directory)); - } - - public NPath CreateDirectory(NPath directory) - { - if (!directory.IsRelative) - throw new ArgumentException("Cannot call CreateDirectory with an absolute argument"); - - return Combine(directory).CreateDirectory(); - } - - public NPath Copy(string dest) - { - return Copy(new NPath(dest)); - } - - public NPath Copy(string dest, Func fileFilter) - { - return Copy(new NPath(dest), fileFilter); - } - - public NPath Copy(NPath dest) - { - return Copy(dest, p => true); - } - - public NPath Copy(NPath dest, Func fileFilter) - { - ThrowIfRelative(); - if (dest.IsRelative) - dest = Parent.Combine(dest); - - if (dest.DirectoryExists()) - return CopyWithDeterminedDestination(dest.Combine(FileName), fileFilter); - - return CopyWithDeterminedDestination(dest, fileFilter); - } - - public NPath MakeAbsolute() - { - if (!IsRelative) - return this; - - return NPath.CurrentDirectory.Combine(this); - } - - NPath CopyWithDeterminedDestination(NPath absoluteDestination, Func fileFilter) - { - if (absoluteDestination.IsRelative) - throw new ArgumentException("absoluteDestination must be absolute"); - - if (FileExists()) - { - if (!fileFilter(absoluteDestination)) - return null; - - absoluteDestination.EnsureParentDirectoryExists(); - - File.Copy(ToString(), absoluteDestination.ToString(), true); - return absoluteDestination; - } - - if (DirectoryExists()) - { - absoluteDestination.EnsureDirectoryExists(); - foreach (var thing in Contents()) - thing.CopyWithDeterminedDestination(absoluteDestination.Combine(thing.RelativeTo(this)), fileFilter); - return absoluteDestination; - } - - throw new ArgumentException("Copy() called on path that doesnt exist: " + ToString()); - } - - public void Delete(DeleteMode deleteMode = DeleteMode.Normal) - { - ThrowIfRelative(); - - if (IsRoot) - throw new NotSupportedException("Delete is not supported on a root level directory because it would be dangerous:" + ToString()); - - if (FileExists()) - File.Delete(ToString()); - else if (DirectoryExists()) - try - { - Directory.Delete(ToString(), true); - } - catch (IOException) - { - if (deleteMode == DeleteMode.Normal) - throw; - } - else - throw new InvalidOperationException("Trying to delete a path that does not exist: " + ToString()); - } - - public void DeleteIfExists(DeleteMode deleteMode = DeleteMode.Normal) - { - ThrowIfRelative(); - - if (FileExists() || DirectoryExists()) - Delete(deleteMode); - } - - public NPath DeleteContents() - { - ThrowIfRelative(); - - if (IsRoot) - throw new NotSupportedException("DeleteContents is not supported on a root level directory because it would be dangerous:" + ToString()); - - if (FileExists()) - throw new InvalidOperationException("It is not valid to perform this operation on a file"); - - if (DirectoryExists()) - { - try - { - Files().Delete(); - Directories().Delete(); - } - catch (IOException) - { - if (Files(true).Any()) - throw; - } - - return this; - } - - return EnsureDirectoryExists(); - } - - public static NPath CreateTempDirectory(string myprefix) - { - var random = new Random(); - while (true) - { - var candidate = new NPath(Path.GetTempPath() + "/" + myprefix + "_" + random.Next()); - if (!candidate.Exists()) - return candidate.CreateDirectory(); - } - } - - public NPath Move(string dest) - { - return Move(new NPath(dest)); - } - - public NPath Move(NPath dest) - { - ThrowIfRelative(); - - if (IsRoot) - throw new NotSupportedException("Move is not supported on a root level directory because it would be dangerous:" + ToString()); - - if (dest.IsRelative) - return Move(Parent.Combine(dest)); - - if (dest.DirectoryExists()) - return Move(dest.Combine(FileName)); - - if (FileExists()) - { - dest.EnsureParentDirectoryExists(); - File.Move(ToString(), dest.ToString()); - return dest; - } - - if (DirectoryExists()) - { - Directory.Move(ToString(), dest.ToString()); - return dest; - } - - throw new ArgumentException("Move() called on a path that doesn't exist: " + ToString()); - } - - #endregion - - #region special paths - - public static NPath CurrentDirectory - { - get - { - return new NPath(Directory.GetCurrentDirectory()); - } - } - - public static NPath HomeDirectory - { - get - { - if (Path.DirectorySeparatorChar == '\\') - return new NPath(Environment.GetEnvironmentVariable("USERPROFILE")); - return new NPath(Environment.GetEnvironmentVariable("HOME")); - } - } - - public static NPath SystemTemp - { - get - { - return new NPath(Path.GetTempPath()); - } - } - - #endregion - - private void ThrowIfRelative() - { - if (_isRelative) - throw new ArgumentException("You are attempting an operation on a Path that requires an absolute path, but the path is relative"); - } - - private void ThrowIfRoot() - { - if (IsRoot) - throw new ArgumentException("You are attempting an operation that is not valid on a root level directory"); - } - - public NPath EnsureDirectoryExists(string append = "") - { - return EnsureDirectoryExists(new NPath(append)); - } - - public NPath EnsureDirectoryExists(NPath append) - { - var combined = Combine(append); - if (combined.DirectoryExists()) - return combined; - combined.EnsureParentDirectoryExists(); - combined.CreateDirectory(); - return combined; - } - - public NPath EnsureParentDirectoryExists() - { - var parent = Parent; - parent.EnsureDirectoryExists(); - return parent; - } - - public NPath FileMustExist() - { - if (!FileExists()) - throw new FileNotFoundException("File was expected to exist : " + ToString()); - - return this; - } - - public NPath DirectoryMustExist() - { - if (!DirectoryExists()) - throw new DirectoryNotFoundException("Expected directory to exist : " + ToString()); - - return this; - } - - public bool IsChildOf(string potentialBasePath) - { - return IsChildOf(new NPath(potentialBasePath)); - } - - public bool IsChildOf(NPath potentialBasePath) - { - if ((IsRelative && !potentialBasePath.IsRelative) || !IsRelative && potentialBasePath.IsRelative) - throw new ArgumentException("You can only call IsChildOf with two relative paths, or with two absolute paths"); - - // If the other path is the root directory, then anything is a child of it as long as it's not a Windows path - if (potentialBasePath.IsRoot) - { - if (_driveLetter != potentialBasePath._driveLetter) - return false; - return true; - } - - if (IsEmpty()) - return false; - - if (Equals(potentialBasePath)) - return true; - - return Parent.IsChildOf(potentialBasePath); - } - - public IEnumerable RecursiveParents - { - get - { - var candidate = this; - while (true) - { - if (candidate.IsEmpty()) - yield break; - - candidate = candidate.Parent; - yield return candidate; - } - } - } - - public NPath ParentContaining(string needle) - { - return ParentContaining(new NPath(needle)); - } - - public NPath ParentContaining(NPath needle) - { - ThrowIfRelative(); - - return RecursiveParents.FirstOrDefault(p => p.Exists(needle)); - } - - public NPath WriteAllText(string contents) - { - ThrowIfRelative(); - EnsureParentDirectoryExists(); - File.WriteAllText(ToString(), contents); - return this; - } - - public string ReadAllText() - { - ThrowIfRelative(); - return File.ReadAllText(ToString()); - } - - public NPath WriteAllLines(string[] contents) - { - ThrowIfRelative(); - EnsureParentDirectoryExists(); - File.WriteAllLines(ToString(), contents); - return this; - } - - public string[] ReadAllLines() - { - ThrowIfRelative(); - return File.ReadAllLines(ToString()); - } - - public IEnumerable CopyFiles(NPath destination, bool recurse, Func fileFilter = null) - { - destination.EnsureDirectoryExists(); - return Files(recurse).Where(fileFilter ?? AlwaysTrue).Select(file => file.Copy(destination.Combine(file.RelativeTo(this)))).ToArray(); - } - - public IEnumerable MoveFiles(NPath destination, bool recurse, Func fileFilter = null) - { - if (IsRoot) - throw new NotSupportedException("MoveFiles is not supported on this directory because it would be dangerous:" + ToString()); - - destination.EnsureDirectoryExists(); - return Files(recurse).Where(fileFilter ?? AlwaysTrue).Select(file => file.Move(destination.Combine(file.RelativeTo(this)))).ToArray(); - } - - static bool AlwaysTrue(NPath p) - { - return true; - } - - private static bool IsLinux() - { - return Directory.Exists("/proc"); - } - } - - public static class Extensions - { - public static IEnumerable Copy(this IEnumerable self, string dest) - { - return Copy(self, new NPath(dest)); - } - - public static IEnumerable Copy(this IEnumerable self, NPath dest) - { - if (dest.IsRelative) - throw new ArgumentException("When copying multiple files, the destination cannot be a relative path"); - dest.EnsureDirectoryExists(); - return self.Select(p => p.Copy(dest.Combine(p.FileName))).ToArray(); - } - - public static IEnumerable Move(this IEnumerable self, string dest) - { - return Move(self, new NPath(dest)); - } - - public static IEnumerable Move(this IEnumerable self, NPath dest) - { - if (dest.IsRelative) - throw new ArgumentException("When moving multiple files, the destination cannot be a relative path"); - dest.EnsureDirectoryExists(); - return self.Select(p => p.Move(dest.Combine(p.FileName))).ToArray(); - } - - public static IEnumerable Delete(this IEnumerable self) - { - foreach (var p in self) - p.Delete(); - return self; - } - - public static IEnumerable InQuotes(this IEnumerable self, SlashMode forward = SlashMode.Native) - { - return self.Select(p => p.InQuotes(forward)); - } - - public static NPath ToNPath(this string path) - { - return new NPath(path); - } - } - - public enum SlashMode - { - Native, - Forward, - Backward - } - - public enum DeleteMode - { - Normal, - Soft - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs deleted file mode 100644 index 47f0f34153..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseExpectedLinkedBehaviorAttribute.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Diagnostics; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - /// - /// Base attribute for attributes that mark up the expected behavior of the linker on a member - /// - [Conditional("INCLUDE_EXPECTATIONS")] - public abstract class BaseExpectedLinkedBehaviorAttribute : Attribute { - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs deleted file mode 100644 index df1a80a13d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/BaseInAssemblyAttribute.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - public abstract class BaseInAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs deleted file mode 100644 index cf6d750949..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/IgnoreTestCaseAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class)] - public class IgnoreTestCaseAttribute : Attribute { - - public IgnoreTestCaseAttribute (string reason) - { - if (reason == null) - throw new ArgumentNullException (nameof (reason)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs deleted file mode 100644 index 5107bdef2c..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAssemblyAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - /// - /// Verifies that an assembly does exist in the output directory - /// - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptAssemblyAttribute : KeptAttribute { - - public KeptAssemblyAttribute (string fileName) - { - if (string.IsNullOrEmpty (fileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (fileName)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs deleted file mode 100644 index 837c971529..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttribute.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.All, Inherited = false)] - public class KeptAttribute : BaseExpectedLinkedBehaviorAttribute { - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs deleted file mode 100644 index c09982a5aa..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptAttributeAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - [AttributeUsage (AttributeTargets.All, AllowMultiple = true, Inherited = false)] - public class KeptAttributeAttribute : KeptAttribute - { - - public KeptAttributeAttribute (string attributeName) - { - if (string.IsNullOrEmpty (attributeName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (attributeName)); - } - - public KeptAttributeAttribute (Type type) - { - if (type == null) - throw new ArgumentNullException (nameof (type)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs deleted file mode 100644 index b21ce0628d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBackingFieldAttribute.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Event, AllowMultiple = false, Inherited = false)] - public sealed class KeptBackingFieldAttribute : KeptAttribute { - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs deleted file mode 100644 index 2824be6302..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptBaseTypeAttribute.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] - public sealed class KeptBaseTypeAttribute : KeptAttribute - { - public KeptBaseTypeAttribute (Type baseType) - { - if (baseType == null) - throw new ArgumentNullException (nameof (baseType)); - } - - public KeptBaseTypeAttribute (Type baseType, params object[] typeArguments) - { - if (baseType == null) - throw new ArgumentNullException (nameof (baseType)); - if (typeArguments == null) - throw new ArgumentNullException (nameof (typeArguments)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs deleted file mode 100644 index 9314b47129..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptInterfaceAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] - public class KeptInterfaceAttribute : KeptAttribute - { - - public KeptInterfaceAttribute (Type interfaceType) - { - if (interfaceType == null) - throw new ArgumentNullException (nameof (interfaceType)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs deleted file mode 100644 index 34cfc5503c..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate | AttributeTargets.Struct, AllowMultiple = true, Inherited = false)] - public sealed class KeptMemberAttribute : KeptAttribute { - - public KeptMemberAttribute (string name) - { - if (string.IsNullOrEmpty (name)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (name)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs deleted file mode 100644 index fed2061ea1..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptMemberInAssemblyAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; - - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptMemberInAssemblyAttribute : BaseInAssemblyAttribute { - - public KeptMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentNullException (nameof (assemblyFileName)); - if (type == null) - throw new ArgumentNullException (nameof (type)); - if (memberNames == null) - throw new ArgumentNullException (nameof (memberNames)); - } - - public KeptMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string [] memberNames) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentNullException (nameof (assemblyFileName)); - if (typeName == null) - throw new ArgumentNullException (nameof (typeName)); - if (memberNames == null) - throw new ArgumentNullException (nameof (memberNames)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs deleted file mode 100644 index 0106dfd1a4..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - /// - /// Verifies that a resource exists in the test case assembly - /// - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptResourceAttribute : KeptAttribute { - public KeptResourceAttribute (string name) - { - if (string.IsNullOrEmpty (name)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (name)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs deleted file mode 100644 index c17fed964d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptResourceInAssemblyAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - /// - /// Verifies that an embedded resource exists in an assembly - /// - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class KeptResourceInAssemblyAttribute : BaseInAssemblyAttribute { - public KeptResourceInAssemblyAttribute (string assemblyFileName, string resourceName) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentNullException (nameof (assemblyFileName)); - - if (string.IsNullOrEmpty (resourceName)) - throw new ArgumentNullException (nameof (resourceName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs deleted file mode 100644 index e259056304..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptSecurityAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Assembly | AttributeTargets.Method, AllowMultiple = true, Inherited = false)] - public class KeptSecurityAttribute : KeptAttribute { - public KeptSecurityAttribute (string attributeName) - { - if (string.IsNullOrEmpty (attributeName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (attributeName)); - } - - public KeptSecurityAttribute (Type type) - { - if (type == null) - throw new ArgumentNullException (nameof (type)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs deleted file mode 100644 index b5aee13926..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/KeptTypeInAssemblyAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class KeptTypeInAssemblyAttribute : BaseInAssemblyAttribute { - public KeptTypeInAssemblyAttribute (string assemblyFileName, Type type) - { - if (type == null) - throw new ArgumentNullException (nameof (type)); - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); - } - - public KeptTypeInAssemblyAttribute (string assemblyFileName, string typeName) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); - if (string.IsNullOrEmpty (typeName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs deleted file mode 100644 index 60cab2a3f9..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedAssemblyAttribute.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - /// - /// Verifies that an assembly does not exist in the output directory - /// - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class RemovedAssemblyAttribute : BaseExpectedLinkedBehaviorAttribute { - - public RemovedAssemblyAttribute (string fileName) - { - if (string.IsNullOrEmpty (fileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (fileName)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedForwarderAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedForwarderAttribute.cs deleted file mode 100644 index 645a01bdc9..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedForwarderAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class RemovedForwarderAttribute : BaseInAssemblyAttribute - { - public RemovedForwarderAttribute (string assemblyFileName, string typeName) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); - if (string.IsNullOrEmpty (typeName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs deleted file mode 100644 index 36bc435bfb..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedMemberInAssemblyAttribute.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class RemovedMemberInAssemblyAttribute : BaseInAssemblyAttribute { - - public RemovedMemberInAssemblyAttribute (string assemblyFileName, Type type, params string [] memberNames) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentNullException (nameof (assemblyFileName)); - if (type == null) - throw new ArgumentNullException (nameof (type)); - if (memberNames == null) - throw new ArgumentNullException (nameof (memberNames)); - } - - public RemovedMemberInAssemblyAttribute (string assemblyFileName, string typeName, params string [] memberNames) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentNullException (nameof (assemblyFileName)); - if (typeName == null) - throw new ArgumentNullException (nameof (typeName)); - if (memberNames == null) - throw new ArgumentNullException (nameof (memberNames)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs deleted file mode 100644 index e05b7ed808..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedResourceInAssemblyAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - /// - /// Verifies that an embedded resource was removed from an assembly - /// - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true, Inherited = false)] - public class RemovedResourceInAssemblyAttribute : BaseInAssemblyAttribute { - public RemovedResourceInAssemblyAttribute (string assemblyFileName, string resourceName) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentNullException (nameof (assemblyFileName)); - - if (string.IsNullOrEmpty (resourceName)) - throw new ArgumentNullException (nameof (resourceName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs deleted file mode 100644 index 253f5bed20..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/RemovedTypeInAssemblyAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions -{ - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Delegate, AllowMultiple = true, Inherited = false)] - public class RemovedTypeInAssemblyAttribute : BaseInAssemblyAttribute { - public RemovedTypeInAssemblyAttribute (string assemblyFileName, Type type) - { - if (type == null) - throw new ArgumentNullException (nameof (type)); - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); - } - - public RemovedTypeInAssemblyAttribute (string assemblyFileName, string typeName) - { - if (string.IsNullOrEmpty (assemblyFileName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (assemblyFileName)); - if (string.IsNullOrEmpty (typeName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (typeName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs deleted file mode 100644 index eaccabd254..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Assertions/SkipPeVerifyAttribute.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Assertions { - - public enum SkipPeVerifyForToolchian - { - Pedump - } - - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SkipPeVerifyAttribute : BaseExpectedLinkedBehaviorAttribute - { - public SkipPeVerifyAttribute () - { - } - - public SkipPeVerifyAttribute (SkipPeVerifyForToolchian toolchain) - { - } - - public SkipPeVerifyAttribute (string assemblyName) - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs deleted file mode 100644 index d98584eab1..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/BaseMetadataAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using System.Diagnostics; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata -{ - [Conditional("INCLUDE_EXPECTATIONS")] - public abstract class BaseMetadataAttribute : Attribute { - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs deleted file mode 100644 index 14e95fd4d8..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/DefineAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class DefineAttribute : BaseMetadataAttribute { - public DefineAttribute (string name) - { - if (string.IsNullOrEmpty (name)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (name)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs deleted file mode 100644 index e72692411e..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/Il8nAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class)] - public sealed class Il8nAttribute : BaseMetadataAttribute { - public readonly string Value; - - public Il8nAttribute (string value) - { - Value = value; - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs deleted file mode 100644 index 4144abcf65..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/IncludeBlacklistStepAttribute.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - public sealed class IncludeBlacklistStepAttribute : BaseMetadataAttribute { - public readonly bool Value; - - public IncludeBlacklistStepAttribute (bool value) - { - Value = value; - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs deleted file mode 100644 index ef00ca5f5e..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/KeepTypeForwarderOnlyAssembliesAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class)] - public sealed class KeepTypeForwarderOnlyAssembliesAttribute : BaseMetadataAttribute { - public KeepTypeForwarderOnlyAssembliesAttribute (string value) - { - if (string.IsNullOrEmpty (value)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (value)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs deleted file mode 100644 index 1fabca3319..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/NotATestCaseAttribute.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class | AttributeTargets.Struct)] - public class NotATestCaseAttribute : BaseMetadataAttribute { - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs deleted file mode 100644 index 0c6fa852d2..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/ReferenceAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class ReferenceAttribute : BaseMetadataAttribute { - - public ReferenceAttribute (string value) - { - if (string.IsNullOrEmpty (value)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (value)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs deleted file mode 100644 index df8033b468..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SandboxDependencyAttribute.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SandboxDependencyAttribute : BaseMetadataAttribute { - - public SandboxDependencyAttribute (string relativePathToFile, string destinationFileName = null) - { - if (string.IsNullOrEmpty (relativePathToFile)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs deleted file mode 100644 index fa580a2f8d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAfterAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - /// - /// Use to compile an assembly after compiling the main test case executabe - /// - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileAfterAttribute : BaseMetadataAttribute { - public SetupCompileAfterAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null) - { - if (sourceFiles == null) - throw new ArgumentNullException (nameof (sourceFiles)); - - if (string.IsNullOrEmpty (outputName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs deleted file mode 100644 index bec6d93c12..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileArgumentAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileArgumentAttribute : BaseMetadataAttribute { - public SetupCompileArgumentAttribute (string value) - { - if (string.IsNullOrEmpty (value)) - throw new ArgumentNullException (nameof(value)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs deleted file mode 100644 index ceb0842eb7..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileAssemblyNameAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupCompileAssemblyNameAttribute : BaseMetadataAttribute { - public SetupCompileAssemblyNameAttribute (string outputName) - { - if (string.IsNullOrEmpty (outputName)) - throw new ArgumentNullException (nameof (outputName)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs deleted file mode 100644 index d9a3bd6589..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileBeforeAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - /// - /// Use to compile an assembly before compiling the main test case executabe - /// - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileBeforeAttribute : BaseMetadataAttribute { - public SetupCompileBeforeAttribute (string outputName, string[] sourceFiles, string[] references = null, string[] defines = null, bool addAsReference = true) - { - if (sourceFiles == null) - throw new ArgumentNullException (nameof (sourceFiles)); - - if (string.IsNullOrEmpty (outputName)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (outputName)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs deleted file mode 100644 index b86a162c58..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupCompileResourceAttribute.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupCompileResourceAttribute : BaseMetadataAttribute { - public SetupCompileResourceAttribute (string relativePathToFile, string destinationFileName = null) - { - if (string.IsNullOrEmpty (relativePathToFile)) - throw new ArgumentException ("Value cannot be null or empty.", nameof (relativePathToFile)); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerActionAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerActionAttribute.cs deleted file mode 100644 index d0d68193e8..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerActionAttribute.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata -{ - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupLinkerActionAttribute : BaseMetadataAttribute - { - public SetupLinkerActionAttribute (string action, string assembly) - { - switch (action) { - case "link": case "copy": case "skip": - break; - default: - throw new ArgumentOutOfRangeException (nameof (action)); - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs deleted file mode 100644 index 3ab3ac873d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerArgumentAttribute.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata { - - /// - /// Used to define arguments to pass to the linker. - /// - /// Don't use this attribute to setup single character flags. These flags do a poor job of communicating their purpose - /// and although we need to continue to support the usages that exist today, that doesn't mean we need to make our tests harder to read - /// - [AttributeUsage (AttributeTargets.Class, AllowMultiple = true)] - public class SetupLinkerArgumentAttribute : BaseMetadataAttribute { - public SetupLinkerArgumentAttribute (string flag, params string [] values) - { - if (string.IsNullOrEmpty (flag)) - throw new ArgumentNullException (nameof (flag)); - - if (flag[0] == '-' && flag.Length == 2) - throw new ArgumentException ($"Flag `{flag}` is short. Avoid using this attribute with command line flags that are to short to communicate their meaning. Support a more descriptive flag or create a new attribute for tests to use similar to {nameof(SetupLinkerCoreActionAttribute)}");} - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerCoreActionAttribute.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerCoreActionAttribute.cs deleted file mode 100644 index c60bc59b20..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Metadata/SetupLinkerCoreActionAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Expectations.Metadata -{ - [AttributeUsage (AttributeTargets.Class, AllowMultiple = false)] - public class SetupLinkerCoreActionAttribute : BaseMetadataAttribute - { - public SetupLinkerCoreActionAttribute (string action) - { - switch (action) { - case "link": - case "copy": - case "skip": - break; - default: - throw new ArgumentOutOfRangeException (nameof (action)); - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj b/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj deleted file mode 100644 index e13fb49b04..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases.Expectations/Mono.Linker.Tests.Cases.Expectations.csproj +++ /dev/null @@ -1,86 +0,0 @@ - - - - - Debug - AnyCPU - {2C26601F-3E2F-45B9-A02F-58EE9296E19E} - Library - Properties - Mono.Linker.Tests.Cases.Expectations - Mono.Linker.Tests.Cases.Expectations - v4.0 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs deleted file mode 100644 index 339d223b6e..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/DeadCodeElimination1.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Advanced { - [IgnoreTestCase ("We cannot do this yet")] - class DeadCodeElimination1 { - public static void Main () - { - object o = null; - if (o is B) - ((B) o).Method (); - } - - class B { - public void Method () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs deleted file mode 100644 index 8c4933ad2e..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Advanced/FieldThatOnlyGetsSetIsRemoved.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Advanced { - [IgnoreTestCase ("We cannot do this yet")] - class FieldThatOnlyGetsSetIsRemoved { - public static void Main () - { - new B ().Method (); - } - - [KeptMember (".ctor()")] - class B { - public int _unused = 3; - - [Kept] - public void Method () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs deleted file mode 100644 index 1e74f81c2d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Attributes.Dependencies; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -[assembly: AttributeInReference] - -namespace Mono.Linker.Tests.Cases.Attributes { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs" })] - [RemovedAssembly ("library.dll")] - class AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly { - static void Main () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs deleted file mode 100644 index 9373f9bde7..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AssemblyAttributeKeptInComplexCase.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Attributes; -using Mono.Linker.Tests.Cases.Attributes.Dependencies; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -// This attribute is defined in this assembly so it will be kept -[assembly: AssemblyAttributeKeptInComplexCase.Foo] - -// This attribute is not going to get marked on the first pass because the reference -// it is defined in will not have been marked yet. -// The catch is, Foo's ctor() will mark a method in `library`, at which point we now expect this -// attribute to be kept -[assembly: AssemblyAttributeKeptInComplexCase_Lib.OtherAssembly] - -[assembly: KeptAttributeAttribute (typeof (AssemblyAttributeKeptInComplexCase.FooAttribute))] -[assembly: KeptAttributeAttribute (typeof (AssemblyAttributeKeptInComplexCase_Lib.OtherAssemblyAttribute))] - -namespace Mono.Linker.Tests.Cases.Attributes { - [SetupCompileBefore ("library.dll", new [] { "Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs" })] - [KeptAssembly ("library.dll")] - [KeptMemberInAssembly ("library.dll", typeof (AssemblyAttributeKeptInComplexCase_Lib.OtherAssemblyAttribute), ".ctor()")] - [KeptMemberInAssembly ("library.dll", typeof (AssemblyAttributeKeptInComplexCase_Lib), "MethodThatWillBeUsed()")] - public class AssemblyAttributeKeptInComplexCase { - static void Main () - { - } - - [Kept] - [KeptBaseType (typeof (Attribute))] - public class FooAttribute : Attribute { - [Kept] - public FooAttribute () - { - // This ctor will be marked late after processing the queue - // This method we call will be the first marked in the referenced library - AssemblyAttributeKeptInComplexCase_Lib.MethodThatWillBeUsed (); - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs deleted file mode 100644 index b42d3ff2f5..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnAssemblyIsKept.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Attributes; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -[assembly: AttributeOnAssemblyIsKept.Foo] -[assembly: KeptAttributeAttribute (typeof (AttributeOnAssemblyIsKept.FooAttribute))] - -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnAssemblyIsKept { - static void Main () - { - } - - [KeptBaseType (typeof (System.Attribute))] - public class FooAttribute : Attribute { - [Kept] - public FooAttribute () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs deleted file mode 100644 index 01cdad565e..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnParameterInUsedMethodIsKept.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnParameterInUsedMethodIsKept { - static void Main () - { - Method ("Bar"); - } - - [Kept] - static void Method ([Foo] [KeptAttributeAttribute (typeof (FooAttribute))] string arg) - { - } - - [Kept] - [KeptMember (".ctor()")] - [KeptBaseType (typeof(Attribute))] - class FooAttribute : Attribute { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs deleted file mode 100644 index 1cd0cdc238..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeIsKept.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - [Foo] - [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeIsKept { - public static void Main () - { - } - - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - [Kept] - public FooAttribute () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs deleted file mode 100644 index aa6600837f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - [Foo (typeof (A))] - [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInConstructorIsKept { - public static void Main () - { - } - - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - [Kept] - public FooAttribute (Type val) - { - } - } - - [Kept] - class A { - public A () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs deleted file mode 100644 index 976ac6d262..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace NamespaceForAttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept { - [Kept] - class A { - public A () - { - } - } -} - -namespace Mono.Linker.Tests.Cases.Attributes { - [Foo (typeof (NamespaceForAttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept.A))] - [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInDifferentNamespaceIsKept { - public static void Main () - { - } - - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - [Kept] - public FooAttribute (Type val) - { - } - } - - // This A is not used and should be removed - class A { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs deleted file mode 100644 index e038333e9f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInFieldIsKept.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - [Foo (Val = typeof (A))] - [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInFieldIsKept { - public static void Main () - { - } - - [KeptMember(".ctor()")] - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - [Kept] - public Type Val; - } - - [Kept] - class A { - public A () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs deleted file mode 100644 index 8bc4dd523f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - [Foo (Val = typeof (A))] - [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithTypeUsedInPropertySetterIsKept { - public static void Main () - { - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - [Kept] - [KeptBackingField] - public Type Val { get; [Kept] set; } - } - - [Kept] - class A { - public A () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs deleted file mode 100644 index 957de91e18..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnPreservedTypeWithUsedSetter.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - [Foo (Val = 1)] - [KeptAttributeAttribute (typeof (FooAttribute))] - class AttributeOnPreservedTypeWithUsedSetter { - public static void Main () - { - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - [Kept] - [KeptBackingField] - public int Val { get; [Kept] set; } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs deleted file mode 100644 index 834c446ac4..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedFieldIsKept.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnUsedFieldIsKept { - public static void Main () - { - var val = new A ().field; - } - - [KeptMember (".ctor()")] - class A { - [Kept] - [KeptAttributeAttribute (typeof (FooAttribute))] - [Foo] - public int field; - } - - [Kept] - [KeptMember(".ctor()")] - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs deleted file mode 100644 index 0f99a1ca95..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedMethodIsKept.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnUsedMethodIsKept { - public static void Main () - { - new A ().Method (); - } - - [KeptMember (".ctor()")] - class A { - [Foo] - [Kept] - [KeptAttributeAttribute (typeof (FooAttribute))] - public void Method () - { - } - } - - [Kept] - [KeptMember (".ctor()")] - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs deleted file mode 100644 index 8e61c12c12..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/AttributeOnUsedPropertyIsKept.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - class AttributeOnUsedPropertyIsKept { - public static void Main () - { - var val = new A ().Field; - } - - [KeptMember (".ctor()")] - [KeptMember ("get_Field()")] - class A { - [Kept] - [KeptBackingField] - [KeptAttributeAttribute (typeof (FooAttribute))] - [Foo] - public int Field { get; set; } - } - - [Kept] - [KeptMember (".ctor()")] - [KeptBaseType (typeof (System.Attribute))] - class FooAttribute : Attribute { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs deleted file mode 100644 index b52782cd8d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeIsRemovedIfOnlyTypesUsedInAssembly_Lib.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { - public class AttributeInReferenceAttribute : Attribute { - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs deleted file mode 100644 index 914361f07d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/Dependencies/AssemblyAttributeKeptInComplexCase_Lib.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.Attributes.Dependencies { - public class AssemblyAttributeKeptInComplexCase_Lib { - public class OtherAssemblyAttribute : Attribute { - } - - public static void MethodThatWillBeUsed () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs deleted file mode 100644 index d6d9e26d91..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedMethodAreKept.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Security.Permissions; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - class SecurityAttributesOnUsedMethodAreKept { - static void Main () - { - new Foo ().Method (); - } - - [Kept] - [KeptMember (".ctor()")] - class Foo { - [SecurityPermission (SecurityAction.LinkDemand)] - [Kept] - [KeptSecurity (typeof (SecurityPermissionAttribute))] - public void Method () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs deleted file mode 100644 index 572e5f7edc..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Attributes/SecurityAttributesOnUsedTypeAreKept.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Security.Permissions; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Attributes { - class SecurityAttributesOnUsedTypeAreKept { - static void Main () - { - new Foo (); - } - - [SecurityPermission (SecurityAction.LinkDemand)] - [Kept] - [KeptMember (".ctor()")] - [KeptSecurity (typeof (SecurityPermissionAttribute))] - class Foo { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs deleted file mode 100644 index fbdbee2045..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/ComplexNestedClassesHasUnusedRemoved.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class ComplexNestedClassesHasUnusedRemoved { - public static void Main () - { - new A.AB.ABD (); - } - - [Kept] - public class A { - [Kept] - public class AB { - public class ABC { - } - - [Kept] - [KeptMember(".ctor()")] - public class ABD { - public class ABDE { - } - } - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs deleted file mode 100644 index fa0b762a8b..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/InterfaceMethodImplementedOnBaseClassDoesNotGetStripped.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class InterfaceMethodImplementedOnBaseClassDoesNotGetStripped { - public static void Main () - { - I1 i1 = new Derived (); - i1.Used (); - } - - public interface I1 { - void Unused (); - - [Kept] - void Used (); - } - - [KeptMember (".ctor()")] - public class Base { - public void Unused () - { - } - - [Kept] - public void Used () - { - } - } - - [Kept] - [KeptMember (".ctor()")] - [KeptBaseType (typeof (Base))] - [KeptInterface (typeof (I1))] - public class Derived : Base, I1 { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs deleted file mode 100644 index dd5f8628e7..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/MultiLevelNestedClassesAllRemovedWhenNonUsed.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class MultiLevelNestedClassesAllRemovedWhenNonUsed { - public static void Main () - { - } - - public class A { - public class AB { - public class ABC { - } - - public class ABD { - } - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs deleted file mode 100644 index c3e231781d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/NestedDelegateInvokeMethodsPreserved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class NestedDelegateInvokeMethodsPreserved { - [Kept] - static B.Delegate @delegate; - - static void Main () - { - System.GC.KeepAlive (@delegate); - } - - [Kept] - public class B { - [Kept] - [KeptMember ("Invoke()")] - [KeptMember ("BeginInvoke(System.AsyncCallback,System.Object)")] - [KeptMember ("EndInvoke(System.IAsyncResult)")] - [KeptMember (".ctor(System.Object,System.IntPtr)")] - [KeptBaseType (typeof (System.MulticastDelegate))] - public delegate void Delegate (); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs deleted file mode 100644 index 11771f4dbb..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UninvokedInterfaceMemberGetsRemoved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class UninvokedInterfaceMemberGetsRemoved { - public static void Main () - { - new B (); - } - - [Kept] - interface I { - void Method (); - } - - [Kept] - [KeptMember (".ctor()")] - [KeptInterface (typeof (I))] - class B : I { - public void Method () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs deleted file mode 100644 index 85d60e33da..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedClassGetsRemoved.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace Mono.Linker.Tests.Cases.Basic { - public class UnusedClassGetsRemoved { - public static void Main () - { - } - } - - class Unused { - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs deleted file mode 100644 index 6edcf5729f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedFieldGetsRemoved.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedFieldGetsRemoved { - public static void Main () - { - new B ().Method (); - } - - [KeptMember (".ctor()")] - class B { - public int _unused; - - [Kept] - public void Method () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs deleted file mode 100644 index eaded4de58..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedMethodGetsRemoved.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedMethodGetsRemoved { - public static void Main () - { - new UnusedMethodGetsRemoved.B ().Method (); - } - - [KeptMember (".ctor()")] - class B { - public void Unused () - { - } - - [Kept] - public void Method () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs deleted file mode 100644 index 7ff2fc3a61..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedNestedClassGetsRemoved.cs +++ /dev/null @@ -1,11 +0,0 @@ - -namespace Mono.Linker.Tests.Cases.Basic { - public class UnusedNestedClassGetsRemoved { - public static void Main () - { - } - - class Unused { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs deleted file mode 100644 index 63d82842e4..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertyGetsRemoved.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedPropertyGetsRemoved { - public static void Main () - { - new UnusedPropertyGetsRemoved.B ().Method (); - } - - [KeptMember(".ctor()")] - class B { - public int Unused { get; set; } - - [Kept] - public void Method () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs deleted file mode 100644 index 9bf680e77d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UnusedPropertySetterRemoved.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class UnusedPropertySetterRemoved { - public static void Main () - { - var val = new UnusedPropertySetterRemoved.B ().PartiallyUsed; - } - - [KeptMember (".ctor()")] - class B { - [Kept] // FIXME: Should be removed - [KeptBackingField] - public int PartiallyUsed { [Kept] get; set; } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs deleted file mode 100644 index b19b8d89c5..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedInterfaceIsKept.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic -{ - class UsedInterfaceIsKept - { - public static void Main () - { - A a = new A (); - } - - [Kept] - [KeptInterface (typeof (I))] - [KeptMember (".ctor()")] - class A : I - { - } - - [Kept] - interface I - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs deleted file mode 100644 index 8adc71f272..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedPropertyIsKept.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic { - class UsedPropertyIsKept { - public static void Main () - { - var obj = new B (); - obj.Prop = 1; - var val = obj.Prop; - } - - [KeptMember (".ctor()")] - class B { - [Kept] - [KeptBackingField] - public int Prop { [Kept] get; [Kept] set; } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs deleted file mode 100644 index 4af518fed1..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Basic/UsedStructIsKept.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Basic -{ - class UsedStructIsKept { - public static void Main() - { - A a; - a.MethodVerifiedByKeptMember (); - } - - [Kept] - // This KeptMember is here to make sure the test framework's support of KeptMember on value types is working correctly - [KeptMember ("MethodVerifiedByKeptMember()")] - struct A { - public void MethodVerifiedByKeptMember () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs deleted file mode 100644 index a46a6deb58..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/CopyOfCoreLibrariesKeepsUnusedTypes.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.CoreLink -{ - [SetupLinkerCoreAction ("copy")] - - [KeptAssembly ("mscorlib.dll")] - // These types are normally removed when the core libraries are linked - [KeptTypeInAssembly ("mscorlib.dll", typeof (ConsoleKeyInfo))] - [KeptTypeInAssembly ("mscorlib.dll", typeof (System.Collections.ObjectModel.KeyedCollection<,>))] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - class CopyOfCoreLibrariesKeepsUnusedTypes - { - public static void Main() - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs deleted file mode 100644 index 5a39b04aa9..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedMethods.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections; -using System.IO; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.CoreLink -{ - [SetupLinkerCoreAction ("link")] - - [KeptAssembly ("mscorlib.dll")] - [KeptMemberInAssembly ("mscorlib.dll", typeof (Stack), ".ctor(System.Int32)", "Pop()", "Push(System.Object)")] - // We can't check everything that should be removed, but we should be able to check a few niche things that - // we known should be removed which will at least verify that the core library was processed - [RemovedMemberInAssembly ("mscorlib.dll", typeof (Stack), ".ctor(System.Collections.ICollection)")] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - class LinkingOfCoreLibrariesRemovesUnusedMethods { - public static void Main() - { - Stack stack = new Stack (2); - stack.Push (1); - var val = stack.Pop (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs deleted file mode 100644 index 9a0d90f531..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/CoreLink/LinkingOfCoreLibrariesRemovesUnusedTypes.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.CoreLink { - [SetupLinkerCoreAction ("link")] - [Reference("System.dll")] - - [KeptAssembly ("mscorlib.dll")] - [KeptAssembly("System.dll")] - // We can't check everything that should be removed, but we should be able to check a few niche things that - // we known should be removed which will at least verify that the core library was processed - [KeptTypeInAssembly ("mscorlib.dll", typeof (System.Collections.Generic.IEnumerable<>))] - [KeptTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedList<,>))] - - [RemovedTypeInAssembly ("mscorlib.dll", typeof (System.Resources.ResourceWriter))] - [RemovedTypeInAssembly ("System.dll", typeof (System.Collections.Generic.SortedDictionary<,>))] - - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify (SkipPeVerifyForToolchian.Pedump)] - - // All sorts of stuff is flagged as invalid even in the original System.dll and System.Configuration.dll for mono class libraries - [SkipPeVerify("System.dll")] - [SkipPeVerify("System.Configuration.dll")] - class LinkingOfCoreLibrariesRemovesUnusedTypes { - public static void Main () - { - // Use something from system that would normally be removed if we didn't use it - OtherMethods2 (new SortedList()); - } - - [Kept] - static void OtherMethods2 (SortedList list) - { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs deleted file mode 100644 index 362c3bb3d6..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/CorrectOverloadedMethodGetsStrippedInGenericClass.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - class CorrectOverloadedMethodGetsStrippedInGenericClass { - public static void Main () - { - // Call overloaded method through the abstract base class - GenericClassWithTwoOverloadedAbstractMethods item = new SpecializedClassWithTwoOverloadedVirtualMethods (); - item.OverloadedMethod (5); - } - - [KeptMember (".ctor()")] - public abstract class GenericClassWithTwoOverloadedAbstractMethods { - public abstract string OverloadedMethod (T thing); // Don't call this one, it should be stripped - - [Kept] - public abstract string OverloadedMethod (int thing); // Call to this should preserve the overriden one - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (GenericClassWithTwoOverloadedAbstractMethods))] - public class SpecializedClassWithTwoOverloadedVirtualMethods : GenericClassWithTwoOverloadedAbstractMethods { - // Don't call this one, it should be stripped - public override string OverloadedMethod (float thing) - { - return "first"; - } - - // Don't call this one, but it shouldn't be stripped because the method it overrides is invoked - [Kept] - public override string OverloadedMethod (int thing) - { - return "second"; - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs deleted file mode 100644 index 4a912d678d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - class GenericInstanceInterfaceMethodImplementedWithDifferentGenericArgumentNameDoesNotGetStripped { - public static void Main () - { - ISomething it = new Concrete (); - it.ShouldNotGetStripped (); - } - - [Kept] - public class GenericType { - } - - public interface ISomething { - [Kept] - GenericType ShouldNotGetStripped (); - } - - [KeptMember (".ctor()")] - [KeptInterface (typeof (ISomething))] - public class Concrete : ISomething { - [Kept] - public GenericType ShouldNotGetStripped () - { - throw new System.Exception (); - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs deleted file mode 100644 index 5f8a4389e2..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Collections.Generic; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - class MethodWithParameterWhichHasGenericParametersAndOverrideUsesADifferentNameForGenericParameter { - public static void Main (string [] args) - { - Derived tmp = new Derived (); - tmp.Method (null); - } - - [KeptMember (".ctor()")] - public abstract class Base { - [Kept] - public abstract TResult1 Method (IDictionary arg); - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (Base<>), "TResult1")] - public class Derived : Base { - [Kept] - public override TResult2 Method (IDictionary arg) - { - return default (TResult2); - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs deleted file mode 100644 index ba81282b81..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - class OverrideWithAnotherVirtualMethodOfSameNameWithDifferentParameterType { - public static void Main (string [] args) - { - new Derived ().Method (1.0); - } - - [KeptMember (".ctor()")] - public class Base { - [Kept] - public virtual S Method (S arg) - { - return arg; - } - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (Base<>), "K")] - public class Derived : Base { - [Kept] - public override K Method (K arg) - { - return arg; - } - - public virtual S Method (S arg) - { - return arg; - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs deleted file mode 100644 index 908e0d50d2..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInGenericClassIsNotStripped.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - public class UsedOverloadedGenericMethodInGenericClassIsNotStripped { - public static void Main () - { - B.Method (true); - } - - class B { - [Kept] - public static void Method (T value) - { - } - - public static void Method (TBase value) - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs deleted file mode 100644 index a565d4cf5d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - public class UsedOverloadedGenericMethodInstanceInGenericClassIsNotStripped { - public static void Main () - { - B.Method (1); - } - - class B { - public static void Method (T value) - { - } - - [Kept] - public static void Method (TBase value) - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs deleted file mode 100644 index 52e1ff7b22..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Generics/UsedOverloadedGenericMethodWithNoParametersIsNotStripped.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Generics { - public class UsedOverloadedGenericMethodWithNoParametersIsNotStripped { - public static void Main () - { - B.Call (); - } - - public class B { - public static void Method () - { - } - - [Kept] - public static void Method () - { - } - - [Kept] - public static void Call () - { - B.Method (); - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/FieldsOfTypeMarkedSequentialLayoutAreNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/FieldsOfTypeMarkedSequentialLayoutAreNotRemoved.cs deleted file mode 100644 index 852a066e1d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/FieldsOfTypeMarkedSequentialLayoutAreNotRemoved.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop { - class FieldsOfTypeMarkedSequentialLayoutAreNotRemoved { - public static void Main () - { - new A (); - } - - [StructLayout (LayoutKind.Sequential)] - [KeptMember (".ctor()")] - class A { - [Kept] int a; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs deleted file mode 100644 index 304a785532..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfParameterIsRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class DefaultConstructorOfParameterIsRemoved { - public static void Main () - { - SomeMethod (null); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (A val); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs deleted file mode 100644 index f9b3fc51d4..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/DefaultConstructorOfReturnTypeIsRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class DefaultConstructorOfReturnTypeIsRemoved { - public static void Main () - { - var a = SomeMethod (); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern A SomeMethod (); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs deleted file mode 100644 index 287b00c780..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfParameterAreRemoved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class FieldsOfParameterAreRemoved { - public static void Main () - { - SomeMethod (null); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - private int field; - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (A val); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs deleted file mode 100644 index d1c0a7ecf3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfReturnTypeAreRemoved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class FieldsOfReturnTypeAreRemoved { - public static void Main () - { - var a = SomeMethod (); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - private int field; - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern A SomeMethod (); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs deleted file mode 100644 index ad4918318c..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/Com/FieldsOfThisAreRemoved.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls.Com { - class FieldsOfThisAreRemoved { - public static void Main () - { - new A ().SomeMethod (); - } - - [Kept] - [KeptMember (".ctor()")] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - private int field; - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - public extern void SomeMethod (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs deleted file mode 100644 index ecfe751232..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/DefaultConstructorOfReturnTypeIsNotRemoved.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Runtime.CompilerServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class DefaultConstructorOfReturnTypeIsNotRemoved { - public static void Main () - { - var a = SomeMethod (); - } - - class A { - [Kept] - public A () - { - } - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern A SomeMethod (); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs deleted file mode 100644 index ab21994f0f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorIsRemoved.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Runtime.CompilerServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedDefaultConstructorIsRemoved { - public static void Main () - { - var a = new A (1); - SomeMethod (a); - } - - class A { - public A () - { - } - - [Kept] - public A (int other) - { - } - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs deleted file mode 100644 index d181ecd0a3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Runtime.CompilerServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved { - public static void Main () - { - var a = new A (1); - SomeMethod (ref a); - } - - class A { - [Kept] - public A () - { - } - - [Kept] - public A (int other) - { - } - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (ref A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs deleted file mode 100644 index 09809a60ee..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesAreNotRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.CompilerServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedFieldsOfTypesAreNotRemoved { - public static void Main () - { - var a = new A (); - SomeMethod (a); - } - - [KeptMember (".ctor()")] - class A { - [Kept] private int field1; - - [Kept] private int field2; - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs deleted file mode 100644 index d4f3c37790..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.CompilerServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedFieldsOfTypesPassedByRefAreNotRemoved { - public static void Main () - { - var a = new A (); - SomeMethod (ref a); - } - - [KeptMember (".ctor()")] - class A { - [Kept] private int field1; - - [Kept] private int field2; - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (ref A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs deleted file mode 100644 index df77357d65..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/InternalCalls/UnusedFieldsOfTypesWhenHasThisAreNotRemoved.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Runtime.CompilerServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.InternalCalls { - class UnusedFieldsOfTypesWhenHasThisAreNotRemoved { - public static void Main () - { - A a = new A (); - a.SomeMethod (); - } - - [KeptMember (".ctor()")] - class A { - [Kept] private int field1; - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - public extern void SomeMethod (); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs deleted file mode 100644 index df3d3b552f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfParameterIsRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class DefaultConstructorOfParameterIsRemoved { - public static void Main () - { - SomeMethod (null); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (A val); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs deleted file mode 100644 index 3cc7df5db5..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/DefaultConstructorOfReturnTypeIsRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class DefaultConstructorOfReturnTypeIsRemoved { - public static void Main () - { - var a = SomeMethod (); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern A SomeMethod (); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs deleted file mode 100644 index 73a66b5768..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfParameterAreRemoved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class FieldsOfParameterAreRemoved { - public static void Main () - { - SomeMethod (null); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - private int field; - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern void SomeMethod (A val); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs deleted file mode 100644 index 7551d86879..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfReturnTypeAreRemoved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class FieldsOfReturnTypeAreRemoved { - public static void Main () - { - var a = SomeMethod (); - } - - [Kept] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - private int field; - } - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - static extern A SomeMethod (); - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs deleted file mode 100644 index 4c74020631..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/Com/FieldsOfThisAreRemoved.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke.Com { - class FieldsOfThisAreRemoved { - public static void Main () - { - new A ().SomeMethod (); - } - - [Kept] - [KeptMember (".ctor()")] - [KeptAttributeAttribute (typeof (GuidAttribute))] - [ComImport] - [Guid ("D7BB1889-3AB7-4681-A115-60CA9158FECA")] - class A { - private int field; - - [Kept] - [MethodImpl (MethodImplOptions.InternalCall)] - public extern void SomeMethod (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs deleted file mode 100644 index d714d0d95b..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/DefaultConstructorOfReturnTypeIsNotRemoved.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class DefaultConstructorOfReturnTypeIsNotRemoved { - public static void Main () - { - var a = SomeMethod (); - } - - class A { - [Kept] - public A () - { - } - } - - [Kept] - [DllImport ("Unused")] - private static extern A SomeMethod (); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs deleted file mode 100644 index 041cc9c985..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorIsRemoved.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedDefaultConstructorIsRemoved { - public static void Main () - { - var a = new A (1); - SomeMethod (a); - } - - class A { - public A () - { - } - - [Kept] - public A (int other) - { - } - } - - [Kept] - [DllImport ("Unused")] - private static extern void SomeMethod (A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs deleted file mode 100644 index db2514a4ab..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedDefaultConstructorOfTypePassedByRefIsNotRemoved { - public static void Main () - { - var a = new A (1); - SomeMethod (ref a); - } - - class A { - [Kept] - public A () - { - } - - [Kept] - public A (int other) - { - } - } - - [Kept] - [DllImport ("Unused")] - private static extern void SomeMethod (ref A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs deleted file mode 100644 index a34c4d6bba..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesAreNotRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedFieldsOfTypesAreNotRemoved { - public static void Main () - { - var a = new A (); - SomeMethod (a); - } - - [KeptMember (".ctor()")] - class A { - [Kept] private int field1; - - [Kept] private int field2; - } - - [Kept] - [DllImport ("Unused")] - private static extern void SomeMethod (A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs deleted file mode 100644 index 50ae45fe31..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/PInvoke/UnusedFieldsOfTypesPassedByRefAreNotRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop.PInvoke { - class UnusedFieldsOfTypesPassedByRefAreNotRemoved { - public static void Main () - { - var a = new A (); - SomeMethod (ref a); - } - - [KeptMember (".ctor()")] - class A { - [Kept] private int field1; - - [Kept] private int field2; - } - - [Kept] - [DllImport ("Unused")] - private static extern void SomeMethod (ref A a); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/UnusedTypeWithSequentialLayoutIsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/UnusedTypeWithSequentialLayoutIsRemoved.cs deleted file mode 100644 index 00c47a3423..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Interop/UnusedTypeWithSequentialLayoutIsRemoved.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Runtime.InteropServices; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Interop { - class UnusedTypeWithSequentialLayoutIsRemoved { - static void Main () - { - } - - [StructLayout (LayoutKind.Sequential)] - class B { - int a; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs deleted file mode 100644 index bbf26c1d49..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Cases.LinkXml.Dependencies; - -namespace Mono.Linker.Tests.Cases.LinkXml -{ - [KeepTypeForwarderOnlyAssemblies ("false")] - [SetupCompileBefore ("Library.dll", new[] { "Dependencies/CanPreserveAnExportedType_Library.cs" })] - // Add another assembly in that uses the forwarder just to make things a little more complex - [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/CanPreserveAnExportedType_Forwarder.cs" }, references: new[] { "Library.dll" })] - - [RemovedAssembly ("Forwarder.dll")] - [KeptMemberInAssembly ("Library.dll", typeof (CanPreserveAnExportedType_Library), "Field1", "Method()", ".ctor()")] - class CanPreserveAnExportedType { - public static void Main () { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.xml deleted file mode 100644 index f469bb982b..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveAnExportedType.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs deleted file mode 100644 index d122d98f35..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Cases.LinkXml.Dependencies; - -namespace Mono.Linker.Tests.Cases.LinkXml -{ - [KeepTypeForwarderOnlyAssemblies ("false")] - [SetupCompileBefore ("Library.dll", new [] { "Dependencies/CanPreserveAnExportedType_Library.cs" })] - // Add another assembly in that uses the forwarder just to make things a little more complex - [SetupCompileBefore ("Forwarder.dll", new [] { "Dependencies/CanPreserveAnExportedType_Forwarder.cs" }, references: new [] { "Library.dll" })] - - [RemovedAssembly ("Forwarder.dll")] - [KeptMemberInAssembly ("Library.dll", typeof (CanPreserveAnExportedType_Library), "Field1", "Method()", ".ctor()")] - class CanPreserveExportedTypesUsingRegex { - public static void Main () { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.xml deleted file mode 100644 index b5827e2654..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveExportedTypesUsingRegex.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs deleted file mode 100644 index fb5d2a06aa..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml -{ - [KeptMember (".ctor()")] - class CanPreserveTypesUsingRegex { - public static void Main () { - } - - [Kept] - void UnusedHelper () { - } - - [Kept] - [KeptMember (".ctor()")] - class Bar { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.xml deleted file mode 100644 index a8eb9abe2d..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/CanPreserveTypesUsingRegex.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Forwarder.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Forwarder.cs deleted file mode 100644 index cb6f81e481..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Forwarder.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System; - -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (Mono.Linker.Tests.Cases.LinkXml.Dependencies.CanPreserveAnExportedType_Library))] diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs deleted file mode 100644 index 38814d9863..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/Dependencies/CanPreserveAnExportedType_Library.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.LinkXml.Dependencies -{ - public class CanPreserveAnExportedType_Library { - public int Field1; - - public void Method () { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs deleted file mode 100644 index c319c14423..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml -{ - abstract class PreserveBackingFieldWhenPropertyIsKept - { - public static void Main () - { - Prop = 1; - } - - public abstract int Base { set; } - - [Kept] - [KeptBackingField] - public static int Prop { get; [Kept] set; } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.xml deleted file mode 100644 index 256f50a845..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/PreserveBackingFieldWhenPropertyIsKept.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs deleted file mode 100644 index d657017721..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.cs +++ /dev/null @@ -1,72 +0,0 @@ - - -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml -{ - class TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved { - public static void Main () { - } - - [Kept] - [KeptInterface(typeof (IFoo))] - [KeptInterface(typeof (IFoo))] - [KeptInterface(typeof (IFoo))] - [KeptInterface(typeof (IFoo2))] - [KeptInterface(typeof (IFoo3))] - [KeptInterface(typeof (IDog))] - [KeptInterface(typeof (IFoo>))] - class Unused : IFoo, IFoo, IFoo, IFoo2, IFoo3, IDog, IFoo> { - [Kept] - public int Field1; - - [Kept] - public IFoo Field2; - - public IFoo Property1 { get; set; } - - string IDog.Name { get; set; } - - int IFoo.Bar { get; set; } - - int IFoo.Bar { get; set; } - - int IFoo.Bar { get; set; } - - int Bar2 { get; set; } - - int IFoo2.Bar2 { get; set; } - - int Bar3 { get; set; } - - int IFoo3.Bar3 { get; set; } - - int IFoo>.Bar { get; set; } - } - - [Kept] - interface IDog { - string Name { get; set; } - } - - [Kept] - interface IFoo { - - int Bar { get; set; } - } - - [Kept] - interface IFoo2 { - int Bar2 { get; set; } - } - - [Kept] - interface IFoo3 { - int Bar3 { get; set; } - } - - [Kept] - class Cat { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml deleted file mode 100644 index 338ee7f760..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/TypeWithPreserveFieldsHasBackingFieldsOfPropertiesRemoved.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs deleted file mode 100644 index fb8536a2f0..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - [KeptMember (".ctor()")] - public class UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - class Unused { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.xml deleted file mode 100644 index ca7da2c44f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedAssemblyWithNoDefinedPreserveHasAllTypesPreserved.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs deleted file mode 100644 index c17eedfb61..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedEventPreservedByLinkXmlIsKept { - public static void Main () - { - } - - [Kept] - class Unused { - [Kept] - [KeptBackingField] - public event EventHandler Preserved; - - [Kept] - public event EventHandler Preserved1 { [Kept] add { } [Kept] remove { } } - - public event EventHandler NotPreserved; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.xml deleted file mode 100644 index 6674d97849..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedEventPreservedByLinkXmlIsKept.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs deleted file mode 100644 index bc1b0f3374..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedFieldPreservedByLinkXmlIsKept { - public static void Main () - { - } - - [Kept] - class Unused { - [Kept] - private int _preserved; - - private int _notPreserved; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.xml deleted file mode 100644 index 46db550dcf..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedFieldPreservedByLinkXmlIsKept.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs deleted file mode 100644 index 99584fd9f3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedMethodPreservedByLinkXmlIsKept { - public static void Main () - { - } - - [Kept] - class Unused { - [Kept] - private void PreservedMethod () - { - } - - private void NotPreservedMethod () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.xml deleted file mode 100644 index 231a0d2037..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedMethodPreservedByLinkXmlIsKept.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs deleted file mode 100644 index 5e319acfd9..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedNestedTypePreservedByLinkXmlIsKept { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - class Unused { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.xml deleted file mode 100644 index 7990e8fec1..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedNestedTypePreservedByLinkXmlIsKept.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs deleted file mode 100644 index 1dbd59a8a3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedPropertyPreservedByLinkXmlIsKept { - public static void Main () - { - } - - [Kept] - class Unused { - [Kept] - [KeptBackingField] - public int PreservedProperty1 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - public int PreservedProperty2 { [Kept] get; set; } - - [Kept] - [KeptBackingField] - public int PreservedProperty3 { get; [Kept] set; } - - [Kept] - [KeptBackingField] - public int PreservedProperty4 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - public int PreservedProperty5 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - public int PreservedProperty6 { [Kept] get; set; } - - [Kept] - [KeptBackingField] - public int PreservedProperty7 { get; [Kept] set; } - - public int NotPreservedProperty { get; set; } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.xml deleted file mode 100644 index de3fe0c7e1..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedPropertyPreservedByLinkXmlIsKept.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs deleted file mode 100644 index 246c80af64..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - - [KeptMember(".ctor()")] - class UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - class Unused { - [Kept] - void Foo () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.xml deleted file mode 100644 index 7ecdb6c223..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeIsPresservedWhenEntireAssemblyIsPreserved.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs deleted file mode 100644 index edaff63ebc..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypePreservedByLinkXmlIsKept { - public static void Main () - { - } - } - - [Kept] - [KeptMember (".ctor()")] - class UnusedTypePreservedByLinkXmlIsKeptUnusedType { - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.xml deleted file mode 100644 index ffb652e1e9..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlIsKept.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs deleted file mode 100644 index fe077d530f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypePreservedByLinkXmlWithCommentIsKept { - public static void Main () - { - } - } - - [Kept] - [KeptMember (".ctor()")] - class UnusedTypePreservedByLinkXmlWithCommentIsKeptUnusedType - { - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.xml deleted file mode 100644 index a6e5643a21..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypePreservedByLinkXmlWithCommentIsKept.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs deleted file mode 100644 index 840d7f4746..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.cs +++ /dev/null @@ -1,86 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved - { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - class Unused { - [Kept] - public int Field1; - - [Kept] - private int Field2; - - [Kept] - internal int Field3; - - [Kept] - public static int Field4; - - [Kept] - private static int Field5; - - [Kept] - internal static int Field6; - - [Kept] - [KeptBackingField] - public string Property1 { [Kept] get; [Kept] set;} - - [Kept] - [KeptBackingField] - private string Property2 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - internal string Property3 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - public static string Property4 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - private static string Property5 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - internal static string Property6 { [Kept] get; [Kept] set; } - - [Kept] - public void Method1 () - { - } - - [Kept] - private void Method2 () - { - } - - [Kept] - internal void Method3 () - { - } - - [Kept] - public static void Method4 () - { - } - - [Kept] - private static void Method5 () - { - } - - [Kept] - internal static void Method6 () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.xml deleted file mode 100644 index d84df95e0f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithNoDefinedPreserveHasAllMembersPreserved.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs deleted file mode 100644 index 02fb956f23..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveAllHasAllMembersPreserved { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - class Unused { - [Kept] - public int Field1; - - [Kept] - private int Field2; - - [Kept] - internal int Field3; - - [Kept] - public static int Field4; - - [Kept] - private static int Field5; - - [Kept] - internal static int Field6; - - [Kept] - [KeptBackingField] - public string Property1 { [Kept] get; [Kept] set;} - - [Kept] - [KeptBackingField] - private string Property2 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - internal string Property3 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - public static string Property4 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - private static string Property5 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - internal static string Property6 { [Kept] get; [Kept] set; } - - [Kept] - public void Method1 () - { - } - - [Kept] - private void Method2 () - { - } - - [Kept] - internal void Method3 () - { - } - - [Kept] - public static void Method4 () - { - } - - [Kept] - private static void Method5 () - { - } - - [Kept] - internal static void Method6 () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.xml deleted file mode 100644 index 7987a7765a..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveAllHasAllMembersPreserved.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs deleted file mode 100644 index 1af6f45300..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveFieldsHasMethodsRemoved { - public static void Main () - { - } - - [Kept] - class Unused { - [Kept] - public int Field1; - - [Kept] - private int Field2; - - [Kept] - internal int Field3; - - [Kept] - public static int Field4; - - [Kept] - private static int Field5; - - [Kept] - internal static int Field6; - - public string Property1 { get; set; } - private string Property2 { get; set; } - internal string Property3 { get; set; } - public static string Property4 { get; set; } - private static string Property5 { get; set; } - internal static string Property6 { get; set; } - - [Kept] - public void PreservedMethod () - { - } - - public void Method1 () - { - } - - private void Method2 () - { - } - - internal void Method3 () - { - } - - public static void Method4 () - { - } - - private static void Method5 () - { - } - - internal static void Method6 () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.xml deleted file mode 100644 index 619a8db26f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveFieldsHasMethodsRemoved.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs deleted file mode 100644 index 8a79d2d2bc..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveMethodsHasFieldsRemoved { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - class Unused { - public int Field1; - private int Field2; - internal int Field3; - public static int Field4; - private static int Field5; - internal static int Field6; - - [Kept] - [KeptBackingField] - public string Property1 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - private string Property2 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - internal string Property3 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - public static string Property4 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - private static string Property5 { [Kept] get; [Kept] set; } - - [Kept] - [KeptBackingField] - internal static string Property6 { [Kept] get; [Kept] set; } - - [Kept] - public void Method1 () - { - } - - [Kept] - private void Method2 () - { - } - - [Kept] - internal void Method3 () - { - } - - [Kept] - public static void Method4 () - { - } - - [Kept] - private static void Method5 () - { - } - - [Kept] - internal static void Method6 () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.xml deleted file mode 100644 index 20723f8ed6..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveMethodsHasFieldsRemoved.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs deleted file mode 100644 index b9d404f22c..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveNothingAndPreserveMembers { - public static void Main () - { - } - - [Kept] - class Unused { - [Kept] - public int Field1; - - private int Field2; - - [Kept] - public void Method1 () - { - } - - private void Method2 () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.xml deleted file mode 100644 index d672e9e094..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingAndPreserveMembers.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs deleted file mode 100644 index d6ea29b89b..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.LinkXml { - class UnusedTypeWithPreserveNothingHasMembersRemoved { - public static void Main () - { - } - - [Kept] - class Unused { - public int Field1; - private int Field2; - internal int Field3; - public static int Field4; - private static int Field5; - internal static int Field6; - - public string Property1 { get; set; } - private string Property2 { get; set; } - internal string Property3 { get; set; } - public static string Property4 { get; set; } - private static string Property5 { get; set; } - internal static string Property6 { get; set; } - - public void Method1 () - { - } - - private void Method2 () - { - } - - internal void Method3 () - { - } - - public static void Method4 () - { - } - - private static void Method5 () - { - } - - internal static void Method6 () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.xml deleted file mode 100644 index f76df307a8..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/LinkXml/UnusedTypeWithPreserveNothingHasMembersRemoved.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj deleted file mode 100644 index 4652454ff2..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Mono.Linker.Tests.Cases.csproj +++ /dev/null @@ -1,219 +0,0 @@ - - - - - Debug - AnyCPU - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5} - Library - Properties - Mono.Linker.Tests.Cases - Mono.Linker.Tests.Cases - v4.0 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE;INCLUDE_EXPECTATIONS - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;INCLUDE_EXPECTATIONS - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {2C26601F-3E2F-45B9-A02F-58EE9296E19E} - Mono.Linker.Tests.Cases.Expectations - - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs deleted file mode 100644 index d8a45ab931..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.References.Dependencies { - public class UserAssembliesAreLinkedByDefault_Library1 { - public void UsedMethod () - { - Console.WriteLine ("Used"); - } - - public void UnusedMethod () - { - Console.WriteLine ("NotUsed"); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs deleted file mode 100644 index ec502e894a..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/CanSkipUnresolved.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Cases.References.Individual.Dependencies; - -namespace Mono.Linker.Tests.Cases.References.Individual { - [SetupCompileBefore ("library1.dll", new [] { "Dependencies/CanSkipUnresolved_Library.cs" })] - [SetupCompileAfter ("library1.dll", new [] { "Dependencies/CanSkipUnresolved_Library.cs" }, defines: new [] { "EXCLUDE_STUFF" })] - [SetupLinkerArgument ("--skip-unresolved", "true")] - public class CanSkipUnresolved { - static void Main () - { - var t1 = new CanSkipUnresolved_Library.TypeWithMissingMethod (); - t1.GoingToBeMissing (); - - var t2 = new CanSkipUnresolved_Library.TypeThatWillBeMissing (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs deleted file mode 100644 index 59e5cff444..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/Individual/Dependencies/CanSkipUnresolved_Library.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; - -namespace Mono.Linker.Tests.Cases.References.Individual.Dependencies { - public class CanSkipUnresolved_Library { - public class TypeWithMissingMethod { -#if !EXCLUDE_STUFF - public void GoingToBeMissing () - { - - } -#endif - } - -#if !EXCLUDE_STUFF - public class TypeThatWillBeMissing { - } -#endif - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs deleted file mode 100644 index f0a7a3f033..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/ReferencesAreRemovedWhenAllUsagesAreRemoved.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.References { - [SetupLinkerCoreAction ("link")] - // Il8n & the blacklist step pollute the results with extra stuff that didn't need to be - // preserved for this test case so we need to disable them - [Il8n ("none")] - [Reference ("System.dll")] - [RemovedAssembly ("System.dll")] - // Can be removed once this bug is fixed https://bugzilla.xamarin.com/show_bug.cgi?id=58168 - [SkipPeVerify(SkipPeVerifyForToolchian.Pedump)] - class ReferencesAreRemovedWhenAllUsagesAreRemoved { - public static void Main () - { - } - - private static void Unused () - { - // Use something from System.dll so that we know the input assembly was compiled with the reference - var uri = new Uri ("w/e"); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs deleted file mode 100644 index 0c68e127c6..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/References/UserAssembliesAreLinkedByDefault.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Cases.References.Dependencies; - -namespace Mono.Linker.Tests.Cases.References { - [SetupCompileBefore ("library1.dll", new [] { "Dependencies/UserAssembliesAreLinkedByDefault_Library1.cs" })] - - [KeptAssembly ("library1.dll")] - [KeptMemberInAssembly ("library1.dll", typeof (UserAssembliesAreLinkedByDefault_Library1), "UsedMethod()")] - [RemovedMemberInAssembly ("library1.dll", typeof (UserAssembliesAreLinkedByDefault_Library1), "UnusedMethod()")] - class UserAssembliesAreLinkedByDefault { - public static void Main () - { - new UserAssembliesAreLinkedByDefault_Library1 ().UsedMethod (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml deleted file mode 100644 index 8494ad0139..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml deleted file mode 100644 index 11c0c1f42a..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.xml deleted file mode 100644 index ea60ba315b..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsProcessed.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsProcessed.xml deleted file mode 100644 index 518addf3df..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/EmbeddedLinkXmlFileIsProcessed.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml deleted file mode 100644 index 1fb65aa9fa..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs deleted file mode 100644 index 69d1d1dc42..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Resources { - [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] - [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly.xml", "NotMatchingAnAssemblyName.xml")] - [SkipPeVerify] - [KeptResource ("NotMatchingAnAssemblyName.xml")] - public class EmbeddedLinkXmlFileIsNotProcessedIfNameDoesNotMatchAnAssembly { - public static void Main () - { - } - - public class Unused { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs deleted file mode 100644 index 604520899a..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Resources { - [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (false)] - - // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step - [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled.xml", "test.xml")] - [SkipPeVerify] - [KeptResource ("test.xml")] - public class EmbeddedLinkXmlFileIsNotProcessedWhenBlacklistStepIsDisabled { - public static void Main () - { - } - - public class Unused { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.cs deleted file mode 100644 index 469ccf59fb..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Resources { - // I'm not sure why it was decided all link xml resources should be skipped when core link is set to skip, but that's the behavior - // that exists today and I don't have a reason to change it right now - [SetupLinkerCoreAction ("skip")] - [IncludeBlacklistStep (true)] - - // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step - [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip.xml", "test.xml")] - [SkipPeVerify] - [KeptResource ("test.xml")] - public class EmbeddedLinkXmlFileIsNotProcessedWhenCoreLinkActionIsSkip { - public static void Main () - { - } - - public class Unused { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs deleted file mode 100644 index c7a043aaf8..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/EmbeddedLinkXmlFileIsProcessed.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Resources { - [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] - - // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step - [SetupCompileResource ("Dependencies/EmbeddedLinkXmlFileIsProcessed.xml", "test.xml")] - [SkipPeVerify] - public class EmbeddedLinkXmlFileIsProcessed { - public static void Main () - { - } - - [Kept] - [KeptMember (".ctor()")] - public class Unused { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs deleted file mode 100644 index b2112b92f5..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Resources/NonLinkerEmbeddedResourceHasNoImpact.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Resources { - [SetupLinkerCoreAction ("link")] - [IncludeBlacklistStep (true)] - - // We need to rename the resource so that it matches the name of an assembly being processed. This is a requriement of the black list step - [SetupCompileResource ("Dependencies/NonLinkerEmbeddedResourceHasNoImpact.xml", "test.xml")] - [SkipPeVerify] - [KeptResource ("test.xml")] - public class NonLinkerEmbeddedResourceHasNoImpact { - public static void Main () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs deleted file mode 100644 index 83c1d1ea80..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticConstructorGetsRemoved.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Statics { - class UnusedStaticConstructorGetsRemoved { - public static void Main () - { - } - - static void Dead () - { - new B (); - } - - class B { - static B () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs deleted file mode 100644 index 31c7c6ef08..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Statics/UnusedStaticMethodGetsRemoved.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.Statics { - public class UnusedStaticMethodGetsRemoved { - public static void Main () - { - A.UsedMethod (); - } - } - - [Kept] - class A { - [Kept] - public static void UsedMethod () - { - } - - static void UnusedMethod () - { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs deleted file mode 100644 index 2662e8f7dc..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileILAssembly.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.TestFramework -{ - [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("ILAssembly.dll", new [] { "Dependencies/ILAssemblySample.il" })] - [KeptMemberInAssembly ("ILAssembly.dll", "Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample", "GiveMeAValue()")] - public class CanCompileILAssembly - { - static void Main () - { -#if IL_ASSEMBLY_AVAILABLE - Console.WriteLine (new Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample ().GiveMeAValue ()); -#endif - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs deleted file mode 100644 index 22e6525c14..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/CanCompileTestCaseWithDebugPdbs.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -// Because we compiled with debug information, this attribute should exist -[assembly: KeptAttributeAttribute (typeof (System.Diagnostics.DebuggableAttribute))] - -namespace Mono.Linker.Tests.Cases.TestFramework { - [SetupCompileArgument ("/debug:pdbonly")] - class CanCompileTestCaseWithDebugPdbs { - static void Main () - { - new Foo ().Method (); - } - - [Kept] - [KeptMember (".ctor()")] - class Foo { - [Kept] - public void Method () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/ILAssemblySample.il b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/ILAssemblySample.il deleted file mode 100644 index 0060542bd0..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/ILAssemblySample.il +++ /dev/null @@ -1,42 +0,0 @@ -.assembly extern mscorlib -{ -} - -.assembly ILAssembly -{ - - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} - -.module ILAssembly.dll - -// =============== CLASS MEMBERS DECLARATION =================== - -.class public auto ansi beforefieldinit Mono.Linker.Tests.Cases.TestFramework.Dependencies.ILAssemblySample - extends [mscorlib]System.Object -{ - .method public hidebysig specialname rtspecialname - instance void .ctor() cil managed - { - .maxstack 8 - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ret - } // end of method ILAssemblySample::.ctor - - .method public hidebysig instance string - GiveMeAValue() cil managed - { - .maxstack 1 - .locals init (string V_0) - IL_0000: nop - IL_0001: ldstr "Bar" - IL_0006: stloc.0 - IL_0007: br IL_000c - - IL_000c: ldloc.0 - IL_000d: ret - } // end of method ILAssemblySample::GiveMeAValue - -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyResourceInAssemblyAttributesBehavior.txt b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyResourceInAssemblyAttributesBehavior.txt deleted file mode 100644 index 540b7baa7f..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/Dependencies/VerifyResourceInAssemblyAttributesBehavior.txt +++ /dev/null @@ -1 +0,0 @@ -Resource that is kept \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs deleted file mode 100644 index abe1430420..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyDefineAttributeBehavior.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.TestFramework { - - /// - /// The purpose of this test is to verify that the testing framework's define attribute is working correctly - /// - [Define("SOME_DEFINE")] - public class VerifyDefineAttributeBehavior { - static void Main () - { -#if SOME_DEFINE - MethodThatIsUsedIfDefineIsWorkingProperly (); -#endif - } - - - [Kept] - static void MethodThatIsUsedIfDefineIsWorkingProperly () - { - Console.WriteLine ("Foo"); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs deleted file mode 100644 index c54be7565a..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TestFramework/VerifyResourceInAssemblyAttributesBehavior.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.TestFramework { - [SetupCompileResource ("Dependencies/VerifyResourceInAssemblyAttributesBehavior.txt")] - [KeptResource ("VerifyResourceInAssemblyAttributesBehavior.txt")] - // These are technically redundant, but the goal of this test is to verify the attributes are working which we can do - // by using them on the test case assembly even though you would normally use these attributes for other checking other - // supporting assemblies - [KeptResourceInAssembly ("test.exe", "VerifyResourceInAssemblyAttributesBehavior.txt")] - [RemovedResourceInAssembly ("test.exe", "NeverExistedResource.txt")] - public class VerifyResourceInAssemblyAttributesBehavior { - public static void Main () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs deleted file mode 100644 index 5e4d82e8e9..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanDumpDependenciesToUncompressedXml.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Tracing.Individual { - - [SetupLinkerArgument ("--dump-dependencies")] - [SetupLinkerArgument ("--dependencies-file", "linker-dependencies.xml")] - public class CanDumpDependenciesToUncompressedXml { - public static void Main () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs deleted file mode 100644 index 8100238606..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableDependenciesDump.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Tracing.Individual { - - [SetupLinkerArgument ("--dump-dependencies")] - public class CanEnableDependenciesDump { - public static void Main () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs deleted file mode 100644 index cc91dc1dca..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/Tracing/Individual/CanEnableReducedTracing.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.Tracing.Individual { - - [SetupLinkerArgument ("--dump-dependencies")] - [SetupLinkerArgument ("--reduced-tracing", "true")] - - // Need to define a custom name so that the linker outputs in uncompressed format, which is more useful for making assertions - [SetupLinkerArgument ("--dependencies-file", "linker-dependencies.xml")] - public class CanEnableReducedTracing { - public static void Main () - { - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs deleted file mode 100644 index bb1521525c..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ForwarderLibrary.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System; - -[assembly: System.Runtime.CompilerServices.TypeForwardedTo (typeof (Mono.Linker.Tests.Cases.TypeForwarding.Dependencies.ImplementationLibrary))] diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs deleted file mode 100644 index 35c2252f42..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ImplementationLibrary.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Reflection; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -[assembly: AssemblyVersion ("2.0")] - -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { - public class ImplementationLibrary { - public string GetSomeValue () - { - return "Hello"; - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs deleted file mode 100644 index 97c728e7d3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/LibraryUsingForwarder.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { - [NotATestCase] - public class LibraryUsingForwarder { - public string GetValueFromOtherAssembly () - { - return new ImplementationLibrary ().GetSomeValue (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs deleted file mode 100644 index 00bb1e30ce..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/ReferenceImplementationLibrary.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.TypeForwarding.Dependencies { - [NotATestCase] - public class ReferenceImplementationLibrary { - } - -#if INCLUDE_REFERENCE_IMPL - public class ImplementationLibrary { - public string GetSomeValue () - { - return null; - } - } -#endif -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il deleted file mode 100644 index 0f8a1e93d2..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/Dependencies/TypeForwarderMissingReference.il +++ /dev/null @@ -1,37 +0,0 @@ -.assembly extern mscorlib -{ -} -.assembly extern 'missing-reference' -{ - .ver 0:0:0:0 -} - -.assembly 'TypeForwarderMissingReference' -{ - .hash algorithm 0x00008004 - .ver 0:0:0:0 -} - -.class extern forwarder C -{ - .assembly extern 'missing-reference' -} -.class extern forwarder G`1 -{ - .assembly extern 'missing-reference' -} - -.module 'TypeForwarderMissingReference.dll' - - -.class public auto ansi beforefieldinit DummyClass - extends [mscorlib]System.Object -{ - .method public hidebysig specialname rtspecialname - instance void .ctor() cil managed - { - IL_0000: ldarg.0 - IL_0001: call instance void [mscorlib]System.Object::.ctor() - IL_0006: ret - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs deleted file mode 100644 index 07f43ef321..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/MissingTargetReference.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.Cases.TypeForwarding -{ - [Define ("IL_ASSEMBLY_AVAILABLE")] - [SetupCompileBefore ("TypeForwarderMissingReference.dll", new [] { "Dependencies/TypeForwarderMissingReference.il" })] - [SetupLinkerAction ("link", "TypeForwarderMissingReference.dll")] - - [KeptMemberInAssembly ("TypeForwarderMissingReference.dll", "DummyClass", ".ctor()")] - [RemovedForwarder ("TypeForwarderMissingReference.dll", "C")] - [RemovedForwarder ("TypeForwarderMissingReference.dll", "G<>")] - public class MissingTargetReference - { - public static void Main () - { -#if IL_ASSEMBLY_AVAILABLE - Console.WriteLine (new DummyClass ()); -#endif - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs deleted file mode 100644 index e8a41a2596..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesKept.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; - -namespace Mono.Linker.Tests.Cases.TypeForwarding { - [KeepTypeForwarderOnlyAssemblies ("true")] - [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] - // Add another assembly in that uses the forwarder just to make things a little more complex - [SetupCompileBefore ("Library.dll", new[] { "Dependencies/LibraryUsingForwarder.cs" }, references: new[] { "Forwarder.dll" })] - - // After compiling the test case we then replace the reference impl with implementation + type forwarder - [SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] - [SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] - - [KeptAssembly ("Forwarder.dll")] - [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] - [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] - public class TypeForwarderOnlyAssembliesKept { - public static void Main () - { - Console.WriteLine (new ImplementationLibrary ().GetSomeValue ()); - Console.WriteLine (new LibraryUsingForwarder ().GetValueFromOtherAssembly ()); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs deleted file mode 100644 index 91ddd58ee3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/TypeForwarding/TypeForwarderOnlyAssembliesRemoved.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; - -namespace Mono.Linker.Tests.Cases.TypeForwarding -{ - [KeepTypeForwarderOnlyAssemblies ("false")] - [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] - // Add another assembly in that uses the forwarder just to make things a little more complex - [SetupCompileBefore ("Library.dll", new[] { "Dependencies/LibraryUsingForwarder.cs" }, references: new[] { "Forwarder.dll" })] - - // After compiling the test case we then replace the reference impl with implementation + type forwarder - [SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] - [SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] - - [RemovedAssembly ("Forwarder.dll")] - [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] - [KeptMemberInAssembly ("Library.dll", typeof (LibraryUsingForwarder), "GetValueFromOtherAssembly()")] - class TypeForwarderOnlyAssembliesRemoved { - static void Main() - { - Console.WriteLine (new ImplementationLibrary ().GetSomeValue ()); - Console.WriteLine (new LibraryUsingForwarder ().GetValueFromOtherAssembly ()); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs deleted file mode 100644 index f370e9e5d7..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass2.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class ClassImplemtingInterfaceMethodsThroughBaseClass2 { - public static void Main () - { - new B (); - IFoo i = null; - i.Foo (); - } - - interface IFoo { - [Kept] - void Foo (); - } - - [KeptMember (".ctor()")] - class B { - [Kept] // FIXME: Should be removed - public void Foo () - { - } - } - - class A : B, IFoo { - //my IFoo.Foo() is actually implemented by B which doesn't know about it. - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs deleted file mode 100644 index 362407bd1c..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass3.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class ClassImplemtingInterfaceMethodsThroughBaseClass3 { - public static void Main () - { - new B ().Foo (); - } - - interface IFoo { - void Foo (); - } - - [KeptMember (".ctor()")] - class B { - [Kept] - public void Foo () - { - } - } - - class A : B, IFoo { - //my IFoo.Foo() is actually implemented by B which doesn't know about it. - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs deleted file mode 100644 index 829ab01c70..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass4.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class ClassImplemtingInterfaceMethodsThroughBaseClass4 { - public static void Main () - { - new A ().Foo (); - } - - [Kept] - interface IFoo { - void Foo (); - } - - [KeptMember (".ctor()")] - class B { - [Kept] - public void Foo () - { - } - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (B))] - [KeptInterface (typeof (IFoo))] // FIXME: Why is it not removed - class A : B, IFoo { - //my IFoo.Foo() is actually implemented by B which doesn't know about it. - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs deleted file mode 100644 index 10868a8a2e..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass5.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class ClassImplemtingInterfaceMethodsThroughBaseClass5 { - public static void Main () - { - new A (); - } - - [Kept] - interface IFoo { - void Foo (); - } - - [KeptMember (".ctor()")] - class B { - public void Foo () - { - } - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (B))] - [KeptInterface (typeof (IFoo))] - class A : B, IFoo { - //my IFoo.Foo() is actually implemented by B which doesn't know about it. - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs deleted file mode 100644 index bb295c9c25..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassImplemtingInterfaceMethodsThroughBaseClass6.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class ClassImplemtingInterfaceMethodsThroughBaseClass6 { - public static void Main () - { - B tmp = new B (); - IFoo i = new C (); - i.Foo (); - } - - interface IFoo { - [Kept] - void Foo (); - } - - [KeptMember (".ctor()")] - class B { - [Kept] // FIXME: Needs to be removed - public void Foo () - { - } - } - - class A : B, IFoo { - //my IFoo.Foo() is actually implemented by B which doesn't know about it. - } - - [KeptMember (".ctor()")] - [KeptInterface (typeof (IFoo))] - class C : IFoo { - [Kept] - public void Foo () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs deleted file mode 100644 index 51ea017d72..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromConcreteTypeHasInterfaceMethodRemoved.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods -{ - class ClassUsedFromConcreteTypeHasInterfaceMethodRemoved { - public static void Main () - { - A a = new A (); - a.Foo (); - } - - [Kept] - [KeptInterface (typeof (IFoo))] - struct A : IFoo { - [Kept] - public void Foo () - { - } - } - - [Kept] - public interface IFoo { - void Foo (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs deleted file mode 100644 index 0f32024a36..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/ClassUsedFromInterfaceHasInterfaceMethodKept.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods -{ - class ClassUsedFromInterfaceHasInterfaceMethodKept { - public static void Main () - { - IFoo a = new A (); - a.Foo (); - } - - [Kept] - [KeptInterface (typeof (IFoo))] - struct A : IFoo { - [Kept] - public void Foo () - { - } - } - - [Kept] - public interface IFoo { - [Kept] - void Foo (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs deleted file mode 100644 index c08e69afd4..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/HarderToDetectUnusedVirtualMethodGetsRemoved.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class HarderToDetectUnusedVirtualMethodGetsRemoved { - public static void Main () - { - new Base ().Call (); - } - - static void DeadCode () - { - new B (); - } - - [Kept] - [KeptMember (".ctor()")] - class Base { - [Kept] - public virtual void Call () - { - } - } - - class B : Base { - public override void Call () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs deleted file mode 100644 index bb795599d0..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromConcreteTypeHasInterfaceMethodRemoved.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods -{ - class StructUsedFromConcreteTypeHasInterfaceMethodRemoved { - public static void Main () - { - A a = new A (); - a.Foo (); - } - - [Kept] - [KeptInterface (typeof (IFoo))] - struct A : IFoo { - [Kept] - public void Foo () - { - } - } - - [Kept] - public interface IFoo { - void Foo (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromInterfaceHasInterfaceMethodKept.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromInterfaceHasInterfaceMethodKept.cs deleted file mode 100644 index bfd632bf56..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/StructUsedFromInterfaceHasInterfaceMethodKept.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods -{ - class StructUsedFromInterfaceHasInterfaceMethodKept { - public static void Main () - { - IFoo a = new A (); - a.Foo (); - } - - [Kept] - [KeptInterface (typeof (IFoo))] - struct A : IFoo { - [Kept] - public void Foo () - { - } - } - - [Kept] - public interface IFoo { - [Kept] - void Foo (); - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs deleted file mode 100644 index 880ac679eb..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod.cs +++ /dev/null @@ -1,35 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class TypeGetsMarkedThatImplementsAlreadyMarkedInterfaceMethod { - public static void Main () - { - IFoo i = new A (); - i.Foo (); - } - - interface IFoo { - [Kept] - void Foo (); - } - - [KeptMember (".ctor()")] - [KeptInterface (typeof (IFoo))] - class B : IFoo { - [Kept] - public void Foo () - { - } - } - - [KeptMember (".ctor()")] - [KeptInterface (typeof (IFoo))] - class A : IFoo { - [Kept] - public void Foo () - { - new B (); /*this will cause us to mark B, but will we be smart enough to realize B.Foo implements the already marked IFoo.Foo?*/ - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UnusedVirtualMethodRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UnusedVirtualMethodRemoved.cs deleted file mode 100644 index 115ca86481..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UnusedVirtualMethodRemoved.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class UnusedVirtualMethodRemoved { - public static void Main () - { - new Base ().Call (); - } - - [KeptMember (".ctor()")] - class Base { - [Kept] - public virtual void Call () - { - } - } - - class B : Base { - public override void Call () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UsedVirtualMethodNotRemoved.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UsedVirtualMethodNotRemoved.cs deleted file mode 100644 index e695cca7e3..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/UsedVirtualMethodNotRemoved.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - public class UsedVirtualMethodNotRemoved { - public static void Main () - { - new B (); - new Base ().Call (); - } - - [KeptMember (".ctor()")] - class Base { - [Kept] - public virtual void Call () - { - } - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (Base))] - class B : Base { - [Kept] - public override void Call () - { - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs deleted file mode 100644 index 372105cd3b..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsPerservedIfBaseMethodGetsInvoked.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class VirtualMethodGetsPerservedIfBaseMethodGetsInvoked { - public static void Main () - { - new A (); - new B ().Foo (); - } - - [KeptMember (".ctor()")] - class B { - [Kept] - public virtual void Foo () - { - } - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (B))] - class A : B { - [Kept] - public override void Foo () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs b/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs deleted file mode 100644 index f1baa44eb8..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.Cases/VirtualMethods/VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.Cases.VirtualMethods { - class VirtualMethodGetsStrippedIfImplementingMethodGetsInvokedDirectly { - public static void Main () - { - new A ().Foo (); - } - - [KeptMember (".ctor()")] - class B { - [Kept] // TODO: Would be nice to be removed - public virtual void Foo () - { - } - } - - [KeptMember (".ctor()")] - [KeptBaseType (typeof (B))] - class A : B { - [Kept] - public override void Foo () - { - } - } - } -} diff --git a/external/linker/linker/Tests/Mono.Linker.Tests.csproj b/external/linker/linker/Tests/Mono.Linker.Tests.csproj deleted file mode 100644 index bffa135240..0000000000 --- a/external/linker/linker/Tests/Mono.Linker.Tests.csproj +++ /dev/null @@ -1,103 +0,0 @@ - - - Debug - AnyCPU - 8.0.50727 - {400A1561-B6B6-482D-9E4C-3DDAEDE5BD07} - Library - Properties - Mono.Linker.Tests - - - v4.6.2 - Mono.Linker.Tests - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll - - - - - - - - - - {D68133BD-1E63-496E-9EDE-4FBDBF77B486} - Mono.Cecil - - - {DD28E2B1-057B-4B4D-A04D-B2EBD9E76E46} - Mono.Linker - - - {B6BEE6AA-ADA0-4E1D-9A17-FBF2936F82B5} - Mono.Linker.Tests.Cases - - - {2C26601F-3E2F-45B9-A02F-58EE9296E19E} - Mono.Linker.Tests.Cases.Expectations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCases/IndividualTests.cs b/external/linker/linker/Tests/TestCases/IndividualTests.cs deleted file mode 100644 index 44e431d5eb..0000000000 --- a/external/linker/linker/Tests/TestCases/IndividualTests.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.IO; -using System.Xml; -using Mono.Linker.Tests.Cases.References.Individual; -using Mono.Linker.Tests.Cases.Tracing.Individual; -using Mono.Linker.Tests.TestCases; -using Mono.Linker.Tests.TestCasesRunner; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCases -{ - [TestFixture] - public class IndividualTests - { - [Test] - public void CanSkipUnresolved () - { - var testcase = CreateIndividualCase (typeof (CanSkipUnresolved)); - var result = Run (testcase); - - // We can't use the ResultChecker on the output because there will be unresolved types/methods - // Let's just make sure that the output assembly exists. That's enough to verify that the linker didn't throw due to the - // missing types/methods - if (!result.OutputAssemblyPath.Exists ()) - Assert.Fail ($"The linked assembly is missing. Should have existed at {result.OutputAssemblyPath}"); - } - - [Test] - public void CanEnableDependenciesDump () - { - var testcase = CreateIndividualCase (typeof (CanEnableDependenciesDump)); - var result = Run (testcase); - - var outputPath = result.OutputAssemblyPath.Parent.Combine (Tracer.DefaultDependenciesFileName); - if (!outputPath.Exists ()) - Assert.Fail ($"The dependency dump file is missing. Expected it to exist at {outputPath}"); - } - - [Test] - public void CanDumpDependenciesToUncompressedXml () - { - var testcase = CreateIndividualCase (typeof (CanDumpDependenciesToUncompressedXml)); - var result = Run (testcase); - - var outputPath = result.OutputAssemblyPath.Parent.Combine ("linker-dependencies.xml"); - if (!outputPath.Exists ()) - Assert.Fail($"The dependency dump file is missing. Expected it to exist at {outputPath}"); - - // Do a basic check to verify that the contents of the file are uncompressed xml - using (var reader = new XmlTextReader (outputPath.ToString ())) { - reader.Read (); - reader.Read (); - reader.Read (); - Assert.That (reader.Name, Is.EqualTo ("dependencies"), $"Expected to be at the dependencies element, but the current node name is `{reader.Name}`"); - } - } - - [Test] - public void CanEnableReducedTracing () - { - var testcase = CreateIndividualCase (typeof (CanEnableReducedTracing)); - var result = Run (testcase); - - // Note: This name needs to match what is setup in the test case arguments to the linker - const string expectedDependenciesFileName = "linker-dependencies.xml"; - var outputPath = result.OutputAssemblyPath.Parent.Combine (expectedDependenciesFileName); - if (!outputPath.Exists ()) - Assert.Fail($"The dependency dump file is missing. Expected it to exist at {outputPath}"); - - // Let's go a little bit further and make sure it looks like reducing tracking actually worked. - // This is intentionally a loose assertion. This test isn't meant to verify how reduced tracing works, - // it's here to make sure that enabling the option enables the behavior. - var lineCount = outputPath.ReadAllLines ().Length; - - // When reduced tracing is not enabled there are around 16k of lines in the output file. - // With reduced tracing there should be less than 20, but to be safe, we'll check for less than 50. - const int expectedMaxLines = 50; - Assert.That (lineCount, Is.LessThan (expectedMaxLines), $"There were `{lineCount}` lines in the dump file. This is more than expected max of {expectedMaxLines} and likely indicates reduced tracing was not enabled. Dump file can be found at: {outputPath}"); - } - - private TestCase CreateIndividualCase (Type testCaseType) - { - return TestDatabase.CreateCollector ().CreateIndividualCase (testCaseType); - } - - protected virtual LinkedTestCaseResult Run (TestCase testCase) - { - var runner = new TestRunner (new ObjectFactory ()); - return runner.Run (testCase); - } - } -} diff --git a/external/linker/linker/Tests/TestCases/TestCase.cs b/external/linker/linker/Tests/TestCases/TestCase.cs deleted file mode 100644 index cb73b66850..0000000000 --- a/external/linker/linker/Tests/TestCases/TestCase.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCases { - public class TestCase { - public TestCase (NPath sourceFile, NPath rootCasesDirectory, NPath originalTestCaseAssemblyPath) - { - SourceFile = sourceFile; - OriginalTestCaseAssemblyPath = originalTestCaseAssemblyPath; - Name = sourceFile.FileNameWithoutExtension; - DisplayName = $"{sourceFile.RelativeTo (rootCasesDirectory).Parent.ToString (SlashMode.Forward).Replace ('/', '.')}.{sourceFile.FileNameWithoutExtension}"; - - // A little hacky, but good enough for name. No reason why namespace & type names - // should not follow the directory structure - ReconstructedFullTypeName = $"{sourceFile.Parent.RelativeTo (rootCasesDirectory.Parent).ToString (SlashMode.Forward).Replace ('/', '.')}.{sourceFile.FileNameWithoutExtension}"; - } - - public string Name { get; } - - public string DisplayName { get; } - - public NPath SourceFile { get; } - - public NPath OriginalTestCaseAssemblyPath { get; } - - public string ReconstructedFullTypeName { get; } - - public bool HasLinkXmlFile { - get { return SourceFile.ChangeExtension ("xml").FileExists (); } - } - - public NPath LinkXmlFile { - get - { - if (!HasLinkXmlFile) - throw new InvalidOperationException ("This test case does not have a link xml file"); - - return SourceFile.ChangeExtension ("xml"); - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCases/TestDatabase.cs b/external/linker/linker/Tests/TestCases/TestDatabase.cs deleted file mode 100644 index c75fbc28e3..0000000000 --- a/external/linker/linker/Tests/TestCases/TestDatabase.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System.Linq; -using System.Collections.Generic; -using NUnit.Framework; -using System.Runtime.CompilerServices; -using System.IO; -using Mono.Linker.Tests.TestCasesRunner; - -namespace Mono.Linker.Tests.TestCases -{ - static class TestDatabase - { - public static IEnumerable XmlTests() - { - return NUnitCasesByPrefix("LinkXml."); - } - - public static IEnumerable BasicTests() - { - return NUnitCasesByPrefix("Basic."); - } - - public static IEnumerable VirtualMethodsTests() - { - return NUnitCasesByPrefix("VirtualMethods."); - } - - public static IEnumerable AttributeTests() - { - return NUnitCasesByPrefix("Attributes."); - } - - public static IEnumerable GenericsTests() - { - return NUnitCasesByPrefix("Generics."); - } - - public static IEnumerable CoreLinkTests() - { - return NUnitCasesByPrefix("CoreLink."); - } - - public static IEnumerable StaticsTests() - { - return NUnitCasesByPrefix("Statics."); - } - - public static IEnumerable InteropTests() - { - return NUnitCasesByPrefix("Interop."); - } - - public static IEnumerable ReferencesTests() - { - return NUnitCasesByPrefix("References."); - } - - public static IEnumerable ResourcesTests () - { - return NUnitCasesByPrefix ("Resources."); - } - - public static IEnumerable TypeForwardingTests () - { - return NUnitCasesByPrefix ("TypeForwarding."); - } - - public static IEnumerable TestFrameworkTests () - { - return NUnitCasesByPrefix ("TestFramework."); - } - - public static IEnumerable OtherTests() - { - var allGroupedTestNames = new HashSet( - XmlTests() - .Concat(BasicTests()) - .Concat(XmlTests()) - .Concat(VirtualMethodsTests()) - .Concat(AttributeTests()) - .Concat(GenericsTests()) - .Concat(CoreLinkTests()) - .Concat(StaticsTests()) - .Concat(InteropTests()) - .Concat(ReferencesTests ()) - .Concat(ResourcesTests ()) - .Concat(TypeForwardingTests ()) - .Concat(TestFrameworkTests ()) - .Select(c => ((TestCase)c.Arguments[0]).ReconstructedFullTypeName)); - - return AllCases().Where(c => !allGroupedTestNames.Contains(c.ReconstructedFullTypeName)).Select(c => CreateNUnitTestCase(c, c.DisplayName)); - } - - public static TestCaseCollector CreateCollector () - { - string rootSourceDirectory; - string testCaseAssemblyPath; - GetDirectoryPaths (out rootSourceDirectory, out testCaseAssemblyPath); - return new TestCaseCollector (rootSourceDirectory, testCaseAssemblyPath); - } - - static IEnumerable AllCases () - { - return CreateCollector () - .Collect () - .OrderBy (c => c.DisplayName) - .ToArray (); - } - - static IEnumerable NUnitCasesByPrefix(string testNamePrefix) - { - return AllCases() - .Where(c => c.DisplayName.StartsWith(testNamePrefix)) - .Select(c => CreateNUnitTestCase(c, c.DisplayName.Substring(testNamePrefix.Length))) - .OrderBy(c => c.TestName); - } - - static TestCaseData CreateNUnitTestCase(TestCase testCase, string displayName) - { - var data = new TestCaseData(testCase); - data.SetName(displayName); - return data; - } - - static void GetDirectoryPaths(out string rootSourceDirectory, out string testCaseAssemblyPath, [CallerFilePath] string thisFile = null) - { - var thisDirectory = Path.GetDirectoryName(thisFile); - rootSourceDirectory = Path.GetFullPath(Path.Combine(thisDirectory, "..", "Mono.Linker.Tests.Cases")); - testCaseAssemblyPath = Path.GetFullPath(Path.Combine(rootSourceDirectory, "bin", "Debug", "Mono.Linker.Tests.Cases.dll")); - } - } -} diff --git a/external/linker/linker/Tests/TestCases/TestSuites.cs b/external/linker/linker/Tests/TestCases/TestSuites.cs deleted file mode 100644 index afb3b499fb..0000000000 --- a/external/linker/linker/Tests/TestCases/TestSuites.cs +++ /dev/null @@ -1,94 +0,0 @@ -using Mono.Linker.Tests.TestCasesRunner; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCases -{ - [TestFixture] - public class All - { - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.BasicTests))] - public void BasicTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.VirtualMethodsTests))] - public void VirtualMethodTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.XmlTests))] - public void XmlTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.AttributeTests))] - public void AttributesTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.GenericsTests))] - public void GenericsTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.StaticsTests))] - public void StaticsTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.CoreLinkTests))] - public void CoreLinkTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.InteropTests))] - public void InteropTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource(typeof(TestDatabase), nameof(TestDatabase.ReferencesTests))] - public void ReferencesTests(TestCase testCase) - { - Run(testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.ResourcesTests))] - public void ResourcesTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.TypeForwardingTests))] - public void TypeForwardingTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource(typeof (TestDatabase), nameof (TestDatabase.TestFrameworkTests))] - public void TestFrameworkTests (TestCase testCase) - { - Run (testCase); - } - - [TestCaseSource (typeof (TestDatabase), nameof (TestDatabase.OtherTests))] - public void OtherTests (TestCase testCase) - { - Run (testCase); - } - - protected virtual void Run (TestCase testCase) - { - var runner = new TestRunner (new ObjectFactory ()); - var linkedResult = runner.Run (testCase); - new ResultChecker ().Check (linkedResult); - } - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/AssemblyChecker.cs b/external/linker/linker/Tests/TestCasesRunner/AssemblyChecker.cs deleted file mode 100644 index 6e40181ecd..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/AssemblyChecker.cs +++ /dev/null @@ -1,420 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Mono.Cecil; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Extensions; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class AssemblyChecker { - readonly AssemblyDefinition originalAssembly, linkedAssembly; - - HashSet linkedMembers; - HashSet verifiedBackingFields = new HashSet (); - HashSet verifiedEventMethods = new HashSet(); - - public AssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked) - { - this.originalAssembly = original; - this.linkedAssembly = linked; - } - - public void Verify () - { - // TODO: Implement fully, probably via custom Kept attribute - Assert.IsFalse (linkedAssembly.MainModule.HasExportedTypes); - - VerifyCustomAttributes (originalAssembly, linkedAssembly); - VerifySecurityAttributes (originalAssembly, linkedAssembly); - - VerifyResources (originalAssembly, linkedAssembly); - - linkedMembers = new HashSet (linkedAssembly.MainModule.AllMembers ().Select (s => { - return s.FullName; - }), StringComparer.Ordinal); - - var membersToAssert = originalAssembly.MainModule.Types; - foreach (var originalMember in membersToAssert) { - var td = originalMember as TypeDefinition; - if (td != null) { - if (td.Name == "") { - linkedMembers.Remove (td.Name); - continue; - } - - TypeDefinition linkedType = linkedAssembly.MainModule.GetType (originalMember.FullName); - VerifyTypeDefinition (td, linkedType); - linkedMembers.Remove (td.FullName); - - continue; - } - - throw new NotImplementedException ($"Don't know how to check member of type {originalMember.GetType ()}"); - } - - Assert.IsEmpty (linkedMembers, "Linked output includes unexpected member"); - } - - protected virtual void VerifyTypeDefinition (TypeDefinition original, TypeDefinition linked) - { - ModuleDefinition linkedModule = linked?.Module; - - // - // Little bit complex check to allow easier test writting to match - // - It has [Kept] attribute or any variation of it - // - It contains Main method - // - It contains at least one member which has [Kept] attribute (not recursive) - // - bool expectedKept = - original.HasAttributeDerivedFrom (nameof (KeptAttribute)) || - (linked != null && linkedModule.Assembly.EntryPoint.DeclaringType == linked) || - original.AllMembers ().Any (l => l.HasAttribute (nameof (KeptAttribute))); - - if (!expectedKept) { - if (linked != null) - Assert.Fail ($"Type `{original}' should have been removed"); - - return; - } - - if (linked == null) - Assert.Fail ($"Type `{original}' should have been kept"); - - if (!original.IsInterface) - VerifyBaseType (original, linked); - - VerifyInterfaces (original, linked); - - VerifyGenericParameters (original, linked); - VerifyCustomAttributes (original, linked); - VerifySecurityAttributes (original, linked); - - foreach (var td in original.NestedTypes) { - VerifyTypeDefinition (td, linked?.NestedTypes.FirstOrDefault (l => td.FullName == l.FullName)); - linkedMembers.Remove (td.FullName); - } - - // Need to check properties before fields so that the KeptBackingFieldAttribute is handled correctly - foreach (var p in original.Properties) { - VerifyProperty (p, linked?.Properties.FirstOrDefault (l => p.Name == l.Name), linked); - linkedMembers.Remove (p.FullName); - } - // Need to check events before fields so that the KeptBackingFieldAttribute is handled correctly - foreach (var e in original.Events) { - VerifyEvent (e, linked?.Events.FirstOrDefault (l => e.Name == l.Name), linked); - linkedMembers.Remove (e.FullName); - } - - foreach (var f in original.Fields) { - if (verifiedBackingFields.Contains (f.FullName)) - continue; - VerifyField (f, linked?.Fields.FirstOrDefault (l => f.Name == l.Name)); - linkedMembers.Remove (f.FullName); - } - - foreach (var m in original.Methods) { - if (verifiedEventMethods.Contains (m.FullName)) - continue; - VerifyMethod (m, linked?.Methods.FirstOrDefault (l => m.GetSignature () == l.GetSignature ())); - linkedMembers.Remove (m.FullName); - } - } - - void VerifyBaseType (TypeDefinition src, TypeDefinition linked) - { - string expectedBaseName; - var expectedBaseGenericAttr = src.CustomAttributes.FirstOrDefault (w => w.AttributeType.Name == nameof (KeptBaseTypeAttribute) && w.ConstructorArguments.Count > 1); - if (expectedBaseGenericAttr != null) { - StringBuilder builder = new StringBuilder (); - builder.Append (expectedBaseGenericAttr.ConstructorArguments [0].Value); - builder.Append ("<"); - bool separator = false; - foreach (var caa in (CustomAttributeArgument[])expectedBaseGenericAttr.ConstructorArguments [1].Value) { - if (separator) - builder.Append (","); - else - separator = true; - - var arg = (CustomAttributeArgument)caa.Value; - builder.Append (arg.Value); - } - - builder.Append (">"); - expectedBaseName = builder.ToString (); - } else { - var defaultBaseType = src.IsValueType ? "System.ValueType" : "System.Object"; - expectedBaseName = GetCustomAttributeCtorValues (src, nameof (KeptBaseTypeAttribute)).FirstOrDefault ()?.ToString () ?? defaultBaseType; - } - Assert.AreEqual (expectedBaseName, linked.BaseType?.FullName); - } - - void VerifyInterfaces (TypeDefinition src, TypeDefinition linked) - { - var expectedInterfaces = new HashSet (GetCustomAttributeCtorValues (src, nameof (KeptInterfaceAttribute)).Select (val => val.ToString ())); - if (expectedInterfaces.Count == 0) { - Assert.IsFalse (linked.HasInterfaces, $"Type `{src}' has unexpected interfaces"); - } else { - foreach (var iface in linked.Interfaces) { - Assert.IsTrue (expectedInterfaces.Remove (iface.InterfaceType.FullName), $"Type `{src}' interface `{iface.InterfaceType.FullName}' should have been removed"); - } - - Assert.IsEmpty (expectedInterfaces); - } - } - - void VerifyField (FieldDefinition src, FieldDefinition linked) - { - bool expectedKept = ShouldBeKept (src); - - if (!expectedKept) { - if (linked != null) - Assert.Fail ($"Field `{src}' should have been removed"); - - return; - } - - VerifyFieldKept (src, linked); - } - - void VerifyFieldKept (FieldDefinition src, FieldDefinition linked) - { - if (linked == null) - Assert.Fail ($"Field `{src}' should have been kept"); - - Assert.AreEqual (src?.Attributes, linked?.Attributes, $"Field `{src}' attributes"); - Assert.AreEqual (src?.Constant, linked?.Constant, $"Field `{src}' value"); - - VerifyCustomAttributes (src, linked); - } - - void VerifyProperty (PropertyDefinition src, PropertyDefinition linked, TypeDefinition linkedType) - { - VerifyMemberBackingField (src, linkedType); - - bool expectedKept = ShouldBeKept (src); - - if (!expectedKept) { - if (linked != null) - Assert.Fail ($"Property `{src}' should have been removed"); - - return; - } - - if (linked == null) - Assert.Fail ($"Property `{src}' should have been kept"); - - Assert.AreEqual (src?.Attributes, linked?.Attributes, $"Property `{src}' attributes"); - Assert.AreEqual (src?.Constant, linked?.Constant, $"Property `{src}' value"); - - VerifyCustomAttributes (src, linked); - } - - void VerifyEvent (EventDefinition src, EventDefinition linked, TypeDefinition linkedType) - { - VerifyMemberBackingField (src, linkedType); - - bool expectedKept = ShouldBeKept (src); - - if (!expectedKept) { - if (linked != null) - Assert.Fail ($"Event `{src}' should have been removed"); - - return; - } else { - var keptBackingFieldAttribute = src.CustomAttributes - .FirstOrDefault (attr => attr.AttributeType.Name == nameof (KeptBackingFieldAttribute)); - - // If we have KeepBackingFieldAttribute set, - // then we expect having 'add' and 'remove' accessors marked as 'kept' implicitly. - if (keptBackingFieldAttribute != null) - { - VerifyMethodInternal (src.AddMethod, linked.AddMethod, true); - verifiedEventMethods.Add (src.AddMethod.FullName); - linkedMembers.Remove (src.AddMethod.FullName); - - VerifyMethodInternal (src.RemoveMethod, linked.RemoveMethod, true); - verifiedEventMethods.Add (src.RemoveMethod.FullName); - linkedMembers.Remove (src.RemoveMethod.FullName); - } - } - - if (linked == null) - Assert.Fail ($"Event `{src}' should have been kept"); - - Assert.AreEqual (src?.Attributes, linked?.Attributes, $"Event `{src}' attributes"); - - VerifyCustomAttributes (src, linked); - } - - void VerifyMethod (MethodDefinition src, MethodDefinition linked) - { - bool expectedKept = ShouldMethodBeKept (src); - VerifyMethodInternal (src, linked, expectedKept); - } - - - void VerifyMethodInternal (MethodDefinition src, MethodDefinition linked, bool expectedKept) - { - if (!expectedKept) { - if (linked != null) - Assert.Fail ($"Method `{src.FullName}' should have been removed"); - - return; - } - - VerifyMethodKept (src, linked); - } - - void VerifyMemberBackingField (IMemberDefinition src, TypeDefinition linkedType) - { - var keptBackingFieldAttribute = src.CustomAttributes.FirstOrDefault (attr => attr.AttributeType.Name == nameof (KeptBackingFieldAttribute)); - if (keptBackingFieldAttribute == null) - return; - - var backingFieldName = src.MetadataToken.TokenType == TokenType.Property - ? $"<{src.Name}>k__BackingField" : src.Name; - var srcField = src.DeclaringType.Fields.FirstOrDefault (f => f.Name == backingFieldName); - - if (srcField == null) { - // Can add more here if necessary - backingFieldName = backingFieldName.Replace ("System.Int32", "int"); - backingFieldName = backingFieldName.Replace ("System.String", "string"); - backingFieldName = backingFieldName.Replace ("System.Char", "char"); - - srcField = src.DeclaringType.Fields.FirstOrDefault (f => f.Name == backingFieldName); - } - - if (srcField == null) - Assert.Fail ($"{src.MetadataToken.TokenType} `{src}', could not locate the expected backing field {backingFieldName}"); - - VerifyFieldKept (srcField, linkedType?.Fields.FirstOrDefault (l => srcField.Name == l.Name)); - verifiedBackingFields.Add (srcField.FullName); - linkedMembers.Remove (srcField.FullName); - } - - protected virtual void VerifyMethodKept (MethodDefinition src, MethodDefinition linked) - { - if (linked == null) - Assert.Fail ($"Method `{src.FullName}' should have been kept"); - - Assert.AreEqual (src?.Attributes, linked.Attributes, $"Method `{src}' attributes"); - - VerifyGenericParameters (src, linked); - VerifyCustomAttributes (src, linked); - VerifyParameters (src, linked); - VerifySecurityAttributes (src, linked); - } - - void VerifyResources (AssemblyDefinition original, AssemblyDefinition linked) - { - var expectedResources = original.MainModule.AllDefinedTypes () - .SelectMany (t => GetCustomAttributeCtorValues (t, nameof (KeptResourceAttribute))); - - Assert.That (linked.MainModule.Resources.Select (r => r.Name), Is.EquivalentTo (expectedResources)); - } - - protected virtual void VerifyCustomAttributes (ICustomAttributeProvider src, ICustomAttributeProvider linked) - { - var expectedAttrs = GetCustomAttributeCtorValues (src, nameof (KeptAttributeAttribute)) - .Select (attr => attr.ToString ()) - .ToList (); - - var linkedAttrs = FilterLinkedAttributes (linked).ToList (); - - Assert.That (linkedAttrs, Is.EquivalentTo (expectedAttrs), $"Custom attributes on `{src}' are not matching"); - } - - protected virtual void VerifySecurityAttributes (ICustomAttributeProvider src, ISecurityDeclarationProvider linked) - { - var expectedAttrs = GetCustomAttributeCtorValues (src, nameof (KeptSecurityAttribute)) - .Select (attr => attr.ToString ()) - .ToList (); - - var linkedAttrs = FilterLinkedSecurityAttributes (linked).ToList (); - - Assert.That (linkedAttrs, Is.EquivalentTo (expectedAttrs), $"Security attributes on `{src}' are not matching"); - } - - /// - /// Filters out some attributes that should not be taken into consideration when checking the linked result against the expected result - /// - /// - /// - protected virtual IEnumerable FilterLinkedAttributes (ICustomAttributeProvider linked) - { - foreach (var attr in linked.CustomAttributes) { - switch (attr.AttributeType.FullName) { - case "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute": - case "System.Runtime.CompilerServices.CompilerGeneratedAttribute": - continue; - - // When mcs is used to compile the test cases, backing fields end up with this attribute on them - case "System.Diagnostics.DebuggerBrowsableAttribute": - continue; - - case "System.Runtime.CompilerServices.CompilationRelaxationsAttribute": - if (linked is AssemblyDefinition) - continue; - break; - } - - yield return attr.AttributeType.FullName; - } - } - - protected virtual IEnumerable FilterLinkedSecurityAttributes (ISecurityDeclarationProvider linked) - { - return linked.SecurityDeclarations - .SelectMany (d => d.SecurityAttributes) - .Select (attr => attr.AttributeType.ToString ()); - } - - void VerifyGenericParameters (IGenericParameterProvider src, IGenericParameterProvider linked) - { - Assert.AreEqual (src.HasGenericParameters, linked.HasGenericParameters); - if (src.HasGenericParameters) { - for (int i = 0; i < src.GenericParameters.Count; ++i) { - // TODO: Verify constraints - VerifyCustomAttributes (src.GenericParameters [i], linked.GenericParameters [i]); - } - } - } - - void VerifyParameters (IMethodSignature src, IMethodSignature linked) - { - Assert.AreEqual (src.HasParameters, linked.HasParameters); - if (src.HasParameters) { - for (int i = 0; i < src.Parameters.Count; ++i) { - VerifyCustomAttributes (src.Parameters [i], linked.Parameters [i]); - } - } - } - - protected virtual bool ShouldMethodBeKept (MethodDefinition method) - { - var srcSignature = method.GetSignature (); - return ShouldBeKept (method, srcSignature) || method.DeclaringType.Module.EntryPoint == method; - } - - protected virtual bool ShouldBeKept (T member, string signature = null) where T : MemberReference, ICustomAttributeProvider - { - if (member.HasAttribute (nameof (KeptAttribute))) - return true; - - ICustomAttributeProvider cap = (ICustomAttributeProvider)member.DeclaringType; - if (cap == null) - return false; - - return GetCustomAttributeCtorValues (cap, nameof (KeptMemberAttribute)).Any (a => a == (signature ?? member.Name)); - } - - protected static IEnumerable GetCustomAttributeCtorValues (ICustomAttributeProvider provider, string attributeName) where T : class - { - return provider.CustomAttributes. - Where (w => w.AttributeType.Name == attributeName && w.Constructor.Parameters.Count == 1). - Select (l => l.ConstructorArguments [0].Value as T); - } - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/CompilerOptions.cs b/external/linker/linker/Tests/TestCasesRunner/CompilerOptions.cs deleted file mode 100644 index 62a4c7d921..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/CompilerOptions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class CompilerOptions { - public NPath OutputPath; - public NPath[] SourceFiles; - public string[] Defines; - public NPath[] References; - public NPath[] Resources; - public string[] AdditionalArguments; - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/ExpectationsProvider.cs b/external/linker/linker/Tests/TestCasesRunner/ExpectationsProvider.cs deleted file mode 100644 index 79280a35a2..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/ExpectationsProvider.cs +++ /dev/null @@ -1,12 +0,0 @@ -using Mono.Cecil; -using Mono.Linker.Tests.Cases.Expectations.Assertions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public static class ExpectationsProvider { - - public static bool IsAssemblyAssertion (CustomAttribute attr) - { - return attr.AttributeType.Name == nameof (KeptAssemblyAttribute) || attr.AttributeType.Name == nameof (RemovedAssemblyAttribute); - } - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/ILCompiler.cs b/external/linker/linker/Tests/TestCasesRunner/ILCompiler.cs deleted file mode 100644 index 517bcb273a..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/ILCompiler.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using Mono.Linker.Tests.Extensions; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class ILCompiler { - private readonly string _ilasmExecutable; - - public ILCompiler () - { - _ilasmExecutable = Environment.OSVersion.Platform == PlatformID.Win32NT ? LocateIlasmOnWindows ().ToString () : "ilasm"; - } - - public ILCompiler (string ilasmExecutable) - { - _ilasmExecutable = ilasmExecutable; - } - - public NPath Compile (CompilerOptions options) - { - var capturedOutput = new List (); - var process = new Process (); - SetupProcess (process, options); - process.StartInfo.RedirectStandardOutput = true; - process.OutputDataReceived += (sender, args) => capturedOutput.Add (args.Data); - process.Start (); - process.BeginOutputReadLine (); - process.WaitForExit (); - - if (process.ExitCode != 0) - { - Assert.Fail($"Failed to compile IL assembly : {options.OutputPath}\n{capturedOutput.Aggregate ((buff, s) => buff + Environment.NewLine + s)}"); - } - - return options.OutputPath; - } - - protected virtual void SetupProcess (Process process, CompilerOptions options) - { - process.StartInfo.FileName = _ilasmExecutable; - process.StartInfo.Arguments = BuildArguments (options); - process.StartInfo.UseShellExecute = false; - process.StartInfo.CreateNoWindow = true; - process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - } - - private string BuildArguments (CompilerOptions options) - { - var args = new StringBuilder(); - args.Append(options.OutputPath.ExtensionWithDot == ".dll" ? "/dll" : "/exe"); - args.Append($" /out:{options.OutputPath.InQuotes ()}"); - args.Append($" {options.SourceFiles.Aggregate (string.Empty, (buff, file) => $"{buff} {file.InQuotes ()}")}"); - return args.ToString (); - } - - public static NPath LocateIlasmOnWindows () - { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) - throw new InvalidOperationException ("This method should only be called on windows"); - - var possiblePath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory ().ToNPath ().Combine ("ilasm.exe"); - if (possiblePath.FileExists ()) - return possiblePath; - - throw new InvalidOperationException ("Could not locate a ilasm.exe executable"); - } - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/LinkXmlHelpers.cs b/external/linker/linker/Tests/TestCasesRunner/LinkXmlHelpers.cs deleted file mode 100644 index c7e70cf710..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/LinkXmlHelpers.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Text; -using Mono.Cecil; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public static class LinkXmlHelpers { - public static void WriteXmlFileToPreserveEntryPoint (NPath targetProgram, NPath xmlFile) - { - using (var assembly = AssemblyDefinition.ReadAssembly (targetProgram.ToString ())) { - var method = assembly.EntryPoint; - - var sb = new StringBuilder (); - sb.AppendLine (""); - - sb.AppendLine (" "); - - if (method != null) { - sb.AppendLine (" "); - sb.AppendLine (" "); - sb.AppendLine (" "); - } - - sb.AppendLine (" "); - - sb.AppendLine (""); - xmlFile.WriteAllText (sb.ToString ()); - } - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/LinkedTestCaseResult.cs b/external/linker/linker/Tests/TestCasesRunner/LinkedTestCaseResult.cs deleted file mode 100644 index 2d05f6d09c..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/LinkedTestCaseResult.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Mono.Linker.Tests.Extensions; -using Mono.Linker.Tests.TestCases; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class LinkedTestCaseResult { - public readonly TestCase TestCase; - public readonly NPath InputAssemblyPath; - public readonly NPath OutputAssemblyPath; - public readonly NPath ExpectationsAssemblyPath; - - public LinkedTestCaseResult (TestCase testCase, NPath inputAssemblyPath, NPath outputAssemblyPath, NPath expectationsAssemblyPath) - { - TestCase = testCase; - InputAssemblyPath = inputAssemblyPath; - OutputAssemblyPath = outputAssemblyPath; - ExpectationsAssemblyPath = expectationsAssemblyPath; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/LinkerArgumentBuilder.cs b/external/linker/linker/Tests/TestCasesRunner/LinkerArgumentBuilder.cs deleted file mode 100644 index 0b8d453d3f..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/LinkerArgumentBuilder.cs +++ /dev/null @@ -1,108 +0,0 @@ -using System.Collections.Generic; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class LinkerArgumentBuilder { - private readonly List _arguments = new List (); - - public virtual void AddSearchDirectory (NPath directory) - { - Append ("-d"); - Append (directory.ToString ()); - } - - public virtual void AddOutputDirectory (NPath directory) - { - Append ("-o"); - Append (directory.ToString ()); - } - - public virtual void AddLinkXmlFile (NPath path) - { - Append ("-x"); - Append (path.ToString ()); - } - - public virtual void AddCoreLink (string value) - { - Append ("-c"); - Append (value); - } - - public virtual void LinkFromAssembly (string fileName) - { - Append ("-a"); - Append (fileName); - } - - public virtual void IncludeBlacklist (bool value) - { - Append ("-z"); - Append (value ? "true" : "false"); - } - - public virtual void AddIl8n (string value) - { - Append ("-l"); - Append (value); - } - - public virtual void AddKeepTypeForwarderOnlyAssemblies (string value) - { - if (bool.Parse (value)) - Append ("-t"); - } - - public virtual void AddAssemblyAction (string action, string assembly) - { - Append ("-p"); - Append (action); - Append (assembly); - } - - public string [] ToArgs () - { - return _arguments.ToArray (); - } - - protected void Append (string arg) - { - _arguments.Add (arg); - } - - public virtual void AddAdditionalArgument (string flag, string [] values) - { - Append (flag); - if (values != null) { - foreach (var val in values) - Append (val); - } - } - - public virtual void ProcessOptions (TestCaseLinkerOptions options) - { - if (options.CoreAssembliesAction != null) - AddCoreLink (options.CoreAssembliesAction); - - if (options.AssembliesAction != null) { - foreach (var entry in options.AssembliesAction) - AddAssemblyAction (entry.Key, entry.Value); - } - - // Running the blacklist step causes a ton of stuff to be preserved. That's good for normal use cases, but for - // our test cases that pollutes the results - IncludeBlacklist (options.IncludeBlacklistStep); - - if (!string.IsNullOrEmpty (options.Il8n)) - AddIl8n (options.Il8n); - - if (!string.IsNullOrEmpty (options.KeepTypeForwarderOnlyAssemblies)) - AddKeepTypeForwarderOnlyAssemblies (options.KeepTypeForwarderOnlyAssemblies); - - // Unity uses different argument format and needs to be able to translate to their format. In order to make that easier - // we keep the information in flag + values format for as long as we can so that this information doesn't have to be parsed out of a single string - foreach (var additionalArgument in options.AdditionalArguments) - AddAdditionalArgument (additionalArgument.Key, additionalArgument.Value); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/LinkerDriver.cs b/external/linker/linker/Tests/TestCasesRunner/LinkerDriver.cs deleted file mode 100644 index dc2469ca31..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/LinkerDriver.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Mono.Linker.Tests.TestCasesRunner { - public class LinkerDriver { - public virtual void Link (string [] args) - { - Driver.Main (args); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/ManagedCompilationResult.cs b/external/linker/linker/Tests/TestCasesRunner/ManagedCompilationResult.cs deleted file mode 100644 index ccce993f97..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/ManagedCompilationResult.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class ManagedCompilationResult { - public ManagedCompilationResult (NPath inputAssemblyPath, NPath expectationsAssemblyPath) - { - InputAssemblyPath = inputAssemblyPath; - ExpectationsAssemblyPath = expectationsAssemblyPath; - } - - public NPath InputAssemblyPath { get; } - - public NPath ExpectationsAssemblyPath { get; } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/ObjectFactory.cs b/external/linker/linker/Tests/TestCasesRunner/ObjectFactory.cs deleted file mode 100644 index 0c96ae1422..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/ObjectFactory.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Mono.Cecil; -using Mono.Linker.Tests.TestCases; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class ObjectFactory { - public virtual TestCaseSandbox CreateSandbox (TestCase testCase) - { - return new TestCaseSandbox (testCase); - } - - public virtual TestCaseCompiler CreateCompiler (TestCaseSandbox sandbox, TestCaseMetadaProvider metadataProvider) - { - return new TestCaseCompiler (sandbox, metadataProvider); - } - - public virtual LinkerDriver CreateLinker () - { - return new LinkerDriver (); - } - - public virtual TestCaseMetadaProvider CreateMetadataProvider (TestCase testCase, AssemblyDefinition fullTestCaseAssemblyDefinition) - { - return new TestCaseMetadaProvider (testCase, fullTestCaseAssemblyDefinition); - } - - public virtual LinkerArgumentBuilder CreateLinkerArgumentBuilder () - { - return new LinkerArgumentBuilder (); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/PeVerifier.cs b/external/linker/linker/Tests/TestCasesRunner/PeVerifier.cs deleted file mode 100644 index dd3d5e37ca..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/PeVerifier.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using Microsoft.Win32; -using Mono.Cecil; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Extensions; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class PeVerifier { - private readonly string _peExecutable; - - public PeVerifier () - { - _peExecutable = Environment.OSVersion.Platform == PlatformID.Win32NT ? FindPeExecutableFromRegistry ().ToString () : "pedump"; - } - - public PeVerifier (string peExecutable) - { - _peExecutable = peExecutable; - } - - public virtual void Check (LinkedTestCaseResult linkResult, AssemblyDefinition original) - { - bool skipCheckEntirely; - HashSet assembliesToSkip; - ProcessSkipAttributes (linkResult, original, out skipCheckEntirely, out assembliesToSkip); - - if (skipCheckEntirely) - return; - - foreach (var file in linkResult.OutputAssemblyPath.Parent.Files ()) { - if (file.ExtensionWithDot != ".exe" && file.ExtensionWithDot != ".dll") - continue; - - // Always skip the I18N assemblies, for some reason they end up in the output directory on OSX. - // verification of these fails due to native pointers - if (file.FileName.StartsWith ("I18N")) - continue; - - if (assembliesToSkip.Contains (file.FileName)) - continue; - - CheckAssembly (file); - } - } - - private void ProcessSkipAttributes (LinkedTestCaseResult linkResult, AssemblyDefinition original, out bool skipCheckEntirely, out HashSet assembliesToSkip) - { - var peVerifyAttrs = original.MainModule.GetType (linkResult.TestCase.ReconstructedFullTypeName).CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SkipPeVerifyAttribute)); - skipCheckEntirely = false; - assembliesToSkip = new HashSet (); - foreach (var attr in peVerifyAttrs) { - var ctorArg = attr.ConstructorArguments.FirstOrDefault (); - - if (!attr.HasConstructorArguments) { - skipCheckEntirely = true; - } else if (ctorArg.Type.Name == nameof (SkipPeVerifyForToolchian)) { - var skipToolchain = (SkipPeVerifyForToolchian)ctorArg.Value; - - if (skipToolchain == SkipPeVerifyForToolchian.Pedump) { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) - skipCheckEntirely = true; - } - else - throw new ArgumentException ($"Unhandled platform and toolchain values of {Environment.OSVersion.Platform} and {skipToolchain}"); - } else if (ctorArg.Type.Name == nameof (String)) { - assembliesToSkip.Add ((string)ctorArg.Value); - } else { - throw new ArgumentException ($"Unhandled constructor argument type of {ctorArg.Type} on {nameof (SkipPeVerifyAttribute)}"); - } - } - } - - private void CheckAssembly (NPath assemblyPath) - { - var capturedOutput = new List (); - var process = new Process (); - SetupProcess (process, assemblyPath); - process.StartInfo.RedirectStandardOutput = true; - process.OutputDataReceived += (sender, args) => capturedOutput.Add (args.Data); - process.Start (); - process.BeginOutputReadLine (); - process.WaitForExit (); - - if (process.ExitCode != 0) { - Assert.Fail ($"Invalid IL detected in {assemblyPath}\n{capturedOutput.Aggregate ((buff, s) => buff + Environment.NewLine + s)}"); - } - } - - protected virtual void SetupProcess (Process process, NPath assemblyPath) - { - var exeArgs = Environment.OSVersion.Platform == PlatformID.Win32NT ? $"/nologo {assemblyPath.InQuotes ()}" : $"--verify metadata,code {assemblyPath.InQuotes ()}"; - process.StartInfo.FileName = _peExecutable; - process.StartInfo.Arguments = exeArgs; - process.StartInfo.UseShellExecute = false; - process.StartInfo.CreateNoWindow = true; - process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; - - if (Environment.OSVersion.Platform != PlatformID.Win32NT) { - process.StartInfo.Environment ["MONO_PATH"] = assemblyPath.Parent.ToString (); - } - } - - public static NPath FindPeExecutableFromRegistry () - { - if (Environment.OSVersion.Platform != PlatformID.Win32NT) - throw new InvalidOperationException ("This method should only be called on windows"); - - NPath result; - if (TryFindPeExecutableFromRegustrySubfolder ("NETFXSDK", out result)) - return result; - if (TryFindPeExecutableFromRegustrySubfolder ("Windows", out result)) - return result; - - throw new InvalidOperationException ("Could not locate a peverify.exe executable"); - } - - private static bool TryFindPeExecutableFromRegustrySubfolder (string subfolder, out NPath peVerifyPath) - { - var keyPath = $"SOFTWARE\\Wow6432Node\\Microsoft\\Microsoft SDKs\\{subfolder}"; - var key = Registry.LocalMachine.OpenSubKey (keyPath); - - foreach (var sdkKeyName in key.GetSubKeyNames ().OrderBy (name => new Version (name.TrimStart ('v').TrimEnd ('A'))).Reverse ()) { - var sdkKey = Registry.LocalMachine.OpenSubKey ($"{keyPath}\\{sdkKeyName}"); - - var sdkDir = (string)sdkKey.GetValue ("InstallationFolder"); - if (string.IsNullOrEmpty (sdkDir)) - continue; - - var binDir = sdkDir.ToNPath ().Combine ("bin"); - if (!binDir.Exists ()) - continue; - - foreach (var netSdkDirs in binDir.Directories ().OrderBy (dir => dir.FileName)) { - peVerifyPath = netSdkDirs.Combine ("PEVerify.exe"); - if (peVerifyPath.FileExists ()) - return true; - } - } - peVerifyPath = null; - return false; - } - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/ResultChecker.cs b/external/linker/linker/Tests/TestCasesRunner/ResultChecker.cs deleted file mode 100644 index 723b2194f8..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/ResultChecker.cs +++ /dev/null @@ -1,297 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Mono.Cecil; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Extensions; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class ResultChecker - { - readonly BaseAssemblyResolver _originalsResolver; - readonly BaseAssemblyResolver _linkedResolver; - readonly PeVerifier _peVerifier; - - public ResultChecker () - : this(new DefaultAssemblyResolver (), new DefaultAssemblyResolver (), new PeVerifier ()) - { - } - - public ResultChecker (BaseAssemblyResolver originalsResolver, BaseAssemblyResolver linkedResolver, PeVerifier peVerifier) - { - _originalsResolver = originalsResolver; - _linkedResolver = linkedResolver; - _peVerifier = peVerifier; - } - - public virtual void Check (LinkedTestCaseResult linkResult) - { - Assert.IsTrue (linkResult.OutputAssemblyPath.FileExists (), $"The linked output assembly was not found. Expected at {linkResult.OutputAssemblyPath}"); - - InitializeResolvers (linkResult); - - try - { - var original = ResolveOriginalsAssembly (linkResult.ExpectationsAssemblyPath.FileNameWithoutExtension); - PerformOutputAssemblyChecks (original, linkResult.OutputAssemblyPath.Parent); - - var linked = ResolveLinkedAssembly (linkResult.OutputAssemblyPath.FileNameWithoutExtension); - - CreateAssemblyChecker (original, linked).Verify (); - - VerifyLinkingOfOtherAssemblies (original); - - _peVerifier.Check (linkResult, original); - - AdditionalChecking (linkResult, original, linked); - } - finally - { - _originalsResolver.Dispose (); - _linkedResolver.Dispose (); - } - } - - protected virtual AssemblyChecker CreateAssemblyChecker (AssemblyDefinition original, AssemblyDefinition linked) - { - return new AssemblyChecker (original, linked); - } - - void InitializeResolvers (LinkedTestCaseResult linkedResult) - { - _originalsResolver.AddSearchDirectory (linkedResult.ExpectationsAssemblyPath.Parent.ToString ()); - _linkedResolver.AddSearchDirectory (linkedResult.OutputAssemblyPath.Parent.ToString ()); - } - - AssemblyDefinition ResolveLinkedAssembly (string assemblyName) - { - var cleanAssemblyName = assemblyName; - if (assemblyName.EndsWith(".exe") || assemblyName.EndsWith(".dll")) - cleanAssemblyName = System.IO.Path.GetFileNameWithoutExtension (assemblyName); - return _linkedResolver.Resolve (new AssemblyNameReference (cleanAssemblyName, null)); - } - - AssemblyDefinition ResolveOriginalsAssembly (string assemblyName) - { - var cleanAssemblyName = assemblyName; - if (assemblyName.EndsWith (".exe") || assemblyName.EndsWith (".dll")) - cleanAssemblyName = Path.GetFileNameWithoutExtension (assemblyName); - return _originalsResolver.Resolve (new AssemblyNameReference (cleanAssemblyName, null)); - } - - void PerformOutputAssemblyChecks (AssemblyDefinition original, NPath outputDirectory) - { - var assembliesToCheck = original.MainModule.Types.SelectMany (t => t.CustomAttributes).Where (attr => ExpectationsProvider.IsAssemblyAssertion(attr)); - - foreach (var assemblyAttr in assembliesToCheck) { - var name = (string) assemblyAttr.ConstructorArguments.First ().Value; - var expectedPath = outputDirectory.Combine (name); - - if (assemblyAttr.AttributeType.Name == nameof (RemovedAssemblyAttribute)) - Assert.IsFalse (expectedPath.FileExists (), $"Expected the assembly {name} to not exist in {outputDirectory}, but it did"); - else if (assemblyAttr.AttributeType.Name == nameof (KeptAssemblyAttribute)) - Assert.IsTrue (expectedPath.FileExists (), $"Expected the assembly {name} to exist in {outputDirectory}, but it did not"); - else - throw new NotImplementedException($"Unknown assembly assertion of type {assemblyAttr.AttributeType}"); - } - } - - protected virtual void AdditionalChecking (LinkedTestCaseResult linkResult, AssemblyDefinition original, AssemblyDefinition linked) - { - } - - void VerifyLinkingOfOtherAssemblies (AssemblyDefinition original) - { - var checks = BuildOtherAssemblyCheckTable (original); - - try { - foreach (var assemblyName in checks.Keys) { - using (var linkedAssembly = ResolveLinkedAssembly (assemblyName)) { - foreach (var checkAttrInAssembly in checks [assemblyName]) { - var expectedTypeName = checkAttrInAssembly.ConstructorArguments [1].Value.ToString (); - var linkedType = linkedAssembly.MainModule.GetType (expectedTypeName); - - switch (checkAttrInAssembly.AttributeType.Name) { - case nameof (RemovedTypeInAssemblyAttribute): - if (linkedType != null) - Assert.Fail ($"Type `{expectedTypeName}' should have been removed"); - break; - case nameof (KeptTypeInAssemblyAttribute): - if (linkedType == null) - Assert.Fail ($"Type `{expectedTypeName}' should have been kept"); - break; - case nameof (RemovedMemberInAssemblyAttribute): - if (linkedType == null) - continue; - - VerifyRemovedMemberInAssembly (checkAttrInAssembly, linkedType); - break; - case nameof (KeptMemberInAssemblyAttribute): - if (linkedType == null) - Assert.Fail ($"Type `{expectedTypeName}' should have been kept"); - - VerifyKeptMemberInAssembly (checkAttrInAssembly, linkedType); - break; - case nameof (RemovedForwarderAttribute): - if (linkedAssembly.MainModule.ExportedTypes.Any (l => l.Name == expectedTypeName)) - Assert.Fail ($"Forwarder `{expectedTypeName}' should have been removed"); - - break; - case nameof (KeptResourceInAssemblyAttribute): - VerifyKeptResourceInAssembly (checkAttrInAssembly); - break; - case nameof (RemovedResourceInAssemblyAttribute): - VerifyRemovedResourceInAssembly (checkAttrInAssembly); - break; - default: - UnhandledOtherAssemblyAssertion (expectedTypeName, checkAttrInAssembly, linkedType); - break; - } - } - } - } - } catch (AssemblyResolutionException e) { - Assert.Fail ($"Failed to resolve linked assembly `{e.AssemblyReference.Name}`. It must not exist in any of the output directories:\n\t{_linkedResolver.GetSearchDirectories ().Aggregate ((buff, s) => $"{buff}\n\t{s}")}\n"); - } - } - - void VerifyRemovedMemberInAssembly (CustomAttribute inAssemblyAttribute, TypeDefinition linkedType) - { - var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - foreach (var memberNameAttr in (CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments [2].Value) { - string memberName = (string) memberNameAttr.Value; - - // We will find the matching type from the original assembly first that way we can confirm - // that the name defined in the attribute corresponds to a member that actually existed - var originalFieldMember = originalType.Fields.FirstOrDefault (m => m.Name == memberName); - if (originalFieldMember != null) { - var linkedField = linkedType.Fields.FirstOrDefault (m => m.Name == memberName); - if (linkedField != null) - Assert.Fail ($"Field `{memberName}` on Type `{originalType}` should have been removed"); - - continue; - } - - var originalPropertyMember = originalType.Properties.FirstOrDefault (m => m.Name == memberName); - if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault (m => m.Name == memberName); - if (linkedProperty != null) - Assert.Fail ($"Property `{memberName}` on Type `{originalType}` should have been removed"); - - continue; - } - - var originalMethodMember = originalType.Methods.FirstOrDefault (m => m.GetSignature () == memberName); - if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault (m => m.GetSignature () == memberName); - if (linkedMethod != null) - Assert.Fail ($"Method `{memberName}` on Type `{originalType}` should have been removed"); - - continue; - } - - Assert.Fail ($"Invalid test assertion. No member named `{memberName}` exists on the original type `{originalType}`"); - } - } - - void VerifyKeptMemberInAssembly (CustomAttribute inAssemblyAttribute, TypeDefinition linkedType) - { - var originalType = GetOriginalTypeFromInAssemblyAttribute (inAssemblyAttribute); - foreach (var memberNameAttr in (CustomAttributeArgument[]) inAssemblyAttribute.ConstructorArguments [2].Value) { - string memberName = (string) memberNameAttr.Value; - - // We will find the matching type from the original assembly first that way we can confirm - // that the name defined in the attribute corresponds to a member that actually existed - var originalFieldMember = originalType.Fields.FirstOrDefault (m => m.Name == memberName); - if (originalFieldMember != null) { - var linkedField = linkedType.Fields.FirstOrDefault (m => m.Name == memberName); - if (linkedField == null) - Assert.Fail ($"Field `{memberName}` on Type `{originalType}` should have been kept"); - - continue; - } - - var originalPropertyMember = originalType.Properties.FirstOrDefault (m => m.Name == memberName); - if (originalPropertyMember != null) { - var linkedProperty = linkedType.Properties.FirstOrDefault (m => m.Name == memberName); - if (linkedProperty == null) - Assert.Fail ($"Property `{memberName}` on Type `{originalType}` should have been kept"); - - continue; - } - - var originalMethodMember = originalType.Methods.FirstOrDefault (m => m.GetSignature () == memberName); - if (originalMethodMember != null) { - var linkedMethod = linkedType.Methods.FirstOrDefault (m => m.GetSignature () == memberName); - if (linkedMethod == null) - Assert.Fail ($"Method `{memberName}` on Type `{originalType}` should have been kept"); - - continue; - } - - Assert.Fail ($"Invalid test assertion. No member named `{memberName}` exists on the original type `{originalType}`"); - } - } - - void VerifyKeptResourceInAssembly (CustomAttribute inAssemblyAttribute) - { - var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments [0].Value.ToString ()); - var resourceName = inAssemblyAttribute.ConstructorArguments [1].Value.ToString (); - - Assert.That (assembly.MainModule.Resources.Select (r => r.Name), Has.Member (resourceName)); - } - - void VerifyRemovedResourceInAssembly (CustomAttribute inAssemblyAttribute) - { - var assembly = ResolveLinkedAssembly (inAssemblyAttribute.ConstructorArguments [0].Value.ToString ()); - var resourceName = inAssemblyAttribute.ConstructorArguments [1].Value.ToString (); - - Assert.That (assembly.MainModule.Resources.Select (r => r.Name), Has.No.Member (resourceName)); - } - - protected TypeDefinition GetOriginalTypeFromInAssemblyAttribute (CustomAttribute inAssemblyAttribute) - { - var attributeValueAsTypeReference = inAssemblyAttribute.ConstructorArguments [1].Value as TypeReference; - if (attributeValueAsTypeReference != null) - return attributeValueAsTypeReference.Resolve (); - - var assembly = ResolveOriginalsAssembly (inAssemblyAttribute.ConstructorArguments [0].Value.ToString ()); - - var expectedTypeName = inAssemblyAttribute.ConstructorArguments [1].Value.ToString (); - var originalType = assembly.MainModule.GetType (expectedTypeName); - if (originalType == null) - throw new InvalidOperationException ($"Unable to locate the original type `{expectedTypeName}`"); - return originalType; - } - - Dictionary> BuildOtherAssemblyCheckTable (AssemblyDefinition original) - { - var checks = new Dictionary> (); - - foreach (var typeWithRemoveInAssembly in original.AllDefinedTypes ()) { - foreach (var attr in typeWithRemoveInAssembly.CustomAttributes.Where (IsTypeInOtherAssemblyAssertion)) { - var assemblyName = (string) attr.ConstructorArguments [0].Value; - List checksForAssembly; - if (!checks.TryGetValue (assemblyName, out checksForAssembly)) - checks [assemblyName] = checksForAssembly = new List (); - - checksForAssembly.Add (attr); - } - } - - return checks; - } - - protected virtual void UnhandledOtherAssemblyAssertion (string expectedTypeName, CustomAttribute checkAttrInAssembly, TypeDefinition linkedType) - { - throw new NotImplementedException ($"Type {expectedTypeName}, has an unknown other assembly attribute of type {checkAttrInAssembly.AttributeType}"); - } - - bool IsTypeInOtherAssemblyAssertion (CustomAttribute attr) - { - return attr.AttributeType.Resolve ().DerivesFrom (nameof (BaseInAssemblyAttribute)); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/SetupCompileInfo.cs b/external/linker/linker/Tests/TestCasesRunner/SetupCompileInfo.cs deleted file mode 100644 index e50a4bd1cc..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/SetupCompileInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class SetupCompileInfo { - public string OutputName; - public NPath[] SourceFiles; - public string[] Defines; - public string[] References; - public bool AddAsReference; - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/SourceAndDestinationPair.cs b/external/linker/linker/Tests/TestCasesRunner/SourceAndDestinationPair.cs deleted file mode 100644 index 762887a137..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/SourceAndDestinationPair.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class SourceAndDestinationPair { - public NPath Source; - public string DestinationFileName; - } -} diff --git a/external/linker/linker/Tests/TestCasesRunner/TestCaseCollector.cs b/external/linker/linker/Tests/TestCasesRunner/TestCaseCollector.cs deleted file mode 100644 index 7b0115345b..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/TestCaseCollector.cs +++ /dev/null @@ -1,162 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Mono.Cecil; -using Mono.Linker.Tests.TestCases; -using Mono.Linker.Tests.Extensions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseCollector { - private readonly NPath _rootDirectory; - private readonly NPath _testCaseAssemblyPath; - - public TestCaseCollector (string rootDirectory, string testCaseAssemblyPath) - : this (rootDirectory.ToNPath (), testCaseAssemblyPath.ToNPath ()) - { - } - - public TestCaseCollector (NPath rootDirectory, NPath testCaseAssemblyPath) - { - _rootDirectory = rootDirectory; - _testCaseAssemblyPath = testCaseAssemblyPath; - } - - public IEnumerable Collect () - { - return Collect (AllSourceFiles ()); - } - - public TestCase Collect (NPath sourceFile) - { - return Collect (new [] { sourceFile }).First (); - } - - public IEnumerable Collect (IEnumerable sourceFiles) - { - _rootDirectory.DirectoryMustExist (); - _testCaseAssemblyPath.FileMustExist (); - - using (var caseAssemblyDefinition = AssemblyDefinition.ReadAssembly (_testCaseAssemblyPath.ToString ())) { - foreach (var file in sourceFiles) { - TestCase testCase; - if (CreateCase (caseAssemblyDefinition, file, out testCase)) - yield return testCase; - } - } - } - - public IEnumerable AllSourceFiles () - { - _rootDirectory.DirectoryMustExist (); - - foreach (var file in _rootDirectory.Files ("*.cs")) { - yield return file; - } - - foreach (var subDir in _rootDirectory.Directories ()) { - if (subDir.FileName == "bin" || subDir.FileName == "obj" || subDir.FileName == "Properties") - continue; - - foreach (var file in subDir.Files ("*.cs", true)) { - - // Magic : Anything in a directory named Dependnecies is assumed to be a dependency to a test case - // and never a test itself - // This makes life a little easier when writing these supporting files as it removes some contraints you would previously have - // had to follow such as ensuring a class exists that matches the file name and putting [NotATestCase] on that class - if (file.Parent.FileName == "Dependencies") - continue; - - // Magic: Anything in a directory named Individual is expected to be ran by it's own [Test] rather than as part of [TestCaseSource] - if (file.Parent.FileName == "Individual") - continue; - - yield return file; - } - } - } - - public TestCase CreateIndividualCase (Type testCaseType) - { - _rootDirectory.DirectoryMustExist (); - _testCaseAssemblyPath.FileMustExist (); - - var pathRelativeToAssembly = $"{testCaseType.FullName.Substring (testCaseType.Module.Name.Length - 3).Replace ('.', '/')}.cs"; - var fullSourcePath = _rootDirectory.Combine (pathRelativeToAssembly).FileMustExist (); - - using (var caseAssemblyDefinition = AssemblyDefinition.ReadAssembly (_testCaseAssemblyPath.ToString ())) - { - TestCase testCase; - if (!CreateCase (caseAssemblyDefinition, fullSourcePath, out testCase)) - throw new ArgumentException ($"Could not create a test case for `{testCaseType}`. Ensure the namespace matches it's location on disk"); - - return testCase; - } - } - - private bool CreateCase (AssemblyDefinition caseAssemblyDefinition, NPath sourceFile, out TestCase testCase) - { - var potentialCase = new TestCase (sourceFile, _rootDirectory, _testCaseAssemblyPath); - - var typeDefinition = FindTypeDefinition (caseAssemblyDefinition, potentialCase); - - testCase = null; - - if (typeDefinition == null) { - Console.WriteLine ($"Could not find the matching type for test case {sourceFile}. Ensure the file name and class name match"); - return false; - } - - if (typeDefinition.HasAttribute (nameof (NotATestCaseAttribute))) { - return false; - } - - // Verify the class as a static main method - var mainMethod = typeDefinition.Methods.FirstOrDefault (m => m.Name == "Main"); - - if (mainMethod == null) { - Console.WriteLine ($"{typeDefinition} in {sourceFile} is missing a Main() method"); - return false; - } - - if (!mainMethod.IsStatic) { - Console.WriteLine ($"The Main() method for {typeDefinition} in {sourceFile} should be static"); - return false; - } - - testCase = potentialCase; - return true; - } - - private static TypeDefinition FindTypeDefinition (AssemblyDefinition caseAssemblyDefinition, TestCase testCase) - { - var typeDefinition = caseAssemblyDefinition.MainModule.GetType (testCase.ReconstructedFullTypeName); - - // For all of the Test Cases, the full type name we constructed from the directory structure will be correct and we can successfully find - // the type from GetType. - if (typeDefinition != null) - return typeDefinition; - - // However, some of types are supporting types rather than test cases. and may not follow the standardized naming scheme of the test cases - // We still need to be able to locate these type defs so that we can parse some of the metadata on them. - // One example, Unity run's into this with it's tests that require a type UnityEngine.MonoBehaviours to exist. This tpe is defined in it's own - // file and it cannot follow our standardized naming directory & namespace naming scheme since the namespace must be UnityEngine - foreach (var type in caseAssemblyDefinition.MainModule.Types) { - // Let's assume we should never have to search for a test case that has no namespace. If we don't find the type from GetType, then o well, that's not a test case. - if (string.IsNullOrEmpty (type.Namespace)) - continue; - - if (type.Name == testCase.Name) { - // This isn't foolproof, but let's do a little extra vetting to make sure the type we found corresponds to the source file we are - // processing. - if (!testCase.SourceFile.ReadAllText ().Contains ($"namespace {type.Namespace}")) - continue; - - return type; - } - } - - return null; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/TestCaseCompiler.cs b/external/linker/linker/Tests/TestCasesRunner/TestCaseCompiler.cs deleted file mode 100644 index 21034eeb67..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/TestCaseCompiler.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.CodeDom.Compiler; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using Mono.Linker.Tests.Extensions; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseCompiler { - protected readonly TestCaseMetadaProvider _metadataProvider; - protected readonly TestCaseSandbox _sandbox; - protected readonly ILCompiler _ilCompiler; - - public TestCaseCompiler (TestCaseSandbox sandbox, TestCaseMetadaProvider metadataProvider) - : this(sandbox, metadataProvider, new ILCompiler ()) - { - } - - public TestCaseCompiler (TestCaseSandbox sandbox, TestCaseMetadaProvider metadataProvider, ILCompiler ilCompiler) - { - _ilCompiler = ilCompiler; - _sandbox = sandbox; - _metadataProvider = metadataProvider; - } - - public NPath CompileTestIn (NPath outputDirectory, string outputName, IEnumerable sourceFiles, IEnumerable references, IEnumerable defines, NPath[] resources, string[] additionalArguments) - { - var originalReferences = references.Select (r => r.ToNPath ()).ToArray (); - var originalDefines = defines?.ToArray () ?? new string [0]; - - Prepare (outputDirectory); - - var compiledReferences = CompileBeforeTestCaseAssemblies (outputDirectory, originalReferences, originalDefines).ToArray (); - var allTestCaseReferences = originalReferences.Concat (compiledReferences).ToArray (); - - var options = CreateOptionsForTestCase ( - outputDirectory.Combine (outputName), - sourceFiles.Select (s => s.ToNPath ()).ToArray (), - allTestCaseReferences, - originalDefines, - resources, - additionalArguments); - var testAssembly = CompileAssembly (options); - - - // The compile after step is used by tests to mess around with the input to the linker. Generally speaking, it doesn't seem like we would ever want to mess with the - // expectations assemblies because this would undermine our ability to inspect them for expected results during ResultChecking. The UnityLinker UnresolvedHandling tests depend on this - // behavior of skipping the after test compile - if (outputDirectory != _sandbox.ExpectationsDirectory) - CompileAfterTestCaseAssemblies (outputDirectory, originalReferences, originalDefines); - - return testAssembly; - } - - protected virtual void Prepare (NPath outputDirectory) - { - } - - protected virtual CompilerOptions CreateOptionsForTestCase (NPath outputPath, NPath[] sourceFiles, NPath[] references, string[] defines, NPath[] resources, string[] additionalArguments) - { - return new CompilerOptions - { - OutputPath = outputPath, - SourceFiles = sourceFiles, - References = references, - Defines = defines.Concat (_metadataProvider.GetDefines ()).ToArray (), - Resources = resources, - AdditionalArguments = additionalArguments - }; - } - - protected virtual CompilerOptions CreateOptionsForSupportingAssembly (SetupCompileInfo setupCompileInfo, NPath outputDirectory, NPath[] sourceFiles, NPath[] references, string[] defines) - { - var allDefines = defines.Concat (setupCompileInfo.Defines ?? new string [0]).ToArray (); - var allReferences = references.Concat (setupCompileInfo.References?.Select (p => MakeSupportingAssemblyReferencePathAbsolute (outputDirectory, p)) ?? new NPath [0]).ToArray (); - return new CompilerOptions - { - OutputPath = outputDirectory.Combine (setupCompileInfo.OutputName), - SourceFiles = sourceFiles, - References = allReferences, - Defines = allDefines - }; - } - - private IEnumerable CompileBeforeTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines) - { - foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesBefore ()) - { - var options = CreateOptionsForSupportingAssembly (setupCompileInfo, outputDirectory, CollectSetupBeforeSourcesFiles (setupCompileInfo), references, defines); - var output = CompileAssembly (options); - if (setupCompileInfo.AddAsReference) - yield return output; - } - } - - private void CompileAfterTestCaseAssemblies (NPath outputDirectory, NPath[] references, string[] defines) - { - foreach (var setupCompileInfo in _metadataProvider.GetSetupCompileAssembliesAfter ()) - { - var options = CreateOptionsForSupportingAssembly (setupCompileInfo, outputDirectory, CollectSetupAfterSourcesFiles (setupCompileInfo), references, defines); - CompileAssembly (options); - } - } - - private NPath[] CollectSetupBeforeSourcesFiles (SetupCompileInfo info) - { - return CollectSourceFilesFrom (_sandbox.BeforeReferenceSourceDirectoryFor (info.OutputName)); - } - - private NPath[] CollectSetupAfterSourcesFiles (SetupCompileInfo info) - { - return CollectSourceFilesFrom (_sandbox.AfterReferenceSourceDirectoryFor (info.OutputName)); - } - - private static NPath[] CollectSourceFilesFrom (NPath directory) - { - var sourceFiles = directory.Files ("*.cs").ToArray (); - if (sourceFiles.Length > 0) - return sourceFiles; - - sourceFiles = directory.Files ("*.il").ToArray (); - if (sourceFiles.Length > 0) - return sourceFiles; - - throw new FileNotFoundException ($"Didn't find any sources files in {directory}"); - } - - protected static NPath MakeSupportingAssemblyReferencePathAbsolute (NPath outputDirectory, string referenceFileName) - { - // Not a good idea to use a full path in a test, but maybe someone is trying to quickly test something locally - if (Path.IsPathRooted (referenceFileName)) - return referenceFileName.ToNPath (); - - var possiblePath = outputDirectory.Combine (referenceFileName); - if (possiblePath.FileExists ()) - return possiblePath; - - return referenceFileName.ToNPath(); - } - - protected NPath CompileAssembly (CompilerOptions options) - { - if (options.SourceFiles.Any (path => path.ExtensionWithDot == ".cs")) - return CompileCSharpAssembly (options); - - if (options.SourceFiles.Any (path => path.ExtensionWithDot == ".il")) - return CompileIlAssembly (options); - - throw new NotSupportedException ($"Unable to compile sources files with extension `{options.SourceFiles.First ().ExtensionWithDot}`"); - } - - protected virtual NPath CompileCSharpAssembly (CompilerOptions options) - { - var compilerOptions = CreateCodeDomCompilerOptions (options); - var provider = CodeDomProvider.CreateProvider ("C#"); - var result = provider.CompileAssemblyFromFile (compilerOptions, options.SourceFiles.Select (p => p.ToString ()).ToArray ()); - if (!result.Errors.HasErrors) - return compilerOptions.OutputAssembly.ToNPath (); - - var errors = new StringBuilder (); - foreach (var error in result.Errors) - errors.AppendLine (error.ToString ()); - throw new Exception ("Compilation errors: " + errors); - } - - protected NPath CompileIlAssembly (CompilerOptions options) - { - return _ilCompiler.Compile (options); - } - - private CompilerParameters CreateCodeDomCompilerOptions (CompilerOptions options) - { - var compilerParameters = new CompilerParameters - { - OutputAssembly = options.OutputPath.ToString (), - GenerateExecutable = options.OutputPath.FileName.EndsWith (".exe") - }; - - compilerParameters.CompilerOptions = options.Defines?.Aggregate (string.Empty, (buff, arg) => $"{buff} /define:{arg}"); - - compilerParameters.ReferencedAssemblies.AddRange (options.References.Select (r => r.ToString ()).ToArray ()); - - if (options.Resources != null) - compilerParameters.EmbeddedResources.AddRange (options.Resources.Select (r => r.ToString ()).ToArray ()); - - if (options.AdditionalArguments != null) { - var combinedValues = options.AdditionalArguments.Aggregate (string.Empty, (buff, arg) => $"{buff} {arg}"); - compilerParameters.CompilerOptions = $"{compilerParameters.CompilerOptions} {combinedValues}"; - } - - return compilerParameters; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/TestCaseLinkerOptions.cs b/external/linker/linker/Tests/TestCasesRunner/TestCaseLinkerOptions.cs deleted file mode 100644 index b04db595c1..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/TestCaseLinkerOptions.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseLinkerOptions - { - public string CoreAssembliesAction; - public List> AssembliesAction = new List> (); - - public string Il8n; - public bool IncludeBlacklistStep; - public string KeepTypeForwarderOnlyAssemblies; - - public List> AdditionalArguments = new List> (); - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs b/external/linker/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs deleted file mode 100644 index 2f0f47ce4a..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/TestCaseMetadaProvider.cs +++ /dev/null @@ -1,160 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Mono.Cecil; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Cases.Expectations.Metadata; -using Mono.Linker.Tests.Extensions; -using Mono.Linker.Tests.TestCases; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseMetadaProvider { - protected readonly TestCase _testCase; - protected readonly AssemblyDefinition _fullTestCaseAssemblyDefinition; - protected readonly TypeDefinition _testCaseTypeDefinition; - - public TestCaseMetadaProvider (TestCase testCase, AssemblyDefinition fullTestCaseAssemblyDefinition) - { - _testCase = testCase; - _fullTestCaseAssemblyDefinition = fullTestCaseAssemblyDefinition; - // The test case types are never nested so we don't need to worry about that - _testCaseTypeDefinition = fullTestCaseAssemblyDefinition.MainModule.GetType (_testCase.ReconstructedFullTypeName); - - if (_testCaseTypeDefinition == null) - throw new InvalidOperationException ($"Could not find the type definition for {_testCase.Name} in {_testCase.SourceFile}"); - } - - public virtual TestCaseLinkerOptions GetLinkerOptions () - { - var tclo = new TestCaseLinkerOptions { - Il8n = GetOptionAttributeValue (nameof (Il8nAttribute), "none"), - IncludeBlacklistStep = GetOptionAttributeValue (nameof (IncludeBlacklistStepAttribute), false), - KeepTypeForwarderOnlyAssemblies = GetOptionAttributeValue (nameof (KeepTypeForwarderOnlyAssembliesAttribute), string.Empty), - CoreAssembliesAction = GetOptionAttributeValue (nameof (SetupLinkerCoreActionAttribute), null) - }; - - foreach (var assemblyAction in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerActionAttribute))) - { - var ca = assemblyAction.ConstructorArguments; - tclo.AssembliesAction.Add (new KeyValuePair ((string)ca [0].Value, (string)ca [1].Value)); - } - - foreach (var additionalArgumentAttr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (SetupLinkerArgumentAttribute))) - { - var ca = additionalArgumentAttr.ConstructorArguments; - var values = ((CustomAttributeArgument [])ca [1].Value)?.Select (arg => arg.Value.ToString ()).ToArray (); - tclo.AdditionalArguments.Add (new KeyValuePair ((string)ca [0].Value, values)); - } - - return tclo; - } - - public virtual IEnumerable GetReferencedAssemblies (NPath workingDirectory) - { - yield return workingDirectory.Combine ("Mono.Linker.Tests.Cases.Expectations.dll").ToString (); - yield return "mscorlib.dll"; - - foreach (var referenceAttr in _testCaseTypeDefinition.CustomAttributes.Where (attr => attr.AttributeType.Name == nameof (ReferenceAttribute))) { - yield return (string) referenceAttr.ConstructorArguments.First ().Value; - } - } - - public virtual IEnumerable GetResources () - { - return _testCaseTypeDefinition.CustomAttributes - .Where (attr => attr.AttributeType.Name == nameof (SetupCompileResourceAttribute)) - .Select (GetSourceAndRelativeDestinationValue); - } - - public virtual IEnumerable GetExtraLinkerSearchDirectories () - { - yield break; - } - - public bool IsIgnored (out string reason) - { - var ignoreAttribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault (attr => attr.AttributeType.Name == nameof (IgnoreTestCaseAttribute)); - if (ignoreAttribute != null) { - reason = (string)ignoreAttribute.ConstructorArguments.First ().Value; - return true; - } - - reason = null; - return false; - } - - public virtual IEnumerable AdditionalFilesToSandbox () - { - return _testCaseTypeDefinition.CustomAttributes - .Where (attr => attr.AttributeType.Name == nameof (SandboxDependencyAttribute)) - .Select (GetSourceAndRelativeDestinationValue); - } - - public virtual IEnumerable GetSetupCompileAssembliesBefore () - { - return _testCaseTypeDefinition.CustomAttributes - .Where (attr => attr.AttributeType.Name == nameof (SetupCompileBeforeAttribute)) - .Select (CreateSetupCompileAssemblyInfo); - } - - public virtual IEnumerable GetSetupCompileAssembliesAfter () - { - return _testCaseTypeDefinition.CustomAttributes - .Where (attr => attr.AttributeType.Name == nameof (SetupCompileAfterAttribute)) - .Select (CreateSetupCompileAssemblyInfo); - } - - public virtual IEnumerable GetDefines () - { - return _testCaseTypeDefinition.CustomAttributes - .Where (attr => attr.AttributeType.Name == nameof (DefineAttribute)) - .Select (attr => (string) attr.ConstructorArguments.First ().Value); - } - - public virtual string GetAssemblyName () - { - return GetOptionAttributeValue (nameof (SetupCompileAssemblyNameAttribute), "test.exe"); - } - - public virtual IEnumerable GetSetupCompilerArguments () - { - return _testCaseTypeDefinition.CustomAttributes - .Where (attr => attr.AttributeType.Name == nameof (SetupCompileArgumentAttribute)) - .Select (attr => (string) attr.ConstructorArguments.First ().Value); - } - - T GetOptionAttributeValue (string attributeName, T defaultValue) - { - var attribute = _testCaseTypeDefinition.CustomAttributes.FirstOrDefault (attr => attr.AttributeType.Name == attributeName); - if (attribute != null) - return (T) attribute.ConstructorArguments.First ().Value; - - return defaultValue; - } - - SourceAndDestinationPair GetSourceAndRelativeDestinationValue (CustomAttribute attribute) - { - var relativeSource = (string) attribute.ConstructorArguments.First ().Value; - var destinationFileName = (string) attribute.ConstructorArguments [1].Value; - var fullSource = _testCase.SourceFile.Parent.Combine (relativeSource); - return new SourceAndDestinationPair - { - Source = fullSource, - DestinationFileName = string.IsNullOrEmpty (destinationFileName) ? fullSource.FileName : destinationFileName - }; - } - - private SetupCompileInfo CreateSetupCompileAssemblyInfo (CustomAttribute attribute) - { - var ctorArguments = attribute.ConstructorArguments; - return new SetupCompileInfo - { - OutputName = (string) ctorArguments [0].Value, - SourceFiles = ((CustomAttributeArgument []) ctorArguments [1].Value).Select (arg => _testCase.SourceFile.Parent.Combine (arg.Value.ToString ())).ToArray (), - References = ((CustomAttributeArgument []) ctorArguments [2].Value)?.Select (arg => arg.Value.ToString ()).ToArray (), - Defines = ((CustomAttributeArgument []) ctorArguments [3].Value)?.Select (arg => arg.Value.ToString ()).ToArray (), - AddAsReference = ctorArguments.Count >= 5 ? (bool) ctorArguments [4].Value : true - }; - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/TestCaseSandbox.cs b/external/linker/linker/Tests/TestCasesRunner/TestCaseSandbox.cs deleted file mode 100644 index 9ef46540ba..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/TestCaseSandbox.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using Mono.Linker.Tests.Cases.Expectations.Assertions; -using Mono.Linker.Tests.Extensions; -using Mono.Linker.Tests.TestCases; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestCaseSandbox { - protected readonly TestCase _testCase; - protected readonly NPath _directory; - - public TestCaseSandbox (TestCase testCase) - : this (testCase, NPath.SystemTemp) - { - } - - public TestCaseSandbox (TestCase testCase, NPath rootTemporaryDirectory) - : this (testCase, rootTemporaryDirectory, string.Empty) - { - } - - public TestCaseSandbox (TestCase testCase, string rootTemporaryDirectory, string namePrefix) - : this (testCase, rootTemporaryDirectory.ToNPath (), namePrefix) - { - } - - public TestCaseSandbox (TestCase testCase, NPath rootTemporaryDirectory, string namePrefix) - { - _testCase = testCase; - var name = string.IsNullOrEmpty (namePrefix) ? "linker_tests" : $"{namePrefix}_linker_tests"; - _directory = rootTemporaryDirectory.Combine (name); - - _directory.DeleteContents (); - - InputDirectory = _directory.Combine ("input").EnsureDirectoryExists (); - OutputDirectory = _directory.Combine ("output").EnsureDirectoryExists (); - ExpectationsDirectory = _directory.Combine ("expectations").EnsureDirectoryExists (); - ResourcesDirectory = _directory.Combine ("resources").EnsureDirectoryExists (); - } - - public NPath InputDirectory { get; } - - public NPath OutputDirectory { get; } - - public NPath ExpectationsDirectory { get; } - - public NPath ResourcesDirectory { get; } - - public IEnumerable SourceFiles { - get { return _directory.Files ("*.cs"); } - } - - public IEnumerable LinkXmlFiles { - get { return InputDirectory.Files ("*.xml"); } - } - - public IEnumerable ResourceFiles => ResourcesDirectory.Files (); - - public virtual void Populate (TestCaseMetadaProvider metadataProvider) - { - _testCase.SourceFile.Copy (_directory); - - if (_testCase.HasLinkXmlFile) - _testCase.LinkXmlFile.Copy (InputDirectory); - - CopyToInputAndExpectations (GetExpectationsAssemblyPath ()); - - foreach (var dep in metadataProvider.AdditionalFilesToSandbox ()) { - dep.Source.FileMustExist ().Copy (_directory.Combine (dep.DestinationFileName)); - } - - foreach (var res in metadataProvider.GetResources ()) { - res.Source.FileMustExist ().Copy (ResourcesDirectory.Combine (res.DestinationFileName)); - } - - foreach (var compileRefInfo in metadataProvider.GetSetupCompileAssembliesBefore ()) - { - var destination = BeforeReferenceSourceDirectoryFor (compileRefInfo.OutputName).EnsureDirectoryExists (); - compileRefInfo.SourceFiles.Copy (destination); - } - - foreach (var compileRefInfo in metadataProvider.GetSetupCompileAssembliesAfter ()) - { - var destination = AfterReferenceSourceDirectoryFor (compileRefInfo.OutputName).EnsureDirectoryExists (); - compileRefInfo.SourceFiles.Copy (destination); - } - } - - private static NPath GetExpectationsAssemblyPath () - { - return new Uri (typeof (KeptAttribute).Assembly.CodeBase).LocalPath.ToNPath (); - } - - protected void CopyToInputAndExpectations (NPath source) - { - source.Copy (InputDirectory); - source.Copy (ExpectationsDirectory); - } - - public NPath BeforeReferenceSourceDirectoryFor (string outputName) - { - return _directory.Combine ($"ref_source_before_{Path.GetFileNameWithoutExtension (outputName)}"); - } - - public NPath AfterReferenceSourceDirectoryFor (string outputName) - { - return _directory.Combine ($"ref_source_after_{Path.GetFileNameWithoutExtension (outputName)}"); - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/TestCasesRunner/TestRunner.cs b/external/linker/linker/Tests/TestCasesRunner/TestRunner.cs deleted file mode 100644 index 4654b3bcdc..0000000000 --- a/external/linker/linker/Tests/TestCasesRunner/TestRunner.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System.Linq; -using Mono.Cecil; -using Mono.Linker.Tests.TestCases; -using NUnit.Framework; - -namespace Mono.Linker.Tests.TestCasesRunner { - public class TestRunner { - private readonly ObjectFactory _factory; - - public TestRunner (ObjectFactory factory) - { - _factory = factory; - } - - public LinkedTestCaseResult Run (TestCase testCase) - { - using (var fullTestCaseAssemblyDefinition = AssemblyDefinition.ReadAssembly (testCase.OriginalTestCaseAssemblyPath.ToString ())) { - var metadataProvider = _factory.CreateMetadataProvider (testCase, fullTestCaseAssemblyDefinition); - - string ignoreReason; - if (metadataProvider.IsIgnored (out ignoreReason)) - Assert.Ignore (ignoreReason); - - var sandbox = Sandbox (testCase, metadataProvider); - var compilationResult = Compile (sandbox, metadataProvider); - PrepForLink (sandbox, compilationResult); - return Link (testCase, sandbox, compilationResult, metadataProvider); - } - } - - private TestCaseSandbox Sandbox (TestCase testCase, TestCaseMetadaProvider metadataProvider) - { - var sandbox = _factory.CreateSandbox (testCase); - sandbox.Populate (metadataProvider); - return sandbox; - } - - private ManagedCompilationResult Compile (TestCaseSandbox sandbox, TestCaseMetadaProvider metadataProvider) - { - var compiler = _factory.CreateCompiler (sandbox, metadataProvider); - var sourceFiles = sandbox.SourceFiles.Select(s => s.ToString()).ToArray(); - - var assemblyName = metadataProvider.GetAssemblyName (); - - var references = metadataProvider.GetReferencedAssemblies(sandbox.InputDirectory); - var resources = sandbox.ResourceFiles.ToArray (); - var additionalArguments = metadataProvider.GetSetupCompilerArguments ().ToArray (); - var inputAssemblyPath = compiler.CompileTestIn (sandbox.InputDirectory, assemblyName, sourceFiles, references, null, resources, additionalArguments); - - references = metadataProvider.GetReferencedAssemblies(sandbox.ExpectationsDirectory); - var expectationsAssemblyPath = compiler.CompileTestIn (sandbox.ExpectationsDirectory, assemblyName, sourceFiles, references, new [] { "INCLUDE_EXPECTATIONS" }, resources, additionalArguments); - return new ManagedCompilationResult (inputAssemblyPath, expectationsAssemblyPath); - } - - protected virtual void PrepForLink (TestCaseSandbox sandbox, ManagedCompilationResult compilationResult) - { - } - - private LinkedTestCaseResult Link (TestCase testCase, TestCaseSandbox sandbox, ManagedCompilationResult compilationResult, TestCaseMetadaProvider metadataProvider) - { - var linker = _factory.CreateLinker (); - var builder = _factory.CreateLinkerArgumentBuilder (); - var caseDefinedOptions = metadataProvider.GetLinkerOptions (); - - builder.AddOutputDirectory (sandbox.OutputDirectory); - foreach (var linkXmlFile in sandbox.LinkXmlFiles) - builder.AddLinkXmlFile (linkXmlFile); - - builder.AddSearchDirectory (sandbox.InputDirectory); - foreach (var extraSearchDir in metadataProvider.GetExtraLinkerSearchDirectories ()) - builder.AddSearchDirectory (extraSearchDir); - - builder.ProcessOptions (caseDefinedOptions); - - AddAdditionalLinkOptions (builder, metadataProvider); - - // TODO: Should be overridable - builder.LinkFromAssembly (compilationResult.InputAssemblyPath.ToString ()); - - linker.Link (builder.ToArgs ()); - - return new LinkedTestCaseResult (testCase, compilationResult.InputAssemblyPath, sandbox.OutputDirectory.Combine (compilationResult.InputAssemblyPath.FileName), compilationResult.ExpectationsAssemblyPath); - } - - protected virtual void AddAdditionalLinkOptions (LinkerArgumentBuilder builder, TestCaseMetadaProvider metadataProvider) - { - } - } -} \ No newline at end of file diff --git a/external/linker/linker/Tests/Tests/PreserveActionComparisonTests.cs b/external/linker/linker/Tests/Tests/PreserveActionComparisonTests.cs deleted file mode 100644 index 21c8814685..0000000000 --- a/external/linker/linker/Tests/Tests/PreserveActionComparisonTests.cs +++ /dev/null @@ -1,30 +0,0 @@ -using NUnit.Framework; - -namespace Mono.Linker.Tests -{ - [TestFixture] - public class PreserveActionComparisonTests - { - [TestCase (TypePreserve.All, TypePreserve.All, TypePreserve.All)] - [TestCase (TypePreserve.All, TypePreserve.Methods, TypePreserve.All)] - [TestCase (TypePreserve.All, TypePreserve.Fields, TypePreserve.All)] - [TestCase (TypePreserve.All, TypePreserve.Nothing, TypePreserve.All)] - [TestCase (TypePreserve.Methods, TypePreserve.All, TypePreserve.All)] - [TestCase (TypePreserve.Methods, TypePreserve.Methods, TypePreserve.Methods)] - [TestCase (TypePreserve.Methods, TypePreserve.Fields, TypePreserve.All)] - [TestCase (TypePreserve.Methods, TypePreserve.Nothing, TypePreserve.Methods)] - [TestCase (TypePreserve.Fields, TypePreserve.All, TypePreserve.All)] - [TestCase (TypePreserve.Fields, TypePreserve.Methods, TypePreserve.All)] - [TestCase (TypePreserve.Fields, TypePreserve.Fields, TypePreserve.Fields)] - [TestCase (TypePreserve.Fields, TypePreserve.Nothing, TypePreserve.Fields)] - [TestCase (TypePreserve.Nothing, TypePreserve.All, TypePreserve.All)] - [TestCase (TypePreserve.Nothing, TypePreserve.Methods, TypePreserve.Methods)] - [TestCase (TypePreserve.Nothing, TypePreserve.Fields, TypePreserve.Fields)] - [TestCase (TypePreserve.Nothing, TypePreserve.Nothing, TypePreserve.Nothing)] - public void VerifyBehaviorOfChoosePreserveActionWhichPreservesTheMost (TypePreserve left, TypePreserve right, TypePreserve expected) - { - Assert.That (expected, Is.EqualTo (AnnotationStore.ChoosePreserveActionWhichPreservesTheMost (left, right))); - Assert.That (expected, Is.EqualTo (AnnotationStore.ChoosePreserveActionWhichPreservesTheMost (right, left))); - } - } -} diff --git a/external/linker/linker/Tests/packages.config b/external/linker/linker/Tests/packages.config deleted file mode 100644 index e49d840c2a..0000000000 --- a/external/linker/linker/Tests/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/external/linker/monobuild/Makefile b/external/linker/monobuild/Makefile index 53e90f2094..c3fc895dc3 100644 --- a/external/linker/monobuild/Makefile +++ b/external/linker/monobuild/Makefile @@ -14,6 +14,7 @@ prepare: # A hack for project.assets.json issues rm -f ../cecil/obj/project.assets.json rm -f ../cecil/symbols/pdb/obj/project.assets.json + rm -f ../cecil/symbols/mdb/obj/project.assets.json rm -f ../linker/obj/project.assets.json check: prepare diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.CSharp.dll.REMOVED.git-id b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.CSharp.dll.REMOVED.git-id new file mode 100644 index 0000000000..34bf0cda6b --- /dev/null +++ b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.CSharp.dll.REMOVED.git-id @@ -0,0 +1 @@ +18d27fde02993081f70898bacdbdb86cc5762135 \ No newline at end of file diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.dll.REMOVED.git-id b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.dll.REMOVED.git-id new file mode 100644 index 0000000000..4668437d3c --- /dev/null +++ b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/Microsoft.CodeAnalysis.dll.REMOVED.git-id @@ -0,0 +1 @@ +be7bd77be1669cc76e41f38f14fc4708e06e8960 \ No newline at end of file diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Collections.Immutable.dll.REMOVED.git-id b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Collections.Immutable.dll.REMOVED.git-id new file mode 100644 index 0000000000..f621878df3 --- /dev/null +++ b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Collections.Immutable.dll.REMOVED.git-id @@ -0,0 +1 @@ +ce6fc0e8d0d43a3e824b4a844fe5eae4667dd428 \ No newline at end of file diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Reflection.Metadata.dll.REMOVED.git-id b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Reflection.Metadata.dll.REMOVED.git-id new file mode 100644 index 0000000000..469c933c5d --- /dev/null +++ b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/System.Reflection.Metadata.dll.REMOVED.git-id @@ -0,0 +1 @@ +ee68731c052c101cd85d9f4ec976628cf1e224b4 \ No newline at end of file diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe new file mode 100644 index 0000000000000000000000000000000000000000..f2c679ce43c356f02b6c027c795489c3500d5412 GIT binary patch literal 46080 zcmce^73`C?n^qfftA+uBz8`>eIknVIm=`}^bf zi_YGAt-bf!Yp=c5+H3D~W?1^^Yso`I20s7(H_^k$`ERbIAD;}PIyC0HA$lP2T1Gcrvj`u~o;{E;BV01$wY7g~Cd-|gb+S;RiR(GPIpdfgfLwfl_q9vM# z&VQrgZ|-PEX)NVwjYQu7#;>qPo<<(U=O{kRT@;zF_(q9LPWUgX37(4{TK`$1Lis{q{D*=2q`%3#=U`EaV-cd@L^LjH^w3$z!BLp>UC4~m zvRDynOOI(mb5aGxiUH`yOlY8)EJ4{SMFMU-78KLWt0UjU8c(bYND!<9y>XxiQH7C8 zXTvJzZWTykqmcxUm=mZtc!bP}q+$7a^wE_dg~C`pR*5Dwu|`i}M1ylIyD@Pd223+X zH`0RGSX!EdG|gewvNER(j*N*DcUOVLn03driI^W~V+2%$DTe8pn3R`_^XdW=t41^7 zpXK1A-=Q5w2$Oewy*VLPgW5umXE)Zw7++sDVRs7($IKMVVGQcV4|5IEtc!t%x}X`+ zB6`FVF(TgBSTukHi+o|76o;$&j<&@Mu3HA7Uf0qV&l0YKb${lECHIpP(h?12Em!J)0w`D_19IC?z3XR z8D0y^X%?AbQwa&fQ`qmU)ppDo;>6k)ub?qiu`|%ahH?$qpf?aht6(rzht!&cB+qBn zBlB4eNNw2VKg(Q{2FUo(Bu+D1b>pPkr<&4rDt4VfV$_9?Wnpyei} zIt%5XS$xc+WQ&rP@1GQ=i04=d7Q8Z0WW0V8XwZ?!gb~QgfHN(atXYJWUkLfq+4!K3 zVZevo|GzSaNAdNmo*i3Pjf<_pgFs5}08YO3gnHaREE(rq;LVUG3Y}6H( zI_sZhEmyu8&6`gVC0}I^ex7#>cFFb-#4^D;VatY|u?Jmvg({$32$jkoc&Rk6uFj70 z(qm3R zU|9^NSSQN`pMW)2J^^|mJ^||{Ip!fb_%tT&W*@;V;3K$!?oD&O9x~EWf0hm79f(1N zc~vJCH3kT4Ofa7?dB)clOc>>1?_)}fAd~_c5%NZ~V0;1E)7}=@pXu(kmtRr`tJ? zEyg(MbGcZOZsjb+Kpwmd#h_Dl<}QX~s0s=XC=j$LoP_=f4;#6YC%uU?BfXh3MKr<1 zl5{s`DFzf#hz>*B7E2mjOi=iwn98#~@LmTiF<- zf5M4kTgmu)=;IR7ZS)?9LE(*x^FSFJ;Il7>}%(~FYJ2@{J6&@8^kJ5y)BJ+rE0Bp5|lG zR6>vA5Ivkd{+IQD{0vK=#kzp9Fh}T%KWtbKQn1K-Bnn>% z>BF-hDG|?Yx9QNOi-5xDUX1QVbtbMkruxY*Y`1OuQ5k3Z(L;Lk9U8p7U#{-y=_ z26YRj8XUwbX?Z{6RCuuWWg7TY11yM^AB!=szKFqlwpoH$gB3NOMC3^rdvIqUYyfRy zCxArQmQ}1=#60L$51It)5QP2iXAr&`i{}xve}Dn4EhvqzHzpL<6!E>YQKLa1L0Du@71npgf9ALi>C_HdYQ# zCYe-Rc&U%fGAQJp@f)f)H^T-bVS7(Ltwb|&^j7ls$ZoOIK1rFDyanJNxxQRQ>1 zCXqeG9RpGq9)jT@*4d9SLiTxXr4tS2ZuFSEF>x&Rb1Cf9`Q(882?%UOyupv+%$vqK zAdG|_dI=g!6(SGRnL&v~Bmjq8_Fy)#OOfCxV0bxdH1lHECxiL1%aIlYIA(=pB3^&M zg!BI_kUAe~5T5zMX4qS7VI;H2AMwXP!z>Cw6A?-BxZsRG(Ek)O1^Rl5*|M#N+i=hcQ9Ot$LdMA> z6fXy}DneoTs92|p$B&Rh1=*D#hU{}H+smZkuT0&;ge55Uh5QohNHE8Gix>l%4>}%$ z&mis;F^0zeP3iO~Er(C`G84!Xn~T1S9~UHSZdXb`ktM@Q5863VgbIDtRLxC(JS%K3h!=WdAlW#9;Lm_gV$L_SW~$~p_N zu+GBsLT6cl>XJ92eHw1l&{LdRHvx|F70)ppJJWcw{{{x^Jc9-Vdlg)gW}gR8j$Fx` z(R?TCpFtBfqA1V7PI7fG3)#LMMHQAfi06PXlps`#4}b{CQP-~Yq90FCwe?#6fpXcJ zkav=&tWGOk6Eu^z0F&p7*4o7@NB4evK< z4#y1MSnBU9*L}(P;5oB_6g8UEh;^!Exs_dwP*5LV8XeE<$RR;Ex|7kt@@Vb&_64T& z&)C2`^c{=7NobkG+E7%ET_G3*tzQA>X(%%XtuQGBtqiE3725@ZR)%By(QKm9!&cB6 z$Mm3ZLJ#t0dRS(Tg|QxPj14_uvQQt8Wk8Y57qSeW5MyH&;Uv^k=-$KqJn3(6W~Bd< zGZniZiWx;+2!Ocx^x-TS$pC;b3t>X7kmE|#PZah7605rpdl zL59^KBjfbHrt=8O$CscQ_JZA%eLUQ-q063}E=O@*2Bp)Te3UH_C^Cy?0y2uMR?w$Bc^5`iZ)4CJ24DiU-T@JwG z$2yre)G!AMm^d$oV{ANNtYYFEZo_~gh2<5$2+OC_b9gnAD?m@wDOfrYjss$l*-s3X zj|4}L0NH1OIwAPW&fB!U22PV-M z36`;bPjP0Xf5e$L{bSBz=b~Tw2`-kTf5=&i0kxXg@UWT;EA`+woA)Zr8*vHLD~L-k zICmok#p8Phl!Mm2Nb-(ACZlkzu5COv8G^Z;2oE$dH0UB$rS2QuvePedw^$h!uiTeqGS;2upIB zpIn-R$_9s->4~4-J(tUHjYdflIvX6u`vVuVO)-&U?P0mQA4KvA?i&Iq)j;-DX)e#fwaugk-sU z5GYU@xTeSYE?^}I>%X|j`?QKx&g3y--vcseTHi+|2Bd5@0v;Nr{!vx`gWP&AEkr$B z1NPl%U}v-=*4?ZKkZN{yA>LTOyVQ4#uZTScI?kb(r!FC4#tpJ=X&jSK6VrytK+nwJ zkw_l-)HUiC(TB=L-k%5aDAEQ!;CKLfN0Yg4(#t({*}rgkwGB`b3S^qG8AxTO=j#%N zCZR7uj`sLyWU@2D9NOA@OX1>rg2LOFTg^?IIL@NG9?bFXfTxN<>3tlH^!RG||GWT{=CZ7fngAib(xM-Va zf0ij626A`~I!t`YzQ*q&&IV#PC+ZB_89>DN3|gu)te2m7)D6$&UJc2epgr8e<;+ZL zJQjEeW)aH9=VNYD)jFh5MzFR(QiuoTMM&9)K*(~%Y+BEO244t6{RQK*eyT8#ma|zRgU3a` zS=QjI3(j1k6U{sw^`Nv2mFg-xpOP1V`MlRJLXEy_DJs}m@k60W_mRviqkNELod@) z0`B@WpyYou(X}Y?92moUI-h8sGFPpMw*Xw46GOqnpaD3-C0)S9JdRyot;Yr{z)06atM7a#}jU&F%{v?*5DN%>AK z^ct5GprWL~QiK!cM@`KMO%|U~rPfPmCl8cf=0Y$MjJ<+F{UW_|d{C~M^>8q~0ZsLy zd|hstBf&^MKNhT`*H?m)p5j_OquRx}+-6qlC2nWX`z7e5JDGx>;w*h3mx~oD#Q-yg zJI7|Y2@(H!+(7AI6(o|Qj(Tbd*QMa!kivf$F|4_nUN5i^PN}lUa~$eQtzYrXMny)& zUgJV25{kXfQ=G4txm<=r=`N;_nPLc2EaoX5vGo*J6@~O&oF6NJCFagA6g$H6gX053 zoaP;w$cx9kD3dxex~Nbeb4&?SBp5D?{U3CqBPAp8zSvPl!Sl<~ zz~Jy1<#y$;Xq^wdTm(ib5ib0J#EPzLe8+d@HH*i73zP)0l^#8WEb z*^8ynQ(RjF^Wpqh3D#XHuE@uX{T}2d*v(+iT_xtj`U4Ng&nF(|)g-gLf!Fg~kmG8{ zn%GZ>H3cF8Wlf9p@(f>rbP`RodCn7aYKzgSwex-TK$k9?wo zN0DP>`U469Sl#jVTnXG*d`@N0uR;fAiaig4^-K(4)cNYVW?l-yh$qV-qx23`&-^r6 z)0l2ObupmWpCOl0>kXuAmcK@hGoCWf`C^_-Qun1(oE7N1hLGc7q=%m!W0~V1rl+_v zPv6B^j&*WR(E2S)o?{Z$E}QHJ#Z0!NGUxV5Pi+H2Pcet3utw(1f)0VV|BJN9i`Ogu zhYK8fypKZtLNO2FE^MTCac`GB1MERoVDE=K_Y_yM>2Q9m1d>+PA^aJ!4?t~#{pQKI zq9bQcK-4f1rUet+iSD4rnO&5}ww|2?bjIXU8X_tY>tC700yQh^Zvb#I<#6DvOOO5g z-`FQi)+=FNBpNnje@7!aQalnL`;f7$CoM~m;E#3cVSG9ucrWr6cot+C{8~V+UNPQ> z&sTx_20o|KpXt!MX3?KC<_7)Yl|p+}xPa^y%+`I{sHZMLBj?bl+n0$T7*!F)P;-<2 z0LN)49pt?SY3!do1N+KTQE&!X1HnqC)G&8VaaZeK=&E${6k7+gi>>3cobdwhMnSfY z${gk7T5KJhLI=1806YkXcL*>` zk9m%TCy@QTh=F-mXZvYjT{+w0yw{(EVC>WLPbI?~IVmBqcj8wsBz`O;`vP=zi5=Og z+TCYjsou4eE54uA{y{*SNtt^z^1pZ^-4shCjaf{)2% z04D0(>E#^C_>Six@bf9LhrMVs!k-S!JcpUrM_+v{=9Y$L820Zo%cG~h0EC`m^k_W= zPK?-kUQ2PXr%+-Z14?`YXRO4ZM?sXhN|bmKn9);Q3nk_(M~S(stHjtsdDzmJrojNA zrQn0pD8CnROqWwr5!qu3vbyy8e_<~AE@4y56g0Stnj16-B-DgdSrI+OtR!&x4c5X5 zTx44Cnj`1Mfs2|KJ1{jb4qQ$)F;i_FxeVHuWY`C<%vDmybYmVQNrNYjWr35{Q=D5~ z#_Z#H2405=u#(kdHy$&I1w5gc}$6^f0c$q@%)I zq^Fo{Kb}dz?CS5=Q^HP4co16Z5rZ3pFxwo12>UzPzFtH8guOzOMtrqpRC@1!ozTu<6*d~>tXEAfSGIGK-np;?OYL=xJSw-N-fpVF4xGg?`TM6!RJcqE0 z)7waXz3?20UrZY0xfWa1Ng4J!L8rTBtY*AsoI8;{){G&y1+NFUkafwdDno9tCR~Z= zMh0tHd?r}qGd-*N_wiYV5A-o(e~ic8LYJd}S8hh&tAKwBxHod}K*>J&FW@||$%Bnc+AG63_WDh!&au~LG0e8X2=%A2mr z_!L44 z&Tt4gh+NJnHKO0Gn1-I>N}N$R%h7M{>7G&S-;dC5=3}IOGw)gbW=KzEdDc_HY*xQr zX64Kx`mN3^!Y$4$BiQ9Li(*%)H&?Q)o{V4PIQ3>>v+|12Gs?@5tKQ5jw-D)PS}^3s zd%~1R4)NaKdE-%Mkt{x=-V*OY-9(S?hj9ONoPM(&zYkpDN%Xi5xXJjON{{hk9nBFv zJ_PQLi@j!mDB0sjWqhI&hGCP#Qrs^om*E*7Ko(mMW&Bvr$Ya1WewQpLj9 z+^aID*Yuon6307CnFSo?$Z4>{RMR*Hsi|qO!#vqM9ESy6>YjcC zB|XI{AA;m%_d*^7pK^Sn_%z^CH&u1wH+9XtBi;P|C-Qa4PfOn6)OHB8$hkzFV_yf^ zsfV@dVur_M?UnI&s-VcnL6J;c7A@?{y_m`3GZ!;%OvLw>+rS#1IVzC5e;gB)12+br z(I}tjV@>)z`kpPi`9p9d=Vb59o0tNE#ixNH`}ZT3{YSv*DXv*N(vv(X6;EZV^;Aw% zJ@sQ$bu&3tfA&Z$mLz3MJoZzlUO0!MV$bDXM8JT5FVW zTog|g@h~3aob?mjhS;ORE`4{e75-#GBlp@YKI4p9*xBHZ*N=}BpTXy3>&IuuQnZ;X z>xb>l@I>fX$vEChtuoALBGJ6|bLVO5Iz{f_w@qzmY?#tGrKuSmaof_1^tJJLXJ7LN0U$^m*FI?X^lwUXi@|e&3j?>Ro%Vl5-bbf#i&wQSK;3H; zqquBH`7bqB7Mt{H0jHnWuPhGIHRZu-lWrQzZCzgxxl@aSFMAX(C8#~7~t zYlPFoLgBPg%*nq(%aOK&6O(po|L~ghk))Q!Eg#Ki$}MGFzC)`8%{9^eVUv1&oW4-Z z=^DZJ3$?vMXP$@K|3bUIGDP!=TdPc(TvS^fq9Q53UC!hFyL@_Wgsv~+asM{%Y`o!p zUInLbkNW}A8vu=%dwI=N;WI7*IGlk1acX>9D98Quh9{#ON0(YmRD}lMhpKJN#6@)r5+f^eeWvc^k~Uz`9XT1l6#$9 z$&_alG0i*kc$L3X@^_RcK`Ts(V-%ATW$%|nXh!L^MIrjtI9`Rbt9dokz(abHT9Qr- zG3NJqEZeiox$iZ_Ea5FtE{_vx`||dON7MJQY9{?i(ym&r^%|Vs45^y*ZIRO3Qa&V7 z@{9Cl1)2X_t2sSV!08z!EU{N0u^=U*Jfnlqw;&xG9jq>;#u~;?uL)KMDNx1p3Xf&E zRh70@h3KMcp35T0+@!IhnJY_KGmm0LOqw^E(?I2FU@Al!KS#?T?S-`20%v(SWsftA z*92}Y4p!F-#Gd0ySV}V>_7QmF-K;KHh%#QHM$0S4R2N(TC`iL-`F%k3s0m5kJgGDJ zony2#OSvv6UZap6LR~r9O_jR)Dyj_BjRn8O!?ps9_f3uU$+Rr3hd4)nDmhHCIuiC@ER z;N|&^p>CPcI)R!1v6MDda?5Fe_-{JqP>(otGX^N6ZN>kSUyu20mC?Ux{!f03HV3zo zpGCj6T7EZb4s92xOQ5sy4K7b@A^jEWP>-AR9pphvrd$s>>=I~)K1afiAD1ya`koJc{x!qi-RttbNRbFX~9@@f{7C z<}bZRgXa$)&U+W>Ly|IuCVDg+#1|jlMXiTsgA)&Z2u?hBx0BQV7W_++?#8@4bcLkD z;LStVNcw|OT>e@Wr+aEgf!aQu)7$h{G!K0@%4uFLr|*w`MKkHA)ts*NaXN!}qu-h= zvBt_*uqDq#+CF@X_ajK)aY?Vh=+iorSb&^chE=P|=3+e#jFZ zux1U)A5?WBoeMdbR1)SikjE(n|B5yZW*2IIQ{0!QQH%B%E=0Taqgb84O1i?sm`6P} zY9|`Ikghl0LhU04RC@U!~s$@y3ULVQ4RIi6KeJ9X--&=VT=-OJ= z)qfZAC@!5pfKD@3)}>G@{I$+J?DTwq^#6E1g4`;NcabhJxct2F58xxv5XE7Z zCeLV1h9>I+OE{!?a6h?P_al8w=>LbO0ObcfWk`9BuD#4Hsmecp_<0|vAEsb zH=%YUZ)%h?D_#J;KAK&lS49ISiv*^6l=OIIzg|(BzdQ<;M%VcdjeY`da=k!L(%*^_ z@Ni#KkoG4)I^8GG9%>1X&-c(@1iGSp9CmKmZV@>%v>*fhNP9Y1pU>w9j;ep8JrQiq z&&xoM1Y7gN^kI|{m-#0IFEt{hVfSFDbM$-IF#`$$&9?jqzq5?LedT9VuF5Z_sRCW^ zf3W5Wy_n_-bOS9Nm&AAHHmiPgUCCOsTsKzw(It^h`DOGMfv%t)voF7#EAaQE_mYy~ z{7PCgj-kuwj*`#kbEMCIPkQetxjp|h1psOt`%wNwS}us|>6=yG!>g1R3$%~U122>4 zNe8;U=6m^*@LLDm^>UF?JrxLang6nJ>#+NjIFKe#wFAu(XuJb;2~@8jQ1Kh}v{az$ z{J--(p*PVwfo=fThx420PE|)A75qAXCh-@FATxS7&tK3&!vbALl|`cq7SJmWwAVbn zU@@)$~_^F7v+l|60{4} z5P#o`M_*aCtKc)VU!W(6wV;!pb|7B&4P@|b3&y*nCx=^TOfLAqZp=%;H1dQxi} zeYjvd-J>944cS4@2=pVW8C6I-=|u?FLG|^7U~e_I$CG04BbZeInd9e@z4P(oW>(uM?a5Rp*!#@J44E6-Ni-N(RI;e z-f$=jeZBg#p|5A^mKEF_`ZisX)9>4K(+DUwog3dk*MwWNZ_`ubT`|w0=Rh z<#V(_Al34x)a%r7%b(J}7G+!hl#U6+Eng2kPvwib?gm;={=3kB(_(?HpwmZ}gnmw2 z6@-?!A);LZsTsW}cW3U5UZid3G8HxYFKAdG)$$i~+A^+FbN>ZR5J*c`7(X3J=^kS`n*7@tMcTfRc)3Zz=TN*w}S zMo-Y6L$9J4;_FB@A>s^o``46@#AVTx-NJRC@?1n5r=qbT|SRk z5&OzYN}VN+Ct`C3C!5xZMxlbo#T&c;?5DzFwip=NrD) zRWwygZsYPc7o(4CNucJ(Nr-PtRj(TGqvLeKy<7~->cR?^kHRn=ofhH3#KkCX8L#2| z!KoLI1$4T=&t*$63jYVlM zSjb})7UG6Y!qgG)}F|UhTW@@VZDUqR-Q(K71<8tHW!m)0wbP4^AY^tr~qE)&-gjj4sxJ@1L3ki2pSDb4|9q8D|Zh<`yu8 zUa_6ERa(?b%_!pz8L5w6gSGnU#&H_-^NKQ^g7g!}O`~UI7B_+uoz5#`%-dqcN|H*> z%8s(BPP{H2u_;4r%1dlhe51f)trwZx3JYRyz%9A2;o!OK;+4-)?Qau*b+zzw8|I?X ziRm&(Sf{U`jmME*uAEP7pNqM=HcD^edkk;lo1SmdIDE$AGXb9%K4;)lhfjbw3JW8} zy(!WlYQ|L-;=6I2HcQ$fX{)3wBz+tyo&z8)p)<5`m6gjvJz~k~wrU@C#6`51)&>zzm99iuE(un(w9KWeGlmMSDcdd7aA9@ihQ`YGK^98DkApAWu?GvA*J-$VLl;Rp1B z-W~l1Rgq_`S39i#G*Y4+(CvaMZ3kU7b{x_x@?+Y2GWvTowWMBqNB?Eb6zx6zwXtVu znrBM11?j=O7A@e(ACsgH>B8VTdPjewW|4N9a2UW$7f=}KMlGye7&Y-mW~8W3tI)nt z@MUch^^f@g_rTny80jG`PA?VwSPOd|D|-d$qvL+1Re0WtyrDg=57hildqn?r*%1Uk3%JK_ot2VZV(`O4`2EKG0m-k1x{1-`o zIhxD;wMg{~qp#^Zv|#k_NS~@WrpM`$Jj1hBd%hyyvzBI77klD#R^SXzi|1d3Q#`F6 z*0iqT=sYdt&57I@;GlGB!WdOQ~d+C4iwPY2g}4uKO3>96y)d6@Gw()ocedLF@i zzwC+YcN@1L9j-dy+2{FsmexhqQLSfQ?OfxKzPX?Unl^jPA_FoR+ivV2 zyJQ{4Jq;(;1Nu*phNagd`o8EIV;#oYj1&Zojd%3C zv5j7?o#;KJ|1x}w=aBx#@DlIk^mK5Y_hx!7e33VfHGWw7q4z4$`6i>M!e{Q$i)$igi}7UiJ)9KT zf?AEA!*=4H^8%-tt;VlHb>=(z-Nox*ad(Y51bZwgTVUQSXY5(x0cO!USl{DVug{tX zJ-^St+FXE{e#v}Xy9Y7mt<*5)PV-KDC;Vaa9y;uMkCxE4eLq3@7WA4VwGT+`_oViF zf?pz|ERhjcXboeUeD7)I=$XC`HKy>Pb_>2tuIYCN7W*{)$HgmrE3^Y+SNon6YR?L_ z7lqo3LT!cg()5e)6mEqv>a>T^{-fF_d~uCAY0?*)FZo`RzQ2{ee~`X^kiHdKt^YmP z)EyW%uJPRC+FcmE74xm~S7?Tx%LmMuzeDELA)I#z=eq>6*O;hp^tVF(eg3$8e4g@|9v_JS?x3GYu`gHuXqzQ?H)gCGH$Dl z;i~)mP5KJ+A*2&apGBHBU-0iW%JhoB0fTkyps}*76%XcPG%6T^)Ek3-YNQoNr_%XB z9cR1Of)QFvJCODu^}{AUgLHt_2Lm)n38b&lMM#g51^jPm5b4`!8KOVXZuBbAxNn7| zVV%n*l8%?O8L6MHlJr{rTPRx6@c?ykUqsEwM zG#KX@R~g?mo-mFWe>DDOjPh1^$9SiC7kIn8L*6fVZ}UFr{h{}H?@QkIytB=7%{Ei> z-RkrCKjmNK-{U{x|Ii-|%n$Gh5Hv zaD|^oKsf}CbZ9ree~*X?-($sdW&Fkjo+smLA{2%8^KX%spyxECI-Y8mAzg;pQpc@s zCDK*sq2u=_@MUf2axMDkS~XHb8w1FXaxDc>9*d_a)kq6b9!JF}kE2qQ$KxlitC5aH zc>+y9c>;cT7{7!^lTeOP1IlO6WR%aKsVLXsJ2KTs&q8@j_}fJ{)4TLGbk zci`*wy?Vd#72_`BUgKv*yZ7JTa`P7RTjmeV-E9e}& zl+Sjy5Z`#1s~x6fo=yw2pU~Hp zmp>Cw?+-GNstIcKTk+wPD%p7G%` z2A?Rj3(|&s{gA64`)3|xng?0t;X9Q0l|y{azz4s81=$tBE90nxzb6Pk#)7}6khkDw za6WFR7_0QShppWk~O*$P%X~u~J z)X1QsNGo=Z8$ea@P$&)b3?yVCO_-N881J38V=$3inTU4_mS)+Bg`GN4=(6&E9VSBQq&PoZedP)6D)~# zYsl_OtZ$-aL%qH64ZU1!UD!X=m#`fOGT+#0(0MZ@$&r zi{()e&#kS$7i*S-6uEJ~rHR4KR`D5!0Nd@JK_xE$j*2ZyY+r6$U5RAUX~g5Ank6=w z77g`xt)EO?8&)Qgtasg$sdpe-#?oyaN+gw@PH{#>o*fl{yS&-e5~Oq-fpa)ocrhe^ zS0Z!RLI)Y%oZcn3GaeEVYLx~mMB?++4>hHnY=3wxTDGXX&R`2-< zJIN-gy2)s+Sx+Ng>!#_{eoo8eY119iBJYj&ZyJhkk|_YpnHZA+W&|0);0r3X(I@L9;enz1>NX26qBtq%?tm(>TGh=UaAyT@I>Q3^Qm`Vz6^n$D)}IcgWQ$jgT|2 zE(=LV>3L9~#jCMn5~@JVX@-u*lWJga&<`!(wm|nd`FuMOA51J&B8AWEa@-=XAXr1o zrB?S4C{p{5MCanf;POPm#+$UuSGLVx*xugRx@=L~%B3wGt!>Mwy`yDi z$ExLwa=JCNqQuxmovYdxws$Nzr)AlKB@5eW8FyOJxqM}7+sf9CwVm^qw6tT}T)DDs zWoP@U`AixQbLX#I*wV4Eb6H#G>egio+E!Ed_BHsdrET%vp+sjVfu9BO!8i;bsWit#fkoe-P1+N#U|Jysk2KQx&j8VIfzu0+@!%qZk5pl$}X=$Iyy}w zw+7L3j5DyK!&2o_>^o>9n~~EY*+pIWur{=IOSUxL4;Ah1*bKh9fx~p?57{=fFoWve zo+&0b$Khggwh;7Cb8%b%V5L}DI7=~$>vlaE+P64bkD{x6C~j6`3XdZgq9s-wow_mb zP*+zX(Vgff*k8iNzrV2sYXxnPS?Lz|tmd&-`)Y{&jwc?%Lx^;{*@IJ`v|^gzn;iyTKtFYSo<}J6mLG?kZ8jSuR=xWr7P-Q(4vD)8&@A z`*K*N%yB99doEjc&!(RKc&`gX8!X!e`kY3N-Ys!<9_n=WAn{2M?ZS(@Hls2@ka%nV zHb{czB|z6HL)r`bxAoXoKkq~5$L$`Dq9}0^+>)LRXqssPx0nlNgEMO7c-Kk_p;Lru z)DCMrC*I$UvADP#+p+_~@3D+KuzNe0`Mp-sErVaKS!7#%PVH($eooPi8CcE)Rj~)* zfHpF4eot};!EHR*)8+VTn%@rBHsC_p{SJ;leuLKD-)DD4nW*SODtG)FLsLFUWZ7MV-6|z4zvsm^!9X#cX2zc zf~$4QZmyhDW?L73E|!=@^|`SXwIq{?z74%Q+|C(u7KGZC8=Ms&mTX&pf|mAl*;dlp zIM~2?+5(l_k?ct}C;UciFu3g5gavjc8cg#Fyn?pwuDC@)!j0PFH&uQ7Lp>tuHkrG z4%uwg2}_=>a+zr#ObqabJhW+Zwz30(1&k2?Dq3PYcD-yx_jW9CZx(i`oYT{dEhLL~ z4TTlL5&DUht^FG<8!H2wjk^biY%7UTP?3c5>A{2%xMjqUqdzMXz442MMlxIP4$lD} zwt>xq*{bDn%&Nt<<2$mrZ1cW>cz;fXW6C@nhS<>4i#;;ijrTXWl=jVtVisPU=;8(9 z3jnbgu@5Po6Hh7tR-y{q*mmf=L}H+&7a=@t$&?(kQE?5$ySqDG-k{`GFWNe>-2$r* zR&_#c=Vl9ARQK_n5W_YkE>3W)-rlp5^R<$<;`r7R?`0IjZ5v&?Rly{p9pXdKLfAkz z1If;z!HrpvJwv9BfwrN+fg$XOZu1jSBYk9pqZ>@S!(vB2eX9D>AS^uIy+p1;mfMMq zJr^gsoeJgIPF8~pB>BQ20^JQsRf1z_gHLqN-2`}HKbw!TPB^7=dj|PLjwpE(httZ! z#00UNSh~%$sCNkIM(i>i;qnH-k(^szg!5*?7KkOFSf=HJw#y9y73>?h(wZOd?cIR* zi@MxGdm^z#xmTR=9RG3B^B-KOjiW@byFBesHe3?yXjqOfSa$UcpvKv4vj`Qbxjk}^ zU2PlKd2%F`A;=mIU*GRwoqc-MU{5cU)9z37PMO@$-J5Bi8NUT5iX zC_1I3Iag|wbcRs>#G}Z%6-Q@BD#YvC(z^+v;^5{!EV>P%cKha@J}3$jW}mr6@Hf;a z8adBG_!93|i^gH`i2*T|H+!y;5E+qxbMTj#f)!HsM8bZp>{#fHux#wji7jms!b+uM zCF0wLakm!RC6<3Nu)DW7zcrsX)Mv9r!`*$Cp?^J&(P zGdCOI^VJ}Q(cfqZW*)&pe=6cW8-00SrEEzr3@eK zi2-ceICRfPa4Ck!W;qYXI~!+KzShL)Q8L`l^zJ~|#-F#il+%{Y>FiV>_M6@%A7WVk8nra0^;n5Ci0+;4Ov*rwTc5YC&<bc38L#wJr`G0Jpcw z51{9WV z-<6du-6sAgW}TvBhzMkb9o%-g;-`6hdDFiQ8p*v!9vp~2~IRxoGj)77$G3WfxPy^pCA(f0D;2@a5jh*-t1jP(Fwls9@4cS|cByDKz-;B#*M}ITpwYD{| zBTDj>f?UaF!gEGBo-GFlQOh$rs8K(Mw2OMlB zt)dS><(iiu;@nV-oZ}tv&L*ykv*t|g>>R{DJAI040e3Mn0eAyDkt8kLiVK(|U)7Dw?!?r``+$*X7s7lHWYHoy(vmva(qR^)fp5iUV8RzI#ORu7_Ah9uyUd+6lFWYPvvk993 zw392<^^XI<)RmP>h~yyA-6};2!(n|3;>|igHbNdN<%Y|~}=n7nB?C6Pz zTB(de^D{gtb@X)MQ8q(el7bs36-Sl)bbu z-ogB|0`u@RM6Q`kuvYf^7N5B8yRy&caytn&T@roWo3(56y|&a&Kl^HjR;o{gmP;?j0ndZKxoZY=}MiH z-^+lGlXSHK4+%K1X|osh4XDoUlPp-e95&=#A>R`Gp2$4>62MBb2>Us{d4RJH%D5@O zo29*kher4b`Q=D0+UQ`~P&bHjA3i(rO$IJo=tp>)b6`YEs#q#D7JiUzC4LK~-|3g& zFL%_QkCEr&9nRy&YrwCd^x{9NT|jMkAifO$?okJI;>|fcSC`UqYC(PuQ9(E84}xw2 zDb_dJQ>YJoq`@CH%t_sA1V804b?-p^V)Z@aYbpr;}Ec%d_H+;_Z+Xo{Kx}Hv(dL z>^P2Y_em&k2OsdHC#mUyRHM$gv}zG}Q|rsvPv*G+trmlyLA(zh#~cQ+CO8set~Skf zsW#2W$at85e;3u2hPwhR5!Ml2sV?+(G-gyMdc=X{6^G30J5g3^)s25KPOV-$dNNHO z{hZv^;Z@*-HFTNNhsxCYH#qCe`DCm&dGIB1PbWV3mC_Qojq1BiC}go+;G_pQ)>ZO# z;9YBcSu@aq`AVs56?AYRw0Su`ZL|pXvji}ewBvnj)=qB6HLSUG-U3kCfc4u13upni zYRo}Mb0c`pu0VF(SWmfK9DP`0Giz4X4vz5F2P6>%ZClEaS=kcEhc%D2EvJ2jJI}#P z+g@o&MR8y@fh!)1=b6M$3wEH6HMb9R`bF1HY{k^M{$g<6C;g-7vk_Q2oyR|(D&tsl zExbdFJ8}M5#=7}vr7XkMk$IrRlE5nxsM!jLB>?HyuSQQhN1M9Qj(f8Pam|k0`JUc^ z8unXJQ2Lm5cVRt*gM*M*LeCZRj}&J~)kH zEVg*oePzK(;0N#@^UvOa?Qgr-O}~_I#{j%58)cd7A#q=al&z$}8G(PWf&bH*PW0Yt z6}zFEOeuk!bz~7Bv9s~Hy3ba^J}qlCj-H(T$zDRW+?3&$*G;W&AJNu@&=mG!YQNw) zwT7eZ*tH+*cn=IlOvB2C_TlxK~~qGjpB6W8Z*qimM_rix-1X6;md z2fIwch<))4m%C5wSD(w@C$=8fj&W`LMlPqykF%{X7jEQ0XENU#fn#bMTd|6{d}reg z*QZf^3tF>bFvU-9oy+ehwr&|21GhKvqxiVd43DkinOq;Jd9V_TPflgzy#E)p zRx4X^CFROQ?IF1ypZVk+T=`r}%$WD;tejjQ*9R@2X>NSQ`gpQg93R~=U9F`JI_~;n z6(yWp8fu4RZh6LPFW?=X&O6!u!F#3J#f~3!W_>$-}T6@RQz zSsS5F?vsVHd%3HhO^Eg8K_*Ny3dfhF$PTj$# zAHPWC!FxHMG)~d#{}V1NI5Etqt)D-b*4wW zAX^--`!;aE8!N*njz5U4mOT!iD)>y+hf=P+V?EZ6^f9h3Dc`^pd4}#PM6p@#fX4AW zb7``z@F*jqyw$6~ABP>x0o$$eDjbvHH4WzXzIpQ0R4n?*u=FwfJY^2GQ zbN7UiE#28c3b^Mu^-QUfh?$0J#)p}uMJH8(r^E?B1J}2)BK(& z!a@|nVFp7|OmG@$GC3W76WW%7JRk<|Wv(!sk zWOm5#AqCYC=!KXbaJuO+&^zS8zu;Hp3sr|oB3reP9tws0dbn5*m4t^h7mqhxs8ckASYz@_DMi74f103qf6VyVb_)U6-LWM%RP%jMee+GdG zQ_%-gy20OP1X9zz(#{*D>LLpGyrIaBP$aG6Yu=&oo<97u^i!@3( z(x@xOR2m+>6~8ZyOQ_+ix$_<^(&*|L0s-c#sxUdxC*6c5_-pVF3TWXD z=$D_>SjX2oBYT?BC*tFwz8@KWJTm-LWcaWiNrN3=gptR6EWGfZ+k8<>;&7x1o%O0w zK3{nFg~;$PBE!!G0=gcE>XAJMLcpQAs>%xmAAU*{;vo0mb4W}jvgbi)JGA5xGpbir zRab?4ex8Ml{;D2Qitv48dUy{8Hh30Q0iO|y48LCOMPDsc?Gff)=X6gKFuY>LJ)3Qb@=Q`Jr~hZ$M6dEO@98Wsgq_75MVFS_G);MZRDtavBifR#604nKItj zp~m3;bzjtgjf6tz>JRu}Y@!VKC*#9aP8l^i6b$PS*;4>>Vqsyj_?9o52*mG0p zund-ndx8Z(v#QZDGD)=VdZj*-92K1;T6Dc=-%YOG-6Y_C7u+u$@61)#I|Dw`&w3Y` z3Ps8EgI0`r3AV(u_ne^f8hi>OFrAGC+NKv|?IzJtzQ zLddWyWy(+l$+;QEWnWZSqZI@*<6=D433L+o1zsBS-P%S}p6Sa2$Km0R!owd%hA)q# z9dZX%r{ROgaSLIfr4A{fk3Xm*MYjOE01f(hwNzXkB8W)1KUfV{=S~F$#lI9-E(f!$ z9t53S)-JDvJ-Cd0PS{f2{k%mLYJ{y1%j1P}=OHk*%g*OUMGYC=&)R|t7!H{6V+({J zB>SW0&vV4!hl4Km1(4n4j&>DB(Dgj=3E@lY!z|nGqWNlbU3|Zg^a*TrJ zL8vVVwc%Sx;0yWCs+<( zfKsqGLiEG;u;u2+?jCFfEc+-dZz&hPvvb|~6;qGy^*8-s=K1$dUpCEu-`Sm)gntn{ zYj{7tk59%h;YV-qGh;duz$@EZn)r7B_#ZKN@L$)yrC+k?%9`zGeeuZNnNL^0sDC%{ zNVIzW+Br8o`K3h7=Wc!c?BbH&KX~>%;ihlq{d~$(e_CI=ss6_Dcbo41=JyNs`_3Hy zO8UFj;ZYy0z2?PVPW$bW=BpOY_r3j_PhCEtc=k6Be{jQP){Rg9ZSnFqZ(P^?>+;(d z9(jMu#Jb4hd!IcS+)D6_*F5_+NzeaQ!lG^d@3yiUx@J!*@ zkl^DtFi|N{}_aWbBh2}mGNT{rz66H%q9BRj`q zMhfv+VM;LQ*UdnH_Y~QZ3=9G6?-|92c2>V<#Kf95EJxT0WO6(sUQ!) zRI#lC@G;y7(JdNP@enGQGEC@)fa2FM((oIc+=Z@_@M%Py<1QT|jWjYlY_e)Y=GF(% zGR>qu$}~U7;32NO*JEP8P-Og44{nC<;`+N?<|Z-CYNjc>DnsKrsb$ubsd4*jIk^>s zZN~l+nOzlWfkW`~HWFDHSurYVMpn5%WNj5}+aFoQ8@XS{`e+4FPqUakAGC~Uzb0+}FgCj^?3vl;7c9{6bOE8sl&{*Oob(EQepLJ0JnFK`#{XB8)s_f-$ z?N;n@@X)oHhK;Jy1aU-1K1^*Y6o~Vg$T8!Pfb7<5LztCv!0?`+ULa9}8xrC8;i(}6 z7A^w5Krb&MoaPWsmY3^+@=#&8qcFS%Ld8G71CnWo8PQ>N6?6!yQb0bW{Kr}tlnAP| z8i7q7r0MD-Z_>~sKZ}~TD69s=0VYLDmwK>To*4P@;XLGvsWtM(c=q@m7(aXq{tYPh z$Q^p=YP=J&j9;U3-sHwRMEGKshIT%7NBAW!8r`sLVMpeBP?Mau@Mq&+znTsbq2f%H z^BX1nR#JrfL^Cx}wB2)wMtgQR??9?Iukg0?NxlNufcIqZ^^)XZa#D2p&<4B@gST5| zH#Sb5+Q@%XXG+$rpvK1Ojgtl8)K8l{ZOYW9DNWo`@La-Y+O$OD>> z^30~jX-ylO<1;5uNi=rNNOX5MH*TCfvvK+qH0hcVpD}fEys3G^)Q!`drZmr(F*A{9 zjBlJeW#-1IGvbNvDI2CInm0B#&zv$d9-rC0AwGR(Gk0q0?%ptSdSh4f^zP=#Q)W(S z+%Rp%hX1F%^9hlgisSf;_8{X?RH&ENpa-p!%w&?8%rZ0ELM;`$-Qt#lQdlzivksli zE|ckE5oCK61TWsa7Hm&KFG7(OPhJ$fEZ!`5(Tl~ipnkvaC6k%mRc9-L(9LX;P4e=4 zzn7PpN#^(YebbM;FlyH8aJh-??LOKPCiSr8H2R6ta-wDs_WP~6(~jE_N_c_SsI|kk z8`qM=?K`3GyOE2v9x8{a7V7ib^|oL0n{Y4j0zdToUfitJ!&)4{X0zRDG?HfGwfrRX zy;eJf?D?%*=z#Z1zH}C81*MuQPDjJP$6fH>biqkOJUi_G362_S06ITJGz?*Vbw?h$ z)skS{q)Ot;BydC})q>y3p21T)T*oT@T*t+)x`uEZ%eQLPDBi9%J+I+aYjq2irRiWI zneDSAJJ=QvNf}AS<@SWQh9`_nD_796V$f8UZi)X|3V+lm2>?4v7J)uH{SSH~;u0Pc z^XSG2xa-rC8X&$9>xOvy(amW@?a&-EtugX1kA-qq9h$?`oS?TQmKSwC2Q_hg0WY5| z#A6_c{~C0>j%-9zlZ6!s;-81+=HgZ~czAlBm`vlS&Jr4SX(79+bH2SxomAk{X&;0H~(9fn`aZ=+I#x>U(fGedH;p*@;$g&4Bzm7 zSuD-ZcW27s{fkdN0HMr@*ZMedtTHRrK7YI<bJ?aUYE zg&rQ(eaL#2+u>wx(B&lXGg_Rm8r=Q#R^#M1V*a zaClL0uPfNfNG|zUMq+bzQI+`Y#HXmnfKQA@>8M&kS(TRfymbShOYw3Q3?l&VJcsp+ z+LK$;++7iCr}-6FBuPp(mr*bBWGp>KX-;Roc@^z7rmY}%NOFQcmGl*DN{l@yRF-Au zNg0-LK~q@=rd-Ru5NHSP3vl$w4w9>2Tz`nZ(5!<%y_#^+zkIN>5zj+wNx!fp+pvWQ zBfZ-|tZf3Dci`FL?IjO(7M6yXmsS|9WW=tFeX2M+&QJQgnwMlR(Tk#=xI`A>px+;e z2KLkRGs!eYH}@Yc9w{GV4e?GwTHBa6g@;!IV-@R39qE2cQ4b^OQjlY1l#xVOC*O~p zfF?&ss+8;wuAeZRf%YW6QLz_WSKwd!!L7gQJ0X7hQHUQ5WlBvR-rwykzncyvQaA|t zcg?z0Gi97h3v^BB5>$Ot@+&Y3hDeX?nm6OjT<%pWogkNKkuWgIx+WBcmNMvnq(N3q z3pJK%xS1{mS!!+9O_>IxL4w<^;s#IE)~iT4wN;?&a}MDd$Z%?eo4&5Oa+666x#El! zY;BpgGB6q6$e@3dY%b`HV{$jtoaOnQdJ!w~loe#Zj|baGEZB&%1#LERo67FgOrHF( zIl9OzVmairYX;Eoq0Z6Rls5)C9jt36NIr{ogOm+>YNYffciW!zyJJtA->Y=&qGR+q XQ}*@|{`*ot*ZBcH)Q^Y9?+E+}tRo6O literal 0 HcmV?d00001 diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe.config b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe.config new file mode 100644 index 0000000000..bf36aec5f8 --- /dev/null +++ b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.exe.config @@ -0,0 +1,149 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.rsp b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.rsp new file mode 100644 index 0000000000..ce72ac60cf --- /dev/null +++ b/external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/csc.rsp @@ -0,0 +1,46 @@ +# Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +# This file contains command-line options that the C# +# command line compiler (CSC) will process as part +# of every compilation, unless the "/noconfig" option +# is specified. + +# Reference the common Framework libraries +/r:Accessibility.dll +/r:Microsoft.CSharp.dll +/r:System.Configuration.dll +/r:System.Configuration.Install.dll +/r:System.Core.dll +/r:System.Data.dll +/r:System.Data.DataSetExtensions.dll +/r:System.Data.Linq.dll +/r:System.Data.OracleClient.dll +/r:System.Deployment.dll +/r:System.Design.dll +/r:System.DirectoryServices.dll +/r:System.dll +/r:System.Drawing.Design.dll +/r:System.Drawing.dll +/r:System.EnterpriseServices.dll +/r:System.Management.dll +/r:System.Messaging.dll +/r:System.Runtime.Remoting.dll +/r:System.Runtime.Serialization.dll +/r:System.Runtime.Serialization.Formatters.Soap.dll +/r:System.Security.dll +/r:System.ServiceModel.dll +/r:System.ServiceModel.Web.dll +/r:System.ServiceProcess.dll +/r:System.Transactions.dll +/r:System.Web.dll +/r:System.Web.Extensions.Design.dll +/r:System.Web.Extensions.dll +/r:System.Web.Mobile.dll +/r:System.Web.RegularExpressions.dll +/r:System.Web.Services.dll +/r:System.Windows.Forms.dll +/r:System.Workflow.Activities.dll +/r:System.Workflow.ComponentModel.dll +/r:System.Workflow.Runtime.dll +/r:System.Xml.dll +/r:System.Xml.Linq.dll diff --git a/ikvm-native/Makefile.in b/ikvm-native/Makefile.in index 8ea02c1557..e1037e0360 100644 --- a/ikvm-native/Makefile.in +++ b/ikvm-native/Makefile.in @@ -83,14 +83,14 @@ subdir = ikvm-native DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -279,6 +279,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -307,6 +311,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/libgc/Makefile.am b/libgc/Makefile.am index 55cced5f57..807a32d628 100644 --- a/libgc/Makefile.am +++ b/libgc/Makefile.am @@ -49,7 +49,7 @@ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \ solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \ backgraph.c win32_threads.c \ pthread_support.c pthread_stop_world.c darwin_stop_world.c \ -openbsd_stop_world.c mach_dep.c $(asm_libgc_sources) +mach_dep.c $(asm_libgc_sources) # Include THREADDLLIBS here to ensure that the correct versions of # linuxthread semaphore functions get linked: diff --git a/libgc/Makefile.in b/libgc/Makefile.in index 2fa9652c35..a3b1aa193e 100644 --- a/libgc/Makefile.in +++ b/libgc/Makefile.in @@ -120,8 +120,8 @@ am__libmonogc_static_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c \ ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c \ solaris_threads.c specific.c stubborn.c typd_mlc.c backgraph.c \ win32_threads.c pthread_support.c pthread_stop_world.c \ - darwin_stop_world.c openbsd_stop_world.c mach_dep.c \ - powerpc_darwin_mach_dep.s ia64_save_regs_in_stack.s + darwin_stop_world.c mach_dep.c powerpc_darwin_mach_dep.s \ + ia64_save_regs_in_stack.s @POWERPC_DARWIN_FALSE@@TARGET_IA64_TRUE@am__objects_1 = ia64_save_regs_in_stack.lo @POWERPC_DARWIN_TRUE@am__objects_1 = powerpc_darwin_mach_dep.lo am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \ @@ -131,8 +131,8 @@ am__objects_2 = allchblk.lo alloc.lo blacklst.lo checksums.lo \ real_malloc.lo reclaim.lo solaris_pthreads.lo \ solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo \ backgraph.lo win32_threads.lo pthread_support.lo \ - pthread_stop_world.lo darwin_stop_world.lo \ - openbsd_stop_world.lo mach_dep.lo $(am__objects_1) + pthread_stop_world.lo darwin_stop_world.lo mach_dep.lo \ + $(am__objects_1) am_libmonogc_static_la_OBJECTS = $(am__objects_2) libmonogc_static_la_OBJECTS = $(am_libmonogc_static_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) @@ -150,8 +150,8 @@ am__libmonogc_la_SOURCES_DIST = allchblk.c alloc.c blacklst.c \ ptr_chck.c real_malloc.c reclaim.c solaris_pthreads.c \ solaris_threads.c specific.c stubborn.c typd_mlc.c backgraph.c \ win32_threads.c pthread_support.c pthread_stop_world.c \ - darwin_stop_world.c openbsd_stop_world.c mach_dep.c \ - powerpc_darwin_mach_dep.s ia64_save_regs_in_stack.s + darwin_stop_world.c mach_dep.c powerpc_darwin_mach_dep.s \ + ia64_save_regs_in_stack.s am_libmonogc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo \ checksums.lo dbg_mlc.lo dyn_load.lo finalize.lo gc_dlopen.lo \ gcj_mlc.lo headers.lo malloc.lo mallocx.lo mark.lo mark_rts.lo \ @@ -159,8 +159,8 @@ am_libmonogc_la_OBJECTS = allchblk.lo alloc.lo blacklst.lo \ ptr_chck.lo real_malloc.lo reclaim.lo solaris_pthreads.lo \ solaris_threads.lo specific.lo stubborn.lo typd_mlc.lo \ backgraph.lo win32_threads.lo pthread_support.lo \ - pthread_stop_world.lo darwin_stop_world.lo \ - openbsd_stop_world.lo mach_dep.lo $(am__objects_1) + pthread_stop_world.lo darwin_stop_world.lo mach_dep.lo \ + $(am__objects_1) libmonogc_la_OBJECTS = $(am_libmonogc_la_OBJECTS) libmonogc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -475,7 +475,7 @@ obj_map.c os_dep.c pcr_interface.c ptr_chck.c real_malloc.c reclaim.c \ solaris_pthreads.c solaris_threads.c specific.c stubborn.c typd_mlc.c \ backgraph.c win32_threads.c \ pthread_support.c pthread_stop_world.c darwin_stop_world.c \ -openbsd_stop_world.c mach_dep.c $(asm_libgc_sources) +mach_dep.c $(asm_libgc_sources) # Include THREADDLLIBS here to ensure that the correct versions of @@ -644,7 +644,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/new_hblk.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/obj_map.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/openbsd_stop_world.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_dep.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pcr_interface.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pthread_stop_world.Plo@am__quote@ diff --git a/libgc/configure.REMOVED.git-id b/libgc/configure.REMOVED.git-id index 31b69a50b7..7c98cb7a74 100644 --- a/libgc/configure.REMOVED.git-id +++ b/libgc/configure.REMOVED.git-id @@ -1 +1 @@ -8b83212143d2cd84c76c503d5accd3056bcbd80e \ No newline at end of file +d8b81a44012229ca8953acb20e2ff052421ebdd3 \ No newline at end of file diff --git a/libgc/configure.ac b/libgc/configure.ac index 7f5aa03148..628144d3a1 100644 --- a/libgc/configure.ac +++ b/libgc/configure.ac @@ -104,6 +104,10 @@ case "$THREADS" in AC_DEFINE(GC_AIX_THREADS) AC_DEFINE(_REENTRANT) ;; + *-*-haiku*) + AC_DEFINE(GC_HAIKU_THREADS) + AC_DEFINE(_REENTRANT) + ;; *-*-hpux*) AC_MSG_WARN("Only HP/UX 11 threads are supported.") AC_DEFINE(GC_HPUX_THREADS) diff --git a/libgc/dyn_load.c b/libgc/dyn_load.c index 5db3503aac..963f6e9542 100644 --- a/libgc/dyn_load.c +++ b/libgc/dyn_load.c @@ -59,7 +59,7 @@ !(defined(FREEBSD) && defined(__ELF__)) && \ !(defined(OPENBSD) && (defined(__ELF__) || defined(M68K))) && \ !(defined(NETBSD) && defined(__ELF__)) && !defined(HURD) && \ - !defined(DARWIN) + !defined(DARWIN) && !defined(HAIKU) --> We only know how to find data segments of dynamic libraries for the --> above. Additional SVR4 variants might not be too --> hard to add. @@ -1258,6 +1258,23 @@ GC_bool GC_register_main_static_data() #endif /* DARWIN */ +#if defined(HAIKU) + +#include + +void GC_register_dynamic_libraries() +{ + image_info info; + int32 cookie = 0; + while (get_next_image_info(0, &cookie, &info) == B_OK) + { + void *data = info.data; + GC_add_roots_inner(data, data + info.data_size, TRUE); + } +} + +#endif /* HAIKU */ + #else /* !DYNAMIC_LOADING */ #ifdef PCR diff --git a/libgc/include/gc_config_macros.h b/libgc/include/gc_config_macros.h index caf8de527c..55519b8ce3 100644 --- a/libgc/include/gc_config_macros.h +++ b/libgc/include/gc_config_macros.h @@ -57,7 +57,7 @@ defined(GC_HPUX_THREADS) || defined(GC_OSF1_THREADS) || \ defined(GC_DGUX386_THREADS) || defined(GC_DARWIN_THREADS) || \ defined(GC_AIX_THREADS) || defined(GC_NETBSD_THREADS) || \ - defined(GC_OPENBSD_THREADS) || \ + defined(GC_OPENBSD_THREADS) || defined(GC_HAIKU_THREADS) ||\ (defined(GC_WIN32_THREADS) && defined(__CYGWIN32__)) # define GC_PTHREADS # endif diff --git a/libgc/include/private/gc_priv.h b/libgc/include/private/gc_priv.h index ab77402e4c..53afd7828d 100644 --- a/libgc/include/private/gc_priv.h +++ b/libgc/include/private/gc_priv.h @@ -1979,6 +1979,8 @@ void GC_err_puts GC_PROTO((GC_CONST char *s)); /* Linuxthreads itself uses SIGUSR1 and SIGUSR2. */ # define SIG_SUSPEND SIGPWR # endif +# elif defined(GC_OPENBSD_THREADS) +# define SIG_SUSPEND SIGXFSZ # else /* !GC_LINUX_THREADS */ # if defined(_SIGRTMIN) # define SIG_SUSPEND _SIGRTMIN + 6 diff --git a/libgc/include/private/gcconfig.h b/libgc/include/private/gcconfig.h index 03305b61de..e2bdf13ac3 100644 --- a/libgc/include/private/gcconfig.h +++ b/libgc/include/private/gcconfig.h @@ -238,6 +238,16 @@ # define BEOS # define mach_type_known # endif +# if defined(__HAIKU__) && defined(_X86_) +# define I386 +# define HAIKU +# define mach_type_known +# endif +# if defined(__HAIKU__) && defined(__amd64__) +# define X86_64 +# define HAIKU +# define mach_type_known +# endif # if defined(LINUX) && (defined(i386) || defined(__i386__)) # define I386 # define mach_type_known @@ -1164,6 +1174,15 @@ extern int etext[]; # define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) # endif +# ifdef HAIKU +# define OS_TYPE "HAIKU" +# include +# define GETPAGESIZE() B_PAGE_SIZE + extern int etext[]; +# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) +# define DYNAMIC_LOADING +# define MPROTECT_VDB +# endif # ifdef SUNOS5 # define OS_TYPE "SUNOS5" extern int _etext[], _end[]; @@ -2134,6 +2153,15 @@ /* There seems to be some issues with trylock hanging on darwin. This should be looked into some more */ # endif +# ifdef HAIKU +# define OS_TYPE "HAIKU" +# include +# define GETPAGESIZE() B_PAGE_SIZE + extern int etext[]; +# define DATASTART ((ptr_t)((((word) (etext)) + 0xfff) & ~0xfff)) +# define DYNAMIC_LOADING +# define MPROTECT_VDB +# endif # ifdef FREEBSD # define OS_TYPE "FREEBSD" # ifndef GC_FREEBSD_THREADS @@ -2251,7 +2279,7 @@ # if defined(SVR4) || defined(LINUX) || defined(IRIX5) || defined(HPUX) \ || defined(OPENBSD) || defined(NETBSD) || defined(FREEBSD) \ || defined(DGUX) || defined(BSD) || defined(SUNOS4) \ - || defined(_AIX) || defined(DARWIN) || defined(OSF1) + || defined(_AIX) || defined(DARWIN) || defined(OSF1) || defined(HAIKU) # define UNIX_LIKE /* Basic Unix-like system calls work. */ # endif @@ -2507,6 +2535,9 @@ # if defined(SN_TARGET_PS3) extern void *ps3_get_mem (size_t size); # define GET_MEM(bytes) (struct hblk*) ps3_get_mem (bytes) +# elif defined(HAIKU) + ptr_t GC_haiku_get_mem(GC_word bytes); +# define GET_MEM(bytes) (struct hblk*)GC_haiku_get_mem(bytes) # else extern ptr_t GC_unix_get_mem(word size); # define GET_MEM(bytes) (struct hblk *)GC_unix_get_mem(bytes) diff --git a/libgc/include/private/openbsd_stop_world.h b/libgc/include/private/openbsd_stop_world.h deleted file mode 100644 index 7f423ad572..0000000000 --- a/libgc/include/private/openbsd_stop_world.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef GC_OPENBSD_STOP_WORLD_H -#define GC_OPENBSD_STOP_WORLD_H - -#if !defined(GC_OPENBSD_THREADS) -#error openbsd_stop_world.h included without GC_OPENBSD_THREADS defined -#endif - -struct thread_stop_info { - ptr_t stack_ptr; /* Valid only when stopped. */ -}; - -#endif diff --git a/libgc/include/private/pthread_support.h b/libgc/include/private/pthread_support.h index 0abbd242a8..d8ca758edc 100644 --- a/libgc/include/private/pthread_support.h +++ b/libgc/include/private/pthread_support.h @@ -8,8 +8,6 @@ #if defined(GC_DARWIN_THREADS) # include "private/darwin_stop_world.h" -#elif defined(GC_OPENBSD_THREADS) -# include "private/openbsd_stop_world.h" #else # include "private/pthread_stop_world.h" #endif diff --git a/libgc/openbsd_stop_world.c b/libgc/openbsd_stop_world.c deleted file mode 100644 index a4c927e6a3..0000000000 --- a/libgc/openbsd_stop_world.c +++ /dev/null @@ -1,161 +0,0 @@ -#include "private/pthread_support.h" - -/* derived from pthread_stop_world.c */ - -# if defined(GC_OPENBSD_THREADS) - -#define THREAD_EQUAL(id1, id2) pthread_equal(id1, id2) - -/* We hold allocation lock. Should do exactly the right thing if the */ -/* world is stopped. Should not fail if it isn't. */ -void GC_push_all_stacks() -{ - GC_bool found_me = FALSE; - size_t nthreads = 0; - int i; - GC_thread p; - ptr_t lo, hi; - pthread_t me = pthread_self(); - - if (!GC_thr_initialized) GC_thr_init(); -# if DEBUG_THREADS - GC_printf("Pushing stacks from thread 0x%x\n", (unsigned) me); -# endif - for (i = 0; i < THREAD_TABLE_SZ; i++) { - for (p = GC_threads[i]; p != 0; p = p -> next) { - if (p -> flags & FINISHED) continue; - ++nthreads; - if (THREAD_EQUAL(p -> id, me)) { -# ifdef SPARC - lo = (ptr_t)GC_save_regs_in_stack(); -# else - lo = GC_approx_sp(); -# endif - found_me = TRUE; - } else { - lo = p -> stop_info.stack_ptr; - } - if ((p -> flags & MAIN_THREAD) == 0) { - hi = p -> stack_end; - } else { - /* The original stack. */ - hi = GC_stackbottom; - } -# if DEBUG_THREADS - GC_printf("Stack for thread 0x%x = [%p,%p)\n", - (unsigned)(p -> id), lo, hi); -# endif - if (0 == lo) ABORT("GC_push_all_stacks: sp not set!\n"); -# ifdef STACK_GROWS_UP - /* We got them backwards! */ - GC_push_all_stack(hi, lo); -# else - GC_push_all_stack(lo, hi); -# endif - } - } - if (!found_me && !GC_in_thread_creation) - ABORT("Collecting from unknown thread."); -} - -/* We hold the allocation lock. Suspend all threads that might */ -/* still be running. */ -void GC_suspend_all() -{ - int i; - GC_thread p; - int result; - pthread_t my_thread = pthread_self(); - - for (i = 0; i < THREAD_TABLE_SZ; i++) { - for (p = GC_threads[i]; p != 0; p = p -> next) { - if (!THREAD_EQUAL(p -> id, my_thread)) { - if (p -> flags & FINISHED) continue; - if (p -> thread_blocked) /* Will wait */ continue; -# if DEBUG_THREADS - GC_printf("Suspending thread 0x%x\n", - (unsigned)(p -> id)); -# endif - - if (pthread_suspend_np(p -> id) != 0) - ABORT("pthread_suspend_np failed"); - - /* - * This will only work for userland pthreads. It will - * fail badly on rthreads. Perhaps we should consider - * a pthread_sp_np() function that returns the stack - * pointer for a suspended thread and implement in - * both pthreads and rthreads. - */ - p -> stop_info.stack_ptr = *(ptr_t*)((char *)p -> id + UTHREAD_SP_OFFSET); - } - } - } -} - -void GC_stop_world() -{ - int i; - - GC_ASSERT(I_HOLD_LOCK()); -# if DEBUG_THREADS - GC_printf("Stopping the world from 0x%x\n", (unsigned)pthread_self()); -# endif - - /* Make sure all free list construction has stopped before we start. */ - /* No new construction can start, since free list construction is */ - /* required to acquire and release the GC lock before it starts, */ - /* and we have the lock. */ -# ifdef PARALLEL_MARK - GC_acquire_mark_lock(); - GC_ASSERT(GC_fl_builder_count == 0); - /* We should have previously waited for it to become zero. */ -# endif /* PARALLEL_MARK */ - - GC_suspend_all(); - -# ifdef PARALLEL_MARK - GC_release_mark_lock(); -# endif - #if DEBUG_THREADS - GC_printf("World stopped from 0x%x\n", (unsigned)pthread_self()); - #endif -} - -/* Caller holds allocation lock, and has held it continuously since */ -/* the world stopped. */ -void GC_start_world() -{ - pthread_t my_thread = pthread_self(); - register int i; - register GC_thread p; - register int result; - -# if DEBUG_THREADS - GC_printf("World starting\n"); -# endif - - for (i = 0; i < THREAD_TABLE_SZ; i++) { - for (p = GC_threads[i]; p != 0; p = p -> next) { - if (!THREAD_EQUAL(p -> id, my_thread)) { - if (p -> flags & FINISHED) continue; - if (p -> thread_blocked) continue; - #if DEBUG_THREADS - GC_printf("Resuming thread 0x%x\n", - (unsigned)(p -> id)); - #endif - - if (pthread_resume_np(p -> id) != 0) - ABORT("pthread_kill failed"); - } - } - } -# if DEBUG_THREADS - GC_printf("World started\n"); -# endif -} - -void GC_stop_init() { -} - -#endif diff --git a/libgc/os_dep.c.REMOVED.git-id b/libgc/os_dep.c.REMOVED.git-id index 145511d12c..46e21f85f9 100644 --- a/libgc/os_dep.c.REMOVED.git-id +++ b/libgc/os_dep.c.REMOVED.git-id @@ -1 +1 @@ -191e4b4ed7d06a8ea02f73a38ea84b941fc758c5 \ No newline at end of file +dca79850754069953233f0376304a45583a842ec \ No newline at end of file diff --git a/libgc/pthread_stop_world.c b/libgc/pthread_stop_world.c index afa77dadfa..f93ce26b56 100644 --- a/libgc/pthread_stop_world.c +++ b/libgc/pthread_stop_world.c @@ -2,8 +2,7 @@ #if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \ && !defined(GC_IRIX_THREADS) && !defined(GC_WIN32_THREADS) \ - && !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS) \ - && !defined(GC_OPENBSD_THREADS) + && !defined(GC_DARWIN_THREADS) && !defined(GC_AIX_THREADS) #include #include diff --git a/libgc/pthread_support.c b/libgc/pthread_support.c index 097d588a7b..6d240f65f0 100644 --- a/libgc/pthread_support.c +++ b/libgc/pthread_support.c @@ -1135,7 +1135,7 @@ void GC_thr_init() # if defined(GC_HPUX_THREADS) GC_nprocs = pthread_num_processors_np(); # endif -# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) +# if defined(GC_OSF1_THREADS) || defined(GC_AIX_THREADS) || defined(GC_HAIKU_THREADS) GC_nprocs = sysconf(_SC_NPROCESSORS_ONLN); if (GC_nprocs <= 0) GC_nprocs = 1; # endif diff --git a/llvm/Makefile.in b/llvm/Makefile.in index c1ca676924..0b4ccb7800 100644 --- a/llvm/Makefile.in +++ b/llvm/Makefile.in @@ -95,14 +95,14 @@ DIST_COMMON = $(top_srcdir)/scripts/submodules/versions.mk \ $(top_srcdir)/mkinstalldirs subdir = llvm ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -214,6 +214,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -242,6 +246,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/m4/Makefile.in b/m4/Makefile.in index 8470b42fff..02a219a778 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -82,14 +82,14 @@ subdir = m4 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4 new file mode 100644 index 0000000000..f23196ced3 --- /dev/null +++ b/m4/ax_check_compile_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.63)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/man/Makefile.am b/man/Makefile.am index e59e357db5..c394dd2510 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -13,6 +13,7 @@ man_MANS = \ genxs.1 \ httpcfg.1 \ ilasm.1 \ + illinkanalyzer.1 \ lc.1 \ macpack.1 \ makecert.1 \ diff --git a/man/Makefile.in b/man/Makefile.in index bb8b8f59bc..b29c0e0ce4 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -82,14 +82,14 @@ subdir = man DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -233,6 +233,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -261,6 +265,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -399,6 +406,7 @@ man_MANS = \ genxs.1 \ httpcfg.1 \ ilasm.1 \ + illinkanalyzer.1 \ lc.1 \ macpack.1 \ makecert.1 \ diff --git a/man/illinkanalyzer.1 b/man/illinkanalyzer.1 new file mode 100644 index 0000000000..5ce3b9cde1 --- /dev/null +++ b/man/illinkanalyzer.1 @@ -0,0 +1,132 @@ +.TH illinkanalyzer 1 +.SH NAME +illinkanalyzer \- Mono's linker analyzer tool +.SH SYNOPSIS +.B illinkanalyzer +\fR[\fIoptions\fR] <\fIlinker-dependency-file.xml.gz\fR> +.SH DESCRIPTION +Linker analyzer is a command line tool to analyze dependencies, which +were recorded during linker processing, and led linker to mark an item +to keep it in the resulting linked assembly. +.PP +It works on an oriented graph of dependencies, which are collected and +dumped during the linker run. The vertices of this graph are the items +of interest like assemblies, types, methods, fields, linker steps, +etc. The edges represent the dependencies. +.SH HOW TO DUMP DEPENDENCIES +The linker analyzer needs a linker dependencies file as an input. It +can be retrieved by enabling dependencies dumping during linking of a +Xamarin.Android or a Xamarin.iOS project. +.PP +That can be done on the command line by setting LinkerDumpDependencies +property to true and building the project. (make sure the +LinkAssemblies task is called, it might require cleaning the project +sometimes) Usually it is enough to build the project like this: +.PP +.nf +.RS +rm -f obj/Release/link.flag +msbuild /p:LinkerDumpDependencies=true /p:Configuration=Release YourAppProject.csproj +.RE +.fi +.PP +After a successful build, there will be a linker-dependencies.xml.gz +file created, containing the information for the analyzer. +.SH OPTIONS +.nf +.RS + -a, --alldeps show all dependencies + --csvoutput=VALUE outputs types and optionally size analysis to CSV + file + -h, --help show this message and exit. + -l, --linkedpath=VALUE sets the linked assemblies directory path. Enables + displaying size estimates. + -r, --rawdeps=VALUE show raw vertex dependencies. Raw vertex VALUE is + in the raw format written by linker to the + dependency XML file. VALUE can be regular + expression + --roots show root dependencies. + --stat show statistic of loaded dependencies. + --tree reduce the dependency graph to the tree. + --types show all types dependencies. + -t, --typedeps=VALUE show type dependencies. The VALUE can be regular + expression + -f, --flat show all dependencies per vertex and their distance + -v, --verbose be more verbose. Enables stat and roots options. +.RE +.fi +.SH EXAMPLES +Let say you would like to know, why a type, Android.App.Activity for +example, was marked by the linker. So run the analyzer like this: +.PP +.nf +.RS +illinkanalyzer -t Android.App.Activity linker-dependencies.xml.gz +.fi +.RE +.PP +Output: +.PP +.nf +.RS +Loading dependency tree from: linker-dependencies.xml.gz + +--- Type dependencies: 'Android.App.Activity' ----------------------- + +--- TypeDef:Android.App.Activity dependencies ----------------------- +Dependency #1 + TypeDef:Android.App.Activity + | TypeDef:XA.App.MainActivity [2 deps] + | Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [3 deps] + | Other:Mono.Linker.Steps.ResolveFromAssemblyStep +.fi +.RE +.PP +The output contains dependencies string(s), starting with the type and +continuing with the item of interest, which depends on the type. The +dependency could be result of multiple reasons. For example the type +was referenced from a method, or the type was listed in the linker xml +file to be protected. +.PP +In our example there is only one dependency string called Dependency +#1. It shows us that the type Android.App.Activity was marked during +processing of type XA.App.MainActivity by the linker. In this case +because the MainActivity type is based on the Activity type and thus +the linker marked it and kept it in the linked assembly. We can also +see that there are 2 dependencies for the MainActivity class. Note +that in the string (above) we see only 1st dependency of the 2, the +dependency on the assembly XA.App. And finally the assembly vertex +depends on the ResolveFromAssemblyStep vertex. So we see that the +assembly was processed in the ResolveFromAssembly linker step. +.PP +Now we might want to see the MainActivity dependencies. That could be done by the following analyzer run: +.PP +.nf +.RS +illinkanalyzer -r TypeDef:XA.App.MainActivity linker-dependencies.xml.gz +.fi +.RE +.PP +Output: +.PP +.nf +.RS +Loading dependency tree from: linker-dependencies.xml.gz + +--- Raw dependencies: 'TypeDef:XA.App.MainActivity' ----------------- + +--- TypeDef:XA.App.MainActivity dependencies ------------------------ +Dependency #1 + TypeDef:XA.App.MainActivity + | Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [3 deps] + | Other:Mono.Linker.Steps.ResolveFromAssemblyStep +Dependency #2 + TypeDef:XA.App.MainActivity + | TypeDef:XA.App.MainActivity/<>c__DisplayClass1_0 [2 deps] + | TypeDef:XA.App.MainActivity [2 deps] + | Assembly:XA.App, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null [3 deps] + | Other:Mono.Linker.Steps.ResolveFromAssemblyStep +.fi +.RE +.SH SEE ALSO +\fBmsbuild\fR(1) diff --git a/man/mono.1 b/man/mono.1 index 5cac78c20a..9ac128167c 100644 --- a/man/mono.1 +++ b/man/mono.1 @@ -65,6 +65,45 @@ and See the description for .B MONO_IOMAP in the environment variables section for more details. +.SH METHOD DESCRIPTIONS +A number of diagnostic command line options take as argument a method +description. A method description is a textual representation that +can be used to uniquely identify a method. The syntax is as follows: +.nf +[namespace]classname:methodname[(arguments)] +.fi +.PP +The values in brackets are optional, like the namespace and the +arguments. The arguments themselves are either empty, or a +comma-separated list of arguments. Both the +\fBclassname\fR +and +\fBmethodname\fR +can be set to the special value '*' to match any values (Unix shell +users should escape the argument to avoid the shell interpreting +this). +.PP +The arguments, if present should be a comma separated list of types +either a full typename, or for built-in types it should use the +low-level ILAsm type names for the built-in types, +like 'void', 'char', 'bool', 'byte', 'sbyte', 'uint16', 'int16', 'uint', +'int', 'ulong', 'long', 'uintptr', 'intptr', 'single', 'double', 'string', 'object'. +.PP +Pointer types should be the name of the type, followed by a '*', +arrays should be the typename followed by '[' one or more commas (to +indicate the rank of the array), and ']'. +.PP +Generic values should use '<', one or more type names, separated by +both a comma and a space and '>'. +.PP +By-reference arguments should include a "&" after the typename. +.PP +Examples: +.nf +*:ctor(int) // All constructors that take an int as an argument +*:Main // Methods named Main in any class +*:Main(string[]) // Methods named Main that take a string array in any class +.fi .SH RUNTIME OPTIONS The following options are available: .TP @@ -1826,7 +1865,10 @@ 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. +method. This can be a comma-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). .TP \fBMONO_JIT_DUMP_METHOD\fR Enables sending of the JITs intermediate representation for a specified diff --git a/man/monolinker.1 b/man/monolinker.1 index 1ec7bcce81..3f8fa01164 100644 --- a/man/monolinker.1 +++ b/man/monolinker.1 @@ -202,7 +202,7 @@ Specify a parameter for a custom step. .SH COPYRIGHT Copyright (C) 2007 Novell, Inc (http://www.novell.com) .SH BUGS -Bugs report are welcome at http://bugzilla.xamarin.com +Bugs report are welcome at https://github.com/mono/linker/issues .PP Product Mono Tools, Component linker. .SH MAILING LISTS diff --git a/man/sqlsharp.1 b/man/sqlsharp.1 index 008fddbfc5..3b9b6b37f8 100644 --- a/man/sqlsharp.1 +++ b/man/sqlsharp.1 @@ -515,10 +515,10 @@ The Mono SQL Query Tool is released under the terms of the GNU GPL. Please read the accompanying `COPYING' file for details. Alternative licenses are available from Novell or Daniel Morgan. .SH BUGS -To report bugs in the compiler, you can use `bug-buddy', or you can +To report bugs in the compiler, you can file bug reports in our bug tracking system: .nf -http://bugzilla.xamarin.com. +https://github.com/mono/mono/issues .fi .PP .SH MAILING LISTS diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs index 92d8c78cd8..66d3503458 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.10.1.49"; + public const string MonoVersion = "5.12.0.220"; 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 = 1051000004; + public const int MonoCorlibVersion = 1051200002; #if MOBILE // Versions of .NET Framework for Silverlight 4.0 diff --git a/mcs/build/common/basic-profile-check.cs b/mcs/build/common/basic-profile-check.cs index df57d4bae8..9146477c4f 100644 --- a/mcs/build/common/basic-profile-check.cs +++ b/mcs/build/common/basic-profile-check.cs @@ -42,7 +42,7 @@ class X { Version min_mono_version; #if __MonoCS__ - min_mono_version = new Version (5, 9); + min_mono_version = new Version (5, 11); #else min_mono_version = new Version (4, 9); #endif diff --git a/mcs/build/library.make b/mcs/build/library.make index 43f97e42a0..e7e1a556cc 100644 --- a/mcs/build/library.make +++ b/mcs/build/library.make @@ -388,5 +388,11 @@ $(the_libdir)/.doc-stamp: $(the_lib) gen-deps: @echo "$(DEPS_TARGET_DIR): $(DEP_DIRS) $(DEP_LIBS)" >> $(DEPS_FILE) -update-corefx-sr: $(RESX_RESOURCE_STRING) - MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_RESOURCE_STRING) >corefx/SR.cs +update-corefx-sr-generic: +ifneq ($(RESX_STRINGS),) + MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/resx2sr.exe $(RESX_STRINGS) >$(SR_OUTPUT) +endif + +update-corefx-sr: $(RESX_RESOURCE_STRING) $(XTEST_RESX_RESOURCE_STRING) + make SR_OUTPUT=corefx/SR.cs RESX_STRINGS="$(RESX_RESOURCE_STRING)" update-corefx-sr-generic \ + && make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic \ No newline at end of file diff --git a/mcs/build/profiles/build.make b/mcs/build/profiles/build.make index d757d10b1c..a10cc31148 100644 --- a/mcs/build/profiles/build.make +++ b/mcs/build/profiles/build.make @@ -22,3 +22,5 @@ NO_TEST = yes NO_INSTALL = yes FRAMEWORK_VERSION = 4.5 +MONO_FEATURE_APPLETLS=1 + diff --git a/mcs/build/rules.make b/mcs/build/rules.make index d7baee55f3..4e5b41f350 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -161,7 +161,7 @@ gacutil = $(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)/gacutil.exe GACUTIL = MONO_PATH="$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) $(RUNTIME_FLAGS) $(gacutil) endif -STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update +STD_TARGETS = test run-test run-xunit-test run-test-ondotnet clean install uninstall doc-update $(STD_TARGETS): %: do-% @@ -288,6 +288,15 @@ dist-recursive: dist-local (cd $$d && $(MAKE) distdir=$$reldir/$$d $@) || exit 1 ; \ done +# function to dist files in groups of 100 entries to make sure we don't exceed shell char limits +define distfilesingroups +for f in $(wordlist 1, 100, $(1)) ; do \ + dest=`dirname "$(distdir)/$$f"` ; \ + $(MKINSTALLDIRS) $$dest && cp -p "$$f" $$dest || exit 1 ; \ +done +$(if $(word 101, $(1)), $(call distfilesingroups, $(wordlist 101, $(words $(1)), $(1)))) +endef + # The following target can be used like # # dist-local: dist-default @@ -296,17 +305,11 @@ dist-recursive: dist-local # Notes: # 1. we invert the test here to not end in an error if ChangeLog doesn't exist. # 2. we error out if we try to dist a nonexistant file. -# 3. we pick up Makefile, makefile, or GNUmakefile. +# 3. we pick up Makefile dist-default: -mkdir -p $(distdir) test '!' -f ChangeLog || cp ChangeLog $(distdir) - if test -f Makefile; then m=M; fi; \ - if test -f makefile; then m=m; fi; \ - if test -f GNUmakefile; then m=GNUm; fi; \ - for f in $${m}akefile $(DISTFILES) ; do \ - dest=`dirname "$(distdir)/$$f"` ; \ - $(MKINSTALLDIRS) $$dest && cp -p "$$f" $$dest || exit 1 ; \ - done + $(call distfilesingroups, Makefile $(DISTFILES)) if test -d Documentation ; then \ find . -name '*.xml' > .files ; \ tar cTf .files - | (cd $(distdir); tar xf -) ; \ diff --git a/mcs/build/tests.make b/mcs/build/tests.make index 288cfcae56..a3592ff80a 100644 --- a/mcs/build/tests.make +++ b/mcs/build/tests.make @@ -20,9 +20,15 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin ifndef NO_TEST test_nunit_lib = nunitlite.dll -xunit_core := xunit.core xunit.abstractions xunit.assert Xunit.NetCore.Extensions +xunit_core := xunit.core xunit.execution.desktop xunit.abstractions xunit.assert Xunit.NetCore.Extensions xunit_deps := 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 = $(xunit_test_lib)_RemoteExecuter.exe +xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs $(topdir)/../mcs/class/test-helpers/RemoteExecutorTestBase.Mono.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.Process.cs $(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs $(topdir)/../external/corefx/src/Common/src/System/PasteArguments.cs +endif + xunit_class_deps := xunit_libs_ref = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(xunit_core)) @@ -54,6 +60,7 @@ test_makefrag = $(depsdir)/$(test_lib).makefrag test_flags = $(test_nunit_ref) $(TEST_MCS_FLAGS) $(TEST_LIB_MCS_FLAGS) 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) @@ -64,7 +71,7 @@ xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll) xtest_response = $(depsdir)/$(xunit_test_lib).response xtest_makefrag = $(depsdir)/$(xunit_test_lib).makefrag -xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) +xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LIB_MCS_FLAGS) /unsafe ifeq ($(wildcard $(xtest_sourcefile)),) xtest_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources) @@ -108,7 +115,7 @@ run-test-local: run-test-lib run-test-ondotnet-local: run-test-ondotnet-lib ifdef TEST_WITH_INTERPRETER -TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,InterpreterNotWorking,CAS +TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,NotWorkingRuntimeInterpreter,CAS else TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,CAS endif @@ -224,7 +231,7 @@ ifdef HAVE_CS_TESTS $(test_lib_dir): mkdir -p $@ -$(test_lib_output): $(the_assembly) $(test_response) $(test_nunit_dep) $(test_lib_dir) +$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(test_lib_dir) $(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response) test_response_preprocessed = $(test_response)_preprocessed @@ -270,18 +277,21 @@ XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(P endif check: run-xunit-test-local -run-xunit-test: run-xunit-test-local xunit-test-local: $(xunit_test_lib) 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 +run-xunit-test-lib: xunit-test-local $(XTEST_REMOTE_EXECUTOR) @cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.desktop.dll xunit.execution.desktop.dll ok=:; \ PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xunit_test_lib) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) || ok=false; \ $$ok @rm -f xunit.execution.desktop.dll +# Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase) +$(XTEST_REMOTE_EXECUTOR): $(topdir)/../mcs/class/test-helpers/RemoteExecutorConsoleApp.cs + $(TEST_COMPILE) $(topdir)/../mcs/class/test-helpers/RemoteExecutorConsoleApp.cs -r:$(xunit_test_lib) $(xtest_flags) /debug- + $(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src) diff --git a/mcs/class/Facades/System.Memory/TypeForwarders.cs b/mcs/class/Facades/System.Memory/TypeForwarders.cs index 16cb66960b..60edc2eec4 100644 --- a/mcs/class/Facades/System.Memory/TypeForwarders.cs +++ b/mcs/class/Facades/System.Memory/TypeForwarders.cs @@ -20,28 +20,28 @@ // THE SOFTWARE. // +[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.MemoryExtensions))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Memory<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ReadOnlyMemory<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ReadOnlySpan<>))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Span<>))] +[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryHandle))] [assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.OperationStatus))] +[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.StandardFormat))] +[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Binary.BinaryPrimitives))] +[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))] // TODO: we don't have these types yet -//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.MemoryExtensions))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.SequencePosition))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.BuffersExtensions))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IBufferWriter<>))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IMemoryOwner<>))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IPinnable))] -//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryHandle))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryManager<>))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryPool<>))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequenceSegment<>))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequence<>))] -//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.StandardFormat))] -//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Binary.BinaryPrimitives))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Base64))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Formatter))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Parser))] -//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))] //[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.SequenceMarshal))] diff --git a/mcs/class/Facades/System.Net.Http.Rtc/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Http.Rtc/AssemblyInfo.cs new file mode 100644 index 0000000000..19cd3907a8 --- /dev/null +++ b/mcs/class/Facades/System.Net.Http.Rtc/AssemblyInfo.cs @@ -0,0 +1,35 @@ +// +// Copyright (c) 2013 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.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle ("System.Net.Http.Rtc")] +[assembly: AssemblyDescription ("System.Net.Http.Rtc")] +[assembly: AssemblyDefaultAlias ("System.Net.Http.Rtc")] +[assembly: AssemblyCompany ("Mono development team")] +[assembly: AssemblyProduct ("Mono Common Language Infrastructure")] +[assembly: AssemblyCopyright ("(c) Various Mono authors")] +[assembly: AssemblyVersion ("4.0.0.0")] +[assembly: AssemblyInformationalVersion ("4.0.0.0")] +[assembly: AssemblyFileVersion ("4.0.0.0")] diff --git a/mcs/class/Facades/System.Net.Http.Rtc/Makefile b/mcs/class/Facades/System.Net.Http.Rtc/Makefile new file mode 100644 index 0000000000..f730763a92 --- /dev/null +++ b/mcs/class/Facades/System.Net.Http.Rtc/Makefile @@ -0,0 +1,21 @@ +MCS_BUILD_DIR = ../../../build + +thisdir = class/Facades/System.Net.Http.Rtc +SUBDIRS = +include $(MCS_BUILD_DIR)/rules.make + +LIBRARY_SUBDIR = Facades +LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades + +LIBRARY = System.Net.Http.Rtc.dll + +KEYFILE = ../../msfinal.pub +SIGN_FLAGS = /delaysign /nowarn:1616,1699 +LIB_REFS = System +LIB_MCS_FLAGS = $(SIGN_FLAGS) + +PLATFORM_DEBUG_FLAGS = + +NO_TEST = yes + +include $(MCS_BUILD_DIR)/library.make diff --git a/mcs/class/Facades/System.Net.Http.Rtc/System.Net.Http.Rtc.dll.sources b/mcs/class/Facades/System.Net.Http.Rtc/System.Net.Http.Rtc.dll.sources new file mode 100644 index 0000000000..719628dc7c --- /dev/null +++ b/mcs/class/Facades/System.Net.Http.Rtc/System.Net.Http.Rtc.dll.sources @@ -0,0 +1,2 @@ +TypeForwarders.cs +AssemblyInfo.cs diff --git a/mcs/class/System/System.Net/IWebConnectionState.cs b/mcs/class/Facades/System.Net.Http.Rtc/TypeForwarders.cs similarity index 71% rename from mcs/class/System/System.Net/IWebConnectionState.cs rename to mcs/class/Facades/System.Net.Http.Rtc/TypeForwarders.cs index 7b032decbb..b8c87d21f3 100644 --- a/mcs/class/System/System.Net/IWebConnectionState.cs +++ b/mcs/class/Facades/System.Net.Http.Rtc/TypeForwarders.cs @@ -1,10 +1,5 @@ // -// IWebConnectionState.cs -// -// Author: -// Martin Baulig -// -// Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) +// 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 @@ -23,30 +18,8 @@ // 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 System.Net -{ - interface IWebConnectionState { - WebConnectionGroup Group { - get; - } - - ServicePoint ServicePoint { - get; - } - - bool Busy { - get; - } - - DateTime IdleSince { - get; - } - - bool TrySetBusy (); - - void SetIdle (); - } -} +#if false // it is forwarded to System.Net.Http.WebRequest.dll but doesn't actually exist there in the .NET 4.7.1 reference assemblies ... +[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Http.RtcRequestFactory))] +#endif diff --git a/mcs/class/Facades/System.Resources.Reader/AssemblyInfo.cs b/mcs/class/Facades/System.Resources.Reader/AssemblyInfo.cs new file mode 100644 index 0000000000..fe58b174b9 --- /dev/null +++ b/mcs/class/Facades/System.Resources.Reader/AssemblyInfo.cs @@ -0,0 +1,35 @@ +// +// 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.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle ("System.Resources.Reader")] +[assembly: AssemblyDescription ("System.Resources.Reader")] +[assembly: AssemblyDefaultAlias ("System.Resources.Reader")] +[assembly: AssemblyCompany ("Mono development team")] +[assembly: AssemblyProduct ("Mono Common Language Infrastructure")] +[assembly: AssemblyCopyright ("(c) Various Mono authors")] +[assembly: AssemblyVersion ("4.0.2.0")] +[assembly: AssemblyInformationalVersion ("4.0.0.0")] +[assembly: AssemblyFileVersion ("4.0.0.0")] diff --git a/mcs/class/Facades/System.Resources.Reader/Makefile b/mcs/class/Facades/System.Resources.Reader/Makefile new file mode 100644 index 0000000000..b16ae43ee3 --- /dev/null +++ b/mcs/class/Facades/System.Resources.Reader/Makefile @@ -0,0 +1,23 @@ +MCS_BUILD_DIR = ../../../build + +thisdir = class/Facades/System.Resources.Reader +SUBDIRS = +include $(MCS_BUILD_DIR)/rules.make + +LIBRARY_SUBDIR = Facades +LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades + +LIBRARY = System.Resources.Reader.dll + +KEYFILE = ../../msfinal.pub +SIGN_FLAGS = /delaysign /nowarn:1616,1699 +LIB_REFS = System +LIB_MCS_FLAGS = $(SIGN_FLAGS) + +PLATFORM_DEBUG_FLAGS = + +NO_TEST = yes + +include $(MCS_BUILD_DIR)/library.make + + diff --git a/mcs/class/Facades/System.Resources.Reader/System.Resources.Reader.dll.sources b/mcs/class/Facades/System.Resources.Reader/System.Resources.Reader.dll.sources new file mode 100644 index 0000000000..8e33d4ddea --- /dev/null +++ b/mcs/class/Facades/System.Resources.Reader/System.Resources.Reader.dll.sources @@ -0,0 +1,3 @@ +TypeForwarders.cs +AssemblyInfo.cs + diff --git a/mcs/class/Facades/System.Resources.Reader/TypeForwarders.cs b/mcs/class/Facades/System.Resources.Reader/TypeForwarders.cs new file mode 100644 index 0000000000..310362270c --- /dev/null +++ b/mcs/class/Facades/System.Resources.Reader/TypeForwarders.cs @@ -0,0 +1,25 @@ +// +// 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. +// + +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))] + + diff --git a/mcs/class/Facades/System.Resources.Writer/AssemblyInfo.cs b/mcs/class/Facades/System.Resources.Writer/AssemblyInfo.cs new file mode 100644 index 0000000000..71222db9e3 --- /dev/null +++ b/mcs/class/Facades/System.Resources.Writer/AssemblyInfo.cs @@ -0,0 +1,35 @@ +// +// 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.Reflection; +using System.Runtime.CompilerServices; + +[assembly: AssemblyTitle ("System.Resources.Writer")] +[assembly: AssemblyDescription ("System.Resources.Writer")] +[assembly: AssemblyDefaultAlias ("System.Resources.Writer")] +[assembly: AssemblyCompany ("Mono development team")] +[assembly: AssemblyProduct ("Mono Common Language Infrastructure")] +[assembly: AssemblyCopyright ("(c) Various Mono authors")] +[assembly: AssemblyVersion ("4.0.2.0")] +[assembly: AssemblyInformationalVersion ("4.0.0.0")] +[assembly: AssemblyFileVersion ("4.0.0.0")] diff --git a/mcs/class/Facades/System.Resources.Writer/Makefile b/mcs/class/Facades/System.Resources.Writer/Makefile new file mode 100644 index 0000000000..f2f622eb1b --- /dev/null +++ b/mcs/class/Facades/System.Resources.Writer/Makefile @@ -0,0 +1,23 @@ +MCS_BUILD_DIR = ../../../build + +thisdir = class/Facades/System.Resources.Writer +SUBDIRS = +include $(MCS_BUILD_DIR)/rules.make + +LIBRARY_SUBDIR = Facades +LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades + +LIBRARY = System.Resources.Writer.dll + +KEYFILE = ../../msfinal.pub +SIGN_FLAGS = /delaysign /nowarn:1616,1699 +LIB_REFS = System +LIB_MCS_FLAGS = $(SIGN_FLAGS) + +PLATFORM_DEBUG_FLAGS = + +NO_TEST = yes + +include $(MCS_BUILD_DIR)/library.make + + diff --git a/mcs/class/Facades/System.Resources.Writer/System.Resources.Writer.dll.sources b/mcs/class/Facades/System.Resources.Writer/System.Resources.Writer.dll.sources new file mode 100644 index 0000000000..8e33d4ddea --- /dev/null +++ b/mcs/class/Facades/System.Resources.Writer/System.Resources.Writer.dll.sources @@ -0,0 +1,3 @@ +TypeForwarders.cs +AssemblyInfo.cs + diff --git a/mcs/class/Facades/System.Resources.Writer/TypeForwarders.cs b/mcs/class/Facades/System.Resources.Writer/TypeForwarders.cs new file mode 100644 index 0000000000..e82cdb0ad5 --- /dev/null +++ b/mcs/class/Facades/System.Resources.Writer/TypeForwarders.cs @@ -0,0 +1,25 @@ +// +// 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. +// + +[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))] + + diff --git a/mcs/class/Facades/subdirs.make b/mcs/class/Facades/subdirs.make index 2ab420e9eb..cd64572700 100644 --- a/mcs/class/Facades/subdirs.make +++ b/mcs/class/Facades/subdirs.make @@ -27,7 +27,8 @@ System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win3 System.IO.FileSystem.AccessControl System.Reflection.TypeExtensions System.Reflection.Emit.Lightweight System.Reflection.Emit.ILGeneration System.Reflection.Emit \ System.Threading.AccessControl System.ValueTuple \ System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \ -System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes +System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes \ +System.Net.Ping System.Resources.Reader System.Resources.Writer System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp # common_SUBDIRS dependencies common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.ServiceModel.Primitives System.Runtime.Serialization.Primitives \ @@ -50,7 +51,7 @@ testing_aot_full_SUBDIRS = $(monotouch_SUBDIRS) testing_aot_full_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS) -net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) +net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) System.Net.Http.Rtc basic_PARALLEL_SUBDIRS = System.Runtime System.Reflection System.Collections System.Resources.ResourceManager System.Globalization \ System.Threading.Tasks System.Collections.Concurrent System.Text.Encoding System.IO System.Threading System.Diagnostics.Debug \ @@ -89,7 +90,7 @@ unreal_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS) wasm_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS) $(mobile_only_DEPS_SUBDIRS) wasm_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS) -mobile_only_SUBDIRS = System.Net.Ping System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp System.Security.Cryptography.Pkcs \ +mobile_only_SUBDIRS = System.Security.Cryptography.Pkcs \ System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy System.Memory System.Drawing.Common mobile_only_DEPS_SUBDIRS = System.Security.Cryptography.OpenSsl diff --git a/mcs/class/I18N/CJK/CP51932.cs b/mcs/class/I18N/CJK/CP51932.cs index c5b11e4aae..188b58e164 100644 --- a/mcs/class/I18N/CJK/CP51932.cs +++ b/mcs/class/I18N/CJK/CP51932.cs @@ -33,10 +33,9 @@ /* - Well, there looks no jis.table source. Thus, it seems like it is - generated from text files from Unicode Home Page such like - ftp://ftp.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/JIS/JIS0208.TXT - However, it is non-normative and in Japan it is contains many problem. + jis.table is generated from uni2tab.c, which requires CP932.TXT and + Unihan.txt as input files. However, it is non-normative and in Japan it is + contains many problem. FIXME: Some characters such as 0xFF0B (wide "plus") are missing in that table. diff --git a/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs b/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs index 12a9d47bb6..2c045c450a 100644 --- a/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs +++ b/mcs/class/I18N/CJK/Test/I18N.CJK.Test.cs @@ -161,6 +161,15 @@ namespace MonoTests.I18N.CJK AssertDecode ("Test/texts/japanese-utf8.txt", "Test/texts/japanese-932.txt", 932); } + [Test] + public void Bug28321 () + { + var expected = "\u00D7\u00B4\u00B1\u00F7\u00B6\u00B0\u00A8\u00A7"; + var text = Manager.GetEncoding ("shift_jis").GetString (Convert.FromBase64String ("gX6BTIF9gYCB94GLgU6BmA==")); + + Assert.AreEqual (expected, text); + } + // EUC-JP [Test] diff --git a/mcs/class/I18N/CJK/jis.table b/mcs/class/I18N/CJK/jis.table index 4d28d82d457168d2ef93cfc9a154133e3ce0a2e7..f35d9d5eef0b0496b1260b735120c6a5d23fd7ad 100644 GIT binary patch delta 79 zcmX>ylkLb%wh0QXTNoVvub8MBE4`87I>UDc+5ZVjGXLfNrzxc?$tjsAIjK3QZJ0P$ fl5zRO?R$B)F~Gok)yak|a?SG?x6fl_ROeVf delta 79 zcmX>ylkLb%wh0QX3=9tc878X6N;80g?EeHMng4SC)0EPcA04TyZNI@yp#u6Z8g_IZqqYTW>3D-^K+ diff --git a/mcs/class/I18N/Common/Handlers.cs b/mcs/class/I18N/Common/Handlers.cs index 2b50d3e954..92299449d2 100644 --- a/mcs/class/I18N/Common/Handlers.cs +++ b/mcs/class/I18N/Common/Handlers.cs @@ -158,6 +158,10 @@ public sealed class Handlers "I18N.Rare.ENCibm500", "I18N.Rare.CP708", "I18N.Rare.ENCasmo_708", + "I18N.Rare.CP737", + "I18N.Rare.ENCibm_737", + "I18N.Rare.CP775", + "I18N.Rare.ENCibm_775", "I18N.Rare.CP852", "I18N.Rare.ENCibm852", "I18N.Rare.CP855", diff --git a/mcs/class/I18N/Rare/CP737.cs b/mcs/class/I18N/Rare/CP737.cs new file mode 100644 index 0000000000..483a61425a --- /dev/null +++ b/mcs/class/I18N/Rare/CP737.cs @@ -0,0 +1,462 @@ +/* + * CP737.cs - Greek (DOS) code page. + * + * Copyright (c) 2002 Southern Storm Software, Pty Ltd + * + * 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. + */ + +// Generated from "ibm-737.ucm". + +// WARNING: Modifying this file directly might be a bad idea. +// You should edit the code generator tools/ucm2cp.c instead for your changes +// to appear in all relevant classes. +namespace I18N.Rare +{ + +using System; +using System.Text; +using I18N.Common; + +[Serializable] +public class CP737 : ByteEncoding +{ + public CP737() + : base(737, ToChars, "Greek (DOS)", + "ibm737", "ibm737", "ibm737", + false, false, false, false, 1253) + {} + + private static readonly char[] ToChars = { + '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', + '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B', + '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011', + '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017', + '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D', + '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023', + '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029', + '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F', + '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', + '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B', + '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041', + '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', + '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D', + '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053', + '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', + '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F', + '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', + '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B', + '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071', + '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', + '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', + '\u007E', '\u001A', '\u0391', '\u0392', '\u0393', '\u0394', + '\u0395', '\u0396', '\u0397', '\u0398', '\u0399', '\u039A', + '\u039B', '\u039C', '\u039D', '\u039E', '\u039F', '\u03A0', + '\u03A1', '\u03A3', '\u03A4', '\u03A5', '\u03A6', '\u03A7', + '\u03A8', '\u03A9', '\u03B1', '\u03B2', '\u03B3', '\u03B4', + '\u03B5', '\u03B6', '\u03B7', '\u03B8', '\u03B9', '\u03BA', + '\u03BB', '\u03BC', '\u03BD', '\u03BE', '\u03BF', '\u03C0', + '\u03C1', '\u03C3', '\u03C2', '\u03C4', '\u03C5', '\u03C6', + '\u03C7', '\u03C8', '\u2591', '\u2592', '\u2593', '\u2502', + '\u2524', '\u2561', '\u2562', '\u2556', '\u2555', '\u2563', + '\u2551', '\u2557', '\u255D', '\u255C', '\u255B', '\u2510', + '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', + '\u255E', '\u255F', '\u255A', '\u2554', '\u2569', '\u2566', + '\u2560', '\u2550', '\u256C', '\u2567', '\u2568', '\u2564', + '\u2565', '\u2559', '\u2558', '\u2552', '\u2553', '\u256B', + '\u256A', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', + '\u2590', '\u2580', '\u03C9', '\u03AC', '\u03AD', '\u03AE', + '\u03CA', '\u03AF', '\u03CC', '\u03CD', '\u03CB', '\u03CE', + '\u0386', '\u0388', '\u0389', '\u038A', '\u038C', '\u038E', + '\u038F', '\u00B1', '\u2265', '\u2264', '\u03AA', '\u03AB', + '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7', '\u221A', + '\u207F', '\u00B2', '\u25A0', '\u00A0', + }; + + // Get the number of bytes needed to encode a character buffer. + public unsafe override int GetByteCountImpl (char* chars, int count) + { + if (this.EncoderFallback != null) { + //Calculate byte count by actually doing encoding and discarding the data. + return GetBytesImpl(chars, count, null, 0); + } + else + { + return count; + } + } + + // Get the number of bytes needed to encode a character buffer. + public override int GetByteCount (String s) + { + if (this.EncoderFallback != null) + { + //Calculate byte count by actually doing encoding and discarding the data. + unsafe + { + fixed (char *s_ptr = s) + { + return GetBytesImpl(s_ptr, s.Length, null, 0); + } + } + } + else + { + //byte count equals character count because no EncoderFallback set + return s.Length; + } + } + + //ToBytes is just an alias for GetBytesImpl, but doesn't return byte count + protected unsafe override void ToBytes(char* chars, int charCount, + byte* bytes, int byteCount) + { + //Calling ToBytes with null destination buffer doesn't make any sense + if (bytes == null) + throw new ArgumentNullException("bytes"); + GetBytesImpl(chars, charCount, bytes, byteCount); + } + + public unsafe override int GetBytesImpl (char* chars, int charCount, + byte* bytes, int byteCount) + { + int ch; + int charIndex = 0; + int byteIndex = 0; + EncoderFallbackBuffer buffer = null; + while (charCount > 0) + { + ch = (int)(chars[charIndex]); + if(ch >= 26) switch(ch) + { + case 0x001B: + case 0x001D: + case 0x001E: + case 0x001F: + case 0x0020: + case 0x0021: + case 0x0022: + case 0x0023: + case 0x0024: + case 0x0025: + case 0x0026: + case 0x0027: + case 0x0028: + case 0x0029: + case 0x002A: + case 0x002B: + case 0x002C: + case 0x002D: + case 0x002E: + case 0x002F: + case 0x0030: + case 0x0031: + case 0x0032: + case 0x0033: + case 0x0034: + case 0x0035: + case 0x0036: + case 0x0037: + case 0x0038: + case 0x0039: + case 0x003A: + case 0x003B: + case 0x003C: + case 0x003D: + case 0x003E: + case 0x003F: + case 0x0040: + case 0x0041: + case 0x0042: + case 0x0043: + case 0x0044: + case 0x0045: + case 0x0046: + case 0x0047: + case 0x0048: + case 0x0049: + case 0x004A: + case 0x004B: + case 0x004C: + case 0x004D: + case 0x004E: + case 0x004F: + case 0x0050: + case 0x0051: + case 0x0052: + case 0x0053: + case 0x0054: + case 0x0055: + case 0x0056: + case 0x0057: + case 0x0058: + case 0x0059: + case 0x005A: + case 0x005B: + case 0x005C: + case 0x005D: + case 0x005E: + case 0x005F: + case 0x0060: + case 0x0061: + case 0x0062: + case 0x0063: + case 0x0064: + case 0x0065: + case 0x0066: + case 0x0067: + case 0x0068: + case 0x0069: + case 0x006A: + case 0x006B: + case 0x006C: + case 0x006D: + case 0x006E: + case 0x006F: + case 0x0070: + case 0x0071: + case 0x0072: + case 0x0073: + case 0x0074: + case 0x0075: + case 0x0076: + case 0x0077: + case 0x0078: + case 0x0079: + case 0x007A: + case 0x007B: + case 0x007C: + case 0x007D: + case 0x007E: + break; + case 0x001A: ch = 0x7F; break; + case 0x001C: ch = 0x1A; break; + case 0x007F: ch = 0x1C; break; + case 0x00A0: ch = 0xFF; break; + case 0x00A7: ch = 0x15; break; + case 0x00B0: ch = 0xF8; break; + case 0x00B1: ch = 0xF1; break; + case 0x00B2: ch = 0xFD; break; + case 0x00B6: ch = 0x14; break; + case 0x00B7: ch = 0xFA; break; + case 0x00F7: ch = 0xF6; break; + case 0x0386: ch = 0xEA; break; + case 0x0388: ch = 0xEB; break; + case 0x0389: ch = 0xEC; break; + case 0x038A: ch = 0xED; break; + case 0x038C: ch = 0xEE; break; + case 0x038E: ch = 0xEF; break; + case 0x038F: ch = 0xF0; break; + case 0x0391: + case 0x0392: + case 0x0393: + case 0x0394: + case 0x0395: + case 0x0396: + case 0x0397: + case 0x0398: + case 0x0399: + case 0x039A: + case 0x039B: + case 0x039C: + case 0x039D: + case 0x039E: + case 0x039F: + case 0x03A0: + case 0x03A1: + ch -= 0x0311; + break; + case 0x03A3: + case 0x03A4: + case 0x03A5: + case 0x03A6: + case 0x03A7: + case 0x03A8: + case 0x03A9: + ch -= 0x0312; + break; + case 0x03AA: ch = 0xF4; break; + case 0x03AB: ch = 0xF5; break; + case 0x03AC: ch = 0xE1; break; + case 0x03AD: ch = 0xE2; break; + case 0x03AE: ch = 0xE3; break; + case 0x03AF: ch = 0xE5; break; + case 0x03B1: + case 0x03B2: + case 0x03B3: + case 0x03B4: + case 0x03B5: + case 0x03B6: + case 0x03B7: + case 0x03B8: + case 0x03B9: + case 0x03BA: + case 0x03BB: + case 0x03BC: + case 0x03BD: + case 0x03BE: + case 0x03BF: + case 0x03C0: + case 0x03C1: + ch -= 0x0319; + break; + case 0x03C2: ch = 0xAA; break; + case 0x03C3: ch = 0xA9; break; + case 0x03C4: + case 0x03C5: + case 0x03C6: + case 0x03C7: + case 0x03C8: + ch -= 0x0319; + break; + case 0x03C9: ch = 0xE0; break; + case 0x03CA: ch = 0xE4; break; + case 0x03CB: ch = 0xE8; break; + case 0x03CC: ch = 0xE6; break; + case 0x03CD: ch = 0xE7; break; + case 0x03CE: ch = 0xE9; break; + case 0x03D5: ch = 0xAD; break; + case 0x2022: ch = 0x07; break; + case 0x203C: ch = 0x13; break; + case 0x207F: ch = 0xFC; break; + case 0x2190: ch = 0x1B; break; + case 0x2191: ch = 0x18; break; + case 0x2192: ch = 0x1A; break; + case 0x2193: ch = 0x19; break; + case 0x2194: ch = 0x1D; break; + case 0x2195: ch = 0x12; break; + case 0x21A8: ch = 0x17; break; + case 0x2219: ch = 0xF9; break; + case 0x221A: ch = 0xFB; break; + case 0x221F: ch = 0x1C; break; + case 0x2248: ch = 0xF7; break; + case 0x2264: ch = 0xF3; break; + case 0x2265: ch = 0xF2; break; + case 0x2302: ch = 0x7F; break; + case 0x2500: ch = 0xC4; break; + case 0x2502: ch = 0xB3; break; + case 0x250C: ch = 0xDA; break; + case 0x2510: ch = 0xBF; break; + case 0x2514: ch = 0xC0; break; + case 0x2518: ch = 0xD9; break; + case 0x251C: ch = 0xC3; break; + case 0x2524: ch = 0xB4; break; + case 0x252C: ch = 0xC2; break; + case 0x2534: ch = 0xC1; break; + case 0x253C: ch = 0xC5; break; + case 0x2550: ch = 0xCD; break; + case 0x2551: ch = 0xBA; break; + case 0x2552: ch = 0xD5; break; + case 0x2553: ch = 0xD6; break; + case 0x2554: ch = 0xC9; break; + case 0x2555: ch = 0xB8; break; + case 0x2556: ch = 0xB7; break; + case 0x2557: ch = 0xBB; break; + case 0x2558: ch = 0xD4; break; + case 0x2559: ch = 0xD3; break; + case 0x255A: ch = 0xC8; break; + case 0x255B: ch = 0xBE; break; + case 0x255C: ch = 0xBD; break; + case 0x255D: ch = 0xBC; break; + case 0x255E: ch = 0xC6; break; + case 0x255F: ch = 0xC7; break; + case 0x2560: ch = 0xCC; break; + case 0x2561: ch = 0xB5; break; + case 0x2562: ch = 0xB6; break; + case 0x2563: ch = 0xB9; break; + case 0x2564: ch = 0xD1; break; + case 0x2565: ch = 0xD2; break; + case 0x2566: ch = 0xCB; break; + case 0x2567: ch = 0xCF; break; + case 0x2568: ch = 0xD0; break; + case 0x2569: ch = 0xCA; break; + case 0x256A: ch = 0xD8; break; + case 0x256B: ch = 0xD7; break; + case 0x256C: ch = 0xCE; break; + case 0x2580: ch = 0xDF; break; + case 0x2584: ch = 0xDC; break; + case 0x2588: ch = 0xDB; break; + case 0x258C: ch = 0xDD; break; + case 0x2590: ch = 0xDE; break; + case 0x2591: ch = 0xB0; break; + case 0x2592: ch = 0xB1; break; + case 0x2593: ch = 0xB2; break; + case 0x25A0: ch = 0xFE; break; + case 0x25AC: ch = 0x16; break; + case 0x25B2: ch = 0x1E; break; + case 0x25BA: ch = 0x10; break; + case 0x25BC: ch = 0x1F; break; + case 0x25C4: ch = 0x11; break; + case 0x25CB: ch = 0x09; break; + case 0x25D8: ch = 0x08; break; + case 0x25D9: ch = 0x0A; break; + case 0x263A: ch = 0x01; break; + case 0x263B: ch = 0x02; break; + case 0x263C: ch = 0x0F; break; + case 0x2640: ch = 0x0C; break; + case 0x2642: ch = 0x0B; break; + case 0x2660: ch = 0x06; break; + case 0x2663: ch = 0x05; break; + case 0x2665: ch = 0x03; break; + case 0x2666: ch = 0x04; break; + case 0x266A: ch = 0x0D; break; + case 0x266C: ch = 0x0E; break; + case 0xFFE8: ch = 0xB3; break; + case 0xFFE9: ch = 0x1B; break; + case 0xFFEA: ch = 0x18; break; + case 0xFFEB: ch = 0x1A; break; + case 0xFFEC: ch = 0x19; break; + case 0xFFED: ch = 0xFE; break; + case 0xFFEE: ch = 0x09; break; + default: + { + if(ch >= 0xFF01 && ch <= 0xFF5E) + { + ch -= 0xFEE0; + } + else + { + HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); + charIndex++; + charCount--; + continue; + } + } + break; + } + //Write encoded byte to buffer, if buffer is defined and fallback was not used + if (bytes != null) + bytes[byteIndex] = (byte)ch; + byteIndex++; + byteCount--; + charIndex++; + charCount--; + } + return byteIndex; + } +}; // class CP737 + +[Serializable] +public class ENCibm737 : CP737 +{ + public ENCibm737() : base() {} + +}; // class ENCibm737 + +}; // namespace I18N.Rare diff --git a/mcs/class/I18N/Rare/CP775.cs b/mcs/class/I18N/Rare/CP775.cs new file mode 100644 index 0000000000..50458ad6ce --- /dev/null +++ b/mcs/class/I18N/Rare/CP775.cs @@ -0,0 +1,451 @@ +/* + * CP775.cs - Baltic (DOS) code page. + * + * Copyright (c) 2002 Southern Storm Software, Pty Ltd + * + * 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. + */ + +// Generated from "ibm-775.ucm". + +// WARNING: Modifying this file directly might be a bad idea. +// You should edit the code generator tools/ucm2cp.c instead for your changes +// to appear in all relevant classes. +namespace I18N.Rare +{ + +using System; +using System.Text; +using I18N.Common; + +[Serializable] +public class CP775 : ByteEncoding +{ + public CP775() + : base(775, ToChars, "Baltic (DOS)", + "ibm775", "ibm775", "ibm775", + false, false, false, false, 1257) + {} + + private static readonly char[] ToChars = { + '\u0000', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', + '\u0006', '\u0007', '\u0008', '\u0009', '\u000A', '\u000B', + '\u000C', '\u000D', '\u000E', '\u000F', '\u0010', '\u0011', + '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017', + '\u0018', '\u0019', '\u001C', '\u001B', '\u007F', '\u001D', + '\u001E', '\u001F', '\u0020', '\u0021', '\u0022', '\u0023', + '\u0024', '\u0025', '\u0026', '\u0027', '\u0028', '\u0029', + '\u002A', '\u002B', '\u002C', '\u002D', '\u002E', '\u002F', + '\u0030', '\u0031', '\u0032', '\u0033', '\u0034', '\u0035', + '\u0036', '\u0037', '\u0038', '\u0039', '\u003A', '\u003B', + '\u003C', '\u003D', '\u003E', '\u003F', '\u0040', '\u0041', + '\u0042', '\u0043', '\u0044', '\u0045', '\u0046', '\u0047', + '\u0048', '\u0049', '\u004A', '\u004B', '\u004C', '\u004D', + '\u004E', '\u004F', '\u0050', '\u0051', '\u0052', '\u0053', + '\u0054', '\u0055', '\u0056', '\u0057', '\u0058', '\u0059', + '\u005A', '\u005B', '\u005C', '\u005D', '\u005E', '\u005F', + '\u0060', '\u0061', '\u0062', '\u0063', '\u0064', '\u0065', + '\u0066', '\u0067', '\u0068', '\u0069', '\u006A', '\u006B', + '\u006C', '\u006D', '\u006E', '\u006F', '\u0070', '\u0071', + '\u0072', '\u0073', '\u0074', '\u0075', '\u0076', '\u0077', + '\u0078', '\u0079', '\u007A', '\u007B', '\u007C', '\u007D', + '\u007E', '\u001A', '\u0106', '\u00FC', '\u00E9', '\u0101', + '\u00E4', '\u0123', '\u00E5', '\u0107', '\u0142', '\u0113', + '\u0156', '\u0157', '\u012B', '\u0179', '\u00C4', '\u00C5', + '\u00C9', '\u00E6', '\u00C6', '\u014D', '\u00F6', '\u0122', + '\u00A2', '\u015A', '\u015B', '\u00D6', '\u00DC', '\u00F8', + '\u00A3', '\u00D8', '\u00D7', '\u00A4', '\u0100', '\u012A', + '\u00F3', '\u017B', '\u017C', '\u017A', '\u201D', '\u00A6', + '\u00A9', '\u00AE', '\u00AC', '\u00BD', '\u00BC', '\u0141', + '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593', '\u2502', + '\u2524', '\u0104', '\u010C', '\u0118', '\u0116', '\u2563', + '\u2551', '\u2557', '\u255D', '\u012E', '\u0160', '\u2510', + '\u2514', '\u2534', '\u252C', '\u251C', '\u2500', '\u253C', + '\u0172', '\u016A', '\u255A', '\u2554', '\u2569', '\u2566', + '\u2560', '\u2550', '\u256C', '\u017D', '\u0105', '\u010D', + '\u0119', '\u0117', '\u012F', '\u0161', '\u0173', '\u016B', + '\u017E', '\u2518', '\u250C', '\u2588', '\u2584', '\u258C', + '\u2590', '\u2580', '\u00D3', '\u00DF', '\u014C', '\u0143', + '\u00F5', '\u00D5', '\u00B5', '\u0144', '\u0136', '\u0137', + '\u013B', '\u013C', '\u0146', '\u0112', '\u0145', '\u2019', + '\u00AD', '\u00B1', '\u201C', '\u00BE', '\u00B6', '\u00A7', + '\u00F7', '\u201E', '\u00B0', '\u2219', '\u00B7', '\u00B9', + '\u00B3', '\u00B2', '\u25A0', '\u00A0', + }; + + // Get the number of bytes needed to encode a character buffer. + public unsafe override int GetByteCountImpl (char* chars, int count) + { + if (this.EncoderFallback != null) { + //Calculate byte count by actually doing encoding and discarding the data. + return GetBytesImpl(chars, count, null, 0); + } + else + { + return count; + } + } + + // Get the number of bytes needed to encode a character buffer. + public override int GetByteCount (String s) + { + if (this.EncoderFallback != null) + { + //Calculate byte count by actually doing encoding and discarding the data. + unsafe + { + fixed (char *s_ptr = s) + { + return GetBytesImpl(s_ptr, s.Length, null, 0); + } + } + } + else + { + //byte count equals character count because no EncoderFallback set + return s.Length; + } + } + + //ToBytes is just an alias for GetBytesImpl, but doesn't return byte count + protected unsafe override void ToBytes(char* chars, int charCount, + byte* bytes, int byteCount) + { + //Calling ToBytes with null destination buffer doesn't make any sense + if (bytes == null) + throw new ArgumentNullException("bytes"); + GetBytesImpl(chars, charCount, bytes, byteCount); + } + + public unsafe override int GetBytesImpl (char* chars, int charCount, + byte* bytes, int byteCount) + { + int ch; + int charIndex = 0; + int byteIndex = 0; + EncoderFallbackBuffer buffer = null; + while (charCount > 0) + { + ch = (int)(chars[charIndex]); + if(ch >= 26) switch(ch) + { + case 0x001B: + case 0x001D: + case 0x001E: + case 0x001F: + case 0x0020: + case 0x0021: + case 0x0022: + case 0x0023: + case 0x0024: + case 0x0025: + case 0x0026: + case 0x0027: + case 0x0028: + case 0x0029: + case 0x002A: + case 0x002B: + case 0x002C: + case 0x002D: + case 0x002E: + case 0x002F: + case 0x0030: + case 0x0031: + case 0x0032: + case 0x0033: + case 0x0034: + case 0x0035: + case 0x0036: + case 0x0037: + case 0x0038: + case 0x0039: + case 0x003A: + case 0x003B: + case 0x003C: + case 0x003D: + case 0x003E: + case 0x003F: + case 0x0040: + case 0x0041: + case 0x0042: + case 0x0043: + case 0x0044: + case 0x0045: + case 0x0046: + case 0x0047: + case 0x0048: + case 0x0049: + case 0x004A: + case 0x004B: + case 0x004C: + case 0x004D: + case 0x004E: + case 0x004F: + case 0x0050: + case 0x0051: + case 0x0052: + case 0x0053: + case 0x0054: + case 0x0055: + case 0x0056: + case 0x0057: + case 0x0058: + case 0x0059: + case 0x005A: + case 0x005B: + case 0x005C: + case 0x005D: + case 0x005E: + case 0x005F: + case 0x0060: + case 0x0061: + case 0x0062: + case 0x0063: + case 0x0064: + case 0x0065: + case 0x0066: + case 0x0067: + case 0x0068: + case 0x0069: + case 0x006A: + case 0x006B: + case 0x006C: + case 0x006D: + case 0x006E: + case 0x006F: + case 0x0070: + case 0x0071: + case 0x0072: + case 0x0073: + case 0x0074: + case 0x0075: + case 0x0076: + case 0x0077: + case 0x0078: + case 0x0079: + case 0x007A: + case 0x007B: + case 0x007C: + case 0x007D: + case 0x007E: + break; + case 0x001A: ch = 0x7F; break; + case 0x001C: ch = 0x1A; break; + case 0x007F: ch = 0x1C; break; + case 0x00A0: ch = 0xFF; break; + case 0x00A2: ch = 0x96; break; + case 0x00A3: ch = 0x9C; break; + case 0x00A4: ch = 0x9F; break; + case 0x00A6: ch = 0xA7; break; + case 0x00A7: ch = 0xF5; break; + case 0x00A9: ch = 0xA8; break; + case 0x00AB: ch = 0xAE; break; + case 0x00AC: ch = 0xAA; break; + case 0x00AD: ch = 0xF0; break; + case 0x00AE: ch = 0xA9; break; + case 0x00B0: ch = 0xF8; break; + case 0x00B1: ch = 0xF1; break; + case 0x00B2: ch = 0xFD; break; + case 0x00B3: ch = 0xFC; break; + case 0x00B5: ch = 0xE6; break; + case 0x00B6: ch = 0xF4; break; + case 0x00B7: ch = 0xFA; break; + case 0x00B9: ch = 0xFB; break; + case 0x00BB: ch = 0xAF; break; + case 0x00BC: ch = 0xAC; break; + case 0x00BD: ch = 0xAB; break; + case 0x00BE: ch = 0xF3; break; + case 0x00C4: ch = 0x8E; break; + case 0x00C5: ch = 0x8F; break; + case 0x00C6: ch = 0x92; break; + case 0x00C9: ch = 0x90; break; + case 0x00D3: ch = 0xE0; break; + case 0x00D5: ch = 0xE5; break; + case 0x00D6: ch = 0x99; break; + case 0x00D7: ch = 0x9E; break; + case 0x00D8: ch = 0x9D; break; + case 0x00DC: ch = 0x9A; break; + case 0x00DF: ch = 0xE1; break; + case 0x00E4: ch = 0x84; break; + case 0x00E5: ch = 0x86; break; + case 0x00E6: ch = 0x91; break; + case 0x00E9: ch = 0x82; break; + case 0x00F3: ch = 0xA2; break; + case 0x00F5: ch = 0xE4; break; + case 0x00F6: ch = 0x94; break; + case 0x00F7: ch = 0xF6; break; + case 0x00F8: ch = 0x9B; break; + case 0x00FC: ch = 0x81; break; + case 0x0100: ch = 0xA0; break; + case 0x0101: ch = 0x83; break; + case 0x0104: ch = 0xB5; break; + case 0x0105: ch = 0xD0; break; + case 0x0106: ch = 0x80; break; + case 0x0107: ch = 0x87; break; + case 0x010C: ch = 0xB6; break; + case 0x010D: ch = 0xD1; break; + case 0x0112: ch = 0xED; break; + case 0x0113: ch = 0x89; break; + case 0x0116: ch = 0xB8; break; + case 0x0117: ch = 0xD3; break; + case 0x0118: ch = 0xB7; break; + case 0x0119: ch = 0xD2; break; + case 0x0122: ch = 0x95; break; + case 0x0123: ch = 0x85; break; + case 0x012A: ch = 0xA1; break; + case 0x012B: ch = 0x8C; break; + case 0x012E: ch = 0xBD; break; + case 0x012F: ch = 0xD4; break; + case 0x0136: ch = 0xE8; break; + case 0x0137: ch = 0xE9; break; + case 0x013B: ch = 0xEA; break; + case 0x013C: ch = 0xEB; break; + case 0x0141: ch = 0xAD; break; + case 0x0142: ch = 0x88; break; + case 0x0143: ch = 0xE3; break; + case 0x0144: ch = 0xE7; break; + case 0x0145: ch = 0xEE; break; + case 0x0146: ch = 0xEC; break; + case 0x014C: ch = 0xE2; break; + case 0x014D: ch = 0x93; break; + case 0x0156: ch = 0x8A; break; + case 0x0157: ch = 0x8B; break; + case 0x015A: ch = 0x97; break; + case 0x015B: ch = 0x98; break; + case 0x0160: ch = 0xBE; break; + case 0x0161: ch = 0xD5; break; + case 0x016A: ch = 0xC7; break; + case 0x016B: ch = 0xD7; break; + case 0x0172: ch = 0xC6; break; + case 0x0173: ch = 0xD6; break; + case 0x0179: ch = 0x8D; break; + case 0x017A: ch = 0xA5; break; + case 0x017B: ch = 0xA3; break; + case 0x017C: ch = 0xA4; break; + case 0x017D: ch = 0xCF; break; + case 0x017E: ch = 0xD8; break; + case 0x2019: ch = 0xEF; break; + case 0x201C: ch = 0xF2; break; + case 0x201D: ch = 0xA6; break; + case 0x201E: ch = 0xF7; break; + case 0x2022: ch = 0x07; break; + case 0x203C: ch = 0x13; break; + case 0x2190: ch = 0x1B; break; + case 0x2191: ch = 0x18; break; + case 0x2192: ch = 0x1A; break; + case 0x2193: ch = 0x19; break; + case 0x2194: ch = 0x1D; break; + case 0x2195: ch = 0x12; break; + case 0x21A8: ch = 0x17; break; + case 0x2219: ch = 0xF9; break; + case 0x221F: ch = 0x1C; break; + case 0x2302: ch = 0x7F; break; + case 0x2500: ch = 0xC4; break; + case 0x2502: ch = 0xB3; break; + case 0x250C: ch = 0xDA; break; + case 0x2510: ch = 0xBF; break; + case 0x2514: ch = 0xC0; break; + case 0x2518: ch = 0xD9; break; + case 0x251C: ch = 0xC3; break; + case 0x2524: ch = 0xB4; break; + case 0x252C: ch = 0xC2; break; + case 0x2534: ch = 0xC1; break; + case 0x253C: ch = 0xC5; break; + case 0x2550: ch = 0xCD; break; + case 0x2551: ch = 0xBA; break; + case 0x2554: ch = 0xC9; break; + case 0x2557: ch = 0xBB; break; + case 0x255A: ch = 0xC8; break; + case 0x255D: ch = 0xBC; break; + case 0x2560: ch = 0xCC; break; + case 0x2563: ch = 0xB9; break; + case 0x2566: ch = 0xCB; break; + case 0x2569: ch = 0xCA; break; + case 0x256C: ch = 0xCE; break; + case 0x2580: ch = 0xDF; break; + case 0x2584: ch = 0xDC; break; + case 0x2588: ch = 0xDB; break; + case 0x258C: ch = 0xDD; break; + case 0x2590: ch = 0xDE; break; + case 0x2591: ch = 0xB0; break; + case 0x2592: ch = 0xB1; break; + case 0x2593: ch = 0xB2; break; + case 0x25A0: ch = 0xFE; break; + case 0x25AC: ch = 0x16; break; + case 0x25B2: ch = 0x1E; break; + case 0x25BA: ch = 0x10; break; + case 0x25BC: ch = 0x1F; break; + case 0x25C4: ch = 0x11; break; + case 0x25CB: ch = 0x09; break; + case 0x25D8: ch = 0x08; break; + case 0x25D9: ch = 0x0A; break; + case 0x263A: ch = 0x01; break; + case 0x263B: ch = 0x02; break; + case 0x263C: ch = 0x0F; break; + case 0x2640: ch = 0x0C; break; + case 0x2642: ch = 0x0B; break; + case 0x2660: ch = 0x06; break; + case 0x2663: ch = 0x05; break; + case 0x2665: ch = 0x03; break; + case 0x2666: ch = 0x04; break; + case 0x266A: ch = 0x0D; break; + case 0x266B: ch = 0x0E; break; + case 0xFFE8: ch = 0xB3; break; + case 0xFFE9: ch = 0x1B; break; + case 0xFFEA: ch = 0x18; break; + case 0xFFEB: ch = 0x1A; break; + case 0xFFEC: ch = 0x19; break; + case 0xFFED: ch = 0xFE; break; + case 0xFFEE: ch = 0x09; break; + default: + { + if(ch >= 0xFF01 && ch <= 0xFF5E) + { + ch -= 0xFEE0; + } + else + { + HandleFallback (ref buffer, chars, ref charIndex, ref charCount, bytes, ref byteIndex, ref byteCount); + charIndex++; + charCount--; + continue; + } + } + break; + } + //Write encoded byte to buffer, if buffer is defined and fallback was not used + if (bytes != null) + bytes[byteIndex] = (byte)ch; + byteIndex++; + byteCount--; + charIndex++; + charCount--; + } + return byteIndex; + } +}; // class CP775 + +[Serializable] +public class ENCibm775 : CP775 +{ + public ENCibm775() : base() {} + +}; // class ENCibm775 + +}; // namespace I18N.Rare diff --git a/mcs/class/I18N/Rare/I18N.Rare.dll.sources b/mcs/class/I18N/Rare/I18N.Rare.dll.sources index 8359d47c7e..be0f2cca9a 100755 --- a/mcs/class/I18N/Rare/I18N.Rare.dll.sources +++ b/mcs/class/I18N/Rare/I18N.Rare.dll.sources @@ -31,6 +31,8 @@ CP21025.cs CP37.cs CP500.cs CP708.cs +CP737.cs +CP775.cs CP852.cs CP855.cs CP857.cs diff --git a/mcs/class/I18N/Rare/ibm-737.ucm b/mcs/class/I18N/Rare/ibm-737.ucm new file mode 100644 index 0000000000..40ef5b94ad --- /dev/null +++ b/mcs/class/I18N/Rare/ibm-737.ucm @@ -0,0 +1,411 @@ +# *************************************************************************** +# * +# * Copyright (C) 1995-2002, International Business Machines +# * Corporation and others. All Rights Reserved. +# * +# *************************************************************************** +# +# File created by rptp2ucm (compiled on Dec 3 2002) +# from source files 34B002E1.RPMAP100 and 02E134B0.TPMAP100 +# + "ibm-737_P100-1997" + "AXXXX" + 1 + 1 + "SBCS" + \x7F + "ASCII" + "ibm-737_VSUB" + +CHARMAP + \x00 |0 + \x01 |0 + \x02 |0 + \x03 |0 + \x04 |0 + \x05 |0 + \x06 |0 + \x07 |0 + \x08 |0 + \x09 |0 + \x0A |0 + \x0B |0 + \x0C |0 + \x0D |0 + \x0E |0 + \x0F |0 + \x10 |0 + \x11 |0 + \x12 |0 + \x13 |0 + \x14 |0 + \x15 |0 + \x16 |0 + \x17 |0 + \x18 |0 + \x19 |0 + \x7F |0 + \x1B |0 + \x1A |0 + \x1D |0 + \x1E |0 + \x1F |0 + \x20 |0 + \x21 |0 + \x22 |0 + \x23 |0 + \x24 |0 + \x25 |0 + \x26 |0 + \x27 |0 + \x28 |0 + \x29 |0 + \x2A |0 + \x2B |0 + \x2C |0 + \x2D |0 + \x2E |0 + \x2F |0 + \x30 |0 + \x31 |0 + \x32 |0 + \x33 |0 + \x34 |0 + \x35 |0 + \x36 |0 + \x37 |0 + \x38 |0 + \x39 |0 + \x3A |0 + \x3B |0 + \x3C |0 + \x3D |0 + \x3E |0 + \x3F |0 + \x40 |0 + \x41 |0 + \x42 |0 + \x43 |0 + \x44 |0 + \x45 |0 + \x46 |0 + \x47 |0 + \x48 |0 + \x49 |0 + \x4A |0 + \x4B |0 + \x4C |0 + \x4D |0 + \x4E |0 + \x4F |0 + \x50 |0 + \x51 |0 + \x52 |0 + \x53 |0 + \x54 |0 + \x55 |0 + \x56 |0 + \x57 |0 + \x58 |0 + \x59 |0 + \x5A |0 + \x5B |0 + \x5C |0 + \x5D |0 + \x5E |0 + \x5F |0 + \x60 |0 + \x61 |0 + \x62 |0 + \x63 |0 + \x64 |0 + \x65 |0 + \x66 |0 + \x67 |0 + \x68 |0 + \x69 |0 + \x6A |0 + \x6B |0 + \x6C |0 + \x6D |0 + \x6E |0 + \x6F |0 + \x70 |0 + \x71 |0 + \x72 |0 + \x73 |0 + \x74 |0 + \x75 |0 + \x76 |0 + \x77 |0 + \x78 |0 + \x79 |0 + \x7A |0 + \x7B |0 + \x7C |0 + \x7D |0 + \x7E |0 + \x1C |0 + \xFF |0 + \x15 |1 + \xF8 |0 + \xF1 |0 + \xFD |0 + \x14 |1 + \xFA |0 + \xF6 |0 + \xEA |0 + \xEB |0 + \xEC |0 + \xED |0 + \xEE |0 + \xEF |0 + \xF0 |0 + \x80 |0 + \x81 |0 + \x82 |0 + \x83 |0 + \x84 |0 + \x85 |0 + \x86 |0 + \x87 |0 + \x88 |0 + \x89 |0 + \x8A |0 + \x8B |0 + \x8C |0 + \x8D |0 + \x8E |0 + \x8F |0 + \x90 |0 + \x91 |0 + \x92 |0 + \x93 |0 + \x94 |0 + \x95 |0 + \x96 |0 + \x97 |0 + \xF4 |0 + \xF5 |0 + \xE1 |0 + \xE2 |0 + \xE3 |0 + \xE5 |0 + \x98 |0 + \x99 |0 + \x9A |0 + \x9B |0 + \x9C |0 + \x9D |0 + \x9E |0 + \x9F |0 + \xA0 |0 + \xA1 |0 + \xA2 |0 + \xA3 |0 + \xA4 |0 + \xA5 |0 + \xA6 |0 + \xA7 |0 + \xA8 |0 + \xAA |0 + \xA9 |0 + \xAB |0 + \xAC |0 + \xAD |0 + \xAE |0 + \xAF |0 + \xE0 |0 + \xE4 |0 + \xE8 |0 + \xE6 |0 + \xE7 |0 + \xE9 |0 + \xAD |1 + \x07 |1 + \x13 |1 + \xFC |0 + \x1B |1 + \x18 |1 + \x1A |1 + \x19 |1 + \x1D |1 + \x12 |1 + \x17 |1 + \xF9 |0 + \xFB |0 + \x1C |1 + \xF7 |0 + \xF3 |0 + \xF2 |0 + \x7F |2 + \xC4 |0 + \xB3 |0 + \xDA |0 + \xBF |0 + \xC0 |0 + \xD9 |0 + \xC3 |0 + \xB4 |0 + \xC2 |0 + \xC1 |0 + \xC5 |0 + \xCD |0 + \xBA |0 + \xD5 |0 + \xD6 |0 + \xC9 |0 + \xB8 |0 + \xB7 |0 + \xBB |0 + \xD4 |0 + \xD3 |0 + \xC8 |0 + \xBE |0 + \xBD |0 + \xBC |0 + \xC6 |0 + \xC7 |0 + \xCC |0 + \xB5 |0 + \xB6 |0 + \xB9 |0 + \xD1 |0 + \xD2 |0 + \xCB |0 + \xCF |0 + \xD0 |0 + \xCA |0 + \xD8 |0 + \xD7 |0 + \xCE |0 + \xDF |0 + \xDC |0 + \xDB |0 + \xDD |0 + \xDE |0 + \xB0 |0 + \xB1 |0 + \xB2 |0 + \xFE |0 + \x16 |1 + \x1E |1 + \x10 |1 + \x1F |1 + \x11 |1 + \x09 |1 + \x08 |1 + \x0A |1 + \x01 |1 + \x02 |1 + \x0F |1 + \x0C |1 + \x0B |1 + \x06 |1 + \x05 |1 + \x03 |1 + \x04 |1 + \x0D |1 + \x0E |1 + \x21 |1 + \x22 |1 + \x23 |1 + \x24 |1 + \x25 |1 + \x26 |1 + \x27 |1 + \x28 |1 + \x29 |1 + \x2A |1 + \x2B |1 + \x2C |1 + \x2D |1 + \x2E |1 + \x2F |1 + \x30 |1 + \x31 |1 + \x32 |1 + \x33 |1 + \x34 |1 + \x35 |1 + \x36 |1 + \x37 |1 + \x38 |1 + \x39 |1 + \x3A |1 + \x3B |1 + \x3C |1 + \x3D |1 + \x3E |1 + \x3F |1 + \x40 |1 + \x41 |1 + \x42 |1 + \x43 |1 + \x44 |1 + \x45 |1 + \x46 |1 + \x47 |1 + \x48 |1 + \x49 |1 + \x4A |1 + \x4B |1 + \x4C |1 + \x4D |1 + \x4E |1 + \x4F |1 + \x50 |1 + \x51 |1 + \x52 |1 + \x53 |1 + \x54 |1 + \x55 |1 + \x56 |1 + \x57 |1 + \x58 |1 + \x59 |1 + \x5A |1 + \x5B |1 + \x5C |1 + \x5D |1 + \x5E |1 + \x5F |1 + \x60 |1 + \x61 |1 + \x62 |1 + \x63 |1 + \x64 |1 + \x65 |1 + \x66 |1 + \x67 |1 + \x68 |1 + \x69 |1 + \x6A |1 + \x6B |1 + \x6C |1 + \x6D |1 + \x6E |1 + \x6F |1 + \x70 |1 + \x71 |1 + \x72 |1 + \x73 |1 + \x74 |1 + \x75 |1 + \x76 |1 + \x77 |1 + \x78 |1 + \x79 |1 + \x7A |1 + \x7B |1 + \x7C |1 + \x7D |1 + \x7E |1 + \xB3 |1 + \x1B |1 + \x18 |1 + \x1A |1 + \x19 |1 + \xFE |1 + \x09 |1 +END CHARMAP diff --git a/mcs/class/I18N/Rare/ibm-775.ucm b/mcs/class/I18N/Rare/ibm-775.ucm new file mode 100644 index 0000000000..3124e9b849 --- /dev/null +++ b/mcs/class/I18N/Rare/ibm-775.ucm @@ -0,0 +1,408 @@ +# *************************************************************************** +# * +# * Copyright (C) 1995-2004, International Business Machines +# * Corporation and others. All Rights Reserved. +# * +# *************************************************************************** +# +# File created by rptp2ucm (compiled on Jan 14 2004) +# from source files 34B00307.RPMAP100 and 030734B0.TPMAP100 +# + "ibm-775_P100-1996" + "AXXXX" + 1 + 1 + "SBCS" + \x7F + "ASCII" + "ibm-775_VSUB" + +CHARMAP + \x00 |0 + \x01 |0 + \x02 |0 + \x03 |0 + \x04 |0 + \x05 |0 + \x06 |0 + \x07 |0 + \x08 |0 + \x09 |0 + \x0A |0 + \x0B |0 + \x0C |0 + \x0D |0 + \x0E |0 + \x0F |0 + \x10 |0 + \x11 |0 + \x12 |0 + \x13 |0 + \x14 |0 + \x15 |0 + \x16 |0 + \x17 |0 + \x18 |0 + \x19 |0 + \x7F |0 + \x1B |0 + \x1A |0 + \x1D |0 + \x1E |0 + \x1F |0 + \x20 |0 + \x21 |0 + \x22 |0 + \x23 |0 + \x24 |0 + \x25 |0 + \x26 |0 + \x27 |0 + \x28 |0 + \x29 |0 + \x2A |0 + \x2B |0 + \x2C |0 + \x2D |0 + \x2E |0 + \x2F |0 + \x30 |0 + \x31 |0 + \x32 |0 + \x33 |0 + \x34 |0 + \x35 |0 + \x36 |0 + \x37 |0 + \x38 |0 + \x39 |0 + \x3A |0 + \x3B |0 + \x3C |0 + \x3D |0 + \x3E |0 + \x3F |0 + \x40 |0 + \x41 |0 + \x42 |0 + \x43 |0 + \x44 |0 + \x45 |0 + \x46 |0 + \x47 |0 + \x48 |0 + \x49 |0 + \x4A |0 + \x4B |0 + \x4C |0 + \x4D |0 + \x4E |0 + \x4F |0 + \x50 |0 + \x51 |0 + \x52 |0 + \x53 |0 + \x54 |0 + \x55 |0 + \x56 |0 + \x57 |0 + \x58 |0 + \x59 |0 + \x5A |0 + \x5B |0 + \x5C |0 + \x5D |0 + \x5E |0 + \x5F |0 + \x60 |0 + \x61 |0 + \x62 |0 + \x63 |0 + \x64 |0 + \x65 |0 + \x66 |0 + \x67 |0 + \x68 |0 + \x69 |0 + \x6A |0 + \x6B |0 + \x6C |0 + \x6D |0 + \x6E |0 + \x6F |0 + \x70 |0 + \x71 |0 + \x72 |0 + \x73 |0 + \x74 |0 + \x75 |0 + \x76 |0 + \x77 |0 + \x78 |0 + \x79 |0 + \x7A |0 + \x7B |0 + \x7C |0 + \x7D |0 + \x7E |0 + \x1C |0 + \xFF |0 + \x96 |0 + \x9C |0 + \x9F |0 + \xA7 |0 + \xF5 |0 + \xA8 |0 + \xAE |0 + \xAA |0 + \xF0 |0 + \xA9 |0 + \xF8 |0 + \xF1 |0 + \xFD |0 + \xFC |0 + \xE6 |0 + \xF4 |0 + \xFA |0 + \xFB |0 + \xAF |0 + \xAC |0 + \xAB |0 + \xF3 |0 + \x8E |0 + \x8F |0 + \x92 |0 + \x90 |0 + \xE0 |0 + \xE5 |0 + \x99 |0 + \x9E |0 + \x9D |0 + \x9A |0 + \xE1 |0 + \x84 |0 + \x86 |0 + \x91 |0 + \x82 |0 + \xA2 |0 + \xE4 |0 + \x94 |0 + \xF6 |0 + \x9B |0 + \x81 |0 + \xA0 |0 + \x83 |0 + \xB5 |0 + \xD0 |0 + \x80 |0 + \x87 |0 + \xB6 |0 + \xD1 |0 + \xED |0 + \x89 |0 + \xB8 |0 + \xD3 |0 + \xB7 |0 + \xD2 |0 + \x95 |0 + \x85 |0 + \xA1 |0 + \x8C |0 + \xBD |0 + \xD4 |0 + \xE8 |0 + \xE9 |0 + \xEA |0 + \xEB |0 + \xAD |0 + \x88 |0 + \xE3 |0 + \xE7 |0 + \xEE |0 + \xEC |0 + \xE2 |0 + \x93 |0 + \x8A |0 + \x8B |0 + \x97 |0 + \x98 |0 + \xBE |0 + \xD5 |0 + \xC7 |0 + \xD7 |0 + \xC6 |0 + \xD6 |0 + \x8D |0 + \xA5 |0 + \xA3 |0 + \xA4 |0 + \xCF |0 + \xD8 |0 + \xEF |0 + \xF2 |0 + \xA6 |0 + \xF7 |0 + \x07 |1 + \x13 |1 + \x1B |1 + \x18 |1 + \x1A |1 + \x19 |1 + \x1D |1 + \x12 |1 + \x17 |1 + \xF9 |0 + \x1C |1 + \x7F |2 + \xC4 |0 + \xB3 |0 + \xDA |0 + \xBF |0 + \xC0 |0 + \xD9 |0 + \xC3 |0 + \xB4 |0 + \xC2 |0 + \xC1 |0 + \xC5 |0 + \xCD |0 + \xBA |0 + \xC9 |0 + \xBB |0 + \xC8 |0 + \xBC |0 + \xCC |0 + \xB9 |0 + \xCB |0 + \xCA |0 + \xCE |0 + \xDF |0 + \xDC |0 + \xDB |0 + \xDD |0 + \xDE |0 + \xB0 |0 + \xB1 |0 + \xB2 |0 + \xFE |0 + \x16 |1 + \x1E |1 + \x10 |1 + \x1F |1 + \x11 |1 + \x09 |1 + \x08 |1 + \x0A |1 + \x01 |1 + \x02 |1 + \x0F |1 + \x0C |1 + \x0B |1 + \x06 |1 + \x05 |1 + \x03 |1 + \x04 |1 + \x0D |1 + \x0E |1 + \x21 |1 + \x22 |1 + \x23 |1 + \x24 |1 + \x25 |1 + \x26 |1 + \x27 |1 + \x28 |1 + \x29 |1 + \x2A |1 + \x2B |1 + \x2C |1 + \x2D |1 + \x2E |1 + \x2F |1 + \x30 |1 + \x31 |1 + \x32 |1 + \x33 |1 + \x34 |1 + \x35 |1 + \x36 |1 + \x37 |1 + \x38 |1 + \x39 |1 + \x3A |1 + \x3B |1 + \x3C |1 + \x3D |1 + \x3E |1 + \x3F |1 + \x40 |1 + \x41 |1 + \x42 |1 + \x43 |1 + \x44 |1 + \x45 |1 + \x46 |1 + \x47 |1 + \x48 |1 + \x49 |1 + \x4A |1 + \x4B |1 + \x4C |1 + \x4D |1 + \x4E |1 + \x4F |1 + \x50 |1 + \x51 |1 + \x52 |1 + \x53 |1 + \x54 |1 + \x55 |1 + \x56 |1 + \x57 |1 + \x58 |1 + \x59 |1 + \x5A |1 + \x5B |1 + \x5C |1 + \x5D |1 + \x5E |1 + \x5F |1 + \x60 |1 + \x61 |1 + \x62 |1 + \x63 |1 + \x64 |1 + \x65 |1 + \x66 |1 + \x67 |1 + \x68 |1 + \x69 |1 + \x6A |1 + \x6B |1 + \x6C |1 + \x6D |1 + \x6E |1 + \x6F |1 + \x70 |1 + \x71 |1 + \x72 |1 + \x73 |1 + \x74 |1 + \x75 |1 + \x76 |1 + \x77 |1 + \x78 |1 + \x79 |1 + \x7A |1 + \x7B |1 + \x7C |1 + \x7D |1 + \x7E |1 + \xB3 |1 + \x1B |1 + \x18 |1 + \x1A |1 + \x19 |1 + \xFE |1 + \x09 |1 +END CHARMAP diff --git a/mcs/class/I18N/tools/cvt.sh b/mcs/class/I18N/tools/cvt.sh index f23a3ba004..5a3ab48255 100755 --- a/mcs/class/I18N/tools/cvt.sh +++ b/mcs/class/I18N/tools/cvt.sh @@ -67,6 +67,20 @@ ${UCM2CP} --region Rare --page 708 --wpage 1256 \ --no-browser-save --no-mailnews-display \ --no-mailnews-save Rare/ibm-1089.ucm >Rare/CP708.cs +${UCM2CP} --region Rare --page 737 --wpage 1253 \ + --name 'Greek (DOS)' \ + --webname ibm737 --bodyname ibm737 \ + --headername ibm737 --no-browser-display \ + --no-browser-save --no-mailnews-display \ + --no-mailnews-save Rare/ibm-737.ucm >Rare/CP737.cs + +${UCM2CP} --region Rare --page 775 --wpage 1257 \ + --name 'Baltic (DOS)' \ + --webname ibm775 --bodyname ibm775 \ + --headername ibm775 --no-browser-display \ + --no-browser-save --no-mailnews-display \ + --no-mailnews-save Rare/ibm-775.ucm >Rare/CP775.cs + ${UCM2CP} --region West --page 850 --wpage 1252 \ --name 'Western European (DOS)' \ --webname ibm850 --bodyname ibm850 \ @@ -481,8 +495,6 @@ exit 0 # 709 Arabic - ASMO 449+, BCON V4 # 710 Arabic - Transparent Arabic # 720 Arabic - Transparent ASMO -# 737 OEM - Greek (formerly 437G) -# 775 OEM - Baltic # 936 Chinese Simplified (GB2312) # 949 Korean # 950 Chinese Traditional (Big5) diff --git a/mcs/class/I18N/tools/uni2tab.c b/mcs/class/I18N/tools/uni2tab.c index a740131974..0de297513f 100644 --- a/mcs/class/I18N/tools/uni2tab.c +++ b/mcs/class/I18N/tools/uni2tab.c @@ -23,12 +23,15 @@ */ /* - -Usage: uni2tab - -Required files from ftp.unicode.org: Unihan.txt, CP932.TXT - -*/ + * + * Usage: uni2tab + * + * Required files from ftp.unicode.org: Unihan.txt, CP932.TXT + * + * Unihan.txt and CP932.TXT can be found at: + * ftp://www.unicode.org/Public/5.0.0/ucd/Unihan.txt + * ftp://ftp.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP932.TXT + */ #include #include @@ -321,6 +324,13 @@ static void convertSJISLine(char *buf) /* Non-CJK characters within JIS */ processJis0208(code, (offset / 94) + 1, (offset % 94) + 1); } + else if(code >= 0x00A7 && code <= 0x00F7) + { + /* Non-CJK characters within JIS for which unicodeToJis should not be + * edited. In addition to this, do not track lowJis and highJis. */ + jisx0208ToUnicode[offset] = (unsigned short)(code & 0xFF); + jisx0208ToUnicode[offset + 1] = (((unsigned short)(code & 0x00FF)) >> 8); + } } /* diff --git a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs index 2ee7b66d6f..1e1760d7c7 100644 --- a/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs +++ b/mcs/class/Microsoft.Build/Test/Microsoft.Build.Execution/BuildSubmissionTest.cs @@ -102,8 +102,8 @@ namespace MonoTests.Microsoft.Build.Execution AssertHelper.GreaterOrEqual (endBuildDone, TimeSpan.FromSeconds (1), "#2"); AssertHelper.GreaterOrEqual (waitDone, TimeSpan.FromSeconds (1), "#3"); AssertHelper.GreaterOrEqual (endBuildDone, waitDone, "#4"); - AssertHelper.LessOrEqual (endBuildDone, TimeSpan.FromSeconds (2), "#5"); - AssertHelper.LessOrEqual (waitDone, TimeSpan.FromSeconds (2), "#6"); + AssertHelper.LessOrEqual (endBuildDone, TimeSpan.FromSeconds (2.5), "#5"); + AssertHelper.LessOrEqual (waitDone, TimeSpan.FromSeconds (2.5), "#6"); } [Test] diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/EnumMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/EnumMirror.cs index 5131b2a434..66a77b3083 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/EnumMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/EnumMirror.cs @@ -19,7 +19,8 @@ namespace Mono.Debugger.Soft if (!type.IsEnum) throw new ArgumentException ("type must be an enum type", "type"); TypeMirror t = type.EnumUnderlyingType; - if (value.Value == null || !value.Value.GetType ().IsPrimitive || t != vm.RootDomain.GetCorrespondingType (value.Value.GetType ())) + // Can't access t's domain, so compare type names + if (value.Value == null || !value.Value.GetType ().IsPrimitive || t.Name != vm.RootDomain.GetCorrespondingType (value.Value.GetType ()).Name) throw new ArgumentException ("Value '" + value.Value + "' does not match the type of the enum."); } diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index 911a679793..97202372c7 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -434,6 +434,7 @@ public class Tests : TestsBase, ITest2 } ss7 (); ss_nested (); + ss_nested_with_two_args_wrapper (); ss_regress_654694 (); ss_step_through (); ss_non_user_code (); @@ -550,6 +551,21 @@ public class Tests : TestsBase, ITest2 ss_nested_3 (); } + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static void ss_nested_with_two_args_wrapper () { + ss_nested_with_two_args(ss_nested_arg (), ss_nested_arg ()); + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static int ss_nested_with_two_args (int a1, int a2) { + return a1 + a2; + } + + [MethodImplAttribute (MethodImplOptions.NoInlining)] + public static int ss_nested_arg () { + return 0; + } + [MethodImplAttribute (MethodImplOptions.NoInlining)] public static void ss_nested_1 (int i) { } 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 d09c851cd5..859ce2963f 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 @@ -4f98dd44c4ad965aaddbb1adaa28149767c715b2 \ No newline at end of file +96529d5a708f73c047a79844dc5eabe9042baa22 \ No newline at end of file diff --git a/mcs/class/Mono.Options/Mono.Options/Options.cs b/mcs/class/Mono.Options/Mono.Options/Options.cs index a68c1608b7..af7eea850c 100644 --- a/mcs/class/Mono.Options/Mono.Options/Options.cs +++ b/mcs/class/Mono.Options/Mono.Options/Options.cs @@ -1390,28 +1390,27 @@ namespace Mono.Options o.Write (s); } - private static string GetArgumentName (int index, int maxIndex, string description) + static string GetArgumentName (int index, int maxIndex, string description) { - if (description == null) - return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); - string[] nameStart; - if (maxIndex == 1) - nameStart = new string[]{"{0:", "{"}; - else - nameStart = new string[]{"{" + index + ":"}; - for (int i = 0; i < nameStart.Length; ++i) { - int start, j = 0; - do { - start = description.IndexOf (nameStart [i], j); - } while (start >= 0 && j != 0 ? description [j++ - 1] == '{' : false); - if (start == -1) - continue; - int end = description.IndexOf ("}", start); - if (end == -1) - continue; - return description.Substring (start + nameStart [i].Length, end - start - nameStart [i].Length); + var matches = Regex.Matches (description ?? "", @"(?<=(? 1 + if (maxIndex > 1 && parts.Length == 2 && + parts[0] == index.ToString (CultureInfo.InvariantCulture)) { + argName = parts[1]; + } } - return maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); + + if (string.IsNullOrEmpty (argName)) { + argName = maxIndex == 1 ? "VALUE" : "VALUE" + (index + 1); + } + return argName; } private static string GetDescription (string description) diff --git a/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs b/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs index 790d55dea2..1b8ca0a588 100644 --- a/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs +++ b/mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs @@ -413,6 +413,8 @@ namespace MonoTests.Mono.Options { "color2:", "set {color}", v => {} }, { "rk=", "required key/value option", (k, v) => {} }, { "rk2=", "required {{foo}} {0:key}/{1:value} option", (k, v) => {} }, + { "rk3=", "required {{foo}} {}", k => {} }, + { "rk4=", "required {{foo}} {0:val}", k => {} }, { "ok:", "optional key/value option", (k, v) => {} }, { "long-desc", "This has a really\nlong, multi-line description that also\ntests\n" + @@ -456,6 +458,8 @@ namespace MonoTests.Mono.Options expected.WriteLine (" --color2[=color] set color"); expected.WriteLine (" --rk=VALUE1:VALUE2 required key/value option"); expected.WriteLine (" --rk2=key:value required {foo} key/value option"); + expected.WriteLine (" --rk3=VALUE required {foo}"); + expected.WriteLine (" --rk4=val required {foo} val"); expected.WriteLine (" --ok[=VALUE1:VALUE2] optional key/value option"); expected.WriteLine (" --long-desc This has a really"); expected.WriteLine (" long, multi-line description that also"); diff --git a/mcs/class/Mono.Profiler.Log/Makefile b/mcs/class/Mono.Profiler.Log/Makefile index d8f11017c5..84d4ed93a8 100644 --- a/mcs/class/Mono.Profiler.Log/Makefile +++ b/mcs/class/Mono.Profiler.Log/Makefile @@ -6,7 +6,7 @@ LIBRARY_SNK = ../mono.snk LIB_REFS = System System.Core KEYFILE = $(LIBRARY_SNK) -LIB_MCS_FLAGS = /unsafe /publicsign +LIB_MCS_FLAGS = /unsafe /publicsign /nowarn:0618 LIBRARY_WARN_AS_ERROR = yes diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs index c4ffb2bb92..945584340d 100644 --- a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs @@ -54,6 +54,8 @@ namespace Mono.Profiler.Log { HeapEnd = 1 << 4, HeapObject = 2 << 4, HeapRoots = 3 << 4, + HeapRootRegister = 4 << 4, + HeapRootUnregister = 5 << 4, SampleHit = 0 << 4, SampleUnmanagedSymbol = 1 << 4, @@ -74,6 +76,7 @@ namespace Mono.Profiler.Log { AppDomain = 4, Thread = 5, Context = 6, + VTable = 7, } // mono/utils/mono-counters.h : MONO_COUNTER_* @@ -133,6 +136,7 @@ namespace Mono.Profiler.Log { // mono/metadata/profiler.h : MonoProfilerGCRootType [Flags] + [Obsolete ("The event field using this enum is no longer produced.")] public enum LogHeapRootAttributes { Pinning = 1 << 8, WeakReference = 2 << 8, @@ -147,6 +151,26 @@ namespace Mono.Profiler.Log { TypeMask = 0xff, } + // mono/metadata/mono-gc.h : MonoGCRootSource + public enum LogHeapRootSource { + External = 0, + Stack = 1, + FinalizerQueue = 2, + Static = 3, + ThreadStatic = 4, + ContextStatic = 5, + GCHandle = 6, + Jit = 7, + Threading = 8, + AppDomain = 9, + Reflection = 10, + Marshal = 11, + ThreadPool = 12, + Debugger = 13, + Handle = 14, + Ephemeron = 15, + } + // mono/profiler/log.h : MonoProfilerMonitorEvent public enum LogMonitorEvent { Contention = 1, diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEventVisitor.cs b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEventVisitor.cs index b49416cd2c..79d6140523 100644 --- a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEventVisitor.cs +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEventVisitor.cs @@ -66,6 +66,10 @@ namespace Mono.Profiler.Log { { } + public virtual void Visit (VTableLoadEvent ev) + { + } + public virtual void Visit (JitEvent ev) { } @@ -94,6 +98,14 @@ namespace Mono.Profiler.Log { { } + public virtual void Visit (HeapRootRegisterEvent ev) + { + } + + public virtual void Visit (HeapRootUnregisterEvent ev) + { + } + public virtual void Visit (GCEvent ev) { } diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEvents.cs b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEvents.cs index 113bf3edc1..faae978cd9 100644 --- a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEvents.cs +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEvents.cs @@ -161,6 +161,20 @@ namespace Mono.Profiler.Log { } } + public sealed class VTableLoadEvent : LogEvent { + + public long VTablePointer { get; internal set; } + + public long AppDomainId { get; internal set; } + + public long ClassPointer { get; internal set; } + + internal override void Accept (LogEventVisitor visitor) + { + visitor.Visit (this); + } + } + public sealed class JitEvent : LogEvent { public long MethodPointer { get; internal set; } @@ -195,8 +209,11 @@ namespace Mono.Profiler.Log { public sealed class AllocationEvent : LogEvent { + [Obsolete ("This field is no longer produced.")] public long ClassPointer { get; internal set; } + public long VTablePointer { get; internal set; } + public long ObjectPointer { get; internal set; } public long ObjectSize { get; internal set; } @@ -236,8 +253,11 @@ namespace Mono.Profiler.Log { public long ObjectPointer { get; internal set; } + [Obsolete ("This field is no longer produced.")] public long ClassPointer { get; internal set; } + public long VTablePointer { get; internal set; } + public long ObjectSize { get; internal set; } public IReadOnlyList References { get; internal set; } @@ -252,13 +272,18 @@ namespace Mono.Profiler.Log { public struct HeapRoot { + public long AddressPointer { get; internal set; } + public long ObjectPointer { get; internal set; } + [Obsolete ("This field is no longer produced.")] public LogHeapRootAttributes Attributes { get; internal set; } + [Obsolete ("This field is no longer produced.")] public long ExtraInfo { get; internal set; } } + [Obsolete ("This field is no longer produced.")] public long MaxGenerationCollectionCount { get; internal set; } public IReadOnlyList Roots { get; internal set; } @@ -269,6 +294,34 @@ namespace Mono.Profiler.Log { } } + public sealed class HeapRootRegisterEvent : LogEvent { + + public long RootPointer { get; internal set; } + + public long RootSize { get; internal set; } + + public LogHeapRootSource Source { get; internal set; } + + public long Key { get; internal set; } + + public string Name { get; internal set; } + + internal override void Accept (LogEventVisitor visitor) + { + visitor.Visit (this); + } + } + + public sealed class HeapRootUnregisterEvent : LogEvent { + + public long RootPointer { get; internal set; } + + internal override void Accept (LogEventVisitor visitor) + { + visitor.Visit (this); + } + } + public sealed class GCEvent : LogEvent { public LogGCEvent Type { get; internal set; } diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogProcessor.cs b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogProcessor.cs index d40897c3a7..6e26d22786 100644 --- a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogProcessor.cs +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogProcessor.cs @@ -127,7 +127,8 @@ namespace Mono.Profiler.Log { case LogEventType.AllocationBacktrace: case LogEventType.AllocationNoBacktrace: ev = new AllocationEvent { - ClassPointer = ReadPointer (), + ClassPointer = StreamHeader.FormatVersion < 15 ? ReadPointer () : 0, + VTablePointer = StreamHeader.FormatVersion >= 15 ? ReadPointer () : 0, ObjectPointer = ReadObject (), ObjectSize = (long) _reader.ReadULeb128 (), Backtrace = ReadBacktrace (extType == LogEventType.AllocationBacktrace), @@ -305,6 +306,16 @@ namespace Mono.Profiler.Log { } else throw new LogException ("Invalid context metadata event."); break; + case LogMetadataType.VTable: + if (load) { + ev = new VTableLoadEvent { + VTablePointer = ReadPointer (), + AppDomainId = ReadPointer (), + ClassPointer = ReadPointer (), + }; + } else + throw new LogException ("Invalid VTable metadata event."); + break; default: throw new LogException ($"Invalid metadata type ({metadataType})."); } @@ -373,8 +384,8 @@ namespace Mono.Profiler.Log { case LogEventType.MonitorBacktrace: ev = new MonitorEvent { Event = StreamHeader.FormatVersion >= 14 ? - (LogMonitorEvent) _reader.ReadByte () : - (LogMonitorEvent) ((((byte) type & 0xf0) >> 4) & 0x3), + (LogMonitorEvent) _reader.ReadByte () : + (LogMonitorEvent) ((((byte) type & 0xf0) >> 4) & 0x3), ObjectPointer = ReadObject (), Backtrace = ReadBacktrace (extType == LogEventType.MonitorBacktrace), }; @@ -394,7 +405,8 @@ namespace Mono.Profiler.Log { case LogEventType.HeapObject: { HeapObjectEvent hoe = new HeapObjectEvent { ObjectPointer = ReadObject (), - ClassPointer = ReadPointer (), + ClassPointer = StreamHeader.FormatVersion < 15 ? ReadPointer () : 0, + VTablePointer = StreamHeader.FormatVersion >= 15 ? ReadPointer () : 0, ObjectSize = (long) _reader.ReadULeb128 (), }; @@ -414,17 +426,22 @@ namespace Mono.Profiler.Log { } case LogEventType.HeapRoots: { - // TODO: This entire event makes no sense. var hre = new HeapRootsEvent (); var list = new HeapRootsEvent.HeapRoot [(int) _reader.ReadULeb128 ()]; - hre.MaxGenerationCollectionCount = (long) _reader.ReadULeb128 (); + if (StreamHeader.FormatVersion < 15) + hre.MaxGenerationCollectionCount = (long) _reader.ReadULeb128 (); for (var i = 0; i < list.Length; i++) { list [i] = new HeapRootsEvent.HeapRoot { + AddressPointer = StreamHeader.FormatVersion >= 15 ? ReadPointer () : 0, ObjectPointer = ReadObject (), - Attributes = StreamHeader.FormatVersion == 13 ? (LogHeapRootAttributes) _reader.ReadByte () : (LogHeapRootAttributes) _reader.ReadULeb128 (), - ExtraInfo = (long) _reader.ReadULeb128 (), + Attributes = StreamHeader.FormatVersion < 15 ? + (StreamHeader.FormatVersion == 13 ? + (LogHeapRootAttributes) _reader.ReadByte () : + (LogHeapRootAttributes) _reader.ReadULeb128 ()) : + 0, + ExtraInfo = StreamHeader.FormatVersion < 15 ? (long) _reader.ReadULeb128 () : 0, }; } @@ -433,6 +450,20 @@ namespace Mono.Profiler.Log { break; } + case LogEventType.HeapRootRegister: + ev = new HeapRootRegisterEvent { + RootPointer = ReadPointer (), + RootSize = (long) _reader.ReadULeb128 (), + Source = (LogHeapRootSource) _reader.ReadByte (), + Key = ReadPointer (), + Name = _reader.ReadCString (), + }; + break; + case LogEventType.HeapRootUnregister: + ev = new HeapRootUnregisterEvent { + RootPointer = ReadPointer (), + }; + break; default: throw new LogException ($"Invalid extended event type ({extType})."); } @@ -476,9 +507,9 @@ namespace Mono.Profiler.Log { Section = section, SectionName = section == LogCounterSection.User ? _reader.ReadCString () : null, CounterName = _reader.ReadCString (), - Type = (LogCounterType) _reader.ReadByte (), - Unit = (LogCounterUnit) _reader.ReadByte (), - Variance = (LogCounterVariance) _reader.ReadByte (), + Type = StreamHeader.FormatVersion < 15 ? (LogCounterType) _reader.ReadByte () : (LogCounterType) _reader.ReadULeb128 (), + Unit = StreamHeader.FormatVersion < 15 ? (LogCounterUnit) _reader.ReadByte () : (LogCounterUnit) _reader.ReadULeb128 (), + Variance = StreamHeader.FormatVersion < 15 ? (LogCounterVariance) _reader.ReadByte () : (LogCounterVariance) _reader.ReadULeb128 (), Index = (long) _reader.ReadULeb128 (), }; } @@ -498,7 +529,7 @@ namespace Mono.Profiler.Log { if (index == 0) break; - var counterType = (LogCounterType) _reader.ReadByte (); + var counterType = StreamHeader.FormatVersion < 15 ? (LogCounterType) _reader.ReadByte () : (LogCounterType) _reader.ReadULeb128 (); object value = null; @@ -544,6 +575,9 @@ namespace Mono.Profiler.Log { case LogEventType.RuntimeJitHelper: { var helperType = (LogJitHelper) _reader.ReadByte (); + if (StreamHeader.FormatVersion < 14) + helperType--; + ev = new JitHelperEvent { Type = helperType, BufferPointer = ReadPointer (), diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs index 44575028a7..aa86b75444 100644 --- a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs @@ -9,7 +9,7 @@ namespace Mono.Profiler.Log { public sealed class LogStreamHeader { const int MinVersion = 13; - const int MaxVersion = 14; + const int MaxVersion = 15; const int Id = 0x4d505a01; diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs index a155874cd6..0397764647 100644 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs @@ -31,6 +31,64 @@ using System; using System.IO; using System.Security.Cryptography; +/* +FIXME There are a number of problems and deficiencies in this code. + +- It requires the PE header to fit in 4K. This is not guaranteed +by the file format and it is easy to construct valid files that violate it. +i.e. with a large MS-DOS header. The code should just read the entire +file into memory. + +- It has a number of missing or incorrect range checks. + Incorrect, as in, checking that record or field starts within + range, but does not end within range. + +- It removes/ignores COFF symbols. These rarely/never occur, but removing +them is not likely correct. It is not mentioned in either of the two specifications. +This seems to be extra unnecessary incorrect code. + +- There are two specifications, Authenticode and PE: +https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/Authenticode_PE.docx +https://www.microsoft.com/whdc/system/platform/firmware/PECOFF.mspx +https://msdn.microsoft.com/library/windows/desktop/ms680547(v=vs.85).aspx + +These are in contradiction regarding hashing of data after the sections. +Such data is usually absent. More comparison is need between +Mono runtime and desktop runtime/tools. +The most common such data is an older signature, which is supposed to be ignored. +The next most common is appended setup data, which isn't likely with managed code. + However this code has nothing to do with signing managed code specifically, just PEs. +There is a slight inconsistency in the Authenticode_PE.doc around the location +of the signature vs. other data past sections. +The picture has the signature first, the text puts last. + +- A buffer size of 4K is small and probably not performant. + Buffering makes the code harder to update and correct, vs. + reading the entire file into memory. + +- It does not validate NumberOfRvasAndSizes field. + Usually it is valid. + +- It is missing a number of other validations. + For example, the optional header magic was ignored, so in the + interest of small change, we treat all non-0x20B values the same. + +Mail with Microsoft confirms the documents do not agree, and that the PE document +is outdated and/or incorrect and/or referring to no longer supported v1 Authenticode, +and that the intent is for the signature to be at the end, per the text and not the picture. +And that data past the sections is to be hashed -- there rarely is any. + +The plan is therefore: + read the entire file into memory + add missing validation + hash, excluding checksum, security directory, and security content + place security content at the end, replacing what is there if anything + remove the symbol code (here and in formatter) + expose more offsets from here to cleanup the formatter code + +There is also no unit tests for this code it seems. +*/ + namespace Mono.Security.Authenticode { // References: @@ -64,9 +122,20 @@ namespace Mono.Security.Authenticode { private int dirSecurityOffset; private int dirSecuritySize; private int coffSymbolTableOffset; + private bool pe64; + + internal bool PE64 { + get { + if (blockNo < 1) + ReadFirstBlock (); + return pe64; + } + } public AuthenticodeBase () { + // FIXME Read the entire file into memory. + // See earlier comments. fileblock = new byte [4096]; } @@ -142,11 +211,17 @@ namespace Mono.Security.Authenticode { peOffset = BitConverterLE.ToInt32 (fileblock, 60); if (peOffset > fileblock.Length) { // just in case (0.1%) this can actually happen + // FIXME This does not mean the file is invalid, + // just that this code cannot handle it. + // FIXME Read the entire file into memory. + // See earlier comments. string msg = String.Format (Locale.GetText ( "Header size too big (> {0} bytes)."), fileblock.Length); throw new NotSupportedException (msg); } + // FIXME This verifies that PE starts within the file, + // but not that it fits. if (peOffset > fs.Length) return 4; @@ -156,12 +231,33 @@ namespace Mono.Security.Authenticode { if (BitConverterLE.ToUInt32 (fileblock, peOffset) != 0x4550) return 5; - // 2.2. Locate IMAGE_DIRECTORY_ENTRY_SECURITY (offset and size) - dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 152); - dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 156); + // PE signature is followed by 20 byte file header, and + // then 2 byte magic 0x10B for PE32 or 0x20B for PE32+, + // or 0x107 for the obscure ROM case. + // FIXME The code historically ignored this magic value + // entirely, so we only treat 0x20B differently to maintain + // this dubious behavior. + // FIXME The code also lacks range checks in a number of places, + // and will access arrays out of bounds for valid files. - // COFF symbol tables are deprecated - we'll strip them if we see them! - // (otherwise the signature won't work on MS and we don't want to support COFF for that) + ushort magic = BitConverterLE.ToUInt16 (fileblock, peOffset + 24); + const int IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x20B; + pe64 = magic == IMAGE_NT_OPTIONAL_HDR64_MAGIC; + + // FIXME This fails to validate NumberOfRvasAndSizes. + // 2.2. Locate IMAGE_DIRECTORY_ENTRY_SECURITY (offset and size) + // These offsets are from the documentation, but add 24 for + // PE signature and file header. + if (pe64) { + dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 168); + dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 168 + 4); + } + else { + dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 152); + dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 156); + } + + // FIXME Remove this code and the dependency on it. coffSymbolTableOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 12); return 0; @@ -229,14 +325,38 @@ namespace Mono.Security.Authenticode { // Authenticode(r) gymnastics // Hash from (generally) 0 to 215 (216 bytes) + // 88 = 64 + 24 + // 64 is the offset of Checksum within OptionalHeader. + // 24 is offset of OptionalHeader within PEHeader. int pe = peOffset + 88; hash.TransformBlock (fileblock, 0, pe, fileblock, 0); // then skip 4 for checksum pe += 4; - // Continue hashing from (generally) 220 to 279 (60 bytes) - hash.TransformBlock (fileblock, pe, 60, fileblock, pe); - // then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY - pe += 68; + + if (pe64) { + // security_directory, if present, is at offset 144 within OptionalHeader64 + // FIXME This code fails to check if the security_directory is present. + // If it is absent, it may or may not be difficult to add, and reject + // the file as valid but unsignable. + // Checksum is at [64, 68]. + // 144 - 68 = 76 + // Hash from checksum to security_directory. + hash.TransformBlock (fileblock, pe, 76, fileblock, pe); + // then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY + pe += 76 + 8; + } + else { + // security_directory, if present, is at offset 128 within OptionalHeader32 + // FIXME This code fails to check if the security_directory is present. + // If it is absent, it may or may not be difficult to add, and reject + // the file as valid but unsignable. + // Checksum is at [64, 68]. + // 128 - 68 = 60 + // Continue hashing from (generally) 220 to 279 (60 bytes) + hash.TransformBlock (fileblock, pe, 60, fileblock, pe); + // then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY + pe += 68; + } // everything is present so start the hashing if (n == 0) { diff --git a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs index f91a3a9594..0729bec2f4 100644 --- a/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs +++ b/mcs/class/Mono.Security/Mono.Security.Authenticode/AuthenticodeFormatter.cs @@ -148,19 +148,19 @@ namespace Mono.Security.Authenticode { } // pkcs 1 -// private const string rsaEncryption = "1.2.840.113549.1.1.1"; + // private const string rsaEncryption = "1.2.840.113549.1.1.1"; // pkcs 7 -// private const string data = "1.2.840.113549.1.7.1"; + // private const string data = "1.2.840.113549.1.7.1"; private const string signedData = "1.2.840.113549.1.7.2"; // pkcs 9 -// private const string contentType = "1.2.840.113549.1.9.3"; -// private const string messageDigest = "1.2.840.113549.1.9.4"; + // private const string contentType = "1.2.840.113549.1.9.3"; + // private const string messageDigest = "1.2.840.113549.1.9.4"; private const string countersignature = "1.2.840.113549.1.9.6"; // microsoft spc (software publisher certificate) private const string spcStatementType = "1.3.6.1.4.1.311.2.1.11"; private const string spcSpOpusInfo = "1.3.6.1.4.1.311.2.1.12"; private const string spcPelmageData = "1.3.6.1.4.1.311.2.1.15"; -// private const string individualCodeSigning = "1.3.6.1.4.1.311.2.1.21"; + // private const string individualCodeSigning = "1.3.6.1.4.1.311.2.1.21"; private const string commercialCodeSigning = "1.3.6.1.4.1.311.2.1.22"; private const string timestampCountersignature = "1.3.6.1.4.1.311.3.2.1"; @@ -192,8 +192,8 @@ namespace Mono.Security.Authenticode { else opus = Attribute (spcSpOpusInfo, Opus (description, url.ToString ())); pkcs7.SignerInfo.AuthenticatedAttributes.Add (opus); -// When using the MS Root Agency (test) we can't include this attribute in the signature or it won't validate! -// pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (spcStatementType, new ASN1 (0x30, ASN1Convert.FromOid (commercialCodeSigning).GetBytes ()))); + // When using the MS Root Agency (test) we can't include this attribute in the signature or it won't validate! + // pkcs7.SignerInfo.AuthenticatedAttributes.Add (Attribute (spcStatementType, new ASN1 (0x30, ASN1Convert.FromOid (commercialCodeSigning).GetBytes ()))); pkcs7.GetASN1 (); // sign return pkcs7.SignerInfo.Signature; } @@ -243,9 +243,14 @@ namespace Mono.Security.Authenticode { using (FileStream fs = File.Open (fileName, FileMode.Open, FileAccess.ReadWrite)) { int filesize; if (SecurityOffset > 0) { + // FIXME Does it fit? Is it always the same size? // file was already signed, we'll reuse the position for the updated signature filesize = SecurityOffset; } else if (CoffSymbolTableOffset > 0) { + // FIXME This is not documented as something to remove. + // However some documentation says to remove after the last + // section, and some does not, and this might be there, + // or it might not. // strip (deprecated) COFF symbol table fs.Seek (PEOffset + 12, SeekOrigin.Begin); for (int i = 0; i < 8; i++) @@ -263,14 +268,22 @@ namespace Mono.Security.Authenticode { // IMAGE_DIRECTORY_ENTRY_SECURITY (offset, size) byte[] data = BitConverterLE.GetBytes (filesize + addsize); - fs.Seek (PEOffset + 152, SeekOrigin.Begin); + if (PE64) + fs.Seek (PEOffset + 168, SeekOrigin.Begin); + else + fs.Seek (PEOffset + 152, SeekOrigin.Begin); + fs.Write (data, 0, 4); int size = asn.Length + 8; int addsize_signature = (size & 7); if (addsize_signature > 0) addsize_signature = 8 - addsize_signature; data = BitConverterLE.GetBytes (size + addsize_signature); - fs.Seek (PEOffset + 156, SeekOrigin.Begin); + if (PE64) + fs.Seek (PEOffset + 168 + 4, SeekOrigin.Begin); + else + fs.Seek (PEOffset + 156, SeekOrigin.Begin); + fs.Write (data, 0, 4); fs.Seek (filesize, SeekOrigin.Begin); // align certificate entry to a multiple of 8 bytes @@ -278,8 +291,40 @@ namespace Mono.Security.Authenticode { byte[] fillup = new byte[addsize]; fs.Write (fillup, 0, fillup.Length); } + + /* + https://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/Authenticode_PE.docx + The Authenticode signature is in a WIN_CERTIFICATE structure, which is declared in Wintrust.h as follows: + typedef struct _WIN_CERTIFICATE + { + DWORD dwLength; + WORD wRevision; + WORD wCertificateType; + BYTE bCertificate[ANYSIZE_ARRAY]; + } WIN_CERTIFICATE, *LPWIN_CERTIFICATE; + + The fields in WIN_CERTIFICATE are set to the following values: + dwLength is set to the length of bCertificate. + wRevision is set to the WIN_CERTIFICATE version number. + + wCertificateType is set to 0x0002 for Authenticode signatures. + This value is defined in Wintrust.h as WIN_CERT_TYPE_PKCS_SIGNED_DATA. + bCertificate is set to a variable-length binary array that contains the Authenticode PKCS #7 signedData. + The PKCS #7 integrity is verified as described in ”PKCS #7: Cryptographic Message Syntax Standard.” + */ + // write WIN_CERTIFICATE.dwLength fs.Write (data, 0, data.Length); // length (again) - data = BitConverterLE.GetBytes (0x00020200); // magic + // write WIN_CERTIFICATE.wRevision = 0x0200 and wCertificateType = 2. + // /usr/local/Cellar/mingw-w64/5.0.3/toolchain-x86_64/x86_64-w64-mingw32/include/wintrust.h + // const short WIN_CERT_REVISION_1_0 = 0x0100; + const short WIN_CERT_REVISION_2_0 = 0x0200; + // const short WIN_CERT_TYPE_X509 = 0x0001; + const short WIN_CERT_TYPE_PKCS_SIGNED_DATA = 0x0002; + // const short WIN_CERT_TYPE_RESERVED_1 = 0x0003; + // const short WIN_CERT_TYPE_TS_STACK_SIGNED = 0x0004; + data = BitConverterLE.GetBytes (WIN_CERT_REVISION_2_0); + fs.Write (data, 0, data.Length); + data = BitConverterLE.GetBytes (WIN_CERT_TYPE_PKCS_SIGNED_DATA); fs.Write (data, 0, data.Length); fs.Write (asn, 0, asn.Length); if (addsize_signature > 0) { diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs index 98026167d4..0a1fd9f3d1 100644 --- a/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs +++ b/mcs/class/Mono.Security/Test/Mono.Security.Authenticode/AuthenticodeDeformatterTest.cs @@ -700,7 +700,7 @@ namespace MonoTests.Mono.Security.Authenticode { AuthenticodeDeformatter ad = new AuthenticodeDeformatter (filename); // note: it's a valid signed PE file - but it doesn't // mean it's root is trusted on the current system - Assert.IsTrue (((ad.Reason == 0) || (ad.Reason == 6)), $"Reason = {ad.Reason}"); + Assert.IsTrue (((ad.Reason == 0) || (ad.Reason == 6)), "Reason"); Assert.AreEqual ("35-A5-21-3B-FC-FE-FA-40-97-AA-BB-DE-3B-52-15-6F", BitConverter.ToString (ad.Hash), "Hash"); Assert.AreEqual (632011370700000000, ad.Timestamp.ToUniversalTime ().Ticks, "Timestamp"); Assert.AreEqual (4, ad.Certificates.Count, "#Certificates"); diff --git a/mcs/class/System.Core/Makefile b/mcs/class/System.Core/Makefile index 566c5fb579..09990975ed 100644 --- a/mcs/class/System.Core/Makefile +++ b/mcs/class/System.Core/Makefile @@ -25,7 +25,7 @@ LIB_MCS_FLAGS += -d:NET_3_5 endif ifdef AOT_FRIENDLY_PROFILE -extra_test_flags := -exclude:NotWorkingInterpreter +extra_test_flags := -exclude:NotWorkingLinqInterpreter LIB_MCS_FLAGS += -d:NO_FEATURE_STATIC_DELEGATE,FEATURE_MAKE_RUN_METHODS else LIB_MCS_FLAGS += -d:FEATURE_COMPILE,FEATURE_COMPILE_TO_METHODBUILDER,FEATURE_PDB_GENERATOR @@ -52,6 +52,10 @@ BUILT_SOURCES = \ endif TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) +XTEST_LIB_REFS = System Facades/System.Threading.Tasks Microsoft.CSharp Facades/System.Text.RegularExpressions Facades/System.Reflection Facades/System.Reflection.Extensions Facades/System.Runtime.InteropServices.RuntimeInformation Facades/System.Reflection.Emit +# FEATURE_INTERPRET, FEATURE_COMPILE, NO_FEATURE_STATIC_DELEGATE +XTEST_LIB_FLAGS = -unsafe -d:FEATURE_COMPILE +XTEST_RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Collections.Immutable/src/Resources/Strings.resx include ../../build/library.make diff --git a/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs b/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs index d60b71b1f5..738342c76e 100644 --- a/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs +++ b/mcs/class/System.Core/System.IO.Pipes/PipeStream.cs @@ -137,7 +137,7 @@ namespace System.IO.Pipes #pragma warning disable 618 stream = new FileStream (handle.DangerousGetHandle (), CanRead ? (CanWrite ? FileAccess.ReadWrite : FileAccess.Read) - : FileAccess.Write, true, buffer_size, IsAsync); + : FileAccess.Write, false, buffer_size, IsAsync); #pragma warning restore 618 } return stream; diff --git a/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs b/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs index e533f0144b..9e64e03dd6 100644 --- a/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs +++ b/mcs/class/System.Core/Test/System.IO.MemoryMappedFiles/MemoryMappedFileTest.cs @@ -37,6 +37,7 @@ using NUnit.Framework; namespace MonoTests.System.IO.MemoryMappedFiles { [TestFixture] + [Category("NotWasm")] public class MemoryMappedFileTest { void AssertThrows (Action del) where ExType : Exception { diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs index 7757ca9d88..0e3bc26aff 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs @@ -403,7 +403,8 @@ namespace MonoTests.System.Linq.Expressions { [Test] [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=319190 - [Category ("NotWorkingInterpreter")] + [Category ("NotWorkingLinqInterpreter")] + [Category ("NotWasm")] public void Connect319190 () { var lambda = Expression.Lambda> ( diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs index d483cf778b..105ec20027 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs @@ -472,7 +472,7 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] + [Category ("NotWorkingLinqInterpreter")] public void NullableNullEqual () { var param = Expression.Parameter (typeof (DateTime?), "x"); diff --git a/mcs/class/System.Core/Test/System.Linq/EnumerableAsQueryableTest.cs b/mcs/class/System.Core/Test/System.Linq/EnumerableAsQueryableTest.cs index 7269f376c2..aee3bff9ee 100644 --- a/mcs/class/System.Core/Test/System.Linq/EnumerableAsQueryableTest.cs +++ b/mcs/class/System.Core/Test/System.Linq/EnumerableAsQueryableTest.cs @@ -324,7 +324,7 @@ namespace MonoTests.System.Linq { } [Test] - [Category ("NotWorkingInterpreter")] + [Category ("NotWorkingLinqInterpreter")] public void UserExtensionMethod () { BindingFlags extensionFlags = BindingFlags.Static | BindingFlags.Public; diff --git a/mcs/class/System.Core/Test/System.Threading.Tasks/TaskExtensionsTests.cs b/mcs/class/System.Core/Test/System.Threading.Tasks/TaskExtensionsTests.cs index f40535f6e9..e97d5f13ce 100644 --- a/mcs/class/System.Core/Test/System.Threading.Tasks/TaskExtensionsTests.cs +++ b/mcs/class/System.Core/Test/System.Threading.Tasks/TaskExtensionsTests.cs @@ -37,6 +37,7 @@ namespace MonoTests.System.Threading.Tasks public class TaskExtensionsTests { [Test] + [Category ("MultiThreaded")] public void TaskUnwrapingBehavioralTest () { Task t2 = Increment(4) diff --git a/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs b/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs index 027776c6f1..1c923a4ed9 100644 --- a/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs +++ b/mcs/class/System.Core/Test/System.Threading/ReaderWriterLockSlimTest.cs @@ -343,6 +343,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void EnterReadLock_MultiRead () { var v = new ReaderWriterLockSlim (); @@ -371,6 +372,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TryEnterWriteLock_WhileReading () { var v = new ReaderWriterLockSlim (); @@ -395,6 +397,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void EnterWriteLock_MultiRead () { var v = new ReaderWriterLockSlim (); @@ -449,7 +452,9 @@ namespace MonoTests.System.Threading Assert.IsTrue (v.TryEnterWriteLock (100)); v.ExitWriteLock (); } + [Test] + [Category ("MultiThreaded")] public void EnterWriteLockWhileInUpgradeAndOtherWaiting () { var v = new ReaderWriterLockSlim (); @@ -559,6 +564,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void RecursiveReadPropertiesTest () { var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion); @@ -588,6 +594,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void RecursiveUpgradePropertiesTest () { var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion); @@ -620,6 +627,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void RecursiveWritePropertiesTest () { var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion); @@ -739,6 +747,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void RecursiveWriteReadAcquisitionInterleaving () { var v = new ReaderWriterLockSlim (LockRecursionPolicy.SupportsRecursion); diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs index eef722c499..cabe515465 100644 --- a/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs +++ b/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.platformnotsupported.cs @@ -196,9 +196,6 @@ namespace System.Data.SqlClient internal void OnReturnStatus(int status) => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - internal void OnReturnValue(SqlReturnValue rec) - => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); - internal void OnReturnValue(SqlReturnValue rec, TdsParserStateObject stateObj) => throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); diff --git a/mcs/class/System.Data/corefx/SqlConnectionStringBuilder.cs b/mcs/class/System.Data/corefx/SqlConnectionStringBuilder.cs index 591fa00c2a..9c3e77cf64 100644 --- a/mcs/class/System.Data/corefx/SqlConnectionStringBuilder.cs +++ b/mcs/class/System.Data/corefx/SqlConnectionStringBuilder.cs @@ -20,7 +20,7 @@ namespace System.Data.SqlClient "keyword and always reset the connection")] public bool ConnectionReset { get; set; } - [MonoTODO("Not implemented in corefx: dotnet/corefx/issues/22474")] + [MonoTODO("Not implemented in corefx: https://github.com/dotnet/corefx/issues/22474")] public SqlAuthenticationMethod Authentication { get => throw new NotImplementedException(); set => throw new NotImplementedException(); diff --git a/mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources b/mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources index a92f4c290a..2307d37be6 100644 --- a/mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources +++ b/mcs/class/System.Data/monotouch_watch_System.Data.dll.exclude.sources @@ -1,6 +1,5 @@ corefx/SqlCommand.cs corefx/SqlException.cs -corefx/SqlParameter.cs ../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlBulkCopy.cs ../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommand.cs ../../../external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/SqlCommandBuilder.cs diff --git a/mcs/class/System.Drawing/System.Drawing/FontFamily.cs b/mcs/class/System.Drawing/System.Drawing/FontFamily.cs index 73acc4bedb..79b63b9b5f 100644 --- a/mcs/class/System.Drawing/System.Drawing/FontFamily.cs +++ b/mcs/class/System.Drawing/System.Drawing/FontFamily.cs @@ -49,17 +49,15 @@ namespace System.Drawing { nativeFontFamily = fntfamily; } - internal void refreshName() + internal unsafe void refreshName() { - StringBuilder sb; - if (nativeFontFamily == IntPtr.Zero) return; - sb = new StringBuilder (GDIPlus.FACESIZE); - Status status = GDIPlus.GdipGetFamilyName (nativeFontFamily, sb, 0); + char* namePtr = stackalloc char[GDIPlus.FACESIZE]; + Status status = GDIPlus.GdipGetFamilyName (nativeFontFamily, (IntPtr)namePtr, 0); GDIPlus.CheckStatus (status); - name = sb.ToString(); + name = Marshal.PtrToStringUni((IntPtr)namePtr); } ~FontFamily() diff --git a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs index c42b38a20b..4865269b83 100644 --- a/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs +++ b/mcs/class/System.Drawing/System.Drawing/gdipFunctions.cs @@ -1560,7 +1560,7 @@ namespace System.Drawing [MarshalAs(UnmanagedType.LPWStr)] string fName, IntPtr collection, out IntPtr fontFamily); [DllImport (GdiPlus, CharSet=CharSet.Unicode)] - internal static extern Status GdipGetFamilyName(IntPtr family, StringBuilder name, int language); + internal static extern Status GdipGetFamilyName(IntPtr family, IntPtr name, int language); [DllImport (GdiPlus)] internal static extern Status GdipGetGenericFontFamilySansSerif (out IntPtr fontFamily); diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs index 7d154cd8fd..dae2cd2350 100644 --- a/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs +++ b/mcs/class/System.Net.Http/System.Net.Http/HttpClientHandler.cs @@ -387,7 +387,7 @@ namespace System.Net.Http } } - wrequest.ResendContentFactory = content.CopyTo; + wrequest.ResendContentFactory = content.CopyToAsync; using (var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false)) { await request.Content.CopyToAsync (stream).ConfigureAwait (false); diff --git a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs index 93e1ed4bb0..62e260b37e 100644 --- a/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs +++ b/mcs/class/System.Net.Http/Test/System.Net.Http/HttpClientTest.cs @@ -276,7 +276,7 @@ namespace MonoTests.System.Net.Http httpClient.PostAsync (restRequest.RequestUri, restRequest.Content).Wait (WaitTimeout); Assert.Fail ("#1"); } catch (AggregateException e) { - Assert.IsTrue (e.InnerException is TaskCanceledException, "#2"); + Assert.That (e.InnerException, Is.InstanceOf (), "#2"); } } @@ -680,16 +680,15 @@ namespace MonoTests.System.Net.Http #endif public void Send_Complete_CustomHeaders_Host () { - bool? failed = null; + Exception error = null; var port = NetworkHelpers.FindFreePort (); var listener = CreateListener (l => { var request = l.Request; try { Assert.AreEqual ("customhost", request.Headers["Host"], "#1"); - failed = false; - } catch { - failed = true; + } catch (Exception ex) { + error = ex; } }, port); @@ -704,7 +703,7 @@ namespace MonoTests.System.Net.Http Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100"); Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101"); - Assert.AreEqual (false, failed, "#102"); + Assert.IsNull (error, "#102"); } finally { listener.Abort (); listener.Close (); @@ -1440,6 +1439,25 @@ namespace MonoTests.System.Net.Http ch.AllowAutoRedirect = false; } +#if !FEATURE_NO_BSD_SOCKETS + [Test] + // https://github.com/mono/mono/issues/7355 + public void WildcardConnect () + { + try { + using (var client = new HttpClient ()) { + client.GetAsync ("http://255.255.255.255").Wait (WaitTimeout); + } + } catch (AggregateException e) { + Assert.That (e.InnerException, Is.InstanceOf (), "#1"); + var rex = (HttpRequestException)e.InnerException; + Assert.That (rex.InnerException, Is.InstanceOf (), "#2"); + var wex = (WebException)rex.InnerException; + Assert.That (wex.Status, Is.EqualTo (WebExceptionStatus.ConnectFailure), "#3"); + } + } +#endif + HttpListener CreateListener (Action contextAssert, int port) { var l = new HttpListener (); diff --git a/mcs/class/System.Numerics/Makefile b/mcs/class/System.Numerics/Makefile index a5f4718f2b..fcbdfcee40 100644 --- a/mcs/class/System.Numerics/Makefile +++ b/mcs/class/System.Numerics/Makefile @@ -9,7 +9,7 @@ LIB_MCS_FLAGS = /unsafe TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) XTEST_LIB_REFS = System Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp XTEST_LIB_FLAGS = -unsafe -#LIBRARY_WARN_AS_ERROR = yes +LIBRARY_WARN_AS_ERROR = yes RESX_RESOURCE_STRING = \ ../../../external/corefx/src/System.Runtime.Numerics/src/Resources/Strings.resx \ diff --git a/mcs/class/System.Security/Makefile b/mcs/class/System.Security/Makefile index 2257ab0953..04a3bea4d1 100644 --- a/mcs/class/System.Security/Makefile +++ b/mcs/class/System.Security/Makefile @@ -8,6 +8,7 @@ MONO_SECURITY=Mono.Security endif LIBRARY = System.Security.dll +API_BIN_REFS := System.Numerics LIB_REFS = secxml/System bare/System.Xml $(MONO_SECURITY) KEYFILE = ../msfinal.pub LIB_MCS_FLAGS = \ @@ -28,10 +29,6 @@ EXTRA_DISTFILES = \ RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx -ifdef MOBILE_PROFILE -NO_TEST = yes -endif - include ../../build/library.make $(build_lib): $(secxml_libdir)/System.dll $(MONO_SECURITY_DLL) diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs deleted file mode 100644 index 74280cb915..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/KeyInfoX509Data.cs +++ /dev/null @@ -1,285 +0,0 @@ -// -// KeyInfoX509Data.cs - KeyInfoX509Data implementation for XML Signature -// -// Authors: -// Sebastien Pouliot -// Atsushi Enomoto (atsushi@ximian.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// 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. -// - -using System.Collections; -using System.Runtime.InteropServices; -using System.Security.Cryptography.X509Certificates; -using System.Xml; - -namespace System.Security.Cryptography.Xml { - - public class KeyInfoX509Data : KeyInfoClause { - - private byte[] x509crl; - private ArrayList IssuerSerialList; - private ArrayList SubjectKeyIdList; - private ArrayList SubjectNameList; - private ArrayList X509CertificateList; - - public KeyInfoX509Data () - { - } - - public KeyInfoX509Data (byte[] rgbCert) - { - AddCertificate (new X509Certificate (rgbCert)); - } - - public KeyInfoX509Data (X509Certificate cert) - { - AddCertificate (cert); - } - -#if SECURITY_DEP - public KeyInfoX509Data (X509Certificate cert, X509IncludeOption includeOption) - { - if (cert == null) - throw new ArgumentNullException ("cert"); - - switch (includeOption) { - case X509IncludeOption.None: - case X509IncludeOption.EndCertOnly: - AddCertificate (cert); - break; - case X509IncludeOption.ExcludeRoot: - AddCertificatesChainFrom (cert, false); - break; - case X509IncludeOption.WholeChain: - AddCertificatesChainFrom (cert, true); - break; - } - } - - // this gets complicated because we must: - // 1. build the chain using a X509Certificate2 class; - // 2. test for root using the Mono.Security.X509.X509Certificate class; - // 3. add the certificates as X509Certificate instances; - private void AddCertificatesChainFrom (X509Certificate cert, bool root) - { - X509Chain chain = new X509Chain (); - chain.Build (new X509Certificate2 (cert)); - foreach (X509ChainElement ce in chain.ChainElements) { - byte[] rawdata = ce.Certificate.RawData; - if (!root) { - // exclude root - Mono.Security.X509.X509Certificate mx = new Mono.Security.X509.X509Certificate (rawdata); - if (mx.IsSelfSigned) - rawdata = null; - } - - if (rawdata != null) - AddCertificate (new X509Certificate (rawdata)); - } - } -#endif - - public ArrayList Certificates { - get { return X509CertificateList; } - } - - public byte[] CRL { - get { return x509crl; } - set { x509crl = value; } - } - - public ArrayList IssuerSerials { - get { return IssuerSerialList; } - } - - public ArrayList SubjectKeyIds { - get { return SubjectKeyIdList; } - } - - public ArrayList SubjectNames { - get { return SubjectNameList; } - } - - public void AddCertificate (X509Certificate certificate) - { - if (certificate == null) - throw new ArgumentNullException ("certificate"); - if (X509CertificateList == null) - X509CertificateList = new ArrayList (); - X509CertificateList.Add (certificate); - } - - public void AddIssuerSerial (string issuerName, string serialNumber) - { - if (issuerName == null) - throw new ArgumentException ("issuerName"); - if (IssuerSerialList == null) - IssuerSerialList = new ArrayList (); - - X509IssuerSerial xis = new X509IssuerSerial (issuerName, serialNumber); - IssuerSerialList.Add (xis); - } - - public void AddSubjectKeyId (byte[] subjectKeyId) - { - if (SubjectKeyIdList == null) - SubjectKeyIdList = new ArrayList (); - - SubjectKeyIdList.Add (subjectKeyId); - } - - [ComVisible (false)] - public void AddSubjectKeyId (string subjectKeyId) - { - if (SubjectKeyIdList == null) - SubjectKeyIdList = new ArrayList (); - - byte[] id = null; - if (subjectKeyId != null) - id = Convert.FromBase64String (subjectKeyId); - SubjectKeyIdList.Add (id); - } - - public void AddSubjectName (string subjectName) - { - if (SubjectNameList == null) - SubjectNameList = new ArrayList (); - - SubjectNameList.Add (subjectName); - } - - public override XmlElement GetXml () - { - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.X509Data, XmlSignature.NamespaceURI); - // FIXME: hack to match MS implementation - xel.SetAttribute ("xmlns", XmlSignature.NamespaceURI); - // - if ((IssuerSerialList != null) && (IssuerSerialList.Count > 0)) { - foreach (X509IssuerSerial iser in IssuerSerialList) { - XmlElement isl = document.CreateElement (XmlSignature.ElementNames.X509IssuerSerial, XmlSignature.NamespaceURI); - XmlElement xin = document.CreateElement (XmlSignature.ElementNames.X509IssuerName, XmlSignature.NamespaceURI); - xin.InnerText = iser.IssuerName; - isl.AppendChild (xin); - XmlElement xsn = document.CreateElement (XmlSignature.ElementNames.X509SerialNumber, XmlSignature.NamespaceURI); - xsn.InnerText = iser.SerialNumber; - isl.AppendChild (xsn); - xel.AppendChild (isl); - } - } - // - if ((SubjectKeyIdList != null) && (SubjectKeyIdList.Count > 0)) { - foreach (byte[] skid in SubjectKeyIdList) { - XmlElement ski = document.CreateElement (XmlSignature.ElementNames.X509SKI, XmlSignature.NamespaceURI); - ski.InnerText = Convert.ToBase64String (skid); - xel.AppendChild (ski); - } - } - // - if ((SubjectNameList != null) && (SubjectNameList.Count > 0)) { - foreach (string subject in SubjectNameList) { - XmlElement sn = document.CreateElement (XmlSignature.ElementNames.X509SubjectName, XmlSignature.NamespaceURI); - sn.InnerText = subject; - xel.AppendChild (sn); - } - } - // - if ((X509CertificateList != null) && (X509CertificateList.Count > 0)) { - foreach (X509Certificate x509 in X509CertificateList) { - XmlElement cert = document.CreateElement (XmlSignature.ElementNames.X509Certificate, XmlSignature.NamespaceURI); - cert.InnerText = Convert.ToBase64String (x509.GetRawCertData ()); - xel.AppendChild (cert); - } - } - // only one - if (x509crl != null) { - XmlElement crl = document.CreateElement (XmlSignature.ElementNames.X509CRL, XmlSignature.NamespaceURI); - crl.InnerText = Convert.ToBase64String (x509crl); - xel.AppendChild (crl); - } - return xel; - } - - public override void LoadXml (XmlElement element) - { - if (element == null) - throw new ArgumentNullException ("element"); - - if (IssuerSerialList != null) - IssuerSerialList.Clear (); - if (SubjectKeyIdList != null) - SubjectKeyIdList.Clear (); - if (SubjectNameList != null) - SubjectNameList.Clear (); - if (X509CertificateList != null) - X509CertificateList.Clear (); - x509crl = null; - - if ((element.LocalName != XmlSignature.ElementNames.X509Data) || (element.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException ("element"); - - XmlElement [] xnl = null; - // - xnl = XmlSignature.GetChildElements (element, XmlSignature.ElementNames.X509IssuerSerial); - if (xnl != null) { - for (int i=0; i < xnl.Length; i++) { - XmlElement xel = (XmlElement) xnl[i]; - XmlElement issuer = XmlSignature.GetChildElement (xel, XmlSignature.ElementNames.X509IssuerName, XmlSignature.NamespaceURI); - XmlElement serial = XmlSignature.GetChildElement (xel, XmlSignature.ElementNames.X509SerialNumber, XmlSignature.NamespaceURI); - AddIssuerSerial (issuer.InnerText, serial.InnerText); - } - } - // - xnl = XmlSignature.GetChildElements (element, XmlSignature.ElementNames.X509SKI); - if (xnl != null) { - for (int i=0; i < xnl.Length; i++) { - byte[] skid = Convert.FromBase64String (xnl[i].InnerXml); - AddSubjectKeyId (skid); - } - } - // - xnl = XmlSignature.GetChildElements (element, XmlSignature.ElementNames.X509SubjectName); - if (xnl != null) { - for (int i=0; i < xnl.Length; i++) { - AddSubjectName (xnl[i].InnerXml); - } - } - // - xnl = XmlSignature.GetChildElements (element, XmlSignature.ElementNames.X509Certificate); - if (xnl != null) { - for (int i=0; i < xnl.Length; i++) { - byte[] cert = Convert.FromBase64String (xnl[i].InnerXml); - AddCertificate (new X509Certificate (cert)); - } - } - // only one - XmlElement x509el = XmlSignature.GetChildElement (element, XmlSignature.ElementNames.X509CRL, XmlSignature.NamespaceURI); - if (x509el != null) { - x509crl = Convert.FromBase64String (x509el.InnerXml); - } - } - } -} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Manifest.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Manifest.cs deleted file mode 100644 index d52ea001d4..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/Manifest.cs +++ /dev/null @@ -1,119 +0,0 @@ -// -// Manifest.cs - Manifest implementation for XML Signature -// -// Author: -// Sebastien Pouliot -// -// (C) 2004 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.Collections; -using System.Xml; - -namespace System.Security.Cryptography.Xml { - - internal class Manifest { - - private ArrayList references; - private string id; - private XmlElement element; - - public Manifest () - { - references = new ArrayList (); - } - - public Manifest (XmlElement xel) : this () - { - LoadXml (xel); - } - - public string Id { - get { return id; } - set { - element = null; - id = value; - } - } - - public ArrayList References { - get { return references; } - } - - public void AddReference (Reference reference) - { - references.Add (reference); - } - - public XmlElement GetXml () - { - if (element != null) - return element; - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.SignedInfo, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - // we add References afterward so we don't end up with extraneous - // xmlns="..." in each reference elements. - foreach (Reference r in references) { - XmlNode xn = r.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - return xel; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName != XmlSignature.ElementNames.Manifest) || (value.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException (); - - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - - for (int i = 0; i < value.ChildNodes.Count; i++) { - XmlNode n = value.ChildNodes [i]; - if (n.NodeType == XmlNodeType.Element && - n.LocalName == XmlSignature.ElementNames.Reference && - n.NamespaceURI == XmlSignature.NamespaceURI) { - Reference r = new Reference (); - r.LoadXml ((XmlElement) n); - AddReference (r); - } - } - element = value; - } - } -} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs deleted file mode 100644 index 49e9d3ad99..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/Signature.cs +++ /dev/null @@ -1,221 +0,0 @@ -// -// Signature.cs - Signature implementation for XML Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) Tim Coleman, 2004 -// - -// -// 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; -using System.Xml; - -namespace System.Security.Cryptography.Xml { - - public class Signature { - static XmlNamespaceManager dsigNsmgr; - - static Signature () - { - dsigNsmgr = new XmlNamespaceManager (new NameTable ()); - dsigNsmgr.AddNamespace ("xd", XmlSignature.NamespaceURI); - } - - private ArrayList list; - private SignedInfo info; - private KeyInfo key; - private string id; - private byte[] signature; - private XmlElement element; - - public Signature () - { - list = new ArrayList (); - } - - public string Id { - get { return id; } - set { - element = null; - id = value; - } - } - - public KeyInfo KeyInfo { - get { return key; } - set { - element = null; - key = value; - } - } - - public IList ObjectList { - get { return list; } - set { list = ArrayList.Adapter (value); } - } - - public byte[] SignatureValue { - get { return signature; } - set { - element = null; - signature = value; - } - } - - public SignedInfo SignedInfo { - get { return info; } - set { - element = null; - info = value; - } - } - - public void AddObject (DataObject dataObject) - { - list.Add (dataObject); - } - - public XmlElement GetXml () - { - return GetXml (null); - } - - internal XmlElement GetXml (XmlDocument document) - { - if (element != null) - return element; - - if (info == null) - throw new CryptographicException ("SignedInfo"); - if (signature == null) - throw new CryptographicException ("SignatureValue"); - - if (document == null) - document = new XmlDocument (); - - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Signature, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - XmlNode xn = info.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - - if (signature != null) { - XmlElement sv = document.CreateElement (XmlSignature.ElementNames.SignatureValue, XmlSignature.NamespaceURI); - sv.InnerText = Convert.ToBase64String (signature); - xel.AppendChild (sv); - } - - if (key != null) { - xn = key.GetXml (); - newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - if (list.Count > 0) { - foreach (DataObject obj in list) { - xn = obj.GetXml (); - newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - } - - return xel; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName == XmlSignature.ElementNames.Signature) && (value.NamespaceURI == XmlSignature.NamespaceURI)) { - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - - // LAMESPEC: This library is totally useless against eXtensibly Marked-up document. - int i = NextElementPos (value.ChildNodes, 0, XmlSignature.ElementNames.SignedInfo, XmlSignature.NamespaceURI, true); - XmlElement sinfo = (XmlElement) value.ChildNodes [i]; - info = new SignedInfo (); - info.LoadXml (sinfo); - - i = NextElementPos (value.ChildNodes, ++i, XmlSignature.ElementNames.SignatureValue, XmlSignature.NamespaceURI, true); - XmlElement sigValue = (XmlElement) value.ChildNodes [i]; - signature = Convert.FromBase64String (sigValue.InnerText); - - // signature isn't required: - i = NextElementPos (value.ChildNodes, ++i, XmlSignature.ElementNames.KeyInfo, XmlSignature.NamespaceURI, false); - if (i > 0) { - XmlElement kinfo = (XmlElement) value.ChildNodes [i]; - key = new KeyInfo (); - key.LoadXml (kinfo); - } - - XmlNodeList xnl = value.SelectNodes ("xd:Object", dsigNsmgr); - foreach (XmlElement xn in xnl) { - DataObject obj = new DataObject (); - obj.LoadXml (xn); - AddObject (obj); - } - } - else - throw new CryptographicException ("Malformed element: Signature."); - - // if invalid - if (info == null) - throw new CryptographicException ("SignedInfo"); - if (signature == null) - throw new CryptographicException ("SignatureValue"); - } - - private int NextElementPos (XmlNodeList nl, int pos, string name, string ns, bool required) - { - while (pos < nl.Count) { - if (nl [pos].NodeType == XmlNodeType.Element) { - if (nl [pos].LocalName != name || nl [pos].NamespaceURI != ns) { - if (required) - throw new CryptographicException ("Malformed element " + name); - else - return -2; - } - else - return pos; - } - else - pos++; - } - if (required) - throw new CryptographicException ("Malformed element " + name); - return -1; - } - } -} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs deleted file mode 100644 index f9d6d9f004..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedInfo.cs +++ /dev/null @@ -1,219 +0,0 @@ -// -// SignedInfo.cs - SignedInfo implementation for XML Signature -// -// Author: -// Sebastien Pouliot -// Tim Coleman (tim@timcoleman.com) -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// 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. -// - -using System.Collections; -using System.Runtime.InteropServices; -using System.Xml; - -namespace System.Security.Cryptography.Xml { - - public class SignedInfo : ICollection, IEnumerable { - - private ArrayList references; - private string c14nMethod; - private string id; - private string signatureMethod; - private string signatureLength; - private XmlElement element; - - public SignedInfo() - { - references = new ArrayList (); - c14nMethod = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"; - } - - public string CanonicalizationMethod { - get { return c14nMethod; } - set { - c14nMethod = value; - element = null; - } - } - - [ComVisible (false)] - [MonoTODO] - public Transform CanonicalizationMethodObject { - get { throw new NotImplementedException (); } - } - - // documented as not supported (and throwing exception) - public int Count { - get { throw new NotSupportedException (); } - } - - public string Id { - get { return id; } - set { - element = null; - id = value; - } - } - - // documented as not supported (and throwing exception) - public bool IsReadOnly { - get { throw new NotSupportedException (); } - } - - // documented as not supported (and throwing exception) - public bool IsSynchronized { - get { throw new NotSupportedException (); } - } - - // Manipulating this array never affects GetXml() when - // LoadXml() was used. - // (Actually, there is no way to detect modification.) - public ArrayList References { - get { return references; } - } - - public string SignatureLength { - get { return signatureLength; } - set { - element = null; - signatureLength = value; - } - } - - public string SignatureMethod { - get { return signatureMethod; } - set { - element = null; - signatureMethod = value; - } - } - - // documented as not supported (and throwing exception) - public object SyncRoot { - get { throw new NotSupportedException (); } - } - - public void AddReference (Reference reference) - { - references.Add (reference); - } - - // documented as not supported (and throwing exception) - public void CopyTo (Array array, int index) - { - throw new NotSupportedException (); - } - - public IEnumerator GetEnumerator () - { - return references.GetEnumerator (); - } - - public XmlElement GetXml () - { - if (element != null) - return element; - - if (signatureMethod == null) - throw new CryptographicException ("SignatureMethod"); - if (references.Count == 0) - throw new CryptographicException ("References empty"); - - XmlDocument document = new XmlDocument (); - XmlElement xel = document.CreateElement (XmlSignature.ElementNames.SignedInfo, XmlSignature.NamespaceURI); - if (id != null) - xel.SetAttribute (XmlSignature.AttributeNames.Id, id); - - if (c14nMethod != null) { - XmlElement c14n = document.CreateElement (XmlSignature.ElementNames.CanonicalizationMethod, XmlSignature.NamespaceURI); - c14n.SetAttribute (XmlSignature.AttributeNames.Algorithm, c14nMethod); - xel.AppendChild (c14n); - } - if (signatureMethod != null) { - XmlElement sm = document.CreateElement (XmlSignature.ElementNames.SignatureMethod, XmlSignature.NamespaceURI); - sm.SetAttribute (XmlSignature.AttributeNames.Algorithm, signatureMethod); - if (signatureLength != null) { - XmlElement hmac = document.CreateElement (XmlSignature.ElementNames.HMACOutputLength, XmlSignature.NamespaceURI); - hmac.InnerText = signatureLength; - sm.AppendChild (hmac); - } - xel.AppendChild (sm); - } - - // This check is only done when element is created here. - if (references.Count == 0) - throw new CryptographicException ("At least one Reference element is required in SignedInfo."); - - // we add References afterward so we don't end up with extraneous - // xmlns="..." in each reference elements. - foreach (Reference r in references) { - XmlNode xn = r.GetXml (); - XmlNode newNode = document.ImportNode (xn, true); - xel.AppendChild (newNode); - } - - return xel; - } - - private string GetAttribute (XmlElement xel, string attribute) - { - XmlAttribute xa = xel.Attributes [attribute]; - return ((xa != null) ? xa.InnerText : null); - } - - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - if ((value.LocalName != XmlSignature.ElementNames.SignedInfo) || (value.NamespaceURI != XmlSignature.NamespaceURI)) - throw new CryptographicException (); - - id = GetAttribute (value, XmlSignature.AttributeNames.Id); - c14nMethod = XmlSignature.GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.CanonicalizationMethod); - - XmlElement sm = XmlSignature.GetChildElement (value, XmlSignature.ElementNames.SignatureMethod, XmlSignature.NamespaceURI); - if (sm != null) { - signatureMethod = sm.GetAttribute (XmlSignature.AttributeNames.Algorithm); - XmlElement length = XmlSignature.GetChildElement (sm, XmlSignature.ElementNames.HMACOutputLength, XmlSignature.NamespaceURI); - if (length != null) { - signatureLength = length.InnerText; - } - } - - for (int i = 0; i < value.ChildNodes.Count; i++) { - XmlNode n = value.ChildNodes [i]; - if (n.NodeType == XmlNodeType.Element && - n.LocalName == XmlSignature.ElementNames.Reference && - n.NamespaceURI == XmlSignature.NamespaceURI) { - Reference r = new Reference (); - r.LoadXml ((XmlElement) n); - AddReference (r); - } - } - element = value; - } - } -} diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs index 958f913836..15e50ca5fc 100644 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs +++ b/mcs/class/System.Security/System.Security.Cryptography.Xml/SignedXml.cs @@ -1,48 +1,57 @@ -// -// SignedXml.cs - SignedXml implementation for XML Signature -// -// Author: -// Sebastien Pouliot -// Atsushi Enomoto -// Tim Coleman -// -// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com) -// 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. -// +// 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.IO; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Security.Cryptography; -using System.Security.Policy; -using System.Net; -using System.Text; -using System.Xml; 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; @@ -63,6 +72,9 @@ namespace System.Security.Cryptography.Xml { 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#"; @@ -74,91 +86,50 @@ namespace System.Security.Cryptography.Xml { 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"; - private EncryptedXml encryptedXml; - - protected Signature m_signature; - private AsymmetricAlgorithm key; - protected string m_strSigningKeyName; - private XmlDocument envdoc; - private IEnumerator pkEnumerator; - private XmlElement signatureElement; - private Hashtable hashes; - // FIXME: enable it after CAS implementation - internal XmlResolver _xmlResolver = new XmlUrlResolver (); - private bool _bResolverSet = true; - internal XmlElement _context; - private ArrayList manifests; - private IEnumerator _x509Enumerator; - - private static readonly char [] whitespaceChars = new char [] {' ', '\r', '\n', '\t'}; + // + // public constructors + // public SignedXml () { - m_signature = new Signature (); - m_signature.SignedInfo = new SignedInfo (); - hashes = new Hashtable (2); // 98% SHA1 for now - _context = null; + Initialize (null); } - public SignedXml (XmlDocument document) : this () + public SignedXml (XmlDocument document) { if (document == null) - throw new ArgumentNullException ("document"); - envdoc = document; - _context = document.DocumentElement; + throw new ArgumentNullException (nameof (document)); + + Initialize (document.DocumentElement); } - public SignedXml (XmlElement elem) : this () + public SignedXml (XmlElement elem) { if (elem == null) - throw new ArgumentNullException ("elem"); - envdoc = new XmlDocument (); - _context = elem; - envdoc.LoadXml (elem.OuterXml); + throw new ArgumentNullException (nameof (elem)); + + Initialize (elem); } - [ComVisible (false)] - public EncryptedXml EncryptedXml { - get { return encryptedXml; } - set { encryptedXml = value; } + 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 KeyInfo KeyInfo { - get { - if (m_signature.KeyInfo == null) - m_signature.KeyInfo = new KeyInfo (); - return m_signature.KeyInfo; - } - set { m_signature.KeyInfo = value; } - } + // + // public properties + // - public Signature Signature { - get { return m_signature; } - } - - public string SignatureLength { - get { return m_signature.SignedInfo.SignatureLength; } - } - - public string SignatureMethod { - get { return m_signature.SignedInfo.SignatureMethod; } - } - - public byte[] SignatureValue { - get { return m_signature.SignatureValue; } - } - - public SignedInfo SignedInfo { - get { return m_signature.SignedInfo; } - } - - public AsymmetricAlgorithm SigningKey { - get { return key; } - set { key = value; } - } - - // NOTE: CryptoAPI related ? documented as fx internal - public string SigningKeyName { + /// + public string SigningKeyName + { get { return m_strSigningKeyName; } set { m_strSigningKeyName = value; } } @@ -179,483 +150,221 @@ namespace System.Security.Cryptography.Xml { 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 void AddReference (Reference reference) + public bool CheckSignature () { - if (reference == null) - throw new ArgumentNullException ("reference"); - m_signature.SignedInfo.AddReference (reference); + AsymmetricAlgorithm signingKey; + return CheckSignatureReturningKey (out signingKey); } - private Stream ApplyTransform (Transform t, XmlDocument input) + public bool CheckSignatureReturningKey (out AsymmetricAlgorithm signingKey) { - // These transformer modify input document, which should - // not affect to the input itself. - if (t is XmlDsigXPathTransform - || t is XmlDsigEnvelopedSignatureTransform - || t is XmlDecryptionTransform - ) - input = (XmlDocument) input.Clone (); + SignedXmlDebugLog.LogBeginSignatureVerification (this, _context); - t.LoadInput (input); + signingKey = null; + bool bRet = false; + AsymmetricAlgorithm key = null; - if (t is XmlDsigEnvelopedSignatureTransform) - // It returns XmlDocument for XmlDocument input. - return CanonicalizeOutput (t.GetOutput ()); - - object obj = t.GetOutput (); - if (obj is Stream) - return (Stream) obj; - else if (obj is XmlDocument) { - MemoryStream ms = new MemoryStream (); - XmlTextWriter xtw = new XmlTextWriter (ms, Encoding.UTF8); - ((XmlDocument) obj).WriteTo (xtw); - - xtw.Flush (); - - // Rewind to the start of the stream - ms.Position = 0; - return ms; - } - else if (obj == null) { - throw new NotImplementedException ("This should not occur. Transform is " + t + "."); - } - else { - // e.g. XmlDsigXPathTransform returns XmlNodeList - return CanonicalizeOutput (obj); - } - } - - private Stream CanonicalizeOutput (object obj) - { - Transform c14n = GetC14NMethod (); - c14n.LoadInput (obj); - return (Stream) c14n.GetOutput (); - } - - private XmlDocument GetManifest (Reference r) - { - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - - if (r.Uri [0] == '#') { - // local manifest - if (signatureElement != null) { - XmlElement xel = GetIdElement (signatureElement.OwnerDocument, r.Uri.Substring (1)); - if (xel == null) - throw new CryptographicException ("Manifest targeted by Reference was not found: " + r.Uri.Substring (1)); - doc.AppendChild (doc.ImportNode (xel, true)); - FixupNamespaceNodes (xel, doc.DocumentElement, false); - } - } - else if (_xmlResolver != null) { - // TODO: need testing - Stream s = (Stream) _xmlResolver.GetEntity (new Uri (r.Uri), null, typeof (Stream)); - doc.Load (s); - } - - if (doc.FirstChild != null) { - // keep a copy of the manifests to check their references later - if (manifests == null) - manifests = new ArrayList (); - manifests.Add (doc); - - return doc; - } - return null; - } - - private void FixupNamespaceNodes (XmlElement src, XmlElement dst, bool ignoreDefault) - { - // add namespace nodes - foreach (XmlAttribute attr in src.SelectNodes ("namespace::*")) { - if (attr.LocalName == "xml") - continue; - if (ignoreDefault && attr.LocalName == "xmlns") - continue; - dst.SetAttributeNode (dst.OwnerDocument.ImportNode (attr, true) as XmlAttribute); - } - } - - private byte[] GetReferenceHash (Reference r, bool check_hmac) - { - Stream s = null; - XmlDocument doc = null; - if (r.Uri == String.Empty) { - doc = envdoc; - } - else if (r.Type == XmlSignature.Uri.Manifest) { - doc = GetManifest (r); - } - else { - doc = new XmlDocument (); - doc.PreserveWhitespace = true; - string objectName = null; - - if (r.Uri.StartsWith ("#xpointer")) { - string uri = string.Join ("", r.Uri.Substring (9).Split (whitespaceChars)); - if (uri.Length < 2 || uri [0] != '(' || uri [uri.Length - 1] != ')') - // FIXME: how to handle invalid xpointer? - uri = String.Empty; - else - uri = uri.Substring (1, uri.Length - 2); - if (uri == "/") - doc = envdoc; - else if (uri.Length > 6 && uri.StartsWith ("id(") && uri [uri.Length - 1] == ')') - // id('foo'), id("foo") - objectName = uri.Substring (4, uri.Length - 6); - } - else if (r.Uri [0] == '#') { - objectName = r.Uri.Substring (1); - } - else if (_xmlResolver != null) { - // TODO: test but doc says that Resolver = null -> no access - try { - // no way to know if valid without throwing an exception - Uri uri = new Uri (r.Uri); - s = (Stream) _xmlResolver.GetEntity (uri, null, typeof (Stream)); - } - catch { - // may still be a local file (and maybe not xml) - s = File.OpenRead (r.Uri); - } - } - if (objectName != null) { - XmlElement found = null; - foreach (DataObject obj in m_signature.ObjectList) { - if (obj.Id == objectName) { - found = obj.GetXml (); - found.SetAttribute ("xmlns", SignedXml.XmlDsigNamespaceUrl); - doc.AppendChild (doc.ImportNode (found, true)); - // FIXME: there should be theoretical justification of copying namespace declaration nodes this way. - foreach (XmlNode n in found.ChildNodes) - // Do not copy default namespace as it must be xmldsig namespace for "Object" element. - if (n.NodeType == XmlNodeType.Element) - FixupNamespaceNodes (n as XmlElement, doc.DocumentElement, true); - break; - } - } - if (found == null && envdoc != null) { - found = GetIdElement (envdoc, objectName); - if (found != null) { - doc.AppendChild (doc.ImportNode (found, true)); - FixupNamespaceNodes (found, doc.DocumentElement, false); - } - } - if (found == null) - throw new CryptographicException (String.Format ("Malformed reference object: {0}", objectName)); - } - } - - if (r.TransformChain.Count > 0) { - foreach (Transform t in r.TransformChain) { - if (s == null) { - s = ApplyTransform (t, doc); - } - else { - t.LoadInput (s); - object o = t.GetOutput (); - if (o is Stream) - s = (Stream) o; - else - s = CanonicalizeOutput (o); - } - } - } - else if (s == null) { - // we must not C14N references from outside the document - // e.g. non-xml documents - if (r.Uri [0] != '#') { - s = new MemoryStream (); - doc.Save (s); - } - else { - // apply default C14N transformation - s = ApplyTransform (new XmlDsigC14NTransform (), doc); - } - } - HashAlgorithm digest = GetHash (r.DigestMethod, check_hmac); - return (digest == null) ? null : digest.ComputeHash (s); - } - - private void DigestReferences () - { - // we must tell each reference which hash algorithm to use - // before asking for the SignedInfo XML ! - foreach (Reference r in m_signature.SignedInfo.References) { - // assume SHA-1 if nothing is specified - if (r.DigestMethod == null) - r.DigestMethod = XmlDsigSHA1Url; - r.DigestValue = GetReferenceHash (r, false); - } - } - - private Transform GetC14NMethod () - { - Transform t = (Transform) CryptoConfig.CreateFromName (m_signature.SignedInfo.CanonicalizationMethod); - if (t == null) - throw new CryptographicException ("Unknown Canonicalization Method {0}", m_signature.SignedInfo.CanonicalizationMethod); - return t; - } - - private Stream SignedInfoTransformed () - { - Transform t = GetC14NMethod (); - - if (signatureElement == null) { - // when creating signatures - XmlDocument doc = new XmlDocument (); - doc.PreserveWhitespace = true; - doc.LoadXml (m_signature.SignedInfo.GetXml ().OuterXml); - if (envdoc != null) - foreach (XmlAttribute attr in envdoc.DocumentElement.SelectNodes ("namespace::*")) { - if (attr.LocalName == "xml") - continue; - if (attr.Prefix == doc.DocumentElement.Prefix) - continue; - doc.DocumentElement.SetAttributeNode (doc.ImportNode (attr, true) as XmlAttribute); - } - t.LoadInput (doc); - } - else { - // when verifying signatures - // TODO - check m_signature.SignedInfo.Id - XmlElement el = signatureElement.GetElementsByTagName (XmlSignature.ElementNames.SignedInfo, XmlSignature.NamespaceURI) [0] as XmlElement; - StringWriter sw = new StringWriter (); - XmlTextWriter xtw = new XmlTextWriter (sw); - xtw.WriteStartElement (el.Prefix, el.LocalName, el.NamespaceURI); - - // context namespace nodes (except for "xmlns:xml") - XmlNodeList nl = el.SelectNodes ("namespace::*"); - foreach (XmlAttribute attr in nl) { - if (attr.ParentNode == el) - continue; - if (attr.LocalName == "xml") - continue; - if (attr.Prefix == el.Prefix) - continue; - attr.WriteTo (xtw); - } - foreach (XmlNode attr in el.Attributes) - attr.WriteTo (xtw); - foreach (XmlNode n in el.ChildNodes) - n.WriteTo (xtw); - - xtw.WriteEndElement (); - byte [] si = Encoding.UTF8.GetBytes (sw.ToString ()); - - MemoryStream ms = new MemoryStream (); - ms.Write (si, 0, si.Length); - ms.Position = 0; - - t.LoadInput (ms); - } - // C14N and C14NWithComments always return a Stream in GetOutput - return (Stream) t.GetOutput (); - } - - // reuse hash - most document will always use the same hash - private HashAlgorithm GetHash (string algorithm, bool check_hmac) - { - HashAlgorithm hash = (HashAlgorithm) hashes [algorithm]; - if (hash == null) { - hash = HashAlgorithm.Create (algorithm); - if (hash == null) - throw new CryptographicException ("Unknown hash algorithm: {0}", algorithm); - hashes.Add (algorithm, hash); - // now ready to be used - } - else { - // important before reusing an hash object - hash.Initialize (); - } - // we can sign using any hash algorith, including HMAC, but we can only verify hash (MS compatibility) - if (check_hmac && (hash is KeyedHashAlgorithm)) - return null; - return hash; - } - - public bool CheckSignature () - { - return (CheckSignatureInternal (null) != null); - } - - private bool CheckReferenceIntegrity (ArrayList referenceList) - { - if (referenceList == null) + if (!CheckSignatureFormat ()) return false; - // check digest (hash) for every reference - foreach (Reference r in referenceList) { - // stop at first broken reference - byte[] hash = GetReferenceHash (r, true); - if (! Compare (r.DigestValue, hash)) - 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 (AsymmetricAlgorithm key) + public bool CheckSignature (KeyedHashAlgorithm macAlg) { - if (key == null) - throw new ArgumentNullException ("key"); - return (CheckSignatureInternal (key) != null); + 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; } - private AsymmetricAlgorithm CheckSignatureInternal (AsymmetricAlgorithm key) + public bool CheckSignature (X509Certificate2 certificate, bool verifySignatureOnly) { - pkEnumerator = null; + 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); - if (key != null) { - // check with supplied key - if (!CheckSignatureWithKey (key)) - return null; - } else { - if (Signature.KeyInfo == null) - return null; - // no supplied key, iterates all KeyInfo - while ((key = GetPublicKey ()) != null) { - if (CheckSignatureWithKey (key)) { + bool validKeyUsage = (keyUsage.KeyUsages & X509KeyUsageFlags.DigitalSignature) != 0 || + (keyUsage.KeyUsages & X509KeyUsageFlags.NonRepudiation) != 0; + + if (!validKeyUsage) { + SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_X509KeyUsage); + return false; + } break; } } - pkEnumerator = null; - if (key == null) - return null; - } - // some parts may need to be downloaded - // so where doing it last - if (!CheckReferenceIntegrity (m_signature.SignedInfo.References)) - return null; + // 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 (manifests != null) { - // do not use foreach as a manifest could contain manifests... - for (int i=0; i < manifests.Count; i++) { - Manifest manifest = new Manifest ((manifests [i] as XmlDocument).DocumentElement); - if (! CheckReferenceIntegrity (manifest.References)) - return null; - } - } - return key; - } - - // Is the signature (over SignedInfo) valid ? - private bool CheckSignatureWithKey (AsymmetricAlgorithm key) - { - if (key == null) - return false; - - SignatureDescription sd = (SignatureDescription) CryptoConfig.CreateFromName (m_signature.SignedInfo.SignatureMethod); - if (sd == null) - return false; - - AsymmetricSignatureDeformatter verifier = (AsymmetricSignatureDeformatter) CryptoConfig.CreateFromName (sd.DeformatterAlgorithm); - if (verifier == null) - return false; - - try { - verifier.SetKey (key); - verifier.SetHashAlgorithm (sd.DigestAlgorithm); - - HashAlgorithm hash = GetHash (sd.DigestAlgorithm, true); - // get the hash of the C14N SignedInfo element - MemoryStream ms = (MemoryStream) SignedInfoTransformed (); - - byte[] digest = hash.ComputeHash (ms); - return verifier.VerifySignature (digest, m_signature.SignatureValue); - } - catch { - // e.g. SignatureMethod != AsymmetricAlgorithm type - return false; - } - } - - private bool Compare (byte[] expected, byte[] actual) - { - bool result = ((expected != null) && (actual != null)); - if (result) { - int l = expected.Length; - result = (l == actual.Length); - if (result) { - for (int i=0; i < l; i++) { - if (expected[i] != actual[i]) - return false; - } - } - } - return result; - } - - public bool CheckSignature (KeyedHashAlgorithm macAlg) - { - if (macAlg == null) - throw new ArgumentNullException ("macAlg"); - - pkEnumerator = null; - - // Is the signature (over SignedInfo) valid ? - Stream s = SignedInfoTransformed (); - if (s == null) - return false; - - byte[] actual = macAlg.ComputeHash (s); - // HMAC signature may be partial and specified by - if (m_signature.SignedInfo.SignatureLength != null) { - int length = Int32.Parse (m_signature.SignedInfo.SignatureLength); - // we only support signatures with a multiple of 8 bits - // and the value must match the signature length - if ((length & 7) != 0) - throw new CryptographicException ("Signature length must be a multiple of 8 bits."); - - // SignatureLength is in bits (and we works on bytes, only in multiple of 8 bits) - // and both values must match for a signature to be valid - length >>= 3; - if (length != m_signature.SignatureValue.Length) - throw new CryptographicException ("Invalid signature length."); - - // is the length "big" enough to make the signature meaningful ? - // we use a minimum of 80 bits (10 bytes) or half the HMAC normal output length - // e.g. HMACMD5 output 128 bits but our minimum is 80 bits (not 64 bits) - int minimum = Math.Max (10, actual.Length / 2); - if (length < minimum) - throw new CryptographicException ("HMAC signature is too small"); - - if (length < actual.Length) { - byte[] trunked = new byte [length]; - Buffer.BlockCopy (actual, 0, trunked, 0, length); - actual = trunked; + if (!chainVerified) { + SignedXmlDebugLog.LogVerificationFailure (this, SR.Log_VerificationFailed_X509Chain); + return false; } } - if (Compare (m_signature.SignatureValue, actual)) { - // some parts may need to be downloaded - // so where doing it last - return CheckReferenceIntegrity (m_signature.SignedInfo.References); + using (AsymmetricAlgorithm publicKey = Utils.GetAnyPublicKey (certificate)) { + if (!CheckSignature (publicKey)) + return false; } - return false; + + SignedXmlDebugLog.LogVerificationResult (this, certificate, true); + return true; } - [MonoTODO] - [ComVisible (false)] - public bool CheckSignature (X509Certificate2 certificate, bool verifySignatureOnly) + public void ComputeSignature () { - throw new NotImplementedException (); - } + SignedXmlDebugLog.LogBeginSignatureComputation (this, _context); - public bool CheckSignatureReturningKey (out AsymmetricAlgorithm signingKey) - { - signingKey = CheckSignatureInternal (null); - return (signingKey != null); - } + BuildDigestedReferences (); - public void ComputeSignature () - { - DigestReferences (); + // Load the key + AsymmetricAlgorithm key = SigningKey; if (key == null) throw new CryptographicException (SR.Cryptography_Xml_LoadKeyFailed); @@ -665,86 +374,159 @@ namespace System.Security.Cryptography.Xml { if (key is DSA) { SignedInfo.SignatureMethod = XmlDsigDSAUrl; } else if (key is RSA) { - // Default to RSA-SHA1 - SignedInfo.SignatureMethod = XmlDsigRSASHA1Url; + 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 = CryptoConfig.CreateFromName (SignedInfo.SignatureMethod) as SignatureDescription; + SignatureDescription signatureDescription = CryptoHelpers.CreateFromName (SignedInfo.SignatureMethod) as SignatureDescription; 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 = hashAlg.ComputeHash (SignedInfoTransformed ()); + 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) + public void ComputeSignature (KeyedHashAlgorithm macAlg) { if (macAlg == null) - throw new ArgumentNullException ("macAlg"); + throw new ArgumentNullException (nameof (macAlg)); - string method = null; + HMAC hash = macAlg as HMAC; + if (hash == null) + throw new CryptographicException (SR.Cryptography_Xml_SignatureMethodKeyMismatch); - if (macAlg is HMACSHA1) { - method = XmlDsigHMACSHA1Url; - } else if (macAlg is HMACSHA256) { - method = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256"; - } else if (macAlg is HMACSHA384) { - method = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384"; - } else if (macAlg is HMACSHA512) { - method = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512"; - } else if (macAlg is HMACRIPEMD160) { - method = "http://www.w3.org/2001/04/xmldsig-more#hmac-ripemd160"; + 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); } - if (method == null) - throw new CryptographicException ("unsupported algorithm"); + byte[] hashValue = GetC14NDigest (hash); - DigestReferences (); - m_signature.SignedInfo.SignatureMethod = method; - m_signature.SignatureValue = macAlg.ComputeHash (SignedInfoTransformed ()); + SignedXmlDebugLog.LogSigning (this, hash); + m_signature.SignatureValue = new byte [signatureLength / 8]; + Buffer.BlockCopy (hashValue, 0, m_signature.SignatureValue, 0, signatureLength / 8); } - public virtual XmlElement GetIdElement (XmlDocument document, string idValue) - { - if ((document == null) || (idValue == null)) - return null; + // + // virtual methods + // - // this works only if there's a DTD or XSD available to define the ID - XmlElement xel = document.GetElementById (idValue); - if (xel == null) { - // search an "undefined" ID - xel = (XmlElement) document.SelectSingleNode ("//*[@Id='" + idValue + "']"); - if (xel == null) { - xel = (XmlElement) document.SelectSingleNode ("//*[@ID='" + idValue + "']"); - if (xel == null) { - xel = (XmlElement) document.SelectSingleNode ("//*[@id='" + idValue + "']"); + 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 xel; + + return null; } - internal static XmlElement DefaultGetIdElement(XmlDocument document, string idValue) + 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 - { + try { + XmlConvert.VerifyNCName (idValue); + } catch (XmlException) { // Identifiers are required to be an NCName // (xml:id version 1.0, part 4, paragraph 2, bullet 1) // @@ -753,49 +535,460 @@ namespace System.Security.Cryptography.Xml { } // Get the element with idValue - XmlElement elem = document.GetElementById(idValue); + XmlElement elem = document.GetElementById (idValue); - if (elem != null) - { + if (elem != null) { // Have to check for duplicate ID values from the DTD. - XmlDocument docClone = (XmlDocument)document.CloneNode(true); - XmlElement cloneElem = docClone.GetElementById(idValue); + 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); + System.Diagnostics.Debug.Assert (cloneElem != null); // Guard against null anyways - if (cloneElem != null) - { - cloneElem.Attributes.RemoveAll(); + if (cloneElem != null) { + cloneElem.Attributes.RemoveAll (); - XmlElement cloneElem2 = docClone.GetElementById(idValue); + XmlElement cloneElem2 = docClone.GetElementById (idValue); if (cloneElem2 != null) - { - throw new CryptographicException( - SR.Cryptography_Xml_InvalidReference); - } + throw new CryptographicException (SR.Cryptography_Xml_InvalidReference); } return elem; } - elem = GetSingleReferenceTarget(document, "Id", idValue); + elem = GetSingleReferenceTarget (document, "Id", idValue); if (elem != null) return elem; - elem = GetSingleReferenceTarget(document, "id", idValue); + elem = GetSingleReferenceTarget (document, "id", idValue); if (elem != null) return elem; - elem = GetSingleReferenceTarget(document, "ID", idValue); + elem = GetSingleReferenceTarget (document, "ID", idValue); return elem; } - private static XmlElement GetSingleReferenceTarget(XmlDocument document, string idAttributeName, string idValue) + // + // 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) as HMAC; + 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) as SignatureDescription; + 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. @@ -810,95 +1003,47 @@ namespace System.Security.Cryptography.Xml { // 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); + XmlNodeList nodeList = document.SelectNodes (xPath); if (nodeList == null || nodeList.Count == 0) - { return null; - } if (nodeList.Count == 1) - { - return nodeList[0] as XmlElement; - } + return nodeList [0] as XmlElement; - throw new CryptographicException(SR.Cryptography_Xml_InvalidReference); + throw new CryptographicException (SR.Cryptography_Xml_InvalidReference); } - // According to book ".NET Framework Security" this method - // iterates all possible keys then return null - protected virtual AsymmetricAlgorithm GetPublicKey () + private static bool IsKeyTheCorrectAlgorithm (AsymmetricAlgorithm key, Type expectedType) { - if (m_signature.KeyInfo == null) - return null; + Type actualType = key.GetType (); - if (pkEnumerator == null) { - pkEnumerator = m_signature.KeyInfo.GetEnumerator (); - } - -#if SECURITY_DEP - if (_x509Enumerator != null) { - if (_x509Enumerator.MoveNext ()) { - X509Certificate cert = (X509Certificate) _x509Enumerator.Current; - return new X509Certificate2 (cert.GetRawCertData ()).PublicKey.Key; - } else { - _x509Enumerator = null; - } - } -#endif - while (pkEnumerator.MoveNext ()) { - AsymmetricAlgorithm key = null; - KeyInfoClause kic = (KeyInfoClause) pkEnumerator.Current; + if (actualType == expectedType) + return true; - if (kic is DSAKeyValue) - key = DSA.Create (); - else if (kic is RSAKeyValue) - key = RSA.Create (); + // 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; - if (key != null) { - key.FromXmlString (kic.GetXml ().InnerXml); - return key; - } + // + // "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 SECURITY_DEP - if (kic is KeyInfoX509Data) { - _x509Enumerator = ((KeyInfoX509Data) kic).Certificates.GetEnumerator (); - if (_x509Enumerator.MoveNext ()) { - X509Certificate cert = (X509Certificate) _x509Enumerator.Current; - return new X509Certificate2 (cert.GetRawCertData ()).PublicKey.Key; - } - } -#endif - } - return null; - } + 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. - public XmlElement GetXml () - { - return m_signature.GetXml (envdoc); - } + if (actualType.IsSubclassOf (expectedType)) + return true; - public void LoadXml (XmlElement value) - { - if (value == null) - throw new ArgumentNullException ("value"); - - signatureElement = value; - m_signature.LoadXml (value); - - if (_context == null) { - _context = value; - } - - // Need to give the EncryptedXml object to the - // XmlDecryptionTransform to give it a fighting - // chance at decrypting the document. - foreach (Reference r in m_signature.SignedInfo.References) { - foreach (Transform t in r.TransformChain) { - if (t is XmlDecryptionTransform) - ((XmlDecryptionTransform) t).EncryptedXml = EncryptedXml; - } - } + return false; } } -} +} \ No newline at end of file diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/X509IssuerSerial.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/X509IssuerSerial.cs deleted file mode 100644 index 505752920a..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/X509IssuerSerial.cs +++ /dev/null @@ -1,56 +0,0 @@ -// -// X509IssuerSerial.cs - X509IssuerSerial implementation for XML Encryption -// -// Author: -// 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. -// - -namespace System.Security.Cryptography.Xml { - - public - struct X509IssuerSerial { - - private string _issuerName; - private string _serialNumber; - - internal X509IssuerSerial (string issuer, string serial) - { - _issuerName = issuer; - _serialNumber = serial; - } - - public string IssuerName { - get { return _issuerName; } - set { _issuerName = value; } - } - - public string SerialNumber { - get { return _serialNumber; } - set { _serialNumber = value; } - } - } -} - diff --git a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlSignature.cs b/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlSignature.cs deleted file mode 100644 index 1dc64eac1d..0000000000 --- a/mcs/class/System.Security/System.Security.Cryptography.Xml/XmlSignature.cs +++ /dev/null @@ -1,128 +0,0 @@ -// -// XmlSignature.cs: Handles Xml Signature -// -// Author: -// Sebastien Pouliot (spouliot@motus.com) -// Atsushi Enomoto (atsushi@ximian.com) -// Tim Coleman (tim@timcoleman.com) -// -// (C) 2003 Motus Technologies Inc. (http://www.motus.com) -// Copyright (C) Tim Coleman, 2004 -// (C) 2004 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.Xml; - -namespace System.Security.Cryptography.Xml { - - // following the design of WSE - internal class XmlSignature { - - public class ElementNames { - - public const string CanonicalizationMethod = "CanonicalizationMethod"; - public const string DigestMethod = "DigestMethod"; - public const string DigestValue = "DigestValue"; - public const string DSAKeyValue = "DSAKeyValue"; - public const string EncryptedKey = "EncryptedKey"; - public const string HMACOutputLength = "HMACOutputLength"; - public const string KeyInfo = "KeyInfo"; - public const string KeyName = "KeyName"; - public const string KeyValue = "KeyValue"; - public const string Manifest = "Manifest"; - public const string Object = "Object"; - public const string Reference = "Reference"; - public const string RetrievalMethod = "RetrievalMethod"; - public const string RSAKeyValue = "RSAKeyValue"; - public const string Signature = "Signature"; - public const string SignatureMethod = "SignatureMethod"; - public const string SignatureValue = "SignatureValue"; - public const string SignedInfo = "SignedInfo"; - public const string Transform = "Transform"; - public const string Transforms = "Transforms"; - public const string X509Data = "X509Data"; - public const string X509IssuerSerial = "X509IssuerSerial"; - public const string X509IssuerName = "X509IssuerName"; - public const string X509SerialNumber = "X509SerialNumber"; - public const string X509SKI = "X509SKI"; - public const string X509SubjectName = "X509SubjectName"; - public const string X509Certificate = "X509Certificate"; - public const string X509CRL = "X509CRL"; - - public ElementNames () {} - } - - public class AttributeNames { - - public const string Algorithm = "Algorithm"; - public const string Encoding = "Encoding"; - public const string Id = "Id"; - public const string MimeType = "MimeType"; - public const string Type = "Type"; - public const string URI = "URI"; - - public AttributeNames () {} - } - - public class Uri { - public const string Manifest = "http://www.w3.org/2000/09/xmldsig#Manifest"; - } - - public const string NamespaceURI = "http://www.w3.org/2000/09/xmldsig#"; - public const string Prefix = "ds"; - - public XmlSignature () - { - } - - public static XmlElement GetChildElement (XmlElement xel, string element, string ns) - { - for (int i = 0; i < xel.ChildNodes.Count; i++) { - XmlNode n = xel.ChildNodes [i]; - if (n.NodeType == XmlNodeType.Element && n.LocalName == element && n.NamespaceURI == ns) - return n as XmlElement; - } - return null; - } - - public static string GetAttributeFromElement (XmlElement xel, string attribute, string element) - { - XmlElement el = GetChildElement (xel, element, XmlSignature.NamespaceURI); - return el != null ? el.GetAttribute (attribute) : null; - } - - public static XmlElement [] GetChildElements (XmlElement xel, string element) - { - ArrayList al = new ArrayList (); - for (int i = 0; i < xel.ChildNodes.Count; i++) { - XmlNode n = xel.ChildNodes [i]; - if (n.NodeType == XmlNodeType.Element && n.LocalName == element && n.NamespaceURI == XmlSignature.NamespaceURI) - al.Add (n); - } - return al.ToArray (typeof (XmlElement)) as XmlElement []; - } - } -} diff --git a/mcs/class/System.Security/System.Security.dll.sources b/mcs/class/System.Security/System.Security.dll.sources index 75c0a6f9b0..e77373a0eb 100644 --- a/mcs/class/System.Security/System.Security.dll.sources +++ b/mcs/class/System.Security/System.Security.dll.sources @@ -1,5 +1,5 @@ #include common_System.Security.dll.sources -corefx/SR.cs + Mono.Security.Cryptography/ManagedProtection.cs Mono.Security.Cryptography/NativeDapiProtection.cs System.Security.Cryptography/MemoryProtectionScope.cs @@ -13,6 +13,8 @@ System.Security.Cryptography.Pkcs/SignerInfoEnumerator.cs ../System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs System.Security.Cryptography.X509Certificates/X509Certificate2UI.cs System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs + +# System.Security.Cryptography.Xml ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/AncestralNamespaceContextManager.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/AttributeSortOrder.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/C14NAncestralNamespaceContextManager.cs @@ -57,9 +59,8 @@ System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/KeyInfoName.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/KeyInfoNode.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/KeyInfoRetrievalMethod.cs -System.Security.Cryptography.Xml/KeyInfoX509Data.cs +../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/KeyInfoX509Data.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/KeyReference.cs -System.Security.Cryptography.Xml/Manifest.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/MyXmlDocument.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/NamespaceFrame.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/NamespaceSortOrder.cs @@ -72,8 +73,8 @@ System.Security.Cryptography.Xml/Manifest.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA384SignatureDescription.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA512SignatureDescription.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SignatureDescription.cs -System.Security.Cryptography.Xml/Signature.cs -System.Security.Cryptography.Xml/SignedInfo.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/SignedXmlDebugLog.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SymmetricKeyWrap.cs @@ -90,8 +91,8 @@ System.Security.Cryptography.Xml/SignedXml.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigXPathTransform.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigXsltTransform.cs ../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlLicenseTransform.cs -System.Security.Cryptography.Xml/XmlSignature.cs -../../build/common/MonoTODOAttribute.cs + +# System.Security.Permissions System.Security.Permissions/DataProtectionPermission.cs System.Security.Permissions/DataProtectionPermissionAttribute.cs System.Security.Permissions/DataProtectionPermissionFlags.cs diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs index 7ff9beef39..82fc0fb433 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/EncryptedXmlTest.cs @@ -180,11 +180,22 @@ namespace MonoTests.System.Security.Cryptography.Xml Assert.IsNull (ex.GetIdElement (null, "value")); } - [Test] - public void GetIdElement_StringNull () + [TestCase (null, TestName = "null")] + [TestCase ("", TestName = "empty")] + public void GetIdElement_WhenElementNameMustBeNonColonizedAndItIsNotProvided_ThrowsArgumentNullException (string elementName) { - EncryptedXml ex = new EncryptedXml (); - Assert.IsNull (ex.GetIdElement (new XmlDocument (), null)); + var sut = new EncryptedXml (); + + var ex = Assert.Throws (() => sut.GetIdElement (new XmlDocument (), elementName), "Exception"); + Assert.That (ex.ParamName, Is.EqualTo ("name"), "ParamName"); + } + + [Test] + public void GetIdElement_WhenElementNameMustBeNonColonizedAndItContainsColon_ReturnsNull () + { + var sut = new EncryptedXml (); + + Assert.That (sut.GetIdElement (new XmlDocument (), "t:test"), Is.Null); } [Test] diff --git a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs index b5baf86ebd..2a6aae4f77 100644 --- a/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs +++ b/mcs/class/System.Security/Test/System.Security.Cryptography.Xml/SignedXmlTest.cs @@ -253,7 +253,7 @@ namespace MonoTests.System.Security.Cryptography.Xml { signedXml.ComputeSignature (); Assert.IsNull (signedXml.SigningKeyName, "SigningKeyName"); - Assert.AreEqual (SignedXml.XmlDsigRSASHA1Url, signedXml.SignatureMethod, "SignatureMethod"); + Assert.AreEqual (SignedXml.XmlDsigRSASHA256Url, signedXml.SignatureMethod, "SignatureMethod"); Assert.AreEqual (128, signedXml.SignatureValue.Length, "SignatureValue"); Assert.IsNull (signedXml.SigningKeyName, "SigningKeyName"); @@ -638,13 +638,13 @@ namespace MonoTests.System.Security.Cryptography.Xml { public void DataReferenceToNonDataObject () { XmlDocument doc = new XmlDocument (); - doc.LoadXml (""); + doc.LoadXml (""); SignedXml signedXml = new SignedXml (doc); DSA key = DSA.Create (); signedXml.SigningKey = key; Reference reference = new Reference (); - reference.Uri = "#id:1"; + reference.Uri = "#test"; XmlDsigC14NTransform t = new XmlDsigC14NTransform (); reference.AddTransform (t); @@ -707,12 +707,30 @@ namespace MonoTests.System.Security.Cryptography.Xml { return sw.ToString (); } - [Test] - public void GetIdElement_Null () + [TestCase (null, TestName = "null")] + [TestCase ("", TestName = "empty")] + public void GetIdElement_WhenElementNameMustBeNonColonizedAndItIsNotProvided_ThrowsArgumentNullException (string elementName) { - SignedXml sign = new SignedXml (); - Assert.IsNull (sign.GetIdElement (null, "value")); - Assert.IsNull (sign.GetIdElement (new XmlDocument (), null)); + var sut = new SignedXml (); + + var ex = Assert.Throws (() => sut.GetIdElement (new XmlDocument (), elementName), "Exception"); + Assert.That (ex.ParamName, Is.EqualTo ("name"), "ParamName"); + } + + [Test] + public void GetIdElement_WhenElementNameMustBeNonColonizedAndItContainsColon_ReturnsNull () + { + var sut = new SignedXml (); + + Assert.That (sut.GetIdElement (new XmlDocument (), "t:test"), Is.Null); + } + + [Test] + public void GetIdElement_WhenXmlDocumentIsNotProvided_ReturnsNull () + { + var sut = new SignedXml (); + + Assert.That (sut.GetIdElement (null, "value"), Is.Null); } [Test] @@ -789,6 +807,7 @@ namespace MonoTests.System.Security.Cryptography.Xml { SignedXml signedXml = new SignedXml (doc); signedXml.SigningKey = cert.PrivateKey; signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl; + signedXml.SignedInfo.SignatureMethod = SignedXml.XmlDsigRSASHA1Url; Reference reference = new Reference (); reference.DigestMethod = SignedXml.XmlDsigSHA1Url; @@ -1408,13 +1427,6 @@ namespace MonoTests.System.Security.Cryptography.Xml { // verify MS-generated signature Assert.IsTrue (sign.CheckSignature (new HMACRIPEMD160 (hmackey))); } - // CVE-2009-0217 - // * a 0-length signature is the worse case - it accepts anything - // * between 1-7 bits length are considered invalid (not a multiple of 8) - // * a 8 bits signature would have one chance, out of 256, to be valid - // * and so on... until we hit (output-length / 2) or 80 bits (see ERRATUM) - - static bool erratum = true; // xmldsig erratum for CVE-2009-0217 static SignedXml GetSignedXml (string xml) { @@ -1426,31 +1438,15 @@ namespace MonoTests.System.Security.Cryptography.Xml { return sign; } - static void CheckErratum (SignedXml signed, KeyedHashAlgorithm hmac, string message) - { - if (erratum) { - try { - signed.CheckSignature (hmac); - Assert.Fail (message + ": unexcepted success"); - } - catch (CryptographicException) { - } - catch (Exception e) { - Assert.Fail (message + ": unexcepted " + e.ToString ()); - } - } else { - Assert.IsTrue (signed.CheckSignature (hmac), message); - } - } - - private void HmacMustBeMultipleOfEightBits (int bits) + [Test] + public void CheckSignature_WhenHmacOutputLengthIsNotMultipleOf8_ThrowsCryptographicException () { string xml = @" - {0} + 81 @@ -1463,96 +1459,41 @@ namespace MonoTests.System.Security.Cryptography.Xml { some other text "; - SignedXml sign = GetSignedXml (String.Format (xml, bits)); - // only multiple of 8 bits are supported - sign.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("secret"))); + + var sut = GetSignedXml (xml); + sut.SignatureFormatValidator = null; + + var ex = Assert.Throws (() => sut.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("secret"))), "Exception"); + Assert.That (ex.Message, Is.StringContaining ("multiple of 8").IgnoreCase, "Message"); } [Test] - public void HmacMustBeMultipleOfEightBits () + public void CheckSignature_WhenDefaultSignatureFormatValidatorIsUsedAndSignatureUsesTruncatedHmac_ReturnsFalse () { - for (int i = 1; i < 160; i++) { - // The .NET framework only supports multiple of 8 bits - if (i % 8 == 0) - continue; - - try { - HmacMustBeMultipleOfEightBits (i); - Assert.Fail ("Unexpected Success " + i.ToString ()); - } - catch (CryptographicException) { - } - catch (Exception e) { - Assert.Fail ("Unexpected Exception " + i.ToString () + " : " + e.ToString ()); - } - } - } - - [Test] - [Category ("NotDotNet")] // will fail until a fix is available - public void VerifyHMAC_ZeroLength () - { - string xml = @" - - - - - 0 - - - - nz4GS0NbH2SrWlD/4fX313CoTzc= - - - - - some other text - -"; - SignedXml sign = GetSignedXml (xml); - - CheckErratum (sign, new HMACSHA1 (Encoding.ASCII.GetBytes ("no clue")), "1"); - CheckErratum (sign, new HMACSHA1 (Encoding.ASCII.GetBytes ("")), "2"); - CheckErratum (sign, new HMACSHA1 (Encoding.ASCII.GetBytes ("oops")), "3"); - CheckErratum (sign, new HMACSHA1 (Encoding.ASCII.GetBytes ("secret")), "4"); - } - - [Test] - [Category ("NotDotNet")] // will fail until a fix is available - public void VerifyHMAC_SmallerThanMinimumLength () - { - // 72 is a multiple of 8 but smaller than the minimum of 80 bits - string xml = @"72nz4GS0NbH2SrWlD/4fX313CoTzc=2dimB+P5Aw5Ksome other text"; - SignedXml sign = GetSignedXml (xml); - CheckErratum (sign, new HMACSHA1 (Encoding.ASCII.GetBytes ("secret")), "72"); - } - - [Test] - public void VerifyHMAC_MinimumLength () - { - // 80 bits is the minimum (and the half-size of HMACSHA1) - string xml = @"80nz4GS0NbH2SrWlD/4fX313CoTzc=jVQPtLj61zNYjw==some other text"; - SignedXml sign = GetSignedXml (xml); - Assert.IsTrue (sign.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("secret")))); - } - [Test] - [Category ("NotDotNet")] // will fail until a fix is available - public void VerifyHMAC_SmallerHalfLength () - { - // 80bits is smaller than the half-size of HMACSHA256 - string xml = @"80nz4GS0NbH2SrWlD/4fX313CoTzc=vPtw7zKVV/JwQg==some other text"; - SignedXml sign = GetSignedXml (xml); - CheckErratum (sign, new HMACSHA256 (Encoding.ASCII.GetBytes ("secret")), "80"); - } - - [Test] - public void VerifyHMAC_HalfLength () - { - // 128 is the half-size of HMACSHA256 + // The HMAC output length is 128, which is a half of HMACSHA256 that we're going to use. string xml = @"128nz4GS0NbH2SrWlD/4fX313CoTzc=aegpvkAwOL8gN/CjSnW6qw==some other text"; - SignedXml sign = GetSignedXml (xml); - Assert.IsTrue (sign.CheckSignature (new HMACSHA256 (Encoding.ASCII.GetBytes ("secret")))); + var sut = GetSignedXml (xml); + + // Although the XML Signature standard allows using truncated HMACs (with some limitations), + // .NET Framework, by default, doesn't allow using them, since it may result in security issues. + Assert.That (sut.CheckSignature (new HMACSHA256 (Encoding.ASCII.GetBytes ("secret"))), Is.False); } + + [Test] + public void CheckSignature_WhenDefaultSignatureFormatValidatorIsNotUsedAndSignatureUsesTruncatedHmac_ReturnsTrue () + { + // The HMAC output length is 128, which is a half of HMACSHA256 that we're going to use. + string xml = @"128nz4GS0NbH2SrWlD/4fX313CoTzc=aegpvkAwOL8gN/CjSnW6qw==some other text"; + var sut = GetSignedXml (xml); + + // By default, .NET Framework doesn't allow using truncated HMACs, since it may lead to security issues. + // That being said, the XML Signature standard allows using truncated HMACs, but with some limitations. + // It's possible to use truncated HMACs by using a custom signature format validator, or not using it at all. + sut.SignatureFormatValidator = null; + + Assert.That (sut.CheckSignature (new HMACSHA256 (Encoding.ASCII.GetBytes ("secret"))), Is.True); + } + [Test] public void VerifyHMAC_FullLength () { @@ -1562,8 +1503,7 @@ namespace MonoTests.System.Security.Cryptography.Xml { } [Test] - [ExpectedException (typeof (CryptographicException))] - public void VerifyHMAC_HMACOutputLength_Signature_Mismatch () + public void CheckSignature_WhenSignatureLengthIsGreaterThanHmacOutputLength_ThrowsCryptographicException () { string xml = @" @@ -1582,13 +1522,15 @@ namespace MonoTests.System.Security.Cryptography.Xml { some other text "; - SignedXml sign = GetSignedXml (xml); - sign.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("no clue"))); + var sut = GetSignedXml (xml); + sut.SignatureFormatValidator = null; + + var ex = Assert.Throws (() => sut.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("no clue"))), "Exception"); + Assert.That (ex.Message, Is.StringContaining ("length of the signature").IgnoreCase, "Message"); } [Test] - [ExpectedException (typeof (FormatException))] - public void VerifyHMAC_HMACOutputLength_Invalid () + public void CheckSignature_WhenHmacOutputLengthIsInvalid_ThrowsFormatException () { string xml = @" @@ -1607,8 +1549,10 @@ namespace MonoTests.System.Security.Cryptography.Xml { some other text "; - SignedXml sign = GetSignedXml (xml); - sign.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("no clue"))); + var sut = GetSignedXml (xml); + sut.SignatureFormatValidator = null; + + Assert.Throws (() => sut.CheckSignature (new HMACSHA1 (Encoding.ASCII.GetBytes ("no clue")))); } [Test] @@ -1628,7 +1572,7 @@ namespace MonoTests.System.Security.Cryptography.Xml { } [Test] - public void ComputeSignature_WhenSignatureMethodIsNotSpecifiedAndRsaSigningKeyIsUsed_UsesRsaSha1Algorithm () + public void ComputeSignature_WhenSignatureMethodIsNotSpecifiedAndRsaSigningKeyIsUsed_UsesRsaSha256Algorithm () { var unsignedXml = new XmlDocument (); unsignedXml.LoadXml (""); @@ -1651,7 +1595,7 @@ namespace MonoTests.System.Security.Cryptography.Xml { string.Format ("/{0}:SignedInfo/{0}:SignatureMethod", XmlDsigNamespacePrefix), namespaceManager); - Assert.That (signatureMethodElement.Attributes["Algorithm"].Value, Is.EqualTo (SignedXml.XmlDsigRSASHA1Url)); + Assert.That (signatureMethodElement.Attributes["Algorithm"].Value, Is.EqualTo (SignedXml.XmlDsigRSASHA256Url)); } [Test] diff --git a/mcs/class/System.Security/common_System.Security.dll.sources b/mcs/class/System.Security/common_System.Security.dll.sources index 5a34119a3a..321dc74da7 100644 --- a/mcs/class/System.Security/common_System.Security.dll.sources +++ b/mcs/class/System.Security/common_System.Security.dll.sources @@ -1,12 +1,18 @@ Assembly/AssemblyInfo.cs +corefx/SR.cs + ../../build/common/Consts.cs ../../build/common/Locale.cs ../../build/common/MonoTODOAttribute.cs + +# System.Security.Cryptography System.Security.Cryptography/CryptographicAttribute.cs System.Security.Cryptography/CryptographicAttributeCollection.cs System.Security.Cryptography/CryptographicAttributeEnumerator.cs 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 @@ -30,5 +36,6 @@ System.Security.Cryptography.Pkcs/SubjectIdentifier.cs System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs -System.Security.Cryptography.Xml/X509IssuerSerial.cs +# System.Security.Cryptography.Xml +../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/X509IssuerSerial.cs diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources index 3f62fe4b03..5067f01abe 100644 --- a/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources +++ b/mcs/class/System.ServiceModel/System.ServiceModel.dll.sources @@ -620,6 +620,7 @@ System.ServiceModel.Description/ServiceTimeoutsBehavior.cs System.ServiceModel.Description/SynchronousReceiveBehavior.cs System.ServiceModel.Description/TransactedBatchingBehavior.cs System.ServiceModel.Description/TypedMessageConverter.cs +../referencesource/System.ServiceModel/System/ServiceModel/Description/UseRequestHeadersForMetadataAddressBehavior.cs System.ServiceModel.Description/WSTrustMessageConverters.cs System.ServiceModel.Description/WSTrustSTSContract.cs System.ServiceModel.Description/WsdlContractConversionContext.cs diff --git a/mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs b/mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs index 8d85d6482f..8d9dac0c31 100644 --- a/mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs +++ b/mcs/class/System.Web/System.Web.SessionState_2.0/SessionStateModule.cs @@ -46,21 +46,6 @@ namespace System.Web.SessionState [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)] public sealed class SessionStateModule : IHttpModule { - class CallbackState - { - public readonly HttpContext Context; - public readonly AutoResetEvent AutoEvent; - public readonly string SessionId; - public readonly bool IsReadOnly; - - public CallbackState (HttpContext context, AutoResetEvent e, string sessionId, bool isReadOnly) { - this.Context = context; - this.AutoEvent = e; - this.SessionId = sessionId; - this.IsReadOnly = isReadOnly; - } - } - internal const string HeaderName = "AspFilterSessionId"; internal const string CookielessFlagName = "_SessionIDManager_IsCookieLess"; @@ -342,36 +327,22 @@ namespace System.Web.SessionState return item; } - void WaitForStoreUnlock (HttpContext context, string sessionId, bool isReadonly) { - AutoResetEvent are = new AutoResetEvent (false); - TimerCallback tc = new TimerCallback (StoreUnlockWaitCallback); - CallbackState cs = new CallbackState (context, are, sessionId, isReadonly); - using (Timer timer = new Timer (tc, cs, 500, 500)) { - try { - are.WaitOne (executionTimeout, false); + void WaitForStoreUnlock (HttpContext context, string sessionId, bool isReadOnly) { + DateTime dt = DateTime.Now; + while ((DateTime.Now - dt) < executionTimeout) { + Thread.Sleep(500); + storeData = GetStoreData (context, sessionId, isReadOnly); + if (storeData == null && storeLocked && (storeLockAge > executionTimeout)) { + handler.ReleaseItemExclusive (context, sessionId, storeLockId); + return; } - catch { - storeData = null; + else if (storeData != null && !storeLocked) { + //we have the session + return; } } } - void StoreUnlockWaitCallback (object s) { - CallbackState state = (CallbackState) s; - - SessionStateStoreData item = GetStoreData (state.Context, state.SessionId, state.IsReadOnly); - - if (item == null && storeLocked && (storeLockAge > executionTimeout)) { - handler.ReleaseItemExclusive (state.Context, state.SessionId, storeLockId); - storeData = null; // Create new state - state.AutoEvent.Set (); - } - else if (item != null && !storeLocked) { - storeData = item; - state.AutoEvent.Set (); - } - } - HttpSessionStateContainer CreateContainer (string sessionId, SessionStateStoreData data, bool isNew, bool isReadOnly) { if (data == null) return new HttpSessionStateContainer ( diff --git a/mcs/class/System.Windows.Forms/README b/mcs/class/System.Windows.Forms/README index 8c1049e7fa..b4c2bc8d79 100644 --- a/mcs/class/System.Windows.Forms/README +++ b/mcs/class/System.Windows.Forms/README @@ -1,8 +1,8 @@ -Managed.Windows.Forms README +System.Windows.Forms README * Introduction -Managed.Windows.Forms is a managed implementation of +This is a managed implementation of System.Windows.Forms. It implements a driver interface to allow running on multiple windowing systems, for example X11 or Windows. All controls are implemented in managed code, using System.Drawing to draw @@ -11,11 +11,8 @@ them. * Status -This library is in a beta state. Development is still proceeding as -at a rapid page on the 1.1 codebase. A limitted number of 2.0 -controls have been implemented, but the 2.0 api is not supported at -this time. Bug reports are welcome. Please use -http://bugzilla.ximian.com/ +This library is in a community-supported state. Bug reports are welcome. +Please use https://github.com/mono/mono/issues * Contributions @@ -26,10 +23,10 @@ controls need a lot of work, so ask on the mailing list or in irc if someone is working on it already, and if not, start in on it. Also, the unit tests need a lot of work. We can always use more of them, and there are still a small number of them which pass on MS .NET and -fail on MWF. For code contributions, please check the 'Guidelines' +fail on Mono. For code contributions, please check the 'Guidelines' file. -The novell MWF team is currently: +The Novell System.Windows.Forms team was: Andreia Gaita (shana.ufie@gmail.com) Jackson Harper (jackson@ximian.com) Mike Kestner (kestner@ximian.com) @@ -40,4 +37,4 @@ The novell MWF team is currently: There is a mailing list dedicated to Mono's System.Windows.Forms implementation, mono-winforms-list, see -http://lists.ximian.com/mailman/listinfo/mono-winforms-list +https://lists.dot.net/mailman/listinfo/mono-winforms-list diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs index ab13b9a604..30d58a3014 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms.CarbonInternal/Enums.cs @@ -105,4 +105,21 @@ namespace System.Windows.Forms.CarbonInternal { kMouseTrackingTimedOut = 8, kMouseTrackingMouseMoved = 9 } + + internal enum CFStringEncoding : uint { + kCFStringEncodingMacRoman = 0, + kCFStringEncodingWindowsLatin1 = 0x0500, + kCFStringEncodingISOLatin1 = 0x0201, + kCFStringEncodingNextStepLatin = 0x0B01, + kCFStringEncodingASCII = 0x0600, + kCFStringEncodingUnicode = 0x0100, + kCFStringEncodingUTF8 = 0x08000100, + kCFStringEncodingNonLossyASCII = 0x0BFF, + kCFStringEncodingUTF16 = 0x0100, + kCFStringEncodingUTF16BE = 0x10000100, + kCFStringEncodingUTF16LE = 0x14000100, + kCFStringEncodingUTF32 = 0x0c000100, + kCFStringEncodingUTF32BE = 0x18000100, + kCFStringEncodingUTF32LE = 0x1c000100 + } } diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridView.cs.REMOVED.git-id b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridView.cs.REMOVED.git-id index 53bc102135..4c7a08a068 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridView.cs.REMOVED.git-id +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/DataGridView.cs.REMOVED.git-id @@ -1 +1 @@ -a4a747537c315e0839c50ad99dd26b90eb018d34 \ No newline at end of file +5baad2b8154d09ac8513466f8d08e15cc3046d83 \ No newline at end of file diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/MimeIcon.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/MimeIcon.cs index d56abff246..c4311f37ca 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/MimeIcon.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/MimeIcon.cs @@ -119,10 +119,17 @@ namespace System.Windows.Forms SmallIcons.ImageSize = new Size (24, 24); LargeIcons.ImageSize = new Size (48, 48); - platformMimeHandler = new GnomeHandler (); - if (platformMimeHandler.Start () == MimeExtensionHandlerStatus.OK) { - platform = EPlatformHandler.GNOME; - } else { + try { + platformMimeHandler = new GnomeHandler (); + if (platformMimeHandler.Start () == MimeExtensionHandlerStatus.OK) { + platform = EPlatformHandler.GNOME; + } else { + MimeIconEngine.LargeIcons.Images.Clear (); + MimeIconEngine.SmallIcons.Images.Clear (); + platformMimeHandler = new PlatformDefaultHandler (); + platformMimeHandler.Start (); + } + } catch { MimeIconEngine.LargeIcons.Images.Clear (); MimeIconEngine.SmallIcons.Images.Clear (); platformMimeHandler = new PlatformDefaultHandler (); diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs index e1937a1fc5..346b24afd3 100644 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs +++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/XplatUICarbon.cs @@ -2085,10 +2085,10 @@ namespace System.Windows.Forms { internal override bool Text(IntPtr handle, string text) { Hwnd hwnd = Hwnd.ObjectFromHandle (handle); if (WindowMapping [hwnd.Handle] != null) { - SetWindowTitleWithCFString ((IntPtr)(WindowMapping [hwnd.Handle]), __CFStringMakeConstantString (text)); + SetWindowTitleWithCFString ((IntPtr)(WindowMapping [hwnd.Handle]), CFStringCreateWithCString (IntPtr.Zero, text, Carbon.CFStringEncoding.kCFStringEncodingUTF8)); } - SetControlTitleWithCFString (hwnd.whole_window, __CFStringMakeConstantString (text)); - SetControlTitleWithCFString (hwnd.client_window, __CFStringMakeConstantString (text)); + SetControlTitleWithCFString (hwnd.whole_window, CFStringCreateWithCString (IntPtr.Zero, text, Carbon.CFStringEncoding.kCFStringEncodingUTF8)); + SetControlTitleWithCFString (hwnd.client_window, CFStringCreateWithCString (IntPtr.Zero, text, Carbon.CFStringEncoding.kCFStringEncodingUTF8)); return true; } @@ -2382,7 +2382,9 @@ namespace System.Windows.Forms { extern static int SetWindowTitleWithCFString (IntPtr hWnd, IntPtr titleCFStr); [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal extern static IntPtr __CFStringMakeConstantString (string cString); - + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] + extern static IntPtr CFStringCreateWithCString (IntPtr allocator, string cString, Carbon.CFStringEncoding encoding); + [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] internal extern static int CFRelease (IntPtr wHnd); [DllImport("/System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon")] diff --git a/mcs/class/System/Makefile b/mcs/class/System/Makefile index cd44f53cec..3cff1fb25b 100644 --- a/mcs/class/System/Makefile +++ b/mcs/class/System/Makefile @@ -20,14 +20,16 @@ RESX_RESOURCE_STRING = \ ../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx \ ../../../external/corefx/src/System.Private.Uri/src/Resources/Strings.resx \ ../../../external/corefx/src/System.IO.Ports/src/Resources/Strings.resx \ - ../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx + ../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Net.Requests/src/Resources/Strings.resx TEST_RESOURCES = \ Test/System/test-uri-props.txt \ Test/System/test-uri-props-manual.txt \ Test/System/test-uri-relative-props.txt -XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation +USE_XTEST_REMOTE_EXECUTOR = YES +XTEST_LIB_REFS = System System.Core System.Net Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Net.Http LIB_MCS_FLAGS = -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%) -nowarn:436 ifndef NO_MONO_SECURITY diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs index dcc640ad30..295b96c7db 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs @@ -226,45 +226,79 @@ namespace Mono.Net.Security providerRegistration = new Dictionary> (); providerCache = new Dictionary (); - var appleTlsEntry = new Tuple (AppleTlsId, "Mono.AppleTls.AppleTlsProvider"); - -#if ONLY_APPLETLS || MONOTOUCH || XAMMAC - providerRegistration.Add ("default", appleTlsEntry); - providerRegistration.Add ("apple", appleTlsEntry); -#else - var legacyEntry = new Tuple (LegacyId, "Mono.Net.Security.LegacyTlsProvider"); - providerRegistration.Add ("legacy", legacyEntry); - - Tuple btlsEntry = null; -#if MONO_FEATURE_BTLS - if (IsBtlsSupported ()) { - btlsEntry = new Tuple (BtlsId, "Mono.Btls.MonoBtlsProvider"); - providerRegistration.Add ("btls", btlsEntry); - } -#endif - - if (Platform.IsMacOS) - providerRegistration.Add ("default", appleTlsEntry); - else if (btlsEntry != null) - providerRegistration.Add ("default", btlsEntry); - else - providerRegistration.Add ("default", legacyEntry); - - providerRegistration.Add ("apple", appleTlsEntry); -#endif + PopulateProviders (); } } -#region Platform-Specific code +#if ONLY_APPLETLS || MONOTOUCH || XAMMAC + // TODO: Should be redundant + static void PopulateProviders () + { + var appleTlsEntry = new Tuple (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName); + + providerRegistration.Add ("default", appleTlsEntry); + providerRegistration.Add ("apple", appleTlsEntry); + } +#elif MONODROID + // TODO: Should be redundant + static void PopulateProviders () + { + var legacyEntry = new Tuple (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName); + + providerRegistration.Add ("legacy", legacyEntry); + + #if MONO_FEATURE_BTLS + var btlsEntry = new Tuple (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName); + if (btlsEntry != null) + providerRegistration.Add ("default", btlsEntry); + else + #endif + providerRegistration.Add ("default", legacyEntry); + } +#else + static void PopulateProviders () + { +#if MONO_FEATURE_APPLETLS + var appleTlsEntry = new Tuple (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName); +#endif + var legacyEntry = new Tuple (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName); + providerRegistration.Add ("legacy", legacyEntry); + + Tuple btlsEntry = null; +#if MONO_FEATURE_BTLS + if (IsBtlsSupported ()) { + btlsEntry = new Tuple (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName); + providerRegistration.Add ("btls", btlsEntry); + } +#endif + +#if MONO_FEATURE_APPLETLS + if (Platform.IsMacOS) + providerRegistration.Add ("default", appleTlsEntry); + else +#endif +#if MONO_FEATURE_BTLS + if (btlsEntry != null) + providerRegistration.Add ("default", btlsEntry); + else +#endif + providerRegistration.Add ("default", legacyEntry); + +#if MONO_FEATURE_APPLETLS + providerRegistration.Add ("apple", appleTlsEntry); +#endif + } +#endif + #if MONO_FEATURE_BTLS [MethodImpl (MethodImplOptions.InternalCall)] internal extern static bool IsBtlsSupported (); #endif -#if MONODROID static MSI.MonoTlsProvider CreateDefaultProviderImpl () { +#if MONODROID MSI.MonoTlsProvider provider = null; var type = Environment.GetEnvironmentVariable ("XA_TLS_PROVIDER"); switch (type) { @@ -281,24 +315,40 @@ namespace Mono.Net.Security default: throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider)); } - } + #elif ONLY_APPLETLS || MONOTOUCH || XAMMAC - static MSI.MonoTlsProvider CreateDefaultProviderImpl () - { return new AppleTlsProvider (); - } #else - static MSI.MonoTlsProvider CreateDefaultProviderImpl () - { - var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER"); - if (string.IsNullOrEmpty (variable)) - variable = "default"; + var type = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER"); + if (string.IsNullOrEmpty (type)) + type = "default"; - return LookupProvider (variable, true); - } + switch (type) { + case "default": +#if MONO_FEATURE_APPLETLS + if (Platform.IsMacOS) + goto case "apple"; #endif +#if MONO_FEATURE_BTLS + if (IsBtlsSupported ()) + goto case "btls"; +#endif + goto case "legacy"; +#if MONO_FEATURE_APPLETLS + case "apple": + return new AppleTlsProvider (); +#endif +#if MONO_FEATURE_BTLS + case "btls": + return new MonoBtlsProvider (); +#endif + case "legacy": + return new Mono.Net.Security.LegacyTlsProvider (); + } -#endregion + return LookupProvider (type, true); +#endif + } #region Mono.Security visible API diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs index ba6d519723..52d1be27ee 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsStream.cs @@ -52,7 +52,7 @@ namespace Mono.Net.Security { class MonoTlsStream { -#if SECURITY_DEP +#if SECURITY_DEP readonly MonoTlsProvider provider; readonly NetworkStream networkStream; readonly HttpWebRequest request; @@ -99,9 +99,11 @@ namespace Mono.Net.Security #endif } - internal Stream CreateStream (byte[] buffer) + internal async Task CreateStream (WebConnectionTunnel tunnel, CancellationToken cancellationToken) { #if SECURITY_DEP + var socket = networkStream.InternalSocket; + WebConnection.Debug ($"MONO TLS STREAM CREATE STREAM: {socket.ID}"); sslStream = provider.CreateSslStream (networkStream, false, settings); try { @@ -112,16 +114,21 @@ namespace Mono.Net.Security host = host.Substring (0, pos); } - sslStream.AuthenticateAsClient ( + await sslStream.AuthenticateAsClientAsync ( host, request.ClientCertificates, (SslProtocols)ServicePointManager.SecurityProtocol, - ServicePointManager.CheckCertificateRevocationList); + ServicePointManager.CheckCertificateRevocationList).ConfigureAwait (false); status = WebExceptionStatus.Success; - } catch { - status = WebExceptionStatus.SecureChannelFailure; + } catch (Exception ex) { + WebConnection.Debug ($"MONO TLS STREAM ERROR: {socket.ID} {socket.CleanedUp} {ex.Message}"); + if (socket.CleanedUp) + status = WebExceptionStatus.RequestCanceled; + else + status = WebExceptionStatus.SecureChannelFailure; throw; } finally { + WebConnection.Debug ($"MONO TLS STREAM CREATE STREAM DONE: {socket.ID} {socket.CleanedUp}"); if (CertificateValidationFailed) status = WebExceptionStatus.TrustFailure; @@ -134,8 +141,8 @@ namespace Mono.Net.Security } try { - if (buffer != null) - sslStream.Write (buffer, 0, buffer.Length); + if (tunnel?.Data != null) + await sslStream.WriteAsync (tunnel.Data, 0, tunnel.Data.Length, cancellationToken).ConfigureAwait (false); } catch { status = WebExceptionStatus.SendFailure; sslStream = null; diff --git a/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id b/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id index 1eb02825ce..e1a2805522 100644 --- a/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id +++ b/mcs/class/System/ReferenceSources/SR.cs.REMOVED.git-id @@ -1 +1 @@ -5f6a3e96a03fd839708cd965990030483ed1179d \ No newline at end of file +4c1d88b51c1ca6902aa3ee4c56a4bbf6c7ac20c6 \ No newline at end of file diff --git a/mcs/class/System/ReferenceSources/SecureStringHelper.cs b/mcs/class/System/ReferenceSources/SecureStringHelper.cs index 31372e2cc6..de5ac5809f 100644 --- a/mcs/class/System/ReferenceSources/SecureStringHelper.cs +++ b/mcs/class/System/ReferenceSources/SecureStringHelper.cs @@ -14,7 +14,18 @@ namespace System.Net if (secureString == null || secureString.Length == 0) return String.Empty; - +#if MONO + try + { + bstr = Marshal.SecureStringToGlobalAllocUnicode(secureString); + plainString = Marshal.PtrToStringUni(bstr); + } + finally + { + if (bstr != IntPtr.Zero) + Marshal.ZeroFreeGlobalAllocUnicode(bstr); + } +#else try { bstr = Marshal.SecureStringToBSTR(secureString); @@ -25,6 +36,7 @@ namespace System.Net if (bstr != IntPtr.Zero) Marshal.ZeroFreeBSTR(bstr); } +#endif return plainString; } diff --git a/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs b/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs index be1aab2214..9efabd152e 100644 --- a/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs +++ b/mcs/class/System/System.CodeDom.Compiler/CompilerCollection.cs @@ -39,7 +39,7 @@ namespace System.CodeDom.Compiler [ConfigurationCollection (typeof (Compiler), AddItemName = "compiler", CollectionType = ConfigurationElementCollectionType.BasicMap)] internal sealed class CompilerCollection : ConfigurationElementCollection { - static readonly string defaultCompilerVersion = "3.5"; + static readonly string defaultCompilerVersion = "4.0"; static ConfigurationPropertyCollection properties; static List compiler_infos; static Dictionary compiler_languages; @@ -50,30 +50,15 @@ namespace System.CodeDom.Compiler properties = new ConfigurationPropertyCollection (); compiler_infos = new List (); compiler_languages = new Dictionary (16, StringComparer.OrdinalIgnoreCase); - compiler_extensions = new Dictionary (6, StringComparer.OrdinalIgnoreCase); + compiler_extensions = new Dictionary (4, StringComparer.OrdinalIgnoreCase); - CompilerInfo compiler = new CompilerInfo (null, "Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", - new [] { ".cs" }, new [] { "c#", "cs", "csharp" }); + CompilerInfo compiler = new CompilerInfo (null, "Microsoft.CSharp.CSharpCodeProvider, " + Consts.AssemblySystem, + new [] { "c#", "cs", "csharp" }, new [] { ".cs" }); compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion; AddCompilerInfo (compiler); - compiler = new CompilerInfo (null, "Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", - new [] { ".vb" }, new [] { "vb", "vbs", "visualbasic", "vbscript" }); - compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion; - AddCompilerInfo (compiler); - - compiler = new CompilerInfo (null, "Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=8.0.1100.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", - new [] { ".js" }, new [] { "js", "jscript", "javascript" }); - compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion; - AddCompilerInfo (compiler); - - compiler = new CompilerInfo (null, "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", - new [] { ".jsl", ".java" }, new [] { "vj#", "vjs", "vjsharp" }); - compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion; - AddCompilerInfo (compiler); - - compiler = new CompilerInfo (null, "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", - new [] { ".h" }, new [] { "c++", "mc", "cpp" }); + compiler = new CompilerInfo (null, "Microsoft.VisualBasic.VBCodeProvider, " + Consts.AssemblySystem, + new [] { "vb", "vbs", "visualbasic", "vbscript" }, new [] { ".vb" }); compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion; AddCompilerInfo (compiler); } diff --git a/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs b/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs index 6b12f95425..7e7676ab5c 100644 --- a/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs +++ b/mcs/class/System/System.Configuration/ApplicationSettingsBase.cs @@ -78,9 +78,13 @@ namespace System.Configuration { public void Reload () { #if (CONFIGURATION_DEP) - foreach (SettingsProvider provider in Providers) { -// IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider; - CacheValuesByProvider(provider); + /* Clear out the old property values so they will be reloaded on request */ + if (PropertyValues != null) { + PropertyValues.Clear(); + } + foreach(SettingsProperty prop in Properties) { + /* emit PropertyChanged for every property */ + OnPropertyChanged(this, new PropertyChangedEventArgs(prop.Name)); } #endif } @@ -88,13 +92,31 @@ namespace System.Configuration { public void Reset() { #if (CONFIGURATION_DEP) + if (Properties != null) { + foreach (SettingsProvider provider in Providers) { + IApplicationSettingsProvider iasp = provider as IApplicationSettingsProvider; + if (iasp != null) + iasp.Reset (Context); + } + InternalSave (); + } + Reload (); - foreach (SettingsPropertyValue pv in PropertyValues) - pv.PropertyValue = pv.Reset(); #endif } - public override void Save() + public override void Save () + { + var e = new CancelEventArgs (); + + OnSettingsSaving (this, e); + if (e.Cancel) + return; + + InternalSave (); + } + + void InternalSave () { #if (CONFIGURATION_DEP) Context.CurrentSettings = this; @@ -111,13 +133,42 @@ namespace System.Configuration { provider.SetPropertyValues (Context, cache); } Context.CurrentSettings = null; +#else + throw new NotImplementedException("No useful Save implemented."); #endif } - public virtual void Upgrade() + public virtual void Upgrade () { +#if (CONFIGURATION_DEP) + // if there is a current property, then for each settings + // provider in the providers collection, upgrade(ssp) + if (Properties != null) { + foreach (SettingsProvider provider in Providers) { + var appSettingsProvider = provider as IApplicationSettingsProvider; + if(appSettingsProvider != null) { + appSettingsProvider.Upgrade (Context, GetPropertiesForProvider (provider)); + } + } + } + Reload (); +#else + throw new NotImplementedException ("No useful Upgrade implemented"); +#endif } + private SettingsPropertyCollection GetPropertiesForProvider (SettingsProvider provider) + { + SettingsPropertyCollection properties = new SettingsPropertyCollection (); + foreach (SettingsProperty sp in Properties) { + if (sp.Provider == provider) { + properties.Add(sp); + } + } + + return properties; + } + protected virtual void OnPropertyChanged (object sender, PropertyChangedEventArgs e) { @@ -310,7 +361,17 @@ namespace System.Configuration { foreach (Attribute a in prop.GetCustomAttributes (false)) { /* the attributes we handle natively here */ if (a is SettingsProviderAttribute) { - Type provider_type = Type.GetType (((SettingsProviderAttribute)a).ProviderTypeName); + var providerTypeName = ((SettingsProviderAttribute)a).ProviderTypeName; + Type provider_type = Type.GetType (providerTypeName); + if(provider_type == null) { // Type failed to find the type by name + var typeNameParts = providerTypeName.Split('.'); + if(typeNameParts.Length > 1) { //Load the assembly that providerTypeName claims + var assy = Assembly.Load(typeNameParts[0]); + if(assy != null) { + provider_type = assy.GetType(providerTypeName); //try to get the type from that Assembly + } + } + } provider = (SettingsProvider) Activator.CreateInstance (provider_type); provider.Initialize (null, null); } diff --git a/mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs b/mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs index d74a226f1e..bdbf0f816a 100644 --- a/mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs +++ b/mcs/class/System/System.Configuration/CustomizableFileSettingsProvider.cs @@ -819,6 +819,11 @@ namespace System.Configuration public void Reset (SettingsContext context) { + if (values == null) { + SettingsPropertyCollection coll = new SettingsPropertyCollection (); + GetPropertyValues (context, coll); + } + if (values != null) { foreach (SettingsPropertyValue propertyValue in values) { // Can't use propertyValue.Property.DefaultValue diff --git a/mcs/class/System/System.Configuration/SettingsPropertyValue.cs b/mcs/class/System/System.Configuration/SettingsPropertyValue.cs index 9bf62c00c6..a15ac24fa0 100644 --- a/mcs/class/System/System.Configuration/SettingsPropertyValue.cs +++ b/mcs/class/System/System.Configuration/SettingsPropertyValue.cs @@ -45,6 +45,7 @@ namespace System.Configuration { this.property = property; needPropertyValue = true; + needSerializedValue = true; } public bool Deserialized { @@ -83,6 +84,8 @@ namespace System.Configuration propertyValue = GetDeserializedValue (serializedValue); if (propertyValue == null) { propertyValue = GetDeserializedDefaultValue (); + serializedValue = null; + needSerializedValue = true; defaulted = true; } needPropertyValue = false; @@ -107,9 +110,7 @@ namespace System.Configuration public object SerializedValue { get { - if (needSerializedValue) { - needSerializedValue = false; - + if ((needSerializedValue || IsDirty) && !UsingDefaultValue) { switch (property.SerializeAs) { case SettingsSerializeAs.String: @@ -143,6 +144,8 @@ namespace System.Configuration break; } + needSerializedValue = false; + dirty = false; } return serializedValue; @@ -150,6 +153,7 @@ namespace System.Configuration set { serializedValue = value; needPropertyValue = true; + needSerializedValue = false; } } @@ -165,6 +169,7 @@ namespace System.Configuration dirty = true; defaulted = true; needPropertyValue = true; + needSerializedValue = true; return propertyValue; } diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounter.cs b/mcs/class/System/System.Diagnostics/PerformanceCounter.cs index 4261b3bc49..2c3305159d 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounter.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounter.cs @@ -127,7 +127,7 @@ namespace System.Diagnostics { [MethodImplAttribute (MethodImplOptions.InternalCall)] static extern IntPtr GetImpl (string category, string counter, - string instance, string machine, out PerformanceCounterType ctype, out bool custom); + string instance, out PerformanceCounterType ctype, out bool custom); [MethodImplAttribute (MethodImplOptions.InternalCall)] static extern bool GetSample (IntPtr impl, bool only_value, out CounterSample sample); @@ -138,6 +138,11 @@ namespace System.Diagnostics { [MethodImplAttribute (MethodImplOptions.InternalCall)] static extern void FreeData (IntPtr impl); + static bool IsValidMachine (string machine) + { // no support for counters on other machines + return machine == "."; + } + /* the perf counter has changed, ensure it's valid and setup it to * be able to collect/update data */ @@ -146,7 +151,9 @@ namespace System.Diagnostics { // need to free the previous info if (impl != IntPtr.Zero) Close (); - impl = GetImpl (categoryName, counterName, instanceName, machineName, out type, out is_custom); + + if (IsValidMachine (machineName)) + impl = GetImpl (categoryName, counterName, instanceName, out type, out is_custom); // system counters are always readonly if (!is_custom) readOnly = true; diff --git a/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs b/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs index 3f8a88f114..84e8c1b91c 100644 --- a/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs +++ b/mcs/class/System/System.Diagnostics/PerformanceCounterCategory.cs @@ -44,27 +44,27 @@ namespace System.Diagnostics static extern bool CategoryDelete (string name); [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern string CategoryHelpInternal (string category, string machine); + static extern string CategoryHelpInternal (string category); /* this icall allows a null counter and it will just search for the category */ [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern bool CounterCategoryExists (string counter, string category, string machine); + static extern bool CounterCategoryExists (string counter, string category); [MethodImplAttribute (MethodImplOptions.InternalCall)] static extern bool Create (string categoryName, string categoryHelp, PerformanceCounterCategoryType categoryType, CounterCreationData[] items); [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern int InstanceExistsInternal (string instance, string category, string machine); + static extern bool InstanceExistsInternal (string instance, string category); [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern string[] GetCategoryNames (string machine); + static extern string[] GetCategoryNames (); [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern string[] GetCounterNames (string category, string machine); + static extern string[] GetCounterNames (string category); [MethodImplAttribute (MethodImplOptions.InternalCall)] - static extern string[] GetInstanceNames (string category, string machine); + static extern string[] GetInstanceNames (string category); static void CheckCategory (string categoryName) { if (categoryName == null) @@ -95,10 +95,17 @@ namespace System.Diagnostics this.machineName = machineName; } + static bool IsValidMachine (string machine) + { // no support for counters on other machines + return machine == "."; + } + // may throw InvalidOperationException, Win32Exception public string CategoryHelp { get { - string res = CategoryHelpInternal (categoryName, machineName); + string res = null; + if (IsValidMachine (machineName)) + res = CategoryHelpInternal (categoryName); if (res != null) return res; throw new InvalidOperationException (); @@ -154,7 +161,8 @@ namespace System.Diagnostics CheckCategory (categoryName); if (machineName == null) throw new ArgumentNullException ("machineName"); - return CounterCategoryExists (counterName, categoryName, machineName); + return IsValidMachine (machineName) + && CounterCategoryExists (counterName, categoryName); } [Obsolete ("Use another overload that uses PerformanceCounterCategoryType instead")] @@ -227,7 +235,8 @@ namespace System.Diagnostics public static bool Exists (string categoryName, string machineName) { CheckCategory (categoryName); - return CounterCategoryExists (null, categoryName, machineName); + return IsValidMachine (machineName) && + CounterCategoryExists (null, categoryName); } public static PerformanceCounterCategory[] GetCategories () @@ -239,7 +248,11 @@ namespace System.Diagnostics { if (machineName == null) throw new ArgumentNullException ("machineName"); - string[] catnames = GetCategoryNames (machineName); + + if (!IsValidMachine (machineName)) + return Array.Empty(); + + string[] catnames = GetCategoryNames (); PerformanceCounterCategory[] cats = new PerformanceCounterCategory [catnames.Length]; for (int i = 0; i < catnames.Length; ++i) cats [i] = new PerformanceCounterCategory (catnames [i], machineName); @@ -253,7 +266,9 @@ namespace System.Diagnostics public PerformanceCounter[] GetCounters (string instanceName) { - string[] countnames = GetCounterNames (categoryName, machineName); + if (!IsValidMachine (machineName)) + return Array.Empty(); + string[] countnames = GetCounterNames (categoryName); PerformanceCounter[] counters = new PerformanceCounter [countnames.Length]; for (int i = 0; i < countnames.Length; ++i) { counters [i] = new PerformanceCounter (categoryName, countnames [i], instanceName, machineName); @@ -263,7 +278,9 @@ namespace System.Diagnostics public string[] GetInstanceNames () { - return GetInstanceNames (categoryName, machineName); + if (!IsValidMachine (machineName)) + return Array.Empty(); + return GetInstanceNames (categoryName); } public bool InstanceExists (string instanceName) @@ -283,12 +300,12 @@ namespace System.Diagnostics CheckCategory (categoryName); if (machineName == null) throw new ArgumentNullException ("machineName"); - int val = InstanceExistsInternal (instanceName, categoryName, machineName); - if (val == 0) - return false; - if (val == 1) - return true; - throw new InvalidOperationException (); + + //?FIXME: machine appears to be wrong + //if (!IsValidMachine (machineName)) + //return false; + + return InstanceExistsInternal (instanceName, categoryName); } [MonoTODO] diff --git a/mcs/class/System/System.Net.Sockets/Socket.cs b/mcs/class/System/System.Net.Sockets/Socket.cs index fe7099144e..0a7a4a0608 100644 --- a/mcs/class/System/System.Net.Sockets/Socket.cs +++ b/mcs/class/System/System.Net.Sockets/Socket.cs @@ -47,7 +47,7 @@ using System.Text; using System.Timers; using System.Net.NetworkInformation; -namespace System.Net.Sockets +namespace System.Net.Sockets { public partial class Socket : IDisposable { @@ -91,7 +91,14 @@ namespace System.Net.Sockets int m_IntCleanedUp; internal bool connect_in_progress; -#region Constructors +#if MONO_WEB_DEBUG + static int nextId; + internal readonly int ID = ++nextId; +#else + internal readonly int ID; +#endif + + #region Constructors public Socket (SocketInformation socketInformation) diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs index d05722051f..7b25c3e709 100644 --- a/mcs/class/System/System.Net/HttpWebRequest.cs +++ b/mcs/class/System/System.Net/HttpWebRequest.cs @@ -4,10 +4,12 @@ // Authors: // Lawrence Pit (loz@cable.a2000.nl) // Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Martin Baulig // // (c) 2002 Lawrence Pit // (c) 2003 Ximian, Inc. (http://www.ximian.com) // (c) 2004 Novell, Inc. (http://www.novell.com) +// Copyright (c) 2017 Xamarin Inc. (http://www.xamarin.com) // // @@ -30,7 +32,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. // - #if SECURITY_DEP #if MONO_SECURITY_ALIAS extern alias MonoSecurity; @@ -54,17 +55,20 @@ using System.Runtime.Serialization; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; +using System.Threading.Tasks; using Mono.Net.Security; -namespace System.Net +namespace System.Net { [Serializable] - public class HttpWebRequest : WebRequest, ISerializable { + public class HttpWebRequest : WebRequest, ISerializable + { Uri requestUri; Uri actualUri; bool hostChanged; bool allowAutoRedirect = true; bool allowBuffering = true; + bool allowReadStreamBuffering; X509CertificateCollection certificates; string connectionGroup; bool haveContentLength; @@ -72,8 +76,7 @@ namespace System.Net HttpContinueDelegate continueDelegate; CookieContainer cookieContainer; ICredentials credentials; - bool haveResponse; - bool haveRequest; + bool haveResponse; bool requestSent; WebHeaderCollection webHeaders; bool keepAlive = true; @@ -91,26 +94,24 @@ namespace System.Net bool sendChunked; ServicePoint servicePoint; int timeout = 100000; - - WebConnectionStream writeStream; + int continueTimeout = 350; + + WebRequestStream writeStream; HttpWebResponse webResponse; - WebAsyncResult asyncWrite; - WebAsyncResult asyncRead; - EventHandler abortHandler; + WebCompletionSource responseTask; + WebOperation currentOperation; int aborted; bool gotRequestStream; int redirects; bool expectContinue; - byte[] bodyBuffer; - int bodyBufferLength; bool getResponseCalled; - Exception saved_exc; object locker = new object (); bool finished_reading; - internal WebConnection WebConnection; DecompressionMethods auto_decomp; int maxResponseHeadersLength; static int defaultMaxResponseHeadersLength; + static int defaultMaximumErrorResponseLength; + static RequestCachePolicy defaultCachePolicy; int readWriteTimeout = 300000; // ms #if SECURITY_DEP MonoTlsProvider tlsProvider; @@ -118,32 +119,34 @@ namespace System.Net #endif ServerCertValidationCallback certValidationCallback; - enum NtlmAuthState { + // stores the user provided Host header as Uri. If the user specified a default port explicitly we'll lose + // that information when converting the host string to a Uri. _HostHasPort will store that information. + bool hostHasPort; + Uri hostUri; + + enum NtlmAuthState + { None, Challenge, Response } AuthorizationState auth_state, proxy_auth_state; - string host; [NonSerialized] - internal Action ResendContentFactory; + internal Func ResendContentFactory; // Constructors static HttpWebRequest () { - defaultMaxResponseHeadersLength = 64 * 1024; + defaultMaxResponseHeadersLength = 64; + defaultMaximumErrorResponseLength = 64; + defaultCachePolicy = new RequestCachePolicy (RequestCacheLevel.BypassCache); #if !MOBILE #pragma warning disable 618 NetConfig config = ConfigurationSettings.GetConfig ("system.net/settings") as NetConfig; #pragma warning restore 618 - if (config != null) { - int x = config.MaxResponseHeadersLength; - if (x != -1) - x *= 64; - - defaultMaxResponseHeadersLength = x; - } + if (config != null) + defaultMaxResponseHeadersLength = config.MaxResponseHeadersLength; #endif } @@ -152,7 +155,7 @@ namespace System.Net #else internal #endif - HttpWebRequest (Uri uri) + HttpWebRequest (Uri uri) { this.requestUri = uri; this.actualUri = uri; @@ -170,89 +173,74 @@ namespace System.Net this.tlsSettings = settings; } #endif - - [Obsolete ("Serialization is obsoleted for this type", false)] - protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) - { - SerializationInfo info = serializationInfo; - requestUri = (Uri) info.GetValue ("requestUri", typeof (Uri)); - actualUri = (Uri) info.GetValue ("actualUri", typeof (Uri)); - allowAutoRedirect = info.GetBoolean ("allowAutoRedirect"); - allowBuffering = info.GetBoolean ("allowBuffering"); - certificates = (X509CertificateCollection) info.GetValue ("certificates", typeof (X509CertificateCollection)); - connectionGroup = info.GetString ("connectionGroup"); - contentLength = info.GetInt64 ("contentLength"); - webHeaders = (WebHeaderCollection) info.GetValue ("webHeaders", typeof (WebHeaderCollection)); - keepAlive = info.GetBoolean ("keepAlive"); - maxAutoRedirect = info.GetInt32 ("maxAutoRedirect"); - mediaType = info.GetString ("mediaType"); - method = info.GetString ("method"); - initialMethod = info.GetString ("initialMethod"); - pipelined = info.GetBoolean ("pipelined"); - version = (Version) info.GetValue ("version", typeof (Version)); - proxy = (IWebProxy) info.GetValue ("proxy", typeof (IWebProxy)); - sendChunked = info.GetBoolean ("sendChunked"); - timeout = info.GetInt32 ("timeout"); - redirects = info.GetInt32 ("redirects"); - host = info.GetString ("host"); - ResetAuthorization (); + [Obsolete ("Serialization is obsoleted for this type. http://go.microsoft.com/fwlink/?linkid=14202")] + protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext) + { + // In CoreFX, attempting to serialize this class fails due to + // non-serializable fields, so this constructor never gets called. + // They're throwing PlatformNotSupportedException() in here. + throw new SerializationException (); } +#if MONO_WEB_DEBUG + static int nextId; + internal readonly int ID = ++nextId; +#else + internal readonly int ID; +#endif + void ResetAuthorization () { auth_state = new AuthorizationState (this, false); proxy_auth_state = new AuthorizationState (this, true); } - + // Properties - void SetSpecialHeaders(string HeaderName, string value) { - value = WebHeaderCollection.CheckBadChars(value, true); - webHeaders.RemoveInternal(HeaderName); + void SetSpecialHeaders (string HeaderName, string value) + { + value = WebHeaderCollection.CheckBadChars (value, true); + webHeaders.RemoveInternal (HeaderName); if (value.Length != 0) { - webHeaders.AddInternal(HeaderName, value); + webHeaders.AddInternal (HeaderName, value); } } public string Accept { - get { return webHeaders ["Accept"]; } + get { return webHeaders["Accept"]; } set { CheckRequestStarted (); SetSpecialHeaders ("Accept", value); } } - + public Uri Address { get { return actualUri; } internal set { actualUri = value; } // Used by Ftp+proxy } - + public virtual bool AllowAutoRedirect { get { return allowAutoRedirect; } set { this.allowAutoRedirect = value; } } - + public virtual bool AllowWriteStreamBuffering { get { return allowBuffering; } set { allowBuffering = value; } } - + public virtual bool AllowReadStreamBuffering { - get { return false; } - set { - if (value) - throw new InvalidOperationException (); - } + get { return allowReadStreamBuffering; } + set { allowReadStreamBuffering = value; } } static Exception GetMustImplement () { return new NotImplementedException (); } - - public DecompressionMethods AutomaticDecompression - { + + public DecompressionMethods AutomaticDecompression { get { return auto_decomp; } @@ -261,7 +249,7 @@ namespace System.Net auto_decomp = value; } } - + internal bool InternalAllowBuffering { get { return allowBuffering && MethodWithBuffer; @@ -300,74 +288,72 @@ namespace System.Net } public string Connection { - get { return webHeaders ["Connection"]; } + get { return webHeaders["Connection"]; } set { CheckRequestStarted (); - if (string.IsNullOrEmpty (value)) { + if (string.IsNullOrWhiteSpace (value)) { webHeaders.RemoveInternal ("Connection"); return; } string val = value.ToLowerInvariant (); if (val.Contains ("keep-alive") || val.Contains ("close")) - throw new ArgumentException ("Keep-Alive and Close may not be set with this property"); + throw new ArgumentException (SR.net_connarg, nameof (value)); - if (keepAlive) - value = value + ", Keep-Alive"; - - webHeaders.CheckUpdate ("Connection", value); + string checkedValue = HttpValidationHelpers.CheckBadHeaderValueChars (value); + webHeaders.CheckUpdate ("Connection", checkedValue); } - } - - public override string ConnectionGroupName { + } + + public override string ConnectionGroupName { get { return connectionGroup; } set { connectionGroup = value; } } - - public override long ContentLength { + + public override long ContentLength { get { return contentLength; } - set { + set { CheckRequestStarted (); if (value < 0) throw new ArgumentOutOfRangeException ("value", "Content-Length must be >= 0"); - + contentLength = value; haveContentLength = true; } } - + internal long InternalContentLength { set { contentLength = value; } } - + internal bool ThrowOnError { get; set; } - - public override string ContentType { - get { return webHeaders ["Content-Type"]; } + + public override string ContentType { + get { return webHeaders["Content-Type"]; } set { SetSpecialHeaders ("Content-Type", value); } } - + public HttpContinueDelegate ContinueDelegate { get { return continueDelegate; } set { continueDelegate = value; } } - + virtual public CookieContainer CookieContainer { get { return cookieContainer; } set { cookieContainer = value; } } - - public override ICredentials Credentials { + + public override ICredentials Credentials { get { return credentials; } set { credentials = value; } } public DateTime Date { get { - string date = webHeaders ["Date"]; + string date = webHeaders["Date"]; if (date == null) return DateTime.MinValue; return DateTime.ParseExact (date, "r", CultureInfo.InvariantCulture).ToLocalTime (); @@ -377,39 +363,30 @@ namespace System.Net } } - void SetDateHeaderHelper(string headerName, DateTime dateTime) { + void SetDateHeaderHelper (string headerName, DateTime dateTime) + { if (dateTime == DateTime.MinValue) - SetSpecialHeaders(headerName, null); // remove header + SetSpecialHeaders (headerName, null); // remove header else - SetSpecialHeaders(headerName, HttpProtocolUtils.date2string(dateTime)); + SetSpecialHeaders (headerName, HttpProtocolUtils.date2string (dateTime)); } #if !MOBILE [MonoTODO] - public static new RequestCachePolicy DefaultCachePolicy - { - get { - throw GetMustImplement (); - } - set { - throw GetMustImplement (); - } + public static new RequestCachePolicy DefaultCachePolicy { + get { return defaultCachePolicy; } + set { defaultCachePolicy = value; } } #endif - + [MonoTODO] - public static int DefaultMaximumErrorResponseLength - { - get { - throw GetMustImplement (); - } - set { - throw GetMustImplement (); - } + public static int DefaultMaximumErrorResponseLength { + get { return defaultMaximumErrorResponseLength; } + set { defaultMaximumErrorResponseLength = value; } } - + public string Expect { - get { return webHeaders ["Expect"]; } + get { return webHeaders["Expect"]; } set { CheckRequestStarted (); string val = value; @@ -428,19 +405,19 @@ namespace System.Net webHeaders.CheckUpdate ("Expect", value); } } - + virtual public bool HaveResponse { get { return haveResponse; } } - - public override WebHeaderCollection Headers { + + public override WebHeaderCollection Headers { get { return webHeaders; } set { CheckRequestStarted (); WebHeaderCollection webHeaders = value; - WebHeaderCollection newWebHeaders = new WebHeaderCollection(WebHeaderCollectionType.HttpWebRequest); + WebHeaderCollection newWebHeaders = new WebHeaderCollection (WebHeaderCollectionType.HttpWebRequest); // Copy And Validate - // Handle the case where their object tries to change @@ -448,55 +425,54 @@ namespace System.Net // we need to clone their headers. // - foreach (String headerName in webHeaders.AllKeys ) { - newWebHeaders.Add(headerName,webHeaders[headerName]); + foreach (String headerName in webHeaders.AllKeys) { + newWebHeaders.Add (headerName, webHeaders[headerName]); } this.webHeaders = newWebHeaders; } } - - public - string Host { + + public string Host { + get { - if (host == null) - return actualUri.Authority; - return host; + Uri uri = hostUri ?? Address; + return (hostUri == null || !hostHasPort) && Address.IsDefaultPort ? + uri.Host : uri.Host + ":" + uri.Port; } set { + CheckRequestStarted (); + if (value == null) - throw new ArgumentNullException ("value"); + throw new ArgumentNullException (nameof (value)); - if (!CheckValidHost (actualUri.Scheme, value)) - throw new ArgumentException ("Invalid host: " + value); + Uri uri; + if ((value.IndexOf ('/') != -1) || (!TryGetHostUri (value, out uri))) + throw new ArgumentException (SR.net_invalid_host, nameof (value)); - host = value; + hostUri = uri; + + // Determine if the user provided string contains a port + if (!hostUri.IsDefaultPort) { + hostHasPort = true; + } else if (value.IndexOf (':') == -1) { + hostHasPort = false; + } else { + int endOfIPv6Address = value.IndexOf (']'); + hostHasPort = endOfIPv6Address == -1 || value.LastIndexOf (':') > endOfIPv6Address; + } } } - static bool CheckValidHost (string scheme, string val) + bool TryGetHostUri (string hostName, out Uri hostUri) { - if (val.Length == 0) - return false; - - if (val [0] == '.') - return false; - - int idx = val.IndexOf ('/'); - if (idx >= 0) - return false; - - IPAddress ipaddr; - if (IPAddress.TryParse (val, out ipaddr)) - return true; - - string u = scheme + "://" + val + "/"; - return Uri.IsWellFormedUriString (u, UriKind.Absolute); + string s = Address.Scheme + "://" + hostName + Address.PathAndQuery; + return Uri.TryCreate (s, UriKind.Absolute, out hostUri); } public DateTime IfModifiedSince { - get { - string str = webHeaders ["If-Modified-Since"]; + get { + string str = webHeaders["If-Modified-Since"]; if (str == null) return DateTime.Now; try { @@ -508,13 +484,13 @@ namespace System.Net set { CheckRequestStarted (); // rfc-1123 pattern - webHeaders.SetInternal ("If-Modified-Since", + webHeaders.SetInternal ("If-Modified-Since", value.ToUniversalTime ().ToString ("r", null)); // TODO: check last param when using different locale } } - public bool KeepAlive { + public bool KeepAlive { get { return keepAlive; } @@ -522,7 +498,7 @@ namespace System.Net keepAlive = value; } } - + public int MaximumAutomaticRedirections { get { return maxAutoRedirect; } set { @@ -530,13 +506,19 @@ namespace System.Net throw new ArgumentException ("Must be > 0", "value"); maxAutoRedirect = value; - } + } } [MonoTODO ("Use this")] public int MaximumResponseHeadersLength { get { return maxResponseHeadersLength; } - set { maxResponseHeadersLength = value; } + set { + CheckRequestStarted (); + if (value < 0 && value != System.Threading.Timeout.Infinite) + throw new ArgumentOutOfRangeException (nameof (value), SR.net_toosmall); + + maxResponseHeadersLength = value; + } } [MonoTODO ("Use this")] @@ -545,37 +527,45 @@ namespace System.Net set { defaultMaxResponseHeadersLength = value; } } - public int ReadWriteTimeout { + public int ReadWriteTimeout { get { return readWriteTimeout; } set { - if (requestSent) - throw new InvalidOperationException ("The request has already been sent."); + CheckRequestStarted (); - if (value < -1) - throw new ArgumentOutOfRangeException ("value", "Must be >= -1"); + if (value <= 0 && value != System.Threading.Timeout.Infinite) + throw new ArgumentOutOfRangeException (nameof (value), SR.net_io_timeout_use_gt_zero); readWriteTimeout = value; } } - + [MonoTODO] public int ContinueTimeout { - get { throw new NotImplementedException (); } - set { throw new NotImplementedException (); } + get { + return continueTimeout; + } + set { + CheckRequestStarted (); + if ((value < 0) && (value != System.Threading.Timeout.Infinite)) + throw new ArgumentOutOfRangeException (nameof (value), SR.net_io_timeout_use_ge_zero); + continueTimeout = value; + } } - + public string MediaType { get { return mediaType; } - set { + set { mediaType = value; } } - - public override string Method { + + public override string Method { get { return this.method; } - set { - if (value == null || value.Trim () == "") - throw new ArgumentException ("not a valid method"); + set { + if (string.IsNullOrEmpty (value)) + throw new ArgumentException (SR.net_badmethod, nameof (value)); + if (HttpValidationHelpers.IsInvalidMethodOrHeaderString (value)) + throw new ArgumentException (SR.net_badmethod, nameof (value)); method = value.ToUpperInvariant (); if (method != "HEAD" && method != "GET" && method != "POST" && method != "PUT" && @@ -585,43 +575,43 @@ namespace System.Net } } } - + public bool Pipelined { get { return pipelined; } set { pipelined = value; } - } - - public override bool PreAuthenticate { + } + + public override bool PreAuthenticate { get { return preAuthenticate; } set { preAuthenticate = value; } } - + public Version ProtocolVersion { get { return version; } - set { + set { if (value != HttpVersion.Version10 && value != HttpVersion.Version11) - throw new ArgumentException ("value"); + throw new ArgumentException (SR.net_wrongversion, nameof (value)); force_version = true; - version = value; + version = value; } } - - public override IWebProxy Proxy { + + public override IWebProxy Proxy { get { return proxy; } - set { + set { CheckRequestStarted (); proxy = value; servicePoint = null; // we may need a new one GetServicePoint (); } } - + public string Referer { - get { return webHeaders ["Referer"]; } + get { return webHeaders["Referer"]; } set { CheckRequestStarted (); - if (value == null || value.Trim().Length == 0) { + if (value == null || value.Trim ().Length == 0) { webHeaders.RemoveInternal ("Referer"); return; } @@ -629,10 +619,10 @@ namespace System.Net } } - public override Uri RequestUri { + public override Uri RequestUri { get { return requestUri; } } - + public bool SendChunked { get { return sendChunked; } set { @@ -640,7 +630,7 @@ namespace System.Net sendChunked = value; } } - + public ServicePoint ServicePoint { get { return GetServicePoint (); } } @@ -648,14 +638,14 @@ namespace System.Net internal ServicePoint ServicePointNoLock { get { return servicePoint; } } - public virtual bool SupportsCookieContainer { + public virtual bool SupportsCookieContainer { get { // The managed implementation supports the cookie container // it is only Silverlight that returns false here return true; } } - public override int Timeout { + public override int Timeout { get { return timeout; } set { if (value < -1) @@ -664,44 +654,45 @@ namespace System.Net timeout = value; } } - + public string TransferEncoding { - get { return webHeaders ["Transfer-Encoding"]; } + get { return webHeaders["Transfer-Encoding"]; } set { CheckRequestStarted (); - string val = value; - if (val != null) - val = val.Trim ().ToLower (); - if (val == null || val.Length == 0) { + if (string.IsNullOrWhiteSpace (value)) { webHeaders.RemoveInternal ("Transfer-Encoding"); return; } - if (val == "chunked") - throw new ArgumentException ("Chunked encoding must be set with the SendChunked property"); + string val = value.ToLower (); + // + // prevent them from adding chunked, or from adding an Encoding without + // turning on chunked, the reason is due to the HTTP Spec which prevents + // additional encoding types from being used without chunked + // + if (val.Contains ("chunked")) + throw new ArgumentException (SR.net_nochunked, nameof (value)); + else if (!SendChunked) + throw new InvalidOperationException (SR.net_needchunked); - if (!sendChunked) - throw new ArgumentException ("SendChunked must be True", "value"); - - webHeaders.CheckUpdate ("Transfer-Encoding", value); + string checkedValue = HttpValidationHelpers.CheckBadHeaderValueChars (value); + webHeaders.CheckUpdate ("Transfer-Encoding", checkedValue); } } - public override bool UseDefaultCredentials - { + public override bool UseDefaultCredentials { get { return CredentialCache.DefaultCredentials == Credentials; } set { Credentials = value ? CredentialCache.DefaultCredentials : null; } } - + public string UserAgent { - get { return webHeaders ["User-Agent"]; } + get { return webHeaders["User-Agent"]; } set { webHeaders.SetInternal ("User-Agent", value); } } bool unsafe_auth_blah; - public bool UnsafeAuthenticatedConnectionSharing - { + public bool UnsafeAuthenticatedConnectionSharing { get { return unsafe_auth_blah; } set { unsafe_auth_blah = value; } } @@ -714,11 +705,11 @@ namespace System.Net get { return expectContinue; } set { expectContinue = value; } } - + internal Uri AuthUri { get { return actualUri; } } - + internal bool ProxyQuery { get { return servicePoint.UsesProxy && !servicePoint.UseConnect; } } @@ -733,8 +724,7 @@ namespace System.Net return null; return certValidationCallback.ValidationCallback; } - set - { + set { if (value == null) certValidationCallback = null; else @@ -743,7 +733,7 @@ namespace System.Net } // Methods - + internal ServicePoint GetServicePoint () { lock (locker) { @@ -755,30 +745,30 @@ namespace System.Net return servicePoint; } - + public void AddRange (int range) { - AddRange ("bytes", (long) range); + AddRange ("bytes", (long)range); } - + public void AddRange (int from, int to) { - AddRange ("bytes", (long) from, (long) to); + AddRange ("bytes", (long)from, (long)to); } - + public void AddRange (string rangeSpecifier, int range) { - AddRange (rangeSpecifier, (long) range); + AddRange (rangeSpecifier, (long)range); } - + public void AddRange (string rangeSpecifier, int from, int to) { - AddRange (rangeSpecifier, (long) from, (long) to); + AddRange (rangeSpecifier, (long)from, (long)to); } public void AddRange (long range) { - AddRange ("bytes", (long) range); + AddRange ("bytes", (long)range); } public @@ -795,7 +785,7 @@ namespace System.Net if (!WebHeaderCollection.IsValidToken (rangeSpecifier)) throw new ArgumentException ("Invalid range specifier", "rangeSpecifier"); - string r = webHeaders ["Range"]; + string r = webHeaders["Range"]; if (r == null) r = rangeSpecifier + "="; else { @@ -825,7 +815,7 @@ namespace System.Net if (to < 0) throw new ArgumentOutOfRangeException ("to"); - string r = webHeaders ["Range"]; + string r = webHeaders["Range"]; if (r == null) r = rangeSpecifier + "="; else @@ -835,11 +825,38 @@ namespace System.Net webHeaders.ChangeInternal ("Range", r); } - - public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) + WebOperation SendRequest (bool redirecting, BufferOffsetSize writeBuffer, CancellationToken cancellationToken) + { + lock (locker) { + WebConnection.Debug ($"HWR SEND REQUEST: Req={ID} requestSent={requestSent} redirecting={redirecting}"); + + WebOperation operation; + if (!redirecting) { + if (requestSent) { + operation = currentOperation; + if (operation == null) + throw new InvalidOperationException ("Should never happen!"); + return operation; + } + } + + operation = new WebOperation (this, writeBuffer, false, cancellationToken); + if (Interlocked.CompareExchange (ref currentOperation, operation, null) != null) + throw new InvalidOperationException ("Invalid nested call."); + + requestSent = true; + if (!redirecting) + redirects = 0; + servicePoint = GetServicePoint (); + servicePoint.SendRequest (operation, connectionGroup); + return operation; + } + } + + Task MyGetRequestStreamAsync (CancellationToken cancellationToken) { if (Aborted) - throw new WebException ("The request was canceled.", WebExceptionStatus.RequestCanceled); + throw CreateRequestAbortedException (); bool send = !(method == "GET" || method == "CONNECT" || method == "HEAD" || method == "TRACE"); @@ -853,36 +870,26 @@ namespace System.Net if (!sendChunked && transferEncoding != null && transferEncoding.Trim () != "") throw new ProtocolViolationException ("SendChunked should be true."); - lock (locker) - { + WebOperation operation; + lock (locker) { if (getResponseCalled) throw new InvalidOperationException ("The operation cannot be performed once the request has been submitted."); - if (asyncWrite != null) { - throw new InvalidOperationException ("Cannot re-call start of asynchronous " + - "method while a previous call is still in progress."); + operation = currentOperation; + if (operation == null) { + initialMethod = method; + + gotRequestStream = true; + operation = SendRequest (false, null, cancellationToken); } - - asyncWrite = new WebAsyncResult (this, callback, state); - initialMethod = method; - if (haveRequest) { - if (writeStream != null) { - asyncWrite.SetCompleted (true, writeStream); - asyncWrite.DoCallback (); - return asyncWrite; - } - } - - gotRequestStream = true; - WebAsyncResult result = asyncWrite; - if (!requestSent) { - requestSent = true; - redirects = 0; - servicePoint = GetServicePoint (); - abortHandler = servicePoint.SendRequest (this, connectionGroup); - } - return result; } + + return operation.GetRequestStream (); + } + + public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state) + { + return TaskToApm.Begin (RunWithTimeout (MyGetRequestStreamAsync), callback, state); } public override Stream EndGetRequestStream (IAsyncResult asyncResult) @@ -890,34 +897,20 @@ namespace System.Net if (asyncResult == null) throw new ArgumentNullException ("asyncResult"); - WebAsyncResult result = asyncResult as WebAsyncResult; - if (result == null) - throw new ArgumentException ("Invalid IAsyncResult"); - - asyncWrite = result; - result.WaitUntilComplete (); - - Exception e = result.Exception; - if (e != null) - throw e; - - return result.WriteStream; + try { + return TaskToApm.End (asyncResult); + } catch (Exception e) { + throw FlattenException (e); + } } - - public override Stream GetRequestStream() + + public override Stream GetRequestStream () { - IAsyncResult asyncResult = asyncWrite; - if (asyncResult == null) { - asyncResult = BeginGetRequestStream (null, null); - asyncWrite = (WebAsyncResult) asyncResult; + try { + return GetRequestStreamAsync ().Result; + } catch (Exception e) { + throw FlattenException (e); } - - if (!asyncResult.IsCompleted && !asyncResult.AsyncWaitHandle.WaitOne (timeout, false)) { - Abort (); - throw new WebException ("The request timed out", WebExceptionStatus.Timeout); - } - - return EndGetRequestStream (asyncResult); } [MonoTODO] @@ -926,30 +919,51 @@ namespace System.Net throw new NotImplementedException (); } - bool CheckIfForceWrite (SimpleAsyncResult result) + public override Task GetRequestStreamAsync () { - if (writeStream == null || writeStream.RequestWritten || !InternalAllowBuffering) - return false; - if (contentLength < 0 && writeStream.CanWrite == true && writeStream.WriteBufferLength < 0) - return false; - - if (contentLength < 0 && writeStream.WriteBufferLength >= 0) - InternalContentLength = writeStream.WriteBufferLength; - - // This will write the POST/PUT if the write stream already has the expected - // amount of bytes in it (ContentLength) (bug #77753) or if the write stream - // contains data and it has been closed already (xamarin bug #1512). - - if (writeStream.WriteBufferLength == contentLength || (contentLength == -1 && writeStream.CanWrite == false)) - return writeStream.WriteRequestAsync (result); - - return false; + return RunWithTimeout (MyGetRequestStreamAsync); } - public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state) + internal static Task RunWithTimeout ( + Func> func, int timeout, Action abort) + { + // Call `func` here to propagate any potential exception that it + // might throw to our caller rather than returning a faulted task. + var cts = new CancellationTokenSource (); + var workerTask = func (cts.Token); + return RunWithTimeoutWorker (workerTask, timeout, abort, cts); + } + + static async Task RunWithTimeoutWorker ( + Task workerTask, int timeout, Action abort, + CancellationTokenSource cts) + { + try { + if (await ServicePointScheduler.WaitAsync (workerTask, timeout).ConfigureAwait (false)) + return workerTask.Result; + try { + cts.Cancel (); + abort (); + } catch { + // Ignore; we report the timeout. + } + throw new WebException (SR.net_timeout, WebExceptionStatus.Timeout); + } catch (Exception ex) { + throw FlattenException (ex); + } finally { + cts.Dispose (); + } + } + + Task RunWithTimeout (Func> func) + { + return RunWithTimeout (func, timeout, Abort); + } + + async Task MyGetResponseAsync (CancellationToken cancellationToken) { if (Aborted) - throw new WebException ("The request was canceled.", WebExceptionStatus.RequestCanceled); + throw CreateRequestAbortedException (); if (method == null) throw new ProtocolViolationException ("Method is null."); @@ -958,93 +972,233 @@ namespace System.Net if (!sendChunked && transferEncoding != null && transferEncoding.Trim () != "") throw new ProtocolViolationException ("SendChunked should be true."); - Monitor.Enter (locker); - getResponseCalled = true; - if (asyncRead != null && !haveResponse) { - Monitor.Exit (locker); - throw new InvalidOperationException ("Cannot re-call start of asynchronous " + - "method while a previous call is still in progress."); + var completion = new WebCompletionSource (); + WebOperation operation; + lock (locker) { + getResponseCalled = true; + var oldCompletion = Interlocked.CompareExchange (ref responseTask, completion, null); + WebConnection.Debug ($"HWR GET RESPONSE: Req={ID} {oldCompletion != null}"); + if (oldCompletion != null) { + oldCompletion.ThrowOnError (); + if (haveResponse && oldCompletion.Task.IsCompleted) + return webResponse; + throw new InvalidOperationException ("Cannot re-call start of asynchronous " + + "method while a previous call is still in progress."); + } + + operation = currentOperation; + if (currentOperation != null) + writeStream = currentOperation.WriteStream; + + initialMethod = method; + + operation = SendRequest (false, null, cancellationToken); } - asyncRead = new WebAsyncResult (this, callback, state); - WebAsyncResult aread = asyncRead; - initialMethod = method; - - SimpleAsyncResult.RunWithLock (locker, CheckIfForceWrite, inner => { - var synch = inner.CompletedSynchronouslyPeek; - - if (inner.GotException) { - aread.SetCompleted (synch, inner.Exception); - aread.DoCallback (); - return; - } - - if (haveResponse) { - Exception saved = saved_exc; - if (webResponse != null) { - if (saved == null) { - aread.SetCompleted (synch, webResponse); - } else { - aread.SetCompleted (synch, saved); - } - aread.DoCallback (); - return; - } else if (saved != null) { - aread.SetCompleted (synch, saved); - aread.DoCallback (); - return; - } - } - - if (requestSent) - return; + while (true) { + WebException throwMe = null; + HttpWebResponse response = null; + WebResponseStream stream = null; + bool redirect = false; + bool mustReadAll = false; + WebOperation ntlm = null; + BufferOffsetSize writeBuffer = null; try { - requestSent = true; - redirects = 0; - servicePoint = GetServicePoint (); - abortHandler = servicePoint.SendRequest (this, connectionGroup); - } catch (Exception ex) { - aread.SetCompleted (synch, ex); - aread.DoCallback (); - } - }); + cancellationToken.ThrowIfCancellationRequested (); - return aread; + WebConnection.Debug ($"HWR GET RESPONSE LOOP: Req={ID} {auth_state.NtlmAuthState}"); + + writeStream = await operation.GetRequestStreamInternal (); + await writeStream.WriteRequestAsync (cancellationToken).ConfigureAwait (false); + + stream = await operation.GetResponseStream (); + + WebConnection.Debug ($"HWR RESPONSE LOOP #0: Req={ID} - {stream?.Headers != null}"); + + (response, redirect, mustReadAll, writeBuffer, ntlm) = await GetResponseFromData ( + stream, cancellationToken).ConfigureAwait (false); + } catch (Exception e) { + throwMe = GetWebException (e); + } + + WebConnection.Debug ($"HWR GET RESPONSE LOOP #1: Req={ID} - redirect={redirect} mustReadAll={mustReadAll} writeBuffer={writeBuffer != null} ntlm={ntlm != null} - {throwMe != null}"); + + lock (locker) { + if (throwMe != null) { + WebConnection.Debug ($"HWR GET RESPONSE LOOP #1 EX: Req={ID} {throwMe.Status} {throwMe.InnerException?.GetType ()}"); + haveResponse = true; + completion.TrySetException (throwMe); + throw throwMe; + } + + if (!redirect) { + haveResponse = true; + webResponse = response; + completion.TrySetCompleted (); + return response; + } + + finished_reading = false; + haveResponse = false; + webResponse = null; + currentOperation = ntlm; + WebConnection.Debug ($"HWR GET RESPONSE LOOP #2: Req={ID} {mustReadAll} {ntlm}"); + } + + try { + if (mustReadAll) + await stream.ReadAllAsync (redirect || ntlm != null, cancellationToken).ConfigureAwait (false); + operation.Finish (true); + response.Close (); + } catch (Exception e) { + throwMe = GetWebException (e); + } + + lock (locker) { + WebConnection.Debug ($"HWR GET RESPONSE LOOP #3: Req={ID} {writeBuffer != null} {ntlm != null}"); + if (throwMe != null) { + WebConnection.Debug ($"HWR GET RESPONSE LOOP #3 EX: Req={ID} {throwMe.Status} {throwMe.InnerException?.GetType ()}"); + haveResponse = true; + stream?.Close (); + completion.TrySetException (throwMe); + throw throwMe; + } + + if (ntlm == null) { + operation = SendRequest (true, writeBuffer, cancellationToken); + } else { + operation = ntlm; + } + } + } + } + + async Task<(HttpWebResponse response, bool redirect, bool mustReadAll, BufferOffsetSize writeBuffer, WebOperation ntlm)> + GetResponseFromData (WebResponseStream stream, CancellationToken cancellationToken) + { + /* + * WebConnection has either called SetResponseData() or SetResponseError(). + */ + + var response = new HttpWebResponse (actualUri, method, stream, cookieContainer); + + WebException throwMe = null; + bool redirect = false; + bool mustReadAll = false; + WebOperation ntlm = null; + Task rewriteHandler = null; + BufferOffsetSize writeBuffer = null; + + lock (locker) { + (redirect, mustReadAll, rewriteHandler, throwMe) = CheckFinalStatus (response); + } + + if (throwMe != null) { + if (mustReadAll) + await stream.ReadAllAsync (false, cancellationToken).ConfigureAwait (false); + throw throwMe; + } + + if (rewriteHandler != null) { + writeBuffer = await rewriteHandler.ConfigureAwait (false); + } + + lock (locker) { + bool isProxy = ProxyQuery && proxy != null && !proxy.IsBypassed (actualUri); + + if (!redirect) { + if ((isProxy ? proxy_auth_state : auth_state).IsNtlmAuthenticated && (int)response.StatusCode < 400) { + stream.Connection.NtlmAuthenticated = true; + } + + // clear internal buffer so that it does not + // hold possible big buffer (bug #397627) + if (writeStream != null) + writeStream.KillBuffer (); + + return (response, false, false, writeBuffer, null); + } + + if (sendChunked) { + sendChunked = false; + webHeaders.RemoveInternal ("Transfer-Encoding"); + } + + bool isChallenge; + (ntlm, isChallenge) = HandleNtlmAuth (stream, response, writeBuffer, cancellationToken); + WebConnection.Debug ($"HWR REDIRECT: {ntlm} {isChallenge} {mustReadAll}"); + } + + return (response, true, mustReadAll, writeBuffer, ntlm); + } + + internal static Exception FlattenException (Exception e) + { + if (e is AggregateException ae) { + ae = ae.Flatten (); + if (ae.InnerExceptions.Count == 1) + return ae.InnerException; + } + + return e; + } + + WebException GetWebException (Exception e) + { + e = FlattenException (e); + if (e is WebException wexc) { + if (!Aborted || wexc.Status == WebExceptionStatus.RequestCanceled || wexc.Status == WebExceptionStatus.Timeout) + return wexc; + } + if (Aborted || e is OperationCanceledException || e is ObjectDisposedException) + return CreateRequestAbortedException (); + return new WebException (e.Message, e, WebExceptionStatus.UnknownError, null); + } + + internal static WebException CreateRequestAbortedException () + { + return new WebException (SR.Format (SR.net_reqaborted, WebExceptionStatus.RequestCanceled), WebExceptionStatus.RequestCanceled); + } + + public override IAsyncResult BeginGetResponse (AsyncCallback callback, object state) + { + if (Aborted) + throw CreateRequestAbortedException (); + + return TaskToApm.Begin (RunWithTimeout (MyGetResponseAsync), callback, state); } public override WebResponse EndGetResponse (IAsyncResult asyncResult) { if (asyncResult == null) - throw new ArgumentNullException ("asyncResult"); + throw new ArgumentNullException (nameof (asyncResult)); - WebAsyncResult result = asyncResult as WebAsyncResult; - if (result == null) - throw new ArgumentException ("Invalid IAsyncResult", "asyncResult"); - - if (!result.WaitUntilComplete (timeout, false)) { - Abort (); - throw new WebException("The request timed out", WebExceptionStatus.Timeout); + try { + return TaskToApm.End (asyncResult); + } catch (Exception e) { + throw FlattenException (e); } - - if (result.GotException) - throw result.Exception; - - return result.Response; } - + public Stream EndGetRequestStream (IAsyncResult asyncResult, out TransportContext context) { + if (asyncResult == null) + throw new ArgumentNullException (nameof (asyncResult)); + context = null; return EndGetRequestStream (asyncResult); } - public override WebResponse GetResponse() + public override WebResponse GetResponse () { - WebAsyncResult result = (WebAsyncResult) BeginGetResponse (null, null); - return EndGetResponse (result); + try { + return GetResponseAsync ().Result; + } catch (Exception e) { + throw FlattenException (e); + } } - + internal bool FinishedReading { get { return finished_reading; } set { finished_reading = value; } @@ -1059,90 +1213,36 @@ namespace System.Net if (Interlocked.CompareExchange (ref aborted, 1, 0) == 1) return; - if (haveResponse && finished_reading) - return; + WebConnection.Debug ($"HWR ABORT: Req={ID}"); haveResponse = true; - if (abortHandler != null) { - try { - abortHandler (this, EventArgs.Empty); - } catch (Exception) {} - abortHandler = null; - } + var operation = currentOperation; + if (operation != null) + operation.Abort (); - if (asyncWrite != null) { - WebAsyncResult r = asyncWrite; - if (!r.IsCompleted) { - try { - WebException wexc = new WebException ("Aborted.", WebExceptionStatus.RequestCanceled); - r.SetCompleted (false, wexc); - r.DoCallback (); - } catch {} - } - asyncWrite = null; - } - - if (asyncRead != null) { - WebAsyncResult r = asyncRead; - if (!r.IsCompleted) { - try { - WebException wexc = new WebException ("Aborted.", WebExceptionStatus.RequestCanceled); - r.SetCompleted (false, wexc); - r.DoCallback (); - } catch {} - } - asyncRead = null; - } - - if (writeStream != null) { - try { - writeStream.Close (); - writeStream = null; - } catch {} - } + responseTask?.TrySetCanceled (); if (webResponse != null) { try { webResponse.Close (); webResponse = null; - } catch {} + } catch { } } - } - + } + void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) { - GetObjectData (serializationInfo, streamingContext); + throw new SerializationException (); } protected override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext) { - SerializationInfo info = serializationInfo; - - info.AddValue ("requestUri", requestUri, typeof (Uri)); - info.AddValue ("actualUri", actualUri, typeof (Uri)); - info.AddValue ("allowAutoRedirect", allowAutoRedirect); - info.AddValue ("allowBuffering", allowBuffering); - info.AddValue ("certificates", certificates, typeof (X509CertificateCollection)); - info.AddValue ("connectionGroup", connectionGroup); - info.AddValue ("contentLength", contentLength); - info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection)); - info.AddValue ("keepAlive", keepAlive); - info.AddValue ("maxAutoRedirect", maxAutoRedirect); - info.AddValue ("mediaType", mediaType); - info.AddValue ("method", method); - info.AddValue ("initialMethod", initialMethod); - info.AddValue ("pipelined", pipelined); - info.AddValue ("version", version, typeof (Version)); - info.AddValue ("proxy", proxy, typeof (IWebProxy)); - info.AddValue ("sendChunked", sendChunked); - info.AddValue ("timeout", timeout); - info.AddValue ("redirects", redirects); - info.AddValue ("host", host); + throw new SerializationException (); } - - void CheckRequestStarted () + + void CheckRequestStarted () { if (requestSent) throw new InvalidOperationException ("request started"); @@ -1160,8 +1260,8 @@ namespace System.Net webHeaders.RemoveInternal ("Transfer-Encoding"); sendChunked = false; } - - bool Redirect (WebAsyncResult result, HttpStatusCode code, WebResponse response) + + bool Redirect (HttpStatusCode code, WebResponse response) { redirects++; Exception e = null; @@ -1187,12 +1287,13 @@ namespace System.Net break; case HttpStatusCode.Unused: // 306 default: - e = new ProtocolViolationException ("Invalid status code: " + (int) code); + e = new ProtocolViolationException ("Invalid status code: " + (int)code); break; } - if (method != "GET" && !InternalAllowBuffering && (writeStream.WriteBufferLength > 0 || contentLength > 0)) - e = new WebException ("The request requires buffering data to succeed.", null, WebExceptionStatus.ProtocolError, webResponse); + if (method != "GET" && !InternalAllowBuffering && ResendContentFactory == null && + (writeStream.WriteBufferLength > 0 || contentLength > 0)) + e = new WebException ("The request requires buffering data to succeed.", null, WebExceptionStatus.ProtocolError, response); if (e != null) throw e; @@ -1200,19 +1301,18 @@ namespace System.Net if (AllowWriteStreamBuffering || method == "GET") contentLength = -1; - uriString = webResponse.Headers ["Location"]; + uriString = response.Headers["Location"]; if (uriString == null) - throw new WebException ("No Location header found for " + (int) code, - WebExceptionStatus.ProtocolError); + throw new WebException ($"No Location header found for {(int)code}", null, + WebExceptionStatus.ProtocolError, response); Uri prev = actualUri; try { actualUri = new Uri (actualUri, uriString); } catch (Exception) { - throw new WebException (String.Format ("Invalid URL ({0}) for {1}", - uriString, (int) code), - WebExceptionStatus.ProtocolError); + throw new WebException ($"Invalid URL ({uriString}) for {(int)code}", + null, WebExceptionStatus.ProtocolError, response); } hostChanged = (actualUri.Scheme != prev.Scheme || Host != prev.Authority); @@ -1247,7 +1347,7 @@ namespace System.Net if (actualVersion == HttpVersion.Version11 && continue100 && servicePoint.SendContinue) { // RFC2616 8.2.3 - webHeaders.ChangeInternal ("Expect" , "100-continue"); + webHeaders.ChangeInternal ("Expect", "100-continue"); expectContinue = true; } else { webHeaders.RemoveInternal ("Expect"); @@ -1268,7 +1368,19 @@ namespace System.Net webHeaders.ChangeInternal (connectionHeader, "close"); } - webHeaders.SetInternal ("Host", Host); + string host; + if (hostUri != null) { + if (hostHasPort) + host = hostUri.GetComponents (UriComponents.HostAndPort, UriFormat.Unescaped); + else + host = hostUri.GetComponents (UriComponents.Host, UriFormat.Unescaped); + } else if (Address.IsDefaultPort) { + host = Address.GetComponents (UriComponents.Host, UriFormat.Unescaped); + } else { + host = Address.GetComponents (UriComponents.HostAndPort, UriFormat.Unescaped); + } + webHeaders.SetInternal ("Host", host); + if (cookieContainer != null) { string cookieHeader = cookieContainer.GetCookieHeader (actualUri); if (cookieHeader != "") @@ -1302,36 +1414,9 @@ namespace System.Net webHeaders.RemoveInternal ("Proxy-Authorization"); webHeaders.RemoveInternal ("Authorization"); string authHeader = (isProxy && credentials == null) ? "Proxy-Authorization" : "Authorization"; - webHeaders [authHeader] = auth.Message; + webHeaders[authHeader] = auth.Message; usedPreAuth = true; } - - internal void SetWriteStreamError (WebExceptionStatus status, Exception exc) - { - if (Aborted) - return; - - WebAsyncResult r = asyncWrite; - if (r == null) - r = asyncRead; - - if (r != null) { - string msg; - WebException wex; - if (exc == null) { - msg = "Error: " + status; - wex = new WebException (msg, status); - } else { - wex = exc as WebException; - if (wex == null) { - msg = String.Format ("Error: {0} ({1})", status, exc.Message); - wex = new WebException (msg, status, WebExceptionInternalStatus.RequestFatal, exc); - } - } - r.SetCompleted (false, wex); - r.DoCallback (); - } - } internal byte[] GetRequestHeaders () { @@ -1340,11 +1425,11 @@ namespace System.Net if (!ProxyQuery) { query = actualUri.PathAndQuery; } else { - query = String.Format ("{0}://{1}{2}", actualUri.Scheme, + query = String.Format ("{0}://{1}{2}", actualUri.Scheme, Host, actualUri.PathAndQuery); } - + if (!force_version && servicePoint.ProtocolVersion != null && servicePoint.ProtocolVersion < version) { actualVersion = servicePoint.ProtocolVersion; } else { @@ -1358,251 +1443,23 @@ namespace System.Net return Encoding.UTF8.GetBytes (reqstr); } - internal void SetWriteStream (WebConnectionStream stream) + (WebOperation, bool) HandleNtlmAuth (WebResponseStream stream, HttpWebResponse response, + BufferOffsetSize writeBuffer, CancellationToken cancellationToken) { - if (Aborted) - return; - - writeStream = stream; - if (bodyBuffer != null) { - webHeaders.RemoveInternal ("Transfer-Encoding"); - contentLength = bodyBufferLength; - writeStream.SendChunked = false; - } - - writeStream.SetHeadersAsync (false, result => { - if (result.GotException) { - SetWriteStreamError (result.Exception); - return; - } - - haveRequest = true; - - SetWriteStreamInner (inner => { - if (inner.GotException) { - SetWriteStreamError (inner.Exception); - return; - } - - if (asyncWrite != null) { - asyncWrite.SetCompleted (inner.CompletedSynchronouslyPeek, writeStream); - asyncWrite.DoCallback (); - asyncWrite = null; - } - }); - }); - } - - void SetWriteStreamInner (SimpleAsyncCallback callback) - { - SimpleAsyncResult.Run (result => { - if (bodyBuffer != null) { - // The body has been written and buffered. The request "user" - // won't write it again, so we must do it. - if (auth_state.NtlmAuthState != NtlmAuthState.Challenge && proxy_auth_state.NtlmAuthState != NtlmAuthState.Challenge) { - // FIXME: this is a blocking call on the thread pool that could lead to thread pool exhaustion - writeStream.Write (bodyBuffer, 0, bodyBufferLength); - bodyBuffer = null; - writeStream.Close (); - } - } else if (MethodWithBuffer) { - if (getResponseCalled && !writeStream.RequestWritten) - return writeStream.WriteRequestAsync (result); - } - - return false; - }, callback); - } - - void SetWriteStreamError (Exception exc) - { - WebException wexc = exc as WebException; - if (wexc != null) - SetWriteStreamError (wexc.Status, wexc); - else - SetWriteStreamError (WebExceptionStatus.SendFailure, exc); - } - - internal void SetResponseError (WebExceptionStatus status, Exception e, string where) - { - if (Aborted) - return; - lock (locker) { - string msg = String.Format ("Error getting response stream ({0}): {1}", where, status); - WebAsyncResult r = asyncRead; - if (r == null) - r = asyncWrite; - - WebException wexc; - if (e is WebException) { - wexc = (WebException) e; - } else { - wexc = new WebException (msg, e, status, null); - } - if (r != null) { - if (!r.IsCompleted) { - r.SetCompleted (false, wexc); - r.DoCallback (); - } else if (r == asyncWrite) { - saved_exc = wexc; - } - haveResponse = true; - asyncRead = null; - asyncWrite = null; - } else { - haveResponse = true; - saved_exc = wexc; - } - } - } - - void CheckSendError (WebConnectionData data) - { - // Got here, but no one called GetResponse - int status = data.StatusCode; - if (status < 400 || status == 401 || status == 407) - return; - - if (writeStream != null && asyncRead == null && !writeStream.CompleteRequestWritten) { - // The request has not been completely sent and we got here! - // We should probably just close and cause an error in any case, - saved_exc = new WebException (data.StatusDescription, null, WebExceptionStatus.ProtocolError, webResponse); - if (allowBuffering || sendChunked || writeStream.totalWritten >= contentLength) { - webResponse.ReadAll (); - } else { - writeStream.IgnoreIOErrors = true; - } - } - } - - bool HandleNtlmAuth (WebAsyncResult r) - { - bool isProxy = webResponse.StatusCode == HttpStatusCode.ProxyAuthenticationRequired; - if ((isProxy ? proxy_auth_state.NtlmAuthState : auth_state.NtlmAuthState) == NtlmAuthState.None) - return false; - - WebConnectionStream wce = webResponse.GetResponseStream () as WebConnectionStream; - if (wce != null) { - WebConnection cnc = wce.Connection; - cnc.PriorityRequest = this; - ICredentials creds = (!isProxy || proxy == null) ? credentials : proxy.Credentials; - if (creds != null) { - cnc.NtlmCredential = creds.GetCredential (requestUri, "NTLM"); - cnc.UnsafeAuthenticatedConnectionSharing = unsafe_auth_blah; - } - } - r.Reset (); - finished_reading = false; - haveResponse = false; - webResponse.ReadAll (); - webResponse = null; - return true; - } - - internal void SetResponseData (WebConnectionData data) - { - lock (locker) { - if (Aborted) { - if (data.stream != null) - data.stream.Close (); - return; - } - - WebException wexc = null; - try { - webResponse = new HttpWebResponse (actualUri, method, data, cookieContainer); - } catch (Exception e) { - wexc = new WebException (e.Message, e, WebExceptionStatus.ProtocolError, null); - if (data.stream != null) - data.stream.Close (); - } - - if (wexc == null && (method == "POST" || method == "PUT")) { - CheckSendError (data); - if (saved_exc != null) - wexc = (WebException) saved_exc; - } - - WebAsyncResult r = asyncRead; - - bool forced = false; - if (r == null && webResponse != null) { - // This is a forced completion (302, 204)... - forced = true; - r = new WebAsyncResult (null, null); - r.SetCompleted (false, webResponse); - } - - if (r != null) { - if (wexc != null) { - haveResponse = true; - if (!r.IsCompleted) - r.SetCompleted (false, wexc); - r.DoCallback (); - return; - } - - bool isProxy = ProxyQuery && proxy != null && !proxy.IsBypassed (actualUri); - - bool redirected; - try { - redirected = CheckFinalStatus (r); - if (!redirected) { - if ((isProxy ? proxy_auth_state.IsNtlmAuthenticated : auth_state.IsNtlmAuthenticated) && - webResponse != null && (int)webResponse.StatusCode < 400) { - WebConnectionStream wce = webResponse.GetResponseStream () as WebConnectionStream; - if (wce != null) { - WebConnection cnc = wce.Connection; - cnc.NtlmAuthenticated = true; - } - } - - // clear internal buffer so that it does not - // hold possible big buffer (bug #397627) - if (writeStream != null) - writeStream.KillBuffer (); - - haveResponse = true; - r.SetCompleted (false, webResponse); - r.DoCallback (); - } else { - if (sendChunked) { - sendChunked = false; - webHeaders.RemoveInternal ("Transfer-Encoding"); - } - - if (webResponse != null) { - if (HandleNtlmAuth (r)) - return; - webResponse.Close (); - } - finished_reading = false; - haveResponse = false; - webResponse = null; - r.Reset (); - servicePoint = GetServicePoint (); - abortHandler = servicePoint.SendRequest (this, connectionGroup); - } - } catch (WebException wexc2) { - if (forced) { - saved_exc = wexc2; - haveResponse = true; - } - r.SetCompleted (false, wexc2); - r.DoCallback (); - return; - } catch (Exception ex) { - wexc = new WebException (ex.Message, ex, WebExceptionStatus.ProtocolError, null); - if (forced) { - saved_exc = wexc; - haveResponse = true; - } - r.SetCompleted (false, wexc); - r.DoCallback (); - return; - } - } + bool isProxy = response.StatusCode == HttpStatusCode.ProxyAuthenticationRequired; + if ((isProxy ? proxy_auth_state : auth_state).NtlmAuthState == NtlmAuthState.None) + return (null, false); + + var isChallenge = auth_state.NtlmAuthState == NtlmAuthState.Challenge || proxy_auth_state.NtlmAuthState == NtlmAuthState.Challenge; + + var operation = new WebOperation (this, writeBuffer, isChallenge, cancellationToken); + stream.Operation.SetPriorityRequest (operation); + var creds = (!isProxy || proxy == null) ? credentials : proxy.Credentials; + if (creds != null) { + stream.Connection.NtlmCredential = creds.GetCredential (requestUri, "NTLM"); + stream.Connection.UnsafeAuthenticatedConnectionSharing = unsafe_auth_blah; } + return (operation, isChallenge); } struct AuthorizationState @@ -1645,7 +1502,7 @@ namespace System.Net if (isProxy && (request.proxy == null || request.proxy.Credentials == null)) return false; - string [] authHeaders = response.Headers.GetValues (isProxy ? "Proxy-Authenticate" : "WWW-Authenticate"); + string[] authHeaders = response.Headers.GetValues (isProxy ? "Proxy-Authenticate" : "WWW-Authenticate"); if (authHeaders == null || authHeaders.Length == 0) return false; @@ -1658,11 +1515,11 @@ namespace System.Net } if (auth == null) return false; - request.webHeaders [isProxy ? "Proxy-Authorization" : "Authorization"] = auth.Message; + request.webHeaders[isProxy ? "Proxy-Authorization" : "Authorization"] = auth.Message; isCompleted = auth.Complete; bool is_ntlm = (auth.ModuleAuthenticationType == "NTLM"); if (is_ntlm) - ntlm_auth_state = (NtlmAuthState)((int) ntlm_auth_state + 1); + ntlm_auth_state = (NtlmAuthState)((int)ntlm_auth_state + 1); return true; } @@ -1685,117 +1542,116 @@ namespace System.Net return isProxy ? proxy_auth_state.CheckAuthorization (response, code) : auth_state.CheckAuthorization (response, code); } - // Returns true if redirected - bool CheckFinalStatus (WebAsyncResult result) + (Task task, WebException throwMe) GetRewriteHandler (HttpWebResponse response, bool redirect) { - if (result.GotException) { - bodyBuffer = null; - throw result.Exception; + if (redirect) { + if (!MethodWithBuffer) + return (null, null); + + if (writeStream.WriteBufferLength == 0 || contentLength == 0) + return (null, null); } - Exception throwMe = result.Exception; + // Keep the written body, so it can be rewritten in the retry + if (AllowWriteStreamBuffering) + return (Task.FromResult (writeStream.GetWriteBuffer ()), null); - HttpWebResponse resp = result.Response; - WebExceptionStatus protoError = WebExceptionStatus.ProtocolError; + if (ResendContentFactory == null) + return (null, new WebException ( + "The request requires buffering data to succeed.", null, WebExceptionStatus.ProtocolError, response)); + + Func> handleResendContentFactory = async () => { + using (var ms = new MemoryStream ()) { + await ResendContentFactory (ms).ConfigureAwait (false); + var buffer = ms.ToArray (); + return new BufferOffsetSize (buffer, 0, buffer.Length, false); + } + }; + + // + // Buffering is not allowed but we have alternative way to get same content (we + // need to resent it due to NTLM Authentication). + // + return (handleResendContentFactory (), null); + } + + // Returns true if redirected + (bool redirect, bool mustReadAll, Task writeBuffer, WebException throwMe) CheckFinalStatus (HttpWebResponse response) + { + WebException throwMe = null; + + bool mustReadAll = false; HttpStatusCode code = 0; - if (throwMe == null && webResponse != null) { - code = webResponse.StatusCode; - if ((!auth_state.IsCompleted && code == HttpStatusCode.Unauthorized && credentials != null) || - (ProxyQuery && !proxy_auth_state.IsCompleted && code == HttpStatusCode.ProxyAuthenticationRequired)) { - if (!usedPreAuth && CheckAuthorization (webResponse, code)) { - // Keep the written body, so it can be rewritten in the retry - if (MethodWithBuffer) { - if (AllowWriteStreamBuffering) { - if (writeStream.WriteBufferLength > 0) { - bodyBuffer = writeStream.WriteBuffer; - bodyBufferLength = writeStream.WriteBufferLength; - } + Task rewriteHandler = null; - return true; - } + code = response.StatusCode; + if ((!auth_state.IsCompleted && code == HttpStatusCode.Unauthorized && credentials != null) || + (ProxyQuery && !proxy_auth_state.IsCompleted && code == HttpStatusCode.ProxyAuthenticationRequired)) { + if (!usedPreAuth && CheckAuthorization (response, code)) { + mustReadAll = true; - // - // Buffering is not allowed but we have alternative way to get same content (we - // need to resent it due to NTLM Authentication). - // - if (ResendContentFactory != null) { - using (var ms = new MemoryStream ()) { - ResendContentFactory (ms); - bodyBuffer = ms.ToArray (); - bodyBufferLength = bodyBuffer.Length; - } - return true; - } - } else if (method != "PUT" && method != "POST") { - bodyBuffer = null; - return true; - } + // HEAD, GET, MKCOL, CONNECT, TRACE + if (!MethodWithBuffer) + return (true, mustReadAll, null, null); - if (!ThrowOnError) - return false; - - writeStream.InternalClose (); - writeStream = null; - webResponse.Close (); - webResponse = null; - bodyBuffer = null; - - throw new WebException ("This request requires buffering " + - "of data for authentication or " + - "redirection to be sucessful."); - } - } + (rewriteHandler, throwMe) = GetRewriteHandler (response, false); + if (throwMe == null) + return (true, mustReadAll, rewriteHandler, null); - bodyBuffer = null; - if ((int) code >= 400) { - string err = String.Format ("The remote server returned an error: ({0}) {1}.", - (int) code, webResponse.StatusDescription); - throwMe = new WebException (err, null, protoError, webResponse); - webResponse.ReadAll (); - } else if ((int) code == 304 && allowAutoRedirect) { - string err = String.Format ("The remote server returned an error: ({0}) {1}.", - (int) code, webResponse.StatusDescription); - throwMe = new WebException (err, null, protoError, webResponse); - } else if ((int) code >= 300 && allowAutoRedirect && redirects >= maxAutoRedirect) { - throwMe = new WebException ("Max. redirections exceeded.", null, - protoError, webResponse); - webResponse.ReadAll (); + if (!ThrowOnError) + return (false, mustReadAll, null, null); + + writeStream.InternalClose (); + writeStream = null; + response.Close (); + + return (false, mustReadAll, null, throwMe); } } - bodyBuffer = null; + if ((int)code >= 400) { + string err = String.Format ("The remote server returned an error: ({0}) {1}.", + (int)code, response.StatusDescription); + throwMe = new WebException (err, null, WebExceptionStatus.ProtocolError, response); + mustReadAll = true; + } else if ((int)code == 304 && allowAutoRedirect) { + string err = String.Format ("The remote server returned an error: ({0}) {1}.", + (int)code, response.StatusDescription); + throwMe = new WebException (err, null, WebExceptionStatus.ProtocolError, response); + } else if ((int)code >= 300 && allowAutoRedirect && redirects >= maxAutoRedirect) { + throwMe = new WebException ("Max. redirections exceeded.", null, + WebExceptionStatus.ProtocolError, response); + mustReadAll = true; + } + if (throwMe == null) { + int c = (int)code; bool b = false; - int c = (int) code; if (allowAutoRedirect && c >= 300) { - b = Redirect (result, code, webResponse); - if (InternalAllowBuffering && writeStream.WriteBufferLength > 0) { - bodyBuffer = writeStream.WriteBuffer; - bodyBufferLength = writeStream.WriteBufferLength; - } + b = Redirect (code, response); + (rewriteHandler, throwMe) = GetRewriteHandler (response, true); if (b && !unsafe_auth_blah) { auth_state.Reset (); proxy_auth_state.Reset (); } } - if (resp != null && c >= 300 && c != 304) - resp.ReadAll (); + if (c >= 300 && c != 304) + mustReadAll = true; - return b; + if (throwMe == null) + return (b, mustReadAll, rewriteHandler, null); } - + if (!ThrowOnError) - return false; + return (false, mustReadAll, null, null); if (writeStream != null) { writeStream.InternalClose (); writeStream = null; } - webResponse = null; - - throw throwMe; + return (false, mustReadAll, null, throwMe); } internal bool ReuseConnection { @@ -1803,8 +1659,6 @@ namespace System.Net set; } - internal WebConnection StoredConnection; - #region referencesource internal static StringBuilder GenerateConnectionGroup(string connectionGroupName, bool unsafeConnectionGroup, bool isInternalGroup) { diff --git a/mcs/class/System/System.Net/HttpWebResponse.cs b/mcs/class/System/System.Net/HttpWebResponse.cs index 5a32084972..58003d5b3b 100644 --- a/mcs/class/System/System.Net/HttpWebResponse.cs +++ b/mcs/class/System/System.Net/HttpWebResponse.cs @@ -39,6 +39,8 @@ using System.IO; using System.IO.Compression; using System.Net.Sockets; using System.Runtime.Serialization; +using System.Threading; +using System.Threading.Tasks; using System.Text; namespace System.Net @@ -60,16 +62,28 @@ namespace System.Net Stream stream; // Constructors - - internal HttpWebResponse (Uri uri, string method, WebConnectionData data, CookieContainer container) + + internal HttpWebResponse (Uri uri, string method, HttpStatusCode status, WebHeaderCollection headers) { this.uri = uri; this.method = method; - webHeaders = data.Headers; - version = data.Version; - statusCode = (HttpStatusCode) data.StatusCode; - statusDescription = data.StatusDescription; - stream = data.stream; + this.statusCode = status; + this.statusDescription = HttpStatusDescription.Get (status); + this.webHeaders = headers; + version = HttpVersion.Version10; + contentLength = -1; + } + + internal HttpWebResponse (Uri uri, string method, WebResponseStream stream, CookieContainer container) + { + this.uri = uri; + this.method = method; + this.stream = stream; + + webHeaders = stream.Headers ?? new WebHeaderCollection (); + version = stream.Version; + statusCode = stream.StatusCode; + statusDescription = stream.StatusDescription ?? HttpStatusDescription.Get (statusCode); contentLength = -1; try { @@ -86,12 +100,12 @@ namespace System.Net } string content_encoding = webHeaders ["Content-Encoding"]; - if (content_encoding == "gzip" && (data.request.AutomaticDecompression & DecompressionMethods.GZip) != 0) { - stream = new GZipStream (stream, CompressionMode.Decompress); + if (content_encoding == "gzip" && (stream.Request.AutomaticDecompression & DecompressionMethods.GZip) != 0) { + this.stream = new GZipStream (stream, CompressionMode.Decompress); webHeaders.Remove (HttpRequestHeader.ContentEncoding); } - else if (content_encoding == "deflate" && (data.request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) { - stream = new DeflateStream (stream, CompressionMode.Decompress); + else if (content_encoding == "deflate" && (stream.Request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) { + this.stream = new DeflateStream (stream, CompressionMode.Decompress); webHeaders.Remove (HttpRequestHeader.ContentEncoding); } } @@ -154,6 +168,8 @@ namespace System.Net if (contentType == null) contentType = webHeaders ["Content-Type"]; + if (contentType == null) + contentType = string.Empty; return contentType; } @@ -263,17 +279,6 @@ namespace System.Net return (value != null) ? value : ""; } - internal void ReadAll () - { - WebConnectionStream wce = stream as WebConnectionStream; - if (wce == null) - return; - - try { - wce.ReadAll (); - } catch {} - } - public override Stream GetResponseStream () { CheckDisposed (); @@ -310,12 +315,9 @@ namespace System.Net public override void Close () { - if (stream != null) { - Stream st = stream; - stream = null; - if (st != null) - st.Close (); - } + var st = Interlocked.Exchange (ref stream, null); + if (st != null) + st.Close (); } void IDisposable.Dispose () diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs index 9b6cc5cc5e..f8eee86cac 100644 --- a/mcs/class/System/System.Net/ServicePoint.cs +++ b/mcs/class/System/System.Net/ServicePoint.cs @@ -38,20 +38,15 @@ using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; using System.Threading; -namespace System.Net +namespace System.Net { public class ServicePoint { readonly Uri uri; - int connectionLimit; - int maxIdleTime; - int currentConnections; - DateTime idleSince; DateTime lastDnsResolve; Version protocolVersion; IPHostEntry host; bool usesProxy; - Dictionary groups; bool sendContinue = true; bool useConnect; object hostE = new object (); @@ -60,21 +55,22 @@ namespace System.Net bool tcp_keepalive; int tcp_keepalive_time; int tcp_keepalive_interval; - Timer idleTimer; // Constructors internal ServicePoint (Uri uri, int connectionLimit, int maxIdleTime) { - this.uri = uri; - this.connectionLimit = connectionLimit; - this.maxIdleTime = maxIdleTime; - this.currentConnections = 0; - this.idleSince = DateTime.UtcNow; + this.uri = uri; + + Scheduler = new ServicePointScheduler (this, connectionLimit, maxIdleTime); } - + + internal ServicePointScheduler Scheduler { + get; + } + // Properties - + public Uri Address { get { return uri; } } @@ -84,15 +80,13 @@ namespace System.Net return new NotImplementedException (); } - public BindIPEndPoint BindIPEndPointDelegate - { + public BindIPEndPoint BindIPEndPointDelegate { get { return endPointCallback; } set { endPointCallback = value; } } - + [MonoTODO] - public int ConnectionLeaseTimeout - { + public int ConnectionLeaseTimeout { get { throw GetMustImplement (); } @@ -100,54 +94,39 @@ namespace System.Net throw GetMustImplement (); } } - - public int ConnectionLimit { - get { return connectionLimit; } - set { - if (value <= 0) - throw new ArgumentOutOfRangeException (); - connectionLimit = value; - } + public int ConnectionLimit { + get { return Scheduler.ConnectionLimit; } + set { Scheduler.ConnectionLimit = value; } } - + public string ConnectionName { get { return uri.Scheme; } } public int CurrentConnections { get { - return currentConnections; + return Scheduler.CurrentConnections; } } public DateTime IdleSince { get { - return idleSince.ToLocalTime (); + return Scheduler.IdleSince.ToLocalTime (); } } public int MaxIdleTime { - get { return maxIdleTime; } - set { - if (value < Timeout.Infinite || value > Int32.MaxValue) - throw new ArgumentOutOfRangeException (); - - lock (this) { - maxIdleTime = value; - if (idleTimer != null) - idleTimer.Change (maxIdleTime, maxIdleTime); - } - } + get { return Scheduler.MaxIdleTime; } + set { Scheduler.MaxIdleTime = value; } } - + public virtual Version ProtocolVersion { get { return protocolVersion; } } [MonoTODO] - public int ReceiveBufferSize - { + public int ReceiveBufferSize { get { throw GetMustImplement (); } @@ -155,7 +134,7 @@ namespace System.Net throw GetMustImplement (); } } - + public bool SupportsPipelining { get { return HttpVersion.Version11.Equals (protocolVersion); } } @@ -172,8 +151,10 @@ namespace System.Net } internal bool SendContinue { - get { return sendContinue && - (protocolVersion == null || protocolVersion == HttpVersion.Version11); } + get { + return sendContinue && + (protocolVersion == null || protocolVersion == HttpVersion.Version11); + } set { sendContinue = value; } } // Methods @@ -197,25 +178,25 @@ namespace System.Net if (!tcp_keepalive) return; - byte [] bytes = new byte [12]; - PutBytes (bytes, (uint) (tcp_keepalive ? 1 : 0), 0); - PutBytes (bytes, (uint) tcp_keepalive_time, 4); - PutBytes (bytes, (uint) tcp_keepalive_interval, 8); + byte[] bytes = new byte[12]; + PutBytes (bytes, (uint)(tcp_keepalive ? 1 : 0), 0); + PutBytes (bytes, (uint)tcp_keepalive_time, 4); + PutBytes (bytes, (uint)tcp_keepalive_interval, 8); socket.IOControl (IOControlCode.KeepAliveValues, bytes, null); } - static void PutBytes (byte [] bytes, uint v, int offset) + static void PutBytes (byte[] bytes, uint v, int offset) { if (BitConverter.IsLittleEndian) { - bytes [offset] = (byte) (v & 0x000000ff); - bytes [offset + 1] = (byte) ((v & 0x0000ff00) >> 8); - bytes [offset + 2] = (byte) ((v & 0x00ff0000) >> 16); - bytes [offset + 3] = (byte) ((v & 0xff000000) >> 24); + bytes[offset] = (byte)(v & 0x000000ff); + bytes[offset + 1] = (byte)((v & 0x0000ff00) >> 8); + bytes[offset + 2] = (byte)((v & 0x00ff0000) >> 16); + bytes[offset + 3] = (byte)((v & 0xff000000) >> 24); } else { - bytes [offset + 3] = (byte) (v & 0x000000ff); - bytes [offset + 2] = (byte) ((v & 0x0000ff00) >> 8); - bytes [offset + 1] = (byte) ((v & 0x00ff0000) >> 16); - bytes [offset] = (byte) ((v & 0xff000000) >> 24); + bytes[offset + 3] = (byte)(v & 0x000000ff); + bytes[offset + 2] = (byte)((v & 0x0000ff00) >> 8); + bytes[offset + 1] = (byte)((v & 0x00ff0000) >> 16); + bytes[offset] = (byte)((v & 0xff000000) >> 24); } } @@ -231,107 +212,7 @@ namespace System.Net set { useConnect = value; } } - WebConnectionGroup GetConnectionGroup (string name) - { - if (name == null) - name = ""; - - /* - * Optimization: - * - * In the vast majority of cases, we only have one single WebConnectionGroup per ServicePoint, so we - * don't need to allocate a dictionary. - * - */ - - WebConnectionGroup group; - if (groups != null && groups.TryGetValue (name, out group)) - return group; - - group = new WebConnectionGroup (this, name); - group.ConnectionClosed += (s, e) => currentConnections--; - - if (groups == null) - groups = new Dictionary (); - groups.Add (name, group); - - return group; - } - - void RemoveConnectionGroup (WebConnectionGroup group) - { - if (groups == null || groups.Count == 0) - throw new InvalidOperationException (); - - groups.Remove (group.Name); - } - - bool CheckAvailableForRecycling (out DateTime outIdleSince) - { - outIdleSince = DateTime.MinValue; - - TimeSpan idleTimeSpan; - List groupList = null, removeList = null; - lock (this) { - if (groups == null || groups.Count == 0) { - idleSince = DateTime.MinValue; - return true; - } - - idleTimeSpan = TimeSpan.FromMilliseconds (maxIdleTime); - - /* - * WebConnectionGroup.TryRecycle() must run outside the lock, so we need to - * copy the group dictionary if it exists. - * - * In most cases, we only have a single connection group, so we can simply store - * that in a local variable instead of copying a collection. - * - */ - - groupList = new List (groups.Values); - } - - foreach (var group in groupList) { - if (!group.TryRecycle (idleTimeSpan, ref outIdleSince)) - continue; - if (removeList == null) - removeList = new List (); - removeList.Add (group); - } - - lock (this) { - idleSince = outIdleSince; - - if (removeList != null && groups != null) { - foreach (var group in removeList) - if (groups.ContainsKey (group.Name)) - RemoveConnectionGroup (group); - } - - if (groups != null && groups.Count == 0) - groups = null; - - if (groups == null) { - if (idleTimer != null) { - idleTimer.Dispose (); - idleTimer = null; - } - return true; - } - - return false; - } - } - - void IdleTimerCallback (object obj) - { - DateTime dummy; - CheckAvailableForRecycling (out dummy); - } - - private bool HasTimedOut - { + private bool HasTimedOut { get { int timeout = ServicePointManager.DnsRefreshTimeout; return timeout != Timeout.Infinite && @@ -339,8 +220,7 @@ namespace System.Net } } - internal IPHostEntry HostEntry - { + internal IPHostEntry HostEntry { get { lock (hostE) { string uriHost = uri.Host; @@ -356,7 +236,7 @@ namespace System.Net } // Creates IPHostEntry - host = new IPHostEntry(); + host = new IPHostEntry (); host.AddressList = new IPAddress[] { IPAddress.Parse (uriHost) }; return host; } @@ -382,41 +262,18 @@ namespace System.Net protocolVersion = version; } - internal EventHandler SendRequest (HttpWebRequest request, string groupName) + internal void SendRequest (WebOperation operation, string groupName) { - WebConnection cnc; - lock (this) { - bool created; - WebConnectionGroup cncGroup = GetConnectionGroup (groupName); - cnc = cncGroup.GetConnection (request, out created); - if (created) { - ++currentConnections; - if (idleTimer == null) - idleTimer = new Timer (IdleTimerCallback, null, maxIdleTime, maxIdleTime); - } + Scheduler.SendRequest (operation, groupName); } - - return cnc.SendRequest (request); } + public bool CloseConnectionGroup (string connectionGroupName) { - WebConnectionGroup cncGroup = null; - lock (this) { - cncGroup = GetConnectionGroup (connectionGroupName); - if (cncGroup != null) { - RemoveConnectionGroup (cncGroup); - } + return Scheduler.CloseConnectionGroup (connectionGroupName); } - - // WebConnectionGroup.Close() must *not* be called inside the lock - if (cncGroup != null) { - cncGroup.Close (); - return true; - } - - return false; } // diff --git a/mcs/class/System/System.Net/ServicePointScheduler.cs b/mcs/class/System/System.Net/ServicePointScheduler.cs new file mode 100644 index 0000000000..621614458b --- /dev/null +++ b/mcs/class/System/System.Net/ServicePointScheduler.cs @@ -0,0 +1,646 @@ +// +// ServicePointScheduler.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2017 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.IO; +using System.Collections; +using System.Collections.Generic; +using System.Net.Sockets; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; +using System.Diagnostics; + +namespace System.Net +{ + class ServicePointScheduler + { + public ServicePoint ServicePoint { + get; + } + + public int MaxIdleTime { + get { return maxIdleTime; } + set { + if (value < Timeout.Infinite || value > Int32.MaxValue) + throw new ArgumentOutOfRangeException (); + if (value == maxIdleTime) + return; + maxIdleTime = value; + Debug ($"MAX IDLE TIME = {value}"); + Run (); + } + } + + public int ConnectionLimit { + get { return connectionLimit; } + set { + if (value <= 0) + throw new ArgumentOutOfRangeException (); + + if (value == connectionLimit) + return; + connectionLimit = value; + Debug ($"CONNECTION LIMIT = {value}"); + Run (); + } + } + + public ServicePointScheduler (ServicePoint servicePoint, int connectionLimit, int maxIdleTime) + { + ServicePoint = servicePoint; + this.connectionLimit = connectionLimit; + this.maxIdleTime = maxIdleTime; + + schedulerEvent = new AsyncManualResetEvent (false); + defaultGroup = new ConnectionGroup (this, string.Empty); + operations = new LinkedList<(ConnectionGroup, WebOperation)> (); + idleConnections = new LinkedList<(ConnectionGroup, WebConnection, Task)> (); + idleSince = DateTime.UtcNow; + } + + [Conditional ("MONO_WEB_DEBUG")] + void Debug (string message, params object[] args) + { + WebConnection.Debug ($"SPS({ID}): {string.Format (message, args)}"); + } + + [Conditional ("MONO_WEB_DEBUG")] + void Debug (string message) + { + WebConnection.Debug ($"SPS({ID}): {message}"); + } + + int running; + int maxIdleTime = 100000; + AsyncManualResetEvent schedulerEvent; + ConnectionGroup defaultGroup; + Dictionary groups; + LinkedList<(ConnectionGroup, WebOperation)> operations; + LinkedList<(ConnectionGroup, WebConnection, Task)> idleConnections; + int currentConnections; + int connectionLimit; + DateTime idleSince; + + public int CurrentConnections { + get { + return currentConnections; + } + } + + public DateTime IdleSince { + get { + return idleSince; + } + } + + static int nextId; + public readonly int ID = ++nextId; + + internal string ME { + get; + } + + public void Run () + { + lock (ServicePoint) { + if (Interlocked.CompareExchange (ref running, 1, 0) == 0) + StartScheduler (); + + schedulerEvent.Set (); + } + } + + async void StartScheduler () + { + idleSince = DateTime.UtcNow + TimeSpan.FromDays (3650); + + while (true) { + Debug ($"MAIN LOOP"); + + // Gather list of currently running operations. + ValueTuple[] operationArray; + ValueTuple[] idleArray; + var taskList = new List (); + lock (ServicePoint) { + Cleanup (); + if (groups == null && defaultGroup.IsEmpty () && operations.Count == 0 && idleConnections.Count == 0) { + Debug ($"MAIN LOOP DONE"); + running = 0; + idleSince = DateTime.UtcNow; + schedulerEvent.Reset (); + return; + } + + operationArray = new ValueTuple[operations.Count]; + operations.CopyTo (operationArray, 0); + idleArray = new ValueTuple[idleConnections.Count]; + idleConnections.CopyTo (idleArray, 0); + + taskList.Add (schedulerEvent.WaitAsync (maxIdleTime)); + foreach (var item in operationArray) + taskList.Add (item.Item2.Finished.Task); + foreach (var item in idleArray) + taskList.Add (item.Item3); + } + + Debug ($"MAIN LOOP #1: operations={operationArray.Length} idle={idleArray.Length}"); + + var ret = await Task.WhenAny (taskList).ConfigureAwait (false); + + lock (ServicePoint) { + bool runMaster = false; + if (ret == taskList[0]) + runMaster = true; + + /* + * We discard the `taskList` at this point as it is only used to wake us up. + * + * The `WebCompletionSource` assigns its `CurrentResult` property prior + * to completing the `Task` instance, so whenever a task is finished we will + * also get a non-null `CurrentResult`. + * + */ + for (int i = 0; i < operationArray.Length; i++) { + var item = operationArray[i]; + var result = item.Item2.Finished.CurrentResult; + if (result == null) + continue; + + Debug ($"MAIN LOOP #2: {i} group={item.Item1.ID} Op={item.Item2.ID} Status={result.Status}"); + operations.Remove (item); + + var runLoop = OperationCompleted (item.Item1, item.Item2); + Debug ($"MAIN LOOP #2 DONE: {i} {runLoop}"); + runMaster |= runLoop; + } + + /* + * This needs to be called after we deal with pending completions to + * ensure that connections are properly recognized as being idle. + * + */ + Debug ($"MAIN LOOP #3: runMaster={runMaster}"); + if (runMaster) + RunSchedulerIteration (); + + int idx = -1; + for (int i = 0; i < idleArray.Length; i++) { + if (ret == taskList[i + 1 + operationArray.Length]) { + idx = i; + break; + } + } + + if (idx >= 0) { + var item = idleArray[idx]; + Debug ($"MAIN LOOP #4: {idx} group={item.Item1.ID} Cnc={item.Item2.ID}"); + idleConnections.Remove (item); + CloseIdleConnection (item.Item1, item.Item2); + } + } + } + } + + void Cleanup () + { + if (groups != null) { + var keys = new string[groups.Count]; + groups.Keys.CopyTo (keys, 0); + foreach (var groupName in keys) { + if (!groups.ContainsKey (groupName)) + continue; + var group = groups[groupName]; + if (group.IsEmpty ()) { + Debug ($"CLEANUP - REMOVING group={group.ID}"); + groups.Remove (groupName); + } + } + if (groups.Count == 0) + groups = null; + } + } + + void RunSchedulerIteration () + { + schedulerEvent.Reset (); + + bool repeat; + do { + Debug ($"ITERATION"); + + repeat = SchedulerIteration (defaultGroup); + + Debug ($"ITERATION #1: {repeat} {groups != null}"); + + if (groups != null) { + foreach (var group in groups) { + Debug ($"ITERATION #2: group={group.Value.ID}"); + repeat |= SchedulerIteration (group.Value); + } + } + + Debug ($"ITERATION #3: {repeat}"); + } while (repeat); + } + + bool OperationCompleted (ConnectionGroup group, WebOperation operation) + { +#if MONO_WEB_DEBUG + var me = $"{nameof (OperationCompleted)}(group={group.ID}, Op={operation.ID}, Cnc={operation.Connection.ID})"; +#else + string me = null; +#endif + + var result = operation.Finished.CurrentResult; + var (ok, next) = result.Success ? result.Argument : (false, null); + + Debug ($"{me}: {operation.Finished.CurrentStatus} {ok} {next?.ID}"); + + if (!ok || !operation.Connection.Continue (next)) { + group.RemoveConnection (operation.Connection); + if (next == null) { + Debug ($"{me}: closed connection and done."); + return true; + } + ok = false; + } + + if (next == null) { + if (ok) { + var idleTask = Task.Delay (MaxIdleTime); + idleConnections.AddLast ((group, operation.Connection, idleTask)); + Debug ($"{me} keeping connection open for {MaxIdleTime} milliseconds."); + } else { + Debug ($"{me}: closed connection and done."); + } + return true; + } + + Debug ($"{me} got new operation next={next.ID}."); + operations.AddLast ((group, next)); + + if (ok) { + Debug ($"{me} continuing next={next.ID} on same connection."); + RemoveIdleConnection (operation.Connection); + return false; + } + + group.Cleanup (); + + var (connection, created) = group.CreateOrReuseConnection (next, true); + Debug ($"{me} created new connection Cnc={connection.ID} next={next.ID}."); + return false; + } + + void CloseIdleConnection (ConnectionGroup group, WebConnection connection) + { + Debug ($"{nameof (CloseIdleConnection)}(group={group.ID}, Cnc={connection.ID}) closing idle connection."); + + group.RemoveConnection (connection); + RemoveIdleConnection (connection); + } + + bool SchedulerIteration (ConnectionGroup group) + { +#if MONO_WEB_DEBUG + var me = $"{nameof (SchedulerIteration)}(group={group.ID})"; +#else + string me = null; +#endif + Debug ($"{me}"); + + // First, let's clean up. + group.Cleanup (); + + // Is there anything in the queue? + var next = group.GetNextOperation (); + Debug ($"{me} no pending operations."); + if (next == null) + return false; + + Debug ($"{me} found pending operation Op={next.ID}"); + + var (connection, created) = group.CreateOrReuseConnection (next, false); + if (connection == null) { + // All connections are currently busy, need to keep it in the queue for now. + Debug ($"{me} all connections busy, keeping operation in queue."); + return false; + } + + Debug ($"{me} started operation: Op={next.ID} Cnc={connection.ID}"); + operations.AddLast ((group, next)); + RemoveIdleConnection (connection); + return true; + } + + void RemoveOperation (WebOperation operation) + { + var iter = operations.First; + while (iter != null) { + var node = iter; + iter = iter.Next; + + if (node.Value.Item2 == operation) + operations.Remove (node); + } + } + + void RemoveIdleConnection (WebConnection connection) + { + var iter = idleConnections.First; + while (iter != null) { + var node = iter; + iter = iter.Next; + + if (node.Value.Item2 == connection) + idleConnections.Remove (node); + } + } + + public void SendRequest (WebOperation operation, string groupName) + { + lock (ServicePoint) { + var group = GetConnectionGroup (groupName); + Debug ($"SEND REQUEST: Op={operation.ID} group={group.ID}"); + group.EnqueueOperation (operation); + Run (); + Debug ($"SEND REQUEST DONE: Op={operation.ID} group={group.ID}"); + } + } + + public bool CloseConnectionGroup (string groupName) + { + lock (ServicePoint) { + ConnectionGroup group; + if (string.IsNullOrEmpty (groupName)) + group = defaultGroup; + else if (groups == null || !groups.TryGetValue (groupName, out group)) + return false; + + Debug ($"CLOSE CONNECTION GROUP: group={group.ID}"); + + if (group != defaultGroup) { + groups.Remove (groupName); + if (groups.Count == 0) + groups = null; + } + + group.Close (); + Run (); + return true; + } + } + + ConnectionGroup GetConnectionGroup (string name) + { + lock (ServicePoint) { + if (string.IsNullOrEmpty (name)) + return defaultGroup; + + if (groups == null) + groups = new Dictionary (); + + if (groups.TryGetValue (name, out ConnectionGroup group)) + return group; + + group = new ConnectionGroup (this, name); + groups.Add (name, group); + return group; + } + } + + void OnConnectionCreated (WebConnection connection) + { + Interlocked.Increment (ref currentConnections); + } + + void OnConnectionClosed (WebConnection connection) + { + RemoveIdleConnection (connection); + Interlocked.Decrement (ref currentConnections); + } + + public static async Task WaitAsync (Task workerTask, int millisecondTimeout) + { + var cts = new CancellationTokenSource (); + try { + var timeoutTask = Task.Delay (millisecondTimeout, cts.Token); + var ret = await Task.WhenAny (workerTask, timeoutTask).ConfigureAwait (false); + return ret != timeoutTask; + } finally { + cts.Cancel (); + cts.Dispose (); + } + } + + class ConnectionGroup + { + public ServicePointScheduler Scheduler { + get; + } + + public string Name { + get; + } + + public bool IsDefault => string.IsNullOrEmpty (Name); + + static int nextId; + public readonly int ID = ++nextId; + LinkedList connections; + LinkedList queue; + + public ConnectionGroup (ServicePointScheduler scheduler, string name) + { + Scheduler = scheduler; + Name = name; + + connections = new LinkedList (); + queue = new LinkedList (); + } + + public bool IsEmpty () + { + return connections.Count == 0 && queue.Count == 0; + } + + public void RemoveConnection (WebConnection connection) + { + Scheduler.Debug ($"REMOVING CONNECTION: group={ID} cnc={connection.ID}"); + connections.Remove (connection); + connection.Dispose (); + Scheduler.OnConnectionClosed (connection); + } + + public void Cleanup () + { + var iter = connections.First; + while (iter != null) { + var connection = iter.Value; + var node = iter; + iter = iter.Next; + + if (connection.Closed) { + Scheduler.Debug ($"REMOVING CONNECTION: group={ID} cnc={connection.ID}"); + connections.Remove (node); + Scheduler.OnConnectionClosed (connection); + } + } + } + + public void Close () + { + foreach (var operation in queue) { + operation.Abort (); + Scheduler.RemoveOperation (operation); + } + queue.Clear (); + + foreach (var connection in connections) { + connection.Dispose (); + Scheduler.OnConnectionClosed (connection); + } + connections.Clear (); + } + + public void EnqueueOperation (WebOperation operation) + { + queue.AddLast (operation); + } + + public WebOperation GetNextOperation () + { + // Is there anything in the queue? + var iter = queue.First; + while (iter != null) { + var operation = iter.Value; + var node = iter; + iter = iter.Next; + + if (operation.Aborted) { + queue.Remove (node); + Scheduler.RemoveOperation (operation); + continue; + } + + return operation; + } + + return null; + } + + public WebConnection FindIdleConnection (WebOperation operation) + { + // First let's find the ideal candidate. + WebConnection candidate = null; + foreach (var connection in connections) { + if (connection.CanReuseConnection (operation)) { + if (candidate == null || connection.IdleSince > candidate.IdleSince) + candidate = connection; + } + } + + // Found one? Make sure it's actually willing to run it. + if (candidate != null && candidate.StartOperation (operation, true)) { + queue.Remove (operation); + return candidate; + } + + // Ok, let's loop again and pick the first one that accepts the new operation. + foreach (var connection in connections) { + if (connection.StartOperation (operation, true)) { + queue.Remove (operation); + return connection; + } + } + + return null; + } + + public (WebConnection connection, bool created) CreateOrReuseConnection (WebOperation operation, bool force) + { + Scheduler.Debug ($"CREATE OR REUSE: group={ID} OP={operation.ID} force={force}"); + var connection = FindIdleConnection (operation); + Scheduler.Debug ($"CREATE OR REUSE #1: group={ID} OP={operation.ID} force={force} - connection={connection?.ID}"); + if (connection != null) + return (connection, false); + + if (force || Scheduler.ServicePoint.ConnectionLimit > connections.Count || connections.Count == 0) { + connection = new WebConnection (Scheduler.ServicePoint); + connection.StartOperation (operation, false); + connections.AddFirst (connection); + Scheduler.OnConnectionCreated (connection); + queue.Remove (operation); + return (connection, true); + } + + return (null, false); + } + } + + // https://blogs.msdn.microsoft.com/pfxteam/2012/02/11/building-async-coordination-primitives-part-1-asyncmanualresetevent/ + class AsyncManualResetEvent + { + volatile TaskCompletionSource m_tcs = new TaskCompletionSource (); + + public Task WaitAsync () { return m_tcs.Task; } + + public bool WaitOne (int millisecondTimeout) + { + WebConnection.Debug ($"AMRE WAIT ONE: {millisecondTimeout}"); + return m_tcs.Task.Wait (millisecondTimeout); + } + + public Task WaitAsync (int millisecondTimeout) + { + return ServicePointScheduler.WaitAsync (m_tcs.Task, millisecondTimeout); + } + + public void Set () + { + var tcs = m_tcs; + Task.Factory.StartNew (s => ((TaskCompletionSource)s).TrySetResult (true), + tcs, CancellationToken.None, TaskCreationOptions.PreferFairness, TaskScheduler.Default); + tcs.Task.Wait (); + } + + public void Reset () + { + while (true) { + var tcs = m_tcs; + if (!tcs.Task.IsCompleted || + Interlocked.CompareExchange (ref m_tcs, new TaskCompletionSource (), tcs) == tcs) + return; + } + } + + public AsyncManualResetEvent (bool state) + { + if (state) + Set (); + } + } + } +} diff --git a/mcs/class/System/System.Net/SimpleAsyncResult.cs b/mcs/class/System/System.Net/SimpleAsyncResult.cs deleted file mode 100644 index 6a2107c977..0000000000 --- a/mcs/class/System/System.Net/SimpleAsyncResult.cs +++ /dev/null @@ -1,232 +0,0 @@ -// -// SimpleAsyncResult.cs -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// Martin Baulig (martin.baulig@xamarin.com) -// -// (C) 2003 Ximian, Inc (http://www.ximian.com) -// Copyright (c) 2014 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.IO; -using System.Threading; - -namespace System.Net -{ - delegate void SimpleAsyncCallback (SimpleAsyncResult result); - - class SimpleAsyncResult : IAsyncResult - { - ManualResetEvent handle; - bool synch; - bool isCompleted; - readonly SimpleAsyncCallback cb; - object state; - bool callbackDone; - Exception exc; - object locker = new object (); - - SimpleAsyncResult (SimpleAsyncCallback cb) - { - this.cb = cb; - } - - protected SimpleAsyncResult (AsyncCallback cb, object state) - { - this.state = state; - this.cb = result => { - if (cb != null) - cb (this); - }; - } - - public static void Run (Func func, SimpleAsyncCallback callback) - { - var result = new SimpleAsyncResult (callback); - try { - if (!func (result)) - result.SetCompleted (true); - } catch (Exception ex) { - result.SetCompleted (true, ex); - } - } - - public static void RunWithLock (object locker, Func func, SimpleAsyncCallback callback) - { - Run (inner => { - bool running = func (inner); - if (running) - Monitor.Exit (locker); - return running; - }, inner => { - if (inner.GotException) { - if (inner.synch) - Monitor.Exit (locker); - callback (inner); - return; - } - - try { - if (!inner.synch) - Monitor.Enter (locker); - - callback (inner); - } finally { - Monitor.Exit (locker); - } - }); - } - - protected void Reset_internal () - { - callbackDone = false; - exc = null; - lock (locker) { - isCompleted = false; - if (handle != null) - handle.Reset (); - } - } - - internal void SetCompleted (bool synch, Exception e) - { - SetCompleted_internal (synch, e); - DoCallback_private (); - } - - internal void SetCompleted (bool synch) - { - SetCompleted_internal (synch); - DoCallback_private (); - } - - void SetCompleted_internal (bool synch, Exception e) - { - this.synch = synch; - exc = e; - lock (locker) { - isCompleted = true; - if (handle != null) - handle.Set (); - } - } - - protected void SetCompleted_internal (bool synch) - { - SetCompleted_internal (synch, null); - } - - void DoCallback_private () - { - if (callbackDone) - return; - callbackDone = true; - if (cb == null) - return; - cb (this); - } - - protected void DoCallback_internal () - { - if (!callbackDone && cb != null) { - callbackDone = true; - cb (this); - } - } - - internal void WaitUntilComplete () - { - if (IsCompleted) - return; - - AsyncWaitHandle.WaitOne (); - } - - internal bool WaitUntilComplete (int timeout, bool exitContext) - { - if (IsCompleted) - return true; - - return AsyncWaitHandle.WaitOne (timeout, exitContext); - } - - public object AsyncState { - get { return state; } - } - - public WaitHandle AsyncWaitHandle { - get { - lock (locker) { - if (handle == null) - handle = new ManualResetEvent (isCompleted); - } - - return handle; - } - } - - bool? user_read_synch; - - public bool CompletedSynchronously { - get { - // - // CompletedSynchronously (for System.Net networking stack) means "was the operation completed before the first time - // that somebody asked if it was completed synchronously"? They do this because some of their asynchronous operations - // (particularly those in the Socket class) will avoid the cost of capturing and transferring the ExecutionContext - // to the callback thread by checking CompletedSynchronously, and calling the callback from within BeginXxx instead of - // on the completion port thread if the native winsock call completes quickly. - // - // TODO: racy - if (user_read_synch != null) - return user_read_synch.Value; - - user_read_synch = synch; - return user_read_synch.Value; - } - } - - internal bool CompletedSynchronouslyPeek { - get { - return synch; - } - } - - public bool IsCompleted { - get { - lock (locker) { - return isCompleted; - } - } - } - - internal bool GotException { - get { return (exc != null); } - } - - internal Exception Exception { - get { return exc; } - } - } -} - diff --git a/mcs/class/System/System.Net/WebAsyncResult.cs b/mcs/class/System/System.Net/WebAsyncResult.cs deleted file mode 100644 index 52fc1a5967..0000000000 --- a/mcs/class/System/System.Net/WebAsyncResult.cs +++ /dev/null @@ -1,132 +0,0 @@ -// -// System.Net.WebAsyncResult -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// -// (C) 2003 Ximian, Inc (http://www.ximian.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.IO; -using System.Threading; - -namespace System.Net -{ - class WebAsyncResult : SimpleAsyncResult - { - int nbytes; - IAsyncResult innerAsyncResult; - HttpWebResponse response; - Stream writeStream; - byte [] buffer; - int offset; - int size; - public bool EndCalled; - public bool AsyncWriteAll; - public HttpWebRequest AsyncObject; - - public WebAsyncResult (AsyncCallback cb, object state) - : base (cb, state) - { - } - - public WebAsyncResult (HttpWebRequest request, AsyncCallback cb, object state) - : base (cb, state) - { - this.AsyncObject = request; - } - - public WebAsyncResult (AsyncCallback cb, object state, byte [] buffer, int offset, int size) - : base (cb, state) - { - this.buffer = buffer; - this.offset = offset; - this.size = size; - } - - internal void Reset () - { - this.nbytes = 0; - this.response = null; - this.buffer = null; - this.offset = 0; - this.size = 0; - Reset_internal (); - } - - internal void SetCompleted (bool synch, int nbytes) - { - this.nbytes = nbytes; - SetCompleted_internal (synch); - } - - internal void SetCompleted (bool synch, Stream writeStream) - { - this.writeStream = writeStream; - SetCompleted_internal (synch); - } - - internal void SetCompleted (bool synch, HttpWebResponse response) - { - this.response = response; - SetCompleted_internal (synch); - } - - internal void DoCallback () - { - DoCallback_internal (); - } - - internal int NBytes { - get { return nbytes; } - set { nbytes = value; } - } - - internal IAsyncResult InnerAsyncResult { - get { return innerAsyncResult; } - set { innerAsyncResult = value; } - } - - internal Stream WriteStream { - get { return writeStream; } - } - - internal HttpWebResponse Response { - get { return response; } - } - - internal byte [] Buffer { - get { return buffer; } - } - - internal int Offset { - get { return offset; } - } - - internal int Size { - get { return size; } - } - } -} - diff --git a/mcs/class/System/System.Net/WebCompletionSource.cs b/mcs/class/System/System.Net/WebCompletionSource.cs new file mode 100644 index 0000000000..4805dac6fe --- /dev/null +++ b/mcs/class/System/System.Net/WebCompletionSource.cs @@ -0,0 +1,155 @@ +// +// WebCompletionSource.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; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; + +namespace System.Net +{ + class WebCompletionSource + { + TaskCompletionSource completion; + Result currentResult; + + public WebCompletionSource (bool runAsync = true) + { + completion = new TaskCompletionSource ( + runAsync ? + TaskCreationOptions.RunContinuationsAsynchronously : + TaskCreationOptions.None); + } + + /* + * Provide a non-blocking way of getting the current status. + * + * We are using `TaskCreationOptions.RunContinuationsAsynchronously` + * to prevent any user continuations from being run during the + * `TrySet*()` methods - to make these safe to be called while holding + * internal locks. + * + */ + internal Result CurrentResult => currentResult; + + internal Status CurrentStatus => currentResult?.Status ?? Status.Running; + + internal Task Task => completion.Task; + + public bool TrySetCompleted (T argument) + { + var result = new Result (argument); + if (Interlocked.CompareExchange (ref currentResult, result, null) != null) + return false; + return completion.TrySetResult (result); + } + + public bool TrySetCompleted () + { + var result = new Result (Status.Completed, null); + if (Interlocked.CompareExchange (ref currentResult, result, null) != null) + return false; + return completion.TrySetResult (result); + } + + public bool TrySetCanceled () + { + return TrySetCanceled (new OperationCanceledException ()); + } + + public bool TrySetCanceled (OperationCanceledException error) + { + var result = new Result (Status.Canceled, ExceptionDispatchInfo.Capture (error)); + if (Interlocked.CompareExchange (ref currentResult, result, null) != null) + return false; + return completion.TrySetResult (result); + } + + public bool TrySetException (Exception error) + { + var result = new Result (Status.Faulted, ExceptionDispatchInfo.Capture (error)); + if (Interlocked.CompareExchange (ref currentResult, result, null) != null) + return false; + return completion.TrySetResult (result); + } + + public void ThrowOnError () + { + if (!completion.Task.IsCompleted) + return; + completion.Task.Result.Error?.Throw (); + } + + public async Task WaitForCompletion () + { + var result = await completion.Task.ConfigureAwait (false); + if (result.Status == Status.Completed) + return (T)result.Argument; + // This will always throw once we get here. + result.Error.Throw (); + throw new InvalidOperationException ("Should never happen."); + } + + internal enum Status : int { + Running, + Completed, + Canceled, + Faulted + } + + internal class Result + { + public Status Status { + get; + } + + public bool Success => Status == Status.Completed; + + public ExceptionDispatchInfo Error { + get; + } + + public T Argument { + get; + } + + public Result (T argument) + { + Status = Status.Completed; + Argument = argument; + } + + public Result (Status state, ExceptionDispatchInfo error) + { + Status = state; + Error = error; + } + } + } + + class WebCompletionSource : WebCompletionSource + { + } +} diff --git a/mcs/class/System/System.Net/WebConnection.cs b/mcs/class/System/System.Net/WebConnection.cs index 82be6259f9..b79b481ea7 100644 --- a/mcs/class/System/System.Net/WebConnection.cs +++ b/mcs/class/System/System.Net/WebConnection.cs @@ -3,10 +3,11 @@ // // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Martin Baulig // // (C) 2003 Ximian, Inc (http://www.ximian.com) +// Copyright (c) 2017 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 @@ -27,13 +28,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.IO; using System.Collections; using System.Net.Sockets; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; using System.Diagnostics; using Mono.Net.Security; @@ -48,72 +50,59 @@ namespace System.Net Aborted } - class WebConnection + class WebConnection : IDisposable { - ServicePoint sPoint; - Stream nstream; - internal Socket socket; - object socketLock = new object (); - IWebConnectionState state; - WebExceptionStatus status; - bool keepAlive; - byte [] buffer; - EventHandler abortHandler; - AbortHelper abortHelper; - internal WebConnectionData Data; - bool chunkedRead; - MonoChunkStream chunkStream; - Queue queue; - bool reused; - int position; - HttpWebRequest priority_request; NetworkCredential ntlm_credentials; bool ntlm_authenticated; bool unsafe_sharing; + Stream networkStream; + Socket socket; + MonoTlsStream monoTlsStream; + WebConnectionTunnel tunnel; + int disposed; - enum NtlmAuthState - { - None, - Challenge, - Response + public ServicePoint ServicePoint { + get; } - NtlmAuthState connect_ntlm_auth_state; - HttpWebRequest connect_request; - - Exception connect_exception; - MonoTlsStream tlsStream; #if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH [System.Runtime.InteropServices.DllImport ("__Internal")] static extern void xamarin_start_wwan (string uri); #endif - internal MonoChunkStream MonoChunkStream { - get { return chunkStream; } - } - - public WebConnection (IWebConnectionState wcs, ServicePoint sPoint) + public WebConnection (ServicePoint sPoint) { - this.state = wcs; - this.sPoint = sPoint; - buffer = new byte [4096]; - Data = new WebConnectionData (); - queue = wcs.Group.Queue; - abortHelper = new AbortHelper (); - abortHelper.Connection = this; - abortHandler = new EventHandler (abortHelper.Abort); + ServicePoint = sPoint; } - class AbortHelper { - public WebConnection Connection; +#if MONO_WEB_DEBUG + internal static bool EnableWebDebug { + get; set; + } - public void Abort (object sender, EventArgs args) - { - WebConnection other = ((HttpWebRequest) sender).WebConnection; - if (other == null) - other = Connection; - other.Abort (sender, args); - } + static WebConnection () + { + if (Environment.GetEnvironmentVariable ("MONO_WEB_DEBUG") != null) + EnableWebDebug = true; + } +#endif + + [Conditional ("MONO_WEB_DEBUG")] + internal static void Debug (string message, params object[] args) + { +#if MONO_WEB_DEBUG + if (EnableWebDebug) + Console.Error.WriteLine (string.Format (message, args)); +#endif + } + + [Conditional ("MONO_WEB_DEBUG")] + internal static void Debug (string message) + { +#if MONO_WEB_DEBUG + if (EnableWebDebug) + Console.Error.WriteLine (message); +#endif } bool CanReuse () @@ -122,714 +111,194 @@ namespace System.Net // but if there's data pending to read (!) we won't reuse the socket. return (socket.Poll (0, SelectMode.SelectRead) == false); } - - void Connect (HttpWebRequest request) + + bool CheckReusable () { - lock (socketLock) { - if (socket != null && socket.Connected && status == WebExceptionStatus.Success) { - // Take the chunked stream to the expected state (State.None) - if (CanReuse () && CompleteChunkedRead ()) { - reused = true; - return; - } - } + if (socket != null && socket.Connected) { + try { + if (CanReuse ()) + return true; + } catch { } + } - reused = false; - if (socket != null) { - socket.Close(); - socket = null; - } + return false; + } - chunkStream = null; - IPHostEntry hostEntry = sPoint.HostEntry; + async Task Connect (WebOperation operation, CancellationToken cancellationToken) + { + IPHostEntry hostEntry = ServicePoint.HostEntry; - if (hostEntry == null) { + if (hostEntry == null || hostEntry.AddressList.Length == 0) { #if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH - xamarin_start_wwan (sPoint.Address.ToString ()); - hostEntry = sPoint.HostEntry; + xamarin_start_wwan (ServicePoint.Address.ToString ()); + hostEntry = ServicePoint.HostEntry; if (hostEntry == null) { #endif - status = sPoint.UsesProxy ? WebExceptionStatus.ProxyNameResolutionFailure : - WebExceptionStatus.NameResolutionFailure; - return; + throw GetException (ServicePoint.UsesProxy ? WebExceptionStatus.ProxyNameResolutionFailure : + WebExceptionStatus.NameResolutionFailure, null); #if MONOTOUCH && !MONOTOUCH_TV && !MONOTOUCH_WATCH } #endif + } + + Exception connectException = null; + + foreach (IPAddress address in hostEntry.AddressList) { + operation.ThrowIfDisposed (cancellationToken); + + try { + socket = new Socket (address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); + } catch (Exception se) { + // The Socket ctor can throw if we run out of FD's + throw GetException (WebExceptionStatus.ConnectFailure, se); + } + IPEndPoint remote = new IPEndPoint (address, ServicePoint.Address.Port); + socket.NoDelay = !ServicePoint.UseNagleAlgorithm; + try { + ServicePoint.KeepAliveSetup (socket); + } catch { + // Ignore. Not supported in all platforms. } - //WebConnectionData data = Data; - foreach (IPAddress address in hostEntry.AddressList) { + if (!ServicePoint.CallEndPointDelegate (socket, remote)) { + Interlocked.Exchange (ref socket, null)?.Close (); + continue; + } else { try { - socket = new Socket (address.AddressFamily, SocketType.Stream, ProtocolType.Tcp); - } catch (Exception se) { - // The Socket ctor can throw if we run out of FD's - if (!request.Aborted) - status = WebExceptionStatus.ConnectFailure; - connect_exception = se; - return; - } - IPEndPoint remote = new IPEndPoint (address, sPoint.Address.Port); - socket.NoDelay = !sPoint.UseNagleAlgorithm; - try { - sPoint.KeepAliveSetup (socket); - } catch { - // Ignore. Not supported in all platforms. - } - - if (!sPoint.CallEndPointDelegate (socket, remote)) { - socket.Close (); - socket = null; - status = WebExceptionStatus.ConnectFailure; - } else { - try { - if (request.Aborted) - return; - socket.Connect (remote); - status = WebExceptionStatus.Success; - break; - } catch (ThreadAbortException) { - // program exiting... - Socket s = socket; - socket = null; - if (s != null) - s.Close (); - return; - } catch (ObjectDisposedException) { - // socket closed from another thread - return; - } catch (Exception exc) { - Socket s = socket; - socket = null; - if (s != null) - s.Close (); - if (!request.Aborted) - status = WebExceptionStatus.ConnectFailure; - connect_exception = exc; - } - } - } - } - } - - bool CreateTunnel (HttpWebRequest request, Uri connectUri, - Stream stream, out byte[] buffer) - { - StringBuilder sb = new StringBuilder (); - sb.Append ("CONNECT "); - sb.Append (request.Address.Host); - sb.Append (':'); - sb.Append (request.Address.Port); - sb.Append (" HTTP/"); - if (request.ServicePoint.ProtocolVersion == HttpVersion.Version11) - sb.Append ("1.1"); - else - sb.Append ("1.0"); - - sb.Append ("\r\nHost: "); - sb.Append (request.Address.Authority); - - bool ntlm = false; - var challenge = Data.Challenge; - Data.Challenge = null; - var auth_header = request.Headers ["Proxy-Authorization"]; - bool have_auth = auth_header != null; - if (have_auth) { - sb.Append ("\r\nProxy-Authorization: "); - sb.Append (auth_header); - ntlm = auth_header.ToUpper ().Contains ("NTLM"); - } else if (challenge != null && Data.StatusCode == 407) { - ICredentials creds = request.Proxy.Credentials; - have_auth = true; - - if (connect_request == null) { - // create a CONNECT request to use with Authenticate - connect_request = (HttpWebRequest)WebRequest.Create ( - connectUri.Scheme + "://" + connectUri.Host + ":" + connectUri.Port + "/"); - connect_request.Method = "CONNECT"; - connect_request.Credentials = creds; - } - - if (creds != null) { - for (int i = 0; i < challenge.Length; i++) { - var auth = AuthenticationManager.Authenticate (challenge [i], connect_request, creds); - if (auth == null) - continue; - ntlm = (auth.ModuleAuthenticationType == "NTLM"); - sb.Append ("\r\nProxy-Authorization: "); - sb.Append (auth.Message); - break; - } - } - } - - if (ntlm) { - sb.Append ("\r\nProxy-Connection: keep-alive"); - connect_ntlm_auth_state++; - } - - sb.Append ("\r\n\r\n"); - - Data.StatusCode = 0; - byte [] connectBytes = Encoding.Default.GetBytes (sb.ToString ()); - stream.Write (connectBytes, 0, connectBytes.Length); - - int status; - WebHeaderCollection result = ReadHeaders (stream, out buffer, out status); - if ((!have_auth || connect_ntlm_auth_state == NtlmAuthState.Challenge) && - result != null && status == 407) { // Needs proxy auth - var connectionHeader = result ["Connection"]; - if (socket != null && !string.IsNullOrEmpty (connectionHeader) && - connectionHeader.ToLower() == "close") { - // The server is requesting that this connection be closed - socket.Close(); - socket = null; - } - - Data.StatusCode = status; - Data.Challenge = result.GetValues ("Proxy-Authenticate"); - Data.Headers = result; - return false; - } - - if (status != 200) { - Data.StatusCode = status; - Data.Headers = result; - return false; - } - - return (result != null); - } - - WebHeaderCollection ReadHeaders (Stream stream, out byte [] retBuffer, out int status) - { - retBuffer = null; - status = 200; - - byte [] buffer = new byte [1024]; - MemoryStream ms = new MemoryStream (); - - while (true) { - int n = stream.Read (buffer, 0, 1024); - if (n == 0) { - HandleError (WebExceptionStatus.ServerProtocolViolation, null, "ReadHeaders"); - return null; - } - - ms.Write (buffer, 0, n); - int start = 0; - string str = null; - bool gotStatus = false; - WebHeaderCollection headers = new WebHeaderCollection (); - while (ReadLine (ms.GetBuffer (), ref start, (int) ms.Length, ref str)) { - if (str == null) { - int contentLen = 0; - try { - contentLen = int.Parse(headers["Content-Length"]); - } - catch { - contentLen = 0; - } - - if (ms.Length - start - contentLen > 0) { - // we've read more data than the response header and conents, - // give back extra data to the caller - retBuffer = new byte[ms.Length - start - contentLen]; - Buffer.BlockCopy(ms.GetBuffer(), start + contentLen, retBuffer, 0, retBuffer.Length); - } - else { - // haven't read in some or all of the contents for the response, do so now - FlushContents(stream, contentLen - (int)(ms.Length - start)); - } - - return headers; - } - - if (gotStatus) { - headers.Add (str); + operation.ThrowIfDisposed (cancellationToken); + await socket.ConnectAsync (remote).ConfigureAwait (false); + } catch (ObjectDisposedException) { + throw; + } catch (Exception exc) { + Interlocked.Exchange (ref socket, null)?.Close (); + // Something went wrong, but we might have multiple IP Addresses + // and need to probe them all. + connectException = GetException (WebExceptionStatus.ConnectFailure, exc); continue; } - - string[] parts = str.Split (' '); - if (parts.Length < 2) { - HandleError (WebExceptionStatus.ServerProtocolViolation, null, "ReadHeaders2"); - return null; - } - - if (String.Compare (parts [0], "HTTP/1.1", true) == 0) - Data.ProxyVersion = HttpVersion.Version11; - else if (String.Compare (parts [0], "HTTP/1.0", true) == 0) - Data.ProxyVersion = HttpVersion.Version10; - else { - HandleError (WebExceptionStatus.ServerProtocolViolation, null, "ReadHeaders2"); - return null; - } - - status = (int)UInt32.Parse (parts [1]); - if (parts.Length >= 3) - Data.StatusDescription = String.Join (" ", parts, 2, parts.Length - 2); - - gotStatus = true; } + + if (socket != null) + return; } + + if (connectException == null) + connectException = GetException (WebExceptionStatus.ConnectFailure, null); + + throw connectException; } - void FlushContents(Stream stream, int contentLength) - { - while (contentLength > 0) { - byte[] contentBuffer = new byte[contentLength]; - int bytesRead = stream.Read(contentBuffer, 0, contentLength); - if (bytesRead > 0) { - contentLength -= bytesRead; - } - else { - break; - } - } - } +#if MONO_WEB_DEBUG + static int nextID, nextRequestID; + readonly int id = ++nextID; + public int ID => disposed != 0 ? -id : id; +#else + internal readonly int ID; +#endif - bool CreateStream (HttpWebRequest request) + async Task CreateStream (WebOperation operation, bool reused, CancellationToken cancellationToken) { +#if MONO_WEB_DEBUG + var requestID = ++nextRequestID; +#else + var requestID = 0; +#endif + try { - NetworkStream serverStream = new NetworkStream (socket, false); + var stream = new NetworkStream (socket, false); - if (request.Address.Scheme == Uri.UriSchemeHttps) { -#if SECURITY_DEP - if (!reused || nstream == null || tlsStream == null) { - byte [] buffer = null; - if (sPoint.UseConnect) { - bool ok = CreateTunnel (request, sPoint.Address, serverStream, out buffer); - if (!ok) + Debug ($"WC CREATE STREAM: Cnc={ID} {requestID} {reused} socket={socket.ID}"); + + if (operation.Request.Address.Scheme == Uri.UriSchemeHttps) { + if (!reused || monoTlsStream == null) { + if (ServicePoint.UseConnect) { + if (tunnel == null) + tunnel = new WebConnectionTunnel (operation.Request, ServicePoint.Address); + await tunnel.Initialize (stream, cancellationToken).ConfigureAwait (false); + if (!tunnel.Success) return false; } - tlsStream = new MonoTlsStream (request, serverStream); - nstream = tlsStream.CreateStream (buffer); + monoTlsStream = new MonoTlsStream (operation.Request, stream); + networkStream = await monoTlsStream.CreateStream (tunnel, cancellationToken).ConfigureAwait (false); } - // we also need to set ServicePoint.Certificate - // and ServicePoint.ClientCertificate but this can - // only be done later (after handshake - which is - // done only after a read operation). -#else - throw new NotSupportedException (); -#endif - } else { - nstream = serverStream; + return true; } + + networkStream = stream; + return true; } catch (Exception ex) { - if (tlsStream != null) - status = tlsStream.ExceptionStatus; - else if (!request.Aborted) - status = WebExceptionStatus.ConnectFailure; - connect_exception = ex; - return false; - } - - return true; - } - - void HandleError (WebExceptionStatus st, Exception e, string where) - { - status = st; - lock (this) { - if (st == WebExceptionStatus.RequestCanceled) - Data = new WebConnectionData (); - } - - if (e == null) { // At least we now where it comes from - try { - throw new Exception (new System.Diagnostics.StackTrace ().ToString ()); - } catch (Exception e2) { - e = e2; - } - } - - HttpWebRequest req = null; - if (Data != null && Data.request != null) - req = Data.request; - - Close (true); - if (req != null) { - req.FinishedReading = true; - req.SetResponseError (st, e, where); + ex = HttpWebRequest.FlattenException (ex); + Debug ($"WC CREATE STREAM EX: Cnc={ID} {requestID} {operation.Aborted} - {ex.Message}"); + if (operation.Aborted || monoTlsStream == null) + throw GetException (WebExceptionStatus.ConnectFailure, ex); + throw GetException (monoTlsStream.ExceptionStatus, ex); + } finally { + Debug ($"WC CREATE STREAM DONE: Cnc={ID} {requestID}"); } } - - void ReadDone (IAsyncResult result) + + internal async Task InitConnection (WebOperation operation, CancellationToken cancellationToken) { - WebConnectionData data = Data; - Stream ns = nstream; - if (ns == null) { - Close (true); - return; - } + Debug ($"WC INIT CONNECTION: Cnc={ID} Req={operation.Request.ID} Op={operation.ID}"); - int nread = -1; - try { - nread = ns.EndRead (result); - } catch (ObjectDisposedException) { - return; - } catch (Exception e) { - if (e.InnerException is ObjectDisposedException) - return; - - HandleError (WebExceptionStatus.ReceiveFailure, e, "ReadDone1"); - return; - } - - if (nread == 0) { - HandleError (WebExceptionStatus.ReceiveFailure, null, "ReadDone2"); - return; - } - - if (nread < 0) { - HandleError (WebExceptionStatus.ServerProtocolViolation, null, "ReadDone3"); - return; - } - - int pos = -1; - nread += position; - if (data.ReadState == ReadState.None) { - Exception exc = null; - try { - pos = GetResponse (data, sPoint, buffer, nread); - } catch (Exception e) { - exc = e; - } - - if (exc != null || pos == -1) { - HandleError (WebExceptionStatus.ServerProtocolViolation, exc, "ReadDone4"); - return; - } - } - - if (data.ReadState == ReadState.Aborted) { - HandleError (WebExceptionStatus.RequestCanceled, null, "ReadDone"); - return; - } - - if (data.ReadState != ReadState.Content) { - int est = nread * 2; - int max = (est < buffer.Length) ? buffer.Length : est; - byte [] newBuffer = new byte [max]; - Buffer.BlockCopy (buffer, 0, newBuffer, 0, nread); - buffer = newBuffer; - position = nread; - data.ReadState = ReadState.None; - InitRead (); - return; - } - - position = 0; - - WebConnectionStream stream = new WebConnectionStream (this, data); - bool expect_content = ExpectContent (data.StatusCode, data.request.Method); - string tencoding = null; - if (expect_content) - tencoding = data.Headers ["Transfer-Encoding"]; - - chunkedRead = (tencoding != null && tencoding.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1); - if (!chunkedRead) { - stream.ReadBuffer = buffer; - stream.ReadBufferOffset = pos; - stream.ReadBufferSize = nread; - try { - stream.CheckResponseInBuffer (); - } catch (Exception e) { - HandleError (WebExceptionStatus.ReceiveFailure, e, "ReadDone7"); - } - } else if (chunkStream == null) { - try { - chunkStream = new MonoChunkStream (buffer, pos, nread, data.Headers); - } catch (Exception e) { - HandleError (WebExceptionStatus.ServerProtocolViolation, e, "ReadDone5"); - return; - } - } else { - chunkStream.ResetBuffer (); - try { - chunkStream.Write (buffer, pos, nread); - } catch (Exception e) { - HandleError (WebExceptionStatus.ServerProtocolViolation, e, "ReadDone6"); - return; - } - } - - data.stream = stream; - - if (!expect_content) - stream.ForceCompletion (); - - data.request.SetResponseData (data); - } - - static bool ExpectContent (int statusCode, string method) - { - if (method == "HEAD") - return false; - return (statusCode >= 200 && statusCode != 204 && statusCode != 304); - } - - internal void InitRead () - { - Stream ns = nstream; - - try { - int size = buffer.Length - position; - ns.BeginRead (buffer, position, size, ReadDone, null); - } catch (Exception e) { - HandleError (WebExceptionStatus.ReceiveFailure, e, "InitRead"); - } - } - - static int GetResponse (WebConnectionData data, ServicePoint sPoint, - byte [] buffer, int max) - { - int pos = 0; - string line = null; - bool lineok = false; - bool isContinue = false; - bool emptyFirstLine = false; - do { - if (data.ReadState == ReadState.Aborted) - return -1; - - if (data.ReadState == ReadState.None) { - lineok = ReadLine (buffer, ref pos, max, ref line); - if (!lineok) - return 0; - - if (line == null) { - emptyFirstLine = true; - continue; - } - emptyFirstLine = false; - data.ReadState = ReadState.Status; - - string [] parts = line.Split (' '); - if (parts.Length < 2) - return -1; - - if (String.Compare (parts [0], "HTTP/1.1", true) == 0) { - data.Version = HttpVersion.Version11; - sPoint.SetVersion (HttpVersion.Version11); - } else { - data.Version = HttpVersion.Version10; - sPoint.SetVersion (HttpVersion.Version10); - } - - data.StatusCode = (int) UInt32.Parse (parts [1]); - if (parts.Length >= 3) - data.StatusDescription = String.Join (" ", parts, 2, parts.Length - 2); - else - data.StatusDescription = ""; - - if (pos >= max) - return pos; - } - - emptyFirstLine = false; - if (data.ReadState == ReadState.Status) { - data.ReadState = ReadState.Headers; - data.Headers = new WebHeaderCollection (); - ArrayList headers = new ArrayList (); - bool finished = false; - while (!finished) { - if (ReadLine (buffer, ref pos, max, ref line) == false) - break; - - if (line == null) { - // Empty line: end of headers - finished = true; - continue; - } - - if (line.Length > 0 && (line [0] == ' ' || line [0] == '\t')) { - int count = headers.Count - 1; - if (count < 0) - break; - - string prev = (string) headers [count] + line; - headers [count] = prev; - } else { - headers.Add (line); - } - } - - if (!finished) - return 0; - - // .NET uses ParseHeaders or ParseHeadersStrict which is much better - foreach (string s in headers) { - - int pos_s = s.IndexOf (':'); - if (pos_s == -1) - throw new ArgumentException ("no colon found", "header"); - - var header = s.Substring (0, pos_s); - var value = s.Substring (pos_s + 1).Trim (); - - var h = data.Headers; - if (WebHeaderCollection.AllowMultiValues (header)) { - h.AddInternal (header, value); - } else { - h.SetInternal (header, value); - } - } - - if (data.StatusCode == (int) HttpStatusCode.Continue) { - sPoint.SendContinue = true; - if (pos >= max) - return pos; - - if (data.request.ExpectContinue) { - data.request.DoContinueDelegate (data.StatusCode, data.Headers); - // Prevent double calls when getting the - // headers in several packets. - data.request.ExpectContinue = false; - } - - data.ReadState = ReadState.None; - isContinue = true; - } - else { - data.ReadState = ReadState.Content; - return pos; - } - } - } while (emptyFirstLine || isContinue); - - return -1; - } - - void InitConnection (HttpWebRequest request) - { - request.WebConnection = this; - if (request.ReuseConnection) - request.StoredConnection = this; - - if (request.Aborted) - return; - - keepAlive = request.KeepAlive; - Data = new WebConnectionData (request); + bool reset = true; retry: - Connect (request); - if (request.Aborted) - return; + operation.ThrowIfClosedOrDisposed (cancellationToken); - if (status != WebExceptionStatus.Success) { - if (!request.Aborted) { - request.SetWriteStreamError (status, connect_exception); - Close (true); + var reused = CheckReusable (); + Debug ($"WC INIT CONNECTION #1: Cnc={ID} Op={operation.ID} - {reused} - {operation.WriteBuffer != null} {operation.IsNtlmChallenge}"); + if (!reused) { + CloseSocket (); + if (reset) + Reset (); + try { + await Connect (operation, cancellationToken).ConfigureAwait (false); + Debug ($"WC INIT CONNECTION #2: Cnc={ID} Op={operation.ID} {socket.LocalEndPoint}"); + } catch (Exception ex) { + Debug ($"WC INIT CONNECTION #2 FAILED: Cnc={ID} Op={operation.ID} - {ex.Message}\n{ex}"); + throw; } - return; - } - - if (!CreateStream (request)) { - if (request.Aborted) - return; - - WebExceptionStatus st = status; - if (Data.Challenge != null) - goto retry; - - Exception cnc_exc = connect_exception; - if (cnc_exc == null && (Data.StatusCode == 401 || Data.StatusCode == 407)) { - st = WebExceptionStatus.ProtocolError; - if (Data.Headers == null) - Data.Headers = new WebHeaderCollection (); - - var webResponse = new HttpWebResponse (sPoint.Address, "CONNECT", Data, null); - cnc_exc = new WebException (Data.StatusCode == 407 ? "(407) Proxy Authentication Required" : "(401) Unauthorized", null, st, webResponse); - } - - connect_exception = null; - request.SetWriteStreamError (st, cnc_exc); - Close (true); - return; } - request.SetWriteStream (new WebConnectionStream (this, request)); + var success = await CreateStream (operation, reused, cancellationToken).ConfigureAwait (false); + + Debug ($"WC INIT CONNECTION #3: Cnc={ID} Op={operation.ID} - {success}"); + if (!success) { + if (tunnel?.Challenge == null) + throw GetException (WebExceptionStatus.ProtocolError, null); + + if (tunnel.CloseConnection) + CloseSocket (); + reset = false; + goto retry; + } + + networkStream.ReadTimeout = operation.Request.ReadWriteTimeout; + + return new WebRequestStream (this, operation, networkStream, tunnel); } -#if MONOTOUCH - static bool warned_about_queue = false; -#endif - - internal EventHandler SendRequest (HttpWebRequest request) + internal static WebException GetException (WebExceptionStatus status, Exception error) { - if (request.Aborted) - return null; - - lock (this) { - if (state.TrySetBusy ()) { - status = WebExceptionStatus.Success; - ThreadPool.QueueUserWorkItem (o => { try { InitConnection ((HttpWebRequest) o); } catch {} }, request); - } else { - lock (queue) { -#if MONOTOUCH - if (!warned_about_queue) { - warned_about_queue = true; - Console.WriteLine ("WARNING: An HttpWebRequest was added to the ConnectionGroup queue because the connection limit was reached."); - } -#endif - queue.Enqueue (request); - } - } - } - - return abortHandler; - } - - void SendNext () - { - lock (queue) { - if (queue.Count > 0) { - SendRequest ((HttpWebRequest) queue.Dequeue ()); - } - } + if (error == null) + return new WebException ($"Error: {status}", status); + if (error is WebException wex) + return wex; + return new WebException ($"Error: {status} ({error.Message})", status, + WebExceptionInternalStatus.RequestFatal, error); } - internal void NextRead () - { - lock (this) { - if (Data.request != null) - Data.request.FinishedReading = true; - string header = (sPoint.UsesProxy) ? "Proxy-Connection" : "Connection"; - string cncHeader = (Data.Headers != null) ? Data.Headers [header] : null; - bool keepAlive = (Data.Version == HttpVersion.Version11 && this.keepAlive); - if (Data.ProxyVersion != null && Data.ProxyVersion != HttpVersion.Version11) - keepAlive = false; - if (cncHeader != null) { - cncHeader = cncHeader.ToLower (); - keepAlive = (this.keepAlive && cncHeader.IndexOf ("keep-alive", StringComparison.Ordinal) != -1); - } - - if ((socket != null && !socket.Connected) || - (!keepAlive || (cncHeader != null && cncHeader.IndexOf ("close", StringComparison.Ordinal) != -1))) { - Close (false); - } - - state.SetIdle (); - if (priority_request != null) { - SendRequest (priority_request); - priority_request = null; - } else { - SendNext (); - } - } - } - - static bool ReadLine (byte [] buffer, ref int start, int max, ref string output) + internal static bool ReadLine (byte[] buffer, ref int start, int max, ref string output) { bool foundCR = false; StringBuilder text = new StringBuilder (); int c = 0; while (start < max) { - c = (int) buffer [start++]; + c = (int)buffer[start++]; - if (c == '\n') { // newline - if ((text.Length > 0) && (text [text.Length - 1] == '\r')) + if (c == '\n') { // newline + if ((text.Length > 0) && (text[text.Length - 1] == '\r')) text.Length--; foundCR = false; @@ -841,9 +310,9 @@ namespace System.Net if (c == '\r') foundCR = true; - - text.Append ((char) c); + + text.Append ((char)c); } if (c != '\n' && c != '\r') @@ -861,380 +330,180 @@ namespace System.Net return true; } - - internal IAsyncResult BeginRead (HttpWebRequest request, byte [] buffer, int offset, int size, AsyncCallback cb, object state) + internal bool CanReuseConnection (WebOperation operation) { - Stream s = null; lock (this) { - if (Data.request != request) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - if (nstream == null) - return null; - s = nstream; - } + if (Closed || currentOperation != null) + return false; + if (!NtlmAuthenticated) + return true; - IAsyncResult result = null; - if (!chunkedRead || (!chunkStream.DataAvailable && chunkStream.WantMore)) { - try { - result = s.BeginRead (buffer, offset, size, cb, state); - cb = null; - } catch (Exception) { - HandleError (WebExceptionStatus.ReceiveFailure, null, "chunked BeginRead"); - throw; - } - } + NetworkCredential cnc_cred = NtlmCredential; + var request = operation.Request; - if (chunkedRead) { - WebAsyncResult wr = new WebAsyncResult (cb, state, buffer, offset, size); - wr.InnerAsyncResult = result; - if (result == null) { - // Will be completed from the data in MonoChunkStream - wr.SetCompleted (true, (Exception) null); - wr.DoCallback (); - } - return wr; - } + bool isProxy = (request.Proxy != null && !request.Proxy.IsBypassed (request.RequestUri)); + ICredentials req_icreds = (!isProxy) ? request.Credentials : request.Proxy.Credentials; + NetworkCredential req_cred = (req_icreds != null) ? req_icreds.GetCredential (request.RequestUri, "NTLM") : null; - return result; - } - - internal int EndRead (HttpWebRequest request, IAsyncResult result) - { - Stream s = null; - Exception exception = null; - - lock (this) { - s = nstream; - } - - int nbytes = 0; - bool done = false; - WebAsyncResult wr = null; - IAsyncResult nsAsync = ((WebAsyncResult) result).InnerAsyncResult; - try { - if (chunkedRead && (nsAsync is WebAsyncResult)) { - wr = (WebAsyncResult) nsAsync; - IAsyncResult inner = wr.InnerAsyncResult; - if (inner != null && !(inner is WebAsyncResult)) { - nbytes = s.EndRead (inner); - done = nbytes == 0; - } - } else if (!(nsAsync is WebAsyncResult)) { - nbytes = s.EndRead (nsAsync); - wr = (WebAsyncResult) result; - done = nbytes == 0; - } - } catch (Exception exc) { - exception = exc; - } - - lock (this) { - if (request.Aborted) - throw new WebException ("Request aborted", WebExceptionStatus.RequestCanceled); - if (Data.request != request) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - if (nstream == null) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - } - - if (exception != null) - throw exception; - - if (chunkedRead) { - try { - chunkStream.WriteAndReadBack (wr.Buffer, wr.Offset, wr.Size, ref nbytes); - if (!done && nbytes == 0 && chunkStream.WantMore) - nbytes = EnsureRead (wr.Buffer, wr.Offset, wr.Size); - } catch (Exception e) { - if (e is WebException) - throw e; - - throw new WebException ("Invalid chunked data.", e, - WebExceptionStatus.ServerProtocolViolation, null); + if (cnc_cred == null || req_cred == null || + cnc_cred.Domain != req_cred.Domain || cnc_cred.UserName != req_cred.UserName || + cnc_cred.Password != req_cred.Password) { + return false; } - if ((done || nbytes == 0) && chunkStream.ChunkLeft != 0) { - HandleError (WebExceptionStatus.ReceiveFailure, null, "chunked EndRead"); - throw new WebException ("Read error", null, WebExceptionStatus.ReceiveFailure, null); - } + bool req_sharing = request.UnsafeAuthenticatedConnectionSharing; + bool cnc_sharing = UnsafeAuthenticatedConnectionSharing; + return !(req_sharing == false || req_sharing != cnc_sharing); } - - return (nbytes != 0) ? nbytes : -1; } - // To be called on chunkedRead when we can read no data from the MonoChunkStream yet - int EnsureRead (byte [] buffer, int offset, int size) + bool PrepareSharingNtlm (WebOperation operation) { - byte [] morebytes = null; - int nbytes = 0; - while (nbytes == 0 && chunkStream.WantMore) { - int localsize = chunkStream.ChunkLeft; - if (localsize <= 0) // not read chunk size yet - localsize = 1024; - else if (localsize > 16384) - localsize = 16384; - - if (morebytes == null || morebytes.Length < localsize) - morebytes = new byte [localsize]; - - int nread = nstream.Read (morebytes, 0, localsize); - if (nread <= 0) - return 0; // Error - - chunkStream.Write (morebytes, 0, nread); - nbytes += chunkStream.Read (buffer, offset + nbytes, size - nbytes); - } - - return nbytes; - } - - bool CompleteChunkedRead() - { - if (!chunkedRead || chunkStream == null) + if (operation == null || !NtlmAuthenticated) return true; - while (chunkStream.WantMore) { - int nbytes = nstream.Read (buffer, 0, buffer.Length); - if (nbytes <= 0) - return false; // Socket was disconnected + bool needs_reset = false; + NetworkCredential cnc_cred = NtlmCredential; + var request = operation.Request; - chunkStream.Write (buffer, 0, nbytes); + bool isProxy = (request.Proxy != null && !request.Proxy.IsBypassed (request.RequestUri)); + ICredentials req_icreds = (!isProxy) ? request.Credentials : request.Proxy.Credentials; + NetworkCredential req_cred = (req_icreds != null) ? req_icreds.GetCredential (request.RequestUri, "NTLM") : null; + + if (cnc_cred == null || req_cred == null || + cnc_cred.Domain != req_cred.Domain || cnc_cred.UserName != req_cred.UserName || + cnc_cred.Password != req_cred.Password) { + needs_reset = true; } - return true; - } - - internal IAsyncResult BeginWrite (HttpWebRequest request, byte [] buffer, int offset, int size, AsyncCallback cb, object state) - { - Stream s = null; - lock (this) { - if (Data.request != request) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - if (nstream == null) - return null; - s = nstream; + if (!needs_reset) { + bool req_sharing = request.UnsafeAuthenticatedConnectionSharing; + bool cnc_sharing = UnsafeAuthenticatedConnectionSharing; + needs_reset = (req_sharing == false || req_sharing != cnc_sharing); } - IAsyncResult result = null; - try { - result = s.BeginWrite (buffer, offset, size, cb, state); - } catch (ObjectDisposedException) { - lock (this) { - if (Data.request != request) - return null; - } - throw; - } catch (IOException e) { - SocketException se = e.InnerException as SocketException; - if (se != null && se.SocketErrorCode == SocketError.NotConnected) { - return null; - } - throw; - } catch (Exception) { - status = WebExceptionStatus.SendFailure; - throw; - } - - return result; + return needs_reset; } - internal bool EndWrite (HttpWebRequest request, bool throwOnError, IAsyncResult result) + void Reset () { - Stream s = null; - WebExceptionStatus newStatus = status; - bool complete; - Exception exception = null; - lock (this) { - s = nstream; + tunnel = null; + ResetNtlm (); } - - try { - s.EndWrite (result); - complete = true; - } catch (Exception exc) { - newStatus = WebExceptionStatus.SendFailure; - if (throwOnError && exc.InnerException != null) - exception = exc.InnerException; - complete = false; - } - - lock (this) { - if (status == WebExceptionStatus.RequestCanceled) - return true; - if (Data.request != request) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - if (nstream == null) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - } - - status = newStatus; - if (exception != null) - throw exception; - return complete; } - internal int Read (HttpWebRequest request, byte [] buffer, int offset, int size) + void Close (bool reset) { - Stream s = null; lock (this) { - if (Data.request != request) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - if (nstream == null) - return 0; - s = nstream; + CloseSocket (); + if (reset) + Reset (); } + } - int result = 0; - try { - bool done = false; - if (!chunkedRead) { - result = s.Read (buffer, offset, size); - done = (result == 0); - } - - if (chunkedRead) { + void CloseSocket () + { + lock (this) { + if (networkStream != null) { try { - chunkStream.WriteAndReadBack (buffer, offset, size, ref result); - if (!done && result == 0 && chunkStream.WantMore) - result = EnsureRead (buffer, offset, size); - } catch (Exception e) { - HandleError (WebExceptionStatus.ReceiveFailure, e, "chunked Read1"); - throw; - } - - if ((done || result == 0) && chunkStream.WantMore) { - HandleError (WebExceptionStatus.ReceiveFailure, null, "chunked Read2"); - throw new WebException ("Read error", null, WebExceptionStatus.ReceiveFailure, null); - } - } - } catch (Exception e) { - HandleError (WebExceptionStatus.ReceiveFailure, e, "Read"); - } - - return result; - } - - internal bool Write (HttpWebRequest request, byte [] buffer, int offset, int size, ref string err_msg) - { - err_msg = null; - Stream s = null; - lock (this) { - if (Data.request != request) - throw new ObjectDisposedException (typeof (NetworkStream).FullName); - s = nstream; - if (s == null) - return false; - } - - try { - s.Write (buffer, offset, size); - } catch (Exception e) { - err_msg = e.Message; - WebExceptionStatus wes = WebExceptionStatus.SendFailure; - string msg = "Write: " + err_msg; - if (e is WebException) { - HandleError (wes, e, msg); - return false; - } - - HandleError (wes, e, msg); - return false; - } - return true; - } - - internal void Close (bool sendNext) - { - lock (this) { - if (Data != null && Data.request != null && Data.request.ReuseConnection) { - Data.request.ReuseConnection = false; - return; - } - - if (nstream != null) { - try { - nstream.Close (); - } catch {} + networkStream.Dispose (); + } catch { } + networkStream = null; } if (socket != null) { try { - socket.Close (); - } catch {} + socket.Dispose (); + } catch { } socket = null; } - if (ntlm_authenticated) - ResetNtlm (); - if (Data != null) { - lock (Data) { - Data.ReadState = ReadState.Aborted; - } - } - state.SetIdle (); - Data = new WebConnectionData (); - if (sendNext) - SendNext (); - - connect_request = null; - connect_ntlm_auth_state = NtlmAuthState.None; + monoTlsStream = null; } } - void Abort (object sender, EventArgs args) + DateTime idleSince; + WebOperation currentOperation; + + public bool Closed => disposed != 0; + + public bool Busy { + get { return currentOperation != null; } + } + + public DateTime IdleSince { + get { return idleSince; } + } + + public bool StartOperation (WebOperation operation, bool reused) { lock (this) { - lock (queue) { - HttpWebRequest req = (HttpWebRequest) sender; - if (Data.request == req || Data.request == null) { - if (!req.FinishedReading) { - status = WebExceptionStatus.RequestCanceled; - Close (false); - if (queue.Count > 0) { - Data.request = (HttpWebRequest) queue.Dequeue (); - SendRequest (Data.request); - } - } - return; - } + if (Closed) + return false; + if (Interlocked.CompareExchange (ref currentOperation, operation, null) != null) + return false; - req.FinishedReading = true; - req.SetResponseError (WebExceptionStatus.RequestCanceled, null, "User aborted"); - if (queue.Count > 0 && queue.Peek () == sender) { - queue.Dequeue (); - } else if (queue.Count > 0) { - object [] old = queue.ToArray (); - queue.Clear (); - for (int i = old.Length - 1; i >= 0; i--) { - if (old [i] != sender) - queue.Enqueue (old [i]); - } - } + idleSince = DateTime.UtcNow + TimeSpan.FromDays (3650); + + if (reused && !PrepareSharingNtlm (operation)) { + Debug ($"WC START - CAN'T REUSE: Cnc={ID} Op={operation.ID}"); + Close (true); } + + operation.RegisterRequest (ServicePoint, this); + Debug ($"WC START: Cnc={ID} Op={operation.ID}"); } + + operation.Run (); + return true; } - internal void ResetNtlm () + public bool Continue (WebOperation next) + { + lock (this) { + if (Closed) + return false; + + Debug ($"WC CONTINUE: Cnc={ID} connected={socket?.Connected} next={next?.ID} current={currentOperation?.ID}"); + if (socket == null || !socket.Connected || !PrepareSharingNtlm (next)) { + Close (true); + return false; + } + + currentOperation = next; + + if (next == null) + return true; + + // Ok, we got another connection. Let's run it! + next.RegisterRequest (ServicePoint, this); + } + + next.Run (); + return true; + } + + void Dispose (bool disposing) + { + if (Interlocked.CompareExchange (ref disposed, 1, 0) != 0) + return; + Debug ($"WC DISPOSE: Cnc={ID}"); + Close (true); + } + + public void Dispose () + { + Dispose (true); + } + + void ResetNtlm () { ntlm_authenticated = false; ntlm_credentials = null; unsafe_sharing = false; } - internal bool Connected { - get { - lock (this) { - return (socket != null && socket.Connected); - } - } - } - - // -Used for NTLM authentication - internal HttpWebRequest PriorityRequest { - set { priority_request = value; } - } - internal bool NtlmAuthenticated { get { return ntlm_authenticated; } set { ntlm_authenticated = value; } diff --git a/mcs/class/System/System.Net/WebConnectionData.cs b/mcs/class/System/System.Net/WebConnectionData.cs deleted file mode 100644 index 77d19540be..0000000000 --- a/mcs/class/System/System.Net/WebConnectionData.cs +++ /dev/null @@ -1,80 +0,0 @@ -// -// System.Net.WebConnectionData -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// -// (C) 2003 Ximian, Inc (http://www.ximian.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.IO; - -namespace System.Net -{ - class WebConnectionData - { - HttpWebRequest _request; - public int StatusCode; - public string StatusDescription; - public WebHeaderCollection Headers; - public Version Version; - public Version ProxyVersion; - public Stream stream; - public string[] Challenge; - ReadState _readState; - - public WebConnectionData () - { - _readState = ReadState.None; - } - - public WebConnectionData (HttpWebRequest request) - { - this._request = request; - } - - public HttpWebRequest request { - get { - return _request; - } - set { - _request = value; - } - } - - public ReadState ReadState { - get { - return _readState; - } - set { - lock (this) { - if ((_readState == ReadState.Aborted) && (value != ReadState.Aborted)) - throw new WebException ("Aborted", WebExceptionStatus.RequestCanceled); - _readState = value; - } - } - } - } -} - diff --git a/mcs/class/System/System.Net/WebConnectionGroup.cs b/mcs/class/System/System.Net/WebConnectionGroup.cs deleted file mode 100644 index 3936ee4289..0000000000 --- a/mcs/class/System/System.Net/WebConnectionGroup.cs +++ /dev/null @@ -1,292 +0,0 @@ -// -// System.Net.WebConnectionGroup -// -// Authors: -// Gonzalo Paniagua Javier (gonzalo@ximian.com) -// Martin Baulig (martin.baulig@xamarin.com) -// -// (C) 2003 Ximian, Inc (http://www.ximian.com) -// Copyright 2011-2014 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.Collections; -using System.Collections.Generic; -using System.Net.Configuration; -using System.Net.Sockets; -using System.Diagnostics; - -namespace System.Net -{ - class WebConnectionGroup - { - ServicePoint sPoint; - string name; - LinkedList connections; - Queue queue; - bool closing; - - public WebConnectionGroup (ServicePoint sPoint, string name) - { - this.sPoint = sPoint; - this.name = name; - connections = new LinkedList (); - queue = new Queue (); - } - - public event EventHandler ConnectionClosed; - - void OnConnectionClosed () - { - if (ConnectionClosed != null) - ConnectionClosed (this, null); - } - - public void Close () - { - List connectionsToClose = null; - - //TODO: what do we do with the queue? Empty it out and abort the requests? - //TODO: abort requests or wait for them to finish - lock (sPoint) { - closing = true; - var iter = connections.First; - while (iter != null) { - var cnc = iter.Value.Connection; - var node = iter; - iter = iter.Next; - - // Closing connections inside the lock leads to a deadlock. - if (connectionsToClose == null) - connectionsToClose = new List(); - - connectionsToClose.Add (cnc); - connections.Remove (node); - } - } - - if (connectionsToClose != null) { - foreach (var cnc in connectionsToClose) { - cnc.Close (false); - OnConnectionClosed (); - } - } - } - - public WebConnection GetConnection (HttpWebRequest request, out bool created) - { - lock (sPoint) { - return CreateOrReuseConnection (request, out created); - } - } - - static void PrepareSharingNtlm (WebConnection cnc, HttpWebRequest request) - { - if (!cnc.NtlmAuthenticated) - return; - - bool needs_reset = false; - NetworkCredential cnc_cred = cnc.NtlmCredential; - - bool isProxy = (request.Proxy != null && !request.Proxy.IsBypassed (request.RequestUri)); - ICredentials req_icreds = (!isProxy) ? request.Credentials : request.Proxy.Credentials; - NetworkCredential req_cred = (req_icreds != null) ? req_icreds.GetCredential (request.RequestUri, "NTLM") : null; - - if (cnc_cred == null || req_cred == null || - cnc_cred.Domain != req_cred.Domain || cnc_cred.UserName != req_cred.UserName || - cnc_cred.Password != req_cred.Password) { - needs_reset = true; - } - - if (!needs_reset) { - bool req_sharing = request.UnsafeAuthenticatedConnectionSharing; - bool cnc_sharing = cnc.UnsafeAuthenticatedConnectionSharing; - needs_reset = (req_sharing == false || req_sharing != cnc_sharing); - } - if (needs_reset) { - cnc.Close (false); // closes the authenticated connection - cnc.ResetNtlm (); - } - } - - ConnectionState FindIdleConnection () - { - foreach (var cnc in connections) { - if (cnc.Busy) - continue; - - connections.Remove (cnc); - connections.AddFirst (cnc); - return cnc; - } - - return null; - } - - WebConnection CreateOrReuseConnection (HttpWebRequest request, out bool created) - { - var cnc = FindIdleConnection (); - if (cnc != null) { - created = false; - PrepareSharingNtlm (cnc.Connection, request); - return cnc.Connection; - } - - if (sPoint.ConnectionLimit > connections.Count || connections.Count == 0) { - created = true; - cnc = new ConnectionState (this); - connections.AddFirst (cnc); - return cnc.Connection; - } - - created = false; - cnc = connections.Last.Value; - connections.Remove (cnc); - connections.AddFirst (cnc); - return cnc.Connection; - } - - public string Name { - get { return name; } - } - - internal Queue Queue { - get { return queue; } - } - - internal bool TryRecycle (TimeSpan maxIdleTime, ref DateTime idleSince) - { - var now = DateTime.UtcNow; - - again: - bool recycled; - List connectionsToClose = null; - - lock (sPoint) { - if (closing) { - idleSince = DateTime.MinValue; - return true; - } - - int count = 0; - var iter = connections.First; - while (iter != null) { - var cnc = iter.Value; - var node = iter; - iter = iter.Next; - - ++count; - if (cnc.Busy) - continue; - - if (count <= sPoint.ConnectionLimit && now - cnc.IdleSince < maxIdleTime) { - if (cnc.IdleSince > idleSince) - idleSince = cnc.IdleSince; - continue; - } - - /* - * Do not call WebConnection.Close() while holding the ServicePoint lock - * as this could deadlock when attempting to take the WebConnection lock. - * - */ - - if (connectionsToClose == null) - connectionsToClose = new List (); - connectionsToClose.Add (cnc.Connection); - connections.Remove (node); - } - - recycled = connections.Count == 0; - } - - // Did we find anything that can be closed? - if (connectionsToClose == null) - return recycled; - - // Ok, let's get rid of these! - foreach (var cnc in connectionsToClose) - cnc.Close (false); - - // Re-take the lock, then remove them from the connection list. - goto again; - } - - class ConnectionState : IWebConnectionState { - public WebConnection Connection { - get; - private set; - } - - public WebConnectionGroup Group { - get; - private set; - } - - public ServicePoint ServicePoint { - get { return Group.sPoint; } - } - - bool busy; - DateTime idleSince; - - public bool Busy { - get { return busy; } - } - - public DateTime IdleSince { - get { return idleSince; } - } - - public bool TrySetBusy () - { - lock (ServicePoint) { - if (busy) - return false; - busy = true; - idleSince = DateTime.UtcNow + TimeSpan.FromDays (3650); - return true; - } - } - - public void SetIdle () - { - lock (ServicePoint) { - busy = false; - idleSince = DateTime.UtcNow; - } - } - - public ConnectionState (WebConnectionGroup group) - { - Group = group; - idleSince = DateTime.UtcNow; - Connection = new WebConnection (this, group.sPoint); - } - } - - } -} - diff --git a/mcs/class/System/System.Net/WebConnectionStream.cs b/mcs/class/System/System.Net/WebConnectionStream.cs index 96a2b3bf42..efd7361f60 100644 --- a/mcs/class/System/System.Net/WebConnectionStream.cs +++ b/mcs/class/System/System.Net/WebConnectionStream.cs @@ -3,9 +3,11 @@ // // Authors: // Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Martin Baulig // // (C) 2003 Ximian, Inc (http://www.ximian.com) // (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (c) 2017 Xamarin Inc. (http://www.xamarin.com) // // @@ -28,127 +30,53 @@ // 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.Text; using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; +using System.Net.Sockets; namespace System.Net { - class WebConnectionStream : Stream + abstract class WebConnectionStream : Stream { - static byte [] crlf = new byte [] { 13, 10 }; - bool isRead; - WebConnection cnc; - HttpWebRequest request; - byte [] readBuffer; - int readBufferOffset; - int readBufferSize; - int stream_length; // -1 when CL not present - long contentLength; - long totalRead; - internal long totalWritten; - bool nextReadCalled; - int pendingReads; - int pendingWrites; - ManualResetEvent pending; - bool allowBuffering; - bool sendChunked; - MemoryStream writeBuffer; - bool requestWritten; - byte [] headers; + protected bool closed; bool disposed; - bool headersSent; object locker = new object (); - bool initRead; - bool read_eof; - bool complete_request_written; int read_timeout; int write_timeout; - AsyncCallback cb_wrapper; // Calls to ReadCallbackWrapper or WriteCallbacWrapper internal bool IgnoreIOErrors; - public WebConnectionStream (WebConnection cnc, WebConnectionData data) - { - if (data == null) - throw new InvalidOperationException ("data was not initialized"); - if (data.Headers == null) - throw new InvalidOperationException ("data.Headers was not initialized"); - if (data.request == null) - throw new InvalidOperationException ("data.request was not initialized"); - isRead = true; - cb_wrapper = new AsyncCallback (ReadCallbackWrapper); - pending = new ManualResetEvent (true); - this.request = data.request; - read_timeout = request.ReadWriteTimeout; + protected WebConnectionStream (WebConnection cnc, WebOperation operation, Stream stream) + { + Connection = cnc; + Operation = operation; + Request = operation.Request; + InnerStream = stream; + + read_timeout = Request.ReadWriteTimeout; write_timeout = read_timeout; - this.cnc = cnc; - string contentType = data.Headers ["Transfer-Encoding"]; - bool chunkedRead = (contentType != null && contentType.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1); - string clength = data.Headers ["Content-Length"]; - if (!chunkedRead && clength != null && clength != "") { - try { - contentLength = Int32.Parse (clength); - if (contentLength == 0 && !IsNtlmAuth ()) { - ReadAll (); - } - } catch { - contentLength = Int64.MaxValue; - } - } else { - contentLength = Int64.MaxValue; - } - - // Negative numbers? - if (!Int32.TryParse (clength, out stream_length)) - stream_length = -1; - } - - public WebConnectionStream (WebConnection cnc, HttpWebRequest request) - { - read_timeout = request.ReadWriteTimeout; - write_timeout = read_timeout; - isRead = false; - cb_wrapper = new AsyncCallback (WriteCallbackWrapper); - this.cnc = cnc; - this.request = request; - allowBuffering = request.InternalAllowBuffering; - sendChunked = request.SendChunked; - if (sendChunked) - pending = new ManualResetEvent (true); - else if (allowBuffering) - writeBuffer = new MemoryStream (); - } - - bool CheckAuthHeader (string headerName) - { - var authHeader = cnc.Data.Headers [headerName]; - return (authHeader != null && authHeader.IndexOf ("NTLM", StringComparison.Ordinal) != -1); - } - - bool IsNtlmAuth () - { - bool isProxy = (request.Proxy != null && !request.Proxy.IsBypassed (request.Address)); - if (isProxy && CheckAuthHeader ("Proxy-Authenticate")) - return true; - return CheckAuthHeader ("WWW-Authenticate"); - } - - internal void CheckResponseInBuffer () - { - if (contentLength > 0 && (readBufferSize - readBufferOffset) >= contentLength) { - if (!IsNtlmAuth ()) - ReadAll (); - } } internal HttpWebRequest Request { - get { return request; } + get; } internal WebConnection Connection { - get { return cnc; } + get; } + + internal WebOperation Operation { + get; + } + + internal ServicePoint ServicePoint => Connection.ServicePoint; + + internal Stream InnerStream { + get; + } + public override bool CanTimeout { get { return true; } } @@ -177,579 +105,133 @@ namespace System.Net } } - internal bool CompleteRequestWritten { - get { return complete_request_written; } - } - - internal bool SendChunked { - set { sendChunked = value; } - } - - internal byte [] ReadBuffer { - set { readBuffer = value; } - } - - internal int ReadBufferOffset { - set { readBufferOffset = value; } - } - - internal int ReadBufferSize { - set { readBufferSize = value; } - } - - internal byte[] WriteBuffer { - get { return writeBuffer.GetBuffer (); } - } - - internal int WriteBufferLength { - get { return writeBuffer != null ? (int) writeBuffer.Length : (-1); } - } - - internal void ForceCompletion () + protected Exception GetException (Exception e) { - if (!nextReadCalled) { - if (contentLength == Int64.MaxValue) - contentLength = 0; - nextReadCalled = true; - cnc.NextRead (); - } + e = HttpWebRequest.FlattenException (e); + if (e is WebException) + return e; + if (Operation.Aborted || e is OperationCanceledException || e is ObjectDisposedException) + return HttpWebRequest.CreateRequestAbortedException (); + return e; } - internal void CheckComplete () + public override int Read (byte[] buffer, int offset, int count) { - bool nrc = nextReadCalled; - if (!nrc && readBufferSize - readBufferOffset == contentLength) { - nextReadCalled = true; - cnc.NextRead (); - } - } - - internal void ReadAll () - { - if (!isRead || read_eof || totalRead >= contentLength || nextReadCalled) { - if (isRead && !nextReadCalled) { - nextReadCalled = true; - cnc.NextRead (); - } - return; - } - - if (!pending.WaitOne (ReadTimeout)) - throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout); - lock (locker) { - if (totalRead >= contentLength) - return; - - byte [] b = null; - int diff = readBufferSize - readBufferOffset; - int new_size; - - if (contentLength == Int64.MaxValue) { - MemoryStream ms = new MemoryStream (); - byte [] buffer = null; - if (readBuffer != null && diff > 0) { - ms.Write (readBuffer, readBufferOffset, diff); - if (readBufferSize >= 8192) - buffer = readBuffer; - } - - if (buffer == null) - buffer = new byte [8192]; - - int read; - while ((read = cnc.Read (request, buffer, 0, buffer.Length)) != 0) - ms.Write (buffer, 0, read); - - b = ms.GetBuffer (); - new_size = (int) ms.Length; - contentLength = new_size; - } else { - new_size = (int) (contentLength - totalRead); - b = new byte [new_size]; - if (readBuffer != null && diff > 0) { - if (diff > new_size) - diff = new_size; - - Buffer.BlockCopy (readBuffer, readBufferOffset, b, 0, diff); - } - - int remaining = new_size - diff; - int r = -1; - while (remaining > 0 && r != 0) { - r = cnc.Read (request, b, diff, remaining); - remaining -= r; - diff += r; - } - } - - readBuffer = b; - readBufferOffset = 0; - readBufferSize = new_size; - totalRead = 0; - nextReadCalled = true; - } - - cnc.NextRead (); - } - - void WriteCallbackWrapper (IAsyncResult r) - { - WebAsyncResult result = r as WebAsyncResult; - if (result != null && result.AsyncWriteAll) - return; - - if (r.AsyncState != null) { - result = (WebAsyncResult) r.AsyncState; - result.InnerAsyncResult = r; - result.DoCallback (); - } else { - try { - EndWrite (r); - } catch { - } - } - } - - void ReadCallbackWrapper (IAsyncResult r) - { - WebAsyncResult result; - if (r.AsyncState != null) { - result = (WebAsyncResult) r.AsyncState; - result.InnerAsyncResult = r; - result.DoCallback (); - } else { - try { - EndRead (r); - } catch { - } - } - } - - public override int Read (byte [] buffer, int offset, int size) - { - AsyncCallback cb = cb_wrapper; - WebAsyncResult res = (WebAsyncResult) BeginRead (buffer, offset, size, cb, null); - if (!res.IsCompleted && !res.WaitUntilComplete (ReadTimeout, false)) { - nextReadCalled = true; - cnc.Close (true); - throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout); - } - - return EndRead (res); - } - - public override IAsyncResult BeginRead (byte [] buffer, int offset, int size, - AsyncCallback cb, object state) - { - if (!isRead) - throw new NotSupportedException ("this stream does not allow reading"); + if (!CanRead) + throw new NotSupportedException (SR.net_writeonlystream); + Operation.ThrowIfClosedOrDisposed (); if (buffer == null) - throw new ArgumentNullException ("buffer"); + throw new ArgumentNullException (nameof (buffer)); int length = buffer.Length; if (offset < 0 || length < offset) - throw new ArgumentOutOfRangeException ("offset"); - if (size < 0 || (length - offset) < size) - throw new ArgumentOutOfRangeException ("size"); + throw new ArgumentOutOfRangeException (nameof (offset)); + if (count < 0 || (length - offset) < count) + throw new ArgumentOutOfRangeException (nameof (count)); - lock (locker) { - pendingReads++; - pending.Reset (); + try { + return ReadAsync (buffer, offset, count, CancellationToken.None).Result; + } catch (Exception e) { + throw GetException (e); } + } - WebAsyncResult result = new WebAsyncResult (cb, state, buffer, offset, size); - if (totalRead >= contentLength) { - result.SetCompleted (true, -1); - result.DoCallback (); - return result; - } - - int remaining = readBufferSize - readBufferOffset; - if (remaining > 0) { - int copy = (remaining > size) ? size : remaining; - Buffer.BlockCopy (readBuffer, readBufferOffset, buffer, offset, copy); - readBufferOffset += copy; - offset += copy; - size -= copy; - totalRead += copy; - if (size == 0 || totalRead >= contentLength) { - result.SetCompleted (true, copy); - result.DoCallback (); - return result; - } - result.NBytes = copy; - } + public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, + AsyncCallback cb, object state) + { + if (!CanRead) + throw new NotSupportedException (SR.net_writeonlystream); + Operation.ThrowIfClosedOrDisposed (); - if (cb != null) - cb = cb_wrapper; + if (buffer == null) + throw new ArgumentNullException (nameof (buffer)); - if (contentLength != Int64.MaxValue && contentLength - totalRead < size) - size = (int)(contentLength - totalRead); + int length = buffer.Length; + if (offset < 0 || length < offset) + throw new ArgumentOutOfRangeException (nameof (offset)); + if (count < 0 || (length - offset) < count) + throw new ArgumentOutOfRangeException (nameof (count)); - if (!read_eof) { - result.InnerAsyncResult = cnc.BeginRead (request, buffer, offset, size, cb, result); - } else { - result.SetCompleted (true, result.NBytes); - result.DoCallback (); - } - return result; + var task = ReadAsync (buffer, offset, count, CancellationToken.None); + return TaskToApm.Begin (task, cb, state); } public override int EndRead (IAsyncResult r) { - WebAsyncResult result = (WebAsyncResult) r; - if (result.EndCalled) { - int xx = result.NBytes; - return (xx >= 0) ? xx : 0; - } - - result.EndCalled = true; - - if (!result.IsCompleted) { - int nbytes = -1; - try { - nbytes = cnc.EndRead (request, result); - } catch (Exception exc) { - lock (locker) { - pendingReads--; - if (pendingReads == 0) - pending.Set (); - } - - nextReadCalled = true; - cnc.Close (true); - result.SetCompleted (false, exc); - result.DoCallback (); - throw; - } - - if (nbytes < 0) { - nbytes = 0; - read_eof = true; - } - - totalRead += nbytes; - result.SetCompleted (false, nbytes + result.NBytes); - result.DoCallback (); - if (nbytes == 0) - contentLength = totalRead; - } - - lock (locker) { - pendingReads--; - if (pendingReads == 0) - pending.Set (); - } - - if (totalRead >= contentLength && !nextReadCalled) - ReadAll (); - - int nb = result.NBytes; - return (nb >= 0) ? nb : 0; - } - - void WriteAsyncCB (IAsyncResult r) - { - WebAsyncResult result = (WebAsyncResult) r.AsyncState; - result.InnerAsyncResult = null; + if (r == null) + throw new ArgumentNullException (nameof (r)); try { - cnc.EndWrite (request, true, r); - result.SetCompleted (false, 0); - if (!initRead) { - initRead = true; - cnc.InitRead (); - } + return TaskToApm.End (r); } catch (Exception e) { - KillBuffer (); - nextReadCalled = true; - cnc.Close (true); - if (e is System.Net.Sockets.SocketException) - e = new IOException ("Error writing request", e); - result.SetCompleted (false, e); + throw GetException (e); } - - if (allowBuffering && !sendChunked && request.ContentLength > 0 && totalWritten == request.ContentLength) - complete_request_written = true; - - result.DoCallback (); } - public override IAsyncResult BeginWrite (byte [] buffer, int offset, int size, - AsyncCallback cb, object state) + public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, + AsyncCallback cb, object state) { - if (request.Aborted) - throw new WebException ("The request was canceled.", WebExceptionStatus.RequestCanceled); - - if (isRead) - throw new NotSupportedException ("this stream does not allow writing"); - if (buffer == null) - throw new ArgumentNullException ("buffer"); + throw new ArgumentNullException (nameof (buffer)); int length = buffer.Length; if (offset < 0 || length < offset) - throw new ArgumentOutOfRangeException ("offset"); - if (size < 0 || (length - offset) < size) - throw new ArgumentOutOfRangeException ("size"); + throw new ArgumentOutOfRangeException (nameof (offset)); + if (count < 0 || (length - offset) < count) + throw new ArgumentOutOfRangeException (nameof (count)); - if (sendChunked) { - lock (locker) { - pendingWrites++; - pending.Reset (); - } - } + if (!CanWrite) + throw new NotSupportedException (SR.net_readonlystream); + Operation.ThrowIfClosedOrDisposed (); - WebAsyncResult result = new WebAsyncResult (cb, state); - AsyncCallback callback = new AsyncCallback (WriteAsyncCB); - - if (sendChunked) { - requestWritten = true; - - string cSize = String.Format ("{0:X}\r\n", size); - byte[] head = Encoding.ASCII.GetBytes (cSize); - int chunkSize = 2 + size + head.Length; - byte[] newBuffer = new byte [chunkSize]; - Buffer.BlockCopy (head, 0, newBuffer, 0, head.Length); - Buffer.BlockCopy (buffer, offset, newBuffer, head.Length, size); - Buffer.BlockCopy (crlf, 0, newBuffer, head.Length + size, crlf.Length); - - if (allowBuffering) { - if (writeBuffer == null) - writeBuffer = new MemoryStream (); - writeBuffer.Write (buffer, offset, size); - totalWritten += size; - } - - buffer = newBuffer; - offset = 0; - size = chunkSize; - } else { - CheckWriteOverflow (request.ContentLength, totalWritten, size); - - if (allowBuffering) { - if (writeBuffer == null) - writeBuffer = new MemoryStream (); - writeBuffer.Write (buffer, offset, size); - totalWritten += size; - - if (request.ContentLength <= 0 || totalWritten < request.ContentLength) { - result.SetCompleted (true, 0); - result.DoCallback (); - return result; - } - - result.AsyncWriteAll = true; - requestWritten = true; - buffer = writeBuffer.GetBuffer (); - offset = 0; - size = (int)totalWritten; - } - } - - try { - result.InnerAsyncResult = cnc.BeginWrite (request, buffer, offset, size, callback, result); - if (result.InnerAsyncResult == null) { - if (!result.IsCompleted) - result.SetCompleted (true, 0); - result.DoCallback (); - } - } catch (Exception) { - if (!IgnoreIOErrors) - throw; - result.SetCompleted (true, 0); - result.DoCallback (); - } - totalWritten += size; - return result; - } - - void CheckWriteOverflow (long contentLength, long totalWritten, long size) - { - if (contentLength == -1) - return; - - long avail = contentLength - totalWritten; - if (size > avail) { - KillBuffer (); - nextReadCalled = true; - cnc.Close (true); - throw new ProtocolViolationException ( - "The number of bytes to be written is greater than " + - "the specified ContentLength."); - } + var task = WriteAsync (buffer, offset, count, CancellationToken.None); + return TaskToApm.Begin (task, cb, state); } public override void EndWrite (IAsyncResult r) { if (r == null) - throw new ArgumentNullException ("r"); + throw new ArgumentNullException (nameof (r)); - WebAsyncResult result = r as WebAsyncResult; - if (result == null) - throw new ArgumentException ("Invalid IAsyncResult"); - - if (result.EndCalled) - return; - - if (sendChunked) { - lock (locker) { - pendingWrites--; - if (pendingWrites <= 0) - pending.Set (); - } + try { + TaskToApm.End (r); + } catch (Exception e) { + throw GetException (e); } - - result.EndCalled = true; - if (result.AsyncWriteAll) { - result.WaitUntilComplete (); - if (result.GotException) - throw result.Exception; - return; - } - - if (allowBuffering && !sendChunked) - return; - - if (result.GotException) - throw result.Exception; } - - public override void Write (byte [] buffer, int offset, int size) - { - AsyncCallback cb = cb_wrapper; - WebAsyncResult res = (WebAsyncResult) BeginWrite (buffer, offset, size, cb, null); - if (!res.IsCompleted && !res.WaitUntilComplete (WriteTimeout, false)) { - KillBuffer (); - nextReadCalled = true; - cnc.Close (true); - throw new IOException ("Write timed out."); - } - EndWrite (res); + public override void Write (byte[] buffer, int offset, int count) + { + if (buffer == null) + throw new ArgumentNullException (nameof (buffer)); + + int length = buffer.Length; + if (offset < 0 || length < offset) + throw new ArgumentOutOfRangeException (nameof (offset)); + if (count < 0 || (length - offset) < count) + throw new ArgumentOutOfRangeException (nameof (count)); + + if (!CanWrite) + throw new NotSupportedException (SR.net_readonlystream); + Operation.ThrowIfClosedOrDisposed (); + + try { + WriteAsync (buffer, offset, count).Wait (); + } catch (Exception e) { + throw GetException (e); + } } public override void Flush () { } - internal void SetHeadersAsync (bool setInternalLength, SimpleAsyncCallback callback) + public override Task FlushAsync (CancellationToken cancellationToken) { - SimpleAsyncResult.Run (r => SetHeadersAsync (r, setInternalLength), callback); - } - - bool SetHeadersAsync (SimpleAsyncResult result, bool setInternalLength) - { - if (headersSent) - return false; - - string method = request.Method; - bool no_writestream = (method == "GET" || method == "CONNECT" || method == "HEAD" || - method == "TRACE"); - bool webdav = (method == "PROPFIND" || method == "PROPPATCH" || method == "MKCOL" || - method == "COPY" || method == "MOVE" || method == "LOCK" || - method == "UNLOCK"); - - if (setInternalLength && !no_writestream && writeBuffer != null) - request.InternalContentLength = writeBuffer.Length; - - bool has_content = !no_writestream && (writeBuffer == null || request.ContentLength > -1); - if (!(sendChunked || has_content || no_writestream || webdav)) - return false; - - headersSent = true; - headers = request.GetRequestHeaders (); - - var innerResult = cnc.BeginWrite (request, headers, 0, headers.Length, r => { - try { - cnc.EndWrite (request, true, r); - if (!initRead) { - initRead = true; - cnc.InitRead (); - } - var cl = request.ContentLength; - if (!sendChunked && cl == 0) - requestWritten = true; - result.SetCompleted (false); - } catch (WebException e) { - result.SetCompleted (false, e); - } catch (Exception e) { - result.SetCompleted (false, new WebException ("Error writing headers", WebExceptionStatus.SendFailure, WebExceptionInternalStatus.RequestFatal, e)); - } - }, null); - - return innerResult != null; - } - - internal bool RequestWritten { - get { return requestWritten; } - } - - internal SimpleAsyncResult WriteRequestAsync (SimpleAsyncCallback callback) - { - var result = WriteRequestAsync (callback); - try { - if (!WriteRequestAsync (result)) - result.SetCompleted (true); - } catch (Exception ex) { - result.SetCompleted (true, ex); - } - return result; - } - - internal bool WriteRequestAsync (SimpleAsyncResult result) - { - if (requestWritten) - return false; - - requestWritten = true; - if (sendChunked || !allowBuffering || writeBuffer == null) - return false; - - // Keep the call for a potential side-effect of GetBuffer - var bytes = writeBuffer.GetBuffer (); - var length = (int)writeBuffer.Length; - if (request.ContentLength != -1 && request.ContentLength < length) { - nextReadCalled = true; - cnc.Close (true); - throw new WebException ("Specified Content-Length is less than the number of bytes to write", null, - WebExceptionStatus.ServerProtocolViolation, null); - } - - SetHeadersAsync (true, inner => { - if (inner.GotException) { - result.SetCompleted (inner.CompletedSynchronouslyPeek, inner.Exception); - return; - } - - if (cnc.Data.StatusCode != 0 && cnc.Data.StatusCode != 100) { - result.SetCompleted (inner.CompletedSynchronouslyPeek); - return; - } - - if (!initRead) { - initRead = true; - cnc.InitRead (); - } - - if (length == 0) { - complete_request_written = true; - result.SetCompleted (inner.CompletedSynchronouslyPeek); - return; - } - - cnc.BeginWrite (request, bytes, 0, length, r => { - try { - complete_request_written = cnc.EndWrite (request, false, r); - result.SetCompleted (false); - } catch (Exception exc) { - result.SetCompleted (false, exc); - } - }, null); - }); - - return true; + return cancellationToken.IsCancellationRequested ? + Task.FromCancellation (cancellationToken) : + Task.CompletedTask; } internal void InternalClose () @@ -757,103 +239,26 @@ namespace System.Net disposed = true; } - internal bool GetResponseOnClose { - get; set; - } + protected abstract void Close_internal (ref bool disposed); public override void Close () { - if (GetResponseOnClose) { - if (disposed) - return; - disposed = true; - var response = (HttpWebResponse)request.GetResponse (); - response.ReadAll (); - response.Close (); - return; - } - - if (sendChunked) { - if (disposed) - return; - disposed = true; - if (!pending.WaitOne (WriteTimeout)) { - throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout); - } - byte [] chunk = Encoding.ASCII.GetBytes ("0\r\n\r\n"); - string err_msg = null; - cnc.Write (request, chunk, 0, chunk.Length, ref err_msg); - return; - } - - if (isRead) { - if (!nextReadCalled) { - CheckComplete (); - // If we have not read all the contents - if (!nextReadCalled) { - nextReadCalled = true; - cnc.Close (true); - } - } - return; - } else if (!allowBuffering) { - complete_request_written = true; - if (!initRead) { - initRead = true; - cnc.InitRead (); - } - return; - } - - if (disposed || requestWritten) - return; - - long length = request.ContentLength; - - if (!sendChunked && length != -1 && totalWritten != length) { - IOException io = new IOException ("Cannot close the stream until all bytes are written"); - nextReadCalled = true; - cnc.Close (true); - throw new WebException ("Request was cancelled.", WebExceptionStatus.RequestCanceled, WebExceptionInternalStatus.RequestFatal, io); - } - - // Commented out the next line to fix xamarin bug #1512 - //WriteRequest (); - disposed = true; - } - - internal void KillBuffer () - { - writeBuffer = null; + Close_internal (ref disposed); } public override long Seek (long a, SeekOrigin b) { throw new NotSupportedException (); } - + public override void SetLength (long a) { throw new NotSupportedException (); } - + public override bool CanSeek { - get { return false; } - } - - public override bool CanRead { - get { return !disposed && isRead; } - } - - public override bool CanWrite { - get { return !disposed && !isRead; } - } - - public override long Length { get { - if (!isRead) - throw new NotSupportedException (); - return stream_length; + return false; } } diff --git a/mcs/class/System/System.Net/WebConnectionTunnel.cs b/mcs/class/System/System.Net/WebConnectionTunnel.cs new file mode 100644 index 0000000000..826d59df92 --- /dev/null +++ b/mcs/class/System/System.Net/WebConnectionTunnel.cs @@ -0,0 +1,271 @@ +// +// System.Net.WebConnectionTunnel +// +// Authors: +// Gonzalo Paniagua Javier (gonzalo@ximian.com) +// Martin Baulig +// +// (C) 2003 Ximian, Inc (http://www.ximian.com) +// Copyright (c) 2017 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.IO; +using System.Collections; +using System.Net.Sockets; +using System.Security.Cryptography.X509Certificates; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; +using System.Diagnostics; +using Mono.Net.Security; + +namespace System.Net +{ + class WebConnectionTunnel + { + public HttpWebRequest Request { + get; + } + + public Uri ConnectUri { + get; + } + + public WebConnectionTunnel (HttpWebRequest request, Uri connectUri) + { + Request = request; + ConnectUri = connectUri; + } + + enum NtlmAuthState + { + None, + Challenge, + Response + } + + HttpWebRequest connectRequest; + NtlmAuthState ntlmAuthState; + + public bool Success { + get; + private set; + } + + public bool CloseConnection { + get; + private set; + } + + public int StatusCode { + get; + private set; + } + + public string StatusDescription { + get; + private set; + } + + public string[] Challenge { + get; + private set; + } + + public WebHeaderCollection Headers { + get; + private set; + } + + public Version ProxyVersion { + get; + private set; + } + + public byte[] Data { + get; + private set; + } + + internal async Task Initialize (Stream stream, CancellationToken cancellationToken) + { + StringBuilder sb = new StringBuilder (); + sb.Append ("CONNECT "); + sb.Append (Request.Address.Host); + sb.Append (':'); + sb.Append (Request.Address.Port); + sb.Append (" HTTP/"); + if (Request.ProtocolVersion == HttpVersion.Version11) + sb.Append ("1.1"); + else + sb.Append ("1.0"); + + sb.Append ("\r\nHost: "); + sb.Append (Request.Address.Authority); + + bool ntlm = false; + var challenge = Challenge; + Challenge = null; + var auth_header = Request.Headers["Proxy-Authorization"]; + bool have_auth = auth_header != null; + if (have_auth) { + sb.Append ("\r\nProxy-Authorization: "); + sb.Append (auth_header); + ntlm = auth_header.ToUpper ().Contains ("NTLM"); + } else if (challenge != null && StatusCode == 407) { + ICredentials creds = Request.Proxy.Credentials; + have_auth = true; + + if (connectRequest == null) { + // create a CONNECT request to use with Authenticate + connectRequest = (HttpWebRequest)WebRequest.Create ( + ConnectUri.Scheme + "://" + ConnectUri.Host + ":" + ConnectUri.Port + "/"); + connectRequest.Method = "CONNECT"; + connectRequest.Credentials = creds; + } + + if (creds != null) { + for (int i = 0; i < challenge.Length; i++) { + var auth = AuthenticationManager.Authenticate (challenge[i], connectRequest, creds); + if (auth == null) + continue; + ntlm = (auth.ModuleAuthenticationType == "NTLM"); + sb.Append ("\r\nProxy-Authorization: "); + sb.Append (auth.Message); + break; + } + } + } + + if (ntlm) { + sb.Append ("\r\nProxy-Connection: keep-alive"); + ntlmAuthState++; + } + + sb.Append ("\r\n\r\n"); + + StatusCode = 0; + byte[] connectBytes = Encoding.Default.GetBytes (sb.ToString ()); + await stream.WriteAsync (connectBytes, 0, connectBytes.Length, cancellationToken).ConfigureAwait (false); + + (Headers, Data, StatusCode) = await ReadHeaders (stream, cancellationToken).ConfigureAwait (false); + + if ((!have_auth || ntlmAuthState == NtlmAuthState.Challenge) && Headers != null && StatusCode == 407) { // Needs proxy auth + var connectionHeader = Headers["Connection"]; + if (!string.IsNullOrEmpty (connectionHeader) && connectionHeader.ToLower () == "close") { + // The server is requesting that this connection be closed + CloseConnection = true; + } + + Challenge = Headers.GetValues ("Proxy-Authenticate"); + Success = false; + } else { + Success = StatusCode == 200 && Headers != null; + } + + if (Challenge == null && (StatusCode == 401 || StatusCode == 407)) { + var response = new HttpWebResponse (ConnectUri, "CONNECT", (HttpStatusCode)StatusCode, Headers); + throw new WebException ( + StatusCode == 407 ? "(407) Proxy Authentication Required" : "(401) Unauthorized", + null, WebExceptionStatus.ProtocolError, response); + } + } + + async Task<(WebHeaderCollection, byte[], int)> ReadHeaders (Stream stream, CancellationToken cancellationToken) + { + byte[] retBuffer = null; + int status = 200; + + byte[] buffer = new byte[1024]; + MemoryStream ms = new MemoryStream (); + + while (true) { + cancellationToken.ThrowIfCancellationRequested (); + int n = await stream.ReadAsync (buffer, 0, 1024, cancellationToken).ConfigureAwait (false); + if (n == 0) + throw WebConnection.GetException (WebExceptionStatus.ServerProtocolViolation, null); + + ms.Write (buffer, 0, n); + int start = 0; + string str = null; + bool gotStatus = false; + WebHeaderCollection headers = new WebHeaderCollection (); + while (WebConnection.ReadLine (ms.GetBuffer (), ref start, (int)ms.Length, ref str)) { + if (str == null) { + int contentLen; + var clengthHeader = headers["Content-Length"]; + if (string.IsNullOrEmpty (clengthHeader) || !int.TryParse (clengthHeader, out contentLen)) + contentLen = 0; + + if (ms.Length - start - contentLen > 0) { + // we've read more data than the response header and conents, + // give back extra data to the caller + retBuffer = new byte[ms.Length - start - contentLen]; + Buffer.BlockCopy (ms.GetBuffer (), start + contentLen, retBuffer, 0, retBuffer.Length); + } else { + // haven't read in some or all of the contents for the response, do so now + FlushContents (stream, contentLen - (int)(ms.Length - start)); + } + + return (headers, retBuffer, status); + } + + if (gotStatus) { + headers.Add (str); + continue; + } + + string[] parts = str.Split (' '); + if (parts.Length < 2) + throw WebConnection.GetException (WebExceptionStatus.ServerProtocolViolation, null); + + if (String.Compare (parts[0], "HTTP/1.1", true) == 0) + ProxyVersion = HttpVersion.Version11; + else if (String.Compare (parts[0], "HTTP/1.0", true) == 0) + ProxyVersion = HttpVersion.Version10; + else + throw WebConnection.GetException (WebExceptionStatus.ServerProtocolViolation, null); + + status = (int)UInt32.Parse (parts[1]); + if (parts.Length >= 3) + StatusDescription = String.Join (" ", parts, 2, parts.Length - 2); + + gotStatus = true; + } + } + } + + void FlushContents (Stream stream, int contentLength) + { + while (contentLength > 0) { + byte[] contentBuffer = new byte[contentLength]; + int bytesRead = stream.Read (contentBuffer, 0, contentLength); + if (bytesRead > 0) { + contentLength -= bytesRead; + } else { + break; + } + } + } + } +} \ No newline at end of file diff --git a/mcs/class/System/System.Net/WebOperation.cs b/mcs/class/System/System.Net/WebOperation.cs new file mode 100644 index 0000000000..b3fb42c226 --- /dev/null +++ b/mcs/class/System/System.Net/WebOperation.cs @@ -0,0 +1,349 @@ +// +// WebOperation.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2017 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.IO; +using System.Collections; +using System.Net.Sockets; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; +using System.Diagnostics; + +namespace System.Net +{ + class WebOperation + { + public HttpWebRequest Request { + get; + } + + public WebConnection Connection { + get; + private set; + } + + public ServicePoint ServicePoint { + get; + private set; + } + + public BufferOffsetSize WriteBuffer { + get; + } + + public bool IsNtlmChallenge { + get; + } + +#if MONO_WEB_DEBUG + static int nextID; + internal readonly int ID = ++nextID; + string ME => $"WO({ID},{Connection?.ID ?? -1})"; +#else + internal readonly int ID; + string ME; +#endif + + public WebOperation (HttpWebRequest request, BufferOffsetSize writeBuffer, bool isNtlmChallenge, CancellationToken cancellationToken) + { + Request = request; + WriteBuffer = writeBuffer; + IsNtlmChallenge = isNtlmChallenge; + cts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken); + requestTask = new WebCompletionSource (); + requestWrittenTask = new WebCompletionSource (); + responseTask = new WebCompletionSource (); + finishedTask = new WebCompletionSource<(bool, WebOperation)> (); + } + + CancellationTokenSource cts; + WebCompletionSource requestTask; + WebCompletionSource requestWrittenTask; + WebCompletionSource responseTask; + WebCompletionSource<(bool, WebOperation)> finishedTask; + WebRequestStream writeStream; + WebResponseStream responseStream; + ExceptionDispatchInfo disposedInfo; + ExceptionDispatchInfo closedInfo; + WebOperation priorityRequest; + int requestSent; + int finished; + + public bool Aborted { + get { + if (disposedInfo != null || Request.Aborted) + return true; + if (cts != null && cts.IsCancellationRequested) + return true; + return false; + } + } + + public bool Closed { + get { + return Aborted || closedInfo != null; + } + } + + public void Abort () + { + var (exception, disposed) = SetDisposed (ref disposedInfo); + if (!disposed) + return; + cts?.Cancel (); + SetCanceled (); + Close (); + } + + public void Close () + { + var (exception, closed) = SetDisposed (ref closedInfo); + if (!closed) + return; + + var stream = Interlocked.Exchange (ref writeStream, null); + if (stream != null) { + try { + stream.Close (); + } catch { } + } + } + + void SetCanceled () + { + WebConnection.Debug ($"{ME} SET CANCELED"); + + var error = new OperationCanceledException (); + requestTask.TrySetCanceled (error); + requestWrittenTask.TrySetCanceled (error); + responseTask.TrySetCanceled (error); + Finish (false, error); + } + + void SetError (Exception error) + { + WebConnection.Debug ($"{ME} SET ERROR: error={error.GetType ().Name}"); + + requestTask.TrySetException (error); + requestWrittenTask.TrySetException (error); + responseTask.TrySetException (error); + Finish (false, error); + } + + (ExceptionDispatchInfo, bool) SetDisposed (ref ExceptionDispatchInfo field) + { + var wexc = new WebException (SR.GetString (SR.net_webstatus_RequestCanceled), WebExceptionStatus.RequestCanceled); + var exception = ExceptionDispatchInfo.Capture (wexc); + var old = Interlocked.CompareExchange (ref field, exception, null); + return (old ?? exception, old == null); + } + + internal ExceptionDispatchInfo CheckDisposed (CancellationToken cancellationToken) + { + if (Aborted || cancellationToken.IsCancellationRequested) + return CheckThrowDisposed (false, ref disposedInfo); + return null; + } + + internal void ThrowIfDisposed () + { + ThrowIfDisposed (CancellationToken.None); + } + + internal void ThrowIfDisposed (CancellationToken cancellationToken) + { + if (Aborted || cancellationToken.IsCancellationRequested) + CheckThrowDisposed (true, ref disposedInfo); + } + + internal void ThrowIfClosedOrDisposed () + { + ThrowIfClosedOrDisposed (CancellationToken.None); + } + + internal void ThrowIfClosedOrDisposed (CancellationToken cancellationToken) + { + if (Closed || cancellationToken.IsCancellationRequested) + CheckThrowDisposed (true, ref closedInfo); + } + + ExceptionDispatchInfo CheckThrowDisposed (bool throwIt, ref ExceptionDispatchInfo field) + { + var (exception, disposed) = SetDisposed (ref field); + if (disposed) + cts?.Cancel (); + if (throwIt) + exception.Throw (); + return exception; + } + + internal void RegisterRequest (ServicePoint servicePoint, WebConnection connection) + { + if (servicePoint == null) + throw new ArgumentNullException (nameof (servicePoint)); + if (connection == null) + throw new ArgumentNullException (nameof (connection)); + + lock (this) { + if (Interlocked.CompareExchange (ref requestSent, 1, 0) != 0) + throw new InvalidOperationException ("Invalid nested call."); + ServicePoint = servicePoint; + Connection = connection; + } + + cts.Token.Register (() => { + Request.FinishedReading = true; + SetDisposed (ref disposedInfo); + }); + } + + public void SetPriorityRequest (WebOperation operation) + { + lock (this) { + if (requestSent != 1 || ServicePoint == null || finished != 0) + throw new InvalidOperationException ("Should never happen."); + if (Interlocked.CompareExchange (ref priorityRequest, operation, null) != null) + throw new InvalidOperationException ("Invalid nested request."); + } + } + + public async Task GetRequestStream () + { + return await requestTask.WaitForCompletion ().ConfigureAwait (false); + } + + internal Task GetRequestStreamInternal () + { + return requestTask.WaitForCompletion (); + } + + public Task WaitUntilRequestWritten () + { + return requestWrittenTask.WaitForCompletion (); + } + + public WebRequestStream WriteStream { + get { + ThrowIfDisposed (); + return writeStream; + } + } + + public Task GetResponseStream () + { + return responseTask.WaitForCompletion (); + } + + internal WebCompletionSource<(bool, WebOperation)> Finished => finishedTask; + + internal async void Run () + { + try { + WebConnection.Debug ($"{ME} RUN"); + + ThrowIfClosedOrDisposed (); + + var requestStream = await Connection.InitConnection (this, cts.Token).ConfigureAwait (false); + + ThrowIfClosedOrDisposed (); + + writeStream = requestStream; + + await requestStream.Initialize (cts.Token).ConfigureAwait (false); + + ThrowIfClosedOrDisposed (); + + requestTask.TrySetCompleted (requestStream); + + var stream = new WebResponseStream (requestStream); + responseStream = stream; + + await stream.InitReadAsync (cts.Token).ConfigureAwait (false); + + WebConnection.Debug ($"{ME} RUN COMPLETE"); + + responseTask.TrySetCompleted (stream); + } catch (OperationCanceledException) { + WebConnection.Debug ($"{ME} RUN CANCELED"); + SetCanceled (); + } catch (Exception e) { + WebConnection.Debug ($"{ME} RUN ERROR: {e.GetType ().Name}"); + SetError (e); + } + } + + internal void CompleteRequestWritten (WebRequestStream stream, Exception error = null) + { + WebConnection.Debug ($"{ME} COMPLETE REQUEST WRITTEN: {error != null}"); + + if (error != null) + SetError (error); + else + requestWrittenTask.TrySetCompleted (stream); + } + + internal void Finish (bool ok, Exception error = null) + { + if (Interlocked.CompareExchange (ref finished, 1, 0) != 0) + return; + +#if MONO_WEB_DEBUG + var me = $"{ME} FINISH"; +#else + string me = null; +#endif + WebConnection.Debug ($"{me}: ok={ok} error={error?.GetType ()}"); + + WebResponseStream stream; + WebOperation next; + + lock (this) { + stream = Interlocked.Exchange (ref responseStream, null); + next = Interlocked.Exchange (ref priorityRequest, null); + Request.FinishedReading = true; + } + + if (error != null) { + if (next != null) + next.SetError (error); + WebConnection.Debug ($"{me} SET ERROR: {error.GetType ().Name}"); + finishedTask.TrySetException (error); + return; + } + + WebConnection.Debug ($"{me}: ok={ok} stream={stream != null} next={next != null}"); + + var keepAlive = !Aborted && ok && (stream?.KeepAlive ?? false); + if (next != null && next.Aborted) { + next = null; + keepAlive = false; + } + + finishedTask.TrySetCompleted ((keepAlive, next)); + + WebConnection.Debug ($"{me} DONE: {keepAlive} next={next?.ID}"); + } + } +} diff --git a/mcs/class/System/System.Net/WebRequestStream.cs b/mcs/class/System/System.Net/WebRequestStream.cs new file mode 100644 index 0000000000..3c43b92003 --- /dev/null +++ b/mcs/class/System/System.Net/WebRequestStream.cs @@ -0,0 +1,449 @@ +// +// WebRequestStream.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2017 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.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; +using System.Net.Sockets; + +namespace System.Net +{ + class WebRequestStream : WebConnectionStream + { + static byte[] crlf = new byte[] { 13, 10 }; + MemoryStream writeBuffer; + bool requestWritten; + bool allowBuffering; + bool sendChunked; + WebCompletionSource pendingWrite; + long totalWritten; + byte[] headers; + bool headersSent; + int completeRequestWritten; + int chunkTrailerWritten; + + internal readonly string ME; + + public WebRequestStream (WebConnection connection, WebOperation operation, + Stream stream, WebConnectionTunnel tunnel) + : base (connection, operation, stream) + { + allowBuffering = operation.Request.InternalAllowBuffering; + sendChunked = operation.Request.SendChunked && operation.WriteBuffer == null; + if (!sendChunked && allowBuffering && operation.WriteBuffer == null) + writeBuffer = new MemoryStream (); + + KeepAlive = Request.KeepAlive; + if (tunnel?.ProxyVersion != null && tunnel?.ProxyVersion != HttpVersion.Version11) + KeepAlive = false; + +#if MONO_WEB_DEBUG + ME = $"WRQ(Cnc={Connection.ID}, Op={Operation.ID})"; +#endif + } + + public bool KeepAlive { + get; + } + + public override long Length { + get { + throw new NotSupportedException (); + } + } + + public override bool CanRead => false; + + public override bool CanWrite => true; + + internal bool SendChunked { + get { return sendChunked; } + set { sendChunked = value; } + } + + internal bool HasWriteBuffer { + get { + return Operation.WriteBuffer != null || writeBuffer != null; + } + } + + internal int WriteBufferLength { + get { + if (Operation.WriteBuffer != null) + return Operation.WriteBuffer.Size; + if (writeBuffer != null) + return (int)writeBuffer.Length; + return -1; + } + } + + internal BufferOffsetSize GetWriteBuffer () + { + if (Operation.WriteBuffer != null) + return Operation.WriteBuffer; + if (writeBuffer == null || writeBuffer.Length == 0) + return null; + var buffer = writeBuffer.GetBuffer (); + return new BufferOffsetSize (buffer, 0, (int)writeBuffer.Length, false); + } + + async Task FinishWriting (CancellationToken cancellationToken) + { + if (Interlocked.CompareExchange (ref completeRequestWritten, 1, 0) != 0) + return; + + WebConnection.Debug ($"{ME} FINISH WRITING: {sendChunked}"); + try { + Operation.ThrowIfClosedOrDisposed (cancellationToken); + if (sendChunked) + await WriteChunkTrailer_inner (cancellationToken).ConfigureAwait (false); + } catch (Exception ex) { + Operation.CompleteRequestWritten (this, ex); + throw; + } finally { + WebConnection.Debug ($"{ME} FINISH WRITING DONE"); + } + + Operation.CompleteRequestWritten (this); + } + + public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + if (buffer == null) + throw new ArgumentNullException (nameof (buffer)); + + int length = buffer.Length; + if (offset < 0 || length < offset) + throw new ArgumentOutOfRangeException (nameof (offset)); + if (count < 0 || (length - offset) < count) + throw new ArgumentOutOfRangeException (nameof (count)); + + WebConnection.Debug ($"{ME} WRITE ASYNC: {buffer.Length}/{offset}/{count}"); + + if (cancellationToken.IsCancellationRequested) + return Task.FromCanceled (cancellationToken); + + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + if (Operation.WriteBuffer != null) + throw new InvalidOperationException (); + + var completion = new WebCompletionSource (); + if (Interlocked.CompareExchange (ref pendingWrite, completion, null) != null) + throw new InvalidOperationException (SR.GetString (SR.net_repcall)); + + return WriteAsyncInner (buffer, offset, count, completion, cancellationToken); + } + + async Task WriteAsyncInner (byte[] buffer, int offset, int size, + WebCompletionSource completion, + CancellationToken cancellationToken) + { + try { + await ProcessWrite (buffer, offset, size, cancellationToken).ConfigureAwait (false); + + WebConnection.Debug ($"{ME} WRITE ASYNC #1: {allowBuffering} {sendChunked} {Request.ContentLength} {totalWritten}"); + + if (Request.ContentLength > 0 && totalWritten == Request.ContentLength) + await FinishWriting (cancellationToken); + + pendingWrite = null; + completion.TrySetCompleted (); + } catch (Exception ex) { + KillBuffer (); + closed = true; + + WebConnection.Debug ($"{ME} WRITE ASYNC EX: {ex.Message}"); + + var oldError = Operation.CheckDisposed (cancellationToken); + if (oldError != null) + ex = oldError.SourceException; + else if (ex is SocketException) + ex = new IOException ("Error writing request", ex); + + Operation.CompleteRequestWritten (this, ex); + + pendingWrite = null; + completion.TrySetException (ex); + + if (oldError != null) + oldError.Throw (); + throw; + } + } + + async Task ProcessWrite (byte[] buffer, int offset, int size, CancellationToken cancellationToken) + { + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + if (sendChunked) { + requestWritten = true; + + string cSize = String.Format ("{0:X}\r\n", size); + byte[] head = Encoding.ASCII.GetBytes (cSize); + int chunkSize = 2 + size + head.Length; + byte[] newBuffer = new byte[chunkSize]; + Buffer.BlockCopy (head, 0, newBuffer, 0, head.Length); + Buffer.BlockCopy (buffer, offset, newBuffer, head.Length, size); + Buffer.BlockCopy (crlf, 0, newBuffer, head.Length + size, crlf.Length); + + if (allowBuffering) { + if (writeBuffer == null) + writeBuffer = new MemoryStream (); + writeBuffer.Write (buffer, offset, size); + } + + totalWritten += size; + + buffer = newBuffer; + offset = 0; + size = chunkSize; + } else { + CheckWriteOverflow (Request.ContentLength, totalWritten, size); + + if (allowBuffering) { + if (writeBuffer == null) + writeBuffer = new MemoryStream (); + writeBuffer.Write (buffer, offset, size); + totalWritten += size; + + if (Request.ContentLength <= 0 || totalWritten < Request.ContentLength) + return; + + requestWritten = true; + buffer = writeBuffer.GetBuffer (); + offset = 0; + size = (int)totalWritten; + } else { + totalWritten += size; + } + } + + await InnerStream.WriteAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false); + } + + void CheckWriteOverflow (long contentLength, long totalWritten, long size) + { + if (contentLength == -1) + return; + + long avail = contentLength - totalWritten; + if (size > avail) { + KillBuffer (); + closed = true; + var throwMe = new ProtocolViolationException ( + "The number of bytes to be written is greater than " + + "the specified ContentLength."); + Operation.CompleteRequestWritten (this, throwMe); + throw throwMe; + } + } + + internal async Task Initialize (CancellationToken cancellationToken) + { + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + WebConnection.Debug ($"{ME} INIT: {Operation.WriteBuffer != null}"); + + if (Operation.WriteBuffer != null) { + if (Operation.IsNtlmChallenge) + Request.InternalContentLength = 0; + else + Request.InternalContentLength = Operation.WriteBuffer.Size; + } + + await SetHeadersAsync (false, cancellationToken).ConfigureAwait (false); + + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + if (Operation.WriteBuffer != null && !Operation.IsNtlmChallenge) { + await WriteRequestAsync (cancellationToken); + Close (); + } + } + + async Task SetHeadersAsync (bool setInternalLength, CancellationToken cancellationToken) + { + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + if (headersSent) + return; + + string method = Request.Method; + bool no_writestream = (method == "GET" || method == "CONNECT" || method == "HEAD" || + method == "TRACE"); + bool webdav = (method == "PROPFIND" || method == "PROPPATCH" || method == "MKCOL" || + method == "COPY" || method == "MOVE" || method == "LOCK" || + method == "UNLOCK"); + + if (Operation.IsNtlmChallenge) + no_writestream = true; + + if (setInternalLength && !no_writestream && HasWriteBuffer) + Request.InternalContentLength = WriteBufferLength; + + bool has_content = !no_writestream && (!HasWriteBuffer || Request.ContentLength > -1); + if (!(sendChunked || has_content || no_writestream || webdav)) + return; + + headersSent = true; + headers = Request.GetRequestHeaders (); + + WebConnection.Debug ($"{ME} SET HEADERS: {Request.ContentLength}"); + + try { + await InnerStream.WriteAsync (headers, 0, headers.Length, cancellationToken).ConfigureAwait (false); + var cl = Request.ContentLength; + if (!sendChunked && cl == 0) + requestWritten = true; + } catch (Exception e) { + if (e is WebException || e is OperationCanceledException) + throw; + throw new WebException ("Error writing headers", WebExceptionStatus.SendFailure, WebExceptionInternalStatus.RequestFatal, e); + } + } + + internal async Task WriteRequestAsync (CancellationToken cancellationToken) + { + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + WebConnection.Debug ($"{ME} WRITE REQUEST: {requestWritten} {sendChunked} {allowBuffering} {HasWriteBuffer}"); + + if (requestWritten) + return; + + requestWritten = true; + if (sendChunked || !HasWriteBuffer) + return; + + BufferOffsetSize buffer = GetWriteBuffer (); + if (buffer != null && !Operation.IsNtlmChallenge && Request.ContentLength != -1 && Request.ContentLength < buffer.Size) { + closed = true; + var throwMe = new WebException ("Specified Content-Length is less than the number of bytes to write", null, + WebExceptionStatus.ServerProtocolViolation, null); + Operation.CompleteRequestWritten (this, throwMe); + throw throwMe; + } + + await SetHeadersAsync (true, cancellationToken).ConfigureAwait (false); + + WebConnection.Debug ($"{ME} WRITE REQUEST #1: {buffer != null}"); + + Operation.ThrowIfClosedOrDisposed (cancellationToken); + if (buffer != null && buffer.Size > 0) + await InnerStream.WriteAsync (buffer.Buffer, 0, buffer.Size, cancellationToken); + + await FinishWriting (cancellationToken); + } + + async Task WriteChunkTrailer_inner (CancellationToken cancellationToken) + { + if (Interlocked.CompareExchange (ref chunkTrailerWritten, 1, 0) != 0) + return; + Operation.ThrowIfClosedOrDisposed (cancellationToken); + byte[] chunk = Encoding.ASCII.GetBytes ("0\r\n\r\n"); + await InnerStream.WriteAsync (chunk, 0, chunk.Length, cancellationToken).ConfigureAwait (false); + } + + async Task WriteChunkTrailer () + { + var cts = new CancellationTokenSource (); + try { + cts.CancelAfter (WriteTimeout); + var timeoutTask = Task.Delay (WriteTimeout, cts.Token); + while (true) { + var completion = new WebCompletionSource (); + var oldCompletion = Interlocked.CompareExchange (ref pendingWrite, completion, null); + if (oldCompletion == null) + break; + var oldWriteTask = oldCompletion.WaitForCompletion (); + var ret = await Task.WhenAny (timeoutTask, oldWriteTask).ConfigureAwait (false); + if (ret == timeoutTask) + throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout); + } + + await WriteChunkTrailer_inner (cts.Token).ConfigureAwait (false); + } catch { + // Intentionally eating exceptions. + } finally { + pendingWrite = null; + cts.Cancel (); + cts.Dispose (); + } + } + + internal void KillBuffer () + { + writeBuffer = null; + } + + public override Task ReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken) + { + return Task.FromException (new NotSupportedException (SR.net_writeonlystream)); + } + + protected override void Close_internal (ref bool disposed) + { + WebConnection.Debug ($"{ME} CLOSE: {disposed} {requestWritten} {allowBuffering}"); + + if (disposed) + return; + disposed = true; + + if (sendChunked) { + // Don't use FinishWriting() here, we need to block on 'pendingWrite' to ensure that + // any pending WriteAsync() has been completed. + // + // FIXME: I belive .NET simply aborts if you call Close() or Dispose() while writing, + // need to check this. 2017/07/17 Martin. + WriteChunkTrailer ().Wait (); + return; + } + + if (!allowBuffering || requestWritten) { + Operation.CompleteRequestWritten (this); + return; + } + + long length = Request.ContentLength; + + if (!sendChunked && !Operation.IsNtlmChallenge && length != -1 && totalWritten != length) { + IOException io = new IOException ("Cannot close the stream until all bytes are written"); + closed = true; + disposed = true; + var throwMe = new WebException ("Request was cancelled.", WebExceptionStatus.RequestCanceled, WebExceptionInternalStatus.RequestFatal, io); + Operation.CompleteRequestWritten (this, throwMe); + throw throwMe; + } + + // Commented out the next line to fix xamarin bug #1512 + //WriteRequest (); + disposed = true; + Operation.CompleteRequestWritten (this); + } + } +} diff --git a/mcs/class/System/System.Net/WebResponseStream.cs b/mcs/class/System/System.Net/WebResponseStream.cs new file mode 100644 index 0000000000..5921785344 --- /dev/null +++ b/mcs/class/System/System.Net/WebResponseStream.cs @@ -0,0 +1,739 @@ +// +// WebResponseStream.cs +// +// Author: +// Martin Baulig +// +// Copyright (c) 2017 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.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Runtime.ExceptionServices; +using System.Net.Sockets; + +namespace System.Net +{ + class WebResponseStream : WebConnectionStream + { + BufferOffsetSize readBuffer; + long contentLength; + long totalRead; + bool nextReadCalled; + int stream_length; // -1 when CL not present + WebCompletionSource pendingRead; + object locker = new object (); + int nestedRead; + bool read_eof; + + public WebRequestStream RequestStream { + get; + } + + public WebHeaderCollection Headers { + get; + private set; + } + + public HttpStatusCode StatusCode { + get; + private set; + } + + public string StatusDescription { + get; + private set; + } + + public Version Version { + get; + private set; + } + + public bool KeepAlive { + get; + private set; + } + + internal readonly string ME; + + public WebResponseStream (WebRequestStream request) + : base (request.Connection, request.Operation, request.InnerStream) + { + RequestStream = request; + +#if MONO_WEB_DEBUG + ME = $"WRP(Cnc={Connection.ID}, Op={Operation.ID})"; +#endif + } + + public override long Length { + get { + return stream_length; + } + } + + public override bool CanRead => true; + + public override bool CanWrite => false; + + protected bool ChunkedRead { + get; + private set; + } + + protected MonoChunkStream ChunkStream { + get; + private set; + } + + public override async Task ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + WebConnection.Debug ($"{ME} READ ASYNC"); + + cancellationToken.ThrowIfCancellationRequested (); + + if (buffer == null) + throw new ArgumentNullException (nameof (buffer)); + + int length = buffer.Length; + if (offset < 0 || length < offset) + throw new ArgumentOutOfRangeException (nameof (offset)); + if (count < 0 || (length - offset) < count) + throw new ArgumentOutOfRangeException (nameof (count)); + + if (Interlocked.CompareExchange (ref nestedRead, 1, 0) != 0) + throw new InvalidOperationException ("Invalid nested call."); + + var completion = new WebCompletionSource (); + while (!cancellationToken.IsCancellationRequested) { + /* + * 'currentRead' is set by ReadAllAsync(). + */ + var oldCompletion = Interlocked.CompareExchange (ref pendingRead, completion, null); + WebConnection.Debug ($"{ME} READ ASYNC #1: {oldCompletion != null}"); + if (oldCompletion == null) + break; + await oldCompletion.WaitForCompletion ().ConfigureAwait (false); + } + + WebConnection.Debug ($"{ME} READ ASYNC #2: {totalRead} {contentLength}"); + + int oldBytes = 0, nbytes = 0; + Exception throwMe = null; + + try { + // FIXME: NetworkStream.ReadAsync() does not support cancellation. + (oldBytes, nbytes) = await HttpWebRequest.RunWithTimeout ( + ct => ProcessRead (buffer, offset, count, ct), + ReadTimeout, () => { + Operation.Abort (); + InnerStream.Dispose (); + }).ConfigureAwait (false); + } catch (Exception e) { + throwMe = GetReadException (WebExceptionStatus.ReceiveFailure, e, "ReadAsync"); + } + + WebConnection.Debug ($"{ME} READ ASYNC #3: {totalRead} {contentLength} - {oldBytes} {nbytes} {throwMe?.Message}"); + + if (throwMe != null) { + lock (locker) { + completion.TrySetException (throwMe); + pendingRead = null; + nestedRead = 0; + } + + closed = true; + Operation.Finish (false, throwMe); + throw throwMe; + } + + lock (locker) { + pendingRead.TrySetCompleted (); + pendingRead = null; + nestedRead = 0; + } + + if (totalRead >= contentLength && !nextReadCalled) { + WebConnection.Debug ($"{ME} READ ASYNC - READ COMPLETE: {oldBytes} {nbytes} - {totalRead} {contentLength} {nextReadCalled}"); + if (!nextReadCalled) { + nextReadCalled = true; + Operation.Finish (true); + } + } + + return oldBytes + nbytes; + } + + async Task<(int, int)> ProcessRead (byte[] buffer, int offset, int size, CancellationToken cancellationToken) + { + WebConnection.Debug ($"{ME} PROCESS READ: {totalRead} {contentLength}"); + + cancellationToken.ThrowIfCancellationRequested (); + if (totalRead >= contentLength) { + read_eof = true; + contentLength = totalRead; + return (0, 0); + } + + int oldBytes = 0; + int remaining = readBuffer?.Size ?? 0; + if (remaining > 0) { + int copy = (remaining > size) ? size : remaining; + Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, buffer, offset, copy); + readBuffer.Offset += copy; + readBuffer.Size -= copy; + offset += copy; + size -= copy; + totalRead += copy; + if (totalRead >= contentLength) { + contentLength = totalRead; + read_eof = true; + } + if (size == 0 || totalRead >= contentLength) + return (0, copy); + oldBytes = copy; + } + + if (contentLength != Int64.MaxValue && contentLength - totalRead < size) + size = (int)(contentLength - totalRead); + + WebConnection.Debug ($"{ME} PROCESS READ #1: {oldBytes} {size} {read_eof}"); + + if (read_eof) { + contentLength = totalRead; + return (oldBytes, 0); + } + + var ret = await InnerReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false); + + if (ret <= 0) { + read_eof = true; + contentLength = totalRead; + return (oldBytes, 0); + } + + totalRead += ret; + return (oldBytes, ret); + } + + internal async Task InnerReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken) + { + WebConnection.Debug ($"{ME} INNER READ ASYNC"); + + Operation.ThrowIfDisposed (cancellationToken); + + int nbytes = 0; + bool done = false; + + if (!ChunkedRead || (!ChunkStream.DataAvailable && ChunkStream.WantMore)) { + nbytes = await InnerStream.ReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false); + WebConnection.Debug ($"{ME} INNER READ ASYNC #1: {nbytes} {ChunkedRead}"); + if (!ChunkedRead) + return nbytes; + done = nbytes == 0; + } + + try { + ChunkStream.WriteAndReadBack (buffer, offset, size, ref nbytes); + WebConnection.Debug ($"{ME} INNER READ ASYNC #1: {done} {nbytes} {ChunkStream.WantMore}"); + if (!done && nbytes == 0 && ChunkStream.WantMore) + nbytes = await EnsureReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false); + } catch (Exception e) { + if (e is WebException || e is OperationCanceledException) + throw; + throw new WebException ("Invalid chunked data.", e, WebExceptionStatus.ServerProtocolViolation, null); + } + + if ((done || nbytes == 0) && ChunkStream.ChunkLeft != 0) { + // HandleError (WebExceptionStatus.ReceiveFailure, null, "chunked EndRead"); + throw new WebException ("Read error", null, WebExceptionStatus.ReceiveFailure, null); + } + + return nbytes; + } + + async Task EnsureReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken) + { + byte[] morebytes = null; + int nbytes = 0; + while (nbytes == 0 && ChunkStream.WantMore && !cancellationToken.IsCancellationRequested) { + int localsize = ChunkStream.ChunkLeft; + if (localsize <= 0) // not read chunk size yet + localsize = 1024; + else if (localsize > 16384) + localsize = 16384; + + if (morebytes == null || morebytes.Length < localsize) + morebytes = new byte[localsize]; + + int nread = await InnerStream.ReadAsync (morebytes, 0, localsize, cancellationToken).ConfigureAwait (false); + if (nread <= 0) + return 0; // Error + + ChunkStream.Write (morebytes, 0, nread); + nbytes += ChunkStream.Read (buffer, offset + nbytes, size - nbytes); + } + + return nbytes; + } + + bool CheckAuthHeader (string headerName) + { + var authHeader = Headers[headerName]; + return (authHeader != null && authHeader.IndexOf ("NTLM", StringComparison.Ordinal) != -1); + } + + bool IsNtlmAuth () + { + bool isProxy = (Request.Proxy != null && !Request.Proxy.IsBypassed (Request.Address)); + if (isProxy && CheckAuthHeader ("Proxy-Authenticate")) + return true; + return CheckAuthHeader ("WWW-Authenticate"); + } + + bool ExpectContent { + get { + if (Request.Method == "HEAD") + return false; + return ((int)StatusCode >= 200 && (int)StatusCode != 204 && (int)StatusCode != 304); + } + } + + async Task Initialize (BufferOffsetSize buffer, CancellationToken cancellationToken) + { + WebConnection.Debug ($"{ME} INIT: status={(int)StatusCode} bos={buffer.Offset}/{buffer.Size}"); + + string contentType = Headers["Transfer-Encoding"]; + bool chunkedRead = (contentType != null && contentType.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1); + string clength = Headers["Content-Length"]; + if (!chunkedRead && !string.IsNullOrEmpty (clength)) { + if (!long.TryParse (clength, out contentLength)) + contentLength = Int64.MaxValue; + } else { + contentLength = Int64.MaxValue; + } + + if (Version == HttpVersion.Version11 && RequestStream.KeepAlive) { + KeepAlive = true; + var cncHeader = Headers[ServicePoint.UsesProxy ? "Proxy-Connection" : "Connection"]; + if (cncHeader != null) { + cncHeader = cncHeader.ToLower (); + KeepAlive = cncHeader.IndexOf ("keep-alive", StringComparison.Ordinal) != -1; + if (cncHeader.IndexOf ("close", StringComparison.Ordinal) != -1) + KeepAlive = false; + } + } + + // Negative numbers? + if (!Int32.TryParse (clength, out stream_length)) + stream_length = -1; + + string me = "WebResponseStream.Initialize()"; + string tencoding = null; + if (ExpectContent) + tencoding = Headers["Transfer-Encoding"]; + + ChunkedRead = (tencoding != null && tencoding.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1); + if (!ChunkedRead) { + readBuffer = buffer; + try { + if (contentLength > 0 && readBuffer.Size >= contentLength) { + if (!IsNtlmAuth ()) + await ReadAllAsync (false, cancellationToken).ConfigureAwait (false); + } + } catch (Exception e) { + throw GetReadException (WebExceptionStatus.ReceiveFailure, e, me); + } + } else if (ChunkStream == null) { + try { + ChunkStream = new MonoChunkStream (buffer.Buffer, buffer.Offset, buffer.Offset + buffer.Size, Headers); + } catch (Exception e) { + throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, me); + } + } else { + ChunkStream.ResetBuffer (); + try { + ChunkStream.Write (buffer.Buffer, buffer.Offset, buffer.Size); + } catch (Exception e) { + throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, me); + } + } + + WebConnection.Debug ($"{ME} INIT #1: - {ExpectContent} {closed} {nextReadCalled}"); + + if (!ExpectContent) { + if (!closed && !nextReadCalled) { + if (contentLength == Int64.MaxValue) + contentLength = 0; + nextReadCalled = true; + } + Operation.Finish (true); + } + } + + internal async Task ReadAllAsync (bool resending, CancellationToken cancellationToken) + { + WebConnection.Debug ($"{ME} READ ALL ASYNC: resending={resending} eof={read_eof} total={totalRead} " + + "length={contentLength} nextReadCalled={nextReadCalled}"); + if (read_eof || totalRead >= contentLength || nextReadCalled) { + if (!nextReadCalled) { + nextReadCalled = true; + Operation.Finish (true); + } + return; + } + + var completion = new WebCompletionSource (); + var timeoutCts = new CancellationTokenSource (); + try { + var timeoutTask = Task.Delay (ReadTimeout, timeoutCts.Token); + while (true) { + /* + * 'currentRead' is set by ReadAsync(). + */ + cancellationToken.ThrowIfCancellationRequested (); + var oldCompletion = Interlocked.CompareExchange (ref pendingRead, completion, null); + if (oldCompletion == null) + break; + + // ReadAsync() is in progress. + var oldReadTask = oldCompletion.WaitForCompletion (); + var anyTask = await Task.WhenAny (oldReadTask, timeoutTask).ConfigureAwait (false); + if (anyTask == timeoutTask) + throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout); + } + } finally { + timeoutCts.Cancel (); + timeoutCts.Dispose (); + } + + WebConnection.Debug ($"{ME} READ ALL ASYNC #1"); + + cancellationToken.ThrowIfCancellationRequested (); + + try { + if (totalRead >= contentLength) + return; + + byte[] b = null; + int new_size; + + if (contentLength == Int64.MaxValue && !ChunkedRead) { + WebConnection.Debug ($"{ME} READ ALL ASYNC - NEITHER LENGTH NOR CHUNKED"); + /* + * This is a violation of the HTTP Spec - the server neither send a + * "Content-Length:" nor a "Transfer-Encoding: chunked" header. + * + * When we're redirecting or resending for NTLM, then we can simply close + * the connection here. + * + * However, if it's the final reply, then we need to try our best to read it. + */ + if (resending) { + Close (); + return; + } + KeepAlive = false; + } + + if (contentLength == Int64.MaxValue) { + MemoryStream ms = new MemoryStream (); + BufferOffsetSize buffer = null; + if (readBuffer != null && readBuffer.Size > 0) { + ms.Write (readBuffer.Buffer, readBuffer.Offset, readBuffer.Size); + readBuffer.Offset = 0; + readBuffer.Size = readBuffer.Buffer.Length; + if (readBuffer.Buffer.Length >= 8192) + buffer = readBuffer; + } + + if (buffer == null) + buffer = new BufferOffsetSize (new byte[8192], false); + + int read; + while ((read = await InnerReadAsync (buffer.Buffer, buffer.Offset, buffer.Size, cancellationToken)) != 0) + ms.Write (buffer.Buffer, buffer.Offset, read); + + new_size = (int)ms.Length; + contentLength = new_size; + readBuffer = new BufferOffsetSize (ms.GetBuffer (), 0, new_size, false); + } else { + new_size = (int)(contentLength - totalRead); + b = new byte[new_size]; + int readSize = 0; + if (readBuffer != null && readBuffer.Size > 0) { + readSize = readBuffer.Size; + if (readSize > new_size) + readSize = new_size; + + Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, b, 0, readSize); + } + + int remaining = new_size - readSize; + int r = -1; + while (remaining > 0 && r != 0) { + r = await InnerReadAsync (b, readSize, remaining, cancellationToken); + remaining -= r; + readSize += r; + } + } + + readBuffer = new BufferOffsetSize (b, 0, new_size, false); + totalRead = 0; + nextReadCalled = true; + completion.TrySetCompleted (); + } catch (Exception ex) { + WebConnection.Debug ($"{ME} READ ALL ASYNC EX: {ex.Message}"); + completion.TrySetException (ex); + throw; + } finally { + WebConnection.Debug ($"{ME} READ ALL ASYNC #2"); + pendingRead = null; + } + + Operation.Finish (true); + } + + public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken) + { + return Task.FromException (new NotSupportedException (SR.net_readonlystream)); + } + + protected override void Close_internal (ref bool disposed) + { + WebConnection.Debug ($"{ME} CLOSE: {disposed} {closed} {nextReadCalled}"); + if (!closed && !nextReadCalled) { + nextReadCalled = true; + if (totalRead >= contentLength) { + disposed = true; + Operation.Finish (true); + } else { + // If we have not read all the contents + closed = true; + disposed = true; + Operation.Finish (false); + } + } + } + + WebException GetReadException (WebExceptionStatus status, Exception error, string where) + { + error = GetException (error); + string msg = $"Error getting response stream ({where}): {status}"; + if (error == null) + return new WebException ($"Error getting response stream ({where}): {status}", status); + if (error is WebException wexc) + return wexc; + if (Operation.Aborted || error is OperationCanceledException || error is ObjectDisposedException) + return HttpWebRequest.CreateRequestAbortedException (); + return new WebException ($"Error getting response stream ({where}): {status} {error.Message}", status, + WebExceptionInternalStatus.RequestFatal, error); + } + + internal async Task InitReadAsync (CancellationToken cancellationToken) + { + WebConnection.Debug ($"{ME} INIT READ ASYNC"); + + var buffer = new BufferOffsetSize (new byte[4096], false); + var state = ReadState.None; + int position = 0; + + while (true) { + Operation.ThrowIfClosedOrDisposed (cancellationToken); + + WebConnection.Debug ($"{ME} INIT READ ASYNC LOOP: {state} {position} - {buffer.Offset}/{buffer.Size}"); + + var nread = await InnerStream.ReadAsync ( + buffer.Buffer, buffer.Offset, buffer.Size, cancellationToken).ConfigureAwait (false); + + WebConnection.Debug ($"{ME} INIT READ ASYNC LOOP #1: {state} {position} - {buffer.Offset}/{buffer.Size} - {nread}"); + + if (nread == 0) + throw GetReadException (WebExceptionStatus.ReceiveFailure, null, "ReadDoneAsync2"); + + if (nread < 0) + throw GetReadException (WebExceptionStatus.ServerProtocolViolation, null, "ReadDoneAsync3"); + + buffer.Offset += nread; + buffer.Size -= nread; + + if (state == ReadState.None) { + try { + var oldPos = position; + if (!GetResponse (buffer, ref position, ref state)) + position = oldPos; + } catch (Exception e) { + WebConnection.Debug ($"{ME} INIT READ ASYNC FAILED: {e.Message}\n{e}"); + throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, "ReadDoneAsync4"); + } + } + + if (state == ReadState.Aborted) + throw GetReadException (WebExceptionStatus.RequestCanceled, null, "ReadDoneAsync5"); + + if (state == ReadState.Content) { + buffer.Size = buffer.Offset - position; + buffer.Offset = position; + break; + } + + int est = nread * 2; + if (est > buffer.Size) { + var newBuffer = new byte [buffer.Buffer.Length + est]; + Buffer.BlockCopy (buffer.Buffer, 0, newBuffer, 0, buffer.Offset); + buffer = new BufferOffsetSize (newBuffer, buffer.Offset, newBuffer.Length - buffer.Offset, false); + } + state = ReadState.None; + position = 0; + } + + WebConnection.Debug ($"{ME} INIT READ ASYNC LOOP DONE: {buffer.Offset} {buffer.Size}"); + + try { + Operation.ThrowIfDisposed (cancellationToken); + await Initialize (buffer, cancellationToken).ConfigureAwait (false); + } catch (Exception e) { + throw GetReadException (WebExceptionStatus.ReceiveFailure, e, "ReadDoneAsync6"); + } + } + + bool GetResponse (BufferOffsetSize buffer, ref int pos, ref ReadState state) + { + string line = null; + bool lineok = false; + bool isContinue = false; + bool emptyFirstLine = false; + do { + if (state == ReadState.Aborted) + throw GetReadException (WebExceptionStatus.RequestCanceled, null, "GetResponse"); + + if (state == ReadState.None) { + lineok = WebConnection.ReadLine (buffer.Buffer, ref pos, buffer.Offset, ref line); + if (!lineok) + return false; + + if (line == null) { + emptyFirstLine = true; + continue; + } + emptyFirstLine = false; + state = ReadState.Status; + + string[] parts = line.Split (' '); + if (parts.Length < 2) + throw GetReadException (WebExceptionStatus.ServerProtocolViolation, null, "GetResponse"); + + if (String.Compare (parts[0], "HTTP/1.1", true) == 0) { + Version = HttpVersion.Version11; + ServicePoint.SetVersion (HttpVersion.Version11); + } else { + Version = HttpVersion.Version10; + ServicePoint.SetVersion (HttpVersion.Version10); + } + + StatusCode = (HttpStatusCode)UInt32.Parse (parts[1]); + if (parts.Length >= 3) + StatusDescription = String.Join (" ", parts, 2, parts.Length - 2); + else + StatusDescription = string.Empty; + + if (pos >= buffer.Size) + return true; + } + + emptyFirstLine = false; + if (state == ReadState.Status) { + state = ReadState.Headers; + Headers = new WebHeaderCollection (); + var headerList = new List (); + bool finished = false; + while (!finished) { + if (WebConnection.ReadLine (buffer.Buffer, ref pos, buffer.Offset, ref line) == false) + break; + + if (line == null) { + // Empty line: end of headers + finished = true; + continue; + } + + if (line.Length > 0 && (line[0] == ' ' || line[0] == '\t')) { + int count = headerList.Count - 1; + if (count < 0) + break; + + string prev = headerList[count] + line; + headerList[count] = prev; + } else { + headerList.Add (line); + } + } + + if (!finished) + return false; + + // .NET uses ParseHeaders or ParseHeadersStrict which is much better + foreach (string s in headerList) { + + int pos_s = s.IndexOf (':'); + if (pos_s == -1) + throw new ArgumentException ("no colon found", "header"); + + var header = s.Substring (0, pos_s); + var value = s.Substring (pos_s + 1).Trim (); + + if (WebHeaderCollection.AllowMultiValues (header)) { + Headers.AddInternal (header, value); + } else { + Headers.SetInternal (header, value); + } + } + + if (StatusCode == HttpStatusCode.Continue) { + ServicePoint.SendContinue = true; + if (pos >= buffer.Offset) + return true; + + if (Request.ExpectContinue) { + Request.DoContinueDelegate ((int)StatusCode, Headers); + // Prevent double calls when getting the + // headers in several packets. + Request.ExpectContinue = false; + } + + state = ReadState.None; + isContinue = true; + } else { + state = ReadState.Content; + return true; + } + } + } while (emptyFirstLine || isContinue); + + throw GetReadException (WebExceptionStatus.ServerProtocolViolation, null, "GetResponse"); + } + + + } +} diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs index 7d0b3d1487..f535f400b3 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509Helper2.cs @@ -126,6 +126,9 @@ namespace System.Security.Cryptography.X509Certificates 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 (); @@ -142,6 +145,9 @@ namespace System.Security.Cryptography.X509Certificates 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 (); diff --git a/mcs/class/System/System_test.dll.sources b/mcs/class/System/System_test.dll.sources index 6cd61c0847..150b363b6a 100644 --- a/mcs/class/System/System_test.dll.sources +++ b/mcs/class/System/System_test.dll.sources @@ -501,6 +501,7 @@ System.Threading/SemaphoreFullExceptionCas.cs System.Threading/SemaphoreTest.cs System.Threading/BarrierTest.cs System.Threading/ThreadExceptionEventArgsCas.cs +System.Threading/WaitHandleTests.cs System.Timers/TimersDescriptionAttributeCas.cs System.Timers/ElapsedEventArgsCas.cs System.Timers/TimerCas.cs diff --git a/mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs b/mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs index 04d507315e..5c43555619 100644 --- a/mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs +++ b/mcs/class/System/Test/System.Collections.Concurrent/BlockingCollectionTests.cs @@ -194,6 +194,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void TakeAnyFromSecondCollection () { var a = new BlockingCollection (); @@ -213,6 +214,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void TakeAnyCancellable () { var a = new BlockingCollection (); diff --git a/mcs/class/System/Test/System.Collections.Concurrent/ConcurrentBagTests.cs b/mcs/class/System/Test/System.Collections.Concurrent/ConcurrentBagTests.cs index 7f7c9ece2a..af23b5137b 100644 --- a/mcs/class/System/Test/System.Collections.Concurrent/ConcurrentBagTests.cs +++ b/mcs/class/System/Test/System.Collections.Concurrent/ConcurrentBagTests.cs @@ -68,6 +68,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void BasicAddTakeFromOtherThread () { var t = new Thread (() => bag.Add (1)); @@ -88,6 +89,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void AddFromMultipleThreadTakeFromOneThread () { var threads = new Thread[10]; @@ -115,6 +117,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void AddFromOneThreadTakeFromMultiple () { var threads = new Thread[10]; @@ -152,6 +155,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void BasicAddPeekFromOtherThread () { var t = new Thread (() => bag.Add (1)); @@ -168,6 +172,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category("MultiThreaded")] public void AddFromOneThreadPeekFromMultiple () { var threads = new Thread[10]; diff --git a/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs b/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs index 50b605adae..e80672a91d 100644 --- a/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs +++ b/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs @@ -164,6 +164,31 @@ namespace MonoTests.System.Configuration { [TestFixture] public class ApplicationSettingsBaseTest { + string tempDir; + + [TestFixtureSetUp] + public void FixtureSetup () + { + // Use random temp directory to store settings files of tests. + tempDir = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ()); + Directory.CreateDirectory (tempDir); + var localAppData = Path.Combine (tempDir, "LocalAppData"); + Directory.CreateDirectory (localAppData); + var appData = Path.Combine (tempDir, "AppData"); + Directory.CreateDirectory (appData); + + Environment.SetEnvironmentVariable ("XDG_DATA_HOME", localAppData); + Environment.SetEnvironmentVariable ("XDG_CONFIG_HOME", appData); + } + + [TestFixtureTearDown] + public void FixtureTearDown () + { + Environment.SetEnvironmentVariable ("XDG_DATA_HOME", null); + Environment.SetEnvironmentVariable ("XDG_CONFIG_HOME", null); + Directory.Delete (tempDir, true); + } + [Test] public void TestSettings1_Properties () { @@ -522,6 +547,212 @@ namespace MonoTests.System.Configuration { Assert.Fail ("Invalid data was saved to config file."); } } + #region Bug #2315 + class Bug2315Settings : ApplicationSettingsBase + { + public Bug2315Settings () : base ("Bug2315Settings") + { + } + + [UserScopedSetting] + [DefaultSettingValue ("some text")] + public string Text { + get { return (string)this ["Text"]; } + set { this ["Text"] = value; } + } + } + + [Test] + public void SettingSavingEventFired_Bug2315 () + { + bool settingsSavingCalled = false; + var settings = new Bug2315Settings (); + settings.SettingsSaving += (object sender, CancelEventArgs e) => { + settingsSavingCalled = true; + }; + + settings.Text = DateTime.Now.ToString (); + settings.Save (); + + Assert.IsTrue (settingsSavingCalled); + } + #endregion + + #region Bug #15818 + class Bug15818SettingsProvider: SettingsProvider, IApplicationSettingsProvider + { + public Bug15818SettingsProvider () + { + } + + public static void ResetUpgradeCalled () + { + UpgradeCalled = false; + } + + public static bool UpgradeCalled { get; private set; } + + public override void Initialize (string name, NameValueCollection config) + { + if (name != null && config != null) { + base.Initialize (name, config); + } + } + + public override string Name + { + get { return "Bug15818SettingsProvider"; } + } + + public override string Description + { + get { return "Bug15818SettingsProvider"; } + } + + public override string ApplicationName + { + get { return "Bug15818"; } + set { } + } + + public override SettingsPropertyValueCollection GetPropertyValues (SettingsContext context, SettingsPropertyCollection collection) + { + return null; + } + + public override void SetPropertyValues (SettingsContext context, SettingsPropertyValueCollection collection) + { + } + + #region IApplicationSettingsProvider implementation + + public SettingsPropertyValue GetPreviousVersion (SettingsContext context, SettingsProperty property) + { + return null; + } + + public void Reset (SettingsContext context) + { + } + + public void Upgrade (SettingsContext context, SettingsPropertyCollection properties) + { + UpgradeCalled = true; + } + + #endregion + } + + class Bug15818Settings : ApplicationSettingsBase + { + public Bug15818Settings () : base ("Bug15818Settings") + { + } + + [UserScopedSetting] + [SettingsProvider (typeof (Bug15818SettingsProvider))] + [DefaultSettingValue ("some text")] + public string Text { + get { return (string)this ["Text"]; } + set { this ["Text"] = value; } + } + } + + public class Bug15818Class + { + public string Name { get; set; } + public int Value { get; set; } + } + + class Bug15818Settings2 : ApplicationSettingsBase + { + public Bug15818Settings2 () : base ("Bug15818Settings2") + { + } + + [UserScopedSetting] + [DefaultSettingValue ("default text")] + public string Text { + get { return (string)this ["Text"]; } + set { this ["Text"] = value; } + } + + [UserScopedSetting] + public Bug15818Class MyObject { + get { return (Bug15818Class)this ["MyObject"]; } + set { this ["MyObject"] = value; } + } + } + + [Test] + public void UpgradeGetsCalled_Bug15818 () + { + Bug15818SettingsProvider.ResetUpgradeCalled (); + + var settings = new Bug15818Settings (); + settings.Upgrade (); + Assert.IsTrue (Bug15818SettingsProvider.UpgradeCalled); + } + + [Test] + public void CustomClass_Roundtrip () + { + var settings = new Bug15818Settings2 + { + Text = "foo", + MyObject = new Bug15818Class { Name = "Some Name", Value = 15818 } + }; + settings.Save (); + + var settings2 = new Bug15818Settings2 (); + Assert.AreEqual ("foo", settings2.Text); + Assert.IsNotNull (settings2.MyObject); + Assert.AreEqual ("Some Name", settings2.MyObject.Name); + Assert.AreEqual (15818, settings2.MyObject.Value); + } + + [Test] + public void ModifiedObjectsAreSerialized_Bug15818 () + { + var settings = new Bug15818Settings2 + { + Text = "foo", + MyObject = new Bug15818Class { Name = "Some Name", Value = 15818 } + }; + settings.Save (); + + // Modify the value of the object - bug #15818 + settings.Text = "bla"; + settings.MyObject.Name = "xyz"; + settings.MyObject.Value = -1; + settings.Save (); + + // Verify that the new values got saved + var settings2 = new Bug15818Settings2 (); + Assert.AreEqual ("bla", settings2.Text); + Assert.IsNotNull (settings2.MyObject); + Assert.AreEqual ("xyz", settings2.MyObject.Name); + Assert.AreEqual (-1, settings2.MyObject.Value); + } + + [Test] + public void Reset_FiresPropChangedOnly_Bug15818 () + { + bool propChangedCalled = false; + bool settingsLoadedCalled = false; + bool settingsSavingCalled = false; + var settings = new Bug15818Settings2 (); + settings.PropertyChanged += (sender, e) => { propChangedCalled = true; }; + settings.SettingsLoaded += (sender, e) => { settingsLoadedCalled = true; }; + settings.SettingsSaving += (sender, e) => { settingsSavingCalled = true; }; + + settings.Reset (); + + Assert.IsTrue (propChangedCalled, "#1"); + Assert.IsFalse (settingsLoadedCalled, "#2"); + Assert.IsFalse (settingsSavingCalled, "#3"); + } + #endregion } } diff --git a/mcs/class/System/Test/System.Configuration/SettingsPropertyValueTest.cs b/mcs/class/System/Test/System.Configuration/SettingsPropertyValueTest.cs index e954bf725a..78308baf07 100644 --- a/mcs/class/System/Test/System.Configuration/SettingsPropertyValueTest.cs +++ b/mcs/class/System/Test/System.Configuration/SettingsPropertyValueTest.cs @@ -81,6 +81,28 @@ namespace MonoTests.System.Configuration { Assert.AreEqual ("\n7", ((string)v.SerializedValue).Replace ("\r\n", "\n"), "A13"); } + [Test] + public void Properties_ChangeSerialzeAs () + { + SettingsProperty p = new SettingsProperty ("property", + typeof (int), + null, + true, + 10, + SettingsSerializeAs.String, + null, + true, + false); + + SettingsPropertyValue v = new SettingsPropertyValue (p); + + // test that setting SerializeAs after changing v.PropertyValue causes + // SerializedValue to be in the new format + v.PropertyValue = (object)5; + p.SerializeAs = SettingsSerializeAs.Xml; + Assert.AreEqual ("\n5", ((string)v.SerializedValue).Replace("\r\n", "\n"), "A99"); + } + [Test] public void Dirty () { @@ -221,6 +243,29 @@ namespace MonoTests.System.Configuration { } + /// + /// This tests the case where we have a SerializedValue but not a PropertyValue. + /// + [Test] + public void Xml_SerializeNoPropValue () + { + SettingsProperty p = new SettingsProperty ("property", + typeof (MyData), + null, + true, + 10, + SettingsSerializeAs.Xml, + null, + true, + false); + + SettingsPropertyValue v = new SettingsPropertyValue (p); + v.SerializedValue = "\n10"; + + Assert.AreEqual ("\n10", v.SerializedValue); + + } + [Test] public void Binary_Serialize () { diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs index df31233d68..12b3034b1a 100644 --- a/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/SocketAsyncTest.cs @@ -98,6 +98,7 @@ namespace MonoTests.System.Net.Sockets [Test] [Category("Test")] + [Category("MultiThreaded")] #if FEATURE_NO_BSD_SOCKETS [ExpectedException (typeof (PlatformNotSupportedException))] #endif diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs.REMOVED.git-id b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs.REMOVED.git-id index 9dc4b0fcf0..fa3f3d8482 100644 --- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs.REMOVED.git-id +++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs.REMOVED.git-id @@ -1 +1 @@ -d1bb2ffee7ac63a76151854a3bc57ec5d6a2a70a \ No newline at end of file +1e25aea1bb2838df06140728a614e421211c3ab8 \ No newline at end of file diff --git a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs index 15b48e5fe2..c3bf7e2ac1 100644 --- a/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs +++ b/mcs/class/System/Test/System.Net.Sockets/TcpListenerTest.cs @@ -49,7 +49,10 @@ namespace MonoTests.System.Net.Sockets } } - // make sure the connection arrives + // There is no guarantee that the connecting socket will be in the listener's + // accept queue yet (though it is highly likely on Linux). We wait up to one + // second for the connecting socket to enter the listener's accept queue. + Assert.IsTrue (inListener.Server.Poll (1000, SelectMode.SelectRead)); Assert.IsTrue (inListener.Pending ()); Socket inSock = inListener.AcceptSocket (); diff --git a/mcs/class/System/Test/System.Net/FileWebRequestTest.cs b/mcs/class/System/Test/System.Net/FileWebRequestTest.cs index 6793d2a48f..5cfdabe0a4 100644 --- a/mcs/class/System/Test/System.Net/FileWebRequestTest.cs +++ b/mcs/class/System/Test/System.Net/FileWebRequestTest.cs @@ -55,6 +55,7 @@ namespace MonoTests.System.Net } [Test] + [Category("MultiThreaded")] public void Async () { WebResponse res = null; @@ -463,6 +464,7 @@ namespace MonoTests.System.Net } [Test] + [Category("MultiThreaded")] public void GetRequestStream_File_Exists () { Stream s = File.Create (_tempFile); diff --git a/mcs/class/System/Test/System.Net/FileWebResponseTest.cs b/mcs/class/System/Test/System.Net/FileWebResponseTest.cs index bf0a956808..472c71d8c9 100644 --- a/mcs/class/System/Test/System.Net/FileWebResponseTest.cs +++ b/mcs/class/System/Test/System.Net/FileWebResponseTest.cs @@ -185,6 +185,7 @@ namespace MonoTests.System.Net } [Test] + [Category("MultiThreaded")] public void ResponseUri () { FileWebRequest req = (FileWebRequest) WebRequest.Create (_tempFileUri); 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 ccc4722c92..d56ddd1342 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 @@ -4cabb0ca84eac14cc074c0d4c57ee60a33f65cad \ No newline at end of file +a0154e7ba83fa85a9caed000fd90aa90d75ae63b \ No newline at end of file diff --git a/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs b/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs index b35c8e7a59..b0f5f7e3ad 100644 --- a/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs +++ b/mcs/class/System/Test/System.Net/HttpWebResponseTest.cs @@ -875,7 +875,7 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2"); Assert.IsNull (ex.InnerException, "#A3"); Assert.IsNotNull (ex.Message, "#A4"); - Assert.AreEqual ("size", ex.ParamName, "#A5"); + Assert.AreEqual ("count", ex.ParamName, "#A5"); } // read full response @@ -890,7 +890,7 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2"); Assert.IsNull (ex.InnerException, "#B3"); Assert.IsNotNull (ex.Message, "#B4"); - Assert.AreEqual ("size", ex.ParamName, "#B5"); + Assert.AreEqual ("count", ex.ParamName, "#B5"); } } finally { rs.Close (); @@ -928,7 +928,7 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2"); Assert.IsNull (ex.InnerException, "#A3"); Assert.IsNotNull (ex.Message, "#A4"); - Assert.AreEqual ("size", ex.ParamName, "#A5"); + Assert.AreEqual ("count", ex.ParamName, "#A5"); } // read full response @@ -943,7 +943,7 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2"); Assert.IsNull (ex.InnerException, "#B3"); Assert.IsNotNull (ex.Message, "#B4"); - Assert.AreEqual ("size", ex.ParamName, "#B5"); + Assert.AreEqual ("count", ex.ParamName, "#B5"); } } finally { rs.Close (); @@ -1221,6 +1221,7 @@ namespace MonoTests.System.Net [Test] [Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues + [Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827 #if FEATURE_NO_BSD_SOCKETS [ExpectedException (typeof (PlatformNotSupportedException))] #endif diff --git a/mcs/class/System/Test/System.Net/WebClientTest.cs b/mcs/class/System/Test/System.Net/WebClientTest.cs index 4e96882335..c70b80352d 100644 --- a/mcs/class/System/Test/System.Net/WebClientTest.cs +++ b/mcs/class/System/Test/System.Net/WebClientTest.cs @@ -23,25 +23,6 @@ namespace MonoTests.System.Net [TestFixture] public class WebClientTest { - private string _tempFolder; - - [SetUp] - public void SetUp () - { - _tempFolder = Path.Combine (Path.GetTempPath (), - GetType ().FullName); - if (Directory.Exists (_tempFolder)) - Directory.Delete (_tempFolder, true); - Directory.CreateDirectory (_tempFolder); - } - - [TearDown] - public void TearDown () - { - if (Directory.Exists (_tempFolder)) - Directory.Delete (_tempFolder, true); - } - [Test] #if FEATURE_NO_BSD_SOCKETS [ExpectedException (typeof (WebException))] // Something catches the PlatformNotSupportedException and re-throws an WebException @@ -842,8 +823,7 @@ namespace MonoTests.System.Net [Test] // UploadFile (string, string) public void UploadFile1_Address_Null () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetTempFileName (); WebClient wc = new WebClient (); try { @@ -855,14 +835,16 @@ namespace MonoTests.System.Net Assert.IsNotNull (ex.Message, "#4"); Assert.IsNotNull (ex.ParamName, "#5"); Assert.AreEqual ("address", ex.ParamName, "#6"); + } finally { + if (File.Exists (tempFile)) + File.Delete (tempFile); } } [Test] // UploadFile (string, string) public void UploadFile1_Address_SchemeNotSupported () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetTempFileName (); WebClient wc = new WebClient (); try { @@ -882,13 +864,17 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7"); Assert.IsNull (inner.InnerException, "#8"); Assert.IsNotNull (inner.Message, "#9"); + } finally { + if (File.Exists (tempFile)) + File.Delete (tempFile); } } [Test] // UploadFile (string, string) public void UploadFile1_FileName_NotFound () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); + var tempPath = Path.GetTempPath (); + string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ()); WebClient wc = new WebClient (); try { @@ -934,7 +920,7 @@ namespace MonoTests.System.Net [Test] // UploadFile (Uri, string) public void UploadFile2_Address_Null () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); + string tempFile = Path.GetRandomFileName (); WebClient wc = new WebClient (); try { @@ -952,8 +938,7 @@ namespace MonoTests.System.Net [Test] // UploadFile (Uri, string) public void UploadFile2_Address_SchemeNotSupported () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetTempFileName (); WebClient wc = new WebClient (); try { @@ -973,13 +958,17 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7"); Assert.IsNull (inner.InnerException, "#8"); Assert.IsNotNull (inner.Message, "#9"); + } finally { + if (File.Exists (tempFile)) + File.Delete (tempFile); } } [Test] // UploadFile (Uri, string) public void UploadFile2_FileName_NotFound () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); + var tempPath = Path.GetTempPath (); + string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ()); WebClient wc = new WebClient (); try { @@ -1025,8 +1014,7 @@ namespace MonoTests.System.Net [Test] // UploadFile (string, string, string) public void UploadFile3_Address_Null () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetRandomFileName (); WebClient wc = new WebClient (); try { @@ -1037,15 +1025,14 @@ namespace MonoTests.System.Net Assert.IsNull (ex.InnerException, "#3"); Assert.IsNotNull (ex.Message, "#4"); Assert.IsNotNull (ex.ParamName, "#5"); - Assert.AreEqual ("path", ex.ParamName, "#6"); + Assert.AreEqual ("address", ex.ParamName, "#6"); } } [Test] // UploadFile (string, string, string) public void UploadFile3_Address_SchemeNotSupported () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetTempFileName (); WebClient wc = new WebClient (); try { @@ -1065,13 +1052,17 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7"); Assert.IsNull (inner.InnerException, "#8"); Assert.IsNotNull (inner.Message, "#9"); + } finally { + if (File.Exists (tempFile)) + File.Delete (tempFile); } } [Test] // UploadFile (string, string, string) public void UploadFile3_FileName_NotFound () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); + var tempPath = Path.GetTempPath (); + string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ()); WebClient wc = new WebClient (); try { @@ -1117,7 +1108,7 @@ namespace MonoTests.System.Net [Test] // UploadFile (Uri, string, string) public void UploadFile4_Address_Null () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); + string tempFile = Path.GetRandomFileName (); WebClient wc = new WebClient (); try { @@ -1135,8 +1126,7 @@ namespace MonoTests.System.Net [Test] // UploadFile (Uri, string, string) public void UploadFile4_Address_SchemeNotSupported () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetTempFileName (); WebClient wc = new WebClient (); try { @@ -1156,13 +1146,17 @@ namespace MonoTests.System.Net Assert.AreEqual (typeof (NotSupportedException), inner.GetType (), "#7"); Assert.IsNull (inner.InnerException, "#8"); Assert.IsNotNull (inner.Message, "#9"); + } finally { + if (File.Exists (tempFile)) + File.Delete (tempFile); } } [Test] // UploadFile (Uri, string, string) public void UploadFile4_FileName_NotFound () { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); + var tempPath = Path.GetTempPath (); + string tempFile = Path.Combine (tempPath, Path.GetRandomFileName ()); WebClient wc = new WebClient (); try { @@ -1691,6 +1685,7 @@ namespace MonoTests.System.Net // We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException [ExpectedException (typeof (WebException))] #endif + [Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827 [Category ("InetAccess")] public void GetWebRequestOverriding () { @@ -1874,8 +1869,7 @@ namespace MonoTests.System.Net { UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) => { - string tempFile = Path.Combine (_tempFolder, "upload.tmp"); - File.Create (tempFile).Close (); + string tempFile = Path.GetTempFileName (); webClient.UploadFileCompleted += (sender, args) => { 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 e97976ebc3..1e8ea28bab 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 @@ -a7e48646d05dcf3b87af070d4ee4cb66ac045634 \ No newline at end of file +58b7b1819107b4116d60ac04a1f27d5b8af4a0d7 \ No newline at end of file diff --git a/mcs/class/System/Test/System.Threading/WaitHandleTests.cs b/mcs/class/System/Test/System.Threading/WaitHandleTests.cs new file mode 100644 index 0000000000..079cfb4ac4 --- /dev/null +++ b/mcs/class/System/Test/System.Threading/WaitHandleTests.cs @@ -0,0 +1,68 @@ +using NUnit.Framework; + +using System; +using System.Security.AccessControl; +using System.Threading; + +namespace MonoTests.System.Threading { + [TestFixture] + public class WaitHandleTests { + SynchronizationContext OriginalContext; + TestSynchronizationContext TestContext; + + [SetUp] + public void SetUp () + { + OriginalContext = SynchronizationContext.Current; + TestContext = new TestSynchronizationContext(); + TestContext.SetWaitNotificationRequired(); + SynchronizationContext.SetSynchronizationContext(TestContext); + } + + [TearDown] + public void TearDown () + { + SynchronizationContext.SetSynchronizationContext(OriginalContext); + } + + [Test] +#if MONODROID + [Ignore("https://github.com/mono/mono/issues/8349")] +#endif + public void WaitHandle_WaitOne_SynchronizationContext () + { + var e = new ManualResetEvent(false); + TestContext.WaitAction = () => e.Set(); + Assert.IsTrue(e.WaitOne(0)); + } + + [Test] + public void WaitHandle_WaitAll_SynchronizationContext () + { + var e1 = new ManualResetEvent(false); + var e2 = new ManualResetEvent(false); + TestContext.WaitAction = () => { + e1.Set(); + e2.Set(); + }; + Assert.IsTrue(WaitHandle.WaitAll(new[] { e1, e2 }, 0)); + } + } + + class TestSynchronizationContext : SynchronizationContext + { + public Action WaitAction { get; set; } + + public new void SetWaitNotificationRequired () + { + base.SetWaitNotificationRequired(); + } + + public override int Wait (IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) + { + WaitAction?.Invoke(); + return base.Wait(waitHandles, waitAll, millisecondsTimeout); + } + } +} + diff --git a/mcs/class/System/common.sources b/mcs/class/System/common.sources index 4d688c4322..785ea5e351 100644 --- a/mcs/class/System/common.sources +++ b/mcs/class/System/common.sources @@ -59,10 +59,8 @@ System.Net/ListenerPrefix.cs System.Net/MonoHttpDate.cs System.Net/NetConfig.cs System.Net/RequestStream.cs -System.Net/SimpleAsyncResult.cs System.Net/SocketPermissionAttribute.cs System.Net/SocketPermission.cs -System.Net/WebAsyncResult.cs System.Net.Mail/AlternateView.cs System.Net.Mail/AlternateViewCollection.cs @@ -696,7 +694,6 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/net/System/Net/ServicePointManager.cs ../referencesource/System/net/System/Net/SocketAddress.cs ../referencesource/System/net/System/Net/SocketException.cs -../referencesource/System/net/System/Net/webclient.cs ../referencesource/System/net/System/Net/WebException.cs ../referencesource/System/net/System/Net/WebExceptionStatus.cs ../referencesource/System/net/System/Net/WebHeaderCollection.cs @@ -706,7 +703,6 @@ ReferenceSources/Win32Exception.cs ../referencesource/System/net/System/Net/WebRequest.cs ../referencesource/System/net/System/Net/WebResponse.cs ../referencesource/System/net/System/Net/WebUtility.cs -../referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs ../referencesource/System/net/System/Net/Cache/RequestCache.cs ../referencesource/System/net/System/Net/Cache/RequestCacheEntry.cs @@ -866,6 +862,9 @@ corefx/SR.cs ../../../external/corefx/src/Common/src/System/Collections/Generic/EnumerableHelpers.cs ../../../external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs +../../../external/corefx/src/Common/src/System/IO/DelegatingStream.cs +../../../external/corefx/src/Common/src/System/IO/ChunkedMemoryStream.cs + ../../../external/corefx/src/Common/src/System/Net/HttpStatusDescription.cs ../../../external/corefx/src/Common/src/System/Net/SecurityProtocol.cs ../../../external/corefx/src/Common/src/System/Net/UriScheme.cs @@ -924,6 +923,8 @@ corefx/SR.cs ../../../external/corefx/src/System.Net.WebSockets.WebSocketProtocol/src/System/Net/WebSockets/ManagedWebSocket.netstandard.cs +../../../external/corefx/src/System.Net.WebClient/src/System/Net/WebClient.cs + ../../../external/corefx/src/System.Private.Uri/src/System/UriBuilder.cs ../../../external/corefx/src/System.Runtime.Extensions/src/System/CodeDom/Compiler/IndentedTextWriter.cs diff --git a/mcs/class/System/common_networking.sources b/mcs/class/System/common_networking.sources index f161a1657e..fe979005fe 100644 --- a/mcs/class/System/common_networking.sources +++ b/mcs/class/System/common_networking.sources @@ -37,19 +37,23 @@ System.Net/HttpListenerResponse.cs System.Net/HttpListenerTimeoutManager.cs System.Net/HttpWebRequest.cs System.Net/HttpWebResponse.cs -System.Net/IWebConnectionState.cs System.Net/ListenerAsyncResult.cs System.Net/ResponseStream.cs System.Net/ServicePoint.cs System.Net/ServicePointManager.cs System.Net/ServicePointManager.extra.cs +System.Net/ServicePointScheduler.cs +System.Net/WebCompletionSource.cs System.Net/WebConnection.cs -System.Net/WebConnectionData.cs -System.Net/WebConnectionGroup.cs System.Net/WebConnectionStream.cs +System.Net/WebConnectionTunnel.cs +System.Net/WebOperation.cs +System.Net/WebRequestStream.cs +System.Net/WebResponseStream.cs ../referencesource/System/net/System/Net/Sockets/TCPClient.cs ../referencesource/System/net/System/Net/Sockets/TCPListener.cs ../referencesource/System/net/System/Net/Sockets/UDPClient.cs +../../../external/corefx/src/Common/src/System/Net/HttpValidationHelpers.cs ../../../external/corefx/src/System.Net.HttpListener/src/System/Net/WebSockets/HttpListenerWebSocketContext.cs diff --git a/mcs/class/System/corefx/SR.cs b/mcs/class/System/corefx/SR.cs index a7ade18f15..d83dc9b869 100644 --- a/mcs/class/System/corefx/SR.cs +++ b/mcs/class/System/corefx/SR.cs @@ -232,4 +232,66 @@ partial class SR public const string net_listener_close = "Listener closed."; public const string net_invalid_port = "Invalid port in prefix."; public const string net_WebSockets_InvalidState = "The WebSocket is in an invalid state ('{0}') for this operation. Valid states are: '{1}'"; + public const string net_unknown_prefix = "The URI prefix is not recognized."; + public const string net_reqsubmitted = "This operation cannot be performed after the request has been submitted."; + public const string net_io_timeout_use_ge_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value >= 0."; + public const string net_writestarted = "This property cannot be set after writing has started."; + public const string net_badmethod = "Cannot set null or blank methods on request."; + public const string net_servererror = "The remote server returned an error: ({0}) {1}."; + public const string net_reqaborted = "The request was aborted: The request was canceled."; + public const string net_OperationNotSupportedException = "This operation is not supported."; + public const string net_nouploadonget = "Cannot send a content-body with this verb-type."; + public const string net_repcall = "Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress."; + public const string net_securityprotocolnotsupported = "The requested security protocol is not supported."; + public const string net_requestaborted = "The request was aborted: {0}."; + public const string net_webstatus_Timeout = "The operation has timed out."; + public const string net_baddate = "The value of the date string in the header is invalid."; + public const string net_connarg = "Keep-Alive and Close may not be set using this property."; + public const string net_fromto = "The From parameter cannot be less than To."; + public const string net_needchunked = "TransferEncoding requires the SendChunked property to be set to true."; + public const string net_no100 = "100-Continue may not be set using this property."; + public const string net_nochunked = "Chunked encoding must be set via the SendChunked property."; + public const string net_nottoken = "The supplied string is not a valid HTTP token."; + public const string net_rangetoosmall = "The From or To parameter cannot be less than 0."; + public const string net_rangetype = "A different range specifier has already been added to this request."; + public const string net_toosmall = "The specified value must be greater than 0."; + public const string net_WebHeaderInvalidCRLFChars = "Specified value has invalid CRLF characters."; + public const string net_WebHeaderInvalidHeaderChars = "Specified value has invalid HTTP Header characters."; + public const string net_timeout = "The operation has timed out."; + public const string net_completed_result = "This operation cannot be performed on a completed asynchronous result object."; + public const string net_PropertyNotSupportedException = "This property is not supported by this class."; + public const string net_InvalidStatusCode = "The server returned a status code outside the valid range of 100-599."; + 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_ftp_servererror = "The remote server returned an error: {0}."; + public const string net_ftp_active_address_different = "The data connection was made from an address that is different than the address to which the FTP connection was made."; + public const string net_ftp_invalid_method_name = "FTP Method names cannot be null or empty."; + public const string net_ftp_invalid_renameto = "The RenameTo filename cannot be null or empty."; + public const string net_ftp_invalid_response_filename = "The server returned the filename ({0}) which is not valid."; + public const string net_ftp_invalid_status_response = "The status response ({0}) is not expected in response to '{1}' command."; + public const string net_ftp_invalid_uri = "The requested URI is invalid for this FTP command."; + public const string net_ftp_no_defaultcreds = "Default credentials are not supported on an FTP request."; + public const string net_ftp_response_invalid_format = "The response string '{0}' has invalid format."; + public const string net_ftp_server_failed_passive = "The server failed the passive mode request with status response ({0})."; + public const string net_ftp_unsupported_method = "This method is not supported."; + public const string net_ftp_protocolerror = "The underlying connection was closed: The server committed a protocol violation"; + public const string net_ftp_receivefailure = "The underlying connection was closed: An unexpected error occurred on a receive"; + public const string net_webstatus_NameResolutionFailure = "The remote name could not be resolved"; + public const string net_webstatus_ConnectFailure = "Unable to connect to the remote server"; + public const string net_ftpstatuscode_ServiceNotAvailable = "Service not available, closing control connection."; + public const string net_ftpstatuscode_CantOpenData = "Can't open data connection"; + public const string net_ftpstatuscode_ConnectionClosed = "Connection closed; transfer aborted"; + public const string net_ftpstatuscode_ActionNotTakenFileUnavailableOrBusy = "File unavailable (e.g., file busy)"; + public const string net_ftpstatuscode_ActionAbortedLocalProcessingError = "Local error in processing"; + public const string net_ftpstatuscode_ActionNotTakenInsufficientSpace = "Insufficient storage space in system"; + public const string net_ftpstatuscode_CommandSyntaxError = "Syntax error, command unrecognized"; + public const string net_ftpstatuscode_ArgumentSyntaxError = "Syntax error in parameters or arguments"; + public const string net_ftpstatuscode_CommandNotImplemented = "Command not implemented"; + public const string net_ftpstatuscode_BadCommandSequence = "Bad sequence of commands"; + public const string net_ftpstatuscode_NotLoggedIn = "Not logged in"; + public const string net_ftpstatuscode_AccountNeeded = "Need account for storing files"; + public const string net_ftpstatuscode_ActionNotTakenFileUnavailable = "File unavailable (e.g., file not found, no access)"; + public const string net_ftpstatuscode_ActionAbortedUnknownPageType = "Page type unknown"; + public const string net_ftpstatuscode_FileActionAborted = "Exceeded storage allocation (for current directory or data set)"; + public const string net_ftpstatuscode_ActionNotTakenFilenameNotAllowed = "File name not allowed"; + public const string net_invalid_host = "The specified value is not a valid Host header string."; } diff --git a/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs b/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs index 783350b093..4aa9fbe922 100644 --- a/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs +++ b/mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs @@ -191,7 +191,7 @@ namespace System.IO.Packaging { string ext = Path.GetExtension (file); if (ext.StartsWith(".")) ext = ext.Substring (1); - xPath = string.Format("/content:Types/content:Default[@Extension='{0}']", ext); + xPath = string.Format("/content:Types/content:Default[translate(@Extension,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='{0}']", ext.ToUpperInvariant()); node = doc.SelectSingleNode (xPath, manager); } diff --git a/mcs/class/corlib/Assembly/AssemblyInfo.cs b/mcs/class/corlib/Assembly/AssemblyInfo.cs index 7c3809e7f0..54b21cdf3b 100644 --- a/mcs/class/corlib/Assembly/AssemblyInfo.cs +++ b/mcs/class/corlib/Assembly/AssemblyInfo.cs @@ -75,7 +75,6 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)] [assembly: InternalsVisibleTo ("System.Core, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)] -[assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")] [assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")] diff --git a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml index 4d36758a43..3ca101e24c 100644 --- a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml +++ b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml @@ -171,6 +171,7 @@ + @@ -229,6 +230,9 @@ + + + @@ -464,6 +468,11 @@ + + + + + diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index 4185a545b2..5c1c87c8d6 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -6,7 +6,7 @@ export __SECURITY_BOOTSTRAP_DB=$(topdir)/class/corlib LIBRARY = corlib.dll LIBRARY_NAME = mscorlib.dll -LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%) -nowarn:3019 +LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) $(RESOURCE_FILES:%=-resource:%) LIBRARY_WARN_AS_ERROR = yes #LIBRARY_USE_INTERMEDIATE_FILE = yes @@ -114,6 +114,11 @@ endif TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe \ -define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%) -resource:LinkerDescriptor/mscorlib_test.xml,$(test_lib:.dll=.xml) +ifeq ($(PROFILE),net_4_x) +LIB_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE +TEST_MCS_FLAGS += -d:FEATURE_CRYPTO_CONFIGURABLE +endif + CC_PROFILE := $(filter monotouch% xammac, $(PROFILE)) ifdef CC_PROFILE diff --git a/mcs/class/corlib/ReferenceSources/EncodingTable.cs b/mcs/class/corlib/ReferenceSources/EncodingTable.cs index 4f768cfbf4..fe5b7f8a91 100644 --- a/mcs/class/corlib/ReferenceSources/EncodingTable.cs +++ b/mcs/class/corlib/ReferenceSources/EncodingTable.cs @@ -535,8 +535,8 @@ ENC ("x-x-big5", 950), MapCodePageDataItem( 500, 1252, "IBM500", 0), // "IBM EBCDIC (International)" MapCodePageDataItem( 708, 1256, "ASMO-708", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (ASMO 708)" // MapCodePageDataItem( 720, 1256, "DOS-720", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Arabic (DOS)" -// MapCodePageDataItem( 737, 1253, "ibm737", 0), // "Greek (DOS)" -// MapCodePageDataItem( 775, 1257, "ibm775", 0), // "Baltic (DOS)" + MapCodePageDataItem( 737, 1253, "ibm737", 0), // "Greek (DOS)" + MapCodePageDataItem( 775, 1257, "ibm775", 0), // "Baltic (DOS)" MapCodePageDataItem( 850, 1252, "ibm850", 0), // "Western European (DOS)" MapCodePageDataItem( 852, 1250, "ibm852", MIMECONTF_BROWSER | MIMECONTF_SAVABLE_BROWSER), // "Central European (DOS)" MapCodePageDataItem( 855, 1252, "IBM855", 0), // "OEM Cyrillic" diff --git a/mcs/class/corlib/ReferenceSources/String.cs b/mcs/class/corlib/ReferenceSources/String.cs index a4a50c8eb4..bb6cad7429 100644 --- a/mcs/class/corlib/ReferenceSources/String.cs +++ b/mcs/class/corlib/ReferenceSources/String.cs @@ -354,7 +354,7 @@ namespace System throw new ArgumentOutOfRangeException("indexB", Environment.GetResourceString("ArgumentOutOfRange_Index")); return CompareOrdinalUnchecked (strA, indexA, count, strB, indexB, count); - } + } unsafe String ReplaceInternal (char oldChar, char newChar) { @@ -501,7 +501,7 @@ namespace System while (p < end) { *p++ = paddingChar; } - } else { + } else { char *p = dest; char *end = p + totalWidth - m_stringLength; while (p < end) { @@ -768,5 +768,16 @@ namespace System return result; } + + [IndexerName ("Chars")] + public char this [int index] { + [IntrinsicAttribute] + get { + if ((uint)index >= m_stringLength) + ThrowHelper.ThrowIndexOutOfRangeException (); + + return Unsafe.Add (ref m_firstChar, index); + } + } } } \ No newline at end of file diff --git a/mcs/class/corlib/System.Diagnostics/StackTrace.cs b/mcs/class/corlib/System.Diagnostics/StackTrace.cs index b528e4cdad..e41884b2df 100644 --- a/mcs/class/corlib/System.Diagnostics/StackTrace.cs +++ b/mcs/class/corlib/System.Diagnostics/StackTrace.cs @@ -56,6 +56,7 @@ namespace System.Diagnostics { } public const int METHODS_TO_SKIP = 0; + const string prefix = " at "; private StackFrame[] frames; readonly StackTrace[] captured_traces; @@ -198,31 +199,25 @@ namespace System.Diagnostics { bool AddFrames (StringBuilder sb) { - string debugInfo, indentation; - string unknown = Locale.GetText (""); + bool any_frame = false; - indentation = " "; - debugInfo = Locale.GetText (" in {0}:{1} "); - - var newline = String.Format ("{0}{1}{2} ", Environment.NewLine, indentation, - Locale.GetText ("at")); - - int i; - for (i = 0; i < FrameCount; i++) { + for (int i = 0; i < FrameCount; i++) { StackFrame frame = GetFrame (i); - if (i == 0) - sb.AppendFormat ("{0}{1} ", indentation, Locale.GetText ("at")); - else - sb.Append (newline); if (frame.GetMethod () == null) { + if (any_frame) + sb.Append (Environment.NewLine); + sb.Append (prefix); + string internal_name = frame.GetInternalMethodName (); if (internal_name != null) sb.Append (internal_name); else - sb.AppendFormat ("<0x{0:x5} + 0x{1:x5}> {2}", frame.GetMethodAddress (), frame.GetNativeOffset (), unknown); + sb.AppendFormat ("<0x{0:x5} + 0x{1:x5}> ", frame.GetMethodAddress (), frame.GetNativeOffset ()); } else { - GetFullNameForStackTrace (sb, frame.GetMethod ()); + GetFullNameForStackTrace (sb, frame.GetMethod (), any_frame, out var skipped); + if (skipped) + continue; if (frame.GetILOffset () == -1) { sb.AppendFormat (" <0x{0:x5} + 0x{1:x5}>", frame.GetMethodAddress (), frame.GetNativeOffset ()); @@ -243,34 +238,48 @@ namespace System.Diagnostics { } } - sb.AppendFormat (debugInfo, filename, frame.GetFileLineNumber ()); + sb.AppendFormat (" in {0}:{1} ", filename, frame.GetFileLineNumber ()); } + + any_frame = true; } - return i != 0; + return any_frame; } - internal void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi) + void GetFullNameForStackTrace (StringBuilder sb, MethodBase mi, bool needsNewLine, out bool skipped) { var declaringType = mi.DeclaringType; - if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition) - declaringType = declaringType.GetGenericTypeDefinition (); // Get generic definition - const BindingFlags bindingflags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - foreach (var m in declaringType.GetMethods (bindingflags)) { - if (m.MetadataToken == mi.MetadataToken) { - mi = m; - break; + if (declaringType.IsGenericType && !declaringType.IsGenericTypeDefinition) { + declaringType = declaringType.GetGenericTypeDefinition (); + + const BindingFlags bindingflags = BindingFlags.Instance | BindingFlags.Static | + BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.DeclaredOnly; + foreach (var m in declaringType.GetMethods (bindingflags)) { + if (m.MetadataToken == mi.MetadataToken) { + mi = m; + break; + } } } + skipped = mi.IsDefined (typeof(StackTraceHiddenAttribute)) || declaringType.IsDefined (typeof(StackTraceHiddenAttribute)); + if (skipped) + return; + + if (needsNewLine) + sb.Append (Environment.NewLine); + sb.Append (prefix); + sb.Append (declaringType.ToString ()); sb.Append ("."); sb.Append (mi.Name); if (mi.IsGenericMethod) { + mi = ((MethodInfo)mi).GetGenericMethodDefinition (); Type[] gen_params = mi.GetGenericArguments (); sb.Append ("["); for (int j = 0; j < gen_params.Length; j++) { @@ -300,7 +309,7 @@ namespace System.Diagnostics { } } sb.Append (")"); - } + } public override string ToString () { diff --git a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs index 935bd6c890..ad15d35f94 100644 --- a/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs +++ b/mcs/class/corlib/System.IO.IsolatedStorage/IsolatedStorageFile.cs @@ -810,12 +810,19 @@ namespace System.IO.IsolatedStorage { DirectoryInfo[] subdirs = directory.GetDirectories (path); // we're looking for a single result, identical to path (no pattern here) // we're also looking for something under the current path (not outside isolated storage) - if ((subdirs.Length == 1) && (subdirs [0].Name == path) && (subdirs [0].FullName.IndexOf (directory.FullName) >= 0)) { - afi = subdirs [0].GetFiles (pattern); - } else { - // CAS, even in FullTrust, normally enforce IsolatedStorage - throw new SecurityException (); - } + if (subdirs.Length != 1) + throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage + + //the base directory must be the prefix of the subdir + if (!subdirs [0].FullName.StartsWith (directory.FullName)) + throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage + + //the subdir suffix must be equal to the provided one + var subdir_suffix = subdirs [0].FullName.Substring (directory.FullName.Length + 1); //skip the dir separator + if (subdir_suffix != path) + throw new SecurityException (); // CAS, even in FullTrust, normally enforce IsolatedStorage + + afi = subdirs [0].GetFiles (pattern); } return GetNames (afi); diff --git a/mcs/class/corlib/System.Reflection/AssemblyName.cs b/mcs/class/corlib/System.Reflection/AssemblyName.cs index 8ad01b437f..8c112d655e 100644 --- a/mcs/class/corlib/System.Reflection/AssemblyName.cs +++ b/mcs/class/corlib/System.Reflection/AssemblyName.cs @@ -456,7 +456,10 @@ namespace System.Reflection { return (cultureinfo == null)? null : cultureinfo.Name; } set { - throw new NotImplementedException (); + if (value == null) + cultureinfo = null; + else + cultureinfo = new CultureInfo (value); } } diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs index 46398d8561..1e768ca5d4 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Certificate.cs @@ -111,19 +111,15 @@ namespace System.Security.Cryptography.X509Certificates { internal X509Certificate (X509CertificateImpl impl) { - if (impl == null) - throw new ArgumentNullException ("impl"); - this.impl = X509Helper.InitFromCertificate (impl); } - public X509Certificate (System.Security.Cryptography.X509Certificates.X509Certificate cert) + public X509Certificate (X509Certificate cert) { if (cert == null) throw new ArgumentNullException ("cert"); impl = X509Helper.InitFromCertificate (cert); - hideDates = false; } internal void ImportHandle (X509CertificateImpl impl) @@ -134,7 +130,6 @@ namespace System.Security.Cryptography.X509Certificates { internal X509CertificateImpl Impl { get { - X509Helper.ThrowIfContextInvalid (impl); return impl; } } diff --git a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs index 4272f8d2e0..b4e0988134 100644 --- a/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs +++ b/mcs/class/corlib/System.Security.Cryptography.X509Certificates/X509Helper.cs @@ -136,7 +136,9 @@ namespace System.Security.Cryptography.X509Certificates public static X509CertificateImpl InitFromCertificate (X509CertificateImpl impl) { - ThrowIfContextInvalid (impl); + if (impl == null) + return null; + var copy = impl.Clone (); if (copy != null) return copy; diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs similarity index 90% rename from mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs rename to mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs index 5cef04313c..5bb37008de 100755 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.Mobile.cs @@ -30,7 +30,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if FULL_AOT_RUNTIME +#if !FEATURE_CRYPTO_CONFIGURABLE // This is a special version of CryptoConfig that is not configurable and // every "choice" is statiscally compiled. As long as CreateFromName is not @@ -38,17 +38,13 @@ using System.Runtime.InteropServices; using System.Security.Permissions; +using System.Collections.Generic; namespace System.Security.Cryptography { [ComVisible (true)] public partial class CryptoConfig { - public static void AddAlgorithm (Type algorithm, params string[] names) - { - throw new PlatformNotSupportedException (); - } - public static void AddOID (string oid, params string[] names) { throw new PlatformNotSupportedException (); @@ -61,12 +57,12 @@ namespace System.Security.Cryptography { return CreateFromName (name, null); } - [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)] public static object CreateFromName (string name, params object[] args) { if (name == null) throw new ArgumentNullException ("name"); + // TODO: These ignore args switch (name.ToLowerInvariant ()) { case "system.security.cryptography.dsacryptoserviceprovider": case "system.security.cryptography.dsa": @@ -94,6 +90,7 @@ namespace System.Security.Cryptography { case "system.security.cryptography.hmac": case "system.security.cryptography.hmacsha1": case "hmacsha1": + case "http://www.w3.org/2000/09/xmldsig#hmac-sha1": return new HMACSHA1 (); case "system.security.cryptography.hmacsha256": case "hmacsha256": @@ -155,8 +152,8 @@ namespace System.Security.Cryptography { case "system.security.cryptography.hashalgorithm": case "system.security.cryptography.sha1": case "system.security.cryptography.sha1cryptoserviceprovider": - case "system.security.cryptography.sha1cng": case "sha1": + case "system.security.cryptography.sha1cng": case "sha": case "http://www.w3.org/2000/09/xmldsig#sha1": return new SHA1CryptoServiceProvider (); @@ -192,23 +189,47 @@ namespace System.Security.Cryptography { case "tripledes": case "3des": return new TripleDESCryptoServiceProvider (); + + // These are not yet linker friendly case "x509chain": name = "System.Security.Cryptography.X509Certificates.X509Chain, System"; break; + case "2.5.29.15": + name = "System.Security.Cryptography.X509Certificates.X509KeyUsageExtension, System"; + break; + case "2.5.29.19": + name = "System.Security.Cryptography.X509Certificates.X509BasicConstraintsExtension, System"; + break; + case "2.5.29.14": + name = "System.Security.Cryptography.X509Certificates.X509SubjectKeyIdentifierExtension, System"; + break; + case "2.5.29.37": + name = "System.Security.Cryptography.X509Certificates.X509EnhancedKeyUsageExtension, System"; + break; case "aes": -#if FULL_AOT_DESKTOP // TODO: why is this special cased? we could use AesManaged like other full AOT profiles - name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core"; -#else +#if MONOTOUCH || XAMMAC name = "System.Security.Cryptography.AesManaged, System.Core"; +#else + name = "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 { + } + } + } + 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)); + return Activator.CreateInstance (Type.GetType (name), args); } catch { // method doesn't throw any exception @@ -271,6 +292,11 @@ namespace System.Security.Cryptography { return null; } } + + static void Initialize () + { + algorithms = new Dictionary (StringComparer.OrdinalIgnoreCase); + } } } diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs index f4a9d9ca41..769279d1c6 100644 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.common.cs @@ -29,9 +29,43 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +using System.Collections.Generic; + namespace System.Security.Cryptography { - public partial class CryptoConfig { + public partial class CryptoConfig + { + static readonly object lockObject = new object (); + static Dictionary algorithms; + + public static void AddAlgorithm (Type algorithm, params string[] names) + { + if (algorithm == null) + throw new ArgumentNullException (nameof (algorithm)); + if (!algorithm.IsVisible) + throw new ArgumentException ("Algorithms added to CryptoConfig must be accessable from outside their assembly.", nameof (algorithm)); + if (names == null) + throw new ArgumentNullException (nameof (names)); + + var algorithmNames = new string [names.Length]; + Array.Copy (names, algorithmNames, algorithmNames.Length); + + foreach (string name in algorithmNames) { + if (string.IsNullOrEmpty (name)) { + throw new ArgumentException ("CryptoConfig cannot add a mapping for a null or empty name."); + } + } + + lock (lockObject) { + if (algorithms == null) { + Initialize (); + } + + foreach (string name in algorithmNames) { + algorithms [name] = algorithm; + } + } + } public static byte[] EncodeOID (string str) { diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs index bd9af4717b..9b06caef38 100644 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.cs @@ -30,7 +30,7 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if !FULL_AOT_RUNTIME +#if FEATURE_CRYPTO_CONFIGURABLE using System.Collections; using System.Collections.Generic; @@ -50,8 +50,6 @@ namespace System.Security.Cryptography { [ComVisible (true)] public partial class CryptoConfig { - static private object lockObject; - static private Dictionary algorithms; static private Dictionary unresolved_algorithms; static private Dictionary oids; @@ -204,6 +202,7 @@ public partial class CryptoConfig { private const string urlSHA256 = "http://www.w3.org/2001/04/xmlenc#sha256"; private const string urlSHA384 = "http://www.w3.org/2001/04/xmldsig-more#sha384"; private const string urlSHA512 = "http://www.w3.org/2001/04/xmlenc#sha512"; + private const string urlHMACSHA1 = "http://www.w3.org/2000/09/xmldsig#hmac-sha1"; private const string urlHMACSHA256 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256"; private const string urlHMACSHA384 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha384"; private const string urlHMACSHA512 = "http://www.w3.org/2001/04/xmldsig-more#hmac-sha512"; @@ -280,12 +279,6 @@ public partial class CryptoConfig { // SHA512 provider const string nameSHA512Provider = "System.Security.Cryptography.SHA512CryptoServiceProvider"; const string defaultSHA512Provider = "System.Security.Cryptography.SHA512CryptoServiceProvider" + system_core_assembly; - static CryptoConfig () - { - // lock(this) is bad - // http://msdn.microsoft.com/library/en-us/dnaskdr/html/askgui06032003.asp?frame=true - lockObject = new object (); - } private static void Initialize () { @@ -384,6 +377,7 @@ public partial class CryptoConfig { algorithms.Add (urlSHA256, defaultSHA256); algorithms.Add (urlSHA384, defaultSHA384); algorithms.Add (urlSHA512, defaultSHA512); + algorithms.Add (urlHMACSHA1, defaultHMAC); algorithms.Add (urlHMACSHA256, defaultHMACSHA256); algorithms.Add (urlHMACSHA384, defaultHMACSHA384); algorithms.Add (urlHMACSHA512, defaultHMACSHA512); @@ -560,20 +554,6 @@ public partial class CryptoConfig { return result; } - public static void AddAlgorithm (Type algorithm, params string[] names) - { - if (algorithm == null) - throw new ArgumentNullException ("algorithm"); - if (names == null) - throw new ArgumentNullException ("names"); - - foreach (string name in names) { - if (String.IsNullOrWhiteSpace (name)) - throw new ArithmeticException ("names"); - algorithms [name] = algorithm; - } - } - public static void AddOID (string oid, params string[] names) { if (oid == null) diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 34682bcb4e..4cf9b0ede1 100644 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -311,7 +311,7 @@ namespace System.Threading { // Returns the system thread handle [MethodImplAttribute(MethodImplOptions.InternalCall)] - private extern IntPtr Thread_internal (MulticastDelegate start); + private extern bool Thread_internal (MulticastDelegate start); private Thread (InternalThread it) { internal_thread = it; @@ -484,7 +484,7 @@ namespace System.Threading { #endif // Thread_internal creates and starts the new thread, - if (Thread_internal(m_Delegate) == IntPtr.Zero) + if (!Thread_internal(m_Delegate)) throw new SystemException ("Thread creation failed."); m_ThreadStartArg = null; diff --git a/mcs/class/corlib/System.Threading/WaitHandle.cs b/mcs/class/corlib/System.Threading/WaitHandle.cs index 0e16f046e8..afb31b07dc 100644 --- a/mcs/class/corlib/System.Threading/WaitHandle.cs +++ b/mcs/class/corlib/System.Threading/WaitHandle.cs @@ -47,12 +47,68 @@ namespace System.Threading internal const int MaxWaitHandles = 64; + // We rely on the reference source implementation of WaitHandle, and it delegates to a function named + // WaitOneNative to perform the actual operation of waiting on a handle. + // This native operation actually has to call back into managed code and invoke .Wait + // on the current SynchronizationContext. As such, our implementation of this "native" method + // is actually managed code, and the real native icall being used is Wait_internal. + static int WaitOneNative (SafeHandle waitableSafeHandle, uint millisecondsTimeout, bool hasThreadAffinity, bool exitContext) + { + bool release = false; +#if !MONODROID + var context = SynchronizationContext.Current; +#endif + try { + waitableSafeHandle.DangerousAddRef (ref release); + +#if !DISABLE_REMOTING + if (exitContext) + SynchronizationAttribute.ExitContext (); +#endif + +#if !MONODROID + // HACK: Documentation (and public posts by experts like Joe Duffy) suggests that + // users must first call SetWaitNotificationRequired to flag that a given synchronization + // context overrides .Wait. Because invoking the Wait method is somewhat expensive, we use + // the notification-required flag to determine whether or not we should invoke the managed + // wait method. + // Another option would be to check whether this context uses the default Wait implementation, + // but I don't know of a cheap way to do this that handles derived types correctly. + // If the thread does not have a synchronization context set at all, we can safely just + // jump directly to invoking Wait_internal. + if ((context != null) && context.IsWaitNotificationRequired ()) { + return context.Wait ( + new IntPtr[] { waitableSafeHandle.DangerousGetHandle () }, + false, + (int)millisecondsTimeout + ); + } else +#endif + { + unsafe { + IntPtr handle = waitableSafeHandle.DangerousGetHandle (); + return Wait_internal (&handle, 1, false, (int)millisecondsTimeout); + } + } + } finally { + if (release) + waitableSafeHandle.DangerousRelease (); + +#if !DISABLE_REMOTING + if (exitContext) + SynchronizationAttribute.EnterContext (); +#endif + } + + } + static int WaitMultiple(WaitHandle[] waitHandles, int millisecondsTimeout, bool exitContext, bool WaitAll) { if (waitHandles.Length > MaxWaitHandles) return WAIT_FAILED; int release_last = -1; + var context = SynchronizationContext.Current; try { #if !DISABLE_REMOTING @@ -70,45 +126,31 @@ namespace System.Threading } } - unsafe { - IntPtr* handles = stackalloc IntPtr[waitHandles.Length]; - + if ((context != null) && context.IsWaitNotificationRequired ()) { + IntPtr[] handles = new IntPtr[waitHandles.Length]; for (int i = 0; i < waitHandles.Length; ++i) handles[i] = waitHandles[i].SafeWaitHandle.DangerousGetHandle (); - return Wait_internal(handles, waitHandles.Length, WaitAll, millisecondsTimeout); + return context.Wait ( + handles, + false, + (int)millisecondsTimeout + ); + } else { + unsafe { + IntPtr* handles = stackalloc IntPtr[waitHandles.Length]; + + for (int i = 0; i < waitHandles.Length; ++i) + handles[i] = waitHandles[i].SafeWaitHandle.DangerousGetHandle (); + + return Wait_internal (handles, waitHandles.Length, WaitAll, millisecondsTimeout); + } } } finally { for (int i = release_last; i >= 0; --i) { waitHandles [i].SafeWaitHandle.DangerousRelease (); } -#if !DISABLE_REMOTING - if (exitContext) - SynchronizationAttribute.EnterContext (); -#endif - } - } - - static int WaitOneNative (SafeHandle waitableSafeHandle, uint millisecondsTimeout, bool hasThreadAffinity, bool exitContext) - { - bool release = false; - try { -#if !DISABLE_REMOTING - if (exitContext) - SynchronizationAttribute.ExitContext (); -#endif - - waitableSafeHandle.DangerousAddRef (ref release); - - unsafe { - IntPtr handle = waitableSafeHandle.DangerousGetHandle(); - return Wait_internal(&handle, 1, false, (int)millisecondsTimeout); - } - } finally { - if (release) - waitableSafeHandle.DangerousRelease (); - #if !DISABLE_REMOTING if (exitContext) SynchronizationAttribute.EnterContext (); @@ -117,7 +159,7 @@ namespace System.Threading } [MethodImplAttribute(MethodImplOptions.InternalCall)] - unsafe static extern int Wait_internal(IntPtr* handles, int numHandles, bool waitAll, int ms); + internal unsafe static extern int Wait_internal(IntPtr* handles, int numHandles, bool waitAll, int ms); static int SignalAndWaitOne (SafeWaitHandle waitHandleToSignal,SafeWaitHandle waitHandleToWaitOn, int millisecondsTimeout, bool hasThreadAffinity, bool exitContext) { diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs index 52a43abf1d..aa0d8fca91 100644 --- a/mcs/class/corlib/System/Console.cs +++ b/mcs/class/corlib/System/Console.cs @@ -36,6 +36,7 @@ using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; +using System.Threading; namespace System { @@ -751,16 +752,12 @@ namespace System } } - delegate void InternalCancelHandler (); - -#pragma warning disable 414 - // - // Used by console-io.c - // - static readonly InternalCancelHandler cancel_handler = new InternalCancelHandler (DoConsoleCancelEvent); -#pragma warning restore 414 + static void DoConsoleCancelEventInBackground () + { + ThreadPool.UnsafeQueueUserWorkItem (_ => DoConsoleCancelEvent(), null); + } - internal static void DoConsoleCancelEvent () + static void DoConsoleCancelEvent () { bool exit = true; if (cancel_event != null) { diff --git a/mcs/class/corlib/System/Delegate.cs b/mcs/class/corlib/System/Delegate.cs index 48d7860514..958b70ce81 100644 --- a/mcs/class/corlib/System/Delegate.cs +++ b/mcs/class/corlib/System/Delegate.cs @@ -134,6 +134,8 @@ namespace System if (!match) { if (delArgType.IsEnum && Enum.GetUnderlyingType (delArgType) == argType) match = true; + else if (argType.IsEnum && Enum.GetUnderlyingType (argType) == delArgType) + match = true; } return match; diff --git a/mcs/class/corlib/System/TimeZoneInfo.cs b/mcs/class/corlib/System/TimeZoneInfo.cs index a1eaf2a7cf..7cffacce05 100644 --- a/mcs/class/corlib/System/TimeZoneInfo.cs +++ b/mcs/class/corlib/System/TimeZoneInfo.cs @@ -266,11 +266,12 @@ namespace System } } #if LIBC + const string DefaultTimeZoneDirectory = "/usr/share/zoneinfo"; static string timeZoneDirectory; static string TimeZoneDirectory { get { if (timeZoneDirectory == null) - timeZoneDirectory = "/usr/share/zoneinfo"; + timeZoneDirectory = readlink (DefaultTimeZoneDirectory) ?? DefaultTimeZoneDirectory; return timeZoneDirectory; } set { diff --git a/mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs.REMOVED.git-id b/mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs.REMOVED.git-id index 004ecc8ee3..42cd446a8b 100644 --- a/mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs.REMOVED.git-id +++ b/mcs/class/corlib/Test/Microsoft.Win32/RegistryKeyTest.cs.REMOVED.git-id @@ -1 +1 @@ -a038b6c7fdad81fce73b4e0580c8b1d0159a7920 \ No newline at end of file +ea5e716e270682aa982464368bc77d8d447869c8 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs index 75b2de89aa..e4ed717273 100644 --- a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs +++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentDictionaryTests.cs @@ -29,6 +29,8 @@ using MonoTests.System.Threading.Tasks; using System.Collections; using System.Collections.Generic; using System.Collections.Concurrent; +using System.IO; +using System.Runtime.Serialization.Formatters.Binary; using NUnit; using NUnit.Framework; @@ -67,6 +69,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void AddParallelWithoutDuplicateTest () { ParallelTestHelper.Repeat (delegate { @@ -98,6 +101,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void RemoveParallelTest () { ParallelTestHelper.Repeat (delegate { @@ -362,5 +366,20 @@ namespace MonoTests.System.Collections.Concurrent Assert.IsTrue (dict.Contains (validKeyPair)); Assert.IsFalse (dict.Contains (wrongKeyPair)); } + + [Test] + public void SerializationRoundTrip () + { + var bf = new BinaryFormatter(); + + var cd = new ConcurrentDictionary(); + cd[0] = 42; + var ms = new MemoryStream(); + bf.Serialize(ms, cd); + + ms.Seek(0, SeekOrigin.Begin); + var result = (ConcurrentDictionary) bf.Deserialize(ms); + Assert.AreEqual (42, result [0]); + } } } diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentQueueTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentQueueTests.cs index a6351e511f..ff92589f58 100644 --- a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentQueueTests.cs +++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentQueueTests.cs @@ -50,6 +50,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void StressEnqueueTestCase () { /*ParallelTestHelper.Repeat (delegate { @@ -79,6 +80,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void StressDequeueTestCase () { /*ParallelTestHelper.Repeat (delegate { @@ -116,6 +118,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void StressTryPeekTestCase () { ParallelTestHelper.Repeat (delegate { diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentStackTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentStackTests.cs index 4086ede09d..0bc60089b3 100644 --- a/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentStackTests.cs +++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ConcurrentStackTests.cs @@ -46,6 +46,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void StressPushTestCase () { /*ParallelTestHelper.Repeat (delegate { @@ -74,6 +75,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void StressPopTestCase () { /*ParallelTestHelper.Repeat (delegate { diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentQueueTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentQueueTests.cs index 5f5abb60de..59eeeb95b0 100644 --- a/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentQueueTests.cs +++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentQueueTests.cs @@ -43,6 +43,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void CountTestCase() { const int numThread = 5; diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentStackTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentStackTests.cs index ef7758c244..7568a5da17 100644 --- a/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentStackTests.cs +++ b/mcs/class/corlib/Test/System.Collections.Concurrent/ParallelConcurrentStackTests.cs @@ -43,6 +43,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] + [Category ("MultiThreaded")] public void CountTestCase() { const int numThread = 5; diff --git a/mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs b/mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs index e46dd7e31f..11851a216e 100644 --- a/mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs +++ b/mcs/class/corlib/Test/System.Collections.Concurrent/PartitionerTests.cs @@ -37,7 +37,7 @@ namespace MonoTests.System.Collections.Concurrent public class PartitionerTests { [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void PartitionerCreateIntegerWithExplicitRange () { OrderablePartitioner> partitioner = Partitioner.Create (1, 20, 5); @@ -59,7 +59,7 @@ namespace MonoTests.System.Collections.Concurrent } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void PartitionerCreateLongWithExplicitRange () { OrderablePartitioner> partitioner = Partitioner.Create ((long)1, (long)20, (long)5); diff --git a/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs b/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs index 188fc33b5e..50aad53645 100644 --- a/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs +++ b/mcs/class/corlib/Test/System.Globalization/CultureInfoTest.cs @@ -725,6 +725,7 @@ namespace MonoTests.System.Globalization } [Test] + [Category ("MultiThreaded")] public void DefaultThreadCurrentCultureIsIgnoredWhenCultureFlowsToThread () { string us_str = null; diff --git a/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs b/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs index 474a3bba20..a6327c4b05 100644 --- a/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs +++ b/mcs/class/corlib/Test/System.IO.IsolatedStorage/IsolatedStorageFileTest.cs @@ -1118,5 +1118,17 @@ namespace MonoTests.System.IO.IsolatedStorageTest { isf.DeleteDirectory ("/test"); } } + + [Test] //fixes bxc #11771 + public void GetFileNamesWithMultiSegmentDirectory () + { + string dir = Path.Combine("Dir", "Level"); + using (var f = IsolatedStorageFile.GetUserStoreForAssembly ()) + { + f.CreateDirectory (dir); + f.GetFileNames (Path.Combine (dir, "*")); + f.DeleteDirectory (dir); + } + } } } diff --git a/mcs/class/corlib/Test/System.IO/DriveInfoTest.cs b/mcs/class/corlib/Test/System.IO/DriveInfoTest.cs index e23b087a08..777aaad2bb 100644 --- a/mcs/class/corlib/Test/System.IO/DriveInfoTest.cs +++ b/mcs/class/corlib/Test/System.IO/DriveInfoTest.cs @@ -65,7 +65,7 @@ namespace MonoTests.System.IO } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void GetDrivesValidInfo () { var drives = DriveInfo.GetDrives (); diff --git a/mcs/class/corlib/Test/System.IO/FileTest.cs b/mcs/class/corlib/Test/System.IO/FileTest.cs index e9300c82c7..8f123ac8a6 100644 --- a/mcs/class/corlib/Test/System.IO/FileTest.cs +++ b/mcs/class/corlib/Test/System.IO/FileTest.cs @@ -1264,6 +1264,57 @@ namespace MonoTests.System.IO } } + /* regression test for https://github.com/mono/mono/issues/7646 */ + [Test] + public void LastWriteTimeSubMs () + { + string path = tmpFolder + Path.DirectorySeparatorChar + "lastWriteTimeSubMs"; + if (File.Exists (path)) + File.Delete (path); + try { + var fmt = "HH:mm:ss:fffffff"; + for (var i = 0; i < 200; i++) { + File.WriteAllText (path, ""); + var untouched = File.GetLastWriteTimeUtc (path); + File.SetLastWriteTimeUtc (path, DateTime.UtcNow); + var touched = File.GetLastWriteTimeUtc (path); + + Assert.IsTrue (touched >= untouched, $"Iteration #{i} failed, untouched: {untouched.ToString (fmt)} touched: {touched.ToString (fmt)}"); + } + } finally { + DeleteFile (path); + } + } + + /* regression test from https://github.com/xamarin/xamarin-macios/issues/3929 */ + [Test] + public void LastWriteTimeSubMsCopy () + { + string path = tmpFolder + Path.DirectorySeparatorChar + "lastWriteTimeSubMs"; + if (File.Exists (path)) + File.Delete (path); + + string path_copy = tmpFolder + Path.DirectorySeparatorChar + "LastWriteTimeSubMs_copy"; + if (File.Exists (path_copy)) + File.Delete (path_copy); + + try { + var fmt = "HH:mm:ss:fffffff"; + for (var i = 0; i < 200; i++) { + File.WriteAllText (path, ""); + var untouched = File.GetLastWriteTimeUtc (path); + File.Copy (path, path_copy); + var copy_touched = File.GetLastWriteTimeUtc (path_copy); + + Assert.IsTrue (copy_touched >= untouched, $"Iteration #{i} failed, untouched: {untouched.ToString (fmt)} copy_touched: {copy_touched.ToString (fmt)}"); + File.Delete (path_copy); + } + } finally { + DeleteFile (path); + DeleteFile (path_copy); + } + } + [Test] public void GetCreationTime_Path_Null () { diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs index 4ac4f6d78f..05fdba1739 100644 --- a/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs +++ b/mcs/class/corlib/Test/System.Reflection.Emit/DynamicMethodTest.cs @@ -470,7 +470,7 @@ namespace MonoTests.System.Reflection.Emit public delegate object RetObj(); [Test] //#640702 - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void GetCurrentMethodWorksWithDynamicMethods () { DynamicMethod dm = new DynamicMethod("Foo", typeof(object), null); @@ -527,7 +527,7 @@ namespace MonoTests.System.Reflection.Emit } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ExceptionHandling () { var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest)); @@ -588,13 +588,13 @@ namespace MonoTests.System.Reflection.Emit // Ignore Metadata lines = lines.Where (l => !l.StartsWith ("[")).ToArray (); - Assert.AreEqual (5, lines.Length, "#1"); + Assert.AreEqual (4, lines.Length, "#1"); Assert.IsTrue (lines [1].Contains ("---"), "#2"); } } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ExceptionHandlingWithExceptionDispatchInfo () { var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest)); @@ -652,7 +652,7 @@ namespace MonoTests.System.Reflection.Emit } [Test] //see bxc #59334 - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ExceptionWrapping () { AssemblyBuilder ab = AppDomain.CurrentDomain.DefineDynamicAssembly (new AssemblyName ("ehatevfheiw"), AssemblyBuilderAccess.Run); diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs b/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs index 5d0a497835..51739a306e 100644 --- a/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs +++ b/mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs @@ -1024,7 +1024,7 @@ namespace MonoTests.System.Reflection.Emit } [Test]//bug #626441 - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void CanCallVarargMethods () { var tb = module.DefineType ("foo"); diff --git a/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs.REMOVED.git-id b/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs.REMOVED.git-id index 0b64063a9a..53f10427f8 100644 --- a/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs.REMOVED.git-id +++ b/mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs.REMOVED.git-id @@ -1 +1 @@ -ebc7cb573f5753e3f100ca4c101dcba11135eb86 \ No newline at end of file +ecf68042d94f42b229e1001ff274a325aa6d0f14 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs b/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs index 12f7602d6b..c53b41c421 100644 --- a/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs @@ -1883,6 +1883,16 @@ public class AssemblyNameTest { Assert.AreEqual (0xE0, t [6], "#4.6"); Assert.AreEqual (0x89, t [7], "#4.7"); } + + [Test] + public void TestSettingCultureName () + { + AssemblyName aname = Assembly.GetExecutingAssembly ().GetName (); + aname.CultureName = null; + Assert.IsFalse(aname.ToString().Contains("en-US")); + aname.CultureName = "en-US"; + Assert.IsTrue(aname.ToString().Contains("en-US")); + } } } diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs index 5483974809..a7a8a55fcb 100644 --- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/ConditionalWeakTableTest.cs @@ -192,6 +192,7 @@ namespace MonoTests.System.Runtime.CompilerServices { } [Test] + [Category ("MultiThreaded")] public void Reachability () { if (GC.MaxGeneration == 0) /*Boehm doesn't handle ephemerons */ Assert.Ignore ("Not working on Boehm."); @@ -241,6 +242,7 @@ namespace MonoTests.System.Runtime.CompilerServices { } [Test] + [Category ("MultiThreaded")] public void InsertStress () { if (GC.MaxGeneration == 0) /*Boehm doesn't handle ephemerons */ Assert.Ignore ("Not working on Boehm."); @@ -289,6 +291,7 @@ namespace MonoTests.System.Runtime.CompilerServices { } [Test] + [Category ("MultiThreaded")] public void OldGenStress () { if (GC.MaxGeneration == 0) /*Boehm doesn't handle ephemerons */ Assert.Ignore ("Not working on Boehm."); @@ -431,6 +434,7 @@ namespace MonoTests.System.Runtime.CompilerServices { } [Test] + [Category ("MultiThreaded")] public void FinalizableObjectsThatRetainDeadKeys () { if (GC.MaxGeneration == 0) /*Boehm doesn't handle ephemerons */ diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs index 108680d10a..badc2a6501 100644 --- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/RuntimeHelpersTest.cs @@ -205,6 +205,7 @@ namespace MonoTests.System.Runtime.CompilerServices { } [Test] + [Category ("MultiThreaded")] public void TestEnsureSufficientExecutionStack () { var t = new Thread (() => { diff --git a/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs b/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs index 1e1c308bdb..2af435ff8c 100644 --- a/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.ExceptionServices/ExceptionDispatchInfoTest.cs @@ -66,7 +66,7 @@ namespace MonoTests.System.Runtime.ExceptionServices } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void Throw () { Exception orig = null; @@ -86,14 +86,14 @@ namespace MonoTests.System.Runtime.ExceptionServices Assert.Fail ("#0"); } catch (Exception e) { var s = GetLines (e.StackTrace); - Assert.AreEqual (4, s.Length, "#1"); + Assert.AreEqual (3, s.Length, "#1"); Assert.AreEqual (orig, e, "#2"); Assert.AreNotEqual (orig_stack, e.StackTrace, "#3"); } } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ThrowWithEmptyFrames () { var edi = ExceptionDispatchInfo.Capture (new OperationCanceledException ()); @@ -103,12 +103,12 @@ namespace MonoTests.System.Runtime.ExceptionServices } catch (OperationCanceledException e) { Assert.IsTrue (!e.StackTrace.Contains("---")); var lines = GetLines (e.StackTrace); - Assert.AreEqual (2, lines.Length, "#1"); + Assert.AreEqual (1, lines.Length, "#1"); } } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void LastThrowWins () { Exception e; @@ -134,13 +134,13 @@ namespace MonoTests.System.Runtime.ExceptionServices edi.Throw (); } catch (Exception ex) { var lines = GetLines (ex.StackTrace); - Assert.AreEqual (4, lines.Length, "#1"); + Assert.AreEqual (3, lines.Length, "#1"); Assert.IsTrue (lines [1].Contains ("---"), "#2"); } } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ThrowMultipleCaptures () { Exception e; @@ -162,14 +162,14 @@ namespace MonoTests.System.Runtime.ExceptionServices edi.Throw (); } catch (Exception ex) { var lines = GetLines (ex.StackTrace); - Assert.AreEqual (7, lines.Length, "#1"); + Assert.AreEqual (5, lines.Length, "#1"); Assert.IsTrue (lines [1].Contains ("---"), "#2"); - Assert.IsTrue (lines [4].Contains ("---"), "#3"); + Assert.IsTrue (lines [3].Contains ("---"), "#3"); } } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void StackTraceUserCopy () { try { @@ -182,7 +182,7 @@ namespace MonoTests.System.Runtime.ExceptionServices } catch (Exception ex) { var st = new StackTrace (ex, true); var lines = GetLines (st.ToString ()); - Assert.AreEqual (4, lines.Length, "#1"); + Assert.AreEqual (3, lines.Length, "#1"); Assert.IsTrue (lines [1].Contains ("---"), "#2"); } } diff --git a/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs b/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs index a59293153b..055f6bdaa5 100644 --- a/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.InteropServices/MarshalTest.cs @@ -963,7 +963,7 @@ namespace MonoTests.System.Runtime.InteropServices } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void CheckPtrToStructureWithFixedArrayAndBaseClassFields() { const int arraySize = 6; diff --git a/mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs b/mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs index 6ac508c973..6f2a158a0a 100644 --- a/mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs @@ -28,7 +28,7 @@ namespace MonoTests.System.Runtime.Remoting.Proxies { } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void InterfaceProxyGetTypeOkay () { // Regression test for #17325 diff --git a/mcs/class/corlib/Test/System.Runtime.Remoting/ContextTest.cs b/mcs/class/corlib/Test/System.Runtime.Remoting/ContextTest.cs index 2fcf05d036..1ed6d8fee7 100644 --- a/mcs/class/corlib/Test/System.Runtime.Remoting/ContextTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.Remoting/ContextTest.cs @@ -40,7 +40,7 @@ namespace MonoTests.System.Runtime.Remoting LocalDataStoreSlot slot; [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestDoCallback () { otherCtx = cbo.GetContext (); @@ -55,7 +55,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestDatastore () { otherCtx = cbo.GetContext (); diff --git a/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs b/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs index 0c4bee45e8..2f2c028816 100644 --- a/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs @@ -146,7 +146,7 @@ namespace MonoTests.System.Runtime.Remoting bool otResult; [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestSynchronization () { Thread tr = new Thread (new ThreadStart (FirstSyncThread)); @@ -170,7 +170,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestSupported () { SincroRequiresNew ob = new SincroRequiresNew (); @@ -183,7 +183,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestRequired () { SincroRequiresNew ob = new SincroRequiresNew (); @@ -196,7 +196,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestRequiresNew () { SincroRequiresNew ob = new SincroRequiresNew (); @@ -209,7 +209,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestNotSupported () { SincroRequiresNew ob = new SincroRequiresNew (); @@ -222,7 +222,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestLocked1 () { sincob.Lock (false); @@ -237,7 +237,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestLocked2 () { Thread tr = new Thread (new ThreadStart (FirstNotSyncThread)); @@ -261,7 +261,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestLocked3 () { Thread tr = new Thread (new ThreadStart (Lock1Thread)); @@ -281,7 +281,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestReentry () { Thread tr = new Thread (new ThreadStart (FirstReentryThread)); @@ -305,7 +305,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestNoReentry () { Thread tr = new Thread (new ThreadStart (FirstNoReentryThread)); @@ -329,7 +329,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestCallback () { Thread tr = new Thread (new ThreadStart (CallbackThread)); @@ -344,7 +344,7 @@ namespace MonoTests.System.Runtime.Remoting } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestSynchronizationReleasedOnMultipleAcquire () { @@ -367,7 +367,7 @@ namespace MonoTests.System.Runtime.Remoting [Test] [Category("NotDotNet")] [Category ("MobileNotWorking")] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestMonitorWait () { Thread tr = new Thread (new ThreadStart (DoMonitorPulse)); diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs index 8bfd75d156..aa67774126 100644 --- a/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs +++ b/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs @@ -30,7 +30,7 @@ namespace MonoTests.System.Runtime.Serialization #if FEATURE_REMOTING [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestSerialization () { MethodTester mt = new MethodTester(); 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 03891892e7..1bf84f5188 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 @@ -3e6958d083b6c9235b39497ec57d2a30e40b73e8 \ No newline at end of file +634dda0599c90556f1d6a23661203f22d01cbfa3 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs index a3e95c65a6..57c36c3f89 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/CryptoConfigTest.cs @@ -37,6 +37,10 @@ namespace MonoTests.System.Security.Cryptography { [TestFixture] public class CryptoConfigTest { + public class FakeAlgorithm + { + } + void CreateFromName (string name, string objectname) { object o = CryptoConfig.CreateFromName (name); @@ -137,20 +141,9 @@ public class CryptoConfigTest { // additional names (URL) used for XMLDSIG (System.Security.Cryptography.Xml) // URL taken from http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/ [Test] -#if MOBILE - [Ignore ("System.Security.dll is not part of Moonlight, MonoTouch and Mono for Android")] -#endif public void CreateFromURL () { - // URL used in SignatureMethod element - CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription"); - CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription"); - CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription"); - CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.RSAPKCS1SHA384SignatureDescription"); - CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.RSAPKCS1SHA512SignatureDescription"); - CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", null); - // URL used in DigestMethod element - CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider"); +#if FEATURE_CRYPTO_CONFIGURABLE // URL used in Canonicalization or Transform elements CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315", "System.Security.Cryptography.Xml.XmlDsigC14NTransform"); CreateFromName ("http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments", "System.Security.Cryptography.Xml.XmlDsigC14NWithCommentsTransform"); @@ -171,6 +164,17 @@ public class CryptoConfigTest { CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyValue/DSAKeyValue", "System.Security.Cryptography.Xml.DSAKeyValue"); CreateFromName ("http://www.w3.org/2000/09/xmldsig# KeyValue/RSAKeyValue", "System.Security.Cryptography.Xml.RSAKeyValue"); CreateFromName ("http://www.w3.org/2000/09/xmldsig# RetrievalMethod", "System.Security.Cryptography.Xml.KeyInfoRetrievalMethod"); +#endif + // URL used in SignatureMethod element + CreateFromName ("http://www.w3.org/2000/09/xmldsig#dsa-sha1", "System.Security.Cryptography.DSASignatureDescription"); + CreateFromName ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.RSAPKCS1SHA1SignatureDescription"); + CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.RSAPKCS1SHA256SignatureDescription"); + CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.RSAPKCS1SHA384SignatureDescription"); + CreateFromName ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.RSAPKCS1SHA512SignatureDescription"); + CreateFromName ("http://www.w3.org/2000/09/xmldsig#hmac-sha1", "System.Security.Cryptography.HMACSHA1"); + // URL used in DigestMethod element + CreateFromName ("http://www.w3.org/2000/09/xmldsig#sha1", "System.Security.Cryptography.SHA1CryptoServiceProvider"); + CreateFromName ("http://www.w3.org/2001/04/xmlenc#sha256", "System.Security.Cryptography.SHA256Managed"); CreateFromName ("http://www.w3.org/2001/04/xmlenc#sha384", null); CreateFromName ("http://www.w3.org/2001/04/xmlenc#sha512", "System.Security.Cryptography.SHA512Managed"); @@ -402,6 +406,14 @@ public class CryptoConfigTest { CryptoConfig cc = new CryptoConfig (); Assert.AreEqual ("System.Security.Cryptography.CryptoConfig", cc.ToString ()); } + + [Test] + public void AddAlgorithm () + { + CryptoConfig.AddAlgorithm (typeof (FakeAlgorithm), "test"); + Assert.IsNotNull (CryptoConfig.CreateFromName ("test")); + + } } } diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs index 82e664df94..d20a3cdf69 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/SignatureDescriptionTest.cs @@ -309,17 +309,16 @@ public class SignatureDescriptionTest { [Test] public void RSASignatureDescription () { -// TODO: this would be cleaner with NUnit TestCase'es but they're NUnit 2.5+ :( -#if FULL_AOT_RUNTIME || MONOTOUCH || MONODROID || XAMMAC || XAMMAC_4_5 - RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1CryptoServiceProvider"); - RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Managed"); - RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Managed"); - RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Managed"); -#else +#if FEATURE_CRYPTO_CONFIGURABLE RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1Cng"); RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Cng"); RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Cng"); RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Cng"); +#else + RSASignatureDescriptionCore ("http://www.w3.org/2000/09/xmldsig#rsa-sha1", "System.Security.Cryptography.SHA1Cng", "System.Security.Cryptography.SHA1CryptoServiceProvider"); + RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha256", "System.Security.Cryptography.SHA256Cng", "System.Security.Cryptography.SHA256Managed"); + RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha384", "System.Security.Cryptography.SHA384Cng", "System.Security.Cryptography.SHA384Managed"); + RSASignatureDescriptionCore ("http://www.w3.org/2001/04/xmldsig-more#rsa-sha512", "System.Security.Cryptography.SHA512Cng", "System.Security.Cryptography.SHA512Managed"); #endif } diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs index 2bc45681ce..987016b0f0 100644 --- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs +++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs @@ -984,6 +984,7 @@ namespace MonoTests.System.Threading.Tasks } [Test] + [Category ("MultiThreaded")] public void UnobservedExceptionOnFinalizerThreadTest () { bool wasCalled = false; diff --git a/mcs/class/corlib/Test/System.Threading/CountdownEventTests.cs b/mcs/class/corlib/Test/System.Threading/CountdownEventTests.cs index 9f1d87cc0d..1f98c17f1f 100644 --- a/mcs/class/corlib/Test/System.Threading/CountdownEventTests.cs +++ b/mcs/class/corlib/Test/System.Threading/CountdownEventTests.cs @@ -101,6 +101,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void AddCountSignalStressTestCase () { var evt = new CountdownEvent (5); @@ -352,6 +353,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void WaitTestCase() { var evt = new CountdownEvent (5); diff --git a/mcs/class/corlib/Test/System.Threading/InterlockedTest.cs b/mcs/class/corlib/Test/System.Threading/InterlockedTest.cs index e98980d857..45cb621570 100644 --- a/mcs/class/corlib/Test/System.Threading/InterlockedTest.cs +++ b/mcs/class/corlib/Test/System.Threading/InterlockedTest.cs @@ -99,7 +99,7 @@ namespace MonoTests.System.Threading } [Test] - [Category ("InterpreterNotWorking")] /* crashes on linux/armv7 */ + [Category ("NotWorkingRuntimeInterpreter")] /* crashes on linux/armv7 */ public void TestCompareExchange_Flt () { flt = flt_1; diff --git a/mcs/class/corlib/Test/System.Threading/ManualResetEventSlimTests.cs b/mcs/class/corlib/Test/System.Threading/ManualResetEventSlimTests.cs index b1cb401ef4..b96903485f 100644 --- a/mcs/class/corlib/Test/System.Threading/ManualResetEventSlimTests.cs +++ b/mcs/class/corlib/Test/System.Threading/ManualResetEventSlimTests.cs @@ -83,6 +83,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void WaitTest() { int count = 0; diff --git a/mcs/class/corlib/Test/System.Threading/MutexTest.cs b/mcs/class/corlib/Test/System.Threading/MutexTest.cs index ee3e588604..f7d421ae41 100644 --- a/mcs/class/corlib/Test/System.Threading/MutexTest.cs +++ b/mcs/class/corlib/Test/System.Threading/MutexTest.cs @@ -124,6 +124,7 @@ namespace MonoTests.System.Threading */ [Test] + [Category ("MultiThreaded")] public void TestWaitAndSignal1() { Mutex Sem = new Mutex (false); @@ -143,6 +144,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestWaitAndForget1() { Mutex Sem = new Mutex(false); diff --git a/mcs/class/corlib/Test/System.Threading/ReaderWriterLockTest.cs b/mcs/class/corlib/Test/System.Threading/ReaderWriterLockTest.cs index ef398486a2..3253868dca 100644 --- a/mcs/class/corlib/Test/System.Threading/ReaderWriterLockTest.cs +++ b/mcs/class/corlib/Test/System.Threading/ReaderWriterLockTest.cs @@ -60,6 +60,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestIsReaderLockHeld () { rwlock = new ReaderWriterLock (); @@ -76,6 +77,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestIsWriterLockHeld () { rwlock = new ReaderWriterLock (); @@ -92,6 +94,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestAcquireLocks () { rwlock = new ReaderWriterLock (); @@ -157,6 +160,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestReleaseRestoreReaderLock () { rwlock = new ReaderWriterLock (); @@ -177,6 +181,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestReleaseRestoreWriterLock () { rwlock = new ReaderWriterLock (); @@ -197,6 +202,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestUpgradeDowngradeLock () { rwlock = new ReaderWriterLock (); @@ -244,6 +250,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestReaderMustWaitWriter () { // A thread cannot get the reader lock if there are other threads @@ -286,6 +293,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestBug_55909 () { rwlock = new ReaderWriterLock (); @@ -313,6 +321,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestBug_55909_bis () { rwlock = new ReaderWriterLock (); diff --git a/mcs/class/corlib/Test/System.Threading/SemaphoreSlimTests.cs b/mcs/class/corlib/Test/System.Threading/SemaphoreSlimTests.cs index eb07f467fd..613f8cad0e 100644 --- a/mcs/class/corlib/Test/System.Threading/SemaphoreSlimTests.cs +++ b/mcs/class/corlib/Test/System.Threading/SemaphoreSlimTests.cs @@ -65,6 +65,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void WaitStressTest() { int count = -1; diff --git a/mcs/class/corlib/Test/System.Threading/SpinLockTests.cs b/mcs/class/corlib/Test/System.Threading/SpinLockTests.cs index 80865e5eb0..82ca039a05 100644 --- a/mcs/class/corlib/Test/System.Threading/SpinLockTests.cs +++ b/mcs/class/corlib/Test/System.Threading/SpinLockTests.cs @@ -111,6 +111,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void LockUnicityTest () { ParallelTestHelper.Repeat (delegate { diff --git a/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs b/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs index b65d150bb5..bbd1a6f280 100644 --- a/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs +++ b/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs @@ -52,6 +52,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void ThreadedTest () { AssertThreadLocal (); @@ -134,6 +135,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void PerThreadException () { int callTime = 0; diff --git a/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs b/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs index 242e9cc825..34465048d2 100644 --- a/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs +++ b/mcs/class/corlib/Test/System.Threading/ThreadPoolTest.cs @@ -255,5 +255,31 @@ namespace MonoTests.System.Threading Assert.AreEqual (0, var_3, "var_3"); } +#if !MOBILE + // This is test related to bug https://bugzilla.xamarin.com/show_bug.cgi?id=41294. + // The bug is that the performance counters return 0. + // "Work Items Added" and "# of Threads" are fixed, the others are not. + [Test] + public void PerformanceCounter_WorkItems () + { + var workItems = new PerformanceCounter ("Mono Threadpool", "Work Items Added"); + var threads = new PerformanceCounter ("Mono Threadpool", "# of Threads"); + + var workItems0 = workItems.NextValue(); + + int N = 99; + for (var i = 0; i < N; i++) + ThreadPool.QueueUserWorkItem (_ => {}); + + var workItems1 = workItems.NextValue(); + var threads0 = threads.NextValue(); + + //Console.WriteLine ("workItems0:{0} workItems1:{1}", workItems0, workItems1); + //Console.WriteLine ("threads:{0}", threads0); + + Assert.AreEqual (N, workItems1 - workItems0, "#1"); + Assert.IsTrue (threads0 > 0, "#2"); + } +#endif } -} \ No newline at end of file +} diff --git a/mcs/class/corlib/Test/System.Threading/ThreadTest.cs b/mcs/class/corlib/Test/System.Threading/ThreadTest.cs index 840680198f..8969ca9862 100644 --- a/mcs/class/corlib/Test/System.Threading/ThreadTest.cs +++ b/mcs/class/corlib/Test/System.Threading/ThreadTest.cs @@ -252,6 +252,7 @@ namespace MonoTests.System.Threading } [Test] // bug #325566 + [Category ("MultiThreaded")] public void GetHashCodeTest () { C1Test test1 = new C1Test (); @@ -281,6 +282,7 @@ namespace MonoTests.System.Threading } [Test] // bug #82700 + [Category ("MultiThreaded")] public void ManagedThreadId () { C1Test test1 = new C1Test (); @@ -307,7 +309,7 @@ namespace MonoTests.System.Threading [Test] [Category ("NotDotNet")] // it hangs. - [Category ("InterpreterNotWorking")] /* crashes on linux/arm64 */ + [Category ("NotWorkingRuntimeInterpreter")] /* crashes on linux/arm64 */ public void TestStart() { { @@ -349,6 +351,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestApartmentState () { C2Test test1 = new C2Test(); @@ -450,7 +453,7 @@ namespace MonoTests.System.Threading } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestUndivisibleByPageSizeMaxStackSize () { const int undivisible_stacksize = 1048573; @@ -461,6 +464,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestIsBackground1 () { C2Test test1 = new C2Test(); @@ -480,6 +484,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestIsBackground2 () { C2Test test1 = new C2Test(); @@ -505,6 +510,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestName() { C2Test test1 = new C2Test(); @@ -545,6 +551,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestNestedThreads1() { C3Test test1 = new C3Test(); @@ -562,6 +569,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestNestedThreads2() { C4Test test1 = new C4Test(); @@ -578,6 +586,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestJoin1() { C1Test test1 = new C1Test(); @@ -664,6 +673,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestThreadState () { //TODO: Test The rest of the possible transitions @@ -768,6 +778,7 @@ namespace MonoTests.System.Threading #if MONO_FEATURE_THREAD_SUSPEND_RESUME [Test] + [Category ("MultiThreaded")] public void TestSuspend () { Thread t = new Thread (new ThreadStart (DoCount)); @@ -795,6 +806,7 @@ namespace MonoTests.System.Threading #if MONO_FEATURE_THREAD_SUSPEND_RESUME && MONO_FEATURE_THREAD_ABORT [Test] [Category("NotDotNet")] // On MS, ThreadStateException is thrown on Abort: "Thread is suspended; attempting to abort" + [Category ("MultiThreaded")] public void TestSuspendAbort () { Thread t = new Thread (new ThreadStart (DoCount)); @@ -982,6 +994,7 @@ namespace MonoTests.System.Threading } [Test] // bug #81720 + [Category ("MultiThreaded")] public void IsBackGround () { Thread t1 = new Thread (new ThreadStart (Start)); @@ -1020,6 +1033,7 @@ namespace MonoTests.System.Threading } [Test] // bug #60031 + [Category ("MultiThreaded")] public void StoppedThreadsThrowThreadStateException () { var t = new Thread (() => { }); @@ -1150,6 +1164,7 @@ namespace MonoTests.System.Threading } [Test] // bug #81658 + [Category ("MultiThreaded")] public void ApartmentState_StoppedThread () { Thread t1 = new Thread (new ThreadStart (Start)); @@ -1189,6 +1204,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestApartmentState () { Thread t1 = new Thread (new ThreadStart (Start)); @@ -1253,6 +1269,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestTrySetApartmentState () { Thread t1 = new Thread (new ThreadStart (Start)); @@ -1267,6 +1284,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void TestTrySetApartmentStateRunning () { Thread t1 = new Thread (new ThreadStart (Start)); @@ -1303,6 +1321,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void ThreadStartSimple () { int i = 0; @@ -1316,6 +1335,7 @@ namespace MonoTests.System.Threading } [Test] + [Category ("MultiThreaded")] public void ParametrizedThreadStart () { int i = 0; diff --git a/mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs b/mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs index 723da25beb..8f5692efef 100644 --- a/mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs +++ b/mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs @@ -317,6 +317,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void InterrupedWaitAny () { using (var m1 = new Mutex (true)) { @@ -345,6 +346,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void InterrupedWaitAll () { using (var m1 = new Mutex (true)) { @@ -373,6 +375,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void InterrupedWaitOne () { using (var m1 = new Mutex (true)) { @@ -398,6 +401,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void WaitOneWithAbandonedMutex () { using (var m = new Mutex (false)) { @@ -432,6 +436,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void WaitOneWithAbandonedMutexAndMultipleThreads () { using (var m = new Mutex (true)) { @@ -465,6 +470,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void WaitAnyWithSecondMutexAbandoned () { using (var m1 = new Mutex (false)) { @@ -525,6 +531,7 @@ namespace MonoTests.System.Threading { [Test] [ExpectedException (typeof (AbandonedMutexException))] + [Category ("MultiThreaded")] public void WaitAllWithOneAbandonedMutex () { using (var m1 = new Mutex (false)) { @@ -541,6 +548,7 @@ namespace MonoTests.System.Threading { #if MONO_FEATURE_THREAD_SUSPEND_RESUME [Test] + [Category ("MultiThreaded")] public void WaitOneWithTimeoutAndSpuriousWake () { /* This is to test that WaitEvent.WaitOne is not going to wait largely @@ -570,6 +578,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void WaitAnyWithTimeoutAndSpuriousWake () { /* This is to test that WaitEvent.WaitAny is not going to wait largely @@ -600,6 +609,7 @@ namespace MonoTests.System.Threading { } [Test] + [Category ("MultiThreaded")] public void WaitAllWithTimeoutAndSpuriousWake () { /* This is to test that WaitEvent.WaitAll is not going to wait largely diff --git a/mcs/class/corlib/Test/System/ConvertTest.cs.REMOVED.git-id b/mcs/class/corlib/Test/System/ConvertTest.cs.REMOVED.git-id index faea660639..54d73b6eeb 100644 --- a/mcs/class/corlib/Test/System/ConvertTest.cs.REMOVED.git-id +++ b/mcs/class/corlib/Test/System/ConvertTest.cs.REMOVED.git-id @@ -1 +1 @@ -8f9fe1c0099abe4f3aa9b529c6cba003b529b9e6 \ No newline at end of file +7dddddb510af5037a9ba9a26f203104dae03ef87 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs b/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs index a29ba7ae7b..a96478e53a 100644 --- a/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs +++ b/mcs/class/corlib/Test/System/DecimalTest-Microsoft.cs @@ -708,7 +708,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestToSingle() { // Single Decimal.ToSingle(Decimal) @@ -726,7 +726,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestToDouble() { Double d = Decimal.ToDouble(new Decimal(0, 0, 1, false, 0)); diff --git a/mcs/class/corlib/Test/System/DecimalTest.cs b/mcs/class/corlib/Test/System/DecimalTest.cs index ac164e8c93..00f1cf9ec3 100644 --- a/mcs/class/corlib/Test/System/DecimalTest.cs +++ b/mcs/class/corlib/Test/System/DecimalTest.cs @@ -507,7 +507,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestConstructSingle () { Decimal d; @@ -630,7 +630,7 @@ namespace MonoTests.System [Test] [SetCulture("en-US")] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestConstructDouble () { Decimal d; @@ -729,7 +729,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestConstructDoubleRound () { decimal d; @@ -982,7 +982,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ToInt32 () { Decimal d = 254.9m; @@ -1045,7 +1045,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ToSingle () { Decimal d = 254.9m; @@ -1059,7 +1059,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ToDouble () { Decimal d = 254.9m; diff --git a/mcs/class/corlib/Test/System/DelegateTest.cs b/mcs/class/corlib/Test/System/DelegateTest.cs index d84fa2c898..19a4bd894d 100644 --- a/mcs/class/corlib/Test/System/DelegateTest.cs +++ b/mcs/class/corlib/Test/System/DelegateTest.cs @@ -851,7 +851,7 @@ namespace MonoTests.System delegate object Boxer (); [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void BoxingCovariance () { var boxer = (Boxer) Delegate.CreateDelegate ( @@ -913,7 +913,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void NullFirstArgumentOnStaticMethod () { CallTarget call = (CallTarget) Delegate.CreateDelegate ( @@ -927,7 +927,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] #if MONOTOUCH || FULL_AOT_RUNTIME [Category ("NotWorking")] // #10539 #endif @@ -1027,7 +1027,7 @@ namespace MonoTests.System #if MONOTOUCH || FULL_AOT_RUNTIME [Category ("NotWorking")] // #10539 #endif - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ClosedOverNullReferenceStaticMethod () { var del = (Func) Delegate.CreateDelegate ( @@ -1105,7 +1105,7 @@ namespace MonoTests.System event Action bar_handler; [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] [ExpectedException (typeof (ArgumentException))] // #635349, #605936 public void NewDelegateClosedOverNullReferenceInstanceMethod () { @@ -1149,7 +1149,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void DynamicInvokeOpenInstanceDelegate () { var d1 = Delegate.CreateDelegate (typeof (Func), typeof(DelegateTest).GetMethod ("DynamicInvokeOpenInstanceDelegate_CB")); @@ -1287,7 +1287,7 @@ namespace MonoTests.System } #if !MONOTOUCH && !FULL_AOT_RUNTIME [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void CreateDelegateWithLdFtnAndAbstractMethod () { AssemblyName assemblyName = new AssemblyName (); @@ -1395,6 +1395,23 @@ namespace MonoTests.System Assert.IsTrue (d (0, 0)); } + [Test] + public void EnumBaseTypeConversion2 () { + Func dm = EnumArg; + var d = (Func)Delegate.CreateDelegate (typeof (Func), dm.Method); + Assert.AreEqual (1, d (1)); + } + + public enum Enum22 { + none, + one, + two + } + + public static int EnumArg (Enum22 e) { + return (int)e; + } + #if !MONOTOUCH && !FULL_AOT_RUNTIME public static void DynInvokeWithClosedFirstArg (object a, object b) { diff --git a/mcs/class/corlib/Test/System/ExceptionTest.cs b/mcs/class/corlib/Test/System/ExceptionTest.cs index 9793ab3ba4..d383e62452 100644 --- a/mcs/class/corlib/Test/System/ExceptionTest.cs +++ b/mcs/class/corlib/Test/System/ExceptionTest.cs @@ -262,7 +262,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void GetObjectData () { string msg = "MESSAGE"; @@ -380,7 +380,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void Source () { Exception ex1 = new Exception ("MSG"); diff --git a/mcs/class/corlib/Test/System/GCTest.cs b/mcs/class/corlib/Test/System/GCTest.cs index 52c8c8cb0c..b1027340f9 100644 --- a/mcs/class/corlib/Test/System/GCTest.cs +++ b/mcs/class/corlib/Test/System/GCTest.cs @@ -56,7 +56,7 @@ namespace MonoTests.System { } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void ReRegisterForFinalizeTest () { var thread = new Thread (Run_ReRegisterForFinalizeTest); diff --git a/mcs/class/corlib/Test/System/LazyTest.cs b/mcs/class/corlib/Test/System/LazyTest.cs index 0b3e042e30..2e461128ee 100644 --- a/mcs/class/corlib/Test/System/LazyTest.cs +++ b/mcs/class/corlib/Test/System/LazyTest.cs @@ -111,6 +111,7 @@ namespace MonoTests.System static int counter; [Test] + [Category ("MultiThreaded")] public void EnsureSingleThreadSafeExecution () { counter = 42; @@ -279,6 +280,7 @@ namespace MonoTests.System } [Test] + [Category ("MultiThreaded")] public void ConcurrentInitialization () { var init = new AutoResetEvent (false); 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 d2f90b98aa..fa269f58ac 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 @@ -c0dce0e1d544ea41ff8c13a3deea467234334447 \ No newline at end of file +be7c06e492f19830004719e43e6448e4ebe66d81 \ No newline at end of file diff --git a/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs b/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs index fbf436cb3b..4fa63d849f 100644 --- a/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs +++ b/mcs/class/corlib/Test/System/TimeZoneInfoTest.cs @@ -124,8 +124,8 @@ namespace MonoTests.System } catch (DllNotFoundException e) { return; } -#if !MONOTOUCH && !XAMMAC && !XAMMAC_4_5 - // this assumption is incorrect for iOS, tvO, watchOS and OSX +#if !MONOTOUCH && !XAMMAC + // this assumption is incorrect for the TimeZoneInfo.MonoTouch.cs implementation (iOS, tvOS, watchOS and XamMac Modern) Assert.IsTrue (TimeZoneInfo.Local.Id != "Local", "Local timezone id should not be \"Local\""); #endif } diff --git a/mcs/class/corlib/Test/System/TimeZoneTest.cs b/mcs/class/corlib/Test/System/TimeZoneTest.cs index 15e04bec5e..c0aa56a416 100644 --- a/mcs/class/corlib/Test/System/TimeZoneTest.cs +++ b/mcs/class/corlib/Test/System/TimeZoneTest.cs @@ -317,7 +317,7 @@ public class TimeZoneTest { } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void GetUtcOffsetAtDSTBoundary () { /* diff --git a/mcs/class/corlib/Test/System/TypedReferenceCas.cs b/mcs/class/corlib/Test/System/TypedReferenceCas.cs index 2b0ee5e283..29f4226dcb 100644 --- a/mcs/class/corlib/Test/System/TypedReferenceCas.cs +++ b/mcs/class/corlib/Test/System/TypedReferenceCas.cs @@ -51,7 +51,7 @@ namespace MonoCasTests.System { // when reflection is used (i.e. it gets testable). [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] [ReflectionPermission (SecurityAction.Deny, MemberAccess = true)] [ExpectedException (typeof (SecurityException))] public void MakeTypedReference () diff --git a/mcs/class/corlib/Test/System/TypedReferenceTest.cs b/mcs/class/corlib/Test/System/TypedReferenceTest.cs index 9c28041c8b..5eeaeb2428 100644 --- a/mcs/class/corlib/Test/System/TypedReferenceTest.cs +++ b/mcs/class/corlib/Test/System/TypedReferenceTest.cs @@ -59,7 +59,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void MakeTypedReference () { var o = new CClass () { a = new AStruct () { b = "5" }}; diff --git a/mcs/class/corlib/Test/System/ValueTypeTest.cs b/mcs/class/corlib/Test/System/ValueTypeTest.cs index c820f9f668..476dfbb285 100644 --- a/mcs/class/corlib/Test/System/ValueTypeTest.cs +++ b/mcs/class/corlib/Test/System/ValueTypeTest.cs @@ -52,7 +52,7 @@ namespace MonoTests.System } [Test] - [Category ("InterpreterNotWorking")] + [Category ("NotWorkingRuntimeInterpreter")] public void TestEquals_Nullable () { NullableStruct f1 = new NullableStruct { f = 5 }; diff --git a/mcs/class/corlib/corert/Stream.cs b/mcs/class/corlib/corert/Stream.cs index 9a9ebf0bd1..80eb3c22e4 100644 --- a/mcs/class/corlib/corert/Stream.cs +++ b/mcs/class/corlib/corert/Stream.cs @@ -23,7 +23,7 @@ namespace System.IO throw new NotImplementedException (); } - internal virtual Task WriteAsync (ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) + public virtual Task WriteAsync (ReadOnlyMemory source, CancellationToken cancellationToken = default(CancellationToken)) { throw new NotImplementedException (); } diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources index 93879941ca..43aae4cb05 100644 --- a/mcs/class/corlib/corlib.dll.sources +++ b/mcs/class/corlib/corlib.dll.sources @@ -684,7 +684,7 @@ 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.fullaot.cs +System.Security.Cryptography/CryptoConfig.Mobile.cs System.Security.Cryptography/CspKeyContainerInfo.cs System.Security.Cryptography/DESCryptoServiceProvider.cs System.Security.Cryptography/DSACryptoServiceProvider.cs @@ -1637,6 +1637,7 @@ corert/ThreadPoolBoundHandle.cs ../../../external/corert/src/Runtime.Base/src/System/Runtime/InteropServices/NativeCallableAttribute.cs ../../../external/corert/src/System.Private.CoreLib/shared/System/Diagnostics/Debug.cs +../../../external/corert/src/System.Private.CoreLib/shared/System/Diagnostics/StackTraceHiddenAttribute.cs ../../../external/corert/src/System.Private.CoreLib/shared/System/Threading/DeferredDisposableLifetime.cs diff --git a/mcs/class/lib/monolite-darwin/1051000004/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/Mono.Security.dll.REMOVED.git-id deleted file mode 100644 index ed34c66cbc..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/Mono.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7c8d89b02f2047cd0842d913bdd7860a7d1c774b \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/System.Configuration.dll.REMOVED.git-id deleted file mode 100644 index f10071d943..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/System.Configuration.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f0db91f9f6a66d380bdb74a54724cb81139917ae \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/System.Core.dll.REMOVED.git-id deleted file mode 100644 index eee5238d50..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/System.Core.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -0363f34f51449bff18edf8ea217e3d913d5c8b4d \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/System.Numerics.dll.REMOVED.git-id deleted file mode 100644 index 456be38d1e..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/System.Numerics.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c9472a9e2a46aff19f2ce276585ed3fdbe808f66 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/System.Security.dll.REMOVED.git-id deleted file mode 100644 index e4e68e05cc..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/System.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -3450b5110feb624c0036d5352c84742585cc1035 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/System.Xml.dll.REMOVED.git-id deleted file mode 100644 index 6c6896955a..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/System.Xml.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -46a1932a1360e7864625d4f0b04bc7b36028d64a \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/System.dll.REMOVED.git-id deleted file mode 100644 index fec6383249..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/System.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4f13db2e6344de8931df89de1cb101a2e66b44dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/mcs.exe.REMOVED.git-id deleted file mode 100644 index 3882a4b71a..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/mcs.exe.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c8931f632b4c2c1fc85b137eaf033c5256e6a840 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051000004/mscorlib.dll.REMOVED.git-id deleted file mode 100644 index 5683bef3ae..0000000000 --- a/mcs/class/lib/monolite-darwin/1051000004/mscorlib.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a1a9c8c762dd61497f47f03d38876b3d8c0ac8f0 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Collections.Concurrent.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Collections.Concurrent.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Collections.Concurrent.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Collections.Concurrent.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Collections.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Collections.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Collections.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Collections.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Diagnostics.Debug.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Diagnostics.Debug.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Diagnostics.Debug.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Diagnostics.Debug.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Diagnostics.FileVersionInfo.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Diagnostics.FileVersionInfo.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Diagnostics.FileVersionInfo.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Diagnostics.FileVersionInfo.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Diagnostics.Tools.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Diagnostics.Tools.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Diagnostics.Tools.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Diagnostics.Tools.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Dynamic.Runtime.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Dynamic.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Dynamic.Runtime.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Dynamic.Runtime.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Globalization.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Globalization.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Globalization.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Globalization.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.IO.FileSystem.Primitives.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.IO.FileSystem.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.IO.FileSystem.Primitives.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.IO.FileSystem.Primitives.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.IO.FileSystem.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.IO.FileSystem.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.IO.FileSystem.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.IO.FileSystem.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.IO.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.IO.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.IO.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.IO.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Linq.Expressions.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Linq.Expressions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Linq.Expressions.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Linq.Expressions.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Linq.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Linq.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Linq.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Linq.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Reflection.Extensions.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Reflection.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Reflection.Extensions.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Reflection.Extensions.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Reflection.Primitives.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Reflection.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Reflection.Primitives.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Reflection.Primitives.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Reflection.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Reflection.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Reflection.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Reflection.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Resources.ResourceManager.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Resources.ResourceManager.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Resources.ResourceManager.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Resources.ResourceManager.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.Extensions.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.Extensions.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.Extensions.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.InteropServices.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.InteropServices.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.InteropServices.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.InteropServices.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.Numerics.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.Numerics.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.Numerics.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.Numerics.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Runtime.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Runtime.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Security.Cryptography.Algorithms.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Security.Cryptography.Algorithms.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Security.Cryptography.Algorithms.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Security.Cryptography.Algorithms.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Security.Cryptography.Primitives.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Security.Cryptography.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Security.Cryptography.Primitives.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Security.Cryptography.Primitives.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Text.Encoding.CodePages.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Text.Encoding.CodePages.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Text.Encoding.CodePages.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Text.Encoding.CodePages.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Text.Encoding.Extensions.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Text.Encoding.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Text.Encoding.Extensions.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Text.Encoding.Extensions.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Text.Encoding.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Text.Encoding.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Text.Encoding.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Text.Encoding.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Threading.Tasks.Parallel.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Threading.Tasks.Parallel.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Threading.Tasks.Parallel.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Threading.Tasks.Parallel.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Threading.Tasks.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Threading.Tasks.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Threading.Tasks.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Threading.Tasks.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Threading.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Threading.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Threading.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Threading.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.ValueTuple.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.ValueTuple.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.ValueTuple.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.ValueTuple.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Xml.ReaderWriter.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Xml.ReaderWriter.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Xml.ReaderWriter.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Xml.ReaderWriter.dll diff --git a/mcs/class/lib/monolite-darwin/1051000004/Facades/System.Xml.XDocument.dll b/mcs/class/lib/monolite-darwin/1051200002/Facades/System.Xml.XDocument.dll similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/Facades/System.Xml.XDocument.dll rename to mcs/class/lib/monolite-darwin/1051200002/Facades/System.Xml.XDocument.dll diff --git a/mcs/class/lib/monolite-darwin/1051200002/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/Mono.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..bea96be260 --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/Mono.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +968ff72936e52bedacfc33a30cdcd421c94522a7 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.Configuration.dll.REMOVED.git-id new file mode 100644 index 0000000000..35306003f6 --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/System.Configuration.dll.REMOVED.git-id @@ -0,0 +1 @@ +4dc943b05d47979e08bfbb03ff1ecef3c81f13a5 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..b85e324e6f --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +939005727764598d30ed961d7c64417144ed5273 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.Numerics.dll.REMOVED.git-id new file mode 100644 index 0000000000..b11a780235 --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/System.Numerics.dll.REMOVED.git-id @@ -0,0 +1 @@ +d4777068e27d20b1f9f90e201a51d77c5faa442b \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..24e41d2fac --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/System.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +10e3bfcb53f40eebda9c2d830e4312928fe7f3c9 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051000004/System.Xml.Linq.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.Xml.Linq.dll.REMOVED.git-id similarity index 100% rename from mcs/class/lib/monolite-darwin/1051000004/System.Xml.Linq.dll.REMOVED.git-id rename to mcs/class/lib/monolite-darwin/1051200002/System.Xml.Linq.dll.REMOVED.git-id diff --git a/mcs/class/lib/monolite-darwin/1051200002/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.Xml.dll.REMOVED.git-id new file mode 100644 index 0000000000..1ebc1bdc4f --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/System.Xml.dll.REMOVED.git-id @@ -0,0 +1 @@ +6051fe6c7013789d45e7d8e3fb8d8039e9ff814a \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..e362ce1b0d --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +391ab530387c217aea71486f167301bf0e2b871e \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/mcs.exe.REMOVED.git-id new file mode 100644 index 0000000000..19b44f3afd --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/mcs.exe.REMOVED.git-id @@ -0,0 +1 @@ +27203237ac23da05704e504c5e1cd2bec13d1210 \ No newline at end of file diff --git a/mcs/class/lib/monolite-darwin/1051200002/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-darwin/1051200002/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..c4347032c5 --- /dev/null +++ b/mcs/class/lib/monolite-darwin/1051200002/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +4e5a5ee2828ce937ec0c19e3d34cd5a0d8c3533b \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/Mono.Security.dll.REMOVED.git-id deleted file mode 100644 index ed34c66cbc..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/Mono.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7c8d89b02f2047cd0842d913bdd7860a7d1c774b \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/System.Configuration.dll.REMOVED.git-id deleted file mode 100644 index f10071d943..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/System.Configuration.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f0db91f9f6a66d380bdb74a54724cb81139917ae \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/System.Core.dll.REMOVED.git-id deleted file mode 100644 index eee5238d50..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/System.Core.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -0363f34f51449bff18edf8ea217e3d913d5c8b4d \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/System.Numerics.dll.REMOVED.git-id deleted file mode 100644 index 456be38d1e..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/System.Numerics.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c9472a9e2a46aff19f2ce276585ed3fdbe808f66 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/System.Security.dll.REMOVED.git-id deleted file mode 100644 index e4e68e05cc..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/System.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -3450b5110feb624c0036d5352c84742585cc1035 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/System.Xml.dll.REMOVED.git-id deleted file mode 100644 index 6c6896955a..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/System.Xml.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -46a1932a1360e7864625d4f0b04bc7b36028d64a \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/System.dll.REMOVED.git-id deleted file mode 100644 index fec6383249..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/System.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4f13db2e6344de8931df89de1cb101a2e66b44dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/mcs.exe.REMOVED.git-id deleted file mode 100644 index 3882a4b71a..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/mcs.exe.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c8931f632b4c2c1fc85b137eaf033c5256e6a840 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051000004/mscorlib.dll.REMOVED.git-id deleted file mode 100644 index 5683bef3ae..0000000000 --- a/mcs/class/lib/monolite-linux/1051000004/mscorlib.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a1a9c8c762dd61497f47f03d38876b3d8c0ac8f0 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Collections.Concurrent.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Collections.Concurrent.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Collections.Concurrent.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Collections.Concurrent.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Collections.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Collections.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Collections.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Collections.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Diagnostics.Debug.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Diagnostics.Debug.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Diagnostics.Debug.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Diagnostics.Debug.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Diagnostics.FileVersionInfo.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Diagnostics.FileVersionInfo.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Diagnostics.FileVersionInfo.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Diagnostics.FileVersionInfo.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Diagnostics.Tools.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Diagnostics.Tools.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Diagnostics.Tools.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Diagnostics.Tools.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Dynamic.Runtime.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Dynamic.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Dynamic.Runtime.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Dynamic.Runtime.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Globalization.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Globalization.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Globalization.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Globalization.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.IO.FileSystem.Primitives.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.IO.FileSystem.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.IO.FileSystem.Primitives.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.IO.FileSystem.Primitives.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.IO.FileSystem.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.IO.FileSystem.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.IO.FileSystem.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.IO.FileSystem.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.IO.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.IO.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.IO.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.IO.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Linq.Expressions.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Linq.Expressions.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Linq.Expressions.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Linq.Expressions.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Linq.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Linq.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Linq.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Linq.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Reflection.Extensions.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Reflection.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Reflection.Extensions.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Reflection.Extensions.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Reflection.Primitives.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Reflection.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Reflection.Primitives.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Reflection.Primitives.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Reflection.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Reflection.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Reflection.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Reflection.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Resources.ResourceManager.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Resources.ResourceManager.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Resources.ResourceManager.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Resources.ResourceManager.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.Extensions.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.Extensions.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.Extensions.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.InteropServices.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.InteropServices.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.InteropServices.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.InteropServices.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.Numerics.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.Numerics.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.Numerics.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.Numerics.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Runtime.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Runtime.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Security.Cryptography.Algorithms.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Security.Cryptography.Algorithms.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Security.Cryptography.Algorithms.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Security.Cryptography.Algorithms.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Security.Cryptography.Primitives.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Security.Cryptography.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Security.Cryptography.Primitives.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Security.Cryptography.Primitives.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Text.Encoding.CodePages.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Text.Encoding.CodePages.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Text.Encoding.CodePages.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Text.Encoding.CodePages.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Text.Encoding.Extensions.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Text.Encoding.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Text.Encoding.Extensions.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Text.Encoding.Extensions.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Text.Encoding.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Text.Encoding.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Text.Encoding.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Text.Encoding.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Threading.Tasks.Parallel.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Threading.Tasks.Parallel.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Threading.Tasks.Parallel.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Threading.Tasks.Parallel.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Threading.Tasks.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Threading.Tasks.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Threading.Tasks.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Threading.Tasks.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Threading.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Threading.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Threading.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Threading.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.ValueTuple.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.ValueTuple.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.ValueTuple.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.ValueTuple.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Xml.ReaderWriter.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Xml.ReaderWriter.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Xml.ReaderWriter.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Xml.ReaderWriter.dll diff --git a/mcs/class/lib/monolite-linux/1051000004/Facades/System.Xml.XDocument.dll b/mcs/class/lib/monolite-linux/1051200002/Facades/System.Xml.XDocument.dll similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/Facades/System.Xml.XDocument.dll rename to mcs/class/lib/monolite-linux/1051200002/Facades/System.Xml.XDocument.dll diff --git a/mcs/class/lib/monolite-linux/1051200002/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/Mono.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..bea96be260 --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/Mono.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +968ff72936e52bedacfc33a30cdcd421c94522a7 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.Configuration.dll.REMOVED.git-id new file mode 100644 index 0000000000..35306003f6 --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/System.Configuration.dll.REMOVED.git-id @@ -0,0 +1 @@ +4dc943b05d47979e08bfbb03ff1ecef3c81f13a5 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..b85e324e6f --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +939005727764598d30ed961d7c64417144ed5273 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.Numerics.dll.REMOVED.git-id new file mode 100644 index 0000000000..b11a780235 --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/System.Numerics.dll.REMOVED.git-id @@ -0,0 +1 @@ +d4777068e27d20b1f9f90e201a51d77c5faa442b \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..24e41d2fac --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/System.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +10e3bfcb53f40eebda9c2d830e4312928fe7f3c9 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051000004/System.Xml.Linq.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.Xml.Linq.dll.REMOVED.git-id similarity index 100% rename from mcs/class/lib/monolite-linux/1051000004/System.Xml.Linq.dll.REMOVED.git-id rename to mcs/class/lib/monolite-linux/1051200002/System.Xml.Linq.dll.REMOVED.git-id diff --git a/mcs/class/lib/monolite-linux/1051200002/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.Xml.dll.REMOVED.git-id new file mode 100644 index 0000000000..1ebc1bdc4f --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/System.Xml.dll.REMOVED.git-id @@ -0,0 +1 @@ +6051fe6c7013789d45e7d8e3fb8d8039e9ff814a \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..e362ce1b0d --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +391ab530387c217aea71486f167301bf0e2b871e \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/mcs.exe.REMOVED.git-id new file mode 100644 index 0000000000..19b44f3afd --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/mcs.exe.REMOVED.git-id @@ -0,0 +1 @@ +27203237ac23da05704e504c5e1cd2bec13d1210 \ No newline at end of file diff --git a/mcs/class/lib/monolite-linux/1051200002/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-linux/1051200002/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..c4347032c5 --- /dev/null +++ b/mcs/class/lib/monolite-linux/1051200002/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +4e5a5ee2828ce937ec0c19e3d34cd5a0d8c3533b \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/Mono.Security.dll.REMOVED.git-id deleted file mode 100644 index ed34c66cbc..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/Mono.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -7c8d89b02f2047cd0842d913bdd7860a7d1c774b \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/System.Configuration.dll.REMOVED.git-id deleted file mode 100644 index f10071d943..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/System.Configuration.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -f0db91f9f6a66d380bdb74a54724cb81139917ae \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/System.Core.dll.REMOVED.git-id deleted file mode 100644 index eee5238d50..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/System.Core.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -0363f34f51449bff18edf8ea217e3d913d5c8b4d \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/System.Numerics.dll.REMOVED.git-id deleted file mode 100644 index 456be38d1e..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/System.Numerics.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c9472a9e2a46aff19f2ce276585ed3fdbe808f66 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/System.Security.dll.REMOVED.git-id deleted file mode 100644 index e4e68e05cc..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/System.Security.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -3450b5110feb624c0036d5352c84742585cc1035 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/System.Xml.dll.REMOVED.git-id deleted file mode 100644 index 6c6896955a..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/System.Xml.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -46a1932a1360e7864625d4f0b04bc7b36028d64a \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/System.dll.REMOVED.git-id deleted file mode 100644 index fec6383249..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/System.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -4f13db2e6344de8931df89de1cb101a2e66b44dc \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/mcs.exe.REMOVED.git-id deleted file mode 100644 index 3882a4b71a..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/mcs.exe.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -c8931f632b4c2c1fc85b137eaf033c5256e6a840 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051000004/mscorlib.dll.REMOVED.git-id deleted file mode 100644 index 5683bef3ae..0000000000 --- a/mcs/class/lib/monolite-win32/1051000004/mscorlib.dll.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -a1a9c8c762dd61497f47f03d38876b3d8c0ac8f0 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Collections.Concurrent.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Collections.Concurrent.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Collections.Concurrent.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Collections.Concurrent.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Collections.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Collections.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Collections.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Collections.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Diagnostics.Debug.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Diagnostics.Debug.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Diagnostics.Debug.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Diagnostics.Debug.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Diagnostics.FileVersionInfo.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Diagnostics.FileVersionInfo.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Diagnostics.FileVersionInfo.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Diagnostics.FileVersionInfo.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Diagnostics.Tools.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Diagnostics.Tools.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Diagnostics.Tools.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Diagnostics.Tools.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Dynamic.Runtime.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Dynamic.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Dynamic.Runtime.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Dynamic.Runtime.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Globalization.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Globalization.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Globalization.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Globalization.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.IO.FileSystem.Primitives.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.IO.FileSystem.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.IO.FileSystem.Primitives.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.IO.FileSystem.Primitives.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.IO.FileSystem.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.IO.FileSystem.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.IO.FileSystem.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.IO.FileSystem.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.IO.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.IO.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.IO.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.IO.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Linq.Expressions.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Linq.Expressions.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Linq.Expressions.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Linq.Expressions.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Linq.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Linq.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Linq.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Linq.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Reflection.Extensions.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Reflection.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Reflection.Extensions.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Reflection.Extensions.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Reflection.Primitives.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Reflection.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Reflection.Primitives.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Reflection.Primitives.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Reflection.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Reflection.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Reflection.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Reflection.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Resources.ResourceManager.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Resources.ResourceManager.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Resources.ResourceManager.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Resources.ResourceManager.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.Extensions.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.Extensions.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.Extensions.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.InteropServices.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.InteropServices.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.InteropServices.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.InteropServices.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.Numerics.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.Numerics.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.Numerics.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.Numerics.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Runtime.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Runtime.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Security.Cryptography.Algorithms.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Security.Cryptography.Algorithms.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Security.Cryptography.Algorithms.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Security.Cryptography.Algorithms.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Security.Cryptography.Primitives.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Security.Cryptography.Primitives.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Security.Cryptography.Primitives.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Security.Cryptography.Primitives.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Text.Encoding.CodePages.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Text.Encoding.CodePages.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Text.Encoding.CodePages.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Text.Encoding.CodePages.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Text.Encoding.Extensions.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Text.Encoding.Extensions.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Text.Encoding.Extensions.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Text.Encoding.Extensions.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Text.Encoding.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Text.Encoding.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Text.Encoding.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Text.Encoding.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Threading.Tasks.Parallel.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Threading.Tasks.Parallel.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Threading.Tasks.Parallel.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Threading.Tasks.Parallel.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Threading.Tasks.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Threading.Tasks.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Threading.Tasks.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Threading.Tasks.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Threading.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Threading.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Threading.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Threading.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.ValueTuple.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.ValueTuple.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.ValueTuple.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.ValueTuple.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Xml.ReaderWriter.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Xml.ReaderWriter.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Xml.ReaderWriter.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Xml.ReaderWriter.dll diff --git a/mcs/class/lib/monolite-win32/1051000004/Facades/System.Xml.XDocument.dll b/mcs/class/lib/monolite-win32/1051200002/Facades/System.Xml.XDocument.dll similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/Facades/System.Xml.XDocument.dll rename to mcs/class/lib/monolite-win32/1051200002/Facades/System.Xml.XDocument.dll diff --git a/mcs/class/lib/monolite-win32/1051200002/Mono.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/Mono.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..bea96be260 --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/Mono.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +968ff72936e52bedacfc33a30cdcd421c94522a7 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/System.Configuration.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.Configuration.dll.REMOVED.git-id new file mode 100644 index 0000000000..35306003f6 --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/System.Configuration.dll.REMOVED.git-id @@ -0,0 +1 @@ +4dc943b05d47979e08bfbb03ff1ecef3c81f13a5 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/System.Core.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.Core.dll.REMOVED.git-id new file mode 100644 index 0000000000..b85e324e6f --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/System.Core.dll.REMOVED.git-id @@ -0,0 +1 @@ +939005727764598d30ed961d7c64417144ed5273 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/System.Numerics.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.Numerics.dll.REMOVED.git-id new file mode 100644 index 0000000000..b11a780235 --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/System.Numerics.dll.REMOVED.git-id @@ -0,0 +1 @@ +d4777068e27d20b1f9f90e201a51d77c5faa442b \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/System.Security.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.Security.dll.REMOVED.git-id new file mode 100644 index 0000000000..24e41d2fac --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/System.Security.dll.REMOVED.git-id @@ -0,0 +1 @@ +10e3bfcb53f40eebda9c2d830e4312928fe7f3c9 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051000004/System.Xml.Linq.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.Xml.Linq.dll.REMOVED.git-id similarity index 100% rename from mcs/class/lib/monolite-win32/1051000004/System.Xml.Linq.dll.REMOVED.git-id rename to mcs/class/lib/monolite-win32/1051200002/System.Xml.Linq.dll.REMOVED.git-id diff --git a/mcs/class/lib/monolite-win32/1051200002/System.Xml.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.Xml.dll.REMOVED.git-id new file mode 100644 index 0000000000..1ebc1bdc4f --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/System.Xml.dll.REMOVED.git-id @@ -0,0 +1 @@ +6051fe6c7013789d45e7d8e3fb8d8039e9ff814a \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/System.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/System.dll.REMOVED.git-id new file mode 100644 index 0000000000..e362ce1b0d --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/System.dll.REMOVED.git-id @@ -0,0 +1 @@ +391ab530387c217aea71486f167301bf0e2b871e \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/mcs.exe.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/mcs.exe.REMOVED.git-id new file mode 100644 index 0000000000..19b44f3afd --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/mcs.exe.REMOVED.git-id @@ -0,0 +1 @@ +27203237ac23da05704e504c5e1cd2bec13d1210 \ No newline at end of file diff --git a/mcs/class/lib/monolite-win32/1051200002/mscorlib.dll.REMOVED.git-id b/mcs/class/lib/monolite-win32/1051200002/mscorlib.dll.REMOVED.git-id new file mode 100644 index 0000000000..c4347032c5 --- /dev/null +++ b/mcs/class/lib/monolite-win32/1051200002/mscorlib.dll.REMOVED.git-id @@ -0,0 +1 @@ +4e5a5ee2828ce937ec0c19e3d34cd5a0d8c3533b \ No newline at end of file diff --git a/mcs/class/referencesource/System/net/System/Net/webclient.cs.REMOVED.git-id b/mcs/class/referencesource/System/net/System/Net/webclient.cs.REMOVED.git-id index 7f5e3d92f7..81d6cd244b 100644 --- a/mcs/class/referencesource/System/net/System/Net/webclient.cs.REMOVED.git-id +++ b/mcs/class/referencesource/System/net/System/Net/webclient.cs.REMOVED.git-id @@ -1 +1 @@ -96cf1c91007b018d4ecf5507a5e221a47f103a1d \ No newline at end of file +3b6da7ced09115387e9630a4266784f9d7cb23a9 \ No newline at end of file diff --git a/mcs/class/referencesource/mscorlib/system/diagnostics/assert.cs b/mcs/class/referencesource/mscorlib/system/diagnostics/assert.cs index 8b886267bc..78277381e5 100644 --- a/mcs/class/referencesource/mscorlib/system/diagnostics/assert.cs +++ b/mcs/class/referencesource/mscorlib/system/diagnostics/assert.cs @@ -116,12 +116,18 @@ namespace System.Diagnostics { #endif } } - + +#if MONO + internal static int ShowDefaultAssertDialog(String conditionString, String message, String stackTrace, String windowTitle) { + throw new NotImplementedException (); + } +#else // Called when an assert happens. // windowTitle can be null. [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.Process)] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal extern static int ShowDefaultAssertDialog(String conditionString, String message, String stackTrace, String windowTitle); +#endif } } diff --git a/mcs/class/referencesource/mscorlib/system/exception.cs b/mcs/class/referencesource/mscorlib/system/exception.cs index a539756ee1..ba3e49e67b 100644 --- a/mcs/class/referencesource/mscorlib/system/exception.cs +++ b/mcs/class/referencesource/mscorlib/system/exception.cs @@ -281,13 +281,12 @@ namespace System { get { return _innerException; } } - +#if !MONO [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] static extern private IRuntimeMethodInfo GetMethodFromStackTrace(Object stackTrace); -#if !MONO [System.Security.SecuritySafeCritical] // auto-generated private MethodBase GetExceptionMethodFromStackTrace() { @@ -1036,11 +1035,16 @@ namespace System { } } +#if MONO + private static bool nIsTransient(int hr) { + throw new NotImplementedException (); + } +#else [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private extern static bool nIsTransient(int hr); - +#endif // This piece of infrastructure exists to help avoid deadlocks // between parts of mscorlib that might throw an exception while @@ -1065,11 +1069,11 @@ namespace System { #if MONO switch (kind) { case ExceptionMessageKind.ThreadAbort: - return ""; + return "Thread was being aborted."; case ExceptionMessageKind.ThreadInterrupted: - return ""; + return "Thread was interrupted from a waiting state."; case ExceptionMessageKind.OutOfMemory: - return "Out of memory"; + return "Insufficient memory to continue the execution of the program."; } return ""; #else diff --git a/mcs/class/referencesource/mscorlib/system/gc.cs b/mcs/class/referencesource/mscorlib/system/gc.cs index dcc15f55ed..a9adeac345 100644 --- a/mcs/class/referencesource/mscorlib/system/gc.cs +++ b/mcs/class/referencesource/mscorlib/system/gc.cs @@ -652,6 +652,7 @@ namespace System { } } +#if !MONO #if !FEATURE_CORECLR internal class SizedReference : IDisposable { @@ -751,4 +752,5 @@ namespace System { } } #endif +#endif } diff --git a/mcs/class/referencesource/mscorlib/system/missingmemberexception.cs b/mcs/class/referencesource/mscorlib/system/missingmemberexception.cs index 0e9ea0974b..7f2857d962 100644 --- a/mcs/class/referencesource/mscorlib/system/missingmemberexception.cs +++ b/mcs/class/referencesource/mscorlib/system/missingmemberexception.cs @@ -61,13 +61,18 @@ namespace System { } } } - + +#if MONO + internal static String FormatSignature(byte [] signature) { + throw new NotImplementedException (); + } +#else // Called to format signature [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern String FormatSignature(byte [] signature); - +#endif // Potentially called from the EE diff --git a/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs b/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs index 7d31bda158..c4889f480f 100644 --- a/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs +++ b/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs @@ -145,6 +145,9 @@ namespace System.Runtime.ExceptionServices { // This method will restore the original stack trace and bucketing details before throwing // the exception so that it is easy, from debugging standpoint, to understand what really went wrong on // the original thread. +#if MONO + [System.Diagnostics.StackTraceHidden] +#endif public void Throw() { // Restore the exception dispatch details before throwing the exception. @@ -153,6 +156,7 @@ namespace System.Runtime.ExceptionServices { } #if MONO + [System.Diagnostics.StackTraceHidden] public static void Throw (Exception source) => Capture (source).Throw (); #endif } diff --git a/mcs/class/referencesource/mscorlib/system/string.cs.REMOVED.git-id b/mcs/class/referencesource/mscorlib/system/string.cs.REMOVED.git-id index 84deee61b8..8c8abf6037 100644 --- a/mcs/class/referencesource/mscorlib/system/string.cs.REMOVED.git-id +++ b/mcs/class/referencesource/mscorlib/system/string.cs.REMOVED.git-id @@ -1 +1 @@ -79e71f969cd9994599f828f5f837105f57781ca7 \ No newline at end of file +4f1214b31d44b0d1eab716234b631e9ad233967c \ No newline at end of file diff --git a/mcs/class/referencesource/mscorlib/system/threading/synchronizationcontext.cs b/mcs/class/referencesource/mscorlib/system/threading/synchronizationcontext.cs index 98e2f3fb73..34bb037f2a 100644 --- a/mcs/class/referencesource/mscorlib/system/threading/synchronizationcontext.cs +++ b/mcs/class/referencesource/mscorlib/system/threading/synchronizationcontext.cs @@ -173,7 +173,11 @@ namespace System.Threading #if MONO protected static int WaitHelper(IntPtr[] waitHandles, bool waitAll, int millisecondsTimeout) { - throw new NotImplementedException (); + unsafe { + fixed (IntPtr * pWaitHandles = waitHandles) { + return System.Threading.WaitHandle.Wait_internal (pWaitHandles, waitHandles.Length, waitAll, millisecondsTimeout); + } + } } #else [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs b/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs index 6def21787d..2db695c93e 100644 --- a/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs +++ b/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs @@ -675,7 +675,9 @@ namespace System.Threading } } } - +#if MONO + ThreadPool.NotifyWorkItemQueued(); +#endif EnsureThreadRequested(); } @@ -1897,6 +1899,13 @@ namespace System.Threading [MethodImplAttribute(MethodImplOptions.InternalCall)] internal static extern void NotifyWorkItemProgressNative(); +#if MONO + [System.Security.SecurityCritical] + [ResourceExposure(ResourceScope.None)] + [MethodImplAttribute(MethodImplOptions.InternalCall)] + internal static extern void NotifyWorkItemQueued(); +#endif + [System.Security.SecurityCritical] // auto-generated [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] diff --git a/mcs/class/referencesource/mscorlib/system/throwhelper.cs b/mcs/class/referencesource/mscorlib/system/throwhelper.cs index 34f3d69db3..21ccab07c0 100644 --- a/mcs/class/referencesource/mscorlib/system/throwhelper.cs +++ b/mcs/class/referencesource/mscorlib/system/throwhelper.cs @@ -52,6 +52,9 @@ namespace System { using System.Collections.Generic; [Pure] +#if MONO + [System.Diagnostics.StackTraceHidden] +#endif internal static partial class ThrowHelper { #if !MONO internal static void ThrowArgumentOutOfRangeException() { diff --git a/mcs/class/referencesource/mscorlib/system/timespan.cs b/mcs/class/referencesource/mscorlib/system/timespan.cs index 65bad44d66..211eae2cf1 100644 --- a/mcs/class/referencesource/mscorlib/system/timespan.cs +++ b/mcs/class/referencesource/mscorlib/system/timespan.cs @@ -412,10 +412,16 @@ namespace System { // "TimeSpan_LegacyFormatMode"=dword:00000001 // #if !FEATURE_CORECLR +#if MONO + private static bool LegacyFormatMode() { + return false; + } +#else [System.Security.SecurityCritical] [ResourceExposure(ResourceScope.None)] [MethodImplAttribute(MethodImplOptions.InternalCall)] private static extern bool LegacyFormatMode(); +#endif #endif // !FEATURE_CORECLR // // In Silverlight v4, specifying the APP_EARLIER_THAN_SL4.0 quirks mode allows applications to diff --git a/mcs/errors/cs0151-4.cs b/mcs/errors/cs0151-4.cs index 0e45b1a904..c9e05589e4 100644 --- a/mcs/errors/cs0151-4.cs +++ b/mcs/errors/cs0151-4.cs @@ -1,5 +1,6 @@ // CS0151: A switch expression of type `S1?' cannot be converted to an integral type, bool, char, string, enum or nullable type -// Line: 24 +// Line: 25 +// Compiler options: -langversion:5 using System; diff --git a/mcs/errors/cs0273-2.cs b/mcs/errors/cs0273-2.cs new file mode 100644 index 0000000000..b0bdbef9e7 --- /dev/null +++ b/mcs/errors/cs0273-2.cs @@ -0,0 +1,9 @@ +// CS0273: The accessibility modifier of the `C.S2.set' accessor must be more restrictive than the modifier of the property or indexer `C.S2' +// Line: 7 +// Compiler options: -langversion:7.2 + + class C + { + private string S2 { get; private protected set; } + } + diff --git a/mcs/errors/cs1013-1.cs b/mcs/errors/cs1013-1.cs new file mode 100644 index 0000000000..01827df499 --- /dev/null +++ b/mcs/errors/cs1013-1.cs @@ -0,0 +1,8 @@ +// CS1013: Invalid number +// Line : 6 + +class X +{ + static int i = 0b; + static void Main () {} +} \ No newline at end of file diff --git a/mcs/errors/cs1013-2.cs b/mcs/errors/cs1013-2.cs new file mode 100644 index 0000000000..c868cb2a76 --- /dev/null +++ b/mcs/errors/cs1013-2.cs @@ -0,0 +1,7 @@ +// CS1013: Invalid number +// Line : 6 + +class X +{ + static int i = 0x0_; +} \ No newline at end of file diff --git a/mcs/errors/cs1021-4.cs b/mcs/errors/cs1021-4.cs new file mode 100644 index 0000000000..75c2ff7036 --- /dev/null +++ b/mcs/errors/cs1021-4.cs @@ -0,0 +1,8 @@ +// CS1021: Integral constant is too large +// Line: 6 + +class X { + public static void Main() { + int h = 0b11111111111111111111111111111111111111111111111111111111111111111; + } +} diff --git a/mcs/errors/cs1061-18.cs b/mcs/errors/cs1061-18.cs new file mode 100644 index 0000000000..3ac82b7f2d --- /dev/null +++ b/mcs/errors/cs1061-18.cs @@ -0,0 +1,10 @@ +// CS1061: Type `int' does not contain a definition for `__0' and no extension method `__0' of type `int' could be found. Are you missing an assembly reference? +// Line: 8 + +static class C +{ + static void Main () + { + int c = 0.__0; + } +} \ No newline at end of file diff --git a/mcs/errors/cs1527-2.cs b/mcs/errors/cs1527-2.cs index d38945f3c8..0256ee2b35 100644 --- a/mcs/errors/cs1527-2.cs +++ b/mcs/errors/cs1527-2.cs @@ -1,4 +1,4 @@ -// CS1527: Namespace elements cannot be explicitly declared as private, protected or protected internal +// CS1527: Namespace elements cannot be explicitly declared as private, protected, protected internal, or private protected // Line: 4 protected interface IFoo { diff --git a/mcs/errors/cs1527-3.cs b/mcs/errors/cs1527-3.cs index 763c75958e..469d74cbb9 100644 --- a/mcs/errors/cs1527-3.cs +++ b/mcs/errors/cs1527-3.cs @@ -1,4 +1,4 @@ -// CS1527: Namespace elements cannot be explicitly declared as private, protected or protected internal +// CS1527: Namespace elements cannot be explicitly declared as private, protected, protected internal, or private protected // Line: 4 protected internal enum E { diff --git a/mcs/errors/cs1527.cs b/mcs/errors/cs1527.cs index 189cc472f4..e847fd14e1 100644 --- a/mcs/errors/cs1527.cs +++ b/mcs/errors/cs1527.cs @@ -1,4 +1,5 @@ -// CS1527: Namespace elements cannot be explicitly declared as private, protected or protected internal -// Line: +// CS1527: Namespace elements cannot be explicitly declared as private, protected, protected internal, or private protected +// Line: 4 + private class X { } diff --git a/mcs/errors/cs1644-61.cs b/mcs/errors/cs1644-61.cs new file mode 100644 index 0000000000..d58ba64c7e --- /dev/null +++ b/mcs/errors/cs1644-61.cs @@ -0,0 +1,11 @@ +// CS1644: Feature `digit separators' cannot be used because it is not part of the C# 6.0 language specification +// Line: 9 +// Compiler options: -langversion:6 + +class X +{ + int Test () + { + var i = 1_0; + } +} diff --git a/mcs/errors/cs1644-62.cs b/mcs/errors/cs1644-62.cs new file mode 100644 index 0000000000..5a29839610 --- /dev/null +++ b/mcs/errors/cs1644-62.cs @@ -0,0 +1,10 @@ +// CS1644: Feature `private protected' cannot be used because it is not part of the C# 6.0 language specification +// Line: 7 +// Compiler options: -langversion:6 + +class C +{ + private protected enum E + { + } +} \ No newline at end of file diff --git a/mcs/errors/cs1763-2.cs b/mcs/errors/cs1763-2.cs index 72f5370949..7e4d091fc7 100644 --- a/mcs/errors/cs1763-2.cs +++ b/mcs/errors/cs1763-2.cs @@ -1,4 +1,4 @@ -// CS1763: Optional parameter `o' of type `object' can only be initialized with `null' +// CS1763: Optional parameter `o' of type `object' can only be initialized with default value // Line: 6 class C diff --git a/mcs/errors/cs1763.cs b/mcs/errors/cs1763.cs index d10a7bf2c2..03b5f28a19 100644 --- a/mcs/errors/cs1763.cs +++ b/mcs/errors/cs1763.cs @@ -1,4 +1,4 @@ -// CS1763: Optional parameter `o' of type `object' can only be initialized with `null' +// CS1763: Optional parameter `o' of type `object' can only be initialized with default value // Line: 6 class C diff --git a/mcs/errors/cs8326.cs b/mcs/errors/cs8326.cs new file mode 100644 index 0000000000..efd3a84fea --- /dev/null +++ b/mcs/errors/cs8326.cs @@ -0,0 +1,13 @@ +// CS8326: Both ref conditional operators must be ref values +// Line: 11 + +class Program +{ + static int x, y; + + public static void Main () + { + bool b = false; + ref int targetBucket = ref b ? x : y; + } +} \ No newline at end of file diff --git a/mcs/errors/cs8327.cs b/mcs/errors/cs8327.cs new file mode 100644 index 0000000000..8d0ccd86a7 --- /dev/null +++ b/mcs/errors/cs8327.cs @@ -0,0 +1,14 @@ +// CS8327: The ref conditional expression types `int' and `byte' have to match +// Line: 12 + +class Program +{ + static int x; + static byte y; + + public static void Main () + { + bool b = false; + ref int targetBucket = ref b ? ref x : ref y; + } +} \ No newline at end of file diff --git a/mcs/errors/known-issues-net_4_x b/mcs/errors/known-issues-net_4_x index c9ed931735..54902e03e7 100644 --- a/mcs/errors/known-issues-net_4_x +++ b/mcs/errors/known-issues-net_4_x @@ -14,6 +14,9 @@ # Parser problems cs0080.cs +# Undocumented switch governing rules +cs0151-4.cs NO ERROR + # Operators cs0457-2.cs cs0457.cs diff --git a/mcs/ilasm/codegen/MethodDef.cs b/mcs/ilasm/codegen/MethodDef.cs index 4e9d31c062..bb40ca0d99 100644 --- a/mcs/ilasm/codegen/MethodDef.cs +++ b/mcs/ilasm/codegen/MethodDef.cs @@ -512,9 +512,6 @@ namespace Mono.ILASM { meth_attr &= ~PEAPI.MethAttr.Abstract; meth_attr |= PEAPI.MethAttr.Static; } else { - if ((inst_list.Count > 0) && type_def.IsInterface && !IsStatic) - Report.Error (start, "Method cannot have body if it is non-static declared in an interface"); - if (IsAbstract) { if (!type_def.IsAbstract) Report.Error (start, String.Format ("Abstract method '{0}' in non-abstract class '{1}'", diff --git a/mcs/ilasm/codegen/TypeDef.cs b/mcs/ilasm/codegen/TypeDef.cs index f35dca0bd4..e6d9dc2cdb 100644 --- a/mcs/ilasm/codegen/TypeDef.cs +++ b/mcs/ilasm/codegen/TypeDef.cs @@ -207,9 +207,9 @@ namespace Mono.ILASM { public void AddMethodDef (MethodDef methoddef) { - if (IsInterface && !methoddef.IsStatic && (!methoddef.IsVirtual || !methoddef.IsAbstract)) { - Report.Warning (methoddef.StartLocation, "Non-virtual or non-abstract instance method in interface, set to such"); - methoddef.Attributes |= PEAPI.MethAttr.Abstract | PEAPI.MethAttr.Virtual; + if (IsInterface && !methoddef.IsStatic && !methoddef.IsVirtual) { + Report.Warning (methoddef.StartLocation, "Non-virtual instance method in interface, set to such"); + methoddef.Attributes |= PEAPI.MethAttr.Virtual; } if (method_table [methoddef.Signature] != null) diff --git a/mcs/jay/closure.c b/mcs/jay/closure.c index 5f63c5f32c..9dff2762bf 100644 --- a/mcs/jay/closure.c +++ b/mcs/jay/closure.c @@ -47,8 +47,17 @@ unsigned *ruleset; static unsigned *first_derives; static unsigned *EFF; +void +print_first_derives (void); -set_EFF() +void +print_closure (int n); + +void +print_EFF (void); + +static void +set_EFF (void) { register unsigned *row; register int symbol; @@ -83,8 +92,8 @@ set_EFF() #endif } - -set_first_derives() +void +set_first_derives (void) { register unsigned *rrow; register unsigned *vrow; @@ -138,10 +147,8 @@ set_first_derives() FREE(EFF); } - -closure(nucleus, n) -short *nucleus; -int n; +void +closure (short *nucleus, int n) { register int ruleno; register unsigned word; @@ -207,20 +214,18 @@ int n; #endif } - - -finalize_closure() +void +finalize_closure (void) { FREE(itemset); FREE(ruleset); FREE(first_derives + ntokens * WORDSIZE(nrules)); } - #ifdef DEBUG -print_closure(n) -int n; +void +print_closure (int n) { register short *isp; @@ -229,8 +234,8 @@ int n; printf(" %d\n", *isp); } - -print_EFF() +void +print_EFF (void) { register int i, j; register unsigned *rowp; @@ -260,8 +265,8 @@ print_EFF() } } - -print_first_derives() +void +print_first_derives (void) { register int i; register int j; diff --git a/mcs/jay/defs.h b/mcs/jay/defs.h index 2aade48dac..b5dfc4303b 100644 --- a/mcs/jay/defs.h +++ b/mcs/jay/defs.h @@ -162,6 +162,7 @@ struct bucket short value; short index; short prec; +#define class clas char class; char assoc; }; @@ -248,11 +249,10 @@ extern int nrules; extern int nsyms; extern int ntokens; extern int nvars; -extern int ntags; extern int nmethods; -extern char *line_format; -extern char *default_line_format; +extern const char *line_format; +extern const char *default_line_format; extern int start_symbol; extern char **symbol_name; @@ -300,8 +300,155 @@ extern short final_state; /* global functions */ -extern char *allocate(); -extern bucket *lookup(); -extern bucket *make_bucket(); +char * +allocate (unsigned); +bucket * +lookup (const char *); +bucket * +make_bucket (const char *); + +void +reflexive_transitive_closure (unsigned *R, int n); + +void +done (int); + +void +fatal (const char*); + +void +no_space (void); + +void +finalize_closure (void); + +void +closure (short *nucleus, int n); + +void +set_first_derives (void); + +void +open_error (const char *filename); + +void +make_parser (void); + +void +free_parser (void); + +void +lr0 (void); + +void +output (void); + +void +verbose (void); + +void +xxlr0 (void); + +void +reader (void); + +void +lalr (void); + +void +free_symbols (void); + +void +free_symbol_table (void); + +void +create_symbol_table (void); + +void +fatal (const char *msg); + +void +no_space (void); + +void +open_error (const char *filename); + +void +unexpected_EOF (void); + +void +syntax_error (int st_lineno, const char *st_line, const char *st_cptr); + +void +unterminated_comment (int c_lineno, const char *c_line, const char *c_cptr); + +void +unterminated_string (int s_lineno, const char *s_line, const char *s_cptr); + +void +unterminated_text (int t_lineno, const char *t_line, const char *t_cptr); + +void +illegal_tag (int t_lineno, const char *t_line, const char *t_cptr); + +void +illegal_character (const char *c_cptr); + +void +used_reserved (const char *s); + +void +tokenized_start (const char *s); + +void +retyped_warning (const char *s); + +void +reprec_warning (const char *s); + +void +revalued_warning (const char *s); + +void +terminal_start (const char *s); + +void +restarted_warning (void); + +void +no_grammar (void); + +void +terminal_lhs (int s_lineno); + +void +prec_redeclared (void); + +void +unterminated_action (int a_lineno, const char *a_line, const char *a_cptr); + +void +dollar_warning (int a_lineno, int i); + +void +dollar_error (int a_lineno, const char *a_line, char *a_cptr); + +void +untyped_lhs (void); + +void +untyped_rhs (int i, const char *s); + +void +unknown_rhs (int i); + +void +default_action_warning (void); + +void +undefined_goal (const char *s); + +void +undefined_symbol_warning (const char *s); diff --git a/mcs/jay/error.c b/mcs/jay/error.c index dd8bf291c2..243a260fe7 100644 --- a/mcs/jay/error.c +++ b/mcs/jay/error.c @@ -42,43 +42,39 @@ static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90"; #include "defs.h" - -fatal(msg) -char *msg; +void +fatal (const char *msg) { fprintf(stderr, "%s: f - %s\n", myname, msg); done(2); } - -no_space() +void +no_space (void) { fprintf(stderr, "%s: f - out of space\n", myname); done(2); } - -open_error(filename) -char *filename; +void +open_error (const char *filename) { fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename); done(2); } - -unexpected_EOF() +void +unexpected_EOF (void) { fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n", myname, lineno, input_file_name); done(1); } - -print_pos(st_line, st_cptr) -char *st_line; -char *st_cptr; +static void +print_pos (const char *st_line, const char *st_cptr) { - register char *s; + const char *s; if (st_line == 0) return; for (s = st_line; *s != '\n'; ++s) @@ -100,11 +96,8 @@ char *st_cptr; putc('\n', stderr); } - -syntax_error(st_lineno, st_line, st_cptr) -int st_lineno; -char *st_line; -char *st_cptr; +void +syntax_error (int st_lineno, const char *st_line, const char *st_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n", myname, st_lineno, input_file_name); @@ -112,11 +105,8 @@ char *st_cptr; done(1); } - -unterminated_comment(c_lineno, c_line, c_cptr) -int c_lineno; -char *c_line; -char *c_cptr; +void +unterminated_comment (int c_lineno, const char *c_line, const char *c_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n", myname, c_lineno, input_file_name); @@ -124,11 +114,8 @@ char *c_cptr; done(1); } - -unterminated_string(s_lineno, s_line, s_cptr) -int s_lineno; -char *s_line; -char *s_cptr; +void +unterminated_string (int s_lineno, const char *s_line, const char *s_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n", myname, s_lineno, input_file_name); @@ -136,11 +123,8 @@ char *s_cptr; done(1); } - -unterminated_text(t_lineno, t_line, t_cptr) -int t_lineno; -char *t_line; -char *t_cptr; +void +unterminated_text (int t_lineno, const char *t_line, const char *t_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n", myname, t_lineno, input_file_name); @@ -148,11 +132,8 @@ char *t_cptr; done(1); } - -illegal_tag(t_lineno, t_line, t_cptr) -int t_lineno; -char *t_line; -char *t_cptr; +void +illegal_tag (int t_lineno, const char *t_line, const char *t_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n", myname, t_lineno, input_file_name); @@ -160,9 +141,8 @@ char *t_cptr; done(1); } - -illegal_character(c_cptr) -char *c_cptr; +void +illegal_character (const char *c_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n", myname, lineno, input_file_name); @@ -170,93 +150,83 @@ char *c_cptr; done(1); } - -used_reserved(s) -char *s; +void +used_reserved (const char *s) { fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \ %s\n", myname, lineno, input_file_name, s); done(1); } - -tokenized_start(s) -char *s; +void +tokenized_start (const char *s) { fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \ declared to be a token\n", myname, lineno, input_file_name, s); done(1); } - -retyped_warning(s) -char *s; +void +retyped_warning (const char *s) { fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \ redeclared\n", myname, lineno, input_file_name, s); } - -reprec_warning(s) -char *s; +void +reprec_warning (const char *s) { fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \ redeclared\n", myname, lineno, input_file_name, s); } - -revalued_warning(s) -char *s; +void +revalued_warning (const char *s) { fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \ redeclared\n", myname, lineno, input_file_name, s); } - -terminal_start(s) -char *s; +void +terminal_start (const char *s) { fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \ token\n", myname, lineno, input_file_name, s); done(1); } - -restarted_warning() +void +restarted_warning (void) { fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \ redeclared\n", myname, lineno, input_file_name); } - -no_grammar() +void +no_grammar (void) { fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \ specified\n", myname, lineno, input_file_name); done(1); } - -terminal_lhs(s_lineno) -int s_lineno; +void +terminal_lhs (int s_lineno) { fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \ of a production\n", myname, s_lineno, input_file_name); done(1); } - -prec_redeclared() +void +prec_redeclared (void) { fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \ specifiers\n", myname, lineno, input_file_name); } - -unterminated_action(a_lineno, a_line, a_cptr) -int a_lineno; -char *a_line; -char *a_cptr; +void +unterminated_action (int a_lineno, const char *a_line, const char *a_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n", myname, a_lineno, input_file_name); @@ -264,20 +234,15 @@ char *a_cptr; done(1); } - -dollar_warning(a_lineno, i) -int a_lineno; -int i; +void +dollar_warning (int a_lineno, int i) { fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \ end of the current rule\n", myname, a_lineno, input_file_name, i); } - -dollar_error(a_lineno, a_line, a_cptr) -int a_lineno; -char *a_line; -char *a_cptr; +void +dollar_error (int a_lineno, const char *a_line, char *a_cptr) { fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n", myname, a_lineno, input_file_name); @@ -285,51 +250,46 @@ char *a_cptr; done(1); } - -untyped_lhs() +void +untyped_lhs (void) { fprintf(stderr, "%s: w - line %d of \"%s\", $$ is untyped\n", myname, lineno, input_file_name); /** done(1); */ } - -untyped_rhs(i, s) -int i; -char *s; +void +untyped_rhs (int i, const char *s) { fprintf(stderr, "%s: w - line %d of \"%s\", $%d (%s) is untyped\n", myname, lineno, input_file_name, i, s); /** done(1); */ } - -unknown_rhs(i) -int i; +void +unknown_rhs (int i) { fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n", myname, lineno, input_file_name, i); done(1); } - -default_action_warning() +void +default_action_warning (void) { fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \ undefined value to $$\n", myname, lineno, input_file_name); } - -undefined_goal(s) -char *s; +void +undefined_goal (const char *s) { fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s); done(1); } - -undefined_symbol_warning(s) -char *s; +void +undefined_symbol_warning (const char *s) { fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); } diff --git a/mcs/jay/lalr.c b/mcs/jay/lalr.c index bf9aec846b..81656753bc 100644 --- a/mcs/jay/lalr.c +++ b/mcs/jay/lalr.c @@ -60,7 +60,8 @@ short *goto_map; short *from_state; short *to_state; -short **transpose(); +static short ** +transpose (short **R, int n); static int infinity; static int maxrhs; @@ -73,8 +74,50 @@ static short *INDEX; static short *VERTICES; static int top; +static void +set_state_table (void); -lalr() +static void +set_accessing_symbol (void); + +static void +set_shift_table (void); + +static void +set_reduction_table (void); + +static void +set_maxrhs (void); + +static void +initialize_LA (void); + +static void +set_goto_map (void); + +static void +initialize_F (void); + +static void +build_relations (void); + +static void +compute_FOLLOWS (void); + +static void +compute_lookaheads (void); + +static void +traverse (int i); + +static void +digraph (short **relation); + +static void +add_lookback_edge (int stateno, int ruleno, int gotono); + +void +lalr (void) { tokensetsize = WORDSIZE(ntokens); @@ -91,9 +134,8 @@ lalr() compute_lookaheads(); } - - -set_state_table() +static void +set_state_table (void) { register core *sp; @@ -102,9 +144,8 @@ set_state_table() state_table[sp->number] = sp; } - - -set_accessing_symbol() +static void +set_accessing_symbol (void) { register core *sp; @@ -113,9 +154,8 @@ set_accessing_symbol() accessing_symbol[sp->number] = sp->accessing_symbol; } - - -set_shift_table() +static void +set_shift_table (void) { register shifts *sp; @@ -124,9 +164,8 @@ set_shift_table() shift_table[sp->number] = sp; } - - -set_reduction_table() +static void +set_reduction_table (void) { register reductions *rp; @@ -135,9 +174,8 @@ set_reduction_table() reduction_table[rp->number] = rp; } - - -set_maxrhs() +static void +set_maxrhs (void) { register short *itemp; register short *item_end; @@ -163,9 +201,8 @@ set_maxrhs() maxrhs = max; } - - -initialize_LA() +static void +initialize_LA (void) { register int i, j, k; register reductions *rp; @@ -201,8 +238,8 @@ initialize_LA() } } - -set_goto_map() +static void +set_goto_map (void) { register shifts *sp; register int i; @@ -271,10 +308,8 @@ set_goto_map() /* Map_goto maps a state/symbol pair into its numeric representation. */ -int -map_goto(state, symbol) -int state; -int symbol; +static int +map_goto (int state, int symbol) { register int high; register int low; @@ -298,9 +333,8 @@ int symbol; } } - - -initialize_F() +static void +initialize_F (void) { register int i; register int j; @@ -375,9 +409,8 @@ initialize_F() FREE(edge); } - - -build_relations() +static void +build_relations (void) { register int i; register int j; @@ -468,9 +501,8 @@ build_relations() FREE(states); } - -add_lookback_edge(stateno, ruleno, gotono) -int stateno, ruleno, gotono; +static void +add_lookback_edge (int stateno, int ruleno, int gotono) { register int i, k; register int found; @@ -494,12 +526,8 @@ int stateno, ruleno, gotono; lookback[i] = sp; } - - -short ** -transpose(R, n) -short **R; -int n; +static short ** +transpose (short **R, int n) { register short **new_R; register short **temp_R; @@ -552,15 +580,14 @@ int n; return (new_R); } - - -compute_FOLLOWS() +static void +compute_FOLLOWS (void) { digraph(includes); } - -compute_lookaheads() +static void +compute_lookaheads (void) { register int i, n; register unsigned *fp1, *fp2, *fp3; @@ -593,9 +620,8 @@ compute_lookaheads() FREE(F); } - -digraph(relation) -short **relation; +static void +digraph (short **relation) { register int i; @@ -619,10 +645,8 @@ short **relation; FREE(VERTICES); } - - -traverse(i) -register int i; +static void +traverse (int i) { register unsigned *fp1; register unsigned *fp2; diff --git a/mcs/jay/lr0.c b/mcs/jay/lr0.c index 43106ea6cf..8e2e8a0305 100644 --- a/mcs/jay/lr0.c +++ b/mcs/jay/lr0.c @@ -49,8 +49,11 @@ core *first_state; shifts *first_shift; reductions *first_reduction; -int get_state(); -core *new_state(); +static int +get_state (int symbol); + +static core * +new_state (int symbol); static core **state_set; static core *this_state; @@ -68,8 +71,25 @@ static short **kernel_base; static short **kernel_end; static short *kernel_items; +#ifdef DEBUG +static void +print_derives (void); +#endif -allocate_itemsets() +static void +save_reductions (void); + +static void +save_shifts (void); + +static void +new_itemsets (void); + +static void +initialize_states (void); + +static void +allocate_itemsets (void) { register short *itemp; register short *item_end; @@ -110,8 +130,8 @@ allocate_itemsets() kernel_end = NEW2(nsyms, short *); } - -allocate_storage() +static void +allocate_storage (void) { allocate_itemsets(); shiftset = NEW2(nsyms, short); @@ -119,8 +139,8 @@ allocate_storage() state_set = NEW2(nitems, core *); } - -append_states() +static void +append_states (void) { register int i; register int j; @@ -148,8 +168,8 @@ append_states() } } - -free_storage() +static void +free_storage (void) { FREE(shift_symbol); FREE(redset); @@ -160,9 +180,8 @@ free_storage() FREE(state_set); } - - -generate_states() +static void +generate_states (void) { allocate_storage(); itemset = NEW2(nitems, short); @@ -187,11 +206,8 @@ generate_states() free_storage(); } - - int -get_state(symbol) -int symbol; +get_state (int symbol) { register int key; register short *isp1; @@ -252,9 +268,8 @@ int symbol; return (sp->number); } - - -initialize_states() +static void +initialize_states (void) { register int i; register short *start_derives; @@ -280,8 +295,8 @@ initialize_states() nstates = 1; } - -new_itemsets() +static void +new_itemsets (void) { register int i; register int shiftcount; @@ -315,11 +330,8 @@ new_itemsets() nshifts = shiftcount; } - - -core * -new_state(symbol) -int symbol; +static core * +new_state (int symbol) { register int n; register core *p; @@ -355,10 +367,10 @@ int symbol; return (p); } - /* show_cores is used for debugging */ -show_cores() +void +show_cores (void) { core *p; int i, j, k, n; @@ -393,7 +405,8 @@ show_cores() /* show_ritems is used for debugging */ -show_ritems() +void +show_ritems (void) { int i; @@ -401,9 +414,9 @@ show_ritems() printf("ritem[%d] = %d\n", i, ritem[i]); } - /* show_rrhs is used for debugging */ -show_rrhs() +void +show_rrhs (void) { int i; @@ -414,7 +427,8 @@ show_rrhs() /* show_shifts is used for debugging */ -show_shifts() +void +show_shifts (void) { shifts *p; int i, j, k; @@ -431,8 +445,8 @@ show_shifts() } } - -save_shifts() +static void +save_shifts (void) { register shifts *p; register short *sp1; @@ -464,9 +478,8 @@ save_shifts() } } - - -save_reductions() +static void +save_reductions (void) { register short *isp; register short *rp1; @@ -514,8 +527,8 @@ save_reductions() } } - -set_derives() +static void +set_derives (void) { register int i, k; register int lhs; @@ -545,14 +558,18 @@ set_derives() #endif } -free_derives() +#if 0 +void +free_derives (void) { FREE(derives[start_symbol]); FREE(derives); } +#endif #ifdef DEBUG -print_derives() +static void +print_derives (void) { register int i; register short *sp; @@ -573,14 +590,14 @@ print_derives() } #endif - -set_nullable() +static void +set_nullable (void) { register int i, j; register int empty; int done; - nullable = MALLOC(nsyms); + nullable = (char*)MALLOC(nsyms); if (nullable == 0) no_space(); for (i = 0; i < nsyms; ++i) @@ -622,14 +639,14 @@ set_nullable() #endif } - -free_nullable() +void +free_nullable (void) { FREE(nullable); } - -lr0() +void +lr0 (void) { set_derives(); set_nullable(); diff --git a/mcs/jay/main.c b/mcs/jay/main.c index fcac218b1d..e039763571 100644 --- a/mcs/jay/main.c +++ b/mcs/jay/main.c @@ -47,19 +47,26 @@ static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93"; #include #include "defs.h" +// FIXME autoconf or use remove instead of unlink +#ifdef _MSC_VER +#include +#else +#include +#endif + char tflag; char vflag; int csharp = 0; -char *file_prefix = "y"; -char *myname = "yacc"; -char *temp_form = "yacc.XXXXXXX"; +const char *file_prefix = (char*)"y"; +char *myname = (char*)"yacc"; +const char *temp_form = "yacc.XXXXXXX"; int lineno; int outline; char *action_file_name; -char *input_file_name = ""; +char *input_file_name = (char*)""; char *prolog_file_name; char *local_file_name; char *verbose_file_name; @@ -100,8 +107,8 @@ extern char* mktemp(); extern char *getenv(); -done(k) -int k; +void +done (int k) { if (action_file) { fclose(action_file); unlink(action_file_name); } if (prolog_file) { fclose(prolog_file); unlink(prolog_file_name); } @@ -109,16 +116,15 @@ int k; exit(k); } - -void -onintr(signo) - int signo; +static void +onintr (int signo) { + (void)signo; // unused done(1); } - -set_signals() +static void +set_signals (void) { #ifdef SIGINT if (signal(SIGINT, SIG_IGN) != SIG_IGN) @@ -134,23 +140,22 @@ set_signals() #endif } - -usage() +static void +usage (void) { fprintf(stderr, "usage: %s [-tvcp] [-b file_prefix] filename\n", myname); exit(1); } -void +static void print_skel_dir(void) { printf ("%s\n", SKEL_DIRECTORY); exit (0); } -getargs(argc, argv) -int argc; -char *argv[]; +static void +getargs (int argc, char *argv[]) { register int i; register char *s; @@ -240,17 +245,15 @@ no_more_options:; input_file_name = argv[i]; } - char * -allocate(n) -unsigned n; +allocate (unsigned n) { register char *p; p = NULL; if (n) { - p = CALLOC(1, n); + p = (char*)CALLOC(1, n); if (!p) no_space(); } return (p); @@ -262,10 +265,11 @@ unsigned n; #define GNUC_UNUSED #endif -create_file_names() +static void +create_file_names (void) { int i, len; - char *tmpdir; + const char *tmpdir; int mkstemp_res GNUC_UNUSED; #if defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) @@ -282,11 +286,11 @@ create_file_names() if (len && tmpdir[len-1] != '/') ++i; - action_file_name = MALLOC(i); + action_file_name = (char*)MALLOC(i); if (action_file_name == 0) no_space(); - prolog_file_name = MALLOC(i); + prolog_file_name = (char*)MALLOC(i); if (prolog_file_name == 0) no_space(); - local_file_name = MALLOC(i); + local_file_name = (char*)MALLOC(i); if (local_file_name == 0) no_space(); strcpy(action_file_name, tmpdir); @@ -317,7 +321,7 @@ create_file_names() if (vflag) { - verbose_file_name = MALLOC(len + 8); + verbose_file_name = (char*)MALLOC(len + 8); if (verbose_file_name == 0) no_space(); strcpy(verbose_file_name, file_prefix); @@ -325,8 +329,8 @@ create_file_names() } } - -open_files() +static void +open_files (void) { create_file_names(); @@ -359,9 +363,7 @@ open_files() int -main(argc, argv) -int argc; -char *argv[]; +main (int argc, char *argv[]) { set_signals(); getargs(argc, argv); diff --git a/mcs/jay/mkpar.c b/mcs/jay/mkpar.c index 42ead14514..ea570a2556 100644 --- a/mcs/jay/mkpar.c +++ b/mcs/jay/mkpar.c @@ -53,13 +53,35 @@ short final_state; static int SRcount; static int RRcount; -extern action *parse_actions(); -extern action *get_shifts(); -extern action *add_reductions(); -extern action *add_reduce(); +static action * +parse_actions (int stateno); +static action * +get_shifts (int stateno); -make_parser() +static action * +add_reductions (int stateno, action *actions); + +static action * +add_reduce (action *actions, int ruleno, int symbol); + +static void +defreds (void); + +static void +remove_conflicts (void); + +static void +total_conflicts (void); + +static void +find_final_state (void); + +static void +unused_rules (void); + +void +make_parser (void) { register int i; @@ -74,10 +96,8 @@ make_parser() defreds(); } - -action * -parse_actions(stateno) -register int stateno; +static action * +parse_actions (int stateno) { register action *actions; @@ -86,10 +106,8 @@ register int stateno; return (actions); } - -action * -get_shifts(stateno) -int stateno; +static action * +get_shifts (int stateno) { register action *actions, *temp; register shifts *sp; @@ -122,10 +140,8 @@ int stateno; return (actions); } -action * -add_reductions(stateno, actions) -int stateno; -register action *actions; +static action * +add_reductions (int stateno, action *actions) { register int i, j, m, n; register int ruleno, tokensetsize; @@ -147,11 +163,8 @@ register action *actions; return (actions); } - -action * -add_reduce(actions, ruleno, symbol) -register action *actions; -register int ruleno, symbol; +static action * +add_reduce (action *actions, int ruleno, int symbol) { register action *temp, *prev, *next; @@ -188,8 +201,8 @@ register int ruleno, symbol; return (actions); } - -find_final_state() +static void +find_final_state (void) { register int goal, i; register short *to_state; @@ -205,8 +218,8 @@ find_final_state() } } - -unused_rules() +static void +unused_rules (void) { register int i; register action *p; @@ -231,14 +244,16 @@ unused_rules() if (!rules_used[i]) ++nunused; if (nunused) + { if (nunused == 1) fprintf(stderr, "%s: 1 rule never reduced\n", myname); else fprintf(stderr, "%s: %d rules never reduced\n", myname, nunused); + } } - -remove_conflicts() +static void +remove_conflicts (void) { register int i; register int symbol; @@ -312,8 +327,8 @@ remove_conflicts() } } - -total_conflicts() +static void +total_conflicts (void) { fprintf(stderr, "%s: ", myname); if (SRtotal == 1) @@ -332,10 +347,8 @@ total_conflicts() fprintf(stderr, ".\n"); } - -int -sole_reduction(stateno) -int stateno; +static int +sole_reduction (int stateno) { register int count, ruleno; register action *p; @@ -361,8 +374,8 @@ int stateno; return (ruleno); } - -defreds() +static void +defreds (void) { register int i; @@ -371,8 +384,8 @@ defreds() defred[i] = sole_reduction(i); } -free_action_row(p) -register action *p; +static void +free_action_row (action *p) { register action *q; @@ -384,7 +397,8 @@ register action *p; } } -free_parser() +void +free_parser (void) { register int i; diff --git a/mcs/jay/output.c b/mcs/jay/output.c index d1e2c14a1b..9e883a7504 100644 --- a/mcs/jay/output.c +++ b/mcs/jay/output.c @@ -58,7 +58,75 @@ static int lowzero; static int high; extern int csharp; -output () { +static void +free_itemsets (void); + +static void +free_reductions (void); + +static void +free_shifts (void); + +static void +goto_actions (void); + +static void +output_actions (void); + +static void +output_base (void); + +static void +output_check (void); + +static void +output_debug (void); + +static void +output_defines (const char *prefix); + +static void +output_rule_data (void); + +static void +output_semantic_actions (void); + +static void +output_stored_text (FILE *file, const char *name); + +static void +output_table (void); + +static void +output_trailing_text (void); + +static void +save_column (int symbol, int default_state); + +static void +sort_actions (void); + +static void +output_yydefred (void); + +static int +default_goto (int symbol); + +static int +matching_vector (int vector); + +static int +pack_vector (int vector); + +static void +token_actions (void); + +static void +pack_table (void); + +void +output (void) +{ int lno = 0; char buf [128]; @@ -77,7 +145,7 @@ output () { case '.': break; default: cp = strtok(buf, " \t\r\n"); - if (cp) + if (cp) { if (strcmp(cp, "actions") == 0) output_semantic_actions(); else if (strcmp(cp, "debug") == 0) output_debug(); else if (strcmp(cp, "epilog") == 0) output_trailing_text(); @@ -91,6 +159,7 @@ output () { output_defines(strtok(NULL, "\r\n")); else fprintf(stderr, "jay: unknown call (%s) in line %d\n", cp, lno); + } continue; } fputs(buf+1, stdout), ++ outline; @@ -98,7 +167,8 @@ output () { free_parser(); } -output_rule_data() +static void +output_rule_data (void) { register int i; register int j; @@ -160,8 +230,8 @@ output_rule_data() printf("\n };\n"); } - -output_yydefred() +static void +output_yydefred (void) { register int i, j; @@ -189,8 +259,8 @@ output_yydefred() printf("\n };\n"); } - -output_actions() +static void +output_actions (void) { nvectors = 2*nstates + nvars; @@ -217,8 +287,8 @@ output_actions() output_check(); } - -token_actions() +static void +token_actions (void) { register int i, j; register int shiftcount, reducecount; @@ -302,7 +372,8 @@ token_actions() FREE(actionrow); } -goto_actions() +static void +goto_actions (void) { register int i, j, k; @@ -334,9 +405,8 @@ goto_actions() FREE(state_count); } -int -default_goto(symbol) -int symbol; +static int +default_goto (int symbol) { register int i; register int m; @@ -369,11 +439,8 @@ int symbol; return (default_state); } - - -save_column(symbol, default_state) -int symbol; -int default_state; +static void +save_column (int symbol, int default_state) { register int i; register int m; @@ -413,7 +480,8 @@ int default_state; width[symno] = sp1[-1] - sp[0] + 1; } -sort_actions() +static void +sort_actions (void) { register int i; register int j; @@ -447,8 +515,8 @@ sort_actions() } } - -pack_table() +static void +pack_table (void) { register int i; register int place; @@ -510,9 +578,8 @@ pack_table() /* faster. Also, it depends on the vectors being in a specific */ /* order. */ -int -matching_vector(vector) -int vector; +static int +matching_vector (int vector) { register int i; register int j; @@ -549,11 +616,8 @@ int vector; return (-1); } - - -int -pack_vector(vector) -int vector; +static int +pack_vector (int vector) { register int i, j, k, l; register int t; @@ -627,9 +691,8 @@ int vector; } } - - -output_base() +static void +output_base (void) { register int i, j; @@ -695,9 +758,8 @@ output_base() FREE(base); } - - -output_table() +static void +output_table (void) { register int i; register int j; @@ -724,9 +786,8 @@ output_table() FREE(table); } - - -output_check() +static void +output_check (void) { register int i; register int j; @@ -755,12 +816,10 @@ output_check() FREE(check); } - -int -is_C_identifier(name) -char *name; +static int +is_C_identifier (const char *name) { - register char *s; + const char *s; register int c; s = name; @@ -780,7 +839,7 @@ char *name; if (!isalpha(c) && c != '_' && c != '$') return (0); - while (c = *++s) + while ((c = *++s)) { if (!isalnum(c) && c != '_' && c != '$') return (0); @@ -788,12 +847,11 @@ char *name; return (1); } - -output_defines(prefix) -char *prefix; +static void +output_defines (const char *prefix) { register int c, i; - register char *s; + const char *s; for (i = 2; i < ntokens; ++i) { @@ -816,7 +874,7 @@ char *prefix; { putchar(c); } - while (c = *++s); + while ((c = *++s)); } ++outline; printf(" = %d%s\n", symbol_value[i], csharp ? ";" : ";"); @@ -827,10 +885,8 @@ char *prefix; printf(" %s yyErrorCode = %d%s\n", prefix ? prefix : "", symbol_value[1], csharp ? ";" : ";"); } - -output_stored_text(file, name) -FILE *file; -char *name; +static void +output_stored_text (FILE *file, const char *name) { register int c; register FILE *in; @@ -854,12 +910,12 @@ char *name; fclose(in); } - -output_debug() +static void +output_debug (void) { register int i, j, k, max; char **symnam, *s; - char * prefix = tflag ? "" : "//t"; + const char * prefix = tflag ? "" : "//t"; ++outline; printf(" protected %s int yyFinal = %d;\n", csharp ? "const" : "static final", final_state); @@ -941,12 +997,12 @@ output_debug() symnam[i] = 0; for (i = ntokens - 1; i >= 2; --i) symnam[symbol_value[i]] = symbol_name[i]; - symnam[0] = "end-of-file"; + symnam[0] = (char*)"end-of-file"; j = 70; fputs(" ", stdout); for (i = 0; i <= max; ++i) { - if (s = symnam[i]) + if ((s = symnam[i])) { if (s[0] == '"') { @@ -1068,7 +1124,8 @@ output_debug() FREE(symnam); } -output_trailing_text() +static void +output_trailing_text (void) { register int c, last; register FILE *in; @@ -1116,8 +1173,8 @@ output_trailing_text() printf(default_line_format, ++outline + 1); } - -output_semantic_actions() +static void +output_semantic_actions (void) { register int c, last; @@ -1150,8 +1207,8 @@ output_semantic_actions() printf(default_line_format, ++outline + 1); } - -free_itemsets() +static void +free_itemsets (void) { register core *cp, *next; @@ -1163,8 +1220,8 @@ free_itemsets() } } - -free_shifts() +static void +free_shifts (void) { register shifts *sp, *next; @@ -1176,9 +1233,8 @@ free_shifts() } } - - -free_reductions() +static void +free_reductions (void) { register reductions *rp, *next; diff --git a/mcs/jay/reader.c b/mcs/jay/reader.c index 9d8fdcb4f2..96bcac4634 100644 --- a/mcs/jay/reader.c +++ b/mcs/jay/reader.c @@ -52,52 +52,71 @@ static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91"; #define LINESIZE 100 +static char *cache; +static int cinc, cache_size; +static int ntags, tagmax; +static char **tag_table; +static char saw_eof; char *cptr, *line; +static int linesize; +static bucket *goal; +static int prec; +static int gensym; +static char last_was_action; +static int maxitems; +static bucket **pitem; +static int maxrules; +static bucket **plhs; +static int maxmethods; +static int name_pool_size; +static char *name_pool; -char *line_format = "\t\t\t\t\t// line %d \"%s\"\n"; -char *default_line_format = "\t\t\t\t\t// line %d\n"; +const char *line_format = "\t\t\t\t\t// line %d \"%s\"\n"; +const char *default_line_format = "\t\t\t\t\t// line %d\n"; +static void +start_rule (bucket *bp, int s_lineno); -cachec(c) -int c; +static void +cachec (int c) { assert(cinc >= 0); if (cinc >= cache_size) { cache_size += 256; - cache = REALLOC(cache, cache_size); + cache = (char*)REALLOC(cache, cache_size); if (cache == 0) no_space(); } cache[cinc] = c; ++cinc; } - -get_line() +static void +get_line (void) { register FILE *f = input_file; register int c; @@ -115,7 +134,7 @@ get_line() { if (line) FREE(line); linesize = LINESIZE + 1; - line = MALLOC(linesize); + line = (char*)MALLOC(linesize); if (line == 0) no_space(); } @@ -128,7 +147,7 @@ get_line() if (++i >= linesize) { linesize += LINESIZE; - line = REALLOC(line, linesize); + line = (char*)REALLOC(line, linesize); if (line == 0) no_space(); } c = getc(f); @@ -142,16 +161,15 @@ get_line() } } - -char * -dup_line() +static char * +dup_line (void) { register char *p, *s, *t; if (line == 0) return (0); s = line; while (*s != '\n') ++s; - p = MALLOC(s - line + 1); + p = (char*)MALLOC(s - line + 1); if (p == 0) no_space(); s = line; @@ -160,8 +178,8 @@ dup_line() return (p); } - -skip_comment() +static void +skip_comment (void) { register char *s; @@ -190,9 +208,8 @@ skip_comment() } } - -int -nextc() +static int +nextc (void) { register char *s; @@ -252,9 +269,8 @@ nextc() } } - -int -keyword() +static int +keyword (void) { register int c; char *t_cptr = cptr; @@ -311,9 +327,8 @@ keyword() /*NOTREACHED*/ } - -copy_text(f) -FILE *f; +static void +copy_text (FILE *f) { register int c; int quote; @@ -434,9 +449,8 @@ loop: } } -int -hexval(c) -int c; +static int +hexval (int c) { if (c >= '0' && c <= '9') return (c - '0'); @@ -447,9 +461,8 @@ int c; return (-1); } - -bucket * -get_literal() +static bucket * +get_literal (void) { register int c, quote; register int i; @@ -528,7 +541,7 @@ get_literal() FREE(s_line); n = cinc; - s = MALLOC(n); + s = (char*)MALLOC(n); if (s == 0) no_space(); for (i = 0; i < n; ++i) @@ -586,12 +599,10 @@ get_literal() return (bp); } - -int -is_reserved(name) -char *name; +static int +is_reserved (const char *name) { - char *s; + const char *s; if (strcmp(name, ".") == 0 || strcmp(name, "$accept") == 0 || @@ -608,9 +619,8 @@ char *name; return (0); } - -bucket * -get_name() +static bucket * +get_name (void) { register int c; @@ -624,9 +634,8 @@ get_name() return (lookup(cache)); } - -int -get_number() +static int +get_number (void) { register int c; register int n; @@ -638,9 +647,8 @@ get_number() return (n); } - -char * -get_tag(int emptyOk) +static char * +get_tag (int emptyOk) { register int c; register int i; @@ -683,7 +691,7 @@ get_tag(int emptyOk) if (tag_table == 0) no_space(); } - s = MALLOC(cinc); + s = (char*)MALLOC(cinc); if (s == 0) no_space(); strcpy(s, cache); tag_table[ntags] = s; @@ -692,9 +700,8 @@ get_tag(int emptyOk) return (s); } - -declare_tokens(assoc) -int assoc; +static void +declare_tokens (int assoc) { register int c; register bucket *bp; @@ -754,8 +761,8 @@ int assoc; } } - -declare_types() +static void +declare_types (void) { register int c; register bucket *bp; @@ -782,8 +789,8 @@ declare_types() } } - -declare_start() +static void +declare_start (void) { register int c; register bucket *bp; @@ -800,13 +807,13 @@ declare_start() goal = bp; } - -read_declarations() +static void +read_declarations (void) { register int c, k; cache_size = 256; - cache = MALLOC(cache_size); + cache = (char*)MALLOC(cache_size); if (cache == 0) no_space(); for (;;) @@ -841,8 +848,8 @@ read_declarations() } } - -initialize_grammar() +static void +initialize_grammar (void) { nitems = 4; maxitems = 300; @@ -873,8 +880,8 @@ initialize_grammar() rassoc[2] = TOKEN; } - -expand_items() +static void +expand_items (void) { maxitems += 300; pitem = (bucket **) REALLOC(pitem, maxitems*sizeof(bucket *)); @@ -882,8 +889,8 @@ expand_items() memset(pitem+maxitems-300, 0, 300*sizeof(bucket *)); } - -expand_rules() +static void +expand_rules (void) { maxrules += 100; plhs = (bucket **) REALLOC(plhs, maxrules*sizeof(bucket *)); @@ -894,8 +901,8 @@ expand_rules() if (rassoc == 0) no_space(); } - -advance_to_start() +static void +advance_to_start (void) { register int c; register bucket *bp; @@ -944,10 +951,8 @@ advance_to_start() ++cptr; } - -start_rule(bp, s_lineno) -register bucket *bp; -int s_lineno; +static void +start_rule (bucket *bp, int s_lineno) { if (bp->class == TERM) terminal_lhs(s_lineno); @@ -959,8 +964,8 @@ int s_lineno; rassoc[nrules] = TOKEN; } - -end_rule() +static void +end_rule (void) { register int i; @@ -979,8 +984,8 @@ end_rule() ++nrules; } - -insert_empty_rule() +static void +insert_empty_rule (void) { register bucket *bp, **bpp; @@ -996,7 +1001,7 @@ insert_empty_rule() expand_items(); bpp = pitem + nitems - 1; *bpp-- = bp; - while (bpp[0] = bpp[-1]) --bpp; + while ((bpp[0] = bpp[-1])) --bpp; if (++nrules >= maxrules) expand_rules(); @@ -1008,8 +1013,8 @@ insert_empty_rule() rassoc[nrules-1] = TOKEN; } - -add_symbol() +static void +add_symbol (void) { register int c; register bucket *bp; @@ -1039,8 +1044,8 @@ add_symbol() pitem[nitems-1] = bp; } - -copy_action() +static void +copy_action (void) { register int c; register int i, n; @@ -1303,7 +1308,7 @@ loop: else if (nmethods == maxmethods) { maxmethods += 500; - methods = REALLOC (methods, maxmethods*sizeof(char *)); + methods = (char**)REALLOC (methods, maxmethods*sizeof(char *)); } line_define = NEW2(snprintf(NULL, 0, line_format, a_lineno, input_file_name)+1, char); @@ -1329,12 +1334,11 @@ loop: fprintf(f, "\n break;\n"); } - -int -mark_symbol() +static int +mark_symbol (void) { register int c; - register bucket *bp; + register bucket *bp = NULL; c = cptr[1]; if (c == '%' || c == '\\') @@ -1373,8 +1377,8 @@ mark_symbol() return (0); } - -read_grammar() +static void +read_grammar (void) { register int c; @@ -1406,8 +1410,8 @@ read_grammar() end_rule(); } - -free_tags() +static void +free_tags (void) { register int i; @@ -1421,8 +1425,8 @@ free_tags() FREE(tag_table); } - -pack_names() +static void +pack_names (void) { register bucket *bp; register char *p, *s, *t; @@ -1430,7 +1434,7 @@ pack_names() name_pool_size = 13; /* 13 == sizeof("$end") + sizeof("$accept") */ for (bp = first_symbol; bp; bp = bp->next) name_pool_size += strlen(bp->name) + 1; - name_pool = MALLOC(name_pool_size); + name_pool = (char*)MALLOC(name_pool_size); if (name_pool == 0) no_space(); strcpy(name_pool, "$accept"); @@ -1440,14 +1444,14 @@ pack_names() { p = t; s = bp->name; - while (*t++ = *s++) continue; + while ((*t++ = *s++)) continue; FREE(bp->name); bp->name = p; } } - -check_symbols() +static void +check_symbols (void) { register bucket *bp; @@ -1464,8 +1468,8 @@ check_symbols() } } - -pack_symbols() +static void +pack_symbols (void) { register bucket *bp; register bucket **v; @@ -1487,7 +1491,7 @@ pack_symbols() if (symbol_value == 0) no_space(); symbol_prec = (short *) MALLOC(nsyms*sizeof(short)); if (symbol_prec == 0) no_space(); - symbol_assoc = MALLOC(nsyms); + symbol_assoc = (char*)MALLOC(nsyms); if (symbol_assoc == 0) no_space(); v = (bucket **) MALLOC(nsyms*sizeof(bucket *)); @@ -1588,8 +1592,8 @@ pack_symbols() FREE(v); } - -pack_grammar() +static void +pack_grammar (void) { register int i, j; int assoc, prec; @@ -1602,7 +1606,7 @@ pack_grammar() if (rrhs == 0) no_space(); rprec = (short *) REALLOC(rprec, nrules*sizeof(short)); if (rprec == 0) no_space(); - rassoc = REALLOC(rassoc, nrules); + rassoc = (char*)REALLOC(rassoc, nrules); if (rassoc == 0) no_space(); ritem[0] = -1; @@ -1647,8 +1651,8 @@ pack_grammar() FREE(pitem); } - -print_grammar() +static void +print_grammar (void) { register int i, j, k; int spacing; @@ -1683,8 +1687,8 @@ print_grammar() } } - -reader() +void +reader (void) { create_symbol_table(); read_declarations(); diff --git a/mcs/jay/symtab.c b/mcs/jay/symtab.c index 0c5f55c535..aa14654f53 100644 --- a/mcs/jay/symtab.c +++ b/mcs/jay/symtab.c @@ -50,27 +50,23 @@ bucket **symbol_table; bucket *first_symbol; bucket *last_symbol; - -int -hash(name) -char *name; +static int +hash (const char *name) { - register char *s; + const char *s; register int c, k; assert(name && *name); s = name; k = *s; - while (c = *++s) + while ((c = *++s)) k = (31*k + c) & (TABLE_SIZE - 1); return (k); } - bucket * -make_bucket(name) -char *name; +make_bucket (const char *name) { register bucket *bp; @@ -79,7 +75,7 @@ char *name; if (bp == 0) no_space(); bp->link = 0; bp->next = 0; - bp->name = MALLOC(strlen(name) + 1); + bp->name = (char*)MALLOC(strlen(name) + 1); if (bp->name == 0) no_space(); bp->tag = 0; bp->value = UNDEFINED; @@ -94,10 +90,8 @@ char *name; return (bp); } - bucket * -lookup(name) -char *name; +lookup (const char *name) { register bucket *bp, **bpp; @@ -118,8 +112,8 @@ char *name; return (bp); } - -create_symbol_table() +void +create_symbol_table (void) { register int i; register bucket *bp; @@ -138,15 +132,15 @@ create_symbol_table() symbol_table[hash("error")] = bp; } - -free_symbol_table() +void +free_symbol_table (void) { FREE(symbol_table); symbol_table = 0; } - -free_symbols() +void +free_symbols (void) { register bucket *p, *q; diff --git a/mcs/jay/verbose.c b/mcs/jay/verbose.c index 33ae265ee2..36cc036c68 100644 --- a/mcs/jay/verbose.c +++ b/mcs/jay/verbose.c @@ -42,7 +42,38 @@ static char sccsid[] = "@(#)verbose.c 5.3 (Berkeley) 1/20/91"; static short *null_rules; -verbose() +static void +print_gotos (int stateno); + +static void +print_shifts (action *p); + +static void +print_reductions (action *p, int defred); + +static void +print_core (int state); + +static void +print_actions (int stateno); + +static void +print_nulls (int state); + +static void +log_unused (void); + +static void +print_conflicts (int state); + +static void +print_state (int state); + +static void +log_conflicts (void); + +void +verbose (void) { register int i; @@ -65,8 +96,8 @@ verbose() fprintf(verbose_file, "%d grammar rules, %d states\n", nrules - 2, nstates); } - -log_unused() +static void +log_unused (void) { register int i; register short *p; @@ -84,8 +115,8 @@ log_unused() } } - -log_conflicts() +static void +log_conflicts (void) { register int i; @@ -112,9 +143,8 @@ log_conflicts() } } - -print_state(state) -int state; +static void +print_state (int state) { if (state) fprintf(verbose_file, "\n\n"); @@ -126,9 +156,8 @@ int state; print_actions(state); } - -print_conflicts(state) -int state; +static void +print_conflicts (int state) { register int symbol, act, number; register action *p; @@ -174,9 +203,8 @@ int state; } } - -print_core(state) -int state; +static void +print_core (int state) { register int i; register int k; @@ -210,9 +238,8 @@ int state; } } - -print_nulls(state) -int state; +static void +print_nulls (int state) { register action *p; register int i, j, k, nnulls; @@ -254,9 +281,8 @@ int state; fprintf(verbose_file, "\n"); } - -print_actions(stateno) -int stateno; +static void +print_actions (int stateno) { register action *p; register shifts *sp; @@ -281,9 +307,8 @@ int stateno; } } - -print_shifts(p) -register action *p; +static void +print_shifts (action *p) { register int count; register action *q; @@ -306,10 +331,8 @@ register action *p; } } - -print_reductions(p, defred) -register action *p; -register int defred; +static void +print_reductions (action *p, int defred) { register int k, anyreds; register action *q; @@ -344,9 +367,8 @@ register int defred; } } - -print_gotos(stateno) -int stateno; +static void +print_gotos (int stateno) { register int i, k; register int as; diff --git a/mcs/jay/warshall.c b/mcs/jay/warshall.c index 4672244e36..8c7ab16718 100644 --- a/mcs/jay/warshall.c +++ b/mcs/jay/warshall.c @@ -40,9 +40,8 @@ static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) 5/24/93"; #include "defs.h" -transitive_closure(R, n) -unsigned *R; -int n; +static void +transitive_closure (unsigned *R, int n) { register int rowsize; register unsigned i; @@ -92,9 +91,8 @@ int n; } } -reflexive_transitive_closure(R, n) -unsigned *R; -int n; +void +reflexive_transitive_closure (unsigned *R, int n) { register int rowsize; register unsigned i; diff --git a/mcs/mcs/convert.cs b/mcs/mcs/convert.cs index ae153fc49e..2c8d2a0204 100644 --- a/mcs/mcs/convert.cs +++ b/mcs/mcs/convert.cs @@ -1232,6 +1232,13 @@ namespace Mono.CSharp { FindApplicableUserDefinedConversionOperators (rc, operators, source_type_expr, target_type, restr, ref candidates); } + if (source_type_expr == source && source_type.IsNullableType) { + operators = MemberCache.GetUserOperator (source_type.TypeArguments [0], Operator.OpType.Implicit, declared_only); + if (operators != null) { + FindApplicableUserDefinedConversionOperators (rc, operators, source_type_expr, target_type, restr, ref candidates); + } + } + if (!implicitOnly) { operators = MemberCache.GetUserOperator (source_type, Operator.OpType.Explicit, declared_only); if (operators != null) { diff --git a/mcs/mcs/cs-parser.jay.REMOVED.git-id b/mcs/mcs/cs-parser.jay.REMOVED.git-id index bf180782e1..25ad128cf9 100644 --- a/mcs/mcs/cs-parser.jay.REMOVED.git-id +++ b/mcs/mcs/cs-parser.jay.REMOVED.git-id @@ -1 +1 @@ -4d6fcb44c0d9390b15f0449683dd69fb56c10390 \ No newline at end of file +7e78d41043314048b54c7e8ec54e14a9bc2944f0 \ No newline at end of file diff --git a/mcs/mcs/cs-tokenizer.cs b/mcs/mcs/cs-tokenizer.cs deleted file mode 100644 index 37edb5c122..0000000000 --- a/mcs/mcs/cs-tokenizer.cs +++ /dev/null @@ -1,4276 +0,0 @@ -// -// cs-tokenizer.cs: The Tokenizer for the C# compiler -// This also implements the preprocessor -// -// Author: Miguel de Icaza (miguel@gnu.org) -// Marek Safar (marek.safar@gmail.com) -// -// Dual licensed under the terms of the MIT X11 or GNU GPL -// -// Copyright 2001, 2002 Ximian, Inc (http://www.ximian.com) -// Copyright 2004-2008 Novell, Inc -// Copyright 2011 Xamarin, Inc (http://www.xamarin.com) -// - -using System; -using System.Text; -using System.Collections.Generic; -using System.Globalization; -using System.Diagnostics; -using System.Collections; - -namespace Mono.CSharp -{ - // - // This class has to be used by parser only, it reuses token - // details once a file is parsed - // - public class LocatedToken - { - public int row, column; - public string value; - public SourceFile file; - - public LocatedToken () - { - } - - public LocatedToken (string value, Location loc) - { - this.value = value; - file = loc.SourceFile; - row = loc.Row; - column = loc.Column; - } - - public override string ToString () - { - return string.Format ("Token '{0}' at {1},{2}", Value, row, column); - } - - public Location Location - { - get { return new Location (file, row, column); } - } - - public string Value - { - get { return value; } - } - } - - /// - /// Tokenizer for C# source code. - /// - public class Tokenizer : yyParser.yyInput - { - class KeywordEntry - { - public readonly T Token; - public KeywordEntry Next; - public readonly char[] Value; - - public KeywordEntry (string value, T token) - { - this.Value = value.ToCharArray (); - this.Token = token; - } - } - - sealed class IdentifiersComparer : IEqualityComparer - { - readonly int length; - - public IdentifiersComparer (int length) - { - this.length = length; - } - - public bool Equals (char[] x, char[] y) - { - for (int i = 0; i < length; ++i) - if (x [i] != y [i]) - return false; - - return true; - } - - public int GetHashCode (char[] obj) - { - int h = 0; - for (int i = 0; i < length; ++i) - h = (h << 5) - h + obj [i]; - - return h; - } - } - - public class LocatedTokenBuffer - { - readonly LocatedToken[] buffer; - public int pos; - - public LocatedTokenBuffer () - { - buffer = new LocatedToken[0]; - } - - public LocatedTokenBuffer (LocatedToken[] buffer) - { - this.buffer = buffer ?? new LocatedToken[0]; - } - - public LocatedToken Create (SourceFile file, int row, int column) - { - return Create (null, file, row, column); - } - - public LocatedToken Create (string value, SourceFile file, int row, int column) - { - // - // TODO: I am not very happy about the logic but it's the best - // what I could come up with for now. - // Ideally we should be using just tiny buffer (256 elements) which - // is enough to hold all details for currect stack and recycle elements - // poped from the stack but there is a trick needed to recycle - // them properly. - // - LocatedToken entry; - if (pos >= buffer.Length) { - entry = new LocatedToken (); - } else { - entry = buffer[pos]; - if (entry == null) { - entry = new LocatedToken (); - buffer[pos] = entry; - } - - ++pos; - } - entry.value = value; - entry.file = file; - entry.row = row; - entry.column = column; - return entry; - } - - // - // Used for token not required by expression evaluator - // - [Conditional ("FULL_AST")] - public void CreateOptional (SourceFile file, int row, int col, ref object token) - { - token = Create (file, row, col); - } - } - - public enum PreprocessorDirective - { - Invalid = 0, - - Region = 1, - Endregion = 2, - If = 3 | RequiresArgument, - Endif = 4, - Elif = 5 | RequiresArgument, - Else = 6, - Define = 7 | RequiresArgument, - Undef = 8 | RequiresArgument, - Error = 9, - Warning = 10, - Pragma = 11 | CustomArgumentsParsing, - Line = 12 | CustomArgumentsParsing, - - CustomArgumentsParsing = 1 << 10, - RequiresArgument = 1 << 11 - } - - readonly SeekableStreamReader reader; - readonly CompilationSourceFile source_file; - readonly CompilerContext context; - readonly Report Report; - - - SourceFile current_source; - Location hidden_block_start; - int ref_line = 1; - int line = 1; - int col = 0; - int previous_col; - int current_token; - readonly int tab_size; - bool handle_get_set = false; - bool handle_remove_add = false; - bool handle_where; - bool lambda_arguments_parsing; - List escaped_identifiers; - int parsing_generic_less_than; - readonly bool doc_processing; - readonly LocatedTokenBuffer ltb; - - // - // Used mainly for parser optimizations. Some expressions for instance - // can appear only in block (including initializer, base initializer) - // scope only - // - public int parsing_block; - internal bool query_parsing; - - // - // When parsing type only, useful for ambiguous nullable types - // - public int parsing_type; - - // - // Set when parsing generic declaration (type or method header) - // - public bool parsing_generic_declaration; - public bool parsing_generic_declaration_doc; - - // - // The value indicates that we have not reach any declaration or - // namespace yet - // - public int parsing_declaration; - - public bool parsing_attribute_section; - - public bool parsing_modifiers; - - public bool parsing_catch_when; - - int parsing_string_interpolation; - int string_interpolation_section; - Stack parsing_string_interpolation_quoted; - - public bool parsing_interpolation_format; - - // - // The special characters to inject on streams to run the unit parser - // in the special expression mode. Using private characters from - // Plane Sixteen (U+100000 to U+10FFFD) - // - // This character is only tested just before the tokenizer is about to report - // an error; So on the regular operation mode, this addition will have no - // impact on the tokenizer's performance. - // - - public const int EvalStatementParserCharacter = 0x100000; - public const int EvalCompilationUnitParserCharacter = 0x100001; - public const int EvalUsingDeclarationsParserCharacter = 0x100002; - public const int DocumentationXref = 0x100003; - - const int UnicodeLS = 0x2028; - const int UnicodePS = 0x2029; - - // - // XML documentation buffer. The save point is used to divide - // comments on types and comments on members. - // - StringBuilder xml_comment_buffer; - - // - // See comment on XmlCommentState enumeration. - // - XmlCommentState xml_doc_state = XmlCommentState.Allowed; - - // - // Whether tokens have been seen on this line - // - bool tokens_seen = false; - - // - // Set to true once the GENERATE_COMPLETION token has bee - // returned. This helps produce one GENERATE_COMPLETION, - // as many COMPLETE_COMPLETION as necessary to complete the - // AST tree and one final EOF. - // - bool generated; - - // - // Whether a token has been seen on the file - // This is needed because `define' is not allowed to be used - // after a token has been seen. - // - bool any_token_seen; - - // - // Class variables - // - static readonly KeywordEntry[][] keywords; - static readonly KeywordEntry[][] keywords_preprocessor; - static readonly HashSet keyword_strings; - static readonly NumberStyles styles; - static readonly NumberFormatInfo csharp_format_info; - - // Pragma arguments - static readonly char[] pragma_warning = "warning".ToCharArray (); - static readonly char[] pragma_warning_disable = "disable".ToCharArray (); - static readonly char[] pragma_warning_restore = "restore".ToCharArray (); - static readonly char[] pragma_checksum = "checksum".ToCharArray (); - static readonly char[] line_hidden = "hidden".ToCharArray (); - static readonly char[] line_default = "default".ToCharArray (); - - static readonly char[] simple_whitespaces = new char[] { ' ', '\t' }; - - public bool PropertyParsing { - get { return handle_get_set; } - set { handle_get_set = value; } - } - - public bool EventParsing { - get { return handle_remove_add; } - set { handle_remove_add = value; } - } - - public bool ConstraintsParsing { - get { return handle_where; } - set { handle_where = value; } - } - - public XmlCommentState doc_state { - get { return xml_doc_state; } - set { - if (value == XmlCommentState.Allowed) { - check_incorrect_doc_comment (); - reset_doc_comment (); - } - xml_doc_state = value; - } - } - - // - // This is used to trigger completion generation on the parser - public bool CompleteOnEOF; - - void AddEscapedIdentifier (Location loc) - { - if (escaped_identifiers == null) - escaped_identifiers = new List (); - - escaped_identifiers.Add (loc); - } - - public bool IsEscapedIdentifier (ATypeNameExpression name) - { - return escaped_identifiers != null && escaped_identifiers.Contains (name.Location); - } - - // - // Values for the associated token returned - // - internal int putback_char; // Used by repl only - object val; - - // - // Pre-processor - // - const int TAKING = 1; - const int ELSE_SEEN = 4; - const int PARENT_TAKING = 8; - const int REGION = 16; - - // - // pre-processor if stack state: - // - Stack ifstack; - - public const int MaxIdentifierLength = 512; - public const int MaxNumberLength = 512; - - readonly char[] id_builder; - readonly Dictionary[] identifiers; - readonly char[] number_builder; - int number_pos; - - char[] value_builder = new char[64]; - - public int Line { - get { - return ref_line; - } - } - - // - // This is used when the tokenizer needs to save - // the current position as it needs to do some parsing - // on its own to deamiguate a token in behalf of the - // parser. - // - Stack position_stack = new Stack (2); - - class Position { - public int position; - public int line; - public int ref_line; - public int col; - public Location hidden; - public int putback_char; - public int previous_col; - public Stack ifstack; - public int parsing_generic_less_than; - public int current_token; - public object val; - public int parsing_string_interpolation; - public int string_interpolation_section; - public Stack parsing_string_interpolation_quoted; - - public Position (Tokenizer t) - { - position = t.reader.Position; - line = t.line; - ref_line = t.ref_line; - col = t.col; - hidden = t.hidden_block_start; - putback_char = t.putback_char; - previous_col = t.previous_col; - if (t.ifstack != null && t.ifstack.Count != 0) { - // There is no simple way to clone Stack all - // methods reverse the order - var clone = t.ifstack.ToArray (); - Array.Reverse (clone); - ifstack = new Stack (clone); - } - parsing_generic_less_than = t.parsing_generic_less_than; - string_interpolation_section = t.string_interpolation_section; - current_token = t.current_token; - val = t.val; - parsing_string_interpolation = t.parsing_string_interpolation; - string_interpolation_section = t.string_interpolation_section; - if (t.parsing_string_interpolation_quoted != null && t.parsing_string_interpolation_quoted.Count != 0) { - var clone = t.parsing_string_interpolation_quoted.ToArray (); - Array.Reverse (clone); - parsing_string_interpolation_quoted = new Stack (clone); - } - } - } - - public Tokenizer (SeekableStreamReader input, CompilationSourceFile file, ParserSession session, Report report) - { - this.source_file = file; - this.context = file.Compiler; - this.current_source = file.SourceFile; - this.identifiers = session.Identifiers; - this.id_builder = session.IDBuilder; - this.number_builder = session.NumberBuilder; - this.ltb = new LocatedTokenBuffer (session.LocatedTokens); - this.Report = report; - - reader = input; - - putback_char = -1; - - xml_comment_buffer = new StringBuilder (); - doc_processing = context.Settings.DocumentationFile != null; - - tab_size = context.Settings.TabSize; - } - - public void PushPosition () - { - position_stack.Push (new Position (this)); - } - - public void PopPosition () - { - Position p = position_stack.Pop (); - - reader.Position = p.position; - ref_line = p.ref_line; - line = p.line; - col = p.col; - hidden_block_start = p.hidden; - putback_char = p.putback_char; - previous_col = p.previous_col; - ifstack = p.ifstack; - parsing_generic_less_than = p.parsing_generic_less_than; - parsing_string_interpolation = p.parsing_string_interpolation; - parsing_string_interpolation_quoted = p.parsing_string_interpolation_quoted; - current_token = p.current_token; - val = p.val; - } - - // Do not reset the position, ignore it. - public void DiscardPosition () - { - position_stack.Pop (); - } - - static void AddKeyword (string kw, int token) - { - keyword_strings.Add (kw); - - AddKeyword (keywords, kw, token); - } - - static void AddPreprocessorKeyword (string kw, PreprocessorDirective directive) - { - AddKeyword (keywords_preprocessor, kw, directive); - } - - static void AddKeyword (KeywordEntry[][] keywords, string kw, T token) - { - int length = kw.Length; - if (keywords[length] == null) { - keywords[length] = new KeywordEntry['z' - '_' + 1]; - } - - int char_index = kw[0] - '_'; - var kwe = keywords[length][char_index]; - if (kwe == null) { - keywords[length][char_index] = new KeywordEntry (kw, token); - return; - } - - while (kwe.Next != null) { - kwe = kwe.Next; - } - - kwe.Next = new KeywordEntry (kw, token); - } - - // - // Class initializer - // - static Tokenizer () - { - keyword_strings = new HashSet (); - - // 11 is the length of the longest keyword for now - keywords = new KeywordEntry[11][]; - - AddKeyword ("__arglist", Token.ARGLIST); - AddKeyword ("__makeref", Token.MAKEREF); - AddKeyword ("__reftype", Token.REFTYPE); - AddKeyword ("__refvalue", Token.REFVALUE); - AddKeyword ("abstract", Token.ABSTRACT); - AddKeyword ("as", Token.AS); - AddKeyword ("add", Token.ADD); - AddKeyword ("base", Token.BASE); - AddKeyword ("bool", Token.BOOL); - AddKeyword ("break", Token.BREAK); - AddKeyword ("byte", Token.BYTE); - AddKeyword ("case", Token.CASE); - AddKeyword ("catch", Token.CATCH); - AddKeyword ("char", Token.CHAR); - AddKeyword ("checked", Token.CHECKED); - AddKeyword ("class", Token.CLASS); - AddKeyword ("const", Token.CONST); - AddKeyword ("continue", Token.CONTINUE); - AddKeyword ("decimal", Token.DECIMAL); - AddKeyword ("default", Token.DEFAULT); - AddKeyword ("delegate", Token.DELEGATE); - AddKeyword ("do", Token.DO); - AddKeyword ("double", Token.DOUBLE); - AddKeyword ("else", Token.ELSE); - AddKeyword ("enum", Token.ENUM); - AddKeyword ("event", Token.EVENT); - AddKeyword ("explicit", Token.EXPLICIT); - AddKeyword ("extern", Token.EXTERN); - AddKeyword ("false", Token.FALSE); - AddKeyword ("finally", Token.FINALLY); - AddKeyword ("fixed", Token.FIXED); - AddKeyword ("float", Token.FLOAT); - AddKeyword ("for", Token.FOR); - AddKeyword ("foreach", Token.FOREACH); - AddKeyword ("goto", Token.GOTO); - AddKeyword ("get", Token.GET); - AddKeyword ("if", Token.IF); - AddKeyword ("implicit", Token.IMPLICIT); - AddKeyword ("in", Token.IN); - AddKeyword ("int", Token.INT); - AddKeyword ("interface", Token.INTERFACE); - AddKeyword ("internal", Token.INTERNAL); - AddKeyword ("is", Token.IS); - AddKeyword ("lock", Token.LOCK); - AddKeyword ("long", Token.LONG); - AddKeyword ("namespace", Token.NAMESPACE); - AddKeyword ("new", Token.NEW); - AddKeyword ("null", Token.NULL); - AddKeyword ("object", Token.OBJECT); - AddKeyword ("operator", Token.OPERATOR); - AddKeyword ("out", Token.OUT); - AddKeyword ("override", Token.OVERRIDE); - AddKeyword ("params", Token.PARAMS); - AddKeyword ("private", Token.PRIVATE); - AddKeyword ("protected", Token.PROTECTED); - AddKeyword ("public", Token.PUBLIC); - AddKeyword ("readonly", Token.READONLY); - AddKeyword ("ref", Token.REF); - AddKeyword ("remove", Token.REMOVE); - AddKeyword ("return", Token.RETURN); - AddKeyword ("sbyte", Token.SBYTE); - AddKeyword ("sealed", Token.SEALED); - AddKeyword ("set", Token.SET); - AddKeyword ("short", Token.SHORT); - AddKeyword ("sizeof", Token.SIZEOF); - AddKeyword ("stackalloc", Token.STACKALLOC); - AddKeyword ("static", Token.STATIC); - AddKeyword ("string", Token.STRING); - AddKeyword ("struct", Token.STRUCT); - AddKeyword ("switch", Token.SWITCH); - AddKeyword ("this", Token.THIS); - AddKeyword ("throw", Token.THROW); - AddKeyword ("true", Token.TRUE); - AddKeyword ("try", Token.TRY); - AddKeyword ("typeof", Token.TYPEOF); - AddKeyword ("uint", Token.UINT); - AddKeyword ("ulong", Token.ULONG); - AddKeyword ("unchecked", Token.UNCHECKED); - AddKeyword ("unsafe", Token.UNSAFE); - AddKeyword ("ushort", Token.USHORT); - AddKeyword ("using", Token.USING); - AddKeyword ("virtual", Token.VIRTUAL); - AddKeyword ("void", Token.VOID); - AddKeyword ("volatile", Token.VOLATILE); - AddKeyword ("while", Token.WHILE); - AddKeyword ("partial", Token.PARTIAL); - AddKeyword ("where", Token.WHERE); - - // LINQ keywords - AddKeyword ("from", Token.FROM); - AddKeyword ("join", Token.JOIN); - AddKeyword ("on", Token.ON); - AddKeyword ("equals", Token.EQUALS); - AddKeyword ("select", Token.SELECT); - AddKeyword ("group", Token.GROUP); - AddKeyword ("by", Token.BY); - AddKeyword ("let", Token.LET); - AddKeyword ("orderby", Token.ORDERBY); - AddKeyword ("ascending", Token.ASCENDING); - AddKeyword ("descending", Token.DESCENDING); - AddKeyword ("into", Token.INTO); - - // Contextual async keywords - AddKeyword ("async", Token.ASYNC); - AddKeyword ("await", Token.AWAIT); - - // Contextual filter catch keyword - AddKeyword ("when", Token.WHEN); - - keywords_preprocessor = new KeywordEntry[10][]; - - AddPreprocessorKeyword ("region", PreprocessorDirective.Region); - AddPreprocessorKeyword ("endregion", PreprocessorDirective.Endregion); - AddPreprocessorKeyword ("if", PreprocessorDirective.If); - AddPreprocessorKeyword ("endif", PreprocessorDirective.Endif); - AddPreprocessorKeyword ("elif", PreprocessorDirective.Elif); - AddPreprocessorKeyword ("else", PreprocessorDirective.Else); - AddPreprocessorKeyword ("define", PreprocessorDirective.Define); - AddPreprocessorKeyword ("undef", PreprocessorDirective.Undef); - AddPreprocessorKeyword ("error", PreprocessorDirective.Error); - AddPreprocessorKeyword ("warning", PreprocessorDirective.Warning); - AddPreprocessorKeyword ("pragma", PreprocessorDirective.Pragma); - AddPreprocessorKeyword ("line", PreprocessorDirective.Line); - - csharp_format_info = NumberFormatInfo.InvariantInfo; - styles = NumberStyles.Float; - } - - int GetKeyword (char[] id, int id_len) - { - // - // Keywords are stored in an array of arrays grouped by their - // length and then by the first character - // - if (id_len >= keywords.Length || keywords [id_len] == null) - return -1; - - int first_index = id [0] - '_'; - if (first_index > 'z' - '_') - return -1; - - var kwe = keywords [id_len] [first_index]; - if (kwe == null) - return -1; - - int res; - do { - res = kwe.Token; - for (int i = 1; i < id_len; ++i) { - if (id [i] != kwe.Value [i]) { - res = 0; - kwe = kwe.Next; - break; - } - } - } while (res == 0 && kwe != null); - - if (res == 0) - return -1; - - int next_token; - switch (res) { - case Token.GET: - case Token.SET: - if (!handle_get_set) - res = -1; - break; - case Token.REMOVE: - case Token.ADD: - if (!handle_remove_add) - res = -1; - break; - case Token.EXTERN: - if (parsing_declaration == 0) - res = Token.EXTERN_ALIAS; - break; - case Token.DEFAULT: - switch (peek_token ()) { - case Token.COLON: - // Special case: foo == null ? default : 1; - if (current_token != Token.INTERR) { - token (); - res = Token.DEFAULT_COLON; - } - break; - case Token.OPEN_PARENS: - case Token.OPEN_PARENS_CAST: - res = Token.DEFAULT_VALUE; - break; - } - break; - case Token.WHEN: - if (current_token != Token.CATCH && !parsing_catch_when) - res = -1; - break; - case Token.WHERE: - if (!(handle_where && current_token != Token.COLON) && !query_parsing) - res = -1; - break; - case Token.FROM: - // - // A query expression is any expression that starts with `from identifier' - // followed by any token except ; , = - // - if (!query_parsing) { - if (lambda_arguments_parsing || parsing_block == 0) { - res = -1; - break; - } - - PushPosition (); - // HACK: to disable generics micro-parser, because PushPosition does not - // store identifiers array - parsing_generic_less_than = 1; - switch (xtoken ()) { - case Token.IDENTIFIER: - case Token.INT: - case Token.BOOL: - case Token.BYTE: - case Token.CHAR: - case Token.DECIMAL: - case Token.DOUBLE: - case Token.FLOAT: - case Token.LONG: - case Token.OBJECT: - case Token.STRING: - case Token.UINT: - case Token.ULONG: - next_token = xtoken (); - if (next_token == Token.SEMICOLON || next_token == Token.COMMA || next_token == Token.EQUALS || next_token == Token.ASSIGN) - goto default; - - res = Token.FROM_FIRST; - query_parsing = true; - if (context.Settings.Version <= LanguageVersion.ISO_2) - Report.FeatureIsNotAvailable (context, Location, "query expressions"); - break; - case Token.VOID: - Expression.Error_VoidInvalidInTheContext (Location, Report); - break; - default: - PopPosition (); - // HACK: A token is not a keyword so we need to restore identifiers buffer - // which has been overwritten before we grabbed the identifier - id_builder [0] = 'f'; id_builder [1] = 'r'; id_builder [2] = 'o'; id_builder [3] = 'm'; - return -1; - } - PopPosition (); - } - break; - case Token.JOIN: - case Token.ON: - case Token.EQUALS: - case Token.SELECT: - case Token.GROUP: - case Token.BY: - case Token.LET: - case Token.ORDERBY: - case Token.ASCENDING: - case Token.DESCENDING: - case Token.INTO: - if (!query_parsing) - res = -1; - break; - - case Token.USING: - case Token.NAMESPACE: - // TODO: some explanation needed - check_incorrect_doc_comment (); - parsing_modifiers = false; - break; - - case Token.PARTIAL: - if (parsing_block > 0) { - res = -1; - break; - } - - // Save current position and parse next token. - PushPosition (); - - next_token = token (); - bool ok = - next_token == Token.CLASS || - next_token == Token.STRUCT || - next_token == Token.INTERFACE || - next_token == Token.VOID || - next_token == Token.REF_STRUCT; - - PopPosition (); - - if (ok) { - if (next_token == Token.VOID) { - if (context.Settings.Version <= LanguageVersion.ISO_2) - Report.FeatureIsNotAvailable (context, Location, "partial methods"); - } else if (context.Settings.Version == LanguageVersion.ISO_1) - Report.FeatureIsNotAvailable (context, Location, "partial types"); - - return res; - } - - if (next_token < Token.LAST_KEYWORD) { - Report.Error (267, Location, - "The `partial' modifier can be used only immediately before `class', `struct', `interface', or `void' keyword"); - return token (); - } - - // HACK: A token is not a keyword so we need to restore identifiers buffer - // which has been overwritten before we grabbed the identifier - id_builder[0] = 'p'; - id_builder[1] = 'a'; - id_builder[2] = 'r'; - id_builder[3] = 't'; - id_builder[4] = 'i'; - id_builder[5] = 'a'; - id_builder[6] = 'l'; - res = -1; - break; - - case Token.ASYNC: - if (parsing_modifiers) { - // - // Skip attributes section or constructor called async - // - if (parsing_attribute_section || peek_token () == Token.OPEN_PARENS) { - res = -1; - } else { - // async is keyword - } - } else if (parsing_block > 0) { - switch (peek_token ()) { - case Token.DELEGATE: - case Token.OPEN_PARENS_LAMBDA: - // async is keyword - break; - case Token.IDENTIFIER: - PushPosition (); - xtoken (); - if (xtoken () != Token.ARROW) { - PopPosition (); - goto default; - } - - PopPosition (); - break; - default: - // peek_token could overwrite id_buffer - id_builder [0] = 'a'; id_builder [1] = 's'; id_builder [2] = 'y'; id_builder [3] = 'n'; id_builder [4] = 'c'; - res = -1; - break; - } - } else { - res = -1; - } - - if (res == Token.ASYNC && context.Settings.Version <= LanguageVersion.V_4) { - Report.FeatureIsNotAvailable (context, Location, "asynchronous functions"); - } - - break; - - case Token.AWAIT: - if (parsing_block == 0) - res = -1; - - break; - case Token.THROW: - switch (current_token) { - case Token.ARROW: - case Token.OP_COALESCING: - case Token.INTERR: - res = Token.THROW_EXPR; - break; - } - - break; - case Token.REF: - if (peek_token () == Token.STRUCT) { - token (); - res = Token.REF_STRUCT; - } - break; - } - - - return res; - } - - static PreprocessorDirective GetPreprocessorDirective (char[] id, int id_len) - { - // - // Keywords are stored in an array of arrays grouped by their - // length and then by the first character - // - if (id_len >= keywords_preprocessor.Length || keywords_preprocessor[id_len] == null) - return PreprocessorDirective.Invalid; - - int first_index = id[0] - '_'; - if (first_index > 'z' - '_') - return PreprocessorDirective.Invalid; - - var kwe = keywords_preprocessor[id_len][first_index]; - if (kwe == null) - return PreprocessorDirective.Invalid; - - PreprocessorDirective res = PreprocessorDirective.Invalid; - do { - res = kwe.Token; - for (int i = 1; i < id_len; ++i) { - if (id[i] != kwe.Value[i]) { - res = 0; - kwe = kwe.Next; - break; - } - } - } while (res == PreprocessorDirective.Invalid && kwe != null); - - return res; - } - - public Location Location { - get { - return new Location (current_source, ref_line, col); - } - } - - static bool is_identifier_start_character (int c) - { - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_') - return true; - - if (c < 0x80) - return false; - - return is_identifier_start_character_slow_part ((char) c); - } - - static bool is_identifier_part_character (char c) - { - if (c >= 'a' && c <= 'z') - return true; - - if (c >= 'A' && c <= 'Z') - return true; - - if (c == '_' || (c >= '0' && c <= '9')) - return true; - - if (c < 0x80) - return false; - - return is_identifier_part_character_slow_part (c); - } - - static bool is_identifier_start_character_slow_part (char c) - { - switch (Char.GetUnicodeCategory (c)) { - case UnicodeCategory.LetterNumber: - case UnicodeCategory.UppercaseLetter: - case UnicodeCategory.LowercaseLetter: - case UnicodeCategory.TitlecaseLetter: - case UnicodeCategory.ModifierLetter: - case UnicodeCategory.OtherLetter: - return true; - } - return false; - } - - static bool is_identifier_part_character_slow_part (char c) - { - switch (Char.GetUnicodeCategory (c)) { - // connecting-character: A Unicode character of the class Pc - case UnicodeCategory.ConnectorPunctuation: - - // combining-character: A Unicode character of classes Mn or Mc - case UnicodeCategory.NonSpacingMark: - case UnicodeCategory.SpacingCombiningMark: - - // decimal-digit-character: A Unicode character of the class Nd - case UnicodeCategory.DecimalDigitNumber: - - // plus is_identifier_start_character_slow_part - case UnicodeCategory.LetterNumber: - case UnicodeCategory.UppercaseLetter: - case UnicodeCategory.LowercaseLetter: - case UnicodeCategory.TitlecaseLetter: - case UnicodeCategory.ModifierLetter: - case UnicodeCategory.OtherLetter: - return true; - - // formatting-character: A Unicode character of the class Cf - case UnicodeCategory.Format: - // csc bug compatibility which recognizes it as a whitespace - return c != 0xFEFF; - } - - return false; - } - - public static bool IsKeyword (string s) - { - return keyword_strings.Contains (s); - } - - // - // Open parens micro parser - // - int TokenizeOpenParens () - { - int ptoken; - current_token = -1; - - int bracket_level = 0; - bool is_type = false; - bool can_be_type = false; - bool at_least_one_comma = false; - - while (true) { - ptoken = current_token; - token (); - - switch (current_token) { - case Token.CLOSE_PARENS: - token (); - - // - // Expression inside parens is lambda, (int i) => - // - if (current_token == Token.ARROW) - return Token.OPEN_PARENS_LAMBDA; - - // - // Expression inside parens is deconstruct expression, (a, x.y) = ... - // - if (current_token == Token.ASSIGN && at_least_one_comma) - return Token.OPEN_PARENS_DECONSTRUCT; - - // - // Expression inside parens is single type, (int[]) - // - if (is_type) { - if (current_token == Token.SEMICOLON) - return Token.OPEN_PARENS; - - return Token.OPEN_PARENS_CAST; - } - - // - // Expression is possible cast, look at next token, (T)null - // - if (can_be_type) { - switch (current_token) { - case Token.OPEN_PARENS: - case Token.BANG: - case Token.TILDE: - case Token.IDENTIFIER: - case Token.LITERAL: - case Token.BASE: - case Token.CHECKED: - case Token.DELEGATE: - case Token.FALSE: - case Token.FIXED: - case Token.NEW: - case Token.NULL: - case Token.SIZEOF: - case Token.THIS: - case Token.THROW: - case Token.TRUE: - case Token.TYPEOF: - case Token.UNCHECKED: - case Token.UNSAFE: - case Token.DEFAULT: - case Token.DEFAULT_VALUE: - case Token.AWAIT: - - // - // These can be part of a member access - // - case Token.INT: - case Token.UINT: - case Token.SHORT: - case Token.USHORT: - case Token.LONG: - case Token.ULONG: - case Token.DOUBLE: - case Token.FLOAT: - case Token.CHAR: - case Token.BYTE: - case Token.DECIMAL: - case Token.BOOL: - case Token.STRING: - case Token.SBYTE: - return Token.OPEN_PARENS_CAST; - } - } - return Token.OPEN_PARENS; - - case Token.DOT: - case Token.DOUBLE_COLON: - if (ptoken != Token.IDENTIFIER && ptoken != Token.OP_GENERICS_GT) - goto default; - - continue; - - case Token.IDENTIFIER: - case Token.AWAIT: - switch (ptoken) { - case Token.DOT: - if (bracket_level == 0) { - is_type = false; - can_be_type = true; - } - - continue; - case Token.OP_GENERICS_LT: - case Token.COMMA: - case Token.DOUBLE_COLON: - case -1: - if (bracket_level == 0) - can_be_type = true; - continue; - default: - can_be_type = is_type = false; - continue; - } - - case Token.OBJECT: - case Token.STRING: - case Token.BOOL: - case Token.DECIMAL: - case Token.FLOAT: - case Token.DOUBLE: - case Token.SBYTE: - case Token.BYTE: - case Token.SHORT: - case Token.USHORT: - case Token.INT: - case Token.UINT: - case Token.LONG: - case Token.ULONG: - case Token.CHAR: - case Token.VOID: - if (bracket_level == 0) - is_type = true; - continue; - - case Token.COMMA: - if (bracket_level == 0) { - bracket_level = 100; - can_be_type = is_type = false; - at_least_one_comma = true; - } - continue; - - case Token.OP_GENERICS_LT: - case Token.OPEN_BRACKET: - if (bracket_level++ == 0) - is_type = true; - continue; - - case Token.OP_GENERICS_GT: - case Token.CLOSE_BRACKET: - --bracket_level; - continue; - - case Token.INTERR_NULLABLE: - case Token.STAR: - if (bracket_level == 0) - is_type = true; - continue; - - case Token.REF: - case Token.OUT: - can_be_type = is_type = false; - continue; - - default: - return Token.OPEN_PARENS; - } - } - } - - public static bool IsValidIdentifier (string s) - { - if (s == null || s.Length == 0) - return false; - - if (!is_identifier_start_character (s [0])) - return false; - - for (int i = 1; i < s.Length; i ++) - if (! is_identifier_part_character (s [i])) - return false; - - return true; - } - - bool parse_less_than (ref int genericDimension) - { - start: - int the_token = token (); - if (the_token == Token.OPEN_BRACKET) { - while (true) { - the_token = token (); - if (the_token == Token.EOF) - return true; - - if (the_token == Token.CLOSE_BRACKET) - break; - } - the_token = token (); - } else if (the_token == Token.IN || the_token == Token.OUT) { - the_token = token (); - } - switch (the_token) { - case Token.IDENTIFIER: - case Token.OBJECT: - case Token.STRING: - case Token.BOOL: - case Token.DECIMAL: - case Token.FLOAT: - case Token.DOUBLE: - case Token.SBYTE: - case Token.BYTE: - case Token.SHORT: - case Token.USHORT: - case Token.INT: - case Token.UINT: - case Token.LONG: - case Token.ULONG: - case Token.CHAR: - case Token.VOID: - break; - case Token.OP_GENERICS_GT: - genericDimension = 1; - return true; - case Token.IN: - case Token.OUT: - return true; - case Token.COMMA: - do { - ++genericDimension; - the_token = token (); - } while (the_token == Token.COMMA); - - if (the_token == Token.OP_GENERICS_GT) { - ++genericDimension; - return true; - } - - return false; - case Token.OPEN_PARENS: - int parens_count = 1; - while (true) { - switch (token ()) { - case Token.COMMA: - // tuple declaration after < - if (parens_count == 1) - return true; - continue; - case Token.OPEN_PARENS: - ++parens_count; - continue; - case Token.CLOSE_PARENS: - if (--parens_count <= 0) - return false; - continue; - case Token.OP_GENERICS_GT: - case Token.EOF: - return false; - } - } - - default: - return false; - } - again: - the_token = token (); - - if (the_token == Token.OP_GENERICS_GT) - return true; - else if (the_token == Token.COMMA || the_token == Token.DOT || the_token == Token.DOUBLE_COLON) - goto start; - else if (the_token == Token.INTERR_NULLABLE || the_token == Token.STAR) - goto again; - else if (the_token == Token.OP_GENERICS_LT) { - int unused = 0; - if (!parse_less_than (ref unused)) - return false; - goto again; - } else if (the_token == Token.OPEN_BRACKET) { - rank_specifiers: - the_token = token (); - if (the_token == Token.CLOSE_BRACKET) - goto again; - else if (the_token == Token.COMMA) - goto rank_specifiers; - return false; - } - - return false; - } - - public int peek_token () - { - int the_token; - - PushPosition (); - the_token = token (); - PopPosition (); - - return the_token; - } - - // - // Tonizes `?' using custom disambiguous rules to return one - // of following tokens: INTERR_NULLABLE, OP_COALESCING, INTERR - // - // Tricky expression looks like: - // - // Foo ? a = x ? b : c; - // - int TokenizePossibleNullableType () - { - if (parsing_block == 0 || parsing_type > 0) - return Token.INTERR_NULLABLE; - - int d = peek_char (); - if (d == '?') { - get_char (); - return Token.OP_COALESCING; - } - - if (d == '.') { - d = reader.Peek (); - return d >= '0' && d <= '9' ? Token.INTERR : Token.INTERR_OPERATOR; - } - - if (d != ' ') { - if (d == ',' || d == ';' || d == '>') - return Token.INTERR_NULLABLE; - if (d == '*' || (d >= '0' && d <= '9')) - return Token.INTERR; - } - - PushPosition (); - current_token = Token.NONE; - int next_token; - int parens = 0; - int generics = 0; - int brackets = 0; - - var nt = xtoken (); - switch (nt) { - case Token.DOT: - case Token.OPEN_BRACKET_EXPR: - next_token = Token.INTERR_OPERATOR; - break; - case Token.LITERAL: - case Token.TRUE: - case Token.FALSE: - case Token.NULL: - case Token.THIS: - case Token.NEW: - case Token.INTERPOLATED_STRING: - case Token.THROW: - case Token.DEFAULT_COLON: - next_token = Token.INTERR; - break; - - case Token.SEMICOLON: - case Token.COMMA: - case Token.CLOSE_PARENS: - case Token.OPEN_BRACKET: - case Token.OP_GENERICS_GT: - case Token.INTERR: - case Token.OP_COALESCING: - case Token.COLON: - next_token = Token.INTERR_NULLABLE; - break; - - case Token.OPEN_PARENS: - case Token.OPEN_PARENS_CAST: - case Token.OPEN_PARENS_LAMBDA: - next_token = -1; - ++parens; - break; - - case Token.OP_GENERICS_LT: - case Token.OP_GENERICS_LT_DECL: - case Token.GENERIC_DIMENSION: - next_token = -1; - ++generics; - break; - - default: - next_token = -1; - break; - } - - if (next_token == -1) { - switch (xtoken ()) { - case Token.COMMA: - case Token.SEMICOLON: - case Token.OPEN_BRACE: - case Token.IN: - next_token = Token.INTERR_NULLABLE; - break; - - case Token.COLON: - next_token = Token.INTERR; - break; - - case Token.OPEN_PARENS: - case Token.OPEN_PARENS_CAST: - case Token.OPEN_PARENS_LAMBDA: - ++parens; - goto default; - - case Token.OPEN_BRACKET: - case Token.OPEN_BRACKET_EXPR: - ++brackets; - goto default; - - case Token.CLOSE_PARENS: - --parens; - goto default; - - case Token.OP_GENERICS_LT: - case Token.OP_GENERICS_LT_DECL: - case Token.GENERIC_DIMENSION: - ++generics; - goto default; - - default: - int ntoken; - int interrs = 1; - int colons = 0; - int braces = 0; - // - // All shorcuts failed, do it hard way - // - while ((ntoken = xtoken ()) != Token.EOF) { - switch (ntoken) { - case Token.OPEN_BRACE: - ++braces; - continue; - case Token.OPEN_PARENS: - case Token.OPEN_PARENS_CAST: - case Token.OPEN_PARENS_LAMBDA: - ++parens; - continue; - case Token.CLOSE_BRACE: - --braces; - continue; - case Token.OP_GENERICS_LT: - case Token.OP_GENERICS_LT_DECL: - case Token.GENERIC_DIMENSION: - ++generics; - continue; - case Token.OPEN_BRACKET: - case Token.OPEN_BRACKET_EXPR: - ++brackets; - continue; - case Token.CLOSE_BRACKET: - --brackets; - continue; - case Token.CLOSE_PARENS: - if (parens > 0) { - --parens; - continue; - } - - PopPosition (); - return Token.INTERR_NULLABLE; - - case Token.OP_GENERICS_GT: - if (generics > 0) { - --generics; - continue; - } - - PopPosition (); - return Token.INTERR_NULLABLE; - } - - if (braces != 0) - continue; - - if (ntoken == Token.SEMICOLON) - break; - - if (parens != 0) - continue; - - if (ntoken == Token.COMMA) { - if (generics != 0 || brackets != 0) - continue; - - PopPosition (); - return Token.INTERR_NULLABLE; - } - - if (ntoken == Token.COLON) { - if (++colons == interrs) - break; - continue; - } - - if (ntoken == Token.INTERR) { - ++interrs; - continue; - } - } - - next_token = colons != interrs && braces == 0 ? Token.INTERR_NULLABLE : Token.INTERR; - break; - } - } - - PopPosition (); - return next_token; - } - - bool decimal_digits (int c) - { - int d; - bool seen_digits = false; - - if (c != -1){ - if (number_pos == MaxNumberLength) - Error_NumericConstantTooLong (); - number_builder [number_pos++] = (char) c; - } - - // - // We use peek_char2, because decimal_digits needs to do a - // 2-character look-ahead (5.ToString for example). - // - while ((d = peek_char2 ()) != -1){ - if (d >= '0' && d <= '9'){ - if (number_pos == MaxNumberLength) - Error_NumericConstantTooLong (); - number_builder [number_pos++] = (char) d; - get_char (); - seen_digits = true; - } else - break; - } - - return seen_digits; - } - - static bool is_hex (int e) - { - return (e >= '0' && e <= '9') || (e >= 'A' && e <= 'F') || (e >= 'a' && e <= 'f'); - } - - static TypeCode real_type_suffix (int c) - { - switch (c){ - case 'F': case 'f': - return TypeCode.Single; - case 'D': case 'd': - return TypeCode.Double; - case 'M': case 'm': - return TypeCode.Decimal; - default: - return TypeCode.Empty; - } - } - - ILiteralConstant integer_type_suffix (ulong ul, int c, Location loc) - { - bool is_unsigned = false; - bool is_long = false; - - if (c != -1){ - bool scanning = true; - do { - switch (c){ - case 'U': case 'u': - if (is_unsigned) - scanning = false; - is_unsigned = true; - get_char (); - break; - - case 'l': - if (!is_unsigned){ - // - // if we have not seen anything in between - // report this error - // - Report.Warning (78, 4, Location, "The `l' suffix is easily confused with the digit `1' (use `L' for clarity)"); - } - - goto case 'L'; - - case 'L': - if (is_long) - scanning = false; - is_long = true; - get_char (); - break; - - default: - scanning = false; - break; - } - c = peek_char (); - } while (scanning); - } - - if (is_long && is_unsigned){ - return new ULongLiteral (context.BuiltinTypes, ul, loc); - } - - if (is_unsigned){ - // uint if possible, or ulong else. - - if ((ul & 0xffffffff00000000) == 0) - return new UIntLiteral (context.BuiltinTypes, (uint) ul, loc); - else - return new ULongLiteral (context.BuiltinTypes, ul, loc); - } else if (is_long){ - // long if possible, ulong otherwise - if ((ul & 0x8000000000000000) != 0) - return new ULongLiteral (context.BuiltinTypes, ul, loc); - else - return new LongLiteral (context.BuiltinTypes, (long) ul, loc); - } else { - // int, uint, long or ulong in that order - if ((ul & 0xffffffff00000000) == 0){ - uint ui = (uint) ul; - - if ((ui & 0x80000000) != 0) - return new UIntLiteral (context.BuiltinTypes, ui, loc); - else - return new IntLiteral (context.BuiltinTypes, (int) ui, loc); - } else { - if ((ul & 0x8000000000000000) != 0) - return new ULongLiteral (context.BuiltinTypes, ul, loc); - else - return new LongLiteral (context.BuiltinTypes, (long) ul, loc); - } - } - } - - // - // given `c' as the next char in the input decide whether - // we need to convert to a special type, and then choose - // the best representation for the integer - // - ILiteralConstant adjust_int (int c, Location loc) - { - try { - if (number_pos > 9){ - ulong ul = (uint) (number_builder [0] - '0'); - - for (int i = 1; i < number_pos; i++){ - ul = checked ((ul * 10) + ((uint)(number_builder [i] - '0'))); - } - - return integer_type_suffix (ul, c, loc); - } else { - uint ui = (uint) (number_builder [0] - '0'); - - for (int i = 1; i < number_pos; i++){ - ui = checked ((ui * 10) + ((uint)(number_builder [i] - '0'))); - } - - return integer_type_suffix (ui, c, loc); - } - } catch (OverflowException) { - Error_NumericConstantTooLong (); - return new IntLiteral (context.BuiltinTypes, 0, loc); - } - catch (FormatException) { - Report.Error (1013, Location, "Invalid number"); - return new IntLiteral (context.BuiltinTypes, 0, loc); - } - } - - ILiteralConstant adjust_real (TypeCode t, Location loc) - { - string s = new string (number_builder, 0, number_pos); - const string error_details = "Floating-point constant is outside the range of type `{0}'"; - - switch (t){ - case TypeCode.Decimal: - try { - return new DecimalLiteral (context.BuiltinTypes, decimal.Parse (s, styles, csharp_format_info), loc); - } catch (OverflowException) { - Report.Error (594, Location, error_details, "decimal"); - return new DecimalLiteral (context.BuiltinTypes, 0, loc); - } - case TypeCode.Single: - try { - return new FloatLiteral (context.BuiltinTypes, float.Parse (s, styles, csharp_format_info), loc); - } catch (OverflowException) { - Report.Error (594, Location, error_details, "float"); - return new FloatLiteral (context.BuiltinTypes, 0, loc); - } - default: - try { - return new DoubleLiteral (context.BuiltinTypes, double.Parse (s, styles, csharp_format_info), loc); - } catch (OverflowException) { - Report.Error (594, loc, error_details, "double"); - return new DoubleLiteral (context.BuiltinTypes, 0, loc); - } - } - } - - ILiteralConstant handle_hex (Location loc) - { - int d; - ulong ul; - - get_char (); - while ((d = peek_char ()) != -1){ - if (is_hex (d)){ - number_builder [number_pos++] = (char) d; - get_char (); - } else - break; - } - - string s = new String (number_builder, 0, number_pos); - - try { - if (number_pos <= 8) - ul = System.UInt32.Parse (s, NumberStyles.HexNumber); - else - ul = System.UInt64.Parse (s, NumberStyles.HexNumber); - - return integer_type_suffix (ul, peek_char (), loc); - } catch (OverflowException){ - Error_NumericConstantTooLong (); - return new IntLiteral (context.BuiltinTypes, 0, loc); - } - catch (FormatException) { - Report.Error (1013, Location, "Invalid number"); - return new IntLiteral (context.BuiltinTypes, 0, loc); - } - } - - // - // Invoked if we know we have .digits or digits - // - int is_number (int c, bool dotLead) - { - ILiteralConstant res; - -#if FULL_AST - int read_start = reader.Position - 1; - if (dotLead) { - // - // Caller did peek_char - // - --read_start; - } -#endif - number_pos = 0; - var loc = Location; - - if (!dotLead){ - if (c == '0'){ - int peek = peek_char (); - - if (peek == 'x' || peek == 'X') { - val = res = handle_hex (loc); -#if FULL_AST - res.ParsedValue = reader.ReadChars (read_start, reader.Position - 1); -#endif - - return Token.LITERAL; - } - } - decimal_digits (c); - c = peek_char (); - } - - // - // We need to handle the case of - // "1.1" vs "1.string" (LITERAL_FLOAT vs NUMBER DOT IDENTIFIER) - // - bool is_real = false; - if (c == '.'){ - if (!dotLead) - get_char (); - - if (decimal_digits ('.')){ - is_real = true; - c = peek_char (); - } else { - putback ('.'); - number_pos--; - val = res = adjust_int (-1, loc); - -#if FULL_AST - res.ParsedValue = reader.ReadChars (read_start, reader.Position - 1); -#endif - return Token.LITERAL; - } - } - - if (c == 'e' || c == 'E'){ - is_real = true; - get_char (); - if (number_pos == MaxNumberLength) - Error_NumericConstantTooLong (); - number_builder [number_pos++] = (char) c; - c = get_char (); - - if (c == '+'){ - if (number_pos == MaxNumberLength) - Error_NumericConstantTooLong (); - number_builder [number_pos++] = '+'; - c = -1; - } else if (c == '-') { - if (number_pos == MaxNumberLength) - Error_NumericConstantTooLong (); - number_builder [number_pos++] = '-'; - c = -1; - } else { - if (number_pos == MaxNumberLength) - Error_NumericConstantTooLong (); - number_builder [number_pos++] = '+'; - } - - decimal_digits (c); - c = peek_char (); - } - - var type = real_type_suffix (c); - if (type == TypeCode.Empty && !is_real) { - res = adjust_int (c, loc); - } else { - is_real = true; - - if (type != TypeCode.Empty) { - get_char (); - } - - res = adjust_real (type, loc); - } - - val = res; - -#if FULL_AST - var chars = reader.ReadChars (read_start, reader.Position - (type == TypeCode.Empty && c > 0 ? 1 : 0)); - if (chars[chars.Length - 1] == '\r') - Array.Resize (ref chars, chars.Length - 1); - res.ParsedValue = chars; -#endif - - return Token.LITERAL; - } - - // - // Accepts exactly count (4 or 8) hex, no more no less - // - int getHex (int count, out int surrogate, out bool error) - { - int i; - int total = 0; - int c; - int top = count != -1 ? count : 4; - - get_char (); - error = false; - surrogate = 0; - for (i = 0; i < top; i++){ - c = get_char (); - - if (c >= '0' && c <= '9') - c = (int) c - (int) '0'; - else if (c >= 'A' && c <= 'F') - c = (int) c - (int) 'A' + 10; - else if (c >= 'a' && c <= 'f') - c = (int) c - (int) 'a' + 10; - else { - error = true; - return 0; - } - - total = (total * 16) + c; - if (count == -1){ - int p = peek_char (); - if (p == -1) - break; - if (!is_hex ((char)p)) - break; - } - } - - if (top == 8) { - if (total > 0x0010FFFF) { - error = true; - return 0; - } - - if (total >= 0x00010000) { - surrogate = ((total - 0x00010000) % 0x0400 + 0xDC00); - total = ((total - 0x00010000) / 0x0400 + 0xD800); - } - } - - return total; - } - - int escape (int c, out int surrogate) - { - bool error; - int d; - int v; - - d = peek_char (); - if (c != '\\') { - surrogate = 0; - return c; - } - - switch (d){ - case 'a': - v = '\a'; break; - case 'b': - v = '\b'; break; - case 'n': - v = '\n'; break; - case 't': - v = '\t'; break; - case 'v': - v = '\v'; break; - case 'r': - v = '\r'; break; - case '\\': - v = '\\'; break; - case 'f': - v = '\f'; break; - case '0': - v = 0; break; - case '"': - v = '"'; break; - case '\'': - v = '\''; break; - case 'x': - v = getHex (-1, out surrogate, out error); - if (error) - goto default; - return v; - case 'u': - case 'U': - return EscapeUnicode (d, out surrogate); - default: - surrogate = 0; - Report.Error (1009, Location, "Unrecognized escape sequence `\\{0}'", ((char)d).ToString ()); - return d; - } - - get_char (); - surrogate = 0; - return v; - } - - int EscapeUnicode (int ch, out int surrogate) - { - bool error; - if (ch == 'U') { - ch = getHex (8, out surrogate, out error); - } else { - ch = getHex (4, out surrogate, out error); - } - - if (error) - Report.Error (1009, Location, "Unrecognized escape sequence"); - - return ch; - } - - int get_char () - { - int x; - if (putback_char != -1) { - x = putback_char; - putback_char = -1; - } else { - x = reader.Read (); - } - - if (x <= 13) { - if (x == '\r') { - if (peek_char () == '\n') { - putback_char = -1; - } - - x = '\n'; - advance_line (); - } else if (x == '\n') { - advance_line (); - } else { - col++; - } - } else if (x >= UnicodeLS && x <= UnicodePS) { - advance_line (); - } else { - col++; - } - - return x; - } - - void advance_line () - { - line++; - ref_line++; - previous_col = col; - col = 0; - } - - int peek_char () - { - if (putback_char == -1) - putback_char = reader.Read (); - return putback_char; - } - - int peek_char2 () - { - if (putback_char != -1) - return putback_char; - return reader.Peek (); - } - - public void putback (int c) - { - if (putback_char != -1) { - throw new InternalErrorException (string.Format ("Secondary putback [{0}] putting back [{1}] is not allowed", (char)putback_char, (char) c), Location); - } - - if (c == '\n' || col == 0 || (c >= UnicodeLS && c <= UnicodePS)) { - // It won't happen though. - line--; - ref_line--; - col = previous_col; - } - else - col--; - putback_char = c; - } - - public bool advance () - { - return peek_char () != -1 || CompleteOnEOF; - } - - public Object Value { - get { - return val; - } - } - - public Object value () - { - return val; - } - - public int token () - { - current_token = xtoken (); - return current_token; - } - - int TokenizePreprocessorKeyword (out int c) - { - // skip over white space - do { - c = get_char (); - } while (c == ' ' || c == '\t'); - - - int pos = 0; - while (c != -1 && c >= 'a' && c <= 'z') { - id_builder[pos++] = (char) c; - c = get_char (); - if (c == '\\') { - int peek = peek_char (); - if (peek == 'U' || peek == 'u') { - int surrogate; - c = EscapeUnicode (c, out surrogate); - if (surrogate != 0) { - if (is_identifier_part_character ((char) c)) { - id_builder[pos++] = (char) c; - } - c = surrogate; - } - } - } - } - - return pos; - } - - PreprocessorDirective get_cmd_arg (out string arg) - { - int c; - - tokens_seen = false; - arg = ""; - - var cmd = GetPreprocessorDirective (id_builder, TokenizePreprocessorKeyword (out c)); - - if ((cmd & PreprocessorDirective.CustomArgumentsParsing) != 0) - return cmd; - - // skip over white space - while (c == ' ' || c == '\t') - c = get_char (); - - int has_identifier_argument = (int)(cmd & PreprocessorDirective.RequiresArgument); - int pos = 0; - - while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS) { - if (c == '\\' && has_identifier_argument >= 0) { - if (has_identifier_argument != 0) { - has_identifier_argument = 1; - - int peek = peek_char (); - if (peek == 'U' || peek == 'u') { - int surrogate; - c = EscapeUnicode (c, out surrogate); - if (surrogate != 0) { - if (is_identifier_part_character ((char) c)) { - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder[pos++] = (char) c; - } - c = surrogate; - } - } - } else { - has_identifier_argument = -1; - } - } else if (c == '/' && peek_char () == '/') { - // - // Eat single-line comments - // - get_char (); - ReadToEndOfLine (); - break; - } - - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder[pos++] = (char) c; - c = get_char (); - } - - if (pos != 0) { - if (pos > MaxIdentifierLength) - arg = new string (value_builder, 0, pos); - else - arg = InternIdentifier (value_builder, pos); - - // Eat any trailing whitespaces - arg = arg.Trim (simple_whitespaces); - } - - return cmd; - } - - // - // Handles the #line directive - // - bool PreProcessLine () - { - Location loc = Location; - - int c; - - int length = TokenizePreprocessorKeyword (out c); - if (length == line_default.Length) { - if (!IsTokenIdentifierEqual (line_default)) - return false; - - current_source = source_file.SourceFile; - if (!hidden_block_start.IsNull) { - current_source.RegisterHiddenScope (hidden_block_start, loc); - hidden_block_start = Location.Null; - } - - ref_line = line; - return true; - } - - if (length == line_hidden.Length) { - if (!IsTokenIdentifierEqual (line_hidden)) - return false; - - if (hidden_block_start.IsNull) - hidden_block_start = loc; - - return true; - } - - if (length != 0 || c < '0' || c > '9') { - // - // Eat any remaining characters to continue parsing on next line - // - ReadToEndOfLine (); - return false; - } - - int new_line = TokenizeNumber (c); - if (new_line < 1) { - // - // Eat any remaining characters to continue parsing on next line - // - ReadToEndOfLine (); - return new_line != 0; - } - - c = get_char (); - if (c == ' ') { - // skip over white space - do { - c = get_char (); - } while (c == ' ' || c == '\t'); - } else if (c == '"') { - c = 0; - } - - if (c != '\n' && c != '/' && c != '"' && c != UnicodeLS && c != UnicodePS) { - // - // Eat any remaining characters to continue parsing on next line - // - ReadToEndOfLine (); - - Report.Error (1578, loc, "Filename, single-line comment or end-of-line expected"); - return true; - } - - string new_file_name = null; - if (c == '"') { - new_file_name = TokenizeFileName (ref c); - - // skip over white space - while (c == ' ' || c == '\t') { - c = get_char (); - } - } - - if (c == '\n' || c == UnicodeLS || c == UnicodePS) { - - } else if (c == '/') { - ReadSingleLineComment (); - } else { - // - // Eat any remaining characters to continue parsing on next line - // - ReadToEndOfLine (); - - Error_EndLineExpected (); - return true; - } - - if (new_file_name != null) { - current_source = context.LookupFile (source_file, new_file_name); - source_file.AddIncludeFile (current_source); - } - - if (!hidden_block_start.IsNull) { - current_source.RegisterHiddenScope (hidden_block_start, loc); - hidden_block_start = Location.Null; - } - - ref_line = new_line; - return true; - } - - // - // Handles #define and #undef - // - void PreProcessDefinition (bool is_define, string ident, bool caller_is_taking) - { - if (ident.Length == 0 || ident == "true" || ident == "false"){ - Report.Error (1001, Location, "Missing identifier to pre-processor directive"); - return; - } - - if (ident.IndexOfAny (simple_whitespaces) != -1){ - Error_EndLineExpected (); - return; - } - - if (!is_identifier_start_character (ident [0])) - Report.Error (1001, Location, "Identifier expected: {0}", ident); - - foreach (char c in ident.Substring (1)){ - if (!is_identifier_part_character (c)){ - Report.Error (1001, Location, "Identifier expected: {0}", ident); - return; - } - } - - if (!caller_is_taking) - return; - - if (is_define) { - // - // #define ident - // - if (context.Settings.IsConditionalSymbolDefined (ident)) - return; - - source_file.AddDefine (ident); - } else { - // - // #undef ident - // - source_file.AddUndefine (ident); - } - } - - byte read_hex (out bool error) - { - int total; - int c = get_char (); - - if ((c >= '0') && (c <= '9')) - total = (int) c - (int) '0'; - else if ((c >= 'A') && (c <= 'F')) - total = (int) c - (int) 'A' + 10; - else if ((c >= 'a') && (c <= 'f')) - total = (int) c - (int) 'a' + 10; - else { - error = true; - return 0; - } - - total *= 16; - c = get_char (); - - if ((c >= '0') && (c <= '9')) - total += (int) c - (int) '0'; - else if ((c >= 'A') && (c <= 'F')) - total += (int) c - (int) 'A' + 10; - else if ((c >= 'a') && (c <= 'f')) - total += (int) c - (int) 'a' + 10; - else { - error = true; - return 0; - } - - error = false; - return (byte) total; - } - - // - // Parses #pragma checksum - // - bool ParsePragmaChecksum () - { - // - // The syntax is ` "foo.txt" "{guid}" "hash"' - // - // guid is predefined hash algorithm guid {406ea660-64cf-4c82-b6f0-42d48172a799} for md5 - // - int c = get_char (); - - if (c != '"') - return false; - - string file_name = TokenizeFileName (ref c); - - // TODO: Any white-spaces count - if (c != ' ') - return false; - - SourceFile file = context.LookupFile (source_file, file_name); - - if (get_char () != '"' || get_char () != '{') - return false; - - bool error; - byte[] guid_bytes = new byte [16]; - int i = 0; - - for (; i < 4; i++) { - guid_bytes [i] = read_hex (out error); - if (error) - return false; - } - - if (get_char () != '-') - return false; - - for (; i < 10; i++) { - guid_bytes [i] = read_hex (out error); - if (error) - return false; - - guid_bytes [i++] = read_hex (out error); - if (error) - return false; - - if (get_char () != '-') - return false; - } - - for (; i < 16; i++) { - guid_bytes [i] = read_hex (out error); - if (error) - return false; - } - - if (get_char () != '}' || get_char () != '"') - return false; - - // TODO: Any white-spaces count - c = get_char (); - if (c != ' ') - return false; - - if (get_char () != '"') - return false; - - // Any length of checksum - List checksum_bytes = new List (16); - - var checksum_location = Location; - c = peek_char (); - while (c != '"' && c != -1) { - checksum_bytes.Add (read_hex (out error)); - if (error) - return false; - - c = peek_char (); - } - - if (c == '/') { - ReadSingleLineComment (); - } else if (get_char () != '"') { - return false; - } - - if (context.Settings.GenerateDebugInfo) { - var chsum = checksum_bytes.ToArray (); - - if (file.HasChecksum) { - if (!ArrayComparer.IsEqual (file.Checksum, chsum)) { - // TODO: Report.SymbolRelatedToPreviousError - Report.Warning (1697, 1, checksum_location, "Different checksum values specified for file `{0}'", file.Name); - } - } - - file.SetChecksum (guid_bytes, chsum); - current_source.AutoGenerated = true; - } - - return true; - } - - bool IsTokenIdentifierEqual (char[] identifier) - { - for (int i = 0; i < identifier.Length; ++i) { - if (identifier[i] != id_builder[i]) - return false; - } - - return true; - } - - bool ScanClosingInterpolationBrace () - { - PushPosition (); - - bool? res = null; - int str_quote = 0; - do { - var c = reader.Read (); - switch (c) { - case '\"': - ++str_quote; - break; - case '\\': - // Skip escaped " character - c = reader.Read (); - if (c == -1) - res = false; - break; - case -1: - res = false; - break; - case '}': - if (str_quote % 2 == 1) { - res = true; - } - - break; - } - } while (res == null); - - PopPosition (); - return res.Value; - } - - int TokenizeNumber (int value) - { - number_pos = 0; - - decimal_digits (value); - uint ui = (uint) (number_builder[0] - '0'); - - try { - for (int i = 1; i < number_pos; i++) { - ui = checked ((ui * 10) + ((uint) (number_builder[i] - '0'))); - } - - return (int) ui; - } catch (OverflowException) { - Error_NumericConstantTooLong (); - return -1; - } - } - - string TokenizeFileName (ref int c) - { - var string_builder = new StringBuilder (); - while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS) { - c = get_char (); - if (c == '"') { - c = get_char (); - break; - } - - string_builder.Append ((char) c); - } - - if (string_builder.Length == 0) { - Report.Warning (1709, 1, Location, "Filename specified for preprocessor directive is empty"); - } - - - return string_builder.ToString (); - } - - int TokenizePragmaWarningIdentifier (ref int c, ref bool identifier) - { - if ((c >= '0' && c <= '9') || is_identifier_start_character (c)) { - int number; - - if (c >= '0' && c <= '9') { - number_pos = 0; - number = TokenizeNumber (c); - - c = get_char (); - - if (c != ' ' && c != '\t' && c != ',' && c != '\n' && c != -1 && c != UnicodeLS && c != UnicodePS) { - return ReadPragmaWarningComment (c); - } - } else { - // - // LAMESPEC v6: No spec what identifier really is in this context, it seems keywords are allowed too - // - int pos = 0; - number = -1; - id_builder [pos++] = (char)c; - while (c < MaxIdentifierLength) { - c = reader.Read (); - id_builder [pos] = (char)c; - - if (c >= '0' && c <= '9') { - if (pos == 5 && id_builder [0] == 'C' && id_builder [1] == 'S') { - // Recognize CSXXXX as C# XXXX warning - number = 0; - int pow = 1000; - for (int i = 0; i < 4; ++i) { - var ch = id_builder [i + 2]; - if (ch < '0' || ch > '9') { - number = -1; - break; - } - - number += (ch - '0') * pow; - pow /= 10; - } - } - } else if (c == '\n' || c == UnicodeLS || c == UnicodePS) { - advance_line (); - break; - } else if ((c < 'a' || c > 'z') && (c < 'A' || c > 'Z') && c != '_') { - break; - } - - ++pos; - } - - if (number < 0) { - identifier = true; - number = pos; - } - } - - // skip over white space - while (c == ' ' || c == '\t') - c = get_char (); - - if (c == ',') { - c = get_char (); - } - - // skip over white space - while (c == ' ' || c == '\t') - c = get_char (); - - return number; - } - - return ReadPragmaWarningComment (c); - } - - int ReadPragmaWarningComment (int c) - { - if (c == '/') { - ReadSingleLineComment (); - } else { - Report.Warning (1692, 1, Location, "Invalid number"); - - // Read everything till the end of the line or file - ReadToEndOfLine (); - } - - return -1; - } - - void ReadToEndOfLine () - { - int c; - do { - c = get_char (); - } while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS); - } - - void ReadSingleLineComment () - { - if (peek_char () != '/') - Report.Warning (1696, 1, Location, "Single-line comment or end-of-line expected"); - - // Read everything till the end of the line or file - ReadToEndOfLine (); - } - - /// - /// Handles #pragma directive - /// - void ParsePragmaDirective () - { - int c; - int length = TokenizePreprocessorKeyword (out c); - if (length == pragma_warning.Length && IsTokenIdentifierEqual (pragma_warning)) { - length = TokenizePreprocessorKeyword (out c); - - // - // #pragma warning disable - // #pragma warning restore - // - if (length == pragma_warning_disable.Length) { - bool disable = IsTokenIdentifierEqual (pragma_warning_disable); - if (disable || IsTokenIdentifierEqual (pragma_warning_restore)) { - // skip over white space - while (c == ' ' || c == '\t') - c = get_char (); - - var loc = Location; - - if (c == '\n' || c == '/' || c == UnicodeLS || c == UnicodePS) { - if (c == '/') - ReadSingleLineComment (); - - // - // Disable/Restore all warnings - // - if (disable) { - Report.RegisterWarningRegion (loc).WarningDisable (loc.Row); - } else { - Report.RegisterWarningRegion (loc).WarningEnable (loc.Row); - } - } else { - // - // Disable/Restore a warning or group of warnings - // - int code; - do { - bool identifier = false; - code = TokenizePragmaWarningIdentifier (ref c, ref identifier); - if (code > 0) { - if (identifier) { - // no-op, custom warnings cannot occur in mcs - } else if (disable) { - Report.RegisterWarningRegion (loc).WarningDisable (loc, code, context.Report); - } else { - Report.RegisterWarningRegion (loc).WarningEnable (loc, code, context); - } - } - } while (code >= 0 && c != '\n' && c != -1 && c != UnicodeLS && c != UnicodePS); - } - - return; - } - } - - Report.Warning (1634, 1, Location, "Expected disable or restore"); - - // Eat any remaining characters on the line - ReadToEndOfLine (); - - return; - } - - // - // #pragma checksum - // - if (length == pragma_checksum.Length && IsTokenIdentifierEqual (pragma_checksum)) { - if (c != ' ' || !ParsePragmaChecksum ()) { - Report.Warning (1695, 1, Location, - "Invalid #pragma checksum syntax. Expected \"filename\" \"{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}\" \"XXXX...\""); - } - - return; - } - - Report.Warning (1633, 1, Location, "Unrecognized #pragma directive"); - - // Eat any remaining characters on the line - ReadToEndOfLine (); - } - - bool eval_val (string s) - { - if (s == "true") - return true; - if (s == "false") - return false; - - return source_file.IsConditionalDefined (s); - } - - bool pp_primary (ref string s) - { - s = s.Trim (); - int len = s.Length; - - if (len > 0){ - char c = s [0]; - - if (c == '('){ - s = s.Substring (1); - bool val = pp_expr (ref s, false); - if (s.Length > 0 && s [0] == ')'){ - s = s.Substring (1); - return val; - } - Error_InvalidDirective (); - return false; - } - - if (is_identifier_start_character (c)){ - int j = 1; - - while (j < len){ - c = s [j]; - - if (is_identifier_part_character (c)){ - j++; - continue; - } - bool v = eval_val (s.Substring (0, j)); - s = s.Substring (j); - return v; - } - bool vv = eval_val (s); - s = ""; - return vv; - } - } - Error_InvalidDirective (); - return false; - } - - bool pp_unary (ref string s) - { - s = s.Trim (); - int len = s.Length; - - if (len > 0){ - if (s [0] == '!'){ - if (len > 1 && s [1] == '='){ - Error_InvalidDirective (); - return false; - } - s = s.Substring (1); - return ! pp_primary (ref s); - } else - return pp_primary (ref s); - } else { - Error_InvalidDirective (); - return false; - } - } - - bool pp_eq (ref string s) - { - bool va = pp_unary (ref s); - - s = s.Trim (); - int len = s.Length; - if (len > 0){ - if (s [0] == '='){ - if (len > 2 && s [1] == '='){ - s = s.Substring (2); - return va == pp_unary (ref s); - } else { - Error_InvalidDirective (); - return false; - } - } else if (s [0] == '!' && len > 1 && s [1] == '='){ - s = s.Substring (2); - - return va != pp_unary (ref s); - - } - } - - return va; - - } - - bool pp_and (ref string s) - { - bool va = pp_eq (ref s); - - s = s.Trim (); - int len = s.Length; - if (len > 0){ - if (s [0] == '&'){ - if (len > 2 && s [1] == '&'){ - s = s.Substring (2); - return (va & pp_and (ref s)); - } else { - Error_InvalidDirective (); - return false; - } - } - } - return va; - } - - // - // Evaluates an expression for `#if' or `#elif' - // - bool pp_expr (ref string s, bool isTerm) - { - bool va = pp_and (ref s); - s = s.Trim (); - int len = s.Length; - if (len > 0){ - char c = s [0]; - - if (c == '|'){ - if (len > 2 && s [1] == '|'){ - s = s.Substring (2); - return va | pp_expr (ref s, isTerm); - } else { - Error_InvalidDirective (); - return false; - } - } - if (isTerm) { - Error_EndLineExpected (); - return false; - } - } - - return va; - } - - bool eval (string s) - { - bool v = pp_expr (ref s, true); - s = s.Trim (); - if (s.Length != 0){ - return false; - } - - return v; - } - - void Error_NumericConstantTooLong () - { - Report.Error (1021, Location, "Integral constant is too large"); - } - - void Error_InvalidDirective () - { - Report.Error (1517, Location, "Invalid preprocessor directive"); - } - - void Error_UnexpectedDirective (string extra) - { - Report.Error ( - 1028, Location, - "Unexpected processor directive ({0})", extra); - } - - void Error_TokensSeen () - { - Report.Error (1032, Location, - "Cannot define or undefine preprocessor symbols after first token in file"); - } - - void Eror_WrongPreprocessorLocation () - { - Report.Error (1040, Location, - "Preprocessor directives must appear as the first non-whitespace character on a line"); - } - - void Error_EndLineExpected () - { - Report.Error (1025, Location, "Single-line comment or end-of-line expected"); - } - - // - // Raises a warning when tokenizer found documentation comment - // on unexpected place - // - void WarningMisplacedComment (Location loc) - { - if (doc_state != XmlCommentState.Error) { - doc_state = XmlCommentState.Error; - Report.Warning (1587, 2, loc, "XML comment is not placed on a valid language element"); - } - } - - // - // if true, then the code continues processing the code - // if false, the code stays in a loop until another directive is - // reached. - // When caller_is_taking is false we ignore all directives except the ones - // which can help us to identify where the #if block ends - bool ParsePreprocessingDirective (bool caller_is_taking) - { - string arg; - bool region_directive = false; - - var directive = get_cmd_arg (out arg); - - // - // The first group of pre-processing instructions is always processed - // - switch (directive) { - case PreprocessorDirective.Region: - region_directive = true; - arg = "true"; - goto case PreprocessorDirective.If; - - case PreprocessorDirective.Endregion: - if (ifstack == null || ifstack.Count == 0){ - Error_UnexpectedDirective ("no #region for this #endregion"); - return true; - } - int pop = ifstack.Pop (); - - if ((pop & REGION) == 0) - Report.Error (1027, Location, "Expected `#endif' directive"); - - return caller_is_taking; - - case PreprocessorDirective.If: - if (ifstack == null) - ifstack = new Stack (2); - - int flags = region_directive ? REGION : 0; - if (ifstack.Count == 0){ - flags |= PARENT_TAKING; - } else { - int state = ifstack.Peek (); - if ((state & TAKING) != 0) { - flags |= PARENT_TAKING; - } - } - - if (eval (arg) && caller_is_taking) { - ifstack.Push (flags | TAKING); - return true; - } - ifstack.Push (flags); - return false; - - case PreprocessorDirective.Endif: - if (ifstack == null || ifstack.Count == 0){ - Error_UnexpectedDirective ("no #if for this #endif"); - return true; - } else { - pop = ifstack.Pop (); - - if ((pop & REGION) != 0) - Report.Error (1038, Location, "#endregion directive expected"); - - if (arg.Length != 0) { - Error_EndLineExpected (); - } - - if (ifstack.Count == 0) - return true; - - int state = ifstack.Peek (); - return (state & TAKING) != 0; - } - - case PreprocessorDirective.Elif: - if (ifstack == null || ifstack.Count == 0){ - Error_UnexpectedDirective ("no #if for this #elif"); - return true; - } else { - int state = ifstack.Pop (); - - if ((state & REGION) != 0) { - Report.Error (1038, Location, "#endregion directive expected"); - return true; - } - - if ((state & ELSE_SEEN) != 0){ - Error_UnexpectedDirective ("#elif not valid after #else"); - return true; - } - - if ((state & TAKING) != 0) { - ifstack.Push (0); - return false; - } - - if (eval (arg) && ((state & PARENT_TAKING) != 0)){ - ifstack.Push (state | TAKING); - return true; - } - - ifstack.Push (state); - return false; - } - - case PreprocessorDirective.Else: - if (ifstack == null || ifstack.Count == 0){ - Error_UnexpectedDirective ("no #if for this #else"); - return true; - } else { - int state = ifstack.Peek (); - - if ((state & REGION) != 0) { - Report.Error (1038, Location, "#endregion directive expected"); - return true; - } - - if ((state & ELSE_SEEN) != 0){ - Error_UnexpectedDirective ("#else within #else"); - return true; - } - - ifstack.Pop (); - - if (arg.Length != 0) { - Error_EndLineExpected (); - return true; - } - - bool ret = false; - if ((state & PARENT_TAKING) != 0) { - ret = (state & TAKING) == 0; - - if (ret) - state |= TAKING; - else - state &= ~TAKING; - } - - ifstack.Push (state | ELSE_SEEN); - - return ret; - } - case PreprocessorDirective.Define: - if (any_token_seen){ - if (caller_is_taking) - Error_TokensSeen (); - return caller_is_taking; - } - PreProcessDefinition (true, arg, caller_is_taking); - return caller_is_taking; - - case PreprocessorDirective.Undef: - if (any_token_seen){ - if (caller_is_taking) - Error_TokensSeen (); - return caller_is_taking; - } - PreProcessDefinition (false, arg, caller_is_taking); - return caller_is_taking; - - case PreprocessorDirective.Invalid: - Report.Error (1024, Location, "Wrong preprocessor directive"); - return true; - } - - // - // These are only processed if we are in a `taking' block - // - if (!caller_is_taking) - return false; - - switch (directive){ - case PreprocessorDirective.Error: - Report.Error (1029, Location, "#error: '{0}'", arg); - return true; - - case PreprocessorDirective.Warning: - Report.Warning (1030, 1, Location, "#warning: `{0}'", arg); - return true; - - case PreprocessorDirective.Pragma: - if (context.Settings.Version == LanguageVersion.ISO_1) { - Report.FeatureIsNotAvailable (context, Location, "#pragma"); - } - - ParsePragmaDirective (); - return true; - - case PreprocessorDirective.Line: - Location loc = Location; - if (!PreProcessLine ()) - Report.Error (1576, loc, "The line number specified for #line directive is missing or invalid"); - - return caller_is_taking; - } - - throw new NotImplementedException (directive.ToString ()); - } - - int consume_string (bool quoted) - { - int c; - int pos = 0; - Location start_location = Location; - if (quoted) - start_location = start_location - 1; - -#if FULL_AST - int reader_pos = reader.Position; -#endif - - while (true){ - // Cannot use get_char because of \r in quoted strings - if (putback_char != -1) { - c = putback_char; - putback_char = -1; - } else { - c = reader.Read (); - } - - if (c == '"') { - ++col; - - if (quoted && peek_char () == '"') { - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder[pos++] = (char) c; - get_char (); - continue; - } - - ILiteralConstant res = new StringLiteral (context.BuiltinTypes, CreateStringFromBuilder (pos), start_location); - val = res; -#if FULL_AST - res.ParsedValue = quoted ? - reader.ReadChars (reader_pos - 2, reader.Position - 1) : - reader.ReadChars (reader_pos - 1, reader.Position); -#endif - - return Token.LITERAL; - } - - if (c == '\n' || c == UnicodeLS || c == UnicodePS) { - if (!quoted) { - Report.Error (1010, Location, "Newline in constant"); - - advance_line (); - - // Don't add \r to string literal - if (pos > 1 && value_builder [pos - 1] == '\r') - --pos; - - val = new StringLiteral (context.BuiltinTypes, new string (value_builder, 0, pos), start_location); - return Token.LITERAL; - } - - advance_line (); - } else if (c == '\\' && !quoted) { - ++col; - int surrogate; - c = escape (c, out surrogate); - if (c == -1) - return Token.ERROR; - if (surrogate != 0) { - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder[pos++] = (char) c; - c = surrogate; - } - } else if (c == -1) { - Report.Error (1039, Location, "Unterminated string literal"); - return Token.EOF; - } else { - ++col; - } - - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder[pos++] = (char) c; - } - } - - private int consume_identifier (int s) - { - int res = consume_identifier (s, false); - - if (doc_state == XmlCommentState.Allowed) - doc_state = XmlCommentState.NotAllowed; - - return res; - } - - int consume_identifier (int c, bool quoted) - { - // - // This method is very performance sensitive. It accounts - // for approximately 25% of all parser time - // - - int pos = 0; - int column = col; - if (quoted) - --column; - - if (c == '\\') { - int surrogate; - c = escape (c, out surrogate); - if (quoted || is_identifier_start_character (c)) { - // it's added bellow - } else if (surrogate != 0) { - id_builder [pos++] = (char)c; - c = surrogate; - } else { - Report.Error (1056, Location, "Unexpected character `\\{0}'", c.ToString ("x4")); - return Token.ERROR; - } - } - - id_builder [pos++] = (char) c; - - try { - while (true) { - c = reader.Read (); - - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c >= '0' && c <= '9')) { - id_builder [pos++] = (char) c; - continue; - } - - if (c < 0x80) { - if (c == '\\') { - int surrogate; - c = escape (c, out surrogate); - if (is_identifier_part_character ((char) c)) - id_builder[pos++] = (char) c; - else if (surrogate != 0) { - c = surrogate; - } else { - switch (c) { - // TODO: Probably need more whitespace characters - case 0xFEFF: - putback_char = c; - break; - default: - Report.Error (1056, Location, "Unexpected character `\\{0}'", c.ToString ("x4")); - return Token.ERROR; - } - } - - continue; - } - } else if (is_identifier_part_character_slow_part ((char) c)) { - id_builder [pos++] = (char) c; - continue; - } - - putback_char = c; - break; - } - } catch (IndexOutOfRangeException) { - Report.Error (645, Location, "Identifier too long (limit is 512 chars)"); - --pos; - col += pos; - } - - col += pos - 1; - - // - // Optimization: avoids doing the keyword lookup - // on uppercase letters - // - if (id_builder [0] >= '_' && !quoted) { - int keyword = GetKeyword (id_builder, pos); - if (keyword != -1) { - val = ltb.Create (keyword == Token.AWAIT ? "await" : null, current_source, ref_line, column); - return keyword; - } - } - - string s = InternIdentifier (id_builder, pos); - val = ltb.Create (s, current_source, ref_line, column); - if (quoted && parsing_attribute_section) - AddEscapedIdentifier (((LocatedToken) val).Location); - - return Token.IDENTIFIER; - } - - string InternIdentifier (char[] charBuffer, int length) - { - // - // Keep identifiers in an array of hashtables to avoid needless - // allocations - // - var identifiers_group = identifiers[length]; - string s; - if (identifiers_group != null) { - if (identifiers_group.TryGetValue (charBuffer, out s)) { - return s; - } - } else { - // TODO: this should be number of files dependant - // corlib compilation peaks at 1000 and System.Core at 150 - int capacity = length > 20 ? 10 : 100; - identifiers_group = new Dictionary (capacity, new IdentifiersComparer (length)); - identifiers[length] = identifiers_group; - } - - char[] chars = new char[length]; - Array.Copy (charBuffer, chars, length); - - s = new string (charBuffer, 0, length); - identifiers_group.Add (chars, s); - return s; - } - - public int xtoken () - { - if (parsing_interpolation_format) { - return TokenizeInterpolationFormat (); - } - - int d, c; - - // Whether we have seen comments on the current line - bool comments_seen = false; - while ((c = get_char ()) != -1) { - switch (c) { - case '\t': - col = ((col - 1 + tab_size) / tab_size) * tab_size; - continue; - - case ' ': - case '\f': - case '\v': - case 0xa0: - case 0: - case 0xFEFF: // Ignore BOM anywhere in the file - continue; - -/* This is required for compatibility with .NET - case 0xEF: - if (peek_char () == 0xBB) { - PushPosition (); - get_char (); - if (get_char () == 0xBF) - continue; - PopPosition (); - } - break; -*/ - case '\\': - tokens_seen = true; - return consume_identifier (c); - - case '{': - val = ltb.Create (current_source, ref_line, col); - - if (parsing_string_interpolation > 0) - ++string_interpolation_section; - - return Token.OPEN_BRACE; - case '}': - if (parsing_string_interpolation > 0) { - if (string_interpolation_section == 0) { - --parsing_string_interpolation; - bool quoted; - if (parsing_string_interpolation_quoted != null && parsing_string_interpolation_quoted.Count > 0) { - quoted = parsing_string_interpolation_quoted.Pop (); - } else { - quoted = false; - } - - return TokenizeInterpolatedString (quoted); - } - - --string_interpolation_section; - } - - val = ltb.Create (current_source, ref_line, col); - return Token.CLOSE_BRACE; - case '[': - // To block doccomment inside attribute declaration. - if (doc_state == XmlCommentState.Allowed) - doc_state = XmlCommentState.NotAllowed; - - val = ltb.Create (current_source, ref_line, col); - - if (parsing_block == 0 || lambda_arguments_parsing) - return Token.OPEN_BRACKET; - - int next = peek_char (); - switch (next) { - case ']': - case ',': - return Token.OPEN_BRACKET; - - case ' ': - case '\f': - case '\v': - case '\r': - case '\n': - case UnicodeLS: - case UnicodePS: - case '/': - next = peek_token (); - if (next == Token.COMMA || next == Token.CLOSE_BRACKET) - return Token.OPEN_BRACKET; - - return Token.OPEN_BRACKET_EXPR; - default: - return Token.OPEN_BRACKET_EXPR; - } - case ']': - ltb.CreateOptional (current_source, ref_line, col, ref val); - return Token.CLOSE_BRACKET; - case '(': - val = ltb.Create (current_source, ref_line, col); - // - // An expression versions of parens can appear in block context only - // - if (parsing_block != 0 && !lambda_arguments_parsing) { - - // - // Optmize most common case where we know that parens - // is not special - // - switch (current_token) { - case Token.IDENTIFIER: - case Token.IF: - case Token.FOR: - case Token.FOREACH: - case Token.TYPEOF: - case Token.WHILE: - case Token.SWITCH: - case Token.USING: - case Token.DEFAULT: - case Token.DEFAULT_VALUE: - case Token.DELEGATE: - case Token.OP_GENERICS_GT: - case Token.REFVALUE: - return Token.OPEN_PARENS; - } - - // Optimize using peek - int xx = peek_char (); - switch (xx) { - case '(': - case '\'': - case '"': - case '0': - case '1': - return Token.OPEN_PARENS; - } - - lambda_arguments_parsing = true; - PushPosition (); - d = TokenizeOpenParens (); - PopPosition (); - lambda_arguments_parsing = false; - return d; - } - - return Token.OPEN_PARENS; - case ')': - ltb.CreateOptional (current_source, ref_line, col, ref val); - return Token.CLOSE_PARENS; - case ',': - ltb.CreateOptional (current_source, ref_line, col, ref val); - return Token.COMMA; - case ';': - ltb.CreateOptional (current_source, ref_line, col, ref val); - return Token.SEMICOLON; - case '~': - val = ltb.Create (current_source, ref_line, col); - return Token.TILDE; - case '?': - val = ltb.Create (current_source, ref_line, col); - return TokenizePossibleNullableType (); - case '<': - val = ltb.Create (current_source, ref_line, col); - if (parsing_generic_less_than++ > 0) - return Token.OP_GENERICS_LT; - - return TokenizeLessThan (); - - case '>': - val = ltb.Create (current_source, ref_line, col); - d = peek_char (); - - if (d == '='){ - get_char (); - return Token.OP_GE; - } - - if (parsing_generic_less_than > 1 || (parsing_generic_less_than == 1 && d != '>')) { - parsing_generic_less_than--; - return Token.OP_GENERICS_GT; - } - - if (d == '>') { - get_char (); - d = peek_char (); - - if (d == '=') { - get_char (); - return Token.OP_SHIFT_RIGHT_ASSIGN; - } - return Token.OP_SHIFT_RIGHT; - } - - return Token.OP_GT; - - case '+': - val = ltb.Create (current_source, ref_line, col); - d = peek_char (); - if (d == '+') { - d = Token.OP_INC; - } else if (d == '=') { - d = Token.OP_ADD_ASSIGN; - } else { - return Token.PLUS; - } - get_char (); - return d; - - case '-': - val = ltb.Create (current_source, ref_line, col); - d = peek_char (); - if (d == '-') { - d = Token.OP_DEC; - } else if (d == '=') - d = Token.OP_SUB_ASSIGN; - else if (d == '>') - d = Token.OP_PTR; - else { - return Token.MINUS; - } - get_char (); - return d; - - case '!': - val = ltb.Create (current_source, ref_line, col); - if (peek_char () == '='){ - get_char (); - return Token.OP_NE; - } - return Token.BANG; - - case '=': - val = ltb.Create (current_source, ref_line, col); - d = peek_char (); - if (d == '='){ - get_char (); - return Token.OP_EQ; - } - if (d == '>'){ - get_char (); - return Token.ARROW; - } - - return Token.ASSIGN; - - case '&': - val = ltb.Create (current_source, ref_line, col); - d = peek_char (); - if (d == '&'){ - get_char (); - return Token.OP_AND; - } - if (d == '='){ - get_char (); - return Token.OP_AND_ASSIGN; - } - return Token.BITWISE_AND; - - case '|': - val = ltb.Create (current_source, ref_line, col); - d = peek_char (); - if (d == '|'){ - get_char (); - return Token.OP_OR; - } - if (d == '='){ - get_char (); - return Token.OP_OR_ASSIGN; - } - return Token.BITWISE_OR; - - case '*': - val = ltb.Create (current_source, ref_line, col); - if (peek_char () == '='){ - get_char (); - return Token.OP_MULT_ASSIGN; - } - return Token.STAR; - - case '/': - d = peek_char (); - if (d == '='){ - val = ltb.Create (current_source, ref_line, col); - get_char (); - return Token.OP_DIV_ASSIGN; - } - - // Handle double-slash comments. - if (d == '/'){ - if (parsing_string_interpolation > 0) { - Report.Error (8077, Location, "A single-line comment may not be used in an interpolated string"); - goto case '}'; - } - - get_char (); - if (doc_processing) { - if (peek_char () == '/') { - get_char (); - // Don't allow ////. - if ((d = peek_char ()) != '/') { - if (doc_state == XmlCommentState.Allowed) - handle_one_line_xml_comment (); - else if (doc_state == XmlCommentState.NotAllowed) - WarningMisplacedComment (Location - 3); - } - } else { - if (xml_comment_buffer.Length > 0) - doc_state = XmlCommentState.NotAllowed; - } - } - - ReadToEndOfLine (); - - any_token_seen |= tokens_seen; - tokens_seen = false; - comments_seen = false; - continue; - } else if (d == '*'){ - get_char (); - bool docAppend = false; - if (doc_processing && peek_char () == '*') { - get_char (); - // But when it is /**/, just do nothing. - if (peek_char () == '/') { - get_char (); - continue; - } - if (doc_state == XmlCommentState.Allowed) - docAppend = true; - else if (doc_state == XmlCommentState.NotAllowed) { - WarningMisplacedComment (Location - 2); - } - } - - int current_comment_start = 0; - if (docAppend) { - current_comment_start = xml_comment_buffer.Length; - xml_comment_buffer.Append (Environment.NewLine); - } - - while ((d = get_char ()) != -1){ - if (d == '*' && peek_char () == '/'){ - get_char (); - comments_seen = true; - break; - } - if (docAppend) - xml_comment_buffer.Append ((char) d); - - if (d == '\n' || d == UnicodeLS || d == UnicodePS){ - any_token_seen |= tokens_seen; - tokens_seen = false; - // - // Reset 'comments_seen' just to be consistent. - // It doesn't matter either way, here. - // - comments_seen = false; - } - } - if (!comments_seen) - Report.Error (1035, Location, "End-of-file found, '*/' expected"); - - if (docAppend) - update_formatted_doc_comment (current_comment_start); - continue; - } - val = ltb.Create (current_source, ref_line, col); - return Token.DIV; - - case '%': - val = ltb.Create (current_source, ref_line, col); - if (peek_char () == '='){ - get_char (); - return Token.OP_MOD_ASSIGN; - } - return Token.PERCENT; - - case '^': - val = ltb.Create (current_source, ref_line, col); - if (peek_char () == '='){ - get_char (); - return Token.OP_XOR_ASSIGN; - } - return Token.CARRET; - - case ':': - val = ltb.Create (current_source, ref_line, col); - if (peek_char () == ':') { - get_char (); - return Token.DOUBLE_COLON; - } - return Token.COLON; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - tokens_seen = true; - return is_number (c, false); - - case '\n': // white space - case UnicodeLS: - case UnicodePS: - any_token_seen |= tokens_seen; - tokens_seen = false; - comments_seen = false; - continue; - - case '.': - tokens_seen = true; - d = peek_char (); - if (d >= '0' && d <= '9') - return is_number (c, true); - - ltb.CreateOptional (current_source, ref_line, col, ref val); - return Token.DOT; - - case '#': - if (tokens_seen || comments_seen) { - Eror_WrongPreprocessorLocation (); - return Token.ERROR; - } - - if (ParsePreprocessingDirective (true)) - continue; - - bool directive_expected = false; - while ((c = get_char ()) != -1) { - if (col == 1) { - directive_expected = true; - } else if (!directive_expected) { - // TODO: Implement comment support for disabled code and uncomment this code -// if (c == '#') { -// Eror_WrongPreprocessorLocation (); -// return Token.ERROR; -// } - continue; - } - - if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v' || c == UnicodeLS || c == UnicodePS) - continue; - - if (c == '#') { - if (ParsePreprocessingDirective (false)) - break; - } - directive_expected = false; - } - - if (c != -1) { - tokens_seen = false; - continue; - } - - return Token.EOF; - - case '"': - if (parsing_string_interpolation > 0 && !ScanClosingInterpolationBrace ()) { - parsing_string_interpolation = 0; - Report.Error (8076, Location, "Missing close delimiter `}' for interpolated expression"); - val = new StringLiteral (context.BuiltinTypes, "", Location); - return Token.INTERPOLATED_STRING_END; - } - - return consume_string (false); - - case '\'': - return TokenizeBackslash (); - - case '@': - c = get_char (); - if (c == '"') { - tokens_seen = true; - return consume_string (true); - } - - if (is_identifier_start_character (c)){ - return consume_identifier (c, true); - } - - Report.Error (1646, Location, "Keyword, identifier, or string expected after verbatim specifier: @"); - return Token.ERROR; - - case '$': - switch (peek_char ()) { - case '"': - get_char (); - return TokenizeInterpolatedString (false); - case '@': - get_char (); - if (peek_char () == '"') { - get_char (); - return TokenizeInterpolatedString (true); - } - - break; - } - - break; - case EvalStatementParserCharacter: - return Token.EVAL_STATEMENT_PARSER; - case EvalCompilationUnitParserCharacter: - return Token.EVAL_COMPILATION_UNIT_PARSER; - case EvalUsingDeclarationsParserCharacter: - return Token.EVAL_USING_DECLARATIONS_UNIT_PARSER; - case DocumentationXref: - return Token.DOC_SEE; - } - - if (is_identifier_start_character (c)) { - tokens_seen = true; - return consume_identifier (c); - } - - if (char.IsWhiteSpace ((char) c)) - continue; - - Report.Error (1056, Location, "Unexpected character `{0}'", ((char) c).ToString ()); - } - - if (CompleteOnEOF){ - if (generated) - return Token.COMPLETE_COMPLETION; - - generated = true; - return Token.GENERATE_COMPLETION; - } - - - return Token.EOF; - } - - int TokenizeBackslash () - { -#if FULL_AST - int read_start = reader.Position; -#endif - Location start_location = Location; - int c = get_char (); - tokens_seen = true; - if (c == '\'') { - val = new CharLiteral (context.BuiltinTypes, (char) c, start_location); - Report.Error (1011, start_location, "Empty character literal"); - return Token.LITERAL; - } - - if (c == '\n' || c == UnicodeLS || c == UnicodePS) { - Report.Error (1010, start_location, "Newline in constant"); - return Token.ERROR; - } - - int d; - c = escape (c, out d); - if (c == -1) - return Token.ERROR; - if (d != 0) - throw new NotImplementedException (); - - ILiteralConstant res = new CharLiteral (context.BuiltinTypes, (char) c, start_location); - val = res; - c = get_char (); - - if (c != '\'') { - Report.Error (1012, start_location, "Too many characters in character literal"); - - // Try to recover, read until newline or next "'" - while ((c = get_char ()) != -1) { - if (c == '\n' || c == '\'' || c == UnicodeLS || c == UnicodePS) - break; - } - } - -#if FULL_AST - res.ParsedValue = reader.ReadChars (read_start - 1, reader.Position); -#endif - - return Token.LITERAL; - } - - int TokenizeLessThan () - { - int d; - - if (current_token != Token.OPERATOR) { - // Save current position and parse next token. - PushPosition (); - int generic_dimension = 0; - if (parse_less_than (ref generic_dimension)) { - if (parsing_generic_declaration && (parsing_generic_declaration_doc || token () != Token.DOT)) { - d = Token.OP_GENERICS_LT_DECL; - } else { - if (generic_dimension > 0) { - val = generic_dimension; - DiscardPosition (); - return Token.GENERIC_DIMENSION; - } - - d = Token.OP_GENERICS_LT; - } - PopPosition (); - return d; - } - - PopPosition (); - } - - parsing_generic_less_than = 0; - - d = peek_char (); - if (d == '<') { - get_char (); - d = peek_char (); - - if (d == '=') { - get_char (); - return Token.OP_SHIFT_LEFT_ASSIGN; - } - return Token.OP_SHIFT_LEFT; - } - - if (d == '=') { - get_char (); - return Token.OP_LE; - } - return Token.OP_LT; - } - - int TokenizeInterpolatedString (bool quoted) - { - int pos = 0; - var start_location = Location; - - while (true) { - var ch = get_char (); - switch (ch) { - case '"': - if (quoted && peek_char () == '"') { - get_char (); - break; - } - - val = new StringLiteral (context.BuiltinTypes, CreateStringFromBuilder (pos), start_location); - return Token.INTERPOLATED_STRING_END; - case '{': - if (peek_char () == '{') { - value_builder [pos++] = (char)ch; - get_char (); - break; - } - - ++parsing_string_interpolation; - if (quoted) { - if (parsing_string_interpolation_quoted == null) - parsing_string_interpolation_quoted = new Stack (); - } - - if (parsing_string_interpolation_quoted != null) { - parsing_string_interpolation_quoted.Push (quoted); - } - - val = new StringLiteral (context.BuiltinTypes, CreateStringFromBuilder (pos), start_location); - return Token.INTERPOLATED_STRING; - case '\\': - if (quoted) - break; - - ++col; - int surrogate; - ch = escape (ch, out surrogate); - if (ch == -1) - return Token.ERROR; - - if (ch == '{' || ch == '}') { - Report.Error (8087, Location, "A `{0}' character may only be escaped by doubling `{0}{0}' in an interpolated string", ((char) ch).ToString ()); - } - - if (surrogate != 0) { - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder [pos++] = (char)ch; - ch = surrogate; - } - - break; - case -1: - return Token.EOF; - } - - ++col; - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder[pos++] = (char) ch; - } - } - - int TokenizeInterpolationFormat () - { - int pos = 0; - int braces = 0; - while (true) { - var ch = get_char (); - switch (ch) { - case '{': - ++braces; - break; - case '}': - if (braces == 0) { - putback_char = ch; - if (pos == 0) { - Report.Error (8089, Location, "Empty interpolated expression format specifier"); - } else if (Array.IndexOf (simple_whitespaces, value_builder [pos - 1]) >= 0) { - Report.Error (8088, Location, "A interpolated expression format specifier may not contain trailing whitespace"); - } - - val = CreateStringFromBuilder (pos); - return Token.LITERAL; - } - - --braces; - break; - case '\\': - if (parsing_string_interpolation_quoted != null && parsing_string_interpolation_quoted.Peek ()) - break; - - ++col; - int surrogate; - ch = escape (ch, out surrogate); - if (ch == -1) - return Token.ERROR; - - if (ch == '{' || ch == '}') { - Report.Error (8087, Location, "A `{0}' character may only be escaped by doubling `{0}{0}' in an interpolated string", ((char) ch).ToString ()); - } - - if (surrogate != 0) { - if (pos == value_builder.Length) - Array.Resize (ref value_builder, pos * 2); - - value_builder [pos++] = (char)ch; - ch = surrogate; - } - - break; - case -1: - return Token.EOF; - } - - ++col; - value_builder[pos++] = (char) ch; - } - } - - string CreateStringFromBuilder (int pos) - { - if (pos == 0) - return string.Empty; - if (pos <= 4) - return InternIdentifier (value_builder, pos); - - return new string (value_builder, 0, pos); - } - - // - // Handles one line xml comment - // - private void handle_one_line_xml_comment () - { - int c; - while ((c = peek_char ()) != -1 && c != '\n' && c != '\r') { - xml_comment_buffer.Append ((char) get_char ()); - } - if (c == '\r' || c == '\n') - xml_comment_buffer.Append (Environment.NewLine); - } - - // - // Remove heading "*" in Javadoc-like xml documentation. - // - private void update_formatted_doc_comment (int current_comment_start) - { - int length = xml_comment_buffer.Length - current_comment_start; - string [] lines = xml_comment_buffer.ToString ( - current_comment_start, - length).Replace ("\r", "").Split ('\n'); - - // The first line starts with /**, thus it is not target - // for the format check. - for (int i = 1; i < lines.Length; i++) { - string s = lines [i]; - int idx = s.IndexOf ('*'); - string head = null; - if (idx < 0) { - if (i < lines.Length - 1) - return; - head = s; - } else - head = s.Substring (0, idx); - foreach (char c in head) - if (c != ' ') - return; - lines [i] = s.Substring (idx + 1); - } - xml_comment_buffer.Remove (current_comment_start, length); - xml_comment_buffer.Insert (current_comment_start, String.Join (Environment.NewLine, lines)); - } - - // - // Checks if there was incorrect doc comments and raise - // warnings. - // - public void check_incorrect_doc_comment () - { - if (xml_comment_buffer.Length > 0) - WarningMisplacedComment (Location); - } - - // - // Consumes the saved xml comment lines (if any) - // as for current target member or type. - // - public string consume_doc_comment () - { - if (xml_comment_buffer.Length > 0) { - string ret = xml_comment_buffer.ToString (); - reset_doc_comment (); - return ret; - } - return null; - } - - void reset_doc_comment () - { - xml_comment_buffer.Length = 0; - } - - public void cleanup () - { - if (ifstack != null && ifstack.Count >= 1) { - int state = ifstack.Pop (); - if ((state & REGION) != 0) - Report.Error (1038, Location, "#endregion directive expected"); - else - Report.Error (1027, Location, "Expected `#endif' directive"); - } - } - } - - // - // Indicates whether it accepts XML documentation or not. - // - public enum XmlCommentState { - // comment is allowed in this state. - Allowed, - // comment is not allowed in this state. - NotAllowed, - // once comments appeared when it is NotAllowed, then the - // state is changed to it, until the state is changed to - // .Allowed. - Error - } -} - diff --git a/mcs/mcs/cs-tokenizer.cs.REMOVED.git-id b/mcs/mcs/cs-tokenizer.cs.REMOVED.git-id new file mode 100644 index 0000000000..c41c02cf8f --- /dev/null +++ b/mcs/mcs/cs-tokenizer.cs.REMOVED.git-id @@ -0,0 +1 @@ +b4a6a6a1dd58a51dfde5b14b6b6e8af4566850c0 \ No newline at end of file diff --git a/mcs/mcs/ecore.cs.REMOVED.git-id b/mcs/mcs/ecore.cs.REMOVED.git-id index 612714b122..6e5de5b827 100644 --- a/mcs/mcs/ecore.cs.REMOVED.git-id +++ b/mcs/mcs/ecore.cs.REMOVED.git-id @@ -1 +1 @@ -20ee9e73b19c3cf415315fbd67fcaeb787ac8ef6 \ No newline at end of file +d5926bf4d1fd0a84786d6b60a31d8e934a1d2074 \ 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 2bd3500fe9..a3570288cf 100644 --- a/mcs/mcs/expression.cs.REMOVED.git-id +++ b/mcs/mcs/expression.cs.REMOVED.git-id @@ -1 +1 @@ -518ccc8ef43fb3e1a0902069579690ac6875696a \ No newline at end of file +dbbd59d35a37f994500804a0be64e0f2198832ea \ No newline at end of file diff --git a/mcs/mcs/modifiers.cs b/mcs/mcs/modifiers.cs index 926ab5d184..21dd52b3b1 100644 --- a/mcs/mcs/modifiers.cs +++ b/mcs/mcs/modifiers.cs @@ -74,6 +74,8 @@ namespace Mono.CSharp return "internal"; case Modifiers.PRIVATE: return "private"; + case Modifiers.PRIVATE | Modifiers.PROTECTED: + return "private protected"; default: throw new NotImplementedException (mod.ToString ()); } @@ -129,12 +131,16 @@ namespace Mono.CSharp if ((modB & Modifiers.PUBLIC) != 0) { flags = Modifiers.PROTECTED | Modifiers.INTERNAL | Modifiers.PRIVATE; } else if ((modB & Modifiers.PROTECTED) != 0) { - if ((modB & Modifiers.INTERNAL) != 0) - flags = Modifiers.PROTECTED | Modifiers.INTERNAL; - - flags |= Modifiers.PRIVATE; - } else if ((modB & Modifiers.INTERNAL) != 0) + if ((modB & Modifiers.INTERNAL) != 0) { + flags = Modifiers.PROTECTED | Modifiers.INTERNAL | Modifiers.PRIVATE; + } else { + modA &= ~Modifiers.PROTECTED; + flags = Modifiers.PRIVATE; + } + } else if ((modB & Modifiers.INTERNAL) != 0) { + modA &= ~Modifiers.PROTECTED; flags = Modifiers.PRIVATE; + } return modB != modA && (modA & (~flags)) == 0; } @@ -151,6 +157,8 @@ namespace Mono.CSharp } else { if ((mod_flags & Modifiers.PUBLIC) != 0) t = TypeAttributes.NestedPublic; + else if ((mod_flags & (Modifiers.PROTECTED | Modifiers.PRIVATE)) == (Modifiers.PROTECTED | Modifiers.PRIVATE)) + t = TypeAttributes.NestedFamANDAssem; else if ((mod_flags & Modifiers.PRIVATE) != 0) t = TypeAttributes.NestedPrivate; else if ((mod_flags & (Modifiers.PROTECTED | Modifiers.INTERNAL)) == (Modifiers.PROTECTED | Modifiers.INTERNAL)) @@ -173,18 +181,27 @@ namespace Mono.CSharp { FieldAttributes fa = 0; - if ((mod_flags & Modifiers.PUBLIC) != 0) + switch (mod_flags & Modifiers.AccessibilityMask) { + case Modifiers.PUBLIC: fa |= FieldAttributes.Public; - if ((mod_flags & Modifiers.PRIVATE) != 0) + break; + case Modifiers.PRIVATE: fa |= FieldAttributes.Private; - if ((mod_flags & Modifiers.PROTECTED) != 0) { - if ((mod_flags & Modifiers.INTERNAL) != 0) - fa |= FieldAttributes.FamORAssem; - else - fa |= FieldAttributes.Family; - } else { - if ((mod_flags & Modifiers.INTERNAL) != 0) - fa |= FieldAttributes.Assembly; + break; + case Modifiers.PROTECTED | Modifiers.INTERNAL: + fa |= FieldAttributes.FamORAssem; + break; + case Modifiers.PROTECTED: + fa |= FieldAttributes.Family; + break; + case Modifiers.INTERNAL: + fa |= FieldAttributes.Assembly; + break; + case Modifiers.PRIVATE | Modifiers.PROTECTED: + fa |= FieldAttributes.FamANDAssem; + break; + default: + throw new NotImplementedException (mod_flags.ToString ()); } if ((mod_flags & Modifiers.STATIC) != 0) @@ -215,6 +232,9 @@ namespace Mono.CSharp case Modifiers.INTERNAL: ma |= MethodAttributes.Assembly; break; + case Modifiers.PRIVATE | Modifiers.PROTECTED: + ma |= MethodAttributes.FamANDAssem; + break; default: throw new NotImplementedException (mod_flags.ToString ()); } diff --git a/mcs/mcs/parameter.cs b/mcs/mcs/parameter.cs index cc10eee162..99e8e11934 100644 --- a/mcs/mcs/parameter.cs +++ b/mcs/mcs/parameter.cs @@ -1474,9 +1474,9 @@ namespace Mono.CSharp { } } - if (!expr.IsNull && TypeSpec.IsReferenceType (parameter_type) && parameter_type.BuiltinType != BuiltinTypeSpec.Type.String) { + if (!res.IsNull && TypeSpec.IsReferenceType (parameter_type) && parameter_type.BuiltinType != BuiltinTypeSpec.Type.String) { rc.Report.Error (1763, Location, - "Optional parameter `{0}' of type `{1}' can only be initialized with `null'", + "Optional parameter `{0}' of type `{1}' can only be initialized with default value", p.Name, parameter_type.GetSignatureForError ()); return; diff --git a/mcs/mcs/tuples.cs b/mcs/mcs/tuples.cs index 901efdc954..15a2ca5b0d 100644 --- a/mcs/mcs/tuples.cs +++ b/mcs/mcs/tuples.cs @@ -594,6 +594,7 @@ namespace Mono.CSharp public override void FlowAnalysis (FlowAnalysisContext fc) { + source.FlowAnalysis (fc); foreach (var expr in targetExprs) expr.FlowAnalysis (fc); } diff --git a/mcs/packages/Makefile b/mcs/packages/Makefile index 8eb7c3a5e6..f8a3d82423 100644 --- a/mcs/packages/Makefile +++ b/mcs/packages/Makefile @@ -28,6 +28,8 @@ ROSLYN_FILES_TO_COPY_FOR_MSBUILD = \ $(ROSLYN_CSC_DIR)/Microsoft.CSharp.Core.targets \ $(ROSLYN_CSC_DIR)/Microsoft.VisualBasic.Core.targets +ROSLYN_DIM_FILES = $(topdir)/../external/roslyn-binaries/Prototypes/DefaultInterfaceImplementation/* + DISTFILES = $(ROSLYN_FILES_FOR_MONO) $(ROSLYN_FILES_TO_COPY_FOR_MSBUILD) csi-test.csx ifeq ($(PROFILE), $(DEFAULT_PROFILE)) @@ -35,7 +37,7 @@ ifeq ($(PROFILE), $(DEFAULT_PROFILE)) TARGET_DIR = $(DESTDIR)$(mono_libdir)/mono/$(FRAMEWORK_VERSION) MSBUILD_ROSLYN_DIR = $(DESTDIR)$(mono_libdir)/mono/msbuild/15.0/bin/Roslyn -install-local: +install-local: install-prototypes $(MKINSTALLDIRS) $(TARGET_DIR) $(INSTALL_LIB) $(ROSLYN_FILES_FOR_MONO) $(TARGET_DIR) $(MKINSTALLDIRS) $(MSBUILD_ROSLYN_DIR) @@ -43,6 +45,10 @@ install-local: (cd $(MSBUILD_ROSLYN_DIR); for asm in $(ROSLYN_FILES_FOR_MONO); do ln -fs ../../../../$(FRAMEWORK_VERSION)/$$(basename $$asm) . ; done) +install-prototypes: + $(MKINSTALLDIRS) $(TARGET_DIR)/dim + $(INSTALL_LIB) $(ROSLYN_DIM_FILES) $(TARGET_DIR)/dim + run-test-local: test-csi test-csi: diff --git a/mcs/tests/gtest-647.cs b/mcs/tests/gtest-647.cs new file mode 100644 index 0000000000..4aae641f85 --- /dev/null +++ b/mcs/tests/gtest-647.cs @@ -0,0 +1,34 @@ +using System; + +public class Program +{ + public static int Main () + { + int B = default (MyStruct?); + if (MyStruct.counter != 1) + return 1; + + switch (default (MyStruct?)) { + case 0: + break; + default: + return 2; + } + + if (MyStruct.counter != 2) + return 4; + + return 0; + } + + public struct MyStruct + { + public static int counter; + + public static implicit operator int (MyStruct? s) + { + ++counter; + return 0; + } + } +} \ No newline at end of file diff --git a/mcs/tests/known-issues-interp-net_4_x b/mcs/tests/known-issues-interp-net_4_x index 9139c646a0..d4a03dc968 100644 --- a/mcs/tests/known-issues-interp-net_4_x +++ b/mcs/tests/known-issues-interp-net_4_x @@ -19,5 +19,3 @@ test-404.cs test-704.cs test-811.cs test-async-17.cs -test-ref-08.cs IGNORE -test-ref-09.cs IGNORE diff --git a/mcs/tests/test-948.cs b/mcs/tests/test-948.cs index 34b3ab9a0c..563e37dc7d 100644 --- a/mcs/tests/test-948.cs +++ b/mcs/tests/test-948.cs @@ -1,4 +1,4 @@ -// Compiler options: -langversion:7.2 -unsafe +// Compiler options: -langversion:7.2 /unsafe using System; @@ -7,10 +7,16 @@ class X public static void Main () { Span stackSpan = stackalloc int[100]; + + bool b = false; + + var r1 = !b ? stackalloc char[1] : throw null; + var r2 = b ? throw null : stackalloc char[1]; + var r3 = b ? stackalloc char[1] : stackalloc char[2]; } + // Disables verifier unsafe void Foo () { - } -} \ No newline at end of file +} diff --git a/mcs/tests/test-950.cs b/mcs/tests/test-950.cs new file mode 100644 index 0000000000..6ac11babea --- /dev/null +++ b/mcs/tests/test-950.cs @@ -0,0 +1,12 @@ +using System; + +public class B +{ + public static void Main () + { + int a = 1_0_3; + double b = 0__0e+1_1; + int c = 0b__1_0; + int d = 0x__F_0; + } +} \ No newline at end of file diff --git a/mcs/tests/test-960.cs b/mcs/tests/test-960.cs new file mode 100644 index 0000000000..ac2a1ca743 --- /dev/null +++ b/mcs/tests/test-960.cs @@ -0,0 +1,20 @@ +// Compiler options: -langversion:7.2 + +public class B +{ + private protected enum E + { + } + + public int Index { get; protected private set; } + + internal string S1 { get; private protected set; } + + protected string S2 { get; private protected set; } + + private protected int field; + + public static void Main () + { + } +} \ No newline at end of file diff --git a/mcs/tests/test-binaryliteral.cs b/mcs/tests/test-binaryliteral.cs new file mode 100644 index 0000000000..3d9cc89bcb --- /dev/null +++ b/mcs/tests/test-binaryliteral.cs @@ -0,0 +1,57 @@ + +class Demo { + static int Main () + { + if (0b1 != 1) + return 1; + var hex1 = 0x123ul; + var bin1 = 0b100100011ul; + var bin11 = 0b100100011lu; + if (hex1 != bin1) + return 2; + if (hex1 != bin11) + return 3; + if (hex1.GetType () != bin1.GetType ()) + return 4; + if (hex1.GetType () != bin11.GetType ()) + return 5; + + var hex2 = 0x7FFFFFFF; + var bin2 = 0b1111111111111111111111111111111; + + if (hex2 != bin2) + return 6; + if (hex2.GetType () != bin2.GetType ()) + return 7; + + var hex3 = 0xFFFFFFFF; + var bin3 = 0b11111111111111111111111111111111; + if (hex3 != bin3) + return 8; + if (hex3.GetType () != bin3.GetType ()) + return 9; + + var hex4 = 0xFFFFFFFFu; + var bin4 = 0b11111111111111111111111111111111u; + if (hex4 != bin4) + return 10; + if (hex4.GetType () != bin4.GetType ()) + return 11; + + var hex5 = 0x7FFFFFFFFFFFFFFF; + var bin5 = 0b111111111111111111111111111111111111111111111111111111111111111; + if (hex5 != bin5) + return 12; + if (hex5.GetType () != bin5.GetType ()) + return 13; + + var hex6 = 0xFFFFFFFFFFFFFFFF; + var bin6 = 0b1111111111111111111111111111111111111111111111111111111111111111; + if (hex6 != bin6) + return 14; + if (hex6.GetType () != bin6.GetType ()) + return 15; + + return 0; + } +} \ No newline at end of file diff --git a/mcs/tests/test-decl-expr-06.cs b/mcs/tests/test-decl-expr-06.cs new file mode 100644 index 0000000000..9734f2ec2a --- /dev/null +++ b/mcs/tests/test-decl-expr-06.cs @@ -0,0 +1,17 @@ +using System; + +public class C +{ + Func f = () => Foo (out int arg); + + static bool Foo (out int arg) + { + arg = 2; + return false; + } + + public static void Main () + { + new C (); + } +} \ No newline at end of file diff --git a/mcs/tests/test-default-01.cs b/mcs/tests/test-default-01.cs index 823e33c451..28aff830cd 100644 --- a/mcs/tests/test-default-01.cs +++ b/mcs/tests/test-default-01.cs @@ -41,7 +41,11 @@ static class X static System.Func M4 () { return () => default; - } + } + + static void Foo (II a = default (II), II b = default, II c = (II) null) + { + } } /* enum E @@ -49,4 +53,10 @@ enum E A = default, B = default + 1 } -*/ \ No newline at end of file +*/ + + +interface II +{ + +} \ No newline at end of file diff --git a/mcs/tests/test-pattern-13.cs b/mcs/tests/test-pattern-13.cs new file mode 100644 index 0000000000..315c7a9e4b --- /dev/null +++ b/mcs/tests/test-pattern-13.cs @@ -0,0 +1,19 @@ +using System; + +class C : B +{ + +} + +public class B +{ + public static void Main () + { + C c = new C (); + + if (c is B b) + { + Console.WriteLine (b == null); + } + } +} \ No newline at end of file diff --git a/mcs/tests/test-ref-11.cs b/mcs/tests/test-ref-11.cs new file mode 100644 index 0000000000..8d392a77d0 --- /dev/null +++ b/mcs/tests/test-ref-11.cs @@ -0,0 +1,13 @@ +class Program +{ + static int x; + static int y; + + public static int Main () + { + bool b = false; + ref int targetBucket = ref b ? ref x : ref y; + + return 0; + } +} \ No newline at end of file diff --git a/mcs/tests/test-tuple-08.cs b/mcs/tests/test-tuple-08.cs new file mode 100644 index 0000000000..fd3375b4df --- /dev/null +++ b/mcs/tests/test-tuple-08.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +class X +{ + public static void Main () + { + var x = new X (); + x.Test ().Wait (); + } + + int a, b; + + async Task Test () + { + (a, b) = await Waiting (); + } + + Task<(int, int)> Waiting () + { + return Task.FromResult ((1, 3)); + } +} \ 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 29a9cd22b4..d655468296 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 @@ -4dbc7042a8a8252f26b40788a5460fbf138e5b46 \ No newline at end of file +b9f7e8f159b0400a597cc46e59c1ab2f32b9d4e8 \ No newline at end of file diff --git a/mcs/tools/linker-analyzer/ConsoleDependencyGraph.cs b/mcs/tools/linker-analyzer/ConsoleDependencyGraph.cs deleted file mode 100644 index a778ffd859..0000000000 --- a/mcs/tools/linker-analyzer/ConsoleDependencyGraph.cs +++ /dev/null @@ -1,146 +0,0 @@ -// -// ConsoleDependencyGraph.cs: text output related code for dependency graph -// -// Author: -// Radek Doulik (rodo@xamarin.com) -// -// Copyright 2015 Xamarin Inc (http://www.xamarin.com). -// -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using LinkerAnalyzer.Core; - -namespace LinkerAnalyzer -{ - public class ConsoleDependencyGraph : DependencyGraph - { - public bool Tree = false; - - public void ShowDependencies (string raw, List verticesList, string searchString) - { - VertexData vertex = Vertex (raw); - if (vertex == null) { - Regex regex = new Regex (searchString); - int count = 0; - - foreach (var v in verticesList) { - if (regex.Match (v.value) != Match.Empty) { - ShowDependencies (v); - count++; - } - } - - if (count == 0) - Console.WriteLine ("\nUnable to find vertex: {0}", raw); - else - Console.WriteLine ("\nFound {0} matches", count); - } else - ShowDependencies (vertex); - } - - public void ShowDependencies (VertexData vertex) - { - Header ("{0} dependencies", vertex.value); - if (vertex.parentIndexes == null) { - Console.WriteLine ("Root dependency"); - } else { - int i = 0; - foreach (int index in vertex.parentIndexes) { - Console.WriteLine ("Dependency #{0}", ++i); - Console.WriteLine ("\t{0}", vertex.value); - var childVertex = Vertex (index); - Console.WriteLine ("\t| {0}{1}", childVertex.value, childVertex.DepsCount); - while (childVertex.parentIndexes != null) { - childVertex = Vertex (childVertex.parentIndexes [0]); - Console.WriteLine ("\t| {0}{1}", childVertex.value, childVertex.DepsCount); - } - if (Tree) - break; - } - } - } - - public void ShowAllDependencies () - { - Header ("All dependencies"); - Console.WriteLine ("Types count: {0}", vertices.Count); - foreach (var vertex in vertices) - ShowDependencies (vertex); - } - - public void ShowTypesDependencies () - { - Header ("All types dependencies"); - Console.WriteLine ("Deps count: {0}", Types.Count); - foreach (var type in Types) - ShowDependencies (type); - } - - string Tabs (string key) - { - int count = Math.Max (1, 2 - key.Length / 8); - - if (count == 1) - return "\t"; - else - return "\t\t"; - } - - public void ShowStat (bool verbose = false) - { - Header ("Statistics"); - if (verbose) { - foreach (var key in counts.Keys) - Console.WriteLine ("Vertex type:\t{0}{1}count:{2}", key, Tabs (key), counts [key]); - } else { - Console.WriteLine ("Assemblies:\t{0}", counts ["Assembly"]); - Console.WriteLine ("Modules:\t{0}", counts ["Module"]); - Console.WriteLine ("Types:\t\t{0}", counts ["TypeDef"]); - Console.WriteLine ("Fields:\t\t{0}", counts ["Field"]); - Console.WriteLine ("Methods:\t{0}", counts ["Method"]); - } - - Console.WriteLine (); - Console.WriteLine ("Total vertices: {0}", vertices.Count); - } - - public void ShowRoots () - { - Header ("Root vertices"); - - int count = 0; - foreach (var vertex in vertices) { - if (vertex.parentIndexes == null) { - Console.WriteLine ("{0}", vertex.value); - count++; - } - } - - Console.WriteLine (); - Console.WriteLine ("Total root vertices: {0}", count); - } - - public void ShowRawDependencies (string raw) - { - Header ("Raw dependencies: '{0}'", raw); - ShowDependencies (raw, vertices, raw); - } - - public void ShowTypeDependencies (string raw) - { - Header ("Type dependencies: '{0}'", raw); - ShowDependencies ("TypeDef:" + raw, Types, raw); - } - - void Header (string header, params object[] values) - { - string formatted = string.Format (header, values); - Console.WriteLine (); - Console.Write ("--- {0} ", formatted); - for (int i=0; i< Math.Max (3, 64 - formatted.Length); i++) - Console.Write ('-'); - Console.WriteLine (); - } - } -} diff --git a/mcs/tools/linker-analyzer/LinkerAnalyzerCore/DependencyGraph.cs b/mcs/tools/linker-analyzer/LinkerAnalyzerCore/DependencyGraph.cs deleted file mode 100644 index ed42e8d141..0000000000 --- a/mcs/tools/linker-analyzer/LinkerAnalyzerCore/DependencyGraph.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -// DependencyGraph.cs: linker dependencies graph -// -// Author: -// Radek Doulik (rodo@xamarin.com) -// -// Copyright 2015 Xamarin Inc (http://www.xamarin.com). -// -using System; -using System.Collections.Generic; -using System.IO; -using System.IO.Compression; -using System.Xml; - -namespace LinkerAnalyzer.Core -{ - public class VertexData { - public string value; - public List parentIndexes; - public int index; - - public string DepsCount { - get { - if (parentIndexes == null || parentIndexes.Count < 1) - return ""; - return string.Format (" [{0} deps]", parentIndexes.Count); - } - } - }; - - public class DependencyGraph - { - protected List vertices = new List (); - public List Types = new List (); - Dictionary indexes = new Dictionary (); - protected Dictionary counts = new Dictionary (); - - public void Load (string filename) - { - Console.WriteLine ("Loading dependency tree from: {0}", filename); - - try { - using (var fileStream = File.OpenRead (filename)) - using (var zipStream = new GZipStream (fileStream, CompressionMode.Decompress)) { - Load (zipStream); - } - } catch (Exception) { - Console.WriteLine ("Unable to open and read the dependecies."); - Environment.Exit (1); - } - } - - void Load (GZipStream zipStream) { - using (XmlReader reader = XmlReader.Create (zipStream)) { - while (reader.Read ()) { - switch (reader.NodeType) { - case XmlNodeType.Element: - //Console.WriteLine (reader.Name); - if (reader.Name == "edge" && reader.IsStartElement ()) { - string b = reader.GetAttribute ("b"); - string e = reader.GetAttribute ("e"); - //Console.WriteLine ("edge value " + b + " --> " + e); - - if (e != b) { - VertexData begin = Vertex (b, true); - VertexData end = Vertex (e, true); - - if (end.parentIndexes == null) - end.parentIndexes = new List (); - if (!end.parentIndexes.Contains (begin.index)) { - end.parentIndexes.Add (begin.index); - //Console.WriteLine (" end parent index: {0}", end.parentIndexes); - } - } - } - break; - default: - //Console.WriteLine ("node: " + reader.NodeType); - break; - } - } - } - } - - public VertexData Vertex (string vertexName, bool create = false) - { - VertexData vertex; - - try { - vertex = vertices [indexes [vertexName]]; - } catch (KeyNotFoundException) { - if (create) { - int index = vertices.Count; - vertex = new VertexData () { value = vertexName, index = index }; - vertices.Add (vertex); - indexes.Add (vertexName, index); - string prefix = vertexName.Substring (0, vertexName.IndexOf (':')); - if (counts.ContainsKey (prefix)) - counts [prefix]++; - else - counts [prefix] = 1; - //Console.WriteLine ("prefix " + prefix + " count " + counts[prefix]); - if (prefix == "TypeDef") { - Types.Add (vertex); - } - } else - return null; - } - - return vertex; - } - - public VertexData Vertex (int index) - { - return vertices [index]; - } - } -} diff --git a/mcs/tools/linker-analyzer/Main.cs b/mcs/tools/linker-analyzer/Main.cs deleted file mode 100644 index 5c75ba5c86..0000000000 --- a/mcs/tools/linker-analyzer/Main.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -// Main.cs: Main program file of command line utility. -// -// Author: -// Radek Doulik (rodo@xamarin.com) -// -// Copyright 2015 Xamarin Inc (http://www.xamarin.com). -// -using System; -using Mono.Options; -using LinkerAnalyzer.Core; - -namespace LinkerAnalyzer -{ - static class MainClass - { - static void Main (string[] args) - { - bool showUsage = true; - bool showAllDeps = false; - bool showTypeDeps = false; - string typeName = null; - bool showRawDeps = false; - string rawName = null; - bool showRoots = false; - bool showSpaceUsage = false; - bool showStat = false; - bool showTypes = false; - bool reduceToTree = false; - bool verbose = false; - - var optionsParser = new OptionSet () { - { "a|alldeps", "show all dependencies", v => { showAllDeps = v != null; } }, - { "h|help", "show this message and exit.", v => showUsage = v != null }, - { "r|rawdeps=", "show raw vertex dependencies. Raw vertex VALUE is in the raw format written by linker to the dependency XML file. VALUE can be regular expression", v => { showRawDeps = v != null; rawName = v; } }, - { "roots", "show root dependencies.", v => showRoots = v != null }, - { "stat", "show statistic of loaded dependencies.", v => showStat = v != null }, - { "tree", "reduce the dependency graph to the tree.", v => reduceToTree = v != null }, - { "types", "show all types dependencies.", v => showTypes = v != null }, - { "t|typedeps=", "show type dependencies. The VALUE can be regular expression", v => { showTypeDeps = v != null; typeName = v; } }, - //{ "u|spaceusage", "show space analysis.", v => showSpaceUsage = v != null }, - { "v|verbose", "be more verbose. Enables stat and roots options.", v => verbose = v != null }, - }; - - if (args.Length > 0) { - showUsage = false; - optionsParser.Parse (args); - } - - if (showUsage) { - Console.WriteLine ("Usage:\n\n\tlinkeranalyzer [Options] \n\nOptions:\n"); - optionsParser.WriteOptionDescriptions (Console.Out); - Console.WriteLine (); - return; - } - - string dependencyFile = args [args.Length - 1]; - - ConsoleDependencyGraph deps = new ConsoleDependencyGraph () { Tree = reduceToTree }; - deps.Load (dependencyFile); - - if (showSpaceUsage) { -// SpaceAnalyzer sa = new SpaceAnalyzer (System.IO.Path.GetDirectoryName (dependencyFile)); -// sa.LoadAssemblies (verbose); - } - - if (verbose) { - showStat = true; - showRoots = true; - } - - if (showStat) - deps.ShowStat (verbose); - if (showRoots) - deps.ShowRoots (); - if (showRawDeps) - deps.ShowRawDependencies (rawName); - if (showTypeDeps) - deps.ShowTypeDependencies (typeName); - if (showAllDeps) - deps.ShowAllDependencies (); - else if (showTypes) - deps.ShowTypesDependencies (); - } - } -} diff --git a/mcs/tools/linker-analyzer/Makefile b/mcs/tools/linker-analyzer/Makefile index 08a3fdc093..ad080b9fbc 100644 --- a/mcs/tools/linker-analyzer/Makefile +++ b/mcs/tools/linker-analyzer/Makefile @@ -2,9 +2,9 @@ thisdir = tools/linker-analyzer SUBDIRS = include ../../build/rules.make -PROGRAM = linkeranalyzer.exe +PROGRAM = illinkanalyzer.exe -LIB_REFS = System System.Xml +LIB_REFS = System System.Xml System.Core Mono.Cecil LOCAL_MCS_FLAGS = include ../../build/executable.make diff --git a/mcs/tools/linker-analyzer/illinkanalyzer.exe.sources b/mcs/tools/linker-analyzer/illinkanalyzer.exe.sources new file mode 100644 index 0000000000..a1079fead1 --- /dev/null +++ b/mcs/tools/linker-analyzer/illinkanalyzer.exe.sources @@ -0,0 +1,4 @@ +../../class/Mono.Options/Mono.Options/Options.cs + +../../../external/linker/analyzer/*.cs +../../../external/linker/analyzer/LinkerAnalyzerCore/*.cs diff --git a/mcs/tools/linker-analyzer/linkeranalyzer.exe.sources b/mcs/tools/linker-analyzer/linkeranalyzer.exe.sources deleted file mode 100644 index 1da8185832..0000000000 --- a/mcs/tools/linker-analyzer/linkeranalyzer.exe.sources +++ /dev/null @@ -1,5 +0,0 @@ -ConsoleDependencyGraph.cs -Main.cs - -LinkerAnalyzerCore/DependencyGraph.cs -../../class/Mono.Options/Mono.Options/Options.cs diff --git a/mcs/tools/linker/Makefile b/mcs/tools/linker/Makefile index b1bfdd1856..d1a63cca8c 100644 --- a/mcs/tools/linker/Makefile +++ b/mcs/tools/linker/Makefile @@ -6,9 +6,10 @@ PROGRAM = monolinker.exe LIB_REFS = System System.Core System.Xml Mono.Cecil -TEST_CASES = \ +TEST_CASES := \ mscorlib/test-array.cs \ - mscorlib/test-remoting.cs + mscorlib/test-remoting.cs \ + System/test-security.cs ifndef AOT_FRIENDLY_PROFILE TEST_CASES += \ @@ -25,6 +26,9 @@ compile-tests: $(TEST_CASES) mscorlib/test-%.cs: $(TESTS_COMPILER) Tests/$@ /out:Tests/$(@:.cs=.exe) +System/test-%.cs: + $(TESTS_COMPILER) -r:$(topdir)/class/lib/$(PROFILE_DIRECTORY)/System.dll Tests/$@ /out:Tests/$(@:.cs=.exe) + run-tests: $(TEST_CASES:.cs=.exe) LINKER_OUTPUT := illink-output-$(PROFILE_DIRECTORY) @@ -34,7 +38,7 @@ TEST_EXEC = MONO_PATH=$(LINKER_OUTPUT) $(RUNTIME) $(RUNTIME_FLAGS) --debug -O=-a .NOTPARALLEL: -mscorlib/test-%.exe: +System/test-%.exe mscorlib/test-%.exe: @rm -rf $(LINKER_OUTPUT) @mkdir $(LINKER_OUTPUT) @echo Testing $@ diff --git a/mcs/tools/linker/monolinker.exe.sources b/mcs/tools/linker/monolinker.exe.sources index 3f7278bfd0..c58f704930 100644 --- a/mcs/tools/linker/monolinker.exe.sources +++ b/mcs/tools/linker/monolinker.exe.sources @@ -24,6 +24,7 @@ ../../../external/linker/linker/Linker.Steps/ResolveFromXmlStep.cs ../../../external/linker/linker/Linker.Steps/SweepStep.cs ../../../external/linker/linker/Linker.Steps/RegenerateGuidStep.cs +../../../external/linker/linker/Linker.Steps/RemoveSecurityStep.cs ../../../external/linker/linker/Linker.Steps/ResolveFromXApiStep.cs ../../../external/linker/linker/Linker.Steps/ResolveFromAssemblyStep.cs ../../../external/linker/linker/Linker.Steps/ResolveStep.cs diff --git a/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/GenericBase`1.xml b/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/GenericBase`1.xml index 0ed561caf3..0b5ad2940b 100644 --- a/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest.Generic/GenericBase`1.xml @@ -85,7 +85,6 @@ , , , - , , , , @@ -93,6 +92,7 @@ , , , + , To be added; from: , @@ -103,7 +103,6 @@ , , , - , , , , @@ -111,6 +110,7 @@ , , , + , To be added; from: , @@ -121,7 +121,6 @@ , , , - , , , , @@ -129,6 +128,7 @@ , , , + , To be added; from: , @@ -139,7 +139,6 @@ , , , - , , , , @@ -147,6 +146,7 @@ , , , + , To be added; from: , @@ -157,7 +157,6 @@ , , , - , , , , @@ -165,6 +164,7 @@ , , , + , To be added; from: , @@ -175,7 +175,6 @@ , , , - , , , , @@ -183,6 +182,7 @@ , , , + , To be added; from: , @@ -193,7 +193,6 @@ , , , - , , , , @@ -201,6 +200,7 @@ , , , + , To be added; from: , @@ -210,7 +210,6 @@ , , , - , , , , @@ -218,6 +217,7 @@ , , , + , To be added; from: , @@ -228,7 +228,6 @@ , , , - , , , , @@ -236,6 +235,7 @@ , , , + , To be added; from: , @@ -246,7 +246,6 @@ , , , - , , , , @@ -254,6 +253,7 @@ , , , + , @@ -276,7 +276,6 @@ , , , - , , , , @@ -284,6 +283,7 @@ , , , + , To be added; from: , @@ -294,7 +294,6 @@ , , , - , , , , @@ -302,6 +301,7 @@ , , , + , To be added; from: , @@ -312,7 +312,6 @@ , , , - , , , , @@ -320,6 +319,7 @@ , , , + , To be added; from: , @@ -330,7 +330,6 @@ , , , - , , , , @@ -338,6 +337,7 @@ , , , + , To be added; from: , @@ -348,7 +348,6 @@ , , , - , , , , @@ -356,6 +355,7 @@ , , , + , To be added; from: , @@ -366,7 +366,6 @@ , , , - , , , , @@ -374,6 +373,7 @@ , , , + , To be added; from: , @@ -384,7 +384,6 @@ , , , - , , , , @@ -392,6 +391,7 @@ , , , + , To be added; from: , @@ -401,7 +401,6 @@ , , , - , , , , @@ -409,6 +408,7 @@ , , , + , To be added; from: , @@ -419,7 +419,6 @@ , , , - , , , , @@ -427,6 +426,7 @@ , , , + , To be added; from: , @@ -437,7 +437,6 @@ , , , - , , , , @@ -445,6 +444,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest/Widget.xml b/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest/Widget.xml index 343e84826c..200ffdb51a 100644 --- a/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest/Widget.xml +++ b/mcs/tools/mdoc/Test/en.expected.delete/Mono.DocTest/Widget.xml @@ -95,7 +95,6 @@ , , , - , , , , @@ -103,6 +102,7 @@ , , , + , To be added; from: , @@ -113,7 +113,6 @@ , , , - , , , , @@ -121,6 +120,7 @@ , , , + , To be added; from: , @@ -131,7 +131,6 @@ , , , - , , , , @@ -139,6 +138,7 @@ , , , + , To be added; from: , @@ -149,7 +149,6 @@ , , , - , , , , @@ -157,6 +156,7 @@ , , , + , To be added; from: , @@ -167,7 +167,6 @@ , , , - , , , , @@ -175,6 +174,7 @@ , , , + , To be added; from: , @@ -185,7 +185,6 @@ , , , - , , , , @@ -193,6 +192,7 @@ , , , + , To be added; from: , @@ -203,7 +203,6 @@ , , , - , , , , @@ -211,6 +210,7 @@ , , , + , To be added; from: , @@ -220,7 +220,6 @@ , , , - , , , , @@ -228,6 +227,7 @@ , , , + , To be added; from: , @@ -238,7 +238,6 @@ , , , - , , , , @@ -246,6 +245,7 @@ , , , + , To be added; from: , @@ -256,7 +256,6 @@ , , , - , , , , @@ -264,6 +263,7 @@ , , , + , @@ -451,7 +451,6 @@ , , , - , , , , @@ -459,6 +458,7 @@ , , , + , To be added; from: , @@ -469,7 +469,6 @@ , , , - , , , , @@ -477,6 +476,7 @@ , , , + , To be added; from: , @@ -487,7 +487,6 @@ , , , - , , , , @@ -495,6 +494,7 @@ , , , + , To be added; from: , @@ -505,7 +505,6 @@ , , , - , , , , @@ -513,6 +512,7 @@ , , , + , To be added; from: , @@ -523,7 +523,6 @@ , , , - , , , , @@ -531,6 +530,7 @@ , , , + , To be added; from: , @@ -541,7 +541,6 @@ , , , - , , , , @@ -549,6 +548,7 @@ , , , + , To be added; from: , @@ -559,7 +559,6 @@ , , , - , , , , @@ -567,6 +566,7 @@ , , , + , To be added; from: , @@ -576,7 +576,6 @@ , , , - , , , , @@ -584,6 +583,7 @@ , , , + , To be added; from: , @@ -594,7 +594,6 @@ , , , - , , , , @@ -602,6 +601,7 @@ , , , + , To be added; from: , @@ -612,7 +612,6 @@ , , , - , , , , @@ -620,6 +619,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/GenericBase`1.xml b/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/GenericBase`1.xml index 4bff19d226..baf29b7ab3 100644 --- a/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest.Generic/GenericBase`1.xml @@ -102,7 +102,6 @@ , , , - , , , , @@ -110,6 +109,7 @@ , , , + , To be added; from: , @@ -120,7 +120,6 @@ , , , - , , , , @@ -128,6 +127,7 @@ , , , + , To be added; from: , @@ -138,7 +138,6 @@ , , , - , , , , @@ -146,6 +145,7 @@ , , , + , To be added; from: , @@ -156,7 +156,6 @@ , , , - , , , , @@ -164,6 +163,7 @@ , , , + , To be added; from: , @@ -174,7 +174,6 @@ , , , - , , , , @@ -182,6 +181,7 @@ , , , + , To be added; from: , @@ -192,7 +192,6 @@ , , , - , , , , @@ -200,6 +199,7 @@ , , , + , To be added; from: , @@ -210,7 +210,6 @@ , , , - , , , , @@ -218,6 +217,7 @@ , , , + , To be added; from: , @@ -227,7 +227,6 @@ , , , - , , , , @@ -235,6 +234,7 @@ , , , + , To be added; from: , @@ -245,7 +245,6 @@ , , , - , , , , @@ -253,6 +252,7 @@ , , , + , To be added; from: , @@ -263,7 +263,6 @@ , , , - , , , , @@ -271,6 +270,7 @@ , , , + , @@ -296,7 +296,6 @@ , , , - , , , , @@ -304,6 +303,7 @@ , , , + , To be added; from: , @@ -314,7 +314,6 @@ , , , - , , , , @@ -322,6 +321,7 @@ , , , + , To be added; from: , @@ -332,7 +332,6 @@ , , , - , , , , @@ -340,6 +339,7 @@ , , , + , To be added; from: , @@ -350,7 +350,6 @@ , , , - , , , , @@ -358,6 +357,7 @@ , , , + , To be added; from: , @@ -368,7 +368,6 @@ , , , - , , , , @@ -376,6 +375,7 @@ , , , + , To be added; from: , @@ -386,7 +386,6 @@ , , , - , , , , @@ -394,6 +393,7 @@ , , , + , To be added; from: , @@ -404,7 +404,6 @@ , , , - , , , , @@ -412,6 +411,7 @@ , , , + , To be added; from: , @@ -421,7 +421,6 @@ , , , - , , , , @@ -429,6 +428,7 @@ , , , + , To be added; from: , @@ -439,7 +439,6 @@ , , , - , , , , @@ -447,6 +446,7 @@ , , , + , To be added; from: , @@ -457,7 +457,6 @@ , , , - , , , , @@ -465,6 +464,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest/Widget.xml b/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest/Widget.xml index 83840d125a..f70ab2d401 100644 --- a/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest/Widget.xml +++ b/mcs/tools/mdoc/Test/en.expected.importslashdoc/Mono.DocTest/Widget.xml @@ -135,7 +135,6 @@ , , , - , , , , @@ -143,6 +142,7 @@ , , , + , To be added; from: , @@ -153,7 +153,6 @@ , , , - , , , , @@ -161,6 +160,7 @@ , , , + , To be added; from: , @@ -171,7 +171,6 @@ , , , - , , , , @@ -179,6 +178,7 @@ , , , + , To be added; from: , @@ -189,7 +189,6 @@ , , , - , , , , @@ -197,6 +196,7 @@ , , , + , To be added; from: , @@ -207,7 +207,6 @@ , , , - , , , , @@ -215,6 +214,7 @@ , , , + , To be added; from: , @@ -225,7 +225,6 @@ , , , - , , , , @@ -233,6 +232,7 @@ , , , + , To be added; from: , @@ -243,7 +243,6 @@ , , , - , , , , @@ -251,6 +250,7 @@ , , , + , To be added; from: , @@ -260,7 +260,6 @@ , , , - , , , , @@ -268,6 +267,7 @@ , , , + , To be added; from: , @@ -278,7 +278,6 @@ , , , - , , , , @@ -286,6 +285,7 @@ , , , + , To be added; from: , @@ -296,7 +296,6 @@ , , , - , , , , @@ -304,6 +303,7 @@ , , , + , @@ -542,7 +542,6 @@ , , , - , , , , @@ -550,6 +549,7 @@ , , , + , To be added; from: , @@ -560,7 +560,6 @@ , , , - , , , , @@ -568,6 +567,7 @@ , , , + , To be added; from: , @@ -578,7 +578,6 @@ , , , - , , , , @@ -586,6 +585,7 @@ , , , + , To be added; from: , @@ -596,7 +596,6 @@ , , , - , , , , @@ -604,6 +603,7 @@ , , , + , To be added; from: , @@ -614,7 +614,6 @@ , , , - , , , , @@ -622,6 +621,7 @@ , , , + , To be added; from: , @@ -632,7 +632,6 @@ , , , - , , , , @@ -640,6 +639,7 @@ , , , + , To be added; from: , @@ -650,7 +650,6 @@ , , , - , , , , @@ -658,6 +657,7 @@ , , , + , To be added; from: , @@ -667,7 +667,6 @@ , , , - , , , , @@ -675,6 +674,7 @@ , , , + , To be added; from: , @@ -685,7 +685,6 @@ , , , - , , , , @@ -693,6 +692,7 @@ , , , + , To be added; from: , @@ -703,7 +703,6 @@ , , , - , , , , @@ -711,6 +710,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest.Generic/GenericBase`1.xml b/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest.Generic/GenericBase`1.xml index 499664142f..db4b562f62 100644 --- a/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest.Generic/GenericBase`1.xml @@ -120,7 +120,6 @@ , , , - , , , , @@ -128,6 +127,7 @@ , , , + , To be added; from: , @@ -138,7 +138,6 @@ , , , - , , , , @@ -146,6 +145,7 @@ , , , + , To be added; from: , @@ -156,7 +156,6 @@ , , , - , , , , @@ -164,6 +163,7 @@ , , , + , To be added; from: , @@ -174,7 +174,6 @@ , , , - , , , , @@ -182,6 +181,7 @@ , , , + , To be added; from: , @@ -192,7 +192,6 @@ , , , - , , , , @@ -200,6 +199,7 @@ , , , + , To be added; from: , @@ -210,7 +210,6 @@ , , , - , , , , @@ -218,6 +217,7 @@ , , , + , To be added; from: , @@ -228,7 +228,6 @@ , , , - , , , , @@ -236,6 +235,7 @@ , , , + , To be added; from: , @@ -245,7 +245,6 @@ , , , - , , , , @@ -253,6 +252,7 @@ , , , + , To be added; from: , @@ -263,7 +263,6 @@ , , , - , , , , @@ -271,6 +270,7 @@ , , , + , To be added; from: , @@ -281,7 +281,6 @@ , , , - , , , , @@ -289,6 +288,7 @@ , , , + , @@ -315,7 +315,6 @@ , , , - , , , , @@ -323,6 +322,7 @@ , , , + , To be added; from: , @@ -333,7 +333,6 @@ , , , - , , , , @@ -341,6 +340,7 @@ , , , + , To be added; from: , @@ -351,7 +351,6 @@ , , , - , , , , @@ -359,6 +358,7 @@ , , , + , To be added; from: , @@ -369,7 +369,6 @@ , , , - , , , , @@ -377,6 +376,7 @@ , , , + , To be added; from: , @@ -387,7 +387,6 @@ , , , - , , , , @@ -395,6 +394,7 @@ , , , + , To be added; from: , @@ -405,7 +405,6 @@ , , , - , , , , @@ -413,6 +412,7 @@ , , , + , To be added; from: , @@ -423,7 +423,6 @@ , , , - , , , , @@ -431,6 +430,7 @@ , , , + , To be added; from: , @@ -440,7 +440,6 @@ , , , - , , , , @@ -448,6 +447,7 @@ , , , + , To be added; from: , @@ -458,7 +458,6 @@ , , , - , , , , @@ -466,6 +465,7 @@ , , , + , To be added; from: , @@ -476,7 +476,6 @@ , , , - , , , , @@ -484,6 +483,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest/Widget.xml b/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest/Widget.xml index 905adaf3f2..fc36f1e103 100644 --- a/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest/Widget.xml +++ b/mcs/tools/mdoc/Test/en.expected.since/Mono.DocTest/Widget.xml @@ -117,7 +117,6 @@ , , , - , , , , @@ -125,6 +124,7 @@ , , , + , To be added; from: , @@ -135,7 +135,6 @@ , , , - , , , , @@ -143,6 +142,7 @@ , , , + , To be added; from: , @@ -153,7 +153,6 @@ , , , - , , , , @@ -161,6 +160,7 @@ , , , + , To be added; from: , @@ -171,7 +171,6 @@ , , , - , , , , @@ -179,6 +178,7 @@ , , , + , To be added; from: , @@ -189,7 +189,6 @@ , , , - , , , , @@ -197,6 +196,7 @@ , , , + , To be added; from: , @@ -207,7 +207,6 @@ , , , - , , , , @@ -215,6 +214,7 @@ , , , + , To be added; from: , @@ -225,7 +225,6 @@ , , , - , , , , @@ -233,6 +232,7 @@ , , , + , To be added; from: , @@ -242,7 +242,6 @@ , , , - , , , , @@ -250,6 +249,7 @@ , , , + , To be added; from: , @@ -260,7 +260,6 @@ , , , - , , , , @@ -268,6 +267,7 @@ , , , + , To be added; from: , @@ -278,7 +278,6 @@ , , , - , , , , @@ -286,6 +285,7 @@ , , , + , @@ -517,7 +517,6 @@ , , , - , , , , @@ -525,6 +524,7 @@ , , , + , To be added; from: , @@ -535,7 +535,6 @@ , , , - , , , , @@ -543,6 +542,7 @@ , , , + , To be added; from: , @@ -553,7 +553,6 @@ , , , - , , , , @@ -561,6 +560,7 @@ , , , + , To be added; from: , @@ -571,7 +571,6 @@ , , , - , , , , @@ -579,6 +578,7 @@ , , , + , To be added; from: , @@ -589,7 +589,6 @@ , , , - , , , , @@ -597,6 +596,7 @@ , , , + , To be added; from: , @@ -607,7 +607,6 @@ , , , - , , , , @@ -615,6 +614,7 @@ , , , + , To be added; from: , @@ -625,7 +625,6 @@ , , , - , , , , @@ -633,6 +632,7 @@ , , , + , To be added; from: , @@ -642,7 +642,6 @@ , , , - , , , , @@ -650,6 +649,7 @@ , , , + , To be added; from: , @@ -660,7 +660,6 @@ , , , - , , , , @@ -668,6 +667,7 @@ , , , + , To be added; from: , @@ -678,7 +678,6 @@ , , , - , , , , @@ -686,6 +685,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml b/mcs/tools/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml index 90edae2dac..2fe080f91c 100644 --- a/mcs/tools/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml +++ b/mcs/tools/mdoc/Test/en.expected/Mono.DocTest.Generic/GenericBase`1.xml @@ -98,7 +98,6 @@ , , , - , , , , @@ -106,6 +105,7 @@ , , , + , To be added; from: , @@ -116,7 +116,6 @@ , , , - , , , , @@ -124,6 +123,7 @@ , , , + , To be added; from: , @@ -134,7 +134,6 @@ , , , - , , , , @@ -142,6 +141,7 @@ , , , + , To be added; from: , @@ -152,7 +152,6 @@ , , , - , , , , @@ -160,6 +159,7 @@ , , , + , To be added; from: , @@ -170,7 +170,6 @@ , , , - , , , , @@ -178,6 +177,7 @@ , , , + , To be added; from: , @@ -188,7 +188,6 @@ , , , - , , , , @@ -196,6 +195,7 @@ , , , + , To be added; from: , @@ -206,7 +206,6 @@ , , , - , , , , @@ -214,6 +213,7 @@ , , , + , To be added; from: , @@ -223,7 +223,6 @@ , , , - , , , , @@ -231,6 +230,7 @@ , , , + , To be added; from: , @@ -241,7 +241,6 @@ , , , - , , , , @@ -249,6 +248,7 @@ , , , + , To be added; from: , @@ -259,7 +259,6 @@ , , , - , , , , @@ -267,6 +266,7 @@ , , , + , @@ -292,7 +292,6 @@ , , , - , , , , @@ -300,6 +299,7 @@ , , , + , To be added; from: , @@ -310,7 +310,6 @@ , , , - , , , , @@ -318,6 +317,7 @@ , , , + , To be added; from: , @@ -328,7 +328,6 @@ , , , - , , , , @@ -336,6 +335,7 @@ , , , + , To be added; from: , @@ -346,7 +346,6 @@ , , , - , , , , @@ -354,6 +353,7 @@ , , , + , To be added; from: , @@ -364,7 +364,6 @@ , , , - , , , , @@ -372,6 +371,7 @@ , , , + , To be added; from: , @@ -382,7 +382,6 @@ , , , - , , , , @@ -390,6 +389,7 @@ , , , + , To be added; from: , @@ -400,7 +400,6 @@ , , , - , , , , @@ -408,6 +407,7 @@ , , , + , To be added; from: , @@ -417,7 +417,6 @@ , , , - , , , , @@ -425,6 +424,7 @@ , , , + , To be added; from: , @@ -435,7 +435,6 @@ , , , - , , , , @@ -443,6 +442,7 @@ , , , + , To be added; from: , @@ -453,7 +453,6 @@ , , , - , , , , @@ -461,6 +460,7 @@ , , , + , diff --git a/mcs/tools/mdoc/Test/en.expected/Mono.DocTest/Widget.xml b/mcs/tools/mdoc/Test/en.expected/Mono.DocTest/Widget.xml index 2d8efe06c6..97e08a4854 100644 --- a/mcs/tools/mdoc/Test/en.expected/Mono.DocTest/Widget.xml +++ b/mcs/tools/mdoc/Test/en.expected/Mono.DocTest/Widget.xml @@ -111,7 +111,6 @@ , , , - , , , , @@ -119,6 +118,7 @@ , , , + , To be added; from: , @@ -129,7 +129,6 @@ , , , - , , , , @@ -137,6 +136,7 @@ , , , + , To be added; from: , @@ -147,7 +147,6 @@ , , , - , , , , @@ -155,6 +154,7 @@ , , , + , To be added; from: , @@ -165,7 +165,6 @@ , , , - , , , , @@ -173,6 +172,7 @@ , , , + , To be added; from: , @@ -183,7 +183,6 @@ , , , - , , , , @@ -191,6 +190,7 @@ , , , + , To be added; from: , @@ -201,7 +201,6 @@ , , , - , , , , @@ -209,6 +208,7 @@ , , , + , To be added; from: , @@ -219,7 +219,6 @@ , , , - , , , , @@ -227,6 +226,7 @@ , , , + , To be added; from: , @@ -236,7 +236,6 @@ , , , - , , , , @@ -244,6 +243,7 @@ , , , + , To be added; from: , @@ -254,7 +254,6 @@ , , , - , , , , @@ -262,6 +261,7 @@ , , , + , To be added; from: , @@ -272,7 +272,6 @@ , , , - , , , , @@ -280,6 +279,7 @@ , , , + , @@ -500,7 +500,6 @@ , , , - , , , , @@ -508,6 +507,7 @@ , , , + , To be added; from: , @@ -518,7 +518,6 @@ , , , - , , , , @@ -526,6 +525,7 @@ , , , + , To be added; from: , @@ -536,7 +536,6 @@ , , , - , , , , @@ -544,6 +543,7 @@ , , , + , To be added; from: , @@ -554,7 +554,6 @@ , , , - , , , , @@ -562,6 +561,7 @@ , , , + , To be added; from: , @@ -572,7 +572,6 @@ , , , - , , , , @@ -580,6 +579,7 @@ , , , + , To be added; from: , @@ -590,7 +590,6 @@ , , , - , , , , @@ -598,6 +597,7 @@ , , , + , To be added; from: , @@ -608,7 +608,6 @@ , , , - , , , , @@ -616,6 +615,7 @@ , , , + , To be added; from: , @@ -625,7 +625,6 @@ , , , - , , , , @@ -633,6 +632,7 @@ , , , + , To be added; from: , @@ -643,7 +643,6 @@ , , , - , , , , @@ -651,6 +650,7 @@ , , , + , To be added; from: , @@ -661,7 +661,6 @@ , , , - , , , , @@ -669,6 +668,7 @@ , , , + , diff --git a/mcs/tools/mono-api-html/ClassComparer.cs b/mcs/tools/mono-api-html/ClassComparer.cs index abb0bdeaaa..887a5dddfb 100644 --- a/mcs/tools/mono-api-html/ClassComparer.cs +++ b/mcs/tools/mono-api-html/ClassComparer.cs @@ -258,7 +258,10 @@ namespace Xamarin.ApiDiff { public override void Removed (XElement source) { - string name = State.Namespace + "." + GetTypeName (source); + if (source.Elements ("attributes").SelectMany (a => a.Elements ("attribute")).Any (c => c.Attribute ("name")?.Value == "System.ObsoleteAttribute")) + return; + + string name = State.Namespace + "." + GetTypeName (source); var memberDescription = $"{name}: Removed type"; State.LogDebugMessage ($"Possible -r value: {memberDescription}"); @@ -285,4 +288,4 @@ namespace Xamarin.ApiDiff { return State.Type + "." + base.GetTypeName (type); } } -} \ No newline at end of file +} diff --git a/mcs/tools/mono-api-html/MemberComparer.cs b/mcs/tools/mono-api-html/MemberComparer.cs index 18c6fc55f8..b32e17e343 100644 --- a/mcs/tools/mono-api-html/MemberComparer.cs +++ b/mcs/tools/mono-api-html/MemberComparer.cs @@ -43,7 +43,7 @@ namespace Xamarin.ApiDiff { protected virtual bool IsBreakingRemoval (XElement e) { - return true; + return !e.Elements ("attributes").SelectMany (a => a.Elements ("attribute")).Any (c => c.Attribute ("name")?.Value == "System.ObsoleteAttribute"); } public void Compare (XElement source, XElement target) diff --git a/mcs/tools/security/README b/mcs/tools/security/README index 20c3313062..7d10f713ae 100644 --- a/mcs/tools/security/README +++ b/mcs/tools/security/README @@ -54,15 +54,13 @@ a timestamp server (so the signature can still be verified after your certificate is expired). The command: -mono signcode.exe -v yourkeypair.pvk -spc yourspc.spc -t -http://timestamp.verisign.com/scripts/timstamp.dll yourassembly.exe +mono signcode.exe -v yourkeypair.pvk -spc yourspc.spc -t http://timestamp.verisign.com/scripts/timstamp.dll yourassembly.exe will sign the specified PE file using your private key and embed your certificate and a timestamp. Note: there are no "e" in timstamp.dll ! example: -mono signcode.exe -v spouliot.pvk -spc spouliot.spc -t -http://timestamp.verisign.com/scripts/timstamp.dll small.exe +mono signcode.exe -v spouliot.pvk -spc spouliot.spc -t http://timestamp.verisign.com/scripts/timstamp.dll small.exe 4. Checking an assembly diff --git a/mcs/tools/sgen/sgen.cs b/mcs/tools/sgen/sgen.cs index 2ab376d3bf..d759a5e51d 100644 --- a/mcs/tools/sgen/sgen.cs +++ b/mcs/tools/sgen/sgen.cs @@ -96,7 +96,19 @@ public class Driver Console.WriteLine ("Generating serializer for the following types:"); if (types == null) { - foreach (Type t in asm.GetTypes ()) { + Type [] types; + + try { + types = asm.GetTypes (); + } catch (ReflectionTypeLoadException tle){ + Console.WriteLine ($"There was an error loading one or more of the types from the referenced assembly {assembly}"); + foreach (var le in tle.LoaderExceptions){ + Console.WriteLine (le); + } + return 1; + } + + foreach (Type t in types){ try { maps.Add (imp.ImportTypeMapping (t)); userTypes.Add (t); diff --git a/mcs/tools/xbuild/data/deniedAssembliesList.txt b/mcs/tools/xbuild/data/deniedAssembliesList.txt index 721fc12ef9..32b986891c 100644 --- a/mcs/tools/xbuild/data/deniedAssembliesList.txt +++ b/mcs/tools/xbuild/data/deniedAssembliesList.txt @@ -23,6 +23,17 @@ System.IO.Compression.dll,C786B28D-0850-4D4C-AED9-FE6B86EE7C31,4,2,0,0 System.Net.Http.dll,903A137B-BB3F-464A-94D4-780B89EE5580,4,2,0,0 System.Threading.Overlapped.dll,3336A2A3-1772-4EF9-A74B-AFDC80A8B21E,4,1,0,0 System.Runtime.InteropServices.RuntimeInformation.dll,D87389D8-6E9C-48CF-B128-3637018577AF,4,0,2,0 +System.Globalization.Extensions.dll,B9BA8638-25D2-4A3B-B91F-16B3D3799861,4,1,0,0 +System.IO.Compression.dll,35DD20B5-8766-476B-B5D2-0EA16EF0A946,4,2,0,0 +System.Net.Http.dll,27BBDD4C-EAF0-4A95-B172-EE502D76A725,4,2,0,0 +System.Runtime.InteropServices.RuntimeInformation.dll,E46BA45E-6A63-47CD-AF70-2C3016AFF75A,4,0,2,0 +System.Threading.Overlapped.dll,A0439CB6-A5E6-4813-A76C-13F92ADDDED5,4,1,0,0 +System.Runtime.InteropServices.RuntimeInformation.dll,488CE209-4E5D-40E7-BE8C-F81F2B99F13A,4,0,2,0 +System.Globalization.Extensions.dll,1A2B9B2A-02F5-4C78-AB0C-7C6D2795CE2B,4,1,0,0 +System.IO.Compression.dll,8DBD1669-97BC-4190-9BD8-738561193741,4,2,0,0 +System.Net.Http.dll,41ACE450-8F44-455A-97AC-0679E5462071,4,2,0,0 +System.Threading.Overlapped.dll,82D565AC-E41C-4E29-9939-C031C88EDBDD,4,1,0,0 +System.Runtime.InteropServices.RuntimeInformation.dll,FD6C8616-C1D8-43F9-AC17-A1C48A45FDA2,4,0,2,0 System.Globalization.Extensions.dll,475DBF02-9F68-44F1-8FB5-C9F69F1BD2B1,4,0,0,0 System.Globalization.Extensions.dll,5FCD54F0-4B97-4259-875D-30E481F02EA2,4,0,1,0 System.Globalization.Extensions.dll,E9FCFF5B-4DE1-4BDC-9CE8-08C640FC78CC,4,0,2,0 diff --git a/mono/Makefile.am b/mono/Makefile.am index de46d63aac..4e408b0e52 100644 --- a/mono/Makefile.am +++ b/mono/Makefile.am @@ -7,10 +7,10 @@ btls_dirs = btls endif if CROSS_COMPILING -SUBDIRS = $(btls_dirs) eglib arch utils cil metadata $(sgen_dirs) mini dis profiler +SUBDIRS = $(btls_dirs) eglib arch utils cil $(sgen_dirs) metadata mini dis profiler else if INSTALL_MONOTOUCH -SUBDIRS = $(btls_dirs) eglib arch utils metadata $(sgen_dirs) mini profiler +SUBDIRS = $(btls_dirs) eglib arch utils $(sgen_dirs) metadata mini profiler monotouch-do-build: @list='$(SUBDIRS)'; for subdir in $$list; do \ @@ -34,7 +34,7 @@ monotouch-do-clean: (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$target); \ done; else -SUBDIRS = $(btls_dirs) eglib arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler +SUBDIRS = $(btls_dirs) eglib arch utils cil $(sgen_dirs) metadata mini dis tests unit-tests benchmark profiler endif endif -DIST_SUBDIRS = btls eglib arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler +DIST_SUBDIRS = btls eglib arch utils cil $(sgen_dirs) metadata mini dis tests unit-tests benchmark profiler diff --git a/mono/Makefile.in b/mono/Makefile.in index ec6855c921..2c93073733 100644 --- a/mono/Makefile.in +++ b/mono/Makefile.in @@ -82,14 +82,14 @@ subdir = mono DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -260,6 +260,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -288,6 +292,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -413,10 +420,10 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @SUPPORT_SGEN_TRUE@sgen_dirs = sgen @BTLS_TRUE@btls_dirs = btls -@CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_FALSE@SUBDIRS = $(btls_dirs) eglib arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler -@CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_TRUE@SUBDIRS = $(btls_dirs) eglib arch utils metadata $(sgen_dirs) mini profiler -@CROSS_COMPILING_TRUE@SUBDIRS = $(btls_dirs) eglib arch utils cil metadata $(sgen_dirs) mini dis profiler -DIST_SUBDIRS = btls eglib arch utils cil metadata $(sgen_dirs) mini dis tests unit-tests benchmark profiler +@CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_FALSE@SUBDIRS = $(btls_dirs) eglib arch utils cil $(sgen_dirs) metadata mini dis tests unit-tests benchmark profiler +@CROSS_COMPILING_FALSE@@INSTALL_MONOTOUCH_TRUE@SUBDIRS = $(btls_dirs) eglib arch utils $(sgen_dirs) metadata mini profiler +@CROSS_COMPILING_TRUE@SUBDIRS = $(btls_dirs) eglib arch utils cil $(sgen_dirs) metadata mini dis profiler +DIST_SUBDIRS = btls eglib arch utils cil $(sgen_dirs) metadata mini dis tests unit-tests benchmark profiler all: all-recursive .SUFFIXES: diff --git a/mono/arch/Makefile.in b/mono/arch/Makefile.in index 30478f18d3..da76877813 100644 --- a/mono/arch/Makefile.in +++ b/mono/arch/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -260,6 +260,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -288,6 +292,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/amd64/Makefile.in b/mono/arch/amd64/Makefile.in index f4274f0838..67b8096b91 100644 --- a/mono/arch/amd64/Makefile.in +++ b/mono/arch/amd64/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch/amd64 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/arm/Makefile.in b/mono/arch/arm/Makefile.in index 9212fcf68f..7119466673 100644 --- a/mono/arch/arm/Makefile.in +++ b/mono/arch/arm/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch/arm DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/arm/arm-codegen.h b/mono/arch/arm/arm-codegen.h index 9b2141521c..879c932b6b 100644 --- a/mono/arch/arm/arm-codegen.h +++ b/mono/arch/arm/arm-codegen.h @@ -1110,6 +1110,7 @@ typedef union { /* ARMv7 */ typedef enum { + ARM_DMB_ISH = 0xb, ARM_DMB_SY = 0xf, } ArmDmbFlags; diff --git a/mono/arch/arm64/Makefile.in b/mono/arch/arm64/Makefile.in index 3c9ec8cc35..81ec285c45 100644 --- a/mono/arch/arm64/Makefile.in +++ b/mono/arch/arm64/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch/arm64 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/mips/Makefile.in b/mono/arch/mips/Makefile.in index ba6ccd9ab8..c768afbb45 100644 --- a/mono/arch/mips/Makefile.in +++ b/mono/arch/mips/Makefile.in @@ -85,14 +85,14 @@ subdir = mono/arch/mips DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -252,6 +252,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -280,6 +284,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/ppc/Makefile.in b/mono/arch/ppc/Makefile.in index 4a23619d73..7d10e063f3 100644 --- a/mono/arch/ppc/Makefile.in +++ b/mono/arch/ppc/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch/ppc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/s390x/Makefile.in b/mono/arch/s390x/Makefile.in index ce1fd7554e..e8e23415f2 100644 --- a/mono/arch/s390x/Makefile.in +++ b/mono/arch/s390x/Makefile.in @@ -83,14 +83,14 @@ subdir = mono/arch/s390x DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -246,6 +246,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -274,6 +278,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/sparc/Makefile.in b/mono/arch/sparc/Makefile.in index 07f42b3d5e..0ecc093ad6 100644 --- a/mono/arch/sparc/Makefile.in +++ b/mono/arch/sparc/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch/sparc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/arch/x86/Makefile.in b/mono/arch/x86/Makefile.in index 8d6c8d6b0d..4bb025053e 100644 --- a/mono/arch/x86/Makefile.in +++ b/mono/arch/x86/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/arch/x86 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/benchmark/Makefile.in b/mono/benchmark/Makefile.in index 470e68d188..cf7f697168 100644 --- a/mono/benchmark/Makefile.in +++ b/mono/benchmark/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/benchmark DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/btls/Makefile.in b/mono/btls/Makefile.in index 7892fc1e70..84bb7502f1 100644 --- a/mono/btls/Makefile.in +++ b/mono/btls/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/btls DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/cil/Makefile.in b/mono/cil/Makefile.in index ce1f1af9ab..c66e4e7101 100644 --- a/mono/cil/Makefile.in +++ b/mono/cil/Makefile.in @@ -83,14 +83,14 @@ subdir = mono/cil DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs TODO ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -231,6 +231,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -259,6 +263,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/dis/Makefile.am b/mono/dis/Makefile.am index f1e79e3178..c4327b6ce5 100644 --- a/mono/dis/Makefile.am +++ b/mono/dis/Makefile.am @@ -5,10 +5,10 @@ export HOST_CC endif if SUPPORT_SGEN -metadata_lib=$(top_builddir)/mono/metadata/libmonoruntimesgen-static.la -gc_lib=$(top_builddir)/mono/sgen/libmonosgen-static.la +metadata_lib=$(top_builddir)/mono/metadata/libmonoruntimesgen.la +gc_lib=$(top_builddir)/mono/sgen/libmonosgen.la else -metadata_lib=$(top_builddir)/mono/metadata/libmonoruntime-static.la +metadata_lib=$(top_builddir)/mono/metadata/libmonoruntime.la gc_lib=$(LIBGC_STATIC_LIBS) endif diff --git a/mono/dis/Makefile.in b/mono/dis/Makefile.in index d439518564..c933dc4de5 100644 --- a/mono/dis/Makefile.in +++ b/mono/dis/Makefile.in @@ -85,14 +85,14 @@ subdir = mono/dis DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -116,7 +116,8 @@ am_monodis_OBJECTS = dump.$(OBJEXT) main.$(OBJEXT) declsec.$(OBJEXT) monodis_OBJECTS = $(am_monodis_OBJECTS) am__DEPENDENCIES_1 = @SUPPORT_SGEN_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) -@SUPPORT_SGEN_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/mono/sgen/libmonosgen-static.la +@SUPPORT_SGEN_TRUE@am__DEPENDENCIES_2 = \ +@SUPPORT_SGEN_TRUE@ $(top_builddir)/mono/sgen/libmonosgen.la am__DEPENDENCIES_3 = $(metadata_lib) $(am__DEPENDENCIES_2) \ $(top_builddir)/mono/utils/libmonoutils.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -301,6 +302,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -329,6 +334,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -453,10 +461,10 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -@SUPPORT_SGEN_FALSE@metadata_lib = $(top_builddir)/mono/metadata/libmonoruntime-static.la -@SUPPORT_SGEN_TRUE@metadata_lib = $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la +@SUPPORT_SGEN_FALSE@metadata_lib = $(top_builddir)/mono/metadata/libmonoruntime.la +@SUPPORT_SGEN_TRUE@metadata_lib = $(top_builddir)/mono/metadata/libmonoruntimesgen.la @SUPPORT_SGEN_FALSE@gc_lib = $(LIBGC_STATIC_LIBS) -@SUPPORT_SGEN_TRUE@gc_lib = $(top_builddir)/mono/sgen/libmonosgen-static.la +@SUPPORT_SGEN_TRUE@gc_lib = $(top_builddir)/mono/sgen/libmonosgen.la runtime_lib = \ $(metadata_lib) \ $(gc_lib) \ diff --git a/mono/dis/dump.c b/mono/dis/dump.c index c13675e823..4c2ba81e48 100755 --- a/mono/dis/dump.c +++ b/mono/dis/dump.c @@ -20,6 +20,7 @@ #include "mono/metadata/class.h" #include "mono/metadata/class-internals.h" #include "mono/utils/mono-compiler.h" +#include "mono/utils/mono-error-internals.h" void dump_table_assembly (MonoImage *m) @@ -560,7 +561,7 @@ dump_table_method (MonoImage *m) current_type = 1; last_m = first_m = 1; for (i = 1; i <= t->rows; i++){ - MonoError error; + ERROR_DECL (error); guint32 cols [MONO_METHOD_SIZE]; char *sig, *impl_flags; const char *sigblob; @@ -579,27 +580,27 @@ dump_table_method (MonoImage *m) first_m = last_m; type_container = mono_metadata_load_generic_params (m, MONO_TOKEN_TYPE_DEF | (current_type - 1), NULL); if (type_container) { - mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_TYPE_DEF | (current_type - 1), type_container, &error); - g_assert (mono_error_ok (&error)); /*FIXME don't swallow the error message*/ + mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_TYPE_DEF | (current_type - 1), type_container, error); + g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ } } method_container = mono_metadata_load_generic_params (m, MONO_TOKEN_METHOD_DEF | i, type_container); if (method_container) { - mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | i, method_container, &error); - g_assert (mono_error_ok (&error)); /*FIXME don't swallow the error message*/ + mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | i, method_container, error); + g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ } mono_metadata_decode_table_row (m, MONO_TABLE_METHOD, i - 1, cols, MONO_METHOD_SIZE); sigblob = mono_metadata_blob_heap (m, cols [MONO_METHOD_SIGNATURE]); mono_metadata_decode_blob_size (sigblob, &sigblob); - method = mono_metadata_parse_method_signature_full (m, method_container ? method_container : type_container, i, sigblob, &sigblob, &error); - if (!mono_error_ok (&error)) { - fprintf (output,"%d: failed to parse due to %s\n", i, mono_error_get_message (&error)); - mono_error_cleanup (&error); + method = mono_metadata_parse_method_signature_full (m, method_container ? method_container : type_container, i, sigblob, &sigblob, error); + if (!mono_error_ok (error)) { + fprintf (output,"%d: failed to parse due to %s\n", i, mono_error_get_message (error)); + mono_error_cleanup (error); continue; } - g_assert (mono_error_ok (&error)); /*FIXME don't swallow the error message*/ + g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ sig = dis_stringify_method_signature (m, method, i, method_container ? method_container : type_container, FALSE); impl_flags = get_method_impl_flags (cols [MONO_METHOD_IMPLFLAGS]); fprintf (output, "%d: %s (param: %d impl_flags: %s)\n", i, sig, cols [MONO_METHOD_PARAMLIST], impl_flags); @@ -945,7 +946,7 @@ dump_table_customattr (MonoImage *m) fprintf (output, "Custom Attributes Table (1..%d)\n", t->rows); for (i = 1; i <= t->rows; i++) { - MonoError error; + ERROR_DECL (error); guint32 cols [MONO_CUSTOM_ATTR_SIZE]; guint32 mtoken; char * desc; @@ -968,14 +969,14 @@ dump_table_customattr (MonoImage *m) break; } method = get_method (m, mtoken, NULL); - meth = mono_get_method_checked (m, mtoken, NULL, NULL, &error); + meth = mono_get_method_checked (m, mtoken, NULL, NULL, error); if (meth) { params = custom_attr_params (m, mono_method_signature (meth), mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE])); fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params); g_free (params); } else { - fprintf (output, "Could not decode method due to %s", mono_error_get_message (&error)); - mono_error_cleanup (&error); + fprintf (output, "Could not decode method due to %s", mono_error_get_message (error)); + mono_error_cleanup (error); } g_free (desc); diff --git a/mono/dis/get.c.REMOVED.git-id b/mono/dis/get.c.REMOVED.git-id index 2776789a7f..c5290b8409 100644 --- a/mono/dis/get.c.REMOVED.git-id +++ b/mono/dis/get.c.REMOVED.git-id @@ -1 +1 @@ -f5b64acdd0dab72058234fb16f54291d593a7e47 \ No newline at end of file +f0247e05d9b430386d42086bb29a1d6b0a2cfa2d \ No newline at end of file diff --git a/mono/dis/main.c b/mono/dis/main.c index dbbb12a62f..972e156b6f 100644 --- a/mono/dis/main.c +++ b/mono/dis/main.c @@ -666,7 +666,7 @@ dis_locals (MonoImage *m, MonoMethodHeader *mh, const char *ptr) static void dis_code (MonoImage *m, guint32 token, guint32 rva, MonoGenericContainer *container) { - MonoError error; + ERROR_DECL (error); MonoMethodHeader *mh; const char *ptr = mono_image_rva_map (m, rva); const char *loc; @@ -682,7 +682,7 @@ dis_code (MonoImage *m, guint32 token, guint32 rva, MonoGenericContainer *contai g_free (override); } - mh = mono_metadata_parse_mh_full (m, container, ptr, &error); + mh = mono_metadata_parse_mh_full (m, container, ptr, error); entry_point = mono_image_get_entry_point (m); if (entry_point && mono_metadata_token_index (entry_point) && mono_metadata_token_table (entry_point) == MONO_TABLE_METHOD) { loc = mono_metadata_locate_token (m, entry_point); @@ -703,7 +703,7 @@ dis_code (MonoImage *m, guint32 token, guint32 rva, MonoGenericContainer *contai */ mono_metadata_free_mh (mh); } else { - mono_error_cleanup (&error); + mono_error_cleanup (error); } } @@ -840,7 +840,7 @@ dis_method_list (const char *klass_name, MonoImage *m, guint32 start, guint32 en } for (i = start; i < end; i++){ - MonoError error; + ERROR_DECL (error); MonoMethodSignature *ms; MonoGenericContainer *container; char *flags, *impl_flags; @@ -860,21 +860,21 @@ dis_method_list (const char *klass_name, MonoImage *m, guint32 start, guint32 en container = mono_metadata_load_generic_params (m, MONO_TOKEN_METHOD_DEF | (i + 1), type_container); if (container) { - MonoError error; - mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | (i + 1), container, &error); - g_assert (mono_error_ok (&error)); /*FIXME don't swallow the error message*/ + ERROR_DECL (error); + mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_METHOD_DEF | (i + 1), container, error); + g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ } else { container = type_container; } - ms = mono_metadata_parse_method_signature_full (m, container, i + 1, sig, &sig, &error); + ms = mono_metadata_parse_method_signature_full (m, container, i + 1, sig, &sig, error); if (ms != NULL){ sig_str = dis_stringify_method_signature (m, ms, i + 1, container, FALSE); method_name = mono_metadata_string_heap (m, cols [MONO_METHOD_NAME]); } else { sig_str = NULL; method_name = g_strdup (""); - mono_error_cleanup (&error); + mono_error_cleanup (error); } fprintf (output, " // method line %d\n", i + 1); @@ -964,7 +964,7 @@ dis_property_methods (MonoImage *m, guint32 prop, MonoGenericContainer *containe static char* dis_property_signature (MonoImage *m, guint32 prop_idx, MonoGenericContainer *container) { - MonoError error; + ERROR_DECL (error); MonoTableInfo *propt = &m->tables [MONO_TABLE_PROPERTY]; const char *ptr; guint32 pcount, i; @@ -987,12 +987,12 @@ dis_property_signature (MonoImage *m, guint32 prop_idx, MonoGenericContainer *co g_string_append (res, "instance "); ptr++; pcount = mono_metadata_decode_value (ptr, &ptr); - type = mono_metadata_parse_type_checked (m, container, 0, FALSE, ptr, &ptr, &error); + type = mono_metadata_parse_type_checked (m, container, 0, FALSE, ptr, &ptr, error); if (type) { blurb = dis_stringify_type (m, type, TRUE); } else { - blurb = g_strdup_printf ("Invalid type due to %s", mono_error_get_message (&error)); - mono_error_cleanup (&error); + blurb = g_strdup_printf ("Invalid type due to %s", mono_error_get_message (error)); + mono_error_cleanup (error); } if (prop_flags & 0x0200) g_string_append (res, "specialname "); @@ -1005,12 +1005,12 @@ dis_property_signature (MonoImage *m, guint32 prop_idx, MonoGenericContainer *co for (i = 0; i < pcount; i++) { if (i) g_string_append (res, ", "); - param = mono_metadata_parse_type_checked (m, container, 0, FALSE, ptr, &ptr, &error); + param = mono_metadata_parse_type_checked (m, container, 0, FALSE, ptr, &ptr, error); if (type) { blurb = dis_stringify_param (m, param); } else { - blurb = g_strdup_printf ("Invalid type due to %s", mono_error_get_message (&error)); - mono_error_cleanup (&error); + blurb = g_strdup_printf ("Invalid type due to %s", mono_error_get_message (error)); + mono_error_cleanup (error); } g_string_append (res, blurb); @@ -1203,9 +1203,9 @@ dis_type (MonoImage *m, int n, int is_nested, int forward) container = mono_metadata_load_generic_params (m, MONO_TOKEN_TYPE_DEF | (n + 1), NULL); if (container) { - MonoError error; - mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_TYPE_DEF | (n + 1), container, &error); - g_assert (mono_error_ok (&error)); /*FIXME don't swallow the error message*/ + ERROR_DECL (error); + mono_metadata_load_generic_param_constraints_checked (m, MONO_TOKEN_TYPE_DEF | (n + 1), container, error); + g_assert (mono_error_ok (error)); /*FIXME don't swallow the error message*/ } esname = get_escaped_name (name); @@ -1533,17 +1533,17 @@ dis_data (MonoImage *m) MonoType *type; for (i = 0; i < t->rows; i++) { - MonoError error; + ERROR_DECL (error); mono_metadata_decode_row (t, i, cols, MONO_FIELD_RVA_SIZE); rva = mono_image_rva_map (m, cols [MONO_FIELD_RVA_RVA]); sig = mono_metadata_blob_heap (m, mono_metadata_decode_row_col (ft, cols [MONO_FIELD_RVA_FIELD] -1, MONO_FIELD_SIGNATURE)); mono_metadata_decode_value (sig, &sig); /* FIELD signature == 0x06 */ g_assert (*sig == 0x06); - type = mono_metadata_parse_type_checked (m, NULL, 0, FALSE, sig + 1, &sig, &error); + type = mono_metadata_parse_type_checked (m, NULL, 0, FALSE, sig + 1, &sig, error); if (!type) { - fprintf (output, "// invalid field %d due to %s\n", i, mono_error_get_message (&error)); - mono_error_cleanup (&error); + fprintf (output, "// invalid field %d due to %s\n", i, mono_error_get_message (error)); + mono_error_cleanup (error); continue; } mono_class_init (mono_class_from_mono_type (type)); diff --git a/mono/eglib/Makefile.in b/mono/eglib/Makefile.in index 3a4a8b28c0..2e0c5da320 100644 --- a/mono/eglib/Makefile.in +++ b/mono/eglib/Makefile.in @@ -84,14 +84,14 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(srcdir)/eglib-config.h.in \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -281,6 +281,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -309,6 +313,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/eglib/gdir-unix.c b/mono/eglib/gdir-unix.c index abca22f9e9..5d1e66be93 100644 --- a/mono/eglib/gdir-unix.c +++ b/mono/eglib/gdir-unix.c @@ -42,20 +42,20 @@ struct _GDir { }; GDir * -g_dir_open (const gchar *path, guint flags, GError **error) +g_dir_open (const gchar *path, guint flags, GError **gerror) { GDir *dir; g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); + g_return_val_if_fail (gerror == NULL || *gerror == NULL, NULL); (void) flags; /* this is not used */ dir = g_new (GDir, 1); dir->dir = opendir (path); if (dir->dir == NULL) { - if (error) { + if (gerror) { gint err = errno; - *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err)); + *gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err)); } g_free (dir); return NULL; diff --git a/mono/eglib/gdir-win32.c b/mono/eglib/gdir-win32.c index 0ae3fd41cf..53fd62f837 100644 --- a/mono/eglib/gdir-win32.c +++ b/mono/eglib/gdir-win32.c @@ -42,7 +42,7 @@ struct _GDir { }; GDir * -g_dir_open (const gchar *path, guint flags, GError **error) +g_dir_open (const gchar *path, guint flags, GError **gerror) { GDir *dir; gunichar2* path_utf16; @@ -50,7 +50,7 @@ g_dir_open (const gchar *path, guint flags, GError **error) WIN32_FIND_DATAW find_data; g_return_val_if_fail (path != NULL, NULL); - g_return_val_if_fail (error == NULL || *error == NULL, NULL); + g_return_val_if_fail (gerror == NULL || *gerror == NULL, NULL); dir = g_new0 (GDir, 1); path_utf16 = u8to16 (path); @@ -60,9 +60,9 @@ g_dir_open (const gchar *path, guint flags, GError **error) dir->handle = FindFirstFileW (path_utf16_search, &find_data); if (dir->handle == INVALID_HANDLE_VALUE) { - if (error) { + if (gerror) { gint err = errno; - *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err)); + *gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err)); } g_free (path_utf16_search); g_free (path_utf16); @@ -74,9 +74,9 @@ g_dir_open (const gchar *path, guint flags, GError **error) while ((wcscmp ((wchar_t *) find_data.cFileName, L".") == 0) || (wcscmp ((wchar_t *) find_data.cFileName, L"..") == 0)) { if (!FindNextFileW (dir->handle, &find_data)) { - if (error) { + if (gerror) { gint err = errno; - *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err)); + *gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), strerror (err)); } g_free (dir); return NULL; diff --git a/mono/eglib/gerror.c b/mono/eglib/gerror.c index 43fef97cc4..a8b1d6084d 100644 --- a/mono/eglib/gerror.c +++ b/mono/eglib/gerror.c @@ -62,21 +62,21 @@ g_error_vnew (gpointer domain, gint code, const char *format, va_list ap) } void -g_clear_error (GError **error) +g_clear_error (GError **gerror) { - if (error && *error) { - g_error_free (*error); - *error = NULL; + if (gerror && *gerror) { + g_error_free (*gerror); + *gerror = NULL; } } void -g_error_free (GError *error) +g_error_free (GError *gerror) { - g_return_if_fail (error != NULL); + g_return_if_fail (gerror != NULL); - g_free (error->message); - g_free (error); + g_free (gerror->message); + g_free (gerror); } void diff --git a/mono/eglib/gfile-posix.c b/mono/eglib/gfile-posix.c index 48a9192ab6..281311775c 100644 --- a/mono/eglib/gfile-posix.c +++ b/mono/eglib/gfile-posix.c @@ -50,7 +50,7 @@ int mkstemp (char *tmp_template); #define OPEN_FLAGS (O_RDONLY | O_LARGEFILE) #endif gboolean -g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error) +g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **gerror) { gchar *str; int fd; @@ -60,7 +60,7 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr g_return_val_if_fail (filename != NULL, FALSE); g_return_val_if_fail (contents != NULL, FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + g_return_val_if_fail (gerror == NULL || *gerror == NULL, FALSE); *contents = NULL; if (length) @@ -68,17 +68,17 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr fd = open (filename, OPEN_FLAGS); if (fd == -1) { - if (error != NULL) { + if (gerror != NULL) { int err = errno; - *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file"); + *gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error opening file"); } return FALSE; } if (fstat (fd, &st) != 0) { - if (error != NULL) { + if (gerror != NULL) { int err = errno; - *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()"); + *gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in fstat()"); } close (fd); return FALSE; @@ -103,29 +103,29 @@ g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GEr } gint -g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error) +g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **gerror) { const static gchar *default_tmpl = ".XXXXXX"; gchar *t; gint fd; size_t len; - g_return_val_if_fail (error == NULL || *error == NULL, -1); + g_return_val_if_fail (gerror == NULL || *gerror == NULL, -1); if (tmpl == NULL) tmpl = default_tmpl; if (strchr (tmpl, G_DIR_SEPARATOR) != NULL) { - if (error) { - *error = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S); + if (gerror) { + *gerror = g_error_new (G_LOG_DOMAIN, 24, "Template should not have any " G_DIR_SEPARATOR_S); } return -1; } len = strlen (tmpl); if (len < 6 || strcmp (tmpl + len - 6, "XXXXXX")) { - if (error) { - *error = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX"); + if (gerror) { + *gerror = g_error_new (G_LOG_DOMAIN, 24, "Template should end with XXXXXX"); } return -1; } @@ -135,9 +135,9 @@ g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error) fd = mkstemp (t); if (fd == -1) { - if (error) { + if (gerror) { int err = errno; - *error = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()"); + *gerror = g_error_new (G_LOG_DOMAIN, g_file_error_from_errno (err), "Error in mkstemp()"); } g_free (t); return -1; diff --git a/mono/eglib/gfile-unix.c b/mono/eglib/gfile-unix.c index c213c8823f..a91a25f441 100644 --- a/mono/eglib/gfile-unix.c +++ b/mono/eglib/gfile-unix.c @@ -79,6 +79,19 @@ g_file_test (const gchar *filename, GFileTest test) return FALSE; } +#ifdef _AIX +/* HACK: the preprocessor will not give us mkdtemp no matter + what and Mono (for good reason) does + "-Werror-implicit-function-declaration" so we error out; + instead declare mkdtemp here; the linker will find mkdtemp + anwyays. libuv has had similar issues, but they just ignore + the compiler warning instead of failing on it. + + See: github.com/libuv/libuv/pull/740 */ + +extern char *mkdtemp(char *); +#endif + gchar * g_mkdtemp (char *tmp_template) { diff --git a/mono/eglib/gfile.c b/mono/eglib/gfile.c index 01cfa251b8..9669734822 100644 --- a/mono/eglib/gfile.c +++ b/mono/eglib/gfile.c @@ -36,7 +36,7 @@ #endif #include -static gpointer error_quark = "FileError"; +static gpointer error_quark = (gpointer)"FileError"; gpointer g_file_error_quark (void) diff --git a/mono/eglib/giconv.c b/mono/eglib/giconv.c index c7723fef5b..fd13f59971 100644 --- a/mono/eglib/giconv.c +++ b/mono/eglib/giconv.c @@ -254,8 +254,16 @@ g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft, * Unicode encoders and decoders */ +static FORCE_INLINE (uint32_t) +read_uint32_endian (unsigned char *inptr, unsigned endian) +{ + if (endian == G_LITTLE_ENDIAN) + return (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0]; + return (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3]; +} + static int -decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar) +decode_utf32_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned endian) { unsigned char *inptr = (unsigned char *) inbuf; gunichar c; @@ -265,7 +273,7 @@ decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar) return -1; } - c = (inptr[0] << 24) | (inptr[1] << 16) | (inptr[2] << 8) | inptr[3]; + c = read_uint32_endian (inptr, endian); if (c >= 0xd800 && c < 0xe000) { errno = EILSEQ; @@ -280,30 +288,16 @@ decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar) return 4; } +static int +decode_utf32be (char *inbuf, size_t inleft, gunichar *outchar) +{ + return decode_utf32_endian (inbuf, inleft, outchar, G_BIG_ENDIAN); +} + static int decode_utf32le (char *inbuf, size_t inleft, gunichar *outchar) { - unsigned char *inptr = (unsigned char *) inbuf; - gunichar c; - - if (inleft < 4) { - errno = EINVAL; - return -1; - } - - c = (inptr[3] << 24) | (inptr[2] << 16) | (inptr[1] << 8) | inptr[0]; - - if (c >= 0xd800 && c < 0xe000) { - errno = EILSEQ; - return -1; - } else if (c >= 0x110000) { - errno = EILSEQ; - return -1; - } - - *outchar = c; - - return 4; + return decode_utf32_endian (inbuf, inleft, outchar, G_LITTLE_ENDIAN); } static int @@ -342,8 +336,16 @@ encode_utf32le (gunichar c, char *outbuf, size_t outleft) return 4; } -static int -decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar) +static FORCE_INLINE (uint16_t) +read_uint16_endian (unsigned char *inptr, unsigned endian) +{ + if (endian == G_LITTLE_ENDIAN) + return (inptr[1] << 8) | inptr[0]; + return (inptr[0] << 8) | inptr[1]; +} + +static FORCE_INLINE (int) +decode_utf16_endian (char *inbuf, size_t inleft, gunichar *outchar, unsigned endian) { unsigned char *inptr = (unsigned char *) inbuf; gunichar2 c; @@ -354,7 +356,7 @@ decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar) return -1; } - u = (inptr[0] << 8) | inptr[1]; + u = read_uint16_endian (inptr, endian); if (u < 0xd800) { /* 0x0000 -> 0xd7ff */ @@ -367,7 +369,7 @@ decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar) return -2; } - c = (inptr[2] << 8) | inptr[3]; + c = read_uint16_endian (inptr + 2, endian); if (c < 0xdc00 || c > 0xdfff) { errno = EILSEQ; @@ -389,125 +391,72 @@ decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar) } } +static int +decode_utf16be (char *inbuf, size_t inleft, gunichar *outchar) +{ + return decode_utf16_endian (inbuf, inleft, outchar, G_BIG_ENDIAN); +} + static int decode_utf16le (char *inbuf, size_t inleft, gunichar *outchar) { - unsigned char *inptr = (unsigned char *) inbuf; - gunichar2 c; - gunichar u; - - if (inleft < 2) { - errno = EINVAL; - return -1; + return decode_utf16_endian (inbuf, inleft, outchar, G_LITTLE_ENDIAN); +} + +static FORCE_INLINE (void) +write_uint16_endian (unsigned char *outptr, uint16_t c, unsigned endian) +{ + if (endian == G_LITTLE_ENDIAN) { + outptr[0] = c & 0xff; + outptr[1] = (c >> 8) & 0xff; + return; } + outptr[0] = (c >> 8) & 0xff; + outptr[1] = c & 0xff; +} + +static FORCE_INLINE (int) +encode_utf16_endian (gunichar c, char *outbuf, size_t outleft, unsigned endian) +{ + unsigned char *outptr = (unsigned char *) outbuf; + gunichar2 ch; + gunichar c2; - u = (inptr[1] << 8) | inptr[0]; - - if (u < 0xd800) { - /* 0x0000 -> 0xd7ff */ - *outchar = u; + if (c < 0x10000) { + if (outleft < 2) { + errno = E2BIG; + return -1; + } + + write_uint16_endian (outptr, c, endian); return 2; - } else if (u < 0xdc00) { - /* 0xd800 -> 0xdbff */ - if (inleft < 4) { - errno = EINVAL; - return -2; - } - - c = (inptr[3] << 8) | inptr[2]; - - if (c < 0xdc00 || c > 0xdfff) { - errno = EILSEQ; - return -2; - } - - u = ((u - 0xd800) << 10) + (c - 0xdc00) + 0x0010000UL; - *outchar = u; - - return 4; - } else if (u < 0xe000) { - /* 0xdc00 -> 0xdfff */ - errno = EILSEQ; - return -1; } else { - /* 0xe000 -> 0xffff */ - *outchar = u; - return 2; + if (outleft < 4) { + errno = E2BIG; + return -1; + } + + c2 = c - 0x10000; + + ch = (gunichar2) ((c2 >> 10) + 0xd800); + write_uint16_endian (outptr, ch, endian); + + ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00); + write_uint16_endian (outptr + 2, ch, endian); + return 4; } } static int encode_utf16be (gunichar c, char *outbuf, size_t outleft) { - unsigned char *outptr = (unsigned char *) outbuf; - gunichar2 ch; - gunichar c2; - - if (c < 0x10000) { - if (outleft < 2) { - errno = E2BIG; - return -1; - } - - outptr[0] = (c >> 8) & 0xff; - outptr[1] = c & 0xff; - - return 2; - } else { - if (outleft < 4) { - errno = E2BIG; - return -1; - } - - c2 = c - 0x10000; - - ch = (gunichar2) ((c2 >> 10) + 0xd800); - outptr[0] = (ch >> 8) & 0xff; - outptr[1] = ch & 0xff; - - ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00); - outptr[2] = (ch >> 8) & 0xff; - outptr[3] = ch & 0xff; - - return 4; - } + return encode_utf16_endian (c, outbuf, outleft, G_BIG_ENDIAN); } static int encode_utf16le (gunichar c, char *outbuf, size_t outleft) { - unsigned char *outptr = (unsigned char *) outbuf; - gunichar2 ch; - gunichar c2; - - if (c < 0x10000) { - if (outleft < 2) { - errno = E2BIG; - return -1; - } - - outptr[0] = c & 0xff; - outptr[1] = (c >> 8) & 0xff; - - return 2; - } else { - if (outleft < 4) { - errno = E2BIG; - return -1; - } - - c2 = c - 0x10000; - - ch = (gunichar2) ((c2 >> 10) + 0xd800); - outptr[0] = ch & 0xff; - outptr[1] = (ch >> 8) & 0xff; - - ch = (gunichar2) ((c2 & 0x3ff) + 0xdc00); - outptr[2] = ch & 0xff; - outptr[3] = (ch >> 8) & 0xff; - - return 4; - } + return encode_utf16_endian (c, outbuf, outleft, G_LITTLE_ENDIAN); } static FORCE_INLINE (int) @@ -651,7 +600,7 @@ encode_latin1 (gunichar c, char *outbuf, size_t outleft) * Simple conversion API */ -static gpointer error_quark = "ConvertError"; +static gpointer error_quark = (gpointer)"ConvertError"; gpointer g_convert_error_quark (void) @@ -884,7 +833,7 @@ g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_written) } static gunichar2 * -eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean include_nuls, GError **err) +eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong *items_written, gboolean include_nuls, gboolean replace_invalid_codepoints, GError **err) { gunichar2 *outbuf, *outptr; size_t outlen = 0; @@ -915,8 +864,12 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong break; if ((u = g_unichar_to_utf16 (c, NULL)) < 0) { - errno = EILSEQ; - goto error; + if (replace_invalid_codepoints) { + u = 2; + } else { + errno = EILSEQ; + goto error; + } } outlen += u; @@ -941,7 +894,14 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong if (c == 0 && !include_nuls) break; - outptr += g_unichar_to_utf16 (c, outptr); + u = g_unichar_to_utf16 (c, outptr); + if ((u < 0) && replace_invalid_codepoints) { + outptr[0] = 0xFFFD; + outptr[1] = 0xFFFD; + u = 2; + } + + outptr += u; inleft -= n; inptr += n; } @@ -973,13 +933,19 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong gunichar2 * g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err) { - return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, err); + return eg_utf8_to_utf16_general (str, len, items_read, items_written, FALSE, FALSE, err); } gunichar2 * eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err) { - return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, err); + return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, FALSE, err); +} + +gunichar2 * +eg_wtf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err) +{ + return eg_utf8_to_utf16_general (str, len, items_read, items_written, TRUE, TRUE, err); } gunichar * diff --git a/mono/eglib/glib.h b/mono/eglib/glib.h index 333639f677..46d01e4a23 100644 --- a/mono/eglib/glib.h +++ b/mono/eglib/glib.h @@ -185,8 +185,8 @@ typedef struct { gchar *message; } GError; -void g_clear_error (GError **error); -void g_error_free (GError *error); +void g_clear_error (GError **gerror); +void g_error_free (GError *gerror); GError *g_error_new (gpointer domain, gint code, const char *format, ...); void g_set_error (GError **err, gpointer domain, gint code, const gchar *format, ...); void g_propagate_error (GError **dest, GError *src); @@ -217,8 +217,8 @@ gchar *g_strnfill (gsize length, gchar fill_char); gchar *g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter); gchar *g_strescape (const gchar *source, const gchar *exceptions); -gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error); -gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error); +gchar *g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **gerror); +gchar *g_filename_from_uri (const gchar *uri, gchar **hostname, GError **gerror); gint g_printf (gchar const *format, ...); gint g_fprintf (FILE *file, gchar const *format, ...); @@ -245,6 +245,8 @@ gint g_ascii_xdigit_value (gchar c); #define g_ascii_isalpha(c) (isalpha (c) != 0) #define g_ascii_isprint(c) (isprint (c) != 0) #define g_ascii_isxdigit(c) (isxdigit (c) != 0) +gboolean g_utf16_ascii_equal (const gunichar2 *utf16, size_t ulen, const char *ascii, size_t alen); +gboolean g_utf16_asciiz_equal (const gunichar2 *utf16, const char *ascii); /* FIXME: g_strcasecmp supports utf8 unicode stuff */ #ifdef _MSC_VER @@ -719,9 +721,37 @@ GUnicodeBreakType g_unichar_break_type (gunichar c); #define eg_unreachable() #endif -#define g_assert(x) G_STMT_START { if (G_UNLIKELY (!(x))) g_assertion_message ("* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x); } G_STMT_END +/* Old version. Preserved for testing and history. */ + +/* g_assert is a boolean expression; the precise value is not preserved, just true or false. */ +#define g_assert(x) \ + (G_LIKELY(x) ? 1 : (g_assertion_message ( \ + "* Assertion at %s:%d, condition `%s' not met\n", __FILE__, __LINE__, #x), 0)) + #define g_assert_not_reached() G_STMT_START { g_assertion_message ("* Assertion: should not be reached at %s:%d\n", __FILE__, __LINE__); eg_unreachable(); } G_STMT_END +/* f is format -- like printf and scanf + * Where you might have said: + * if (!(expr)) + * g_error("%s invalid bar:%d", __func__, bar) + * + * You can say: + * g_assertf(expr, "bar:%d", bar); + * + * The usual assertion text of file/line/expr/newline are builtin, and __func__. + * + * g_assertf is a boolean expression -- the precise value is not preserved, just true or false. + * + * Other than expr, the parameters are not evaluated unless expr is false. + * + * format must be a string literal, in order to be concatenated. + * If this is too restrictive, g_error remains. + */ +#define g_assertf(x, format, ...) \ + (G_LIKELY(x) ? 1 : (g_assertion_message ( \ + "* Assertion at %s:%d, condition `%s' not met, function:%s, " format "\n", \ + __FILE__, __LINE__, #x, __func__, __VA_ARGS__), 0)) + /* * Unicode conversion */ @@ -744,6 +774,7 @@ gunichar *g_utf8_to_ucs4_fast (const gchar *str, glong len, glong *items_writte gunichar *g_utf8_to_ucs4 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err); gunichar2 *g_utf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err); gunichar2 *eg_utf8_to_utf16_with_nuls (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err); +gunichar2 *eg_wtf8_to_utf16 (const gchar *str, glong len, glong *items_read, glong *items_written, GError **err); gchar *g_utf16_to_utf8 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err); gunichar *g_utf16_to_ucs4 (const gunichar2 *str, glong len, glong *items_read, glong *items_written, GError **err); gchar *g_ucs4_to_utf8 (const gunichar *str, glong len, glong *items_read, glong *items_written, GError **err); @@ -780,8 +811,8 @@ gboolean g_ensure_directory_exists (const gchar *filename); * Shell */ -gboolean g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error); -gchar *g_shell_unquote (const gchar *quoted_string, GError **error); +gboolean g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **gerror); +gchar *g_shell_unquote (const gchar *quoted_string, GError **gerror); gchar *g_shell_quote (const gchar *unquoted_string); /* @@ -799,9 +830,9 @@ typedef enum { typedef void (*GSpawnChildSetupFunc) (gpointer user_data); -gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error); +gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **gerror); gboolean g_spawn_async_with_pipes (const gchar *working_directory, gchar **argv, gchar **envp, GSpawnFlags flags, GSpawnChildSetupFunc child_setup, - gpointer user_data, GPid *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **error); + gpointer user_data, GPid *child_pid, gint *standard_input, gint *standard_output, gint *standard_error, GError **gerror); int eg_getdtablesize (void); @@ -872,10 +903,10 @@ typedef enum { } GFileTest; -gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **error); -gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **error); +gboolean g_file_set_contents (const gchar *filename, const gchar *contents, gssize length, GError **gerror); +gboolean g_file_get_contents (const gchar *filename, gchar **contents, gsize *length, GError **gerror); GFileError g_file_error_from_errno (gint err_no); -gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error); +gint g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **gerror); gboolean g_file_test (const gchar *filename, GFileTest test); #define g_open open @@ -904,7 +935,7 @@ gboolean g_pattern_match_string (GPatternSpec *pspec, const gchar *string) * Directory */ typedef struct _GDir GDir; -GDir *g_dir_open (const gchar *path, guint flags, GError **error); +GDir *g_dir_open (const gchar *path, guint flags, GError **gerror); const gchar *g_dir_read_name (GDir *dir); void g_dir_rewind (GDir *dir); void g_dir_close (GDir *dir); @@ -929,26 +960,26 @@ typedef struct { const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, - GError **error); + GError **gerror); void (*end_element) (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, - GError **error); + GError **gerror); void (*text) (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, - GError **error); + GError **gerror); void (*passthrough) (GMarkupParseContext *context, const gchar *passthrough_text, gsize text_len, gpointer user_data, - GError **error); + GError **gerror); void (*error) (GMarkupParseContext *context, - GError *error, + GError *gerror, gpointer user_data); } GMarkupParser; @@ -959,9 +990,9 @@ GMarkupParseContext *g_markup_parse_context_new (const GMarkupParser *parser, void g_markup_parse_context_free (GMarkupParseContext *context); gboolean g_markup_parse_context_parse (GMarkupParseContext *context, const gchar *text, gssize text_len, - GError **error); + GError **gerror); gboolean g_markup_parse_context_end_parse (GMarkupParseContext *context, - GError **error); + GError **gerror); /* * Character set conversion @@ -975,14 +1006,14 @@ int g_iconv_close (GIConv cd); gboolean g_get_charset (G_CONST_RETURN char **charset); gchar *g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, - GError **error); + GError **gerror); gchar *g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, - gsize *bytes_written, GError **error); + gsize *bytes_written, GError **gerror); gchar *g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, - gsize *bytes_written, GError **error); + gsize *bytes_written, GError **gerror); gchar *g_convert (const gchar *str, gssize len, const gchar *to_codeset, const gchar *from_codeset, - gsize *bytes_read, gsize *bytes_written, GError **error); + gsize *bytes_read, gsize *bytes_written, GError **gerror); /* * Unicode manipulation diff --git a/mono/eglib/gmarkup.c b/mono/eglib/gmarkup.c index 4e6c6641fe..a91058a4e5 100644 --- a/mono/eglib/gmarkup.c +++ b/mono/eglib/gmarkup.c @@ -43,7 +43,7 @@ #include #include -#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0); +#define set_error(msg, ...) do { if (gerror != NULL) *gerror = g_error_new (GINT_TO_POINTER (1), 1, msg, __VA_ARGS__); } while (0); typedef enum { START, @@ -127,6 +127,24 @@ my_isalpha (char c) return FALSE; } +static gboolean +my_isnamestartchar (char c) +{ + /* NameStartChar from https://www.w3.org/TR/xml/#sec-common-syn excluding non-ASCII and ':' */ + if (my_isalpha (c) || c == '_') + return TRUE; + return FALSE; +} + +static gboolean +my_isnamechar (char c) +{ + /* NameChar from https://www.w3.org/TR/xml/#sec-common-syn excluding non-ASCII and ':' */ + if (my_isalnum (c) || c == '_' || c == '-' || c == '.') + return TRUE; + return FALSE; +} + static const char * skip_space (const char *p, const char *end) { @@ -136,7 +154,7 @@ skip_space (const char *p, const char *end) } static const char * -parse_value (const char *p, const char *end, char **value, GError **error) +parse_value (const char *p, const char *end, char **value, GError **gerror) { const char *start; int l; @@ -166,8 +184,9 @@ parse_name (const char *p, const char *end, char **value) const char *start = p; int l; - for (; p < end && my_isalnum (*p); p++) - ; + if (p < end && my_isnamestartchar (*p)) + for (; p < end && my_isnamechar (*p); p++) + ; if (p == end) return end; @@ -181,7 +200,7 @@ parse_name (const char *p, const char *end, char **value) } static const char * -parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **error, int *full_stop, int state) +parse_attributes (const char *p, const char *end, char ***names, char ***values, GError **gerror, int *full_stop, int state) { int nnames = 0; @@ -226,7 +245,7 @@ parse_attributes (const char *p, const char *end, char ***names, char ***values, return end; } - p = parse_value (p, end, &value, error); + p = parse_value (p, end, &value, gerror); if (p == end){ g_free (name); return p; @@ -261,7 +280,7 @@ destroy_parse_state (GMarkupParseContext *context) gboolean g_markup_parse_context_parse (GMarkupParseContext *context, const gchar *text, gssize text_len, - GError **error) + GError **gerror) { const char *p, *end; @@ -309,12 +328,12 @@ g_markup_parse_context_parse (GMarkupParseContext *context, break; } - if (!my_isalpha (*p)){ + if (!my_isnamestartchar (*p)){ set_error ("%s", "Expected an element name"); goto fail; } - for (++p; p < end && (my_isalnum (*p) || (*p == '.')); p++) + for (++p; p < end && my_isnamechar (*p); p++) ; if (p == end){ set_error ("%s", "Expected an element"); @@ -328,14 +347,14 @@ g_markup_parse_context_parse (GMarkupParseContext *context, set_error ("%s", "Unfinished element"); goto fail; } - p = parse_attributes (p, end, &names, &values, error, &full_stop, context->state); + p = parse_attributes (p, end, &names, &values, gerror, &full_stop, context->state); if (p == end){ if (names != NULL) { g_strfreev (names); g_strfreev (values); } /* Only set the error if parse_attributes did not */ - if (error != NULL && *error == NULL) + if (gerror != NULL && *gerror == NULL) set_error ("%s", "Unfinished sequence"); goto fail; } @@ -351,22 +370,22 @@ g_markup_parse_context_parse (GMarkupParseContext *context, context->parser.start_element (context, ename, (const gchar **) names, (const gchar **) values, - context->user_data, error); + context->user_data, gerror); if (names != NULL){ g_strfreev (names); g_strfreev (values); } - if (error != NULL && *error != NULL){ + if (gerror != NULL && *gerror != NULL){ g_free (ename); goto fail; } if (full_stop){ if (context->parser.end_element != NULL && context->state == START_ELEMENT){ - context->parser.end_element (context, ename, context->user_data, error); - if (error != NULL && *error != NULL){ + context->parser.end_element (context, ename, context->user_data, gerror); + if (gerror != NULL && *gerror != NULL){ g_free (ename); goto fail; } @@ -406,8 +425,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context, case FLUSH_TEXT: if (context->parser.text != NULL && context->text != NULL){ context->parser.text (context, context->text->str, context->text->len, - context->user_data, error); - if (error != NULL && *error != NULL) + context->user_data, gerror); + if (gerror != NULL && *gerror != NULL) goto fail; } @@ -430,8 +449,8 @@ g_markup_parse_context_parse (GMarkupParseContext *context, text = current->data; if (context->parser.end_element != NULL){ - context->parser.end_element (context, text, context->user_data, error); - if (error != NULL && *error != NULL){ + context->parser.end_element (context, text, context->user_data, gerror); + if (gerror != NULL && *gerror != NULL){ g_free (text); goto fail; } @@ -453,15 +472,15 @@ g_markup_parse_context_parse (GMarkupParseContext *context, return TRUE; fail: - if (context->parser.error && error != NULL && *error) - context->parser.error (context, *error, context->user_data); + if (context->parser.error && gerror != NULL && *gerror) + context->parser.error (context, *gerror, context->user_data); destroy_parse_state (context); return FALSE; } gboolean -g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **error) +g_markup_parse_context_end_parse (GMarkupParseContext *context, GError **gerror) { g_return_val_if_fail (context != NULL, FALSE); diff --git a/mono/eglib/gshell.c b/mono/eglib/gshell.c index 43b4c17870..07b355b9d6 100644 --- a/mono/eglib/gshell.c +++ b/mono/eglib/gshell.c @@ -29,7 +29,7 @@ #include static int -split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error) +split_cmdline (const gchar *cmdline, GPtrArray *array, GError **gerror) { gchar *ptr; gchar c; @@ -81,15 +81,15 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error) } if (escaped) { - if (error) - *error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape."); + if (gerror) + *gerror = g_error_new (G_LOG_DOMAIN, 0, "Unfinished escape."); g_string_free (str, TRUE); return -1; } if (quote_char) { - if (error) - *error = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote."); + if (gerror) + *gerror = g_error_new (G_LOG_DOMAIN, 0, "Unfinished quote."); g_string_free (str, TRUE); return -1; } @@ -104,17 +104,17 @@ split_cmdline (const gchar *cmdline, GPtrArray *array, GError **error) } gboolean -g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **error) +g_shell_parse_argv (const gchar *command_line, gint *argcp, gchar ***argvp, GError **gerror) { GPtrArray *array; gint argc; gchar **argv; g_return_val_if_fail (command_line, FALSE); - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); + g_return_val_if_fail (gerror == NULL || *gerror == NULL, FALSE); array = g_ptr_array_new(); - if (split_cmdline (command_line, array, error)) { + if (split_cmdline (command_line, array, gerror)) { g_ptr_array_add (array, NULL); g_strfreev ((gchar **) array->pdata); g_ptr_array_free (array, FALSE); @@ -160,7 +160,7 @@ g_shell_quote (const gchar *unquoted_string) } gchar * -g_shell_unquote (const gchar *quoted_string, GError **error) +g_shell_unquote (const gchar *quoted_string, GError **gerror) { GString *result; const char *p; @@ -192,7 +192,7 @@ g_shell_unquote (const gchar *quoted_string, GError **error) g_string_append_c (result, *p); } if (!*p){ - g_set_error (error, 0, 0, "Open quote"); + g_set_error (gerror, 0, 0, "Open quote"); return NULL; } } else if (*p == '"'){ @@ -203,7 +203,7 @@ g_shell_unquote (const gchar *quoted_string, GError **error) if (*p == '\\'){ p++; if (*p == 0){ - g_set_error (error, 0, 0, "Open quote"); + g_set_error (gerror, 0, 0, "Open quote"); return NULL; } switch (*p){ @@ -220,7 +220,7 @@ g_shell_unquote (const gchar *quoted_string, GError **error) g_string_append_c (result, *p); } if (!*p){ - g_set_error (error, 0, 0, "Open quote"); + g_set_error (gerror, 0, 0, "Open quote"); return NULL; } } else if (*p == '\\'){ diff --git a/mono/eglib/gspawn.c b/mono/eglib/gspawn.c index 01639be101..e1b0e2968a 100644 --- a/mono/eglib/gspawn.c +++ b/mono/eglib/gspawn.c @@ -68,9 +68,9 @@ #define pipe(x) _pipe(x, 256, 0) #endif -#define set_error(msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0) -#define set_error_cond(cond,msg, ...) do { if ((cond) && error != NULL) *error = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0) -#define set_error_status(status,msg, ...) do { if (error != NULL) *error = g_error_new (G_LOG_DOMAIN, status, msg, __VA_ARGS__); } while (0) +#define set_error(msg, ...) do { if (gerror != NULL) *gerror = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0) +#define set_error_cond(cond,msg, ...) do { if ((cond) && gerror != NULL) *gerror = g_error_new (G_LOG_DOMAIN, 1, msg, __VA_ARGS__); } while (0) +#define set_error_status(status,msg, ...) do { if (gerror != NULL) *gerror = g_error_new (G_LOG_DOMAIN, status, msg, __VA_ARGS__); } while (0) #define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR) #define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0) @@ -94,7 +94,7 @@ extern char **environ; #ifndef G_OS_WIN32 static int -safe_read (int fd, gchar *buffer, gint count, GError **error) +safe_read (int fd, gchar *buffer, gint count, GError **gerror) { int res; @@ -104,7 +104,7 @@ safe_read (int fd, gchar *buffer, gint count, GError **error) } static int -read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **error) +read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **gerror) { fd_set rfds; int res; @@ -151,7 +151,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err if (buffer == NULL) buffer = g_malloc (1024); if (!out_closed && FD_ISSET (outfd, &rfds)) { - nread = safe_read (outfd, buffer, 1024, error); + nread = safe_read (outfd, buffer, 1024, gerror); if (nread < 0) { close (errfd); close (outfd); @@ -165,7 +165,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err } if (!err_closed && FD_ISSET (errfd, &rfds)) { - nread = safe_read (errfd, buffer, 1024, error); + nread = safe_read (errfd, buffer, 1024, gerror); if (nread < 0) { close (errfd); close (outfd); @@ -191,7 +191,7 @@ read_pipes (int outfd, gchar **out_str, int errfd, gchar **err_str, GError **err } static gboolean -create_pipe (int *fds, GError **error) +create_pipe (int *fds, GError **gerror) { if (pipe (fds) == -1) { set_error ("%s", "Error creating pipe."); @@ -250,7 +250,7 @@ g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, - GError **error) + GError **gerror) { #ifdef G_OS_WIN32 #elif !defined (HAVE_FORK) || !defined (HAVE_EXECV) @@ -265,13 +265,13 @@ g_spawn_command_line_sync (const gchar *command_line, int status; int res; - if (!g_shell_parse_argv (command_line, &argc, &argv, error)) + if (!g_shell_parse_argv (command_line, &argc, &argv, gerror)) return FALSE; - if (standard_output && !create_pipe (stdout_pipe, error)) + if (standard_output && !create_pipe (stdout_pipe, gerror)) return FALSE; - if (standard_error && !create_pipe (stderr_pipe, error)) { + if (standard_error && !create_pipe (stderr_pipe, gerror)) { if (standard_output) { CLOSE_PIPE (stdout_pipe); } @@ -317,7 +317,7 @@ g_spawn_command_line_sync (const gchar *command_line, close (stderr_pipe [1]); if (standard_output || standard_error) { - res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, error); + res = read_pipes (stdout_pipe [0], standard_output, stderr_pipe [0], standard_error, gerror); if (res) { waitpid (pid, &status, WNOHANG); /* avoid zombie */ return FALSE; @@ -349,7 +349,7 @@ g_spawn_async_with_pipes (const gchar *working_directory, gint *standard_input, gint *standard_output, gint *standard_error, - GError **error) + GError **gerror) { #ifdef G_OS_WIN32 #elif !defined (HAVE_FORK) || !defined (HAVE_EXECVE) @@ -365,21 +365,21 @@ g_spawn_async_with_pipes (const gchar *working_directory, g_return_val_if_fail (argv != NULL, FALSE); /* Only mandatory arg */ - if (!create_pipe (info_pipe, error)) + if (!create_pipe (info_pipe, gerror)) return FALSE; - if (standard_output && !create_pipe (out_pipe, error)) { + if (standard_output && !create_pipe (out_pipe, gerror)) { CLOSE_PIPE (info_pipe); return FALSE; } - if (standard_error && !create_pipe (err_pipe, error)) { + if (standard_error && !create_pipe (err_pipe, gerror)) { CLOSE_PIPE (info_pipe); CLOSE_PIPE (out_pipe); return FALSE; } - if (standard_input && !create_pipe (in_pipe, error)) { + if (standard_input && !create_pipe (in_pipe, gerror)) { CLOSE_PIPE (info_pipe); CLOSE_PIPE (out_pipe); CLOSE_PIPE (err_pipe); diff --git a/mono/eglib/gstr.c b/mono/eglib/gstr.c index e8a76e429c..dc2346cc99 100644 --- a/mono/eglib/gstr.c +++ b/mono/eglib/gstr.c @@ -662,7 +662,7 @@ char_needs_encoding (char c) } gchar * -g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error) +g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **gerror) { size_t n; char *ret, *rp; @@ -679,8 +679,8 @@ g_filename_to_uri (const gchar *filename, const gchar *hostname, GError **error) g_warning ("%s", "eglib: g_filename_to_uri: hostname not handled"); if (!g_path_is_absolute (filename)){ - if (error != NULL) - *error = g_error_new (NULL, 2, "Not an absolute filename"); + if (gerror != NULL) + *gerror = g_error_new (NULL, 2, "Not an absolute filename"); return NULL; } @@ -732,7 +732,7 @@ decode (char p) } gchar * -g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error) +g_filename_from_uri (const gchar *uri, gchar **hostname, GError **gerror) { const char *p; char *r, *result; @@ -744,8 +744,8 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error) g_warning ("%s", "eglib: g_filename_from_uri: hostname not handled"); if (strncmp (uri, "file:///", 8) != 0){ - if (error != NULL) - *error = g_error_new (NULL, 2, "URI does not start with the file: scheme"); + if (gerror != NULL) + *gerror = g_error_new (NULL, 2, "URI does not start with the file: scheme"); return NULL; } @@ -754,8 +754,8 @@ g_filename_from_uri (const gchar *uri, gchar **hostname, GError **error) if (p [1] && p [2] && isxdigit (p [1]) && isxdigit (p [2])){ p += 2; } else { - if (error != NULL) - *error = g_error_new (NULL, 2, "URI contains an invalid escape sequence"); + if (gerror != NULL) + *gerror = g_error_new (NULL, 2, "URI contains an invalid escape sequence"); return NULL; } } @@ -886,6 +886,34 @@ g_ascii_strcasecmp (const gchar *s1, const gchar *s2) return (*sp1) - (*sp2); } +gboolean +g_utf16_ascii_equal (const gunichar2 *utf16, size_t ulen, const char *ascii, size_t alen) +{ + size_t i; + if (ulen != alen) + return FALSE; + for (i = 0; i < ulen; ++i) { + if (utf16[i] != ascii[i]) + return FALSE; + } + return TRUE; +} + +gboolean +g_utf16_asciiz_equal (const gunichar2 *utf16, const char *ascii) +// z for zero means null terminated +{ + while (1) + { + char a = *ascii++; + gunichar2 u = *utf16++; + if (a != u) + return FALSE; + if (a == 0) + return TRUE; + } +} + gchar * g_strdelimit (gchar *string, const gchar *delimiters, gchar new_delimiter) { diff --git a/mono/eglib/gunicode.c b/mono/eglib/gunicode.c index c1280f9b8b..2c76c7c970 100644 --- a/mono/eglib/gunicode.c +++ b/mono/eglib/gunicode.c @@ -98,7 +98,7 @@ g_unichar_break_type (gunichar c) return G_UNICODE_BREAK_UNKNOWN; } -gunichar +static gunichar g_unichar_case (gunichar c, gboolean upper) { gint8 i, i2; @@ -188,7 +188,7 @@ g_unichar_isspace (gunichar c) * This is broken, and assumes an UTF8 system, but will do for eglib's first user */ gchar * -g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) +g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **gerror) { char *res; @@ -224,17 +224,17 @@ g_get_charset (G_CONST_RETURN char **charset) #endif /* G_OS_WIN32 */ gchar * -g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) +g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **gerror) { g_get_charset (NULL); - return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, error); + return g_convert (opsysstring, len, "UTF-8", my_charset, bytes_read, bytes_written, gerror); } gchar * -g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error) +g_locale_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **gerror) { g_get_charset (NULL); - return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, error); + return g_convert (utf8string, len, my_charset, "UTF-8", bytes_read, bytes_written, gerror); } diff --git a/mono/metadata/Makefile.am b/mono/metadata/Makefile.am index 3c6ed9960c..6b17dee4dc 100644 --- a/mono/metadata/Makefile.am +++ b/mono/metadata/Makefile.am @@ -63,38 +63,36 @@ if HOST_ANDROID platform_sources += ../../support/libm/complex.c endif -# -# libtool is not capable of creating static/shared versions of the same -# convenience lib, so we have to do it ourselves -# -if SUPPORT_SGEN -if DISABLE_EXECUTABLES -shared_sgen_libraries = libmonoruntimesgen.la +if HOST_WASM +platform_sources += threadpool-worker-wasm.c else -if SHARED_MONO -shared_sgen_libraries = libmonoruntimesgen.la +platform_sources += threadpool-worker-default.c endif + +if BITCODE +libmonoldflags = -no-undefined endif -sgen_libraries = $(shared_sgen_libraries) libmonoruntimesgen-static.la + +if SUPPORT_SGEN +sgen_libraries = libmonoruntimesgen.la endif if SUPPORT_BOEHM -if DISABLE_EXECUTABLES -shared_boehm_libraries = libmonoruntime.la -else -if SHARED_MONO -shared_boehm_libraries = libmonoruntime.la -endif -endif -boehm_libraries = $(shared_boehm_libraries) libmonoruntime-static.la +boehm_libraries = libmonoruntime.la endif -if DISABLE_EXECUTABLES -noinst_LTLIBRARIES = libmonoruntime-config.la $(shared_sgen_libraries) $(shared_boehm_libraries) -else -noinst_LTLIBRARIES = libmonoruntime-config.la $(boehm_libraries) $(sgen_libraries) +if DISABLE_ICALL_TABLES +icall_table_libraries = libmono-icall-table.la endif +if !ENABLE_ILGEN +ilgen_libraries = libmono-ilgen.la +endif + +noinst_LTLIBRARIES = libmonoruntime-config.la $(boehm_libraries) $(sgen_libraries) + +lib_LTLIBRARIES = $(icall_table_libraries) $(ilgen_libraries) + AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) # @@ -115,6 +113,38 @@ libmonoruntime_config_la_SOURCES = \ mono-config-dirs.c libmonoruntime_config_la_CPPFLAGS = $(AM_CPPFLAGS) -DMONO_BINDIR=\"$(bindir)/\" -DMONO_ASSEMBLIES=\"$(assembliesdir)\" -DMONO_CFG_DIR=\"$(confdir)\" -DMONO_RELOC_LIBDIR=\"../$(reloc_libdir)\" +# +# This library contains the icall tables if the runtime was configured with --disable-icall-tables +# +if DISABLE_ICALL_TABLES +libmono_icall_table_la_SOURCES = \ + icall-table.c +libmono_icall_table_la_CFLAGS = $(SGEN_DEFINES) +libmono_icall_table_la_LDFLAGS = $(libmonoldflags) +if BITCODE +libmono_icall_table_la_LIBADD = ../eglib/libeglib.la ../utils/libmonoutils.la ../sgen/libmonosgen.la libmonoruntimesgen.la +endif +endif + +# +# This library contains code to generate IL at runtime +# +if !ENABLE_ILGEN +libmono_ilgen_la_SOURCES = \ + method-builder-ilgen.c \ + method-builder-ilgen.h \ + method-builder-ilgen-internals.h \ + marshal-ilgen.c \ + marshal-ilgen.h \ + sgen-mono-ilgen.c \ + sgen-mono-ilgen.h +libmono_ilgen_la_CFLAGS = $(SGEN_DEFINES) +libmono_ilgen_la_LDFLAGS = $(libmonoldflags) +if BITCODE +libmono_ilgen_la_LIBADD = ../eglib/libeglib.la ../utils/libmonoutils.la ../sgen/libmonosgen.la libmonoruntimesgen.la +endif +endif + CLEANFILES = mono-bundle.stamp null_sources = \ @@ -125,6 +155,22 @@ null_gc_sources = \ null-gc-handles.h \ null-gc-handles.c +if !DISABLE_ICALL_TABLES +icall_tables_sources = \ + icall-table.c +endif + +if ENABLE_ILGEN +ilgen_sources = \ + method-builder-ilgen.c \ + method-builder-ilgen.h \ + method-builder-ilgen-internals.h \ + marshal-ilgen.c \ + marshal-ilgen.h \ + sgen-mono-ilgen.c \ + sgen-mono-ilgen.h +endif + common_sources = \ $(platform_sources) \ appdomain.c \ @@ -169,6 +215,7 @@ common_sources = \ icall.c \ icall-internals.h \ icall-def.h \ + icall-table.h \ image.c \ image-internals.h \ jit-info.c \ @@ -187,6 +234,7 @@ common_sources = \ metadata-verify.c \ metadata-internals.h \ method-builder.h \ + method-builder-internals.h \ method-builder.c \ mono-basic-block.c \ mono-basic-block.h \ @@ -214,6 +262,7 @@ common_sources = \ number-ms.c \ number-ms.h \ object.c \ + object-forward.h \ object-internals.h \ opcodes.c \ property-bag.h \ @@ -246,7 +295,6 @@ common_sources = \ threads-types.h \ threadpool.c \ threadpool.h \ - threadpool-worker-default.c \ threadpool-worker.h \ threadpool-io.c \ threadpool-io.h \ @@ -309,37 +357,28 @@ sgen_sources = \ sgen-toggleref.h \ sgen-stw.c \ sgen-mono.c \ + sgen-mono.h \ sgen-client-mono.h -libmonoruntime_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources) +libmonoruntime_la_SOURCES = $(common_sources) $(icall_tables_sources) $(ilgen_sources) $(gc_dependent_sources) $(null_gc_sources) $(boehm_sources) libmonoruntime_la_CFLAGS = $(BOEHM_DEFINES) libmonoruntime_la_LIBADD = libmonoruntime-config.la -libmonoruntimesgen_la_SOURCES = $(common_sources) $(gc_dependent_sources) $(sgen_sources) +libmonoruntimesgen_la_SOURCES = $(common_sources) $(icall_tables_sources) $(ilgen_sources) $(gc_dependent_sources) $(sgen_sources) libmonoruntimesgen_la_CFLAGS = $(SGEN_DEFINES) libmonoruntimesgen_la_LIBADD = libmonoruntime-config.la -libmonoruntime_static_la_SOURCES = $(libmonoruntime_la_SOURCES) -libmonoruntime_static_la_LDFLAGS = -static -libmonoruntime_static_la_CFLAGS = $(BOEHM_DEFINES) -libmonoruntime_static_la_LIBADD = $(bundle_obj) libmonoruntime-config.la - -libmonoruntimesgen_static_la_SOURCES = $(libmonoruntimesgen_la_SOURCES) -libmonoruntimesgen_static_la_LDFLAGS = -static -libmonoruntimesgen_static_la_CFLAGS = $(SGEN_DEFINES) -libmonoruntimesgen_static_la_LIBADD = libmonoruntime-config.la - libmonoruntimeincludedir = $(includedir)/mono-$(API_VER)/mono/metadata +# This list is sorted for easier searching. libmonoruntimeinclude_HEADERS = \ + appdomain.h \ assembly.h \ attrdefs.h \ - appdomain.h \ blob.h \ class.h \ debug-helpers.h \ debug-mono-symfile.h \ - threads.h \ environment.h \ exception.h \ image.h \ @@ -348,13 +387,14 @@ libmonoruntimeinclude_HEADERS = \ mono-config.h \ mono-debug.h \ mono-gc.h \ - sgen-bridge.h \ object.h \ opcodes.h \ profiler.h \ profiler-events.h \ reflection.h \ row-indexes.h \ + sgen-bridge.h \ + threads.h \ tokentype.h \ verify.h diff --git a/mono/metadata/Makefile.in.REMOVED.git-id b/mono/metadata/Makefile.in.REMOVED.git-id index fc805395e0..c2bc050320 100644 --- a/mono/metadata/Makefile.in.REMOVED.git-id +++ b/mono/metadata/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -c42d5b485de824d97a128fd2845cdc5a07edf6f4 \ No newline at end of file +2d5717007116890444130260e939df68297131e2 \ No newline at end of file diff --git a/mono/metadata/appdomain.c b/mono/metadata/appdomain.c index 0975c8cec2..dfb72166b3 100644 --- a/mono/metadata/appdomain.c +++ b/mono/metadata/appdomain.c @@ -174,7 +174,7 @@ mono_runtime_get_no_exec (void) static void create_domain_objects (MonoDomain *domain) { - MonoError error; + ERROR_DECL (error); MonoDomain *old_domain = mono_domain_get (); MonoString *arg; MonoVTable *string_vt; @@ -189,40 +189,41 @@ create_domain_objects (MonoDomain *domain) * Initialize String.Empty. This enables the removal of * the static cctor of the String class. */ - string_vt = mono_class_vtable (domain, mono_defaults.string_class); + 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"); g_assert (string_empty_fld); - MonoString *empty_str = mono_string_new_checked (domain, "", &error); - mono_error_assert_ok (&error); - empty_str = mono_string_intern_checked (empty_str, &error); - mono_error_assert_ok (&error); + MonoString *empty_str = mono_string_new_checked (domain, "", error); + mono_error_assert_ok (error); + empty_str = mono_string_intern_checked (empty_str, error); + mono_error_assert_ok (error); mono_field_static_set_value (string_vt, string_empty_fld, empty_str); domain->empty_string = empty_str; /* * 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); - 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); - mono_error_assert_ok (&error); + arg = mono_string_new_checked (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); + 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); - mono_error_assert_ok (&error); - domain->null_reference_ex = mono_exception_from_name_two_strings_checked (mono_defaults.corlib, "System", "NullReferenceException", arg, NULL, &error); - mono_error_assert_ok (&error); - arg = mono_string_new_checked (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); - mono_error_assert_ok (&error); + arg = mono_string_new_checked (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); + mono_error_assert_ok (error); + arg = mono_string_new_checked (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); + mono_error_assert_ok (error); /*The ephemeron tombstone i*/ - domain->ephemeron_tombstone = mono_object_new_checked (domain, mono_defaults.object_class, &error); - mono_error_assert_ok (&error); + domain->ephemeron_tombstone = mono_object_new_checked (domain, mono_defaults.object_class, error); + mono_error_assert_ok (error); if (domain != old_domain) { mono_thread_pop_appdomain_ref (); @@ -251,9 +252,9 @@ create_domain_objects (MonoDomain *domain) void mono_runtime_init (MonoDomain *domain, MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb) { - MonoError error; - mono_runtime_init_checked (domain, start_cb, attach_cb, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + mono_runtime_init_checked (domain, start_cb, attach_cb, error); + mono_error_cleanup (error); } void @@ -336,7 +337,7 @@ mono_context_set_default_context (MonoDomain *domain) static int mono_get_corlib_version (void) { - MonoError error; + ERROR_DECL (error); MonoClass *klass; MonoClassField *field; MonoObject *value; @@ -348,8 +349,8 @@ mono_get_corlib_version (void) return -1; if (! (field->type->attrs & FIELD_ATTRIBUTE_STATIC)) return -1; - value = mono_field_get_value_object_checked (mono_domain_get (), field, NULL, &error); - mono_error_assert_ok (&error); + value = mono_field_get_value_object_checked (mono_domain_get (), field, NULL, error); + mono_error_assert_ok (error); return *(gint32*)((gchar*)value + sizeof (MonoObject)); } @@ -383,9 +384,9 @@ mono_check_corlib_version (void) void mono_context_init (MonoDomain *domain) { - MonoError error; - mono_context_init_checked (domain, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + mono_context_init_checked (domain, error); + mono_error_cleanup (error); } void @@ -467,9 +468,9 @@ MonoDomain * mono_domain_create_appdomain (char *friendly_name, char *configuration_file) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoDomain *domain = mono_domain_create_appdomain_checked (friendly_name, configuration_file, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoDomain *domain = mono_domain_create_appdomain_checked (friendly_name, configuration_file, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_VAL (domain); } @@ -524,9 +525,9 @@ void mono_domain_set_config (MonoDomain *domain, const char *base_dir, const char *config_file_name) { HANDLE_FUNCTION_ENTER (); - MonoError error; - mono_domain_set_config_checked (domain, base_dir, config_file_name, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + mono_domain_set_config_checked (domain, base_dir, config_file_name, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN (); } @@ -706,56 +707,112 @@ mono_domain_has_type_resolve (MonoDomain *domain) /** * mono_domain_try_type_resolve: - * \param domain application domainwhere the name where the type is going to be resolved + * \param domain application domain in which to resolve the type * \param name the name of the type to resolve or NULL. - * \param tb A \c System.Reflection.Emit.TypeBuilder, used if name is NULL. + * \param typebuilder A \c System.Reflection.Emit.TypeBuilder, used if name is NULL. * * This routine invokes the internal \c System.AppDomain.DoTypeResolve and returns - * the assembly that matches name. - * - * If \p name is null, the value of \c ((TypeBuilder)tb).FullName is used instead + * the assembly that matches name, or ((TypeBuilder)typebuilder).FullName. * * \returns A \c MonoReflectionAssembly or NULL if not found */ MonoReflectionAssembly * -mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *tb) +mono_domain_try_type_resolve (MonoDomain *domain, char *name, MonoObject *typebuilder) { - MonoError error; - MonoReflectionAssembly *ret = mono_domain_try_type_resolve_checked (domain, name, tb, &error); - mono_error_cleanup (&error); + g_assert (domain); + g_assert (name || typebuilder); + ERROR_DECL (error); + error_init (error); + + MonoReflectionAssembly * const ret = name + ? mono_domain_try_type_resolve_name (domain, name, error) + : mono_domain_try_type_resolve_typebuilder (domain, (MonoReflectionTypeBuilder *)typebuilder, error); + + mono_error_cleanup (error); return ret; } -MonoReflectionAssembly * -mono_domain_try_type_resolve_checked (MonoDomain *domain, char *name, MonoObject *tb, MonoError *error) +/** + * mono_class_get_appdomain_do_type_resolve_method: + * + * This routine returns System.AppDomain.DoTypeResolve. + */ +static MonoMethod * +mono_class_get_appdomain_do_type_resolve_method (MonoError *error) { - static MonoMethod *method = NULL; - MonoReflectionAssembly *ret; - void *params [1]; + static MonoMethod *method; // cache + + if (method) + return method; + + // not cached yet, fill cache under caller's lock + + method = mono_class_get_method_from_name_checked (mono_class_get_appdomain_class (), "DoTypeResolve", -1, 0, error); + + if (method == NULL) + g_warning ("%s method AppDomain.DoTypeResolve not found. %s\n", __func__, mono_error_get_message (error)); + + return method; +} + +/** + * mono_domain_try_type_resolve_name: + * \param domain application domain in which to resolve the type + * \param name the name of the type to resolve. + * + * This routine invokes the internal \c System.AppDomain.DoTypeResolve and returns + * the assembly that matches name. + * + * \returns A \c MonoReflectionAssembly or NULL if not found + */ +MonoReflectionAssembly * +mono_domain_try_type_resolve_name (MonoDomain *domain, const char *name, MonoError *error) +{ + g_assert (domain); + g_assert (name); + g_assert (error); error_init (error); - g_assert (domain != NULL && ((name != NULL) || (tb != NULL))); - - if (method == NULL) { - method = mono_class_get_method_from_name (mono_class_get_appdomain_class (), "DoTypeResolve", -1); - if (method == NULL) { - g_warning ("Method AppDomain.DoTypeResolve not found.\n"); - return NULL; - } - } - - if (name) { - *params = (MonoObject*)mono_string_new_checked (mono_domain_get (), name, error); - return_val_if_nok (error, NULL); - } else - *params = tb; - - ret = (MonoReflectionAssembly *) mono_runtime_invoke_checked (method, domain->domain, params, error); + void *params [] = { mono_string_new_checked (mono_domain_get (), name, error) }; return_val_if_nok (error, NULL); - return ret; + MonoMethod * const method = mono_class_get_appdomain_do_type_resolve_method (error); + return_val_if_nok (error, NULL); + + MonoObject * const ret = mono_runtime_invoke_checked (method, domain->domain, params, error); + return_val_if_nok (error, NULL); + + return (MonoReflectionAssembly *)ret; +} + +/** + * mono_domain_try_type_resolve_typebuilder: + * \param domain application domain in which to resolve the type + * \param typebuilder A \c System.Reflection.Emit.TypeBuilder; typebuilder.FullName is the name of the type to resolve. + * + * This routine invokes the internal \c System.AppDomain.DoTypeResolve and returns + * the assembly that matches typebuilder.FullName. + * + * \returns A \c MonoReflectionAssembly or NULL if not found + */ +MonoReflectionAssembly * +mono_domain_try_type_resolve_typebuilder (MonoDomain *domain, MonoReflectionTypeBuilder *typebuilder, MonoError *error) +{ + g_assert (domain); + g_assert (typebuilder); + g_assert (error); + + error_init (error); + + MonoMethod * const method = mono_class_get_appdomain_do_type_resolve_method (error); + return_val_if_nok (error, NULL); + + MonoObject * const ret = mono_runtime_invoke_checked (method, domain->domain, (void**)&typebuilder, error); + return_val_if_nok (error, NULL); + + return (MonoReflectionAssembly *)ret; } /** @@ -930,7 +987,7 @@ start_element (GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, - GError **error) + GError **gerror) { RuntimeConfig *runtime_config = (RuntimeConfig *)user_data; @@ -973,7 +1030,7 @@ static void end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, - GError **error) + GError **gerror) { RuntimeConfig *runtime_config = (RuntimeConfig *)user_data; if (strcmp (element_name, "runtime") == 0) @@ -983,14 +1040,14 @@ end_element (GMarkupParseContext *context, } static void -parse_error (GMarkupParseContext *context, GError *error, gpointer user_data) +parse_error (GMarkupParseContext *context, GError *gerror, gpointer user_data) { RuntimeConfig *state = (RuntimeConfig *)user_data; const gchar *msg; const gchar *filename; filename = state && state->filename ? (gchar *) state->filename : ""; - msg = error && error->message ? error->message : ""; + msg = gerror && gerror->message ? gerror->message : ""; g_warning ("Error parsing %s: %s", filename, msg); } @@ -1006,7 +1063,7 @@ mono_parser = { void mono_domain_set_options_from_config (MonoDomain *domain) { - MonoError error; + ERROR_DECL (error); gchar *config_file_name = NULL, *text = NULL, *config_file_path = NULL; gsize len; GMarkupParseContext *context; @@ -1016,9 +1073,9 @@ mono_domain_set_options_from_config (MonoDomain *domain) if (!domain || !domain->setup || !domain->setup->configuration_file) return; - config_file_name = mono_string_to_utf8_checked (domain->setup->configuration_file, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + config_file_name = mono_string_to_utf8_checked (domain->setup->configuration_file, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); goto free_and_out; } @@ -1149,7 +1206,7 @@ mono_try_assembly_resolve_handle (MonoDomain *domain, MonoStringHandle fname, Mo g_assert (domain != NULL && !MONO_HANDLE_IS_NULL (fname)); - method = mono_class_get_method_from_name (mono_class_get_appdomain_class (), "DoAssemblyResolve", -1); + method = mono_class_get_method_from_name_checked (mono_class_get_appdomain_class (), "DoAssemblyResolve", -1, 0, error); g_assert (method != NULL); isrefonly = refonly ? 1 : 0; @@ -1184,7 +1241,7 @@ MonoAssembly * mono_domain_assembly_postload_search (MonoAssemblyName *aname, MonoAssembly *requesting, gboolean refonly) { - MonoError error; + ERROR_DECL (error); MonoAssembly *assembly; MonoDomain *domain = mono_domain_get (); char *aname_str; @@ -1193,9 +1250,9 @@ mono_domain_assembly_postload_search (MonoAssemblyName *aname, MonoAssembly *req /* FIXME: We invoke managed code here, so there is a potential for deadlocks */ - assembly = mono_try_assembly_resolve (domain, aname_str, requesting, refonly, &error); + assembly = mono_try_assembly_resolve (domain, aname_str, requesting, refonly, error); g_free (aname_str); - mono_error_cleanup (&error); + mono_error_cleanup (error); return assembly; } @@ -1249,7 +1306,7 @@ mono_domain_fire_assembly_load (MonoAssembly *assembly, gpointer user_data) HANDLE_FUNCTION_ENTER (); static MonoClassField *assembly_load_field; static MonoMethod *assembly_load_method; - MonoError error; + ERROR_DECL (error); MonoDomain *domain = mono_domain_get (); MonoClass *klass; gpointer load_value; @@ -1263,6 +1320,8 @@ mono_domain_fire_assembly_load (MonoAssembly *assembly, gpointer user_data) #endif klass = domain->domain->mbr.obj.vtable->klass; + error_init (error); + mono_domain_assemblies_lock (domain); add_assemblies_to_domain (domain, assembly, NULL); mono_domain_assemblies_unlock (domain); @@ -1278,18 +1337,18 @@ mono_domain_fire_assembly_load (MonoAssembly *assembly, gpointer user_data) goto leave; } - MonoReflectionAssemblyHandle ref_assembly = mono_assembly_get_object_handle (domain, assembly, &error); - mono_error_assert_ok (&error); + MonoReflectionAssemblyHandle ref_assembly = mono_assembly_get_object_handle (domain, assembly, error); + mono_error_assert_ok (error); if (assembly_load_method == NULL) { - assembly_load_method = mono_class_get_method_from_name (klass, "DoAssemblyLoad", -1); + assembly_load_method = mono_class_get_method_from_name_checked (klass, "DoAssemblyLoad", -1, 0, error); g_assert (assembly_load_method); } *params = MONO_HANDLE_RAW(ref_assembly); - mono_runtime_invoke_checked (assembly_load_method, domain->domain, params, &error); - mono_error_cleanup (&error); + mono_runtime_invoke_checked (assembly_load_method, domain->domain, params, error); + mono_error_cleanup (error); leave: HANDLE_FUNCTION_RETURN (); } @@ -1300,7 +1359,7 @@ leave: static void set_domain_search_path (MonoDomain *domain) { - MonoError error; + ERROR_DECL (error); MonoAppDomainSetup *setup; gchar **tmp; gchar *search_path = NULL; @@ -1334,10 +1393,10 @@ set_domain_search_path (MonoDomain *domain) npaths++; if (setup->private_bin_path) { - search_path = mono_string_to_utf8_checked (setup->private_bin_path, &error); - if (!mono_error_ok (&error)) { /*FIXME maybe we should bubble up the error.*/ + search_path = mono_string_to_utf8_checked (setup->private_bin_path, error); + if (!mono_error_ok (error)) { /*FIXME maybe we should bubble up the error.*/ g_warning ("Could not decode AppDomain search path since it contains invalid characters"); - mono_error_cleanup (&error); + mono_error_cleanup (error); mono_domain_assemblies_unlock (domain); return; } @@ -1399,9 +1458,9 @@ set_domain_search_path (MonoDomain *domain) tmp = (gchar **)g_malloc ((npaths + 1) * sizeof (gchar *)); tmp [npaths] = NULL; - *tmp = mono_string_to_utf8_checked (setup->application_base, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + *tmp = mono_string_to_utf8_checked (setup->application_base, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); g_strfreev (pvt_split); g_free (tmp); @@ -1742,7 +1801,7 @@ shadow_copy_create_ini (const char *shadow, const char *filename) gboolean mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) { - MonoError error; + ERROR_DECL (error); MonoAppDomainSetup *setup; gchar *all_dirs; gchar **dir_ptr; @@ -1759,9 +1818,9 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) if (setup == NULL || setup->shadow_copy_files == NULL) return FALSE; - shadow_status_string = mono_string_to_utf8_checked (setup->shadow_copy_files, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + shadow_status_string = mono_string_to_utf8_checked (setup->shadow_copy_files, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); return FALSE; } shadow_enabled = !g_ascii_strncasecmp (shadow_status_string, "true", 4); @@ -1774,9 +1833,9 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) return TRUE; /* Is dir_name a shadow_copy destination already? */ - base_dir = get_shadow_assembly_location_base (domain, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + base_dir = get_shadow_assembly_location_base (domain, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); return FALSE; } @@ -1786,9 +1845,9 @@ mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) } g_free (base_dir); - all_dirs = mono_string_to_utf8_checked (setup->shadow_copy_directories, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + all_dirs = mono_string_to_utf8_checked (setup->shadow_copy_directories, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); return FALSE; } @@ -1816,7 +1875,7 @@ FIXME bubble up the error instead of raising it here char * mono_make_shadow_copy (const char *filename, MonoError *oerror) { - MonoError error; + ERROR_DECL (error); gint filename_len, shadow_len; guint16 *orig, *dest; guint32 attrs; @@ -1839,9 +1898,9 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) } /* Is dir_name a shadow_copy destination already? */ - shadow_dir = get_shadow_assembly_location_base (domain, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + shadow_dir = get_shadow_assembly_location_base (domain, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); g_free (dir_name); mono_error_set_execution_engine (oerror, "Failed to create shadow copy (invalid characters in shadow directory name)."); return NULL; @@ -1855,9 +1914,9 @@ mono_make_shadow_copy (const char *filename, MonoError *oerror) g_free (shadow_dir); g_free (dir_name); - shadow = get_shadow_assembly_location (filename, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + shadow = get_shadow_assembly_location (filename, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); mono_error_set_execution_engine (oerror, "Failed to create shadow copy (invalid characters in file name)."); return NULL; } @@ -2208,6 +2267,9 @@ ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomainHandle ad, return refass; } + /* Clear the reference added by mono_image_open_from_data_full above */ + mono_image_close (image); + refass = mono_assembly_get_object_handle (domain, ass, error); if (!MONO_HANDLE_IS_NULL(refass)) MONO_HANDLE_SET (refass, evidence, evidence); @@ -2563,7 +2625,7 @@ deregister_reflection_info_roots (MonoDomain *domain) static gsize WINAPI unload_thread_main (void *arg) { - MonoError error; + ERROR_DECL (error); unload_data *data = (unload_data*)arg; MonoDomain *domain = data->domain; MonoInternalThread *internal; @@ -2571,12 +2633,12 @@ unload_thread_main (void *arg) internal = mono_thread_internal_current (); - MonoString *thread_name_str = mono_string_new_checked (mono_domain_get (), "Domain unloader", &error); - if (is_ok (&error)) - mono_thread_set_name_internal (internal, thread_name_str, TRUE, FALSE, &error); - if (!is_ok (&error)) { - data->failure_reason = g_strdup (mono_error_get_message (&error)); - mono_error_cleanup (&error); + MonoString *thread_name_str = mono_string_new_checked (mono_domain_get (), "Domain unloader", error); + if (is_ok (error)) + mono_thread_set_name_internal (internal, thread_name_str, TRUE, FALSE, error); + if (!is_ok (error)) { + data->failure_reason = g_strdup (mono_error_get_message (error)); + mono_error_cleanup (error); goto failure; } @@ -2697,7 +2759,7 @@ guarded_wait (MonoThreadHandle *thread_handle, guint32 timeout, gboolean alertab void mono_domain_try_unload (MonoDomain *domain, MonoObject **exc) { - MonoError error; + ERROR_DECL (error); MonoThreadHandle *thread_handle; MonoAppDomainState prev_state; MonoMethod *method; @@ -2705,6 +2767,8 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc) MonoInternalThread *internal; MonoDomain *caller_domain = mono_domain_get (); + error_init(error); + /* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, mono_native_thread_id_get ()); */ /* Atomically change our state to UNLOADING */ @@ -2728,16 +2792,16 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc) mono_domain_set (domain, FALSE); /* Notify OnDomainUnload listeners */ - method = mono_class_get_method_from_name (domain->domain->mbr.obj.vtable->klass, "DoDomainUnload", -1); + method = mono_class_get_method_from_name_checked (domain->domain->mbr.obj.vtable->klass, "DoDomainUnload", -1, 0, error); g_assert (method); - mono_runtime_try_invoke (method, domain->domain, NULL, exc, &error); + mono_runtime_try_invoke (method, domain->domain, NULL, exc, error); - if (!mono_error_ok (&error)) { + if (!mono_error_ok (error)) { if (*exc) - mono_error_cleanup (&error); + mono_error_cleanup (error); else - *exc = (MonoObject*)mono_error_convert_to_exception (&error); + *exc = (MonoObject*)mono_error_convert_to_exception (error); } if (*exc) { @@ -2764,8 +2828,8 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc) * * Force it to be attached to avoid racing during shutdown. */ - internal = mono_thread_create_internal (mono_get_root_domain (), unload_thread_main, thread_data, MONO_THREAD_CREATE_FLAGS_FORCE_CREATE, &error); - mono_error_assert_ok (&error); + internal = mono_thread_create_internal (mono_get_root_domain (), unload_thread_main, thread_data, MONO_THREAD_CREATE_FLAGS_FORCE_CREATE, error); + mono_error_assert_ok (error); thread_handle = mono_threads_open_thread_handle (internal->handle); diff --git a/mono/metadata/assembly.c.REMOVED.git-id b/mono/metadata/assembly.c.REMOVED.git-id index 0ab19343e0..b77ca01749 100644 --- a/mono/metadata/assembly.c.REMOVED.git-id +++ b/mono/metadata/assembly.c.REMOVED.git-id @@ -1 +1 @@ -5a9ac7d6f3e9ef05796fc9f7bf1a89f847824663 \ No newline at end of file +c77f190da2f5f4cbd04a2d9208da50400ec851d7 \ No newline at end of file diff --git a/mono/metadata/attach.c b/mono/metadata/attach.c index 942209fb16..ab0d2a0073 100644 --- a/mono/metadata/attach.c +++ b/mono/metadata/attach.c @@ -267,7 +267,7 @@ mono_attach_cleanup (void) static int mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject **exc) { - MonoError error; + ERROR_DECL (error); MonoAssembly *agent_assembly; MonoImage *image; MonoMethod *method; @@ -295,28 +295,28 @@ mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject return 1; } - method = mono_get_method_checked (image, entry, NULL, NULL, &error); + method = mono_get_method_checked (image, entry, NULL, NULL, error); if (method == NULL){ - g_print ("The entry point method of assembly '%s' could not be loaded due to %s\n", agent, mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_print ("The entry point method of assembly '%s' could not be loaded due to %s\n", agent, mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } - main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, (args == NULL) ? 0 : 1, &error); + main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, (args == NULL) ? 0 : 1, error); if (main_args == NULL) { - g_print ("Could not allocate main method args due to %s\n", mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_print ("Could not allocate main method args due to %s\n", mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } if (args) { - MonoString *args_str = mono_string_new_checked (domain, args, &error); - if (!is_ok (&error)) { - g_print ("Could not allocate main method arg string due to %s\n", mono_error_get_message (&error)); - mono_error_cleanup (&error); + MonoString *args_str = mono_string_new_checked (domain, args, error); + if (!is_ok (error)) { + g_print ("Could not allocate main method arg string due to %s\n", mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } @@ -325,10 +325,10 @@ mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject pa [0] = main_args; - mono_runtime_try_invoke (method, NULL, pa, exc, &error); - if (!is_ok (&error)) { - g_print ("The entry point method of assembly '%s' could not be executed due to %s\n", agent, mono_error_get_message (&error)); - mono_error_cleanup (&error); + mono_runtime_try_invoke (method, NULL, pa, exc, error); + if (!is_ok (error)) { + g_print ("The entry point method of assembly '%s' could not be executed due to %s\n", agent, mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } @@ -483,7 +483,7 @@ transport_send (int fd, guint8 *data, int len) static void transport_start_receive (void) { - MonoError error; + ERROR_DECL (error); MonoInternalThread *internal; transport_connect (); @@ -491,8 +491,8 @@ transport_start_receive (void) if (!listen_fd) return; - internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, &error); - mono_error_assert_ok (&error); + internal = mono_thread_create_internal (mono_get_root_domain (), receiver_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error); + mono_error_assert_ok (error); receiver_thread_handle = mono_threads_open_thread_handle (internal->handle); g_assert (receiver_thread_handle); @@ -501,7 +501,7 @@ transport_start_receive (void) static gsize WINAPI receiver_thread (void *arg) { - MonoError error; + ERROR_DECL (error); int res, content_len; guint8 buffer [256]; guint8 *p, *p_end; @@ -509,10 +509,10 @@ receiver_thread (void *arg) MonoInternalThread *internal; internal = mono_thread_internal_current (); - MonoString *attach_str = mono_string_new_checked (mono_domain_get (), "Attach receiver", &error); - mono_error_assert_ok (&error); - mono_thread_set_name_internal (internal, attach_str, TRUE, FALSE, &error); - mono_error_assert_ok (&error); + MonoString *attach_str = mono_string_new_checked (mono_domain_get (), "Attach receiver", error); + mono_error_assert_ok (error); + mono_thread_set_name_internal (internal, attach_str, TRUE, FALSE, error); + mono_error_assert_ok (error); /* Ask the runtime to not abort this thread */ //internal->flags |= MONO_THREAD_FLAG_DONT_MANAGE; /* Ask the runtime to not wait for this thread */ diff --git a/mono/metadata/boehm-gc.c b/mono/metadata/boehm-gc.c index 0f3832ce0e..f8c945a709 100644 --- a/mono/metadata/boehm-gc.c +++ b/mono/metadata/boehm-gc.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -500,6 +502,7 @@ on_gc_notification (GC_EventType event) break; default: MONO_PROFILER_RAISE (gc_event, (e, 0)); + MONO_PROFILER_RAISE (gc_event2, (e, 0, TRUE)); break; } @@ -507,10 +510,12 @@ on_gc_notification (GC_EventType event) case GC_EVENT_PRE_STOP_WORLD: mono_thread_info_suspend_lock (); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, 0)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, 0, TRUE)); break; case GC_EVENT_POST_START_WORLD: mono_thread_info_suspend_unlock (); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, 0)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, 0, TRUE)); break; default: break; @@ -548,21 +553,21 @@ register_root (gpointer arg) } int -mono_gc_register_root (char *start, size_t size, void *descr, MonoGCRootSource source, const char *msg) +mono_gc_register_root (char *start, size_t size, void *descr, MonoGCRootSource source, void *key, const char *msg) { RootData root_data; root_data.start = start; /* Boehm root processing requires one byte past end of region to be scanned */ root_data.end = start + size + 1; GC_call_with_alloc_lock (register_root, &root_data); - + MONO_PROFILER_RAISE (gc_root_register, ((const mono_byte *) start, size, source, key, msg)); return TRUE; } int -mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg) +mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg) { - return mono_gc_register_root (start, size, descr, source, msg); + return mono_gc_register_root (start, size, descr, source, key, msg); } static gpointer @@ -577,6 +582,7 @@ void mono_gc_deregister_root (char* addr) { GC_call_with_alloc_lock (deregister_root, addr); + MONO_PROFILER_RAISE (gc_root_unregister, ((const mono_byte *) addr)); } static void @@ -596,7 +602,7 @@ push_handle_stack (HandleStack* stack) while (cur) { if (cur->size > 0) - GC_push_all (cur->elems, (char*)(cur->elems + cur->size) + 1); + GC_push_all ((gpointer)&cur->elems[0], (char*)(cur->elems + cur->size) + 1); if (cur == last) break; cur = cur->next; @@ -695,14 +701,17 @@ mono_gc_make_root_descr_all_refs (int numbits) } void* -mono_gc_alloc_fixed (size_t size, void *descr, MonoGCRootSource source, const char *msg) +mono_gc_alloc_fixed (size_t size, void *descr, MonoGCRootSource source, void *key, const char *msg) { - return GC_MALLOC_UNCOLLECTABLE (size); + void *start = GC_MALLOC_UNCOLLECTABLE (size); + MONO_PROFILER_RAISE (gc_root_register, ((const mono_byte *) start, size, source, key, msg)); + return start; } void mono_gc_free_fixed (void* addr) { + MONO_PROFILER_RAISE (gc_root_unregister, ((const mono_byte *) addr)); GC_FREE (addr); } @@ -1505,6 +1514,13 @@ BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reser } #endif +MonoVTable * +mono_gc_get_vtable (MonoObject *obj) +{ + // No pointer tagging. + return obj->vtable; +} + guint mono_gc_get_vtable_bits (MonoClass *klass) { @@ -1658,7 +1674,7 @@ handle_data_alloc_entries (HandleData *handles) handles->entries = (void **)g_malloc0 (sizeof (*handles->entries) * handles->size); handles->domain_ids = (guint16 *)g_malloc0 (sizeof (*handles->domain_ids) * handles->size); } else { - handles->entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * handles->size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, "gc handles table"); + handles->entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * handles->size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, NULL, "GC Handle Table (Boehm)"); } handles->bitmap = (guint32 *)g_malloc0 (handles->size / CHAR_BIT); } @@ -1725,7 +1741,7 @@ handle_data_grow (HandleData *handles, gboolean track) handles->domain_ids = domain_ids; } else { gpointer *entries; - entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * new_size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, "gc handles table"); + entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * new_size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, NULL, "GC Handle Table (Boehm)"); mono_gc_memmove_aligned (entries, handles->entries, sizeof (*handles->entries) * handles->size); mono_gc_free_fixed (handles->entries); handles->entries = entries; diff --git a/mono/metadata/class-internals.h b/mono/metadata/class-internals.h index 07e42ad0d3..dc27745aef 100644 --- a/mono/metadata/class-internals.h +++ b/mono/metadata/class-internals.h @@ -42,7 +42,8 @@ typedef struct _MonoDynamicMethod MonoDynamicMethod; #define ICALL_EXPORT MONO_API #else #define ICALL_DECL_EXPORT -#define ICALL_EXPORT static +/* Can't be static as icall.c defines icalls referenced by icall-tables.c */ +#define ICALL_EXPORT #endif typedef enum { @@ -867,9 +868,9 @@ typedef struct { gint32 security_depth; gint32 unused; /* Threadpool */ + gint32 threadpool_threads; gint64 threadpool_workitems; gint64 threadpool_ioworkitems; - gint32 threadpool_threads; gint32 threadpool_iothreads; } MonoPerfCounters; @@ -942,7 +943,7 @@ MonoMethod* mono_class_get_method_by_index (MonoClass *klass, int index); MonoMethod* -mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method); +mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method, MonoError *error); MonoMethod* mono_class_get_vtable_entry (MonoClass *klass, int offset); @@ -956,9 +957,8 @@ mono_class_get_vtable_size (MonoClass *klass); gboolean mono_class_is_open_constructed_type (MonoType *t); -gboolean -mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides, - MonoGenericContext *generic_context); +void +mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides, MonoGenericContext *generic_context, MonoError *error); MonoMethod* mono_class_get_cctor (MonoClass *klass) MONO_LLVM_INTERNAL; @@ -1027,9 +1027,6 @@ mono_generic_class_get_class (MonoGenericClass *gclass); void mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container); -MonoMethod* -mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context); - MonoMethod* mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context, MonoError *error); @@ -1119,6 +1116,7 @@ typedef struct { MonoClass *generic_ienumerator_class; MonoClass *threadpool_wait_callback_class; MonoMethod *threadpool_perform_wait_callback_method; + MonoClass *console_class; } MonoDefaults; #ifdef DISABLE_REMOTING @@ -1310,9 +1308,6 @@ mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericC gboolean mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass); -MonoMethod* -mono_class_get_method_generic (MonoClass *klass, MonoMethod *method); - MonoType* mono_type_get_basic_type_from_generic (MonoType *type); @@ -1362,7 +1357,7 @@ MonoClassField* mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoType *type); MonoVTable* -mono_class_vtable_full (MonoDomain *domain, MonoClass *klass, MonoError *error); +mono_class_vtable_checked (MonoDomain *domain, MonoClass *klass, MonoError *error); gboolean mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate); @@ -1399,7 +1394,7 @@ mono_class_full_name (MonoClass *klass); MonoClass* mono_class_inflate_generic_class_checked (MonoClass *gklass, MonoGenericContext *context, MonoError *error); -MonoClass * +MONO_PROFILER_API MonoClass * mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error); MonoClass * @@ -1538,6 +1533,21 @@ mono_class_set_weak_bitmap (MonoClass *klass, int nbits, gsize *bits); gsize* mono_class_get_weak_bitmap (MonoClass *klass, int *nbits); +MonoMethod * +mono_class_get_method_from_name_checked (MonoClass *klass, const char *name, int param_count, int flags, MonoError *error); + +gboolean +mono_method_has_no_body (MonoMethod *method); + +// FIXME Replace all internal callers of mono_method_get_header_checked with +// mono_method_get_header_internal; the difference is in error initialization. +// +// And then mark mono_method_get_header_checked as MONO_RT_EXTERNAL_ONLY MONO_API. +// +// Internal callers expected to use ERROR_DECL. External callers are not. +MonoMethodHeader* +mono_method_get_header_internal (MonoMethod *method, 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 50b259b754..203aeff68b 100644 --- a/mono/metadata/class.c.REMOVED.git-id +++ b/mono/metadata/class.c.REMOVED.git-id @@ -1 +1 @@ -68ab440b71fd8ec8a06ecaf8b49681b8555a6143 \ No newline at end of file +d9d2bd488056924f2ffe4218405597e4f4206565 \ No newline at end of file diff --git a/mono/metadata/class.h b/mono/metadata/class.h index 565dac59e4..877379fc00 100644 --- a/mono/metadata/class.h +++ b/mono/metadata/class.h @@ -18,15 +18,18 @@ typedef struct _MonoClassField MonoClassField; typedef struct _MonoProperty MonoProperty; typedef struct _MonoEvent MonoEvent; +MONO_RT_EXTERNAL_ONLY MONO_API MonoClass * mono_class_get (MonoImage *image, uint32_t type_token); +MONO_RT_EXTERNAL_ONLY MONO_API 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_class_vtable (MonoDomain *domain, MonoClass *klass); @@ -39,6 +42,7 @@ mono_class_from_name_case (MonoImage *image, const char* name_space, const char MONO_API 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_class_from_typeref (MonoImage *image, uint32_t type_token); @@ -52,12 +56,15 @@ mono_class_from_generic_parameter (MonoGenericParam *param, MonoImage *image, mo MONO_RT_EXTERNAL_ONLY MONO_API MonoType* mono_class_inflate_generic_type (MonoType *type, MonoGenericContext *context) /* MONO_DEPRECATED */; +MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod* mono_class_inflate_generic_method (MonoMethod *method, MonoGenericContext *context); +MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod * mono_get_inflated_method (MonoMethod *method); +MONO_RT_EXTERNAL_ONLY MONO_API MonoClassField* mono_field_from_token (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context); @@ -116,6 +123,7 @@ 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_ldtoken (MonoImage *image, uint32_t token, MonoClass **retclass, MonoGenericContext *context); diff --git a/mono/metadata/cominterop.c.REMOVED.git-id b/mono/metadata/cominterop.c.REMOVED.git-id index 8f15d84069..bb1684cb2e 100644 --- a/mono/metadata/cominterop.c.REMOVED.git-id +++ b/mono/metadata/cominterop.c.REMOVED.git-id @@ -1 +1 @@ -1caa6ca0f99263707a56f3d1d736adbb0c385ba2 \ No newline at end of file +fad0d1a534f8c784caf07437b80b3be076be8eed \ No newline at end of file diff --git a/mono/metadata/cominterop.h b/mono/metadata/cominterop.h index 6f93ec191d..7a1bb17f12 100644 --- a/mono/metadata/cominterop.h +++ b/mono/metadata/cominterop.h @@ -11,6 +11,7 @@ #define __MONO_COMINTEROP_H__ #include +#include #include void diff --git a/mono/metadata/console-unix.c b/mono/metadata/console-unix.c index fe71923dbb..d14c52c0c8 100644 --- a/mono/metadata/console-unix.c +++ b/mono/metadata/console-unix.c @@ -219,47 +219,19 @@ tty_teardown (void) static void do_console_cancel_event (void) { - static MonoClassField *cancel_handler_field; - MonoError error; - MonoDomain *domain = mono_domain_get (); - MonoClass *klass; - MonoDelegate *load_value; - MonoMethod *method; - MonoVTable *vtable; + static MonoMethod *System_Console_DoConsoleCancelEventBackground_method = ((gpointer)-1); + ERROR_DECL (error); - /* FIXME: this should likely iterate all the domains, instead */ - if (!domain->domain) + if (mono_defaults.console_class == NULL) return; - klass = mono_class_try_load_from_name (mono_defaults.corlib, "System", "Console"); - if (klass == NULL) + 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 == NULL) return; - if (cancel_handler_field == NULL) { - cancel_handler_field = mono_class_get_field_from_name (klass, "cancel_handler"); - g_assert (cancel_handler_field); - } - - vtable = mono_class_vtable_full (domain, klass, &error); - if (vtable == NULL || !is_ok (&error)) { - mono_error_cleanup (&error); - return; - } - mono_field_static_get_value_checked (vtable, cancel_handler_field, &load_value, &error); - if (load_value == NULL || !is_ok (&error)) { - mono_error_cleanup (&error); - return; - } - - klass = load_value->object.vtable->klass; - method = mono_class_get_method_from_name (klass, "BeginInvoke", -1); - g_assert (method != NULL); - - mono_threadpool_begin_invoke (domain, (MonoObject*) load_value, method, NULL, &error); - if (!is_ok (&error)) { - g_warning ("Couldn't invoke System.Console cancel handler due to %s", mono_error_get_message (&error)); - mono_error_cleanup (&error); - } + mono_runtime_invoke_checked (System_Console_DoConsoleCancelEventBackground_method, NULL, NULL, error); + mono_error_assert_ok (error); } static int need_cancel = FALSE; @@ -445,7 +417,7 @@ set_control_chars (MonoArray *control_chars, const guchar *cc) MonoBoolean ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardown, MonoArray **control_chars, int **size) { - MonoError error; + ERROR_DECL (error); int dims; @@ -476,8 +448,8 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow /* 17 is the number of entries set in set_control_chars() above. * NCCS is the total size, but, by now, we only care about those 17 values*/ - MonoArray *control_chars_arr = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, 17, &error); - if (mono_error_set_pending_exception (&error)) + MonoArray *control_chars_arr = mono_array_new_checked (mono_domain_get (), mono_defaults.byte_class, 17, error); + if (mono_error_set_pending_exception (error)) return FALSE; mono_gc_wbarrier_generic_store (control_chars, (MonoObject*) control_chars_arr); if (tcgetattr (STDIN_FILENO, &initial_attr) == -1) @@ -502,8 +474,8 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow keypad_xmit_str = NULL; if (keypad != NULL) { - keypad_xmit_str = mono_string_to_utf8_checked (keypad, &error); - if (mono_error_set_pending_exception (&error)) + keypad_xmit_str = mono_string_to_utf8_checked (keypad, error); + if (mono_error_set_pending_exception (error)) return FALSE; } @@ -511,8 +483,8 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow setup_finished = TRUE; if (!atexit_called) { if (teardown != NULL) { - teardown_str = mono_string_to_utf8_checked (teardown, &error); - if (mono_error_set_pending_exception (&error)) + teardown_str = mono_string_to_utf8_checked (teardown, error); + if (mono_error_set_pending_exception (error)) return FALSE; } diff --git a/mono/metadata/coree.c b/mono/metadata/coree.c index d3a0589cb1..b61fb15634 100644 --- a/mono/metadata/coree.c +++ b/mono/metadata/coree.c @@ -145,7 +145,7 @@ BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpRes #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) __int32 STDMETHODCALLTYPE _CorExeMain(void) { - MonoError error; + ERROR_DECL (error); MonoDomain* domain; MonoAssembly* assembly; MonoImage* image; @@ -189,10 +189,10 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void) ExitProcess (1); } - method = mono_get_method_checked (image, entry, NULL, NULL, &error); + method = mono_get_method_checked (image, entry, NULL, NULL, error); if (method == NULL) { g_free (file_name); - mono_error_cleanup (&error); /* FIXME don't swallow the error */ + mono_error_cleanup (error); /* FIXME don't swallow the error */ MessageBox (NULL, L"The entry point method could not be loaded.", NULL, MB_ICONERROR); mono_runtime_quit (); ExitProcess (1); @@ -205,8 +205,8 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void) argv [i] = g_utf16_to_utf8 (argvw [i], -1, NULL, NULL, NULL); LocalFree (argvw); - mono_runtime_run_main_checked (method, argc, argv, &error); - mono_error_raise_exception_deprecated (&error); /* OK, triggers unhandled exn handler */ + mono_runtime_run_main_checked (method, argc, argv, error); + mono_error_raise_exception_deprecated (error); /* OK, triggers unhandled exn handler */ mono_thread_manage (); mono_runtime_quit (); diff --git a/mono/metadata/custom-attrs.c b/mono/metadata/custom-attrs.c index e58f0fedfe..4d85ef9423 100644 --- a/mono/metadata/custom-attrs.c +++ b/mono/metadata/custom-attrs.c @@ -176,7 +176,7 @@ find_event_index (MonoClass *klass, MonoEvent *event) static MonoType* cattr_type_from_name (char *n, MonoImage *image, gboolean is_enum, MonoError *error) { - MonoError inner_error; + ERROR_DECL_VALUE (inner_error); MonoType *t = mono_reflection_type_from_name_checked (n, image, &inner_error); if (!t) { mono_error_set_type_load_name (error, g_strdup(n), NULL, @@ -311,7 +311,13 @@ handle_enum: if (slen > 0 && !bcheck_blob (p, slen - 1, boundp, error)) return NULL; *end = p + slen; - return mono_string_new_len_checked (mono_domain_get (), p, slen, error); + // https://bugzilla.xamarin.com/show_bug.cgi?id=60848 + // Custom attribute strings are encoded as wtf-8 instead of utf-8. + // If we decode using utf-8 like the spec says, we will silently fail + // 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); case MONO_TYPE_CLASS: { MonoReflectionType *rt; char *n; @@ -761,7 +767,7 @@ create_custom_attr (MonoImage *image, MonoMethod *method, const guchar *data, gu memset (params, 0, sizeof (void*) * sig->param_count); } else { /* Allocate using GC so it gets GC tracking */ - params = (void **)mono_gc_alloc_fixed (sig->param_count * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_REFLECTION, "custom attribute parameters"); + params = (void **)mono_gc_alloc_fixed (sig->param_count * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_REFLECTION, NULL, "Reflection Custom Attribute Parameters"); } /* skip prolog */ @@ -1144,9 +1150,9 @@ leave: void ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal (MonoReflectionMethod *ref_method, MonoReflectionAssembly *assembly, gpointer data, guint32 len, MonoArray **ctor_args, MonoArray **named_args) { - MonoError error; - (void) reflection_resolve_custom_attribute_data (ref_method, assembly, data, len, ctor_args, named_args, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + (void) reflection_resolve_custom_attribute_data (ref_method, assembly, data, len, ctor_args, named_args, error); + mono_error_set_pending_exception (error); } static MonoObjectHandle @@ -1245,9 +1251,9 @@ mono_custom_attrs_construct_by_type (MonoCustomAttrInfo *cinfo, MonoClass *attr_ MonoArray* mono_custom_attrs_construct (MonoCustomAttrInfo *cinfo) { - MonoError error; - MonoArray *result = mono_custom_attrs_construct_by_type (cinfo, NULL, &error); - mono_error_assert_ok (&error); /*FIXME proper error handling*/ + ERROR_DECL (error); + MonoArray *result = mono_custom_attrs_construct_by_type (cinfo, NULL, error); + mono_error_assert_ok (error); /*FIXME proper error handling*/ return result; } @@ -1278,9 +1284,9 @@ mono_custom_attrs_data_construct (MonoCustomAttrInfo *cinfo, MonoError *error) MonoCustomAttrInfo* mono_custom_attrs_from_index (MonoImage *image, guint32 idx) { - MonoError error; - MonoCustomAttrInfo *result = mono_custom_attrs_from_index_checked (image, idx, FALSE, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo *result = mono_custom_attrs_from_index_checked (image, idx, FALSE, error); + mono_error_cleanup (error); return result; } /** @@ -1368,9 +1374,9 @@ mono_custom_attrs_from_index_checked (MonoImage *image, guint32 idx, gboolean ig MonoCustomAttrInfo* mono_custom_attrs_from_method (MonoMethod *method) { - MonoError error; - MonoCustomAttrInfo* result = mono_custom_attrs_from_method_checked (method, &error); - mono_error_cleanup (&error); /* FIXME want a better API that doesn't swallow the error */ + ERROR_DECL (error); + MonoCustomAttrInfo* result = mono_custom_attrs_from_method_checked (method, error); + mono_error_cleanup (error); /* FIXME want a better API that doesn't swallow the error */ return result; } @@ -1409,9 +1415,9 @@ mono_custom_attrs_from_method_checked (MonoMethod *method, MonoError *error) MonoCustomAttrInfo* mono_custom_attrs_from_class (MonoClass *klass) { - MonoError error; - MonoCustomAttrInfo *result = mono_custom_attrs_from_class_checked (klass, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo *result = mono_custom_attrs_from_class_checked (klass, error); + mono_error_cleanup (error); return result; } @@ -1446,9 +1452,9 @@ mono_custom_attrs_from_class_checked (MonoClass *klass, MonoError *error) MonoCustomAttrInfo* mono_custom_attrs_from_assembly (MonoAssembly *assembly) { - MonoError error; - MonoCustomAttrInfo *result = mono_custom_attrs_from_assembly_checked (assembly, FALSE, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo *result = mono_custom_attrs_from_assembly_checked (assembly, FALSE, error); + mono_error_cleanup (error); return result; } @@ -1488,9 +1494,9 @@ mono_custom_attrs_from_module (MonoImage *image, MonoError *error) MonoCustomAttrInfo* mono_custom_attrs_from_property (MonoClass *klass, MonoProperty *property) { - MonoError error; - MonoCustomAttrInfo * result = mono_custom_attrs_from_property_checked (klass, property, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo * result = mono_custom_attrs_from_property_checked (klass, property, error); + mono_error_cleanup (error); return result; } @@ -1517,9 +1523,9 @@ mono_custom_attrs_from_property_checked (MonoClass *klass, MonoProperty *propert MonoCustomAttrInfo* mono_custom_attrs_from_event (MonoClass *klass, MonoEvent *event) { - MonoError error; - MonoCustomAttrInfo * result = mono_custom_attrs_from_event_checked (klass, event, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo * result = mono_custom_attrs_from_event_checked (klass, event, error); + mono_error_cleanup (error); return result; } @@ -1546,9 +1552,9 @@ mono_custom_attrs_from_event_checked (MonoClass *klass, MonoEvent *event, MonoEr MonoCustomAttrInfo* mono_custom_attrs_from_field (MonoClass *klass, MonoClassField *field) { - MonoError error; - MonoCustomAttrInfo * result = mono_custom_attrs_from_field_checked (klass, field, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo * result = mono_custom_attrs_from_field_checked (klass, field, error); + mono_error_cleanup (error); return result; } @@ -1580,9 +1586,9 @@ mono_custom_attrs_from_field_checked (MonoClass *klass, MonoClassField *field, M MonoCustomAttrInfo* mono_custom_attrs_from_param (MonoMethod *method, guint32 param) { - MonoError error; - MonoCustomAttrInfo *result = mono_custom_attrs_from_param_checked (method, param, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoCustomAttrInfo *result = mono_custom_attrs_from_param_checked (method, param, error); + mono_error_cleanup (error); return result; } @@ -1688,9 +1694,9 @@ mono_custom_attrs_has_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass) MonoObject* mono_custom_attrs_get_attr (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass) { - MonoError error; - MonoObject *res = mono_custom_attrs_get_attr_checked (ainfo, attr_klass, &error); - mono_error_assert_ok (&error); /*FIXME proper error handling*/ + ERROR_DECL (error); + MonoObject *res = mono_custom_attrs_get_attr_checked (ainfo, attr_klass, error); + mono_error_assert_ok (error); /*FIXME proper error handling*/ return res; } @@ -1731,10 +1737,10 @@ MonoCustomAttrInfo* mono_reflection_get_custom_attrs_info (MonoObject *obj_raw) { HANDLE_FUNCTION_ENTER (); - MonoError error; + ERROR_DECL (error); MONO_HANDLE_DCL (MonoObject, obj); - MonoCustomAttrInfo *result = mono_reflection_get_custom_attrs_info_checked (obj, &error); - mono_error_assert_ok (&error); + MonoCustomAttrInfo *result = mono_reflection_get_custom_attrs_info_checked (obj, error); + mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_VAL (result); } @@ -1928,10 +1934,10 @@ MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj_raw) { HANDLE_FUNCTION_ENTER (); - MonoError error; + ERROR_DECL (error); MONO_HANDLE_DCL (MonoObject, obj); - MonoArrayHandle result = mono_reflection_get_custom_attrs_by_type_handle (obj, NULL, &error); - mono_error_cleanup (&error); + MonoArrayHandle result = mono_reflection_get_custom_attrs_by_type_handle (obj, NULL, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -1946,10 +1952,10 @@ MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj_raw) { HANDLE_FUNCTION_ENTER (); - MonoError error; + ERROR_DECL (error); MONO_HANDLE_DCL (MonoObject, obj); - MonoArrayHandle result = mono_reflection_get_custom_attrs_data_checked (obj, &error); - mono_error_cleanup (&error); + MonoArrayHandle result = mono_reflection_get_custom_attrs_data_checked (obj, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -2160,7 +2166,7 @@ static void init_weak_fields_inner (MonoImage *image, GHashTable *indexes) { MonoTableInfo *tdef; - MonoError error; + ERROR_DECL (error); MonoClass *klass = NULL; guint32 memberref_index = -1; int first_method_idx = -1; @@ -2168,9 +2174,9 @@ init_weak_fields_inner (MonoImage *image, GHashTable *indexes) if (image == mono_get_corlib ()) { /* Typedef */ - klass = mono_class_from_name_checked (image, "System", "WeakAttribute", &error); - if (!is_ok (&error)) { - mono_error_cleanup (&error); + klass = mono_class_from_name_checked (image, "System", "WeakAttribute", error); + if (!is_ok (error)) { + mono_error_cleanup (error); return; } if (!klass) @@ -2238,7 +2244,11 @@ init_weak_fields_inner (MonoImage *image, GHashTable *indexes) const char *nspace = mono_metadata_string_heap (image, cols [MONO_TYPEREF_NAMESPACE]); if (!strcmp (nspace, "System") && !strcmp (name, "WeakAttribute")) { - MonoClass *klass = mono_class_from_typeref (image, MONO_TOKEN_TYPE_REF | nindex); + MonoClass *klass = mono_class_from_typeref_checked (image, MONO_TOKEN_TYPE_REF | nindex, error); + if (!is_ok (error)) { + mono_error_cleanup (error); + return; + } g_assert (!strcmp (klass->name, "WeakAttribute")); /* Allow a testing dll as well since some profiles don't have WeakAttribute */ if (klass && (klass->image == mono_get_corlib () || strstr (klass->image->name, "Mono.Runtime.Testing"))) { diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c index 1e657e43aa..3742175728 100644 --- a/mono/metadata/debug-helpers.c +++ b/mono/metadata/debug-helpers.c @@ -575,6 +575,13 @@ mono_method_desc_is_full (MonoMethodDesc *desc) /** * mono_method_desc_full_match: + * \param desc A method description that you created with mono_method_desc_new + * \param method a MonoMethod instance that you want to match against + * + * This method is used to check whether the method matches the provided + * description, by making sure that the method matches both the class and the method parameters. + * + * \returns TRUE if the specified method matches the specified description, FALSE otherwise. */ gboolean mono_method_desc_full_match (MonoMethodDesc *desc, MonoMethod *method) @@ -631,15 +638,15 @@ mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image) mono_image_get_table_info (image, MONO_TABLE_TYPEDEF); methods = mono_image_get_table_info (image, MONO_TABLE_METHOD); for (i = 0; i < mono_table_info_get_rows (methods); ++i) { - MonoError error; + ERROR_DECL (error); guint32 token = mono_metadata_decode_row_col (methods, i, MONO_METHOD_NAME); const char *n = mono_metadata_string_heap (image, token); if (strcmp (n, desc->name)) continue; - method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error); + method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, error); if (!method) { - mono_error_cleanup (&error); + mono_error_cleanup (error); continue; } if (mono_method_desc_full_match (desc, method)) @@ -651,8 +658,8 @@ mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image) static const unsigned char* dis_one (GString *str, MonoDisHelper *dh, MonoMethod *method, const unsigned char *ip, const unsigned char *end) { - MonoError error; - MonoMethodHeader *header = mono_method_get_header_checked (method, &error); + ERROR_DECL (error); + MonoMethodHeader *header = mono_method_get_header_checked (method, error); const MonoOpcode *opcode; guint32 label, token; gint32 sval; @@ -661,8 +668,8 @@ dis_one (GString *str, MonoDisHelper *dh, MonoMethod *method, const unsigned cha const unsigned char* il_code; if (!header) { - g_string_append_printf (str, "could not disassemble, bad header due to %s", mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_string_append_printf (str, "could not disassemble, bad header due to %s", mono_error_get_message (error)); + mono_error_cleanup (error); return end; } il_code = mono_method_header_get_code (header, NULL, NULL); @@ -895,7 +902,7 @@ mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret, char wrapper [64]; char *klass_desc; char *inst_desc = NULL; - MonoError error; + ERROR_DECL (error); const char *class_method_separator = ":"; const char *method_sig_space = " "; @@ -947,12 +954,12 @@ mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret, strcpy (wrapper, ""); if (signature) { - MonoMethodSignature *sig = mono_method_signature_checked (method, &error); + MonoMethodSignature *sig = mono_method_signature_checked (method, error); char *tmpsig; - if (!is_ok (&error)) { + if (!is_ok (error)) { tmpsig = g_strdup_printf (""); - mono_error_cleanup (&error); + mono_error_cleanup (error); } else { tmpsig = mono_signature_get_desc (sig, TRUE); } @@ -1035,7 +1042,7 @@ print_name_space (MonoClass *klass) void mono_object_describe (MonoObject *obj) { - MonoError error; + ERROR_DECL (error); MonoClass* klass; const char* sep; if (!obj) { @@ -1044,8 +1051,8 @@ mono_object_describe (MonoObject *obj) } klass = mono_object_class (obj); if (klass == mono_defaults.string_class) { - char *utf8 = mono_string_to_utf8_checked ((MonoString*)obj, &error); - mono_error_cleanup (&error); /* FIXME don't swallow the error */ + char *utf8 = mono_string_to_utf8_checked ((MonoString*)obj, error); + mono_error_cleanup (error); /* FIXME don't swallow the error */ if (utf8 && strlen (utf8) > 60) { utf8 [57] = '.'; utf8 [58] = '.'; @@ -1214,15 +1221,15 @@ mono_value_describe_fields (MonoClass* klass, const char* addr) void mono_class_describe_statics (MonoClass* klass) { - MonoError error; + ERROR_DECL (error); MonoClassField *field; MonoClass *p; const char *field_ptr; - MonoVTable *vtable = mono_class_vtable_full (mono_domain_get (), klass, &error); + MonoVTable *vtable = mono_class_vtable_checked (mono_domain_get (), klass, error); const char *addr; - if (!vtable || !is_ok (&error)) { - mono_error_cleanup (&error); + if (!vtable || !is_ok (error)) { + mono_error_cleanup (error); return; } @@ -1255,12 +1262,12 @@ mono_class_describe_statics (MonoClass* klass) void mono_method_print_code (MonoMethod *method) { - MonoError error; + ERROR_DECL (error); char *code; - MonoMethodHeader *header = mono_method_get_header_checked (method, &error); + MonoMethodHeader *header = mono_method_get_header_checked (method, error); if (!header) { - printf ("METHOD HEADER NOT FOUND DUE TO: %s\n", mono_error_get_message (&error)); - mono_error_cleanup (&error); + printf ("METHOD HEADER NOT FOUND DUE TO: %s\n", mono_error_get_message (error)); + mono_error_cleanup (error); return; } code = mono_disasm_code (0, method, header->code, header->code + header->code_size); diff --git a/mono/metadata/decimal-ms.c b/mono/metadata/decimal-ms.c index c87eac6882..fe1c04ab7c 100644 --- a/mono/metadata/decimal-ms.c +++ b/mono/metadata/decimal-ms.c @@ -168,10 +168,15 @@ const DECOVFL power_overflow[] = { { 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) diff --git a/mono/metadata/domain-internals.h b/mono/metadata/domain-internals.h index 6d8042c076..ba58b3e7e1 100644 --- a/mono/metadata/domain-internals.h +++ b/mono/metadata/domain-internals.h @@ -7,6 +7,7 @@ #ifndef __MONO_METADATA_DOMAIN_INTERNALS_H__ #define __MONO_METADATA_DOMAIN_INTERNALS_H__ +#include #include #include #include @@ -359,7 +360,7 @@ struct _MonoDomain { /* Protected by 'jit_code_hash_lock' */ MonoInternalHashTable jit_code_hash; mono_mutex_t jit_code_hash_lock; - int num_jit_info_tables; + int num_jit_info_table_duplicates; MonoJitInfoTable * volatile jit_info_table; /* @@ -608,7 +609,10 @@ MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, void mono_enable_debug_domain_unload (gboolean enable); MonoReflectionAssembly * -mono_domain_try_type_resolve_checked (MonoDomain *domain, char *name, MonoObject *tb, MonoError *error); +mono_domain_try_type_resolve_name (MonoDomain *domain, const char *name, MonoError *error); + +MonoReflectionAssembly * +mono_domain_try_type_resolve_typebuilder (MonoDomain *domain, MonoReflectionTypeBuilder *typebuilder, MonoError *error); void mono_runtime_init_checked (MonoDomain *domain, MonoThreadStartCB start_cb, MonoThreadAttachCB attach_cb, MonoError *error); diff --git a/mono/metadata/domain.c b/mono/metadata/domain.c index 131bf56867..88f3f3f9fa 100644 --- a/mono/metadata/domain.c +++ b/mono/metadata/domain.c @@ -45,8 +45,8 @@ #include #include #include -#include -#include +#include +#include #include //#define DEBUG_DOMAIN_UNLOAD 1 @@ -292,6 +292,24 @@ mono_ptrarray_hash (gpointer *s) return hash; } +//g_malloc on sgen and mono_gc_alloc_fixed on boehm +static void* +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"); +} + +static void +gc_free_fixed_non_heap_list (void *ptr) +{ + if (mono_gc_is_moving ()) + return g_free (ptr); + else + return mono_gc_free_fixed (ptr); +} /* * Allocate an id for domain and set domain->domain_id. * LOCKING: must be called while holding appdomains_mutex. @@ -306,7 +324,8 @@ domain_id_alloc (MonoDomain *domain) int id = -1, i; if (!appdomains_list) { appdomain_list_size = 2; - appdomains_list = (MonoDomain **)mono_gc_alloc_fixed (appdomain_list_size * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domains list"); + appdomains_list = (MonoDomain **)gc_alloc_fixed_non_heap_list (appdomain_list_size * sizeof (void*)); + } for (i = appdomain_next; i < appdomain_list_size; ++i) { if (!appdomains_list [i]) { @@ -328,9 +347,9 @@ domain_id_alloc (MonoDomain *domain) if (new_size >= (1 << 16)) g_assert_not_reached (); id = appdomain_list_size; - new_list = (MonoDomain **)mono_gc_alloc_fixed (new_size * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domains list"); + new_list = (MonoDomain **)gc_alloc_fixed_non_heap_list (new_size * sizeof (void*)); memcpy (new_list, appdomains_list, appdomain_list_size * sizeof (void*)); - mono_gc_free_fixed (appdomains_list); + gc_free_fixed_non_heap_list (appdomains_list); appdomains_list = new_list; appdomain_list_size = new_size; } @@ -386,12 +405,11 @@ mono_domain_create (void) } mono_appdomains_unlock (); - if (!mono_gc_is_moving ()) { - domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object"); - } else { - domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object"); - mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields"); - } + if (!mono_gc_is_moving ()) + domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, NULL, "Domain Structure"); + else + domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, NULL, "Domain Structure"); + domain->shadow_serial = shadow_serial; domain->domain = NULL; domain->setup = NULL; @@ -403,15 +421,15 @@ mono_domain_create (void) domain->mp = mono_mempool_new (); domain->code_mp = mono_code_manager_new (); domain->lock_free_mp = lock_free_mempool_new (); - domain->env = mono_g_hash_table_new_type ((GHashFunc)mono_string_hash, (GCompareFunc)mono_string_equal, MONO_HASH_KEY_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain environment variables table"); + domain->env = mono_g_hash_table_new_type ((GHashFunc)mono_string_hash, (GCompareFunc)mono_string_equal, MONO_HASH_KEY_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, domain, "Domain Environment Variable Table"); domain->domain_assemblies = NULL; domain->assembly_bindings = NULL; domain->assembly_bindings_parsed = FALSE; domain->class_vtable_array = g_ptr_array_new (); domain->proxy_vtable_hash = g_hash_table_new ((GHashFunc)mono_ptrarray_hash, (GCompareFunc)mono_ptrarray_equal); mono_jit_code_hash_init (&domain->jit_code_hash); - domain->ldstr_table = mono_g_hash_table_new_type ((GHashFunc)mono_string_hash, (GCompareFunc)mono_string_equal, MONO_HASH_KEY_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain string constants table"); - domain->num_jit_info_tables = 1; + domain->ldstr_table = mono_g_hash_table_new_type ((GHashFunc)mono_string_hash, (GCompareFunc)mono_string_equal, MONO_HASH_KEY_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, domain, "Domain String Pool Table"); + domain->num_jit_info_table_duplicates = 0; domain->jit_info_table = mono_jit_info_table_new (domain); domain->jit_info_free_queue = NULL; domain->finalizable_objects_hash = g_hash_table_new (mono_aligned_addr_hash, NULL); @@ -762,6 +780,9 @@ mono_init_internal (const char *filename, const char *exe_filename, const char * mono_defaults.threadpool_perform_wait_callback_method = mono_class_get_method_from_name ( mono_defaults.threadpool_wait_callback_class, "PerformWaitCallback", 0); + mono_defaults.console_class = mono_class_try_load_from_name ( + mono_defaults.corlib, "System", "Console"); + domain->friendly_name = g_path_get_basename (filename); MONO_PROFILER_RAISE (domain_name, (domain, domain->friendly_name)); @@ -954,7 +975,7 @@ mono_domain_foreach (MonoDomainFunc func, gpointer user_data) */ mono_appdomains_lock (); size = appdomain_list_size; - copy = (MonoDomain **)mono_gc_alloc_fixed (appdomain_list_size * sizeof (void*), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "temporary domains list"); + copy = (MonoDomain **)gc_alloc_fixed_non_heap_list (appdomain_list_size * sizeof (void*)); memcpy (copy, appdomains_list, appdomain_list_size * sizeof (void*)); mono_appdomains_unlock (); @@ -963,7 +984,7 @@ mono_domain_foreach (MonoDomainFunc func, gpointer user_data) func (copy [i], user_data); } - mono_gc_free_fixed (copy); + gc_free_fixed_non_heap_list (copy); } /* FIXME: maybe we should integrate this with mono_assembly_open? */ @@ -1157,7 +1178,7 @@ mono_domain_free (MonoDomain *domain, gboolean force) mono_thread_hazardous_try_free_all (); if (domain->aot_modules) mono_jit_info_table_free (domain->aot_modules); - g_assert (domain->num_jit_info_tables == 1); + g_assert (domain->num_jit_info_table_duplicates == 0); mono_jit_info_table_free (domain->jit_info_table); domain->jit_info_table = NULL; g_assert (!domain->jit_info_free_queue); @@ -1710,7 +1731,7 @@ static void start_element (GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, - GError **error) + GError **gerror) { AppConfigInfo* app_config = (AppConfigInfo*) user_data; @@ -1737,7 +1758,7 @@ static void start_element (GMarkupParseContext *context, static void end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, - GError **error) + GError **gerror) { AppConfigInfo* app_config = (AppConfigInfo*) user_data; diff --git a/mono/metadata/dynamic-image.c b/mono/metadata/dynamic-image.c index 9c69791245..e386fbbe73 100644 --- a/mono/metadata/dynamic-image.c +++ b/mono/metadata/dynamic-image.c @@ -352,19 +352,19 @@ mono_dynamic_image_create (MonoDynamicAssembly *assembly, char *assembly_name, c mono_image_init (&image->image); - image->token_fixups = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module token fixups table"); + image->token_fixups = mono_g_hash_table_new_type ((GHashFunc)mono_object_hash, NULL, MONO_HASH_KEY_GC, MONO_ROOT_SOURCE_REFLECTION, NULL, "Reflection Dynamic Image Token Fixup Table"); image->method_to_table_idx = g_hash_table_new (NULL, NULL); image->field_to_table_idx = g_hash_table_new (NULL, NULL); image->method_aux_hash = g_hash_table_new (NULL, NULL); image->vararg_aux_hash = g_hash_table_new (NULL, NULL); image->handleref = g_hash_table_new (NULL, NULL); - image->tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module tokens table"); - image->generic_def_objects = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module generic definitions table"); + image->tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, NULL, "Reflection Dynamic Image Token Table"); + image->generic_def_objects = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, NULL, "Reflection Dynamic Image Generic Definition Table"); image->typespec = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal); image->typeref = g_hash_table_new ((GHashFunc)mono_metadata_type_hash, (GCompareFunc)mono_metadata_type_equal); image->blob_cache = g_hash_table_new ((GHashFunc)mono_blob_entry_hash, (GCompareFunc)mono_blob_entry_equal); image->gen_params = g_ptr_array_new (); - image->remapped_tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, "dynamic module remapped tokens table"); + image->remapped_tokens = mono_g_hash_table_new_type (NULL, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_REFLECTION, NULL, "Reflection Dynamic Image Remapped Token Table"); /*g_print ("string heap create for image %p (%s)\n", image, module_name);*/ string_heap_init (&image->sheap); diff --git a/mono/metadata/exception.c b/mono/metadata/exception.c index 61fde65417..d7aee9e1fd 100644 --- a/mono/metadata/exception.c +++ b/mono/metadata/exception.c @@ -68,20 +68,20 @@ MonoException * mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, const char* name_space, const char *name) { - MonoError error; + 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); - mono_error_assert_ok (&error); + o = mono_object_new_checked (domain, klass, 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); + mono_runtime_object_init_checked (o, error); + mono_error_assert_ok (error); if (domain != caller_domain) mono_domain_set_internal (caller_domain); @@ -102,18 +102,18 @@ mono_exception_from_name_domain (MonoDomain *domain, MonoImage *image, MonoException * mono_exception_from_token (MonoImage *image, guint32 token) { - MonoError error; + ERROR_DECL (error); MonoClass *klass; MonoObject *o; - klass = mono_class_get_checked (image, token, &error); - mono_error_assert_ok (&error); + 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); + o = mono_object_new_checked (mono_domain_get (), klass, error); + mono_error_assert_ok (error); - mono_runtime_object_init_checked (o, &error); - mono_error_assert_ok (&error); + mono_runtime_object_init_checked (o, error); + mono_error_assert_ok (error); return (MonoException *)o; } @@ -179,11 +179,11 @@ MonoException * mono_exception_from_name_two_strings (MonoImage *image, const char *name_space, const char *name, MonoString *a1, MonoString *a2) { - MonoError error; + ERROR_DECL (error); MonoException *ret; - ret = mono_exception_from_name_two_strings_checked (image, name_space, name, a1, a2, &error); - mono_error_cleanup (&error); + ret = mono_exception_from_name_two_strings_checked (image, name_space, name, a1, a2, error); + mono_error_cleanup (error); return ret; } @@ -230,14 +230,14 @@ MonoException * mono_exception_from_name_msg (MonoImage *image, const char *name_space, const char *name, const char *msg) { - MonoError error; + 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); + 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); } @@ -254,10 +254,10 @@ MonoException * mono_exception_from_token_two_strings (MonoImage *image, guint32 token, MonoString *a1, MonoString *a2) { - MonoError error; + ERROR_DECL (error); MonoException *ret; - ret = mono_exception_from_token_two_strings_checked (image, token, a1, a2, &error); - mono_error_cleanup (&error); + ret = mono_exception_from_token_two_strings_checked (image, token, a1, a2, error); + mono_error_cleanup (error); return ret; } @@ -434,17 +434,17 @@ mono_get_exception_array_type_mismatch () MonoException * mono_get_exception_type_load (MonoString *class_name, char *assembly_name) { - MonoError error; + ERROR_DECL (error); MonoString *s = NULL; if (assembly_name) { - s = mono_string_new_checked (mono_domain_get (), assembly_name, &error); - mono_error_assert_ok (&error); + s = mono_string_new_checked (mono_domain_get (), assembly_name, error); + mono_error_assert_ok (error); } else s = mono_string_empty (mono_domain_get ()); MonoException *ret = mono_exception_from_name_two_strings_checked (mono_get_corlib (), "System", - "TypeLoadException", class_name, s, &error); - mono_error_assert_ok (&error); + "TypeLoadException", class_name, s, error); + mono_error_assert_ok (error); return ret; } @@ -479,15 +479,15 @@ mono_get_exception_not_supported (const char *msg) MonoException * mono_get_exception_missing_method (const char *class_name, const char *member_name) { - MonoError 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); + 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); + "MissingMethodException", s1, s2, error); + mono_error_assert_ok (error); return ret; } @@ -500,15 +500,15 @@ mono_get_exception_missing_method (const char *class_name, const char *member_na MonoException * mono_get_exception_missing_field (const char *class_name, const char *member_name) { - MonoError 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); + 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", - "MissingFieldException", s1, s2, &error); - mono_error_assert_ok (&error); + "MissingFieldException", s1, s2, error); + mono_error_assert_ok (error); return ret; } @@ -526,10 +526,10 @@ mono_get_exception_argument_null (const char *arg) mono_get_corlib (), "System", "ArgumentNullException"); if (arg) { - MonoError error; + 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); + 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); } @@ -550,10 +550,10 @@ mono_get_exception_argument (const char *arg, const char *msg) mono_get_corlib (), "System", "ArgumentException", msg); if (arg) { - MonoError error; + 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); + 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); } @@ -574,10 +574,10 @@ mono_get_exception_argument_out_of_range (const char *arg) mono_get_corlib (), "System", "ArgumentOutOfRangeException"); if (arg) { - MonoError error; + 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); + 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); } @@ -616,10 +616,10 @@ mono_get_exception_io (const char *msg) MonoException * mono_get_exception_file_not_found (MonoString *fname) { - MonoError error; + ERROR_DECL (error); MonoException *ret = mono_exception_from_name_two_strings_checked ( - mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname, &error); - mono_error_assert_ok (&error); + mono_get_corlib (), "System.IO", "FileNotFoundException", fname, fname, error); + mono_error_assert_ok (error); return ret; } @@ -632,16 +632,16 @@ mono_get_exception_file_not_found (MonoString *fname) MonoException * mono_get_exception_file_not_found2 (const char *msg, MonoString *fname) { - MonoError error; + ERROR_DECL (error); MonoString *s = NULL; if (msg) { - s = mono_string_new_checked (mono_domain_get (), msg, &error); - mono_error_assert_ok (&error); + s = mono_string_new_checked (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); - mono_error_assert_ok (&error); + mono_get_corlib (), "System.IO", "FileNotFoundException", s, fname, error); + mono_error_assert_ok (error); return ret; } @@ -654,10 +654,10 @@ mono_get_exception_file_not_found2 (const char *msg, MonoString *fname) MonoException * mono_get_exception_type_initialization (const gchar *type_name, MonoException *inner) { - MonoError error; - MonoException *ret = mono_get_exception_type_initialization_checked (type_name, inner, &error); - if (!is_ok (&error)) { - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoException *ret = mono_get_exception_type_initialization_checked (type_name, inner, error); + if (!is_ok (error)) { + mono_error_cleanup (error); return NULL; } @@ -757,17 +757,17 @@ mono_get_exception_bad_image_format (const char *msg) MonoException * mono_get_exception_bad_image_format2 (const char *msg, MonoString *fname) { - MonoError error; + ERROR_DECL (error); MonoString *s = NULL; if (msg) { - s = mono_string_new_checked (mono_domain_get (), msg, &error); - mono_error_assert_ok (&error); + s = mono_string_new_checked (mono_domain_get (), msg, error); + mono_error_assert_ok (error); } MonoException *ret = mono_exception_from_name_two_strings_checked ( - mono_get_corlib (), "System", "BadImageFormatException", s, fname, &error); - mono_error_assert_ok (&error); + mono_get_corlib (), "System", "BadImageFormatException", s, fname, error); + mono_error_assert_ok (error); return ret; } @@ -843,12 +843,12 @@ MonoException * mono_get_exception_reflection_type_load (MonoArray *types_raw, MonoArray *exceptions_raw) { HANDLE_FUNCTION_ENTER (); - MonoError error; + ERROR_DECL (error); 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); + 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); goto leave; } @@ -903,10 +903,10 @@ mono_get_exception_reflection_type_load_checked (MonoArrayHandle types, MonoArra MonoException * mono_get_exception_runtime_wrapped (MonoObject *wrapped_exception) { - MonoError error; - MonoException *ret = mono_get_exception_runtime_wrapped_checked (wrapped_exception, &error); - if (!is_ok (&error)) { - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoException *ret = mono_get_exception_runtime_wrapped_checked (wrapped_exception, error); + if (!is_ok (error)) { + mono_error_cleanup (error); return NULL; } @@ -1084,7 +1084,7 @@ mono_invoke_unhandled_exception_hook (MonoObject *exc) if (unhandled_exception_hook) { unhandled_exception_hook (exc, unhandled_exception_hook_data); } else { - MonoError inner_error; + ERROR_DECL_VALUE (inner_error); MonoObject *other = NULL; MonoString *str = mono_object_try_to_string (exc, &other, &inner_error); char *msg = NULL; diff --git a/mono/metadata/file-mmap-posix.c b/mono/metadata/file-mmap-posix.c index adddf8b763..b936caa0fa 100644 --- a/mono/metadata/file-mmap-posix.c +++ b/mono/metadata/file-mmap-posix.c @@ -381,21 +381,21 @@ done: void * mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint64 *capacity, int access, int options, int *ioerror) { - MonoError error; + ERROR_DECL (error); MmapHandle *handle = NULL; g_assert (path || mapName); if (!mapName) { - char * c_path = mono_string_to_utf8_checked (path, &error); - if (mono_error_set_pending_exception (&error)) + char * c_path = mono_string_to_utf8_checked (path, error); + if (mono_error_set_pending_exception (error)) return NULL; handle = open_file_map (c_path, -1, mode, capacity, access, options, ioerror); g_free (c_path); return handle; } - char *c_mapName = mono_string_to_utf8_checked (mapName, &error); - if (mono_error_set_pending_exception (&error)) + char *c_mapName = mono_string_to_utf8_checked (mapName, error); + if (mono_error_set_pending_exception (error)) return NULL; if (path) { @@ -405,8 +405,8 @@ mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint64 *ca *ioerror = FILE_ALREADY_EXISTS; handle = NULL; } else { - char *c_path = mono_string_to_utf8_checked (path, &error); - if (is_ok (&error)) { + char *c_path = mono_string_to_utf8_checked (path, error); + if (is_ok (error)) { handle = (MmapHandle *)open_file_map (c_path, -1, mode, capacity, access, options, ioerror); if (handle) { handle->name = g_strdup (c_mapName); @@ -429,13 +429,13 @@ mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint64 *ca void * mono_mmap_open_handle (void *input_fd, MonoString *mapName, gint64 *capacity, int access, int options, int *ioerror) { - MonoError error; + ERROR_DECL (error); MmapHandle *handle; if (!mapName) { handle = (MmapHandle *)open_file_map (NULL, GPOINTER_TO_INT (input_fd), FILE_MODE_OPEN, capacity, access, options, ioerror); } else { - char *c_mapName = mono_string_to_utf8_checked (mapName, &error); - if (mono_error_set_pending_exception (&error)) + char *c_mapName = mono_string_to_utf8_checked (mapName, error); + if (mono_error_set_pending_exception (error)) return NULL; named_regions_lock (); diff --git a/mono/metadata/file-mmap-windows.c b/mono/metadata/file-mmap-windows.c index 59abd6686f..d5178b096c 100644 --- a/mono/metadata/file-mmap-windows.c +++ b/mono/metadata/file-mmap-windows.c @@ -139,6 +139,9 @@ static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c wchar_t *w_mapName = NULL; HANDLE result = NULL; + // INVALID_HANDLE_VALUE (-1) is valid, to make named shared memory, + // backed by physical memory / pagefile. + if (handle == INVALID_HANDLE_VALUE) { if (*capacity <= 0 && mode != FILE_MODE_OPEN) { *error = CAPACITY_MUST_BE_POSITIVE; @@ -156,7 +159,7 @@ static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c } } else { FILE_STANDARD_INFO info; - if (!GetFileInformationByHandleEx ((HANDLE) handle, FileStandardInfo, &info, sizeof (FILE_STANDARD_INFO))) { + if (!GetFileInformationByHandleEx (handle, FileStandardInfo, &info, sizeof (FILE_STANDARD_INFO))) { *error = convert_win32_error (GetLastError (), COULD_NOT_OPEN); return NULL; } @@ -171,10 +174,10 @@ static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c } } - w_mapName = mapName ? mono_string_to_utf16 (mapName) : NULL; + w_mapName = mapName ? mono_string_chars (mapName) : NULL; if (mode == FILE_MODE_CREATE_NEW || handle != INVALID_HANDLE_VALUE) { - result = CreateFileMappingW ((HANDLE)handle, NULL, get_page_access (access) | options, (DWORD)(((guint64)*capacity) >> 32), (DWORD)*capacity, w_mapName); + result = CreateFileMappingW (handle, NULL, get_page_access (access) | options, (DWORD)(((guint64)*capacity) >> 32), (DWORD)*capacity, w_mapName); if (result && GetLastError () == ERROR_ALREADY_EXISTS) { CloseHandle (result); result = NULL; @@ -209,7 +212,7 @@ static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c guint32 waitSleep = 0; while (waitRetries > 0) { - result = CreateFileMappingW ((HANDLE)handle, NULL, get_page_access (access) | options, (DWORD)(((guint64)*capacity) >> 32), (DWORD)*capacity, w_mapName); + result = CreateFileMappingW (handle, NULL, get_page_access (access) | options, (DWORD)(((guint64)*capacity) >> 32), (DWORD)*capacity, w_mapName); if (result) break; if (GetLastError() != ERROR_ACCESS_DENIED) { @@ -238,8 +241,6 @@ static void *open_handle (void *handle, MonoString *mapName, int mode, gint64 *c } } - if (w_mapName) - g_free (w_mapName); return result; } @@ -253,7 +254,7 @@ void *mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint gboolean delete_on_error = FALSE; if (path) { - w_path = mono_string_to_utf16 (path); + w_path = mono_string_chars (path); WIN32_FILE_ATTRIBUTE_DATA file_attrs; gboolean existed = GetFileAttributesExW (w_path, GetFileExInfoStandard, &file_attrs); if (!existed && mode == FILE_MODE_CREATE_NEW && *capacity == 0) { @@ -266,6 +267,9 @@ void *mono_mmap_open_file (MonoString *path, int mode, MonoString *mapName, gint goto done; } delete_on_error = !existed; + } else { + // INVALID_HANDLE_VALUE (-1) is valid, to make named shared memory, + // backed by physical memory / pagefile. } result = open_handle (hFile, mapName, mode, capacity, access, options, error); @@ -275,8 +279,6 @@ done: CloseHandle (hFile); if (!result && delete_on_error) DeleteFileW (w_path); - if (w_path) - g_free (w_path); return result; } @@ -291,13 +293,13 @@ void *mono_mmap_open_handle (void *handle, MonoString *mapName, gint64 *capacity void mono_mmap_close (void *mmap_handle) { g_assert (mmap_handle); - CloseHandle ((HANDLE) mmap_handle); + CloseHandle (mmap_handle); } void mono_mmap_configure_inheritability (void *mmap_handle, gboolean inheritability) { g_assert (mmap_handle); - if (!SetHandleInformation ((HANDLE) mmap_handle, HANDLE_FLAG_INHERIT, inheritability ? HANDLE_FLAG_INHERIT : 0)) { + if (!SetHandleInformation (mmap_handle, HANDLE_FLAG_INHERIT, inheritability ? HANDLE_FLAG_INHERIT : 0)) { g_error ("mono_mmap_configure_inheritability: SetHandleInformation failed with error %d!", GetLastError ()); } } @@ -361,7 +363,7 @@ int mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void * return CAPACITY_LARGER_THAN_LOGICAL_ADDRESS_SPACE; #endif - void *address = MapViewOfFile ((HANDLE) handle, get_file_map_access (access), (DWORD) (newOffset >> 32), (DWORD) newOffset, (SIZE_T) nativeSize); + void *address = MapViewOfFile (handle, get_file_map_access (access), (DWORD) (newOffset >> 32), (DWORD) newOffset, (SIZE_T) nativeSize); if (!address) return convert_win32_error (GetLastError (), COULD_NOT_MAP_MEMORY); diff --git a/mono/metadata/filewatcher.c b/mono/metadata/filewatcher.c index 159a2537bc..f0b8b14800 100644 --- a/mono/metadata/filewatcher.c +++ b/mono/metadata/filewatcher.c @@ -111,14 +111,14 @@ ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn, gint *code, gint *reqnum) { - MonoError error; + ERROR_DECL (error); FAMEvent ev; if (FAMNextEvent (conn, &ev) == 1) { - *filename = mono_string_new_checked (mono_domain_get (), ev.filename, &error); + *filename = mono_string_new_checked (mono_domain_get (), ev.filename, error); *code = ev.code; *reqnum = ev.fr.reqnum; - if (mono_error_set_pending_exception (&error)) + if (mono_error_set_pending_exception (error)) return FALSE; return TRUE; } @@ -155,15 +155,15 @@ ves_icall_System_IO_InotifyWatcher_GetInotifyInstance () int ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString *name, gint32 mask) { - MonoError error; + ERROR_DECL (error); char *str, *path; int retval; if (name == NULL) return -1; - str = mono_string_to_utf8_checked (name, &error); - if (mono_error_set_pending_exception (&error)) + str = mono_string_to_utf8_checked (name, error); + if (mono_error_set_pending_exception (error)) return -1; path = mono_portability_find_file (str, TRUE); if (!path) diff --git a/mono/metadata/gc-internals.h b/mono/metadata/gc-internals.h index 2a19c30494..7c3cb01466 100644 --- a/mono/metadata/gc-internals.h +++ b/mono/metadata/gc-internals.h @@ -22,7 +22,7 @@ #define mono_domain_finalizers_unlock(domain) mono_os_mutex_unlock (&(domain)->finalizable_objects_hash_lock); /* Register a memory area as a conservatively scanned GC root */ -#define MONO_GC_REGISTER_ROOT_PINNING(x,src,msg) mono_gc_register_root ((char*)&(x), sizeof(x), MONO_GC_DESCRIPTOR_NULL, (src), (msg)) +#define MONO_GC_REGISTER_ROOT_PINNING(x,src,key,msg) mono_gc_register_root ((char*)&(x), sizeof(x), MONO_GC_DESCRIPTOR_NULL, (src), (key), (msg)) #define MONO_GC_UNREGISTER_ROOT(x) mono_gc_deregister_root ((char*)&(x)) @@ -34,18 +34,18 @@ #define MONO_GC_ROOT_DESCR_FOR_FIXED(n) (mono_gc_is_moving () ? mono_gc_make_root_descr_all_refs (0) : MONO_GC_DESCRIPTOR_NULL) /* Register a memory location holding a single object reference as a GC root */ -#define MONO_GC_REGISTER_ROOT_SINGLE(x,src,msg) do { \ +#define MONO_GC_REGISTER_ROOT_SINGLE(x,src,key,msg) do { \ g_assert (sizeof (x) == sizeof (MonoObject*)); \ - mono_gc_register_root ((char*)&(x), sizeof(MonoObject*), mono_gc_make_root_descr_all_refs (1), (src), (msg)); \ + mono_gc_register_root ((char*)&(x), sizeof(MonoObject*), mono_gc_make_root_descr_all_refs (1), (src), (key),(msg)); \ } while (0) /* * This is used for fields which point to objects which are kept alive by other references * when using Boehm. */ -#define MONO_GC_REGISTER_ROOT_IF_MOVING(x,src,msg) do { \ +#define MONO_GC_REGISTER_ROOT_IF_MOVING(x,src,key,msg) do { \ if (mono_gc_is_moving ()) \ - MONO_GC_REGISTER_ROOT_SINGLE(x,src,msg); \ + MONO_GC_REGISTER_ROOT_SINGLE(x,src,key,msg); \ } while (0) #define MONO_GC_UNREGISTER_ROOT_IF_MOVING(x) do { \ @@ -121,7 +121,7 @@ gboolean mono_gc_user_markers_supported (void); * size bytes will be available from the returned address (ie, descr * must not be stored in the returned memory) */ -void* mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg); +void* mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg); void mono_gc_free_fixed (void* addr); /* make sure the gchandle was allocated for an object in domain */ @@ -142,7 +142,7 @@ void mono_gc_register_obj_with_weak_fields (void *obj); void mono_gc_register_for_finalization (MonoObject *obj, void *user_data); void mono_gc_add_memory_pressure (gint64 value); -MONO_API int mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg); +MONO_API int mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg); void mono_gc_deregister_root (char* addr); void mono_gc_finalize_domain (MonoDomain *domain); void mono_gc_run_finalize (void *obj, void *data); @@ -161,7 +161,7 @@ void mono_gc_suspend_finalizers (void); * FIXME: Add an API for clearing remset entries if a root with a user defined * mark routine is deleted. */ -int mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg); +int mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg); void mono_gc_wbarrier_set_root (gpointer ptr, MonoObject *value); @@ -348,6 +348,8 @@ MONO_API void mono_gc_register_finalizer_callbacks (MonoGCFinalizerCallbacks *ca BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved); #endif +MonoVTable *mono_gc_get_vtable (MonoObject *obj); + guint mono_gc_get_vtable_bits (MonoClass *klass); void mono_gc_register_altstack (gpointer stack, gint32 stack_size, gpointer altstack, gint32 altstack_size); diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index 2f0a82113c..06dd41c35c 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -92,6 +92,7 @@ static void object_register_finalizer (MonoObject *obj, void (*callback)(void *, static void reference_queue_proccess_all (void); 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 MonoThreadInfoWaitRet @@ -167,7 +168,7 @@ coop_cond_timedwait_alertable (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 void mono_gc_run_finalize (void *obj, void *data) { - MonoError error; + ERROR_DECL (error); MonoObject *exc = NULL; MonoObject *o; #ifndef HAVE_SGEN_GC @@ -176,7 +177,6 @@ mono_gc_run_finalize (void *obj, void *data) MonoMethod* finalizer = NULL; MonoDomain *caller_domain = mono_domain_get (); MonoDomain *domain; - RuntimeInvokeFunction runtime_invoke; // This function is called from the innards of the GC, so our best alternative for now is to do polling here mono_threads_safepoint (); @@ -287,17 +287,19 @@ mono_gc_run_finalize (void *obj, void *data) if (log_finalizers) g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Compiling finalizer.", o->vtable->klass->name, o); +#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); - domain->finalize_runtime_invoke = mono_compile_method_checked (invoke, &error); - mono_error_assert_ok (&error); /* expect this not to fail */ + domain->finalize_runtime_invoke = mono_compile_method_checked (invoke, error); + mono_error_assert_ok (error); /* expect this not to fail */ } - runtime_invoke = (RuntimeInvokeFunction)domain->finalize_runtime_invoke; + RuntimeInvokeFunction runtime_invoke = (RuntimeInvokeFunction)domain->finalize_runtime_invoke; +#endif - mono_runtime_class_init_full (o->vtable, &error); - goto_if_nok (&error, unhandled_error); + mono_runtime_class_init_full (o->vtable, error); + goto_if_nok (error, unhandled_error); if (G_UNLIKELY (MONO_GC_FINALIZE_INVOKE_ENABLED ())) { MONO_GC_FINALIZE_INVOKE ((unsigned long)o, mono_object_get_size (o), @@ -309,7 +311,12 @@ mono_gc_run_finalize (void *obj, void *data) MONO_PROFILER_RAISE (gc_finalizing_object, (o)); +#ifdef HOST_WASM + gpointer params[] = { NULL }; + mono_runtime_try_invoke (finalizer, o, params, &exc, error); +#else runtime_invoke (o, NULL, &exc, NULL); +#endif MONO_PROFILER_RAISE (gc_finalized_object, (o)); @@ -317,8 +324,8 @@ mono_gc_run_finalize (void *obj, void *data) g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Returned from finalizer.", o->vtable->klass->name, o); unhandled_error: - if (!is_ok (&error)) - exc = (MonoObject*)mono_error_convert_to_exception (&error); + if (!is_ok (error)) + exc = (MonoObject*)mono_error_convert_to_exception (error); if (exc) mono_thread_internal_unhandled_exception (exc); @@ -708,7 +715,11 @@ mono_gc_finalize_notify (void) if (mono_gc_is_null ()) return; +#ifdef HOST_WASM + mono_threads_schedule_background_job (mono_runtime_do_background_work); +#else mono_coop_sem_post (&finalizer_sem); +#endif } /* @@ -825,16 +836,46 @@ finalize_domain_objects (void) } } + +static void +mono_runtime_do_background_work (void) +{ + mono_threads_perform_thread_dump (); + + mono_console_handle_async_ops (); + + mono_attach_maybe_start (); + + finalize_domain_objects (); + + MONO_PROFILER_RAISE (gc_finalizing, ()); + + /* If finished == TRUE, mono_gc_cleanup has been called (from mono_runtime_cleanup), + * before the domain is unloaded. + */ + mono_gc_invoke_finalizers (); + + MONO_PROFILER_RAISE (gc_finalized, ()); + + mono_threads_join_threads (); + + reference_queue_proccess_all (); + + mono_w32process_signal_finished (); + + hazard_free_queue_pump (); +} + static gsize WINAPI finalizer_thread (gpointer unused) { - MonoError error; + ERROR_DECL (error); gboolean wait = TRUE; - MonoString *finalizer = mono_string_new_checked (mono_get_root_domain (), "Finalizer", &error); - mono_error_assert_ok (&error); - mono_thread_set_name_internal (mono_thread_internal_current (), finalizer, FALSE, FALSE, &error); - mono_error_assert_ok (&error); + MonoString *finalizer = mono_string_new_checked (mono_get_root_domain (), "Finalizer", error); + mono_error_assert_ok (error); + mono_thread_set_name_internal (mono_thread_internal_current (), finalizer, FALSE, FALSE, error); + mono_error_assert_ok (error); /* Register a hazard free queue pump callback */ mono_hazard_pointer_install_free_queue_size_callback (hazard_free_queue_is_too_big); @@ -855,30 +896,7 @@ finalizer_thread (gpointer unused) mono_gc_set_skip_thread (FALSE); - mono_threads_perform_thread_dump (); - - mono_console_handle_async_ops (); - - mono_attach_maybe_start (); - - finalize_domain_objects (); - - MONO_PROFILER_RAISE (gc_finalizing, ()); - - /* If finished == TRUE, mono_gc_cleanup has been called (from mono_runtime_cleanup), - * before the domain is unloaded. - */ - mono_gc_invoke_finalizers (); - - MONO_PROFILER_RAISE (gc_finalized, ()); - - mono_threads_join_threads (); - - reference_queue_proccess_all (); - - mono_w32process_signal_finished (); - - hazard_free_queue_pump (); + mono_runtime_do_background_work (); /* Avoid posting the pending done event until there are pending finalizers */ if (mono_coop_sem_timedwait (&finalizer_sem, 0, MONO_SEM_FLAGS_NONE) == MONO_SEM_TIMEDWAIT_RET_SUCCESS) { @@ -910,9 +928,9 @@ static void mono_gc_init_finalizer_thread (void) { - MonoError error; - gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + gc_thread = mono_thread_create_internal (mono_domain_get (), finalizer_thread, NULL, MONO_THREAD_CREATE_FLAGS_NONE, error); + mono_error_assert_ok (error); } void diff --git a/mono/metadata/handle.c b/mono/metadata/handle.c index 9208cd285e..ad47303d02 100644 --- a/mono/metadata/handle.c +++ b/mono/metadata/handle.c @@ -35,14 +35,13 @@ Add counters for: Actually do something in mono_handle_verify Shrink the handles stack in mono_handle_stack_scan -Properly report it to the profiler. Add a boehm implementation TODO (things to explore): There's no convenient way to wrap the object allocation function. Right now we do this: - MonoCultureInfoHandle culture = MONO_HANDLE_NEW (MonoCultureInfo, mono_object_new_checked (domain, klass, &error)); + MonoCultureInfoHandle culture = MONO_HANDLE_NEW (MonoCultureInfo, mono_object_new_checked (domain, klass, error)); Maybe what we need is a round of cleanup around all exposed types in the runtime to unify all helpers under the same hoof. Combine: MonoDefaults, GENERATE_GET_CLASS_WITH_CACHE, TYPED_HANDLE_DECL and friends. @@ -69,7 +68,7 @@ Combine: MonoDefaults, GENERATE_GET_CLASS_WITH_CACHE, TYPED_HANDLE_DECL and frie * Note that the handle stack is scanned PRECISELY (see * sgen_client_scan_thread_data ()). That means there should not be * stale objects scanned. So when we manipulate the size of a chunk, - * wemust ensure that the newly scannable slot is either null or + * we must ensure that the newly scannable slot is either null or * points to a valid value. */ @@ -382,10 +381,11 @@ check_handle_stack_monotonic (HandleStack *stack) } void -mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise) +mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise, gboolean check) { - if (precise) /* run just once (per handle stack) per GC */ + if (check) /* run just once (per handle stack) per GC */ check_handle_stack_monotonic (stack); + /* We're called twice - on the imprecise pass we call func to pin the objects where the handle points to its interior. On the precise diff --git a/mono/metadata/handle.h b/mono/metadata/handle.h index 10cc400f51..8328eee0e2 100644 --- a/mono/metadata/handle.h +++ b/mono/metadata/handle.h @@ -132,7 +132,7 @@ MonoRawHandle mono_handle_new_full (gpointer rawptr, gboolean interior, const ch MonoRawHandle mono_handle_new_interior (gpointer rawptr, const char *owner); #endif -void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise); +void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data, gboolean precise, gboolean check); gboolean mono_handle_stack_is_empty (HandleStack *stack); HandleStack* mono_handle_stack_alloc (void); void mono_handle_stack_free (HandleStack *handlestack); @@ -180,12 +180,12 @@ Icall macros */ #define SETUP_ICALL_COMMON \ do { \ - MonoError error; \ + ERROR_DECL (error); \ MonoThreadInfo *__info = mono_thread_info_current (); \ - error_init (&error); \ + error_init (error); \ #define CLEAR_ICALL_COMMON \ - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); #define SETUP_ICALL_FRAME \ HandleStackMark __mark; \ diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h index 55f8d408e0..58416155ce 100644 --- a/mono/metadata/icall-def.h +++ b/mono/metadata/icall-def.h @@ -9,7 +9,7 @@ * typeid must be a C symbol name unique to the type, don't worry about namespace * pollution, since it will be automatically prefixed to avoid it. * typename is a C string containing the full name of the type - * first_icall_id s the symbol ID of the first internal call of the declared + * first_icall_id is the symbol ID of the first internal call of the declared * type (see below) * * The list of internal calls of the methods of a type must follow the @@ -18,7 +18,7 @@ * ICALL(icallid, methodname, cfuncptr) * * icallid must be a C symbol, unique for each icall defined in this file and - * tipically equal to the typeid + '_' + a sequential number. + * typically equal to the typeid + '_' + a sequential number. * methodname is a C string defining the method name and the optional signature * (the signature is required only when several internal calls in the type * have the same name) @@ -64,7 +64,6 @@ * Limitations: "out" and "ref" arguments are not supported yet. */ -#ifndef DISABLE_PROCESS_HANDLING ICALL_TYPE(NATIVEMETHODS, "Microsoft.Win32.NativeMethods", NATIVEMETHODS_1) ICALL(NATIVEMETHODS_1, "CloseProcess", ves_icall_Microsoft_Win32_NativeMethods_CloseProcess) ICALL(NATIVEMETHODS_2, "GetCurrentProcess", ves_icall_Microsoft_Win32_NativeMethods_GetCurrentProcess) @@ -77,7 +76,6 @@ ICALL(NATIVEMETHODS_8, "SetPriorityClass", ves_icall_Microsoft_Win32_NativeMetho ICALL(NATIVEMETHODS_9, "SetProcessWorkingSetSize", ves_icall_Microsoft_Win32_NativeMethods_SetProcessWorkingSetSize) ICALL(NATIVEMETHODS_10, "TerminateProcess", ves_icall_Microsoft_Win32_NativeMethods_TerminateProcess) ICALL(NATIVEMETHODS_11, "WaitForInputIdle", ves_icall_Microsoft_Win32_NativeMethods_WaitForInputIdle) -#endif /* !DISABLE_PROCESS_HANDLING */ #ifndef DISABLE_COM ICALL_TYPE(COMPROX, "Mono.Interop.ComInteropProxy", COMPROX_1) @@ -224,7 +222,6 @@ ICALL(TRACEL_1, "WriteWindowsDebugString", ves_icall_System_Diagnostics_DefaultT ICALL_TYPE(FILEV, "System.Diagnostics.FileVersionInfo", FILEV_1) ICALL(FILEV_1, "GetVersionInfo_internal(string)", ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal) -#ifndef DISABLE_PROCESS_HANDLING ICALL_TYPE(PERFCTR, "System.Diagnostics.PerformanceCounter", PERFCTR_1) ICALL(PERFCTR_1, "FreeData", mono_perfcounter_free_data) ICALL(PERFCTR_2, "GetImpl", mono_perfcounter_get_impl) @@ -249,7 +246,6 @@ ICALL(PROCESS_6, "GetProcess_internal(int)", ves_icall_System_Diagnostics_Proces 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) -#endif /* !DISABLE_PROCESS_HANDLING */ ICALL_TYPE(STOPWATCH, "System.Diagnostics.Stopwatch", STOPWATCH_1) ICALL(STOPWATCH_1, "GetTimestamp", mono_100ns_ticks) @@ -936,23 +932,23 @@ ICALL_TYPE(THREAD, "System.Threading.Thread", THREAD_1) ICALL(THREAD_1, "Abort_internal(System.Threading.InternalThread,object)", ves_icall_System_Threading_Thread_Abort) ICALL(THREAD_1a, "ByteArrayToCurrentDomain(byte[])", ves_icall_System_Threading_Thread_ByteArrayToCurrentDomain) ICALL(THREAD_1b, "ByteArrayToRootDomain(byte[])", ves_icall_System_Threading_Thread_ByteArrayToRootDomain) -ICALL(THREAD_2, "ClrState(System.Threading.InternalThread,System.Threading.ThreadState)", ves_icall_System_Threading_Thread_ClrState) +HANDLES(ICALL(THREAD_2, "ClrState(System.Threading.InternalThread,System.Threading.ThreadState)", ves_icall_System_Threading_Thread_ClrState)) ICALL(THREAD_2a, "ConstructInternalThread", ves_icall_System_Threading_Thread_ConstructInternalThread) ICALL(THREAD_55, "GetAbortExceptionState", ves_icall_System_Threading_Thread_GetAbortExceptionState) -ICALL(THREAD_60, "GetCurrentThread", ves_icall_System_Threading_Thread_GetCurrentThread) +HANDLES(ICALL(THREAD_60, "GetCurrentThread", ves_icall_System_Threading_Thread_GetCurrentThread)) ICALL(THREAD_7, "GetDomainID", ves_icall_System_Threading_Thread_GetDomainID) -ICALL(THREAD_8, "GetName_internal(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetName_internal) -ICALL(THREAD_57, "GetPriorityNative", ves_icall_System_Threading_Thread_GetPriority) +HANDLES(ICALL(THREAD_8, "GetName_internal(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetName_internal)) +HANDLES(ICALL(THREAD_57, "GetPriorityNative", ves_icall_System_Threading_Thread_GetPriority)) ICALL(THREAD_59, "GetStackTraces", ves_icall_System_Threading_Thread_GetStackTraces) -ICALL(THREAD_11, "GetState(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetState) +HANDLES(ICALL(THREAD_11, "GetState(System.Threading.InternalThread)", ves_icall_System_Threading_Thread_GetState)) ICALL(THREAD_53, "InterruptInternal", ves_icall_System_Threading_Thread_Interrupt_internal) ICALL(THREAD_12, "JoinInternal", ves_icall_System_Threading_Thread_Join_internal) ICALL(THREAD_13, "MemoryBarrier", ves_icall_System_Threading_Thread_MemoryBarrier) ICALL(THREAD_14, "ResetAbortNative", ves_icall_System_Threading_Thread_ResetAbort) 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) -ICALL(THREAD_58, "SetPriorityNative", ves_icall_System_Threading_Thread_SetPriority) -ICALL(THREAD_21, "SetState(System.Threading.InternalThread,System.Threading.ThreadState)", ves_icall_System_Threading_Thread_SetState) +HANDLES(ICALL(THREAD_58, "SetPriorityNative", ves_icall_System_Threading_Thread_SetPriority)) +HANDLES(ICALL(THREAD_21, "SetState(System.Threading.InternalThread,System.Threading.ThreadState)", ves_icall_System_Threading_Thread_SetState)) ICALL(THREAD_22, "SleepInternal", ves_icall_System_Threading_Thread_Sleep_internal) ICALL(THREAD_54, "SpinWait_nop", ves_icall_System_Threading_Thread_SpinWait_nop) ICALL(THREAD_23, "SuspendInternal", ves_icall_System_Threading_Thread_Suspend) @@ -996,6 +992,7 @@ ICALL(THREADP_5, "InitializeVMTp", ves_icall_System_Threading_ThreadPool_Initial ICALL(THREADP_6, "IsThreadPoolHosted", ves_icall_System_Threading_ThreadPool_IsThreadPoolHosted) ICALL(THREADP_7, "NotifyWorkItemComplete", ves_icall_System_Threading_ThreadPool_NotifyWorkItemComplete) ICALL(THREADP_8, "NotifyWorkItemProgressNative", ves_icall_System_Threading_ThreadPool_NotifyWorkItemProgressNative) +ICALL(THREADP_8m, "NotifyWorkItemQueued", ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued) ICALL(THREADP_9, "PostQueuedCompletionStatus", ves_icall_System_Threading_ThreadPool_PostQueuedCompletionStatus) ICALL(THREADP_11, "ReportThreadStatus", ves_icall_System_Threading_ThreadPool_ReportThreadStatus) ICALL(THREADP_12, "RequestWorkerThread", ves_icall_System_Threading_ThreadPool_RequestWorkerThread) diff --git a/mono/metadata/icall-table.c b/mono/metadata/icall-table.c new file mode 100644 index 0000000000..93e26114ae --- /dev/null +++ b/mono/metadata/icall-table.c @@ -0,0 +1,433 @@ +/** + * \file + * + * Authors: + * Dietmar Maurer (dietmar@ximian.com) + * Paolo Molaro (lupus@ximian.com) + * Patrik Torstensson (patrik.torstensson@labs2.com) + * Marek Safar (marek.safar@gmail.com) + * Aleksey Kliger (aleksey@xamarin.com) + * + * Copyright 2001-2003 Ximian, Inc (http://www.ximian.com) + * Copyright 2004-2009 Novell, Inc (http://www.novell.com) + * Copyright 2011-2015 Xamarin Inc (http://www.xamarin.com). + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ + +#include +#include +#include +#include +#include +#ifdef HAVE_ALLOCA_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#if defined (HAVE_WCHAR_H) +#include +#endif + +#include +#include +#include + +/* + * icall.c defines a lot of icalls as static, to avoid having to add prototypes for + * them, just don't include any mono headers and emit dummy prototypes. + */ +// Generate prototypes +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) extern void func (void); +#define HANDLES(inner) inner +#include "metadata/icall-def.h" + +// Generate Icall_ constants +#undef ICALL_TYPE +#undef ICALL +#undef HANDLES +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) Icall_ ## id, +#define HANDLES(inner) inner + +enum { +#include "metadata/icall-def.h" + Icall_last +}; + +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,first) Icall_type_ ## id, +#define ICALL(id,name,func) +#undef HANDLES +#define HANDLES(inner) inner +enum { +#include "metadata/icall-def.h" + Icall_type_num +}; + +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,firstic) {(Icall_ ## firstic)}, +#define ICALL(id,name,func) +#undef HANDLES +#define HANDLES(inner) inner +typedef struct { + guint16 first_icall; +} IcallTypeDesc; + +static const IcallTypeDesc +icall_type_descs [] = { +#include "metadata/icall-def.h" + {Icall_last} +}; + +#define icall_desc_num_icalls(desc) ((desc) [1].first_icall - (desc) [0].first_icall) + +#undef HANDLES +#define HANDLES(inner) inner +#undef ICALL_TYPE +#define ICALL_TYPE(id,name,first) +#undef ICALL + +#ifdef HAVE_ARRAY_ELEM_INIT +#define MSGSTRFIELD(line) MSGSTRFIELD1(line) +#define MSGSTRFIELD1(line) str##line + +static const struct msgstrtn_t { +#define ICALL(id,name,func) +#undef ICALL_TYPE +#define ICALL_TYPE(id,name,first) char MSGSTRFIELD(__LINE__) [sizeof (name)]; +#include "metadata/icall-def.h" +#undef ICALL_TYPE +} icall_type_names_str = { +#define ICALL_TYPE(id,name,first) (name), +#include "metadata/icall-def.h" +#undef ICALL_TYPE +}; +static const guint16 icall_type_names_idx [] = { +#define ICALL_TYPE(id,name,first) [Icall_type_ ## id] = offsetof (struct msgstrtn_t, MSGSTRFIELD(__LINE__)), +#include "metadata/icall-def.h" +#undef ICALL_TYPE +}; +#define icall_type_name_get(id) ((const char*)&icall_type_names_str + icall_type_names_idx [(id)]) + +static const struct msgstr_t { +#undef ICALL +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) char MSGSTRFIELD(__LINE__) [sizeof (name)]; +#include "metadata/icall-def.h" +#undef ICALL +} icall_names_str = { +#define ICALL(id,name,func) (name), +#include "metadata/icall-def.h" +#undef ICALL +}; +static const guint16 icall_names_idx [] = { +#define ICALL(id,name,func) [Icall_ ## id] = offsetof (struct msgstr_t, MSGSTRFIELD(__LINE__)), +#include "metadata/icall-def.h" +#undef ICALL +}; +#define icall_name_get(id) ((const char*)&icall_names_str + icall_names_idx [(id)]) + +#else + +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,first) name, +#define ICALL(id,name,func) +static const char* const +icall_type_names [] = { +#include "metadata/icall-def.h" + NULL +}; + +#define icall_type_name_get(id) (icall_type_names [(id)]) + +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) name, +static const char* const +icall_names [] = { +#include "metadata/icall-def.h" + NULL +}; +#define icall_name_get(id) icall_names [(id)] + +#endif /* !HAVE_ARRAY_ELEM_INIT */ + +#undef HANDLES +#define HANDLES(inner) inner +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) func, +static const gconstpointer +icall_functions [] = { +#include "metadata/icall-def.h" + NULL +}; + +#ifdef ENABLE_ICALL_SYMBOL_MAP +#undef HANDLES +#define HANDLES(inner) inner +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) #func, +static const gconstpointer +icall_symbols [] = { +#include "metadata/icall-def.h" + NULL +}; +#endif + +#undef ICALL_TYPE +#undef ICALL +#define ICALL_TYPE(id,name,first) +#define ICALL(id,name,func) 0, +#undef HANDLES +#define HANDLES(inner) 1, +static const guchar +icall_uses_handles [] = { +#include "metadata/icall-def.h" +#undef ICALL +#undef HANDLES +}; + +#ifdef HAVE_ARRAY_ELEM_INIT +static int +compare_method_imap (const void *key, const void *elem) +{ + const char* method_name = (const char*)&icall_names_str + (*(guint16*)elem); + return strcmp (key, method_name); +} + +static gsize +find_slot_icall (const IcallTypeDesc *imap, const char *name) +{ + const guint16 *nameslot = (const guint16 *)mono_binary_search (name, icall_names_idx + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names_idx [0]), compare_method_imap); + if (!nameslot) + return -1; + return (nameslot - &icall_names_idx [0]); +} + +static gboolean +find_uses_handles_icall (const IcallTypeDesc *imap, const char *name) +{ + gsize slotnum = find_slot_icall (imap, name); + if (slotnum == -1) + return FALSE; + return (gboolean)icall_uses_handles [slotnum]; +} + +static gpointer +find_method_icall (const IcallTypeDesc *imap, const char *name) +{ + gsize slotnum = find_slot_icall (imap, name); + if (slotnum == -1) + return NULL; + return (gpointer)icall_functions [slotnum]; +} + +static int +compare_class_imap (const void *key, const void *elem) +{ + const char* class_name = (const char*)&icall_type_names_str + (*(guint16*)elem); + return strcmp (key, class_name); +} + +static const IcallTypeDesc* +find_class_icalls (const char *name) +{ + const guint16 *nameslot = (const guint16 *)mono_binary_search (name, icall_type_names_idx, Icall_type_num, sizeof (icall_type_names_idx [0]), compare_class_imap); + if (!nameslot) + return NULL; + return &icall_type_descs [nameslot - &icall_type_names_idx [0]]; +} + +#else /* HAVE_ARRAY_ELEM_INIT */ + +static int +compare_method_imap (const void *key, const void *elem) +{ + const char** method_name = (const char**)elem; + return strcmp (key, *method_name); +} + +static gsize +find_slot_icall (const IcallTypeDesc *imap, const char *name) +{ + const char **nameslot = mono_binary_search (name, icall_names + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names [0]), compare_method_imap); + if (!nameslot) + return -1; + return nameslot - icall_names; +} + +static gpointer +find_method_icall (const IcallTypeDesc *imap, const char *name) +{ + gsize slotnum = find_slot_icall (imap, name); + if (slotnum == -1) + return NULL; + return (gpointer)icall_functions [slotnum]; +} + +static gboolean +find_uses_handles_icall (const IcallTypeDesc *imap, const char *name) +{ + gsize slotnum = find_slot_icall (imap, name); + if (slotnum == -1) + return FALSE; + return (gboolean)icall_uses_handles [slotnum]; +} + +static int +compare_class_imap (const void *key, const void *elem) +{ + const char** class_name = (const char**)elem; + return strcmp (key, *class_name); +} + +static const IcallTypeDesc* +find_class_icalls (const char *name) +{ + const char **nameslot = mono_binary_search (name, icall_type_names, Icall_type_num, sizeof (icall_type_names [0]), compare_class_imap); + if (!nameslot) + return NULL; + return &icall_type_descs [nameslot - icall_type_names]; +} + +#endif /* HAVE_ARRAY_ELEM_INIT */ + +static gpointer +icall_table_lookup (char *classname, char *methodname, char *sigstart, gboolean *uses_handles) +{ + const IcallTypeDesc *imap = NULL; + gpointer res; + + imap = find_class_icalls (classname); + + /* it wasn't found in the static call tables */ + if (!imap) { + if (uses_handles) + *uses_handles = FALSE; + return NULL; + } + res = find_method_icall (imap, methodname); + if (res) { + if (uses_handles) + *uses_handles = find_uses_handles_icall (imap, methodname); + return res; + } + /* try _with_ signature */ + *sigstart = '('; + res = find_method_icall (imap, methodname); + if (res) { + if (uses_handles) + *uses_handles = find_uses_handles_icall (imap, methodname); + return res; + } + return NULL; +} + +#ifdef ENABLE_ICALL_SYMBOL_MAP +static int +func_cmp (gconstpointer key, gconstpointer p) +{ + return (gsize)key - (gsize)*(gsize*)p; +} +#endif + +static const char* +lookup_icall_symbol (gpointer func) +{ +#ifdef ENABLE_ICALL_SYMBOL_MAP + int i; + gpointer slot; + static gconstpointer *functions_sorted; + static const char**symbols_sorted; + static gboolean inited; + + if (!inited) { + gboolean changed; + + functions_sorted = g_malloc (G_N_ELEMENTS (icall_functions) * sizeof (gpointer)); + memcpy (functions_sorted, icall_functions, G_N_ELEMENTS (icall_functions) * sizeof (gpointer)); + symbols_sorted = g_malloc (G_N_ELEMENTS (icall_functions) * sizeof (gpointer)); + memcpy (symbols_sorted, icall_symbols, G_N_ELEMENTS (icall_functions) * sizeof (gpointer)); + /* Bubble sort the two arrays */ + changed = TRUE; + while (changed) { + changed = FALSE; + for (i = 0; i < G_N_ELEMENTS (icall_functions) - 1; ++i) { + if (functions_sorted [i] > functions_sorted [i + 1]) { + gconstpointer tmp; + + tmp = functions_sorted [i]; + functions_sorted [i] = functions_sorted [i + 1]; + functions_sorted [i + 1] = tmp; + tmp = symbols_sorted [i]; + symbols_sorted [i] = symbols_sorted [i + 1]; + symbols_sorted [i + 1] = tmp; + changed = TRUE; + } + } + } + } + + slot = mono_binary_search (func, functions_sorted, G_N_ELEMENTS (icall_functions), sizeof (gpointer), func_cmp); + if (!slot) + return NULL; + g_assert (slot); + return symbols_sorted [(gpointer*)slot - (gpointer*)functions_sorted]; +#else + fprintf (stderr, "icall symbol maps not enabled, pass --enable-icall-symbol-map to configure.\n"); + g_assert_not_reached (); + return NULL; +#endif +} + +void +mono_icall_table_init (void) +{ + int i = 0; + + /* check that tables are sorted: disable in release */ + if (TRUE) { + int j; + const char *prev_class = NULL; + const char *prev_method; + + for (i = 0; i < Icall_type_num; ++i) { + const IcallTypeDesc *desc; + int num_icalls; + prev_method = NULL; + if (prev_class && strcmp (prev_class, icall_type_name_get (i)) >= 0) + g_print ("class %s should come before class %s\n", icall_type_name_get (i), prev_class); + prev_class = icall_type_name_get (i); + desc = &icall_type_descs [i]; + num_icalls = icall_desc_num_icalls (desc); + /*g_print ("class %s has %d icalls starting at %d\n", prev_class, num_icalls, desc->first_icall);*/ + for (j = 0; j < num_icalls; ++j) { + const char *methodn = icall_name_get (desc->first_icall + j); + if (prev_method && strcmp (prev_method, methodn) >= 0) + g_print ("method %s should come before method %s\n", methodn, prev_method); + prev_method = methodn; + } + } + } + + MonoIcallTableCallbacks cb; + memset (&cb, 0, sizeof (MonoIcallTableCallbacks)); + cb.version = MONO_ICALL_TABLE_CALLBACKS_VERSION; + cb.lookup = icall_table_lookup; + cb.lookup_icall_symbol = lookup_icall_symbol; + + mono_install_icall_table_callbacks (&cb); +} diff --git a/mono/metadata/icall-table.h b/mono/metadata/icall-table.h new file mode 100644 index 0000000000..76d5e5b397 --- /dev/null +++ b/mono/metadata/icall-table.h @@ -0,0 +1,27 @@ +/** + * \file + * Copyright 2016 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_METADATA_ICALL_TABLE_H__ +#define __MONO_METADATA_ICALL_TABLE_H__ + +#include +#include +#include + +#define MONO_ICALL_TABLE_CALLBACKS_VERSION 1 + +typedef struct { + int version; + gpointer (*lookup) (char *classname, char *methodname, char *sigstart, gboolean *uses_handles); + const char* (*lookup_icall_symbol) (gpointer func); +} MonoIcallTableCallbacks; + +void +mono_install_icall_table_callbacks (MonoIcallTableCallbacks *cb); + +MONO_API void +mono_icall_table_init (void); + +#endif diff --git a/mono/metadata/icall-windows.c b/mono/metadata/icall-windows.c index cb5215b016..b5493091e7 100644 --- a/mono/metadata/icall-windows.c +++ b/mono/metadata/icall-windows.c @@ -159,19 +159,15 @@ mono_icall_set_environment_variable (MonoString *name, MonoString *value) { gunichar2 *utf16_name, *utf16_value; - utf16_name = mono_string_to_utf16 (name); + utf16_name = name ? mono_string_chars (name) : NULL; if ((value == NULL) || (mono_string_length (value) == 0) || (mono_string_chars (value)[0] == 0)) { SetEnvironmentVariable (utf16_name, NULL); - g_free (utf16_name); return; } - utf16_value = mono_string_to_utf16 (value); + utf16_value = mono_string_chars (value); SetEnvironmentVariable (utf16_name, utf16_value); - - g_free (utf16_name); - g_free (utf16_value); } #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) diff --git a/mono/metadata/icall.c.REMOVED.git-id b/mono/metadata/icall.c.REMOVED.git-id index f64bab2b3a..d2940e9cd4 100644 --- a/mono/metadata/icall.c.REMOVED.git-id +++ b/mono/metadata/icall.c.REMOVED.git-id @@ -1 +1 @@ -8e3eaec8515ed4b4c5f2d8327e739f7b954ea8c9 \ No newline at end of file +f12673d460431ee88ea05490d8e88073f9caa651 \ No newline at end of file diff --git a/mono/metadata/image.c b/mono/metadata/image.c index 06993ca652..af671c7cfc 100644 --- a/mono/metadata/image.c +++ b/mono/metadata/image.c @@ -765,9 +765,9 @@ mono_image_load_module_checked (MonoImage *image, int idx, MonoError *error) MonoImage* mono_image_load_module (MonoImage *image, int idx) { - MonoError error; - MonoImage *result = mono_image_load_module_checked (image, idx, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + MonoImage *result = mono_image_load_module_checked (image, idx, error); + mono_error_assert_ok (error); return result; } @@ -1177,6 +1177,17 @@ static const IgnoredAssembly ignored_assemblies [] = { IGNORED_ASSEMBLY (0x9DBB28A2, SYS_NET_HTTP, "903A137B-BB3F-464A-94D4-780B89EE5580", "2.1.0-preview1-62414-02 net471"), IGNORED_ASSEMBLY (0xD00F7419, SYS_THREADING_OVERLAPPED, "3336A2A3-1772-4EF9-A74B-AFDC80A8B21E", "2.1.0-preview1-62414-02 net471"), IGNORED_ASSEMBLY (0x17A113, SYS_RT_INTEROP_RUNTIME_INFO, "D87389D8-6E9C-48CF-B128-3637018577AF", "2.1.0-preview1-62414-02 net47"), + IGNORED_ASSEMBLY (0x1FB3F8E8, SYS_GLOBALIZATION_EXT, "B9BA8638-25D2-4A3B-B91F-16B3D3799861", "2.1.100-preview-62617-01 net461"), + IGNORED_ASSEMBLY (0x6AE7C015, SYS_IO_COMPRESSION, "35DD20B5-8766-476B-B5D2-0EA16EF0A946", "2.1.100-preview-62617-01 net461"), + IGNORED_ASSEMBLY (0x4E906129, SYS_NET_HTTP, "27BBDD4C-EAF0-4A95-B172-EE502D76A725", "2.1.100-preview-62617-01 net461"), + IGNORED_ASSEMBLY (0x765A8E04, SYS_RT_INTEROP_RUNTIME_INFO, "E46BA45E-6A63-47CD-AF70-2C3016AFF75A", "2.1.100-preview-62617-01 net461"), + IGNORED_ASSEMBLY (0x66CEDA9, SYS_THREADING_OVERLAPPED, "A0439CB6-A5E6-4813-A76C-13F92ADDDED5", "2.1.100-preview-62617-01 net461"), + IGNORED_ASSEMBLY (0xD3ABE53A, SYS_RT_INTEROP_RUNTIME_INFO, "488CE209-4E5D-40E7-BE8C-F81F2B99F13A", "2.1.100-preview-62617-01 net462"), + IGNORED_ASSEMBLY (0xE16ECCCD, SYS_GLOBALIZATION_EXT, "1A2B9B2A-02F5-4C78-AB0C-7C6D2795CE2B", "2.1.100-preview-62617-01 net471"), + IGNORED_ASSEMBLY (0xE758DAD4, SYS_IO_COMPRESSION, "8DBD1669-97BC-4190-9BD8-738561193741", "2.1.100-preview-62617-01 net471"), + IGNORED_ASSEMBLY (0xA99E866F, SYS_NET_HTTP, "41ACE450-8F44-455A-97AC-0679E5462071", "2.1.100-preview-62617-01 net471"), + IGNORED_ASSEMBLY (0x8BFCB05D, SYS_THREADING_OVERLAPPED, "82D565AC-E41C-4E29-9939-C031C88EDBDD", "2.1.100-preview-62617-01 net471"), + IGNORED_ASSEMBLY (0xFC67D3A7, SYS_RT_INTEROP_RUNTIME_INFO, "FD6C8616-C1D8-43F9-AC17-A1C48A45FDA2", "2.1.100-preview-62617-01 net47"), IGNORED_ASSEMBLY (0x1136045D, SYS_GLOBALIZATION_EXT, "475DBF02-9F68-44F1-8FB5-C9F69F1BD2B1", "4.0.0 net46"), IGNORED_ASSEMBLY (0x358C9723, SYS_GLOBALIZATION_EXT, "5FCD54F0-4B97-4259-875D-30E481F02EA2", "4.0.1 net46"), IGNORED_ASSEMBLY (0x450A096A, SYS_GLOBALIZATION_EXT, "E9FCFF5B-4DE1-4BDC-9CE8-08C640FC78CC", "4.3.0 net46"), @@ -2531,9 +2542,9 @@ done: MonoImage* mono_image_load_file_for_image (MonoImage *image, int fileidx) { - MonoError error; - MonoImage *result = mono_image_load_file_for_image_checked (image, fileidx, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + MonoImage *result = mono_image_load_file_for_image_checked (image, fileidx, error); + mono_error_assert_ok (error); return result; } diff --git a/mono/metadata/jit-info.c b/mono/metadata/jit-info.c index 3344679e81..76d272ad44 100644 --- a/mono/metadata/jit-info.c +++ b/mono/metadata/jit-info.c @@ -41,8 +41,8 @@ #include #include #include -#include -#include +#include +#include #include static MonoJitInfoFindInAot jit_info_find_in_aot_func = NULL; @@ -88,8 +88,8 @@ mono_jit_info_table_new (MonoDomain *domain) return table; } -void -mono_jit_info_table_free (MonoJitInfoTable *table) +static void +jit_info_table_free (MonoJitInfoTable *table, gboolean duplicate) { int i; int num_chunks = table->num_chunks; @@ -97,15 +97,17 @@ mono_jit_info_table_free (MonoJitInfoTable *table) mono_domain_lock (domain); - table->domain->num_jit_info_tables--; - if (table->domain->num_jit_info_tables <= 1) { - GSList *list; + if (duplicate) { + table->domain->num_jit_info_table_duplicates--; + if (!table->domain->num_jit_info_table_duplicates) { + GSList *list; - for (list = table->domain->jit_info_free_queue; list; list = list->next) - g_free (list->data); + for (list = table->domain->jit_info_free_queue; list; list = list->next) + g_free (list->data); - g_slist_free (table->domain->jit_info_free_queue); - table->domain->jit_info_free_queue = NULL; + g_slist_free (table->domain->jit_info_free_queue); + table->domain->jit_info_free_queue = NULL; + } } /* At this point we assume that there are no other threads @@ -133,6 +135,18 @@ mono_jit_info_table_free (MonoJitInfoTable *table) g_free (table); } +static void +jit_info_table_free_duplicate (MonoJitInfoTable *table) +{ + jit_info_table_free (table, TRUE); +} + +void +mono_jit_info_table_free (MonoJitInfoTable *table) +{ + jit_info_table_free (table, FALSE); +} + /* The jit_info_table is sorted in ascending order by the end * addresses of the compiled methods. The reason why we have to do * this is that once we introduce tombstones, it becomes possible for @@ -604,8 +618,8 @@ jit_info_table_add (MonoDomain *domain, MonoJitInfoTable *volatile *table_ptr, M *table_ptr = new_table; mono_memory_barrier (); - domain->num_jit_info_tables++; - mono_thread_hazardous_try_free (table, (MonoHazardousFreeFunc)mono_jit_info_table_free); + domain->num_jit_info_table_duplicates++; + mono_thread_hazardous_try_free (table, (MonoHazardousFreeFunc)jit_info_table_free_duplicate); table = new_table; goto restart; @@ -682,13 +696,20 @@ mono_jit_info_make_tombstone (MonoJitInfoTableChunk *chunk, MonoJitInfo *ji) static void mono_jit_info_free_or_queue (MonoDomain *domain, MonoJitInfo *ji) { - if (domain->num_jit_info_tables <= 1) { - /* Can it actually happen that we only have one table - but ji is still hazardous? */ + /* + * When we run out of space in a jit info table and we reallocate it, a + * ji structure can be temporary present in multiple tables. If the ji + * structure is freed while another thread is doing a jit lookup and still + * accessing the old table, it might be accessing this jit info (which + * would have been removed and freed only from the new table). The hazard + * pointer doesn't stop this since the jinfo would have been freed before + * we get to set the hazard pointer for ji. Delay the free-ing for when + * there are no jit info table duplicates. + */ + if (!domain->num_jit_info_table_duplicates) mono_thread_hazardous_try_free (ji, g_free); - } else { + else domain->jit_info_free_queue = g_slist_prepend (domain->jit_info_free_queue, ji); - } } static void @@ -761,10 +782,8 @@ mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end) * We reuse MonoJitInfoTable to store AOT module info, * this gives us async-safe lookup. */ - if (!domain->aot_modules) { - domain->num_jit_info_tables ++; + if (!domain->aot_modules) domain->aot_modules = mono_jit_info_table_new (domain); - } ji = g_new0 (MonoJitInfo, 1); ji->d.image = image; diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c index edced98b6d..811ae8a016 100644 --- a/mono/metadata/loader.c +++ b/mono/metadata/loader.c @@ -235,7 +235,7 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass, */ sig_type = (MonoType *)find_cached_memberref_sig (image, cols [MONO_MEMBERREF_SIGNATURE]); if (!sig_type) { - MonoError inner_error; + ERROR_DECL_VALUE (inner_error); sig_type = mono_metadata_parse_type_checked (image, NULL, 0, FALSE, ptr, &ptr, &inner_error); if (sig_type == NULL) { mono_error_set_field_load (error, klass, fname, "Could not parse field '%s' signature %08x due to: %s", fname, token, mono_error_get_message (&inner_error)); @@ -265,9 +265,9 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass, MonoClassField* mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass, MonoGenericContext *context) { - MonoError error; - MonoClassField *res = mono_field_from_token_checked (image, token, retklass, context, &error); - g_assert (mono_error_ok (&error)); + ERROR_DECL (error); + MonoClassField *res = mono_field_from_token_checked (image, token, retklass, context, error); + mono_error_assert_ok (error); return res; } @@ -285,7 +285,7 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk MonoClass *handle_class; *retklass = NULL; - MonoError inner_error; + ERROR_DECL_VALUE (inner_error); result = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, TRUE, &handle_class, context, &inner_error); mono_error_cleanup (&inner_error); // This checks the memberref type as well @@ -318,7 +318,7 @@ mono_field_from_token_checked (MonoImage *image, guint32 token, MonoClass **retk if (retklass) *retklass = k; if (mono_class_has_failure (k)) { - MonoError causedby_error; + ERROR_DECL_VALUE (causedby_error); error_init (&causedby_error); mono_error_set_for_class_failure (&causedby_error, k); mono_error_set_bad_image (error, image, "Could not resolve field token 0x%08x, due to: %s", token, mono_error_get_message (&causedby_error)); @@ -649,9 +649,9 @@ fail: MonoMethodSignature* mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 token, MonoGenericContext *context) { - MonoError error; - MonoMethodSignature *res = mono_method_get_signature_checked (method, image, token, context, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMethodSignature *res = mono_method_get_signature_checked (method, image, token, context, error); + mono_error_cleanup (error); return res; } @@ -751,9 +751,9 @@ mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32 MonoMethodSignature* mono_method_get_signature (MonoMethod *method, MonoImage *image, guint32 token) { - MonoError error; - MonoMethodSignature *res = mono_method_get_signature_checked (method, image, token, NULL, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMethodSignature *res = mono_method_get_signature_checked (method, image, token, NULL, error); + mono_error_cleanup (error); return res; } @@ -1741,9 +1741,9 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass, MonoMethod * mono_get_method (MonoImage *image, guint32 token, MonoClass *klass) { - MonoError error; - MonoMethod *result = mono_get_method_checked (image, token, klass, NULL, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMethod *result = mono_get_method_checked (image, token, klass, NULL, error); + mono_error_cleanup (error); return result; } @@ -1754,9 +1754,9 @@ MonoMethod * mono_get_method_full (MonoImage *image, guint32 token, MonoClass *klass, MonoGenericContext *context) { - MonoError error; - MonoMethod *result = mono_get_method_checked (image, token, klass, context, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMethod *result = mono_get_method_checked (image, token, klass, context, error); + mono_error_cleanup (error); return result; } @@ -1928,9 +1928,9 @@ MonoMethod * mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constrained_class, MonoGenericContext *context, MonoMethod **cil_method) { - MonoError error; - MonoMethod *result = mono_get_method_constrained_checked (image, token, constrained_class, context, cil_method, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMethod *result = mono_get_method_constrained_checked (image, token, constrained_class, context, cil_method, error); + mono_error_cleanup (error); return result; } @@ -2579,15 +2579,15 @@ mono_method_signature_checked (MonoMethod *m, MonoError *error) MonoMethodSignature* mono_method_signature (MonoMethod *m) { - MonoError error; + ERROR_DECL (error); MonoMethodSignature *sig; - sig = mono_method_signature_checked (m, &error); + sig = mono_method_signature_checked (m, error); if (!sig) { char *type_name = mono_type_get_full_name (m->klass); - g_warning ("Could not load signature of %s:%s due to: %s", type_name, m->name, mono_error_get_message (&error)); + g_warning ("Could not load signature of %s:%s due to: %s", type_name, m->name, mono_error_get_message (error)); g_free (type_name); - mono_error_cleanup (&error); + mono_error_cleanup (error); } return sig; @@ -2620,8 +2620,19 @@ mono_method_get_token (MonoMethod *method) return method->token; } +gboolean +mono_method_has_no_body (MonoMethod *method) +{ + return ((method->flags & METHOD_ATTRIBUTE_ABSTRACT) || + (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) || + (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || + (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)); +} + +// FIXME Replace all internal callers of mono_method_get_header_checked with +// mono_method_get_header_internal; the difference is in error initialization. MonoMethodHeader* -mono_method_get_header_checked (MonoMethod *method, MonoError *error) +mono_method_get_header_internal (MonoMethod *method, MonoError *error) { int idx; guint32 rva; @@ -2632,7 +2643,9 @@ mono_method_get_header_checked (MonoMethod *method, MonoError *error) error_init (error); img = method->klass->image; - if ((method->flags & METHOD_ATTRIBUTE_ABSTRACT) || (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) || (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) { + // FIXME: for internal callers maybe it makes sense to do this check at the call site, not + // here? + if (mono_method_has_no_body (method)) { mono_error_set_bad_image (error, img, "Method has no body"); return NULL; } @@ -2689,15 +2702,22 @@ mono_method_get_header_checked (MonoMethod *method, MonoError *error) return mono_metadata_parse_mh_full (img, container, (const char *)loc, error); } +MonoMethodHeader* +mono_method_get_header_checked (MonoMethod *method, MonoError *error) +// Public function that must initialize MonoError for compatibility. +{ + MONO_API_ERROR_INIT (error); + return mono_method_get_header_internal (method, error); +} /** * mono_method_get_header: */ MonoMethodHeader* mono_method_get_header (MonoMethod *method) { - MonoError error; - MonoMethodHeader *header = mono_method_get_header_checked (method, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMethodHeader *header = mono_method_get_header_checked (method, error); + mono_error_cleanup (error); return header; } diff --git a/mono/metadata/locales.c b/mono/metadata/locales.c index 2ef0d21459..e9937a199c 100644 --- a/mono/metadata/locales.c +++ b/mono/metadata/locales.c @@ -177,15 +177,15 @@ create_names_array_idx_dynamic (const guint16 *names, int ml, MonoError *error) MonoBoolean ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData *this_obj, MonoString *name, gint32 calendar_index) { - MonoError error; + ERROR_DECL (error); MonoDomain *domain; const DateTimeFormatEntry *dfe; const CultureInfoNameEntry *ne; const CultureInfoEntry *ci; char *n; - n = mono_string_to_utf8_checked (name, &error); - if (mono_error_set_pending_exception (&error)) + n = mono_string_to_utf8_checked (name, error); + if (mono_error_set_pending_exception (error)) return FALSE; ne = (const CultureInfoNameEntry *)mono_binary_search (n, culture_name_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoNameEntry), culture_name_locator); @@ -199,56 +199,56 @@ ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData domain = mono_domain_get (); - MonoString *native_name = mono_string_new_checked (domain, idx2string (ci->nativename), &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoString *native_name = mono_string_new_checked (domain, idx2string (ci->nativename), error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, NativeName, native_name); MonoArray *short_date_patterns = create_names_array_idx_dynamic (dfe->short_date_patterns, - NUM_SHORT_DATE_PATTERNS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + NUM_SHORT_DATE_PATTERNS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, ShortDatePatterns, short_date_patterns); MonoArray *year_month_patterns =create_names_array_idx_dynamic (dfe->year_month_patterns, - NUM_YEAR_MONTH_PATTERNS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + NUM_YEAR_MONTH_PATTERNS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, YearMonthPatterns, year_month_patterns); MonoArray *long_date_patterns = create_names_array_idx_dynamic (dfe->long_date_patterns, - NUM_LONG_DATE_PATTERNS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + NUM_LONG_DATE_PATTERNS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, LongDatePatterns, long_date_patterns); - MonoString *month_day_pattern = mono_string_new_checked (domain, pattern2string (dfe->month_day_pattern), &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoString *month_day_pattern = mono_string_new_checked (domain, pattern2string (dfe->month_day_pattern), error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, MonthDayPattern, month_day_pattern); - MonoArray *day_names = create_names_array_idx (dfe->day_names, NUM_DAYS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoArray *day_names = create_names_array_idx (dfe->day_names, NUM_DAYS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, DayNames, day_names); MonoArray *abbr_day_names = create_names_array_idx (dfe->abbreviated_day_names, - NUM_DAYS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + NUM_DAYS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, AbbreviatedDayNames, abbr_day_names); - MonoArray *ss_day_names = create_names_array_idx (dfe->shortest_day_names, NUM_DAYS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoArray *ss_day_names = create_names_array_idx (dfe->shortest_day_names, NUM_DAYS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, SuperShortDayNames, ss_day_names); - MonoArray *month_names = create_names_array_idx (dfe->month_names, NUM_MONTHS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoArray *month_names = create_names_array_idx (dfe->month_names, NUM_MONTHS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, MonthNames, month_names); MonoArray *abbr_mon_names = create_names_array_idx (dfe->abbreviated_month_names, - NUM_MONTHS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + NUM_MONTHS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, AbbreviatedMonthNames, abbr_mon_names); - MonoArray *gen_month_names = create_names_array_idx (dfe->month_genitive_names, NUM_MONTHS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoArray *gen_month_names = create_names_array_idx (dfe->month_genitive_names, NUM_MONTHS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, GenitiveMonthNames, gen_month_names); - MonoArray *gen_abbr_mon_names = create_names_array_idx (dfe->abbreviated_month_genitive_names, NUM_MONTHS, &error); - return_val_and_set_pending_if_nok (&error, FALSE); + MonoArray *gen_abbr_mon_names = create_names_array_idx (dfe->abbreviated_month_genitive_names, NUM_MONTHS, error); + return_val_and_set_pending_if_nok (error, FALSE); MONO_OBJECT_SETREF (this_obj, GenitiveAbbreviatedMonthNames, gen_abbr_mon_names); return TRUE; @@ -257,7 +257,7 @@ ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData void ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *this_obj, gint32 datetime_index) { - MonoError error; + ERROR_DECL (error); MonoDomain *domain; const DateTimeFormatEntry *dfe; @@ -274,20 +274,20 @@ ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *t MONO_OBJECT_SETREF((obj), field, _tmp_str); \ } while (0) - SET_STR (this_obj, AMDesignator, domain, idx2string (dfe->am_designator), &error); - SET_STR (this_obj, PMDesignator, domain, idx2string (dfe->pm_designator), &error); - SET_STR (this_obj, TimeSeparator, domain, idx2string (dfe->time_separator), &error); + SET_STR (this_obj, AMDesignator, domain, idx2string (dfe->am_designator), error); + SET_STR (this_obj, PMDesignator, domain, idx2string (dfe->pm_designator), error); + SET_STR (this_obj, TimeSeparator, domain, idx2string (dfe->time_separator), error); #undef SET_STR MonoArray *long_time_patterns = create_names_array_idx_dynamic (dfe->long_time_patterns, - NUM_LONG_TIME_PATTERNS, &error); - if (mono_error_set_pending_exception (&error)) + NUM_LONG_TIME_PATTERNS, error); + if (mono_error_set_pending_exception (error)) return; MONO_OBJECT_SETREF (this_obj, LongTimePatterns, long_time_patterns); MonoArray *short_time_patterns = create_names_array_idx_dynamic (dfe->short_time_patterns, - NUM_SHORT_TIME_PATTERNS, &error); - if (mono_error_set_pending_exception (&error)) + NUM_SHORT_TIME_PATTERNS, error); + if (mono_error_set_pending_exception (error)) return; MONO_OBJECT_SETREF (this_obj, ShortTimePatterns, short_time_patterns); this_obj->FirstDayOfWeek = dfe->first_day_of_week; @@ -297,7 +297,7 @@ ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *t void ves_icall_System_Globalization_CultureData_fill_number_data (MonoNumberFormatInfo* number, gint32 number_index) { - MonoError error; + ERROR_DECL (error); MonoDomain *domain; const NumberFormatEntry *nfe; @@ -316,36 +316,36 @@ ves_icall_System_Globalization_CultureData_fill_number_data (MonoNumberFormatInf MONO_OBJECT_SETREF((obj), field, _tmp_str); \ } while (0) - SET_STR (number, currencyDecimalSeparator, domain, idx2string (nfe->currency_decimal_separator), &error); - SET_STR (number, currencyGroupSeparator, domain, idx2string (nfe->currency_group_separator), &error); + SET_STR (number, currencyDecimalSeparator, domain, idx2string (nfe->currency_decimal_separator), error); + SET_STR (number, currencyGroupSeparator, domain, idx2string (nfe->currency_group_separator), error); MonoArray *currency_sizes_arr = create_group_sizes_array (nfe->currency_group_sizes, - GROUP_SIZE, &error); - if (mono_error_set_pending_exception (&error)) + GROUP_SIZE, error); + if (mono_error_set_pending_exception (error)) return; MONO_OBJECT_SETREF (number, currencyGroupSizes, currency_sizes_arr); number->currencyNegativePattern = nfe->currency_negative_pattern; number->currencyPositivePattern = nfe->currency_positive_pattern; - SET_STR (number, currencySymbol, domain, idx2string (nfe->currency_symbol), &error); - SET_STR (number, naNSymbol, domain, idx2string (nfe->nan_symbol), &error); - SET_STR (number, negativeInfinitySymbol, domain, idx2string (nfe->negative_infinity_symbol), &error); - SET_STR (number, negativeSign, domain, idx2string (nfe->negative_sign), &error); + SET_STR (number, currencySymbol, domain, idx2string (nfe->currency_symbol), error); + SET_STR (number, naNSymbol, domain, idx2string (nfe->nan_symbol), error); + SET_STR (number, negativeInfinitySymbol, domain, idx2string (nfe->negative_infinity_symbol), error); + SET_STR (number, negativeSign, domain, idx2string (nfe->negative_sign), error); number->numberDecimalDigits = nfe->number_decimal_digits; - SET_STR (number, numberDecimalSeparator, domain, idx2string (nfe->number_decimal_separator), &error); - SET_STR (number, numberGroupSeparator, domain, idx2string (nfe->number_group_separator), &error); + SET_STR (number, numberDecimalSeparator, domain, idx2string (nfe->number_decimal_separator), error); + SET_STR (number, numberGroupSeparator, domain, idx2string (nfe->number_group_separator), error); MonoArray *number_sizes_arr = create_group_sizes_array (nfe->number_group_sizes, - GROUP_SIZE, &error); - if (mono_error_set_pending_exception (&error)) + GROUP_SIZE, error); + if (mono_error_set_pending_exception (error)) return; MONO_OBJECT_SETREF (number, numberGroupSizes, number_sizes_arr); number->numberNegativePattern = nfe->number_negative_pattern; number->percentNegativePattern = nfe->percent_negative_pattern; number->percentPositivePattern = nfe->percent_positive_pattern; - SET_STR (number, percentSymbol, domain, idx2string (nfe->percent_symbol), &error); - SET_STR (number, perMilleSymbol, domain, idx2string (nfe->per_mille_symbol), &error); - SET_STR (number, positiveInfinitySymbol, domain, idx2string (nfe->positive_infinity_symbol), &error); - SET_STR (number, positiveSign, domain, idx2string (nfe->positive_sign), &error); + SET_STR (number, percentSymbol, domain, idx2string (nfe->percent_symbol), error); + SET_STR (number, perMilleSymbol, domain, idx2string (nfe->per_mille_symbol), error); + SET_STR (number, positiveInfinitySymbol, domain, idx2string (nfe->positive_infinity_symbol), error); + SET_STR (number, positiveSign, domain, idx2string (nfe->positive_sign), error); #undef SET_STR } @@ -606,15 +606,15 @@ MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_lcid (MonoCultureInfo *this_obj, gint lcid) { - MonoError error; + ERROR_DECL (error); const CultureInfoEntry *ci; ci = culture_info_entry_from_lcid (lcid); if(ci == NULL) return FALSE; - if (!construct_culture (this_obj, ci, &error)) { - mono_error_set_pending_exception (&error); + if (!construct_culture (this_obj, ci, error)) { + mono_error_set_pending_exception (error); return FALSE; } return TRUE; @@ -624,12 +624,12 @@ MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (MonoCultureInfo *this_obj, MonoString *name) { - MonoError error; + ERROR_DECL (error); const CultureInfoNameEntry *ne; char *n; - n = mono_string_to_utf8_checked (name, &error); - if (mono_error_set_pending_exception (&error)) + n = mono_string_to_utf8_checked (name, error); + if (mono_error_set_pending_exception (error)) return FALSE; ne = (const CultureInfoNameEntry *)mono_binary_search (n, culture_name_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoNameEntry), culture_name_locator); @@ -641,8 +641,8 @@ ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name ( } g_free (n); - if (!construct_culture (this_obj, &culture_entries [ne->culture_entry_index], &error)) { - mono_error_set_pending_exception (&error); + if (!construct_culture (this_obj, &culture_entries [ne->culture_entry_index], error)) { + mono_error_set_pending_exception (error); return FALSE; } return TRUE; @@ -666,15 +666,15 @@ MonoBoolean ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_lcid (MonoRegionInfo *this_obj, gint lcid) { - MonoError error; + ERROR_DECL (error); const RegionInfoEntry *ri; ri = region_info_entry_from_lcid (lcid); if(ri == NULL) return FALSE; - MonoBoolean result = construct_region (this_obj, ri, &error); - mono_error_set_pending_exception (&error); + MonoBoolean result = construct_region (this_obj, ri, error); + mono_error_set_pending_exception (error); return result; } @@ -682,12 +682,12 @@ MonoBoolean ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_name (MonoRegionInfo *this_obj, MonoString *name) { - MonoError error; + ERROR_DECL (error); const RegionInfoNameEntry *ne; char *n; - n = mono_string_to_utf8_checked (name, &error); - if (mono_error_set_pending_exception (&error)) + n = mono_string_to_utf8_checked (name, error); + if (mono_error_set_pending_exception (error)) return FALSE; ne = (const RegionInfoNameEntry *)mono_binary_search (n, region_name_entries, NUM_REGION_ENTRIES, sizeof (RegionInfoNameEntry), region_name_locator); @@ -699,8 +699,8 @@ ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_name (M } g_free (n); - MonoBoolean result = construct_region (this_obj, ®ion_entries [ne->region_entry_index], &error); - mono_error_set_pending_exception (&error); + MonoBoolean result = construct_region (this_obj, ®ion_entries [ne->region_entry_index], error); + mono_error_set_pending_exception (error); return result; } @@ -708,7 +708,7 @@ MonoArray* ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean neutral, MonoBoolean specific, MonoBoolean installed) { - MonoError error; + ERROR_DECL (error); MonoArray *ret; MonoClass *klass; MonoCultureInfo *culture; @@ -734,8 +734,8 @@ ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean ne if (neutral) len++; - ret = mono_array_new_checked (domain, klass, len, &error); - goto_if_nok (&error, fail); + ret = mono_array_new_checked (domain, klass, len, error); + goto_if_nok (error, fail); if (len == 0) return ret; @@ -748,11 +748,11 @@ ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean ne ci = &culture_entries [i]; is_neutral = ci->territory == 0; if ((neutral && is_neutral) || (specific && !is_neutral)) { - culture = (MonoCultureInfo *) mono_object_new_checked (domain, klass, &error); - goto_if_nok (&error, fail); - mono_runtime_object_init_checked ((MonoObject *) culture, &error); - goto_if_nok (&error, fail); - if (!construct_culture (culture, ci, &error)) + culture = (MonoCultureInfo *) mono_object_new_checked (domain, klass, error); + goto_if_nok (error, fail); + mono_runtime_object_init_checked ((MonoObject *) culture, error); + goto_if_nok (error, fail); + if (!construct_culture (culture, ci, error)) goto fail; culture->use_user_override = TRUE; mono_array_setref (ret, len++, culture); @@ -762,7 +762,7 @@ ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean ne return ret; fail: - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return ret; } @@ -777,15 +777,15 @@ int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this_obj, MonoSortKey *key, MonoString *source, gint32 options) { - MonoError error; + ERROR_DECL (error); MonoArray *arr; gint32 keylen, i; keylen=mono_string_length (source); arr=mono_array_new_checked (mono_domain_get (), mono_get_byte_class (), - keylen, &error); - if (mono_error_set_pending_exception (&error)) + keylen, error); + if (mono_error_set_pending_exception (error)) return; for(i=0; ilength, NULL, &len, &error); - if (error) { - MonoException *exc = mono_get_exception_argument ("string", error->message); - g_error_free (error); + tmp = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, &len, &gerror); + if (gerror) { + MonoException *exc = mono_get_exception_argument ("string", gerror->message); + g_error_free (gerror); mono_set_pending_exception (exc); return NULL; } else { diff --git a/mono/metadata/marshal.c.REMOVED.git-id b/mono/metadata/marshal.c.REMOVED.git-id index f6f8b36cbe..808c19a196 100644 --- a/mono/metadata/marshal.c.REMOVED.git-id +++ b/mono/metadata/marshal.c.REMOVED.git-id @@ -1 +1 @@ -0d047053f50bcd47329e1a9c59334c300f23f2c2 \ No newline at end of file +22678e56be344e2fbbf617928164c2acae66abb4 \ No newline at end of file diff --git a/mono/metadata/marshal.h b/mono/metadata/marshal.h index 12f224d2de..56b9ba5663 100644 --- a/mono/metadata/marshal.h +++ b/mono/metadata/marshal.h @@ -247,6 +247,68 @@ typedef struct { } d; } WrapperInfo; +enum { + STELEMREF_OBJECT, /*no check at all*/ + STELEMREF_SEALED_CLASS, /*check vtable->klass->element_type */ + STELEMREF_CLASS, /*only the klass->parents check*/ + STELEMREF_CLASS_SMALL_IDEPTH, /* like STELEMREF_CLASS bit without the idepth check */ + STELEMREF_INTERFACE, /*interfaces without variant generic arguments. */ + STELEMREF_COMPLEX, /*arrays, MBR or types with variant generic args - go straight to icalls*/ + STELEMREF_KIND_COUNT +}; + +static const char *strelemref_wrapper_name[] = { + "object", "sealed_class", "class", "class_small_idepth", "interface", "complex" +}; + + +#define MONO_MARSHAL_CALLBACKS_VERSION 1 + +typedef struct { + int version; + int (*emit_marshal_array) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_boolean) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_ptr) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_char) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_scalar) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + + int (*emit_marshal_custom) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_asany) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_vtype) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_string) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_safehandle) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_handleref) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_object) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + int (*emit_marshal_variant) (EmitMarshalContext *m, int argnum, MonoType *t, MonoMarshalSpec *spec, int conv_arg, MonoType **conv_arg_type, MarshalAction action); + void (*emit_castclass) (MonoMethodBuilder *mb); + void (*emit_struct_to_ptr) (MonoMethodBuilder *mb, MonoClass *klass); + void (*emit_ptr_to_struct) (MonoMethodBuilder *mb, MonoClass *klass); + void (*emit_isinst) (MonoMethodBuilder *mb); + void (*emit_virtual_stelemref) (MonoMethodBuilder *mb, const char **param_names, int kind); + void (*emit_stelemref) (MonoMethodBuilder *mb); + void (*emit_array_address) (MonoMethodBuilder *mb, int rank, int elem_size); + void (*emit_native_wrapper) (MonoImage *image, MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func, gboolean aot, gboolean check_exceptions, gboolean func_param); + void (*emit_managed_wrapper) (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle); + void (*emit_runtime_invoke_body) (MonoMethodBuilder *mb, const char **param_names, MonoImage *image, MonoMethod *method, MonoMethodSignature *sig, MonoMethodSignature *callsig, gboolean virtual_, gboolean need_direct_wrapper); + void (*emit_runtime_invoke_dynamic) (MonoMethodBuilder *mb); + void (*emit_delegate_begin_invoke) (MonoMethodBuilder *mb, MonoMethodSignature *sig); + void (*emit_delegate_end_invoke) (MonoMethodBuilder *mb, MonoMethodSignature *sig); + void (*emit_delegate_invoke_internal) (MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethodSignature *invoke_sig, gboolean static_method_with_first_arg_bound, gboolean callvirt, gboolean closed_over_null, MonoMethod *method, MonoMethod *target_method, MonoClass *target_class, MonoGenericContext *ctx, MonoGenericContainer *container); + void (*emit_synchronized_wrapper) (MonoMethodBuilder *mb, MonoMethod *method, MonoGenericContext *ctx, MonoGenericContainer *container, MonoMethod *enter_method, MonoMethod *exit_method, MonoMethod *gettypefromhandle_method); + void (*emit_unbox_wrapper) (MonoMethodBuilder *mb, MonoMethod *method); + void (*emit_array_accessor_wrapper) (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *sig, MonoGenericContext *ctx); + void (*emit_generic_array_helper) (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *csig); + void (*emit_thunk_invoke_wrapper) (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *csig); + void (*emit_create_string_hack) (MonoMethodBuilder *mb, MonoMethodSignature *csig, MonoMethod *res); + void (*emit_native_icall_wrapper) (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *csig, gboolean check_exceptions, gboolean aot, MonoMethodPInvoke *pinfo); + void (*emit_icall_wrapper) (MonoMethodBuilder *mb, MonoMethodSignature *sig, gconstpointer func, MonoMethodSignature *csig2, gboolean check_exceptions); + void (*emit_vtfixup_ftnptr) (MonoMethodBuilder *mb, MonoMethod *method, int param_count, guint16 type); + void (*mb_skip_visibility) (MonoMethodBuilder *mb); + void (*mb_set_dynamic) (MonoMethodBuilder *mb); + void (*mb_emit_exception) (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg); + void (*mb_emit_byte) (MonoMethodBuilder *mb, guint8 op); +} MonoMarshalCallbacks; + G_BEGIN_DECLS /*type of the function pointer of methods returned by mono_marshal_get_runtime_invoke*/ @@ -254,6 +316,9 @@ typedef MonoObject *(*RuntimeInvokeFunction) (MonoObject *this_obj, void **param typedef void (*RuntimeInvokeDynamicFunction) (void *args, MonoObject **exc, void* compiled_method); +void +mono_install_marshal_callbacks (MonoMarshalCallbacks *cb); + /* marshaling helper functions */ void @@ -289,6 +354,18 @@ mono_string_to_bstr(MonoString* str); void mono_delegate_free_ftnptr (MonoDelegate *delegate); +gpointer +mono_marshal_asany (MonoObject *obj, MonoMarshalNative string_encoding, int param_attrs); + +void +mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_encoding, int param_attrs); + +void +mono_free_lparray (MonoArray *array, gpointer* nativeArray); + +void +mono_marshal_ftnptr_eh_callback (guint32 gchandle); + void mono_marshal_set_last_error (void); @@ -298,6 +375,15 @@ mono_type_to_ldind (MonoType *type); guint mono_type_to_stind (MonoType *type); +void +mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum); + +MonoString * +mono_string_from_byvalstr (const char *data, int len); + +MonoString * +mono_string_from_byvalwstr (gunichar2 *data, int len); + /* functions to create various architecture independent helper functions */ MonoMethod * @@ -431,6 +517,136 @@ mono_marshal_free_ccw (MonoObject* obj); void cominterop_release_all_rcws (void); +MonoString* +ves_icall_mono_string_from_utf16 (gunichar2 *data); + +char* +ves_icall_mono_string_to_utf8 (MonoString *str); + +void * +mono_marshal_string_to_utf16_copy (MonoString *s); + +MonoString* +mono_string_new_len_wrapper (const char *text, guint length); + +MonoDelegate* +mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn); + +MONO_API void * +mono_marshal_string_to_utf16 (MonoString *s); + +#ifndef HOST_WIN32 +gpointer +mono_string_to_utf8str (MonoString *string_obj); +#endif + +MonoStringBuilder * +mono_string_utf8_to_builder2 (char *text); + +MonoStringBuilder * +mono_string_utf16_to_builder2 (gunichar2 *text); + +gchar* +mono_string_builder_to_utf8 (MonoStringBuilder *sb); + +gunichar2* +mono_string_builder_to_utf16 (MonoStringBuilder *sb); + +void +mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text); + +void +mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text); + +void +mono_string_to_byvalstr (gpointer dst, MonoString *src, int size); + +void +mono_string_to_byvalwstr (gpointer dst, MonoString *src, int size); + +gpointer +mono_delegate_to_ftnptr (MonoDelegate *delegate); + +gpointer +mono_array_to_savearray (MonoArray *array); + +void +mono_free_lparray (MonoArray *array, gpointer* nativeArray); + +void +mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum); + +gpointer +mono_array_to_lparray (MonoArray *array); + +void +mono_marshal_set_last_error_windows (int error); + +void +mono_struct_delete_old (MonoClass *klass, char *ptr); + +MonoObject* +mono_object_isinst_icall (MonoObject *obj, MonoClass *klass); + +MonoString* +ves_icall_string_new_wrapper (const char *text); + +int +mono_emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t, + MonoMarshalSpec *spec, int conv_arg, + MonoType **conv_arg_type, MarshalAction action); + +MonoObject * +mono_marshal_isinst_with_cache (MonoObject *obj, MonoClass *klass, uintptr_t *cache); + +MonoAsyncResult * +mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params); + +MonoObject * +mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params); + +MonoMarshalNative +mono_marshal_get_string_encoding (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec); + +MonoMarshalConv +mono_marshal_get_string_to_ptr_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec); + +MonoMarshalConv +mono_marshal_get_stringbuilder_to_ptr_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec); + +MonoMarshalConv +mono_marshal_get_ptr_to_stringbuilder_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec, gboolean *need_free); + +MonoMarshalConv +mono_marshal_get_ptr_to_string_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec, gboolean *need_free); + +MonoType* +marshal_boolean_conv_in_get_local_type (MonoMarshalSpec *spec, guint8 *ldc_op /*out*/); + +MonoClass* +marshal_boolean_managed_conv_in_get_conv_arg_class (MonoMarshalSpec *spec, guint8 *ldop/*out*/); + +gboolean +mono_pinvoke_is_unicode (MonoMethodPInvoke *piinfo); + +gboolean +mono_marshal_need_free (MonoType *t, MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec); + +MonoThreadInfo* +mono_icall_start (HandleStackMark *stackmark, MonoError *error); + +void +mono_icall_end (MonoThreadInfo *info, HandleStackMark *stackmark, MonoError *error); + +MonoObjectHandle +mono_icall_handle_new (gpointer rawobj); + +MonoObjectHandle +mono_icall_handle_new_interior (gpointer rawobj); + +void* +ves_icall_marshal_alloc (gsize size); + void ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index, gpointer dest, gint32 length); diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index e849706e19..cd657d7441 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -51,11 +51,6 @@ struct _MonoType { #define MONO_PROCESSOR_ARCHITECTURE_AMD64 4 #define MONO_PROCESSOR_ARCHITECTURE_ARM 5 -#if !defined(DISABLE_JIT) || !defined(DISABLE_INTERPRETER) -/* Some VES is available at runtime */ -#define ENABLE_ILGEN -#endif - struct _MonoAssemblyName { const char *name; const char *culture; @@ -581,8 +576,11 @@ struct _MonoMethodHeader { }; typedef struct { + const unsigned char *code; guint32 code_size; + guint16 max_stack; gboolean has_clauses; + gboolean has_locals; } MonoMethodHeaderSummary; #define MONO_SIZEOF_METHOD_HEADER (sizeof (struct _MonoMethodHeader) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P) @@ -964,5 +962,8 @@ mono_loader_get_strict_strong_names (void); char* mono_signature_get_managed_fmt_string (MonoMethodSignature *sig); +gboolean +mono_type_in_image (MonoType *type, MonoImage *image); + #endif /* __MONO_METADATA_INTERNALS_H__ */ diff --git a/mono/metadata/metadata-verify.c.REMOVED.git-id b/mono/metadata/metadata-verify.c.REMOVED.git-id index b7ba43e80d..df7685374e 100644 --- a/mono/metadata/metadata-verify.c.REMOVED.git-id +++ b/mono/metadata/metadata-verify.c.REMOVED.git-id @@ -1 +1 @@ -94ecae8b9414033e412f7a34b391a63ecb3070d5 \ No newline at end of file +b67ba57936ed2679c070422c049e1941c157e356 \ No newline at end of file diff --git a/mono/metadata/metadata.c.REMOVED.git-id b/mono/metadata/metadata.c.REMOVED.git-id index 0597ac7d9f..6b2eba77df 100644 --- a/mono/metadata/metadata.c.REMOVED.git-id +++ b/mono/metadata/metadata.c.REMOVED.git-id @@ -1 +1 @@ -2fe50b93c77be1aae1f8ad3484eadb99512633b2 \ No newline at end of file +1b63db3224cc82da59241df8f6c0aaa4288472e4 \ No newline at end of file diff --git a/mono/metadata/metadata.h b/mono/metadata/metadata.h index 874852c9b0..6f7131303c 100644 --- a/mono/metadata/metadata.h +++ b/mono/metadata/metadata.h @@ -237,6 +237,7 @@ 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 uint32_t mono_metadata_events_from_typedef (MonoImage *meta, uint32_t table_index, unsigned int *end_idx); @@ -413,6 +414,7 @@ MONO_API 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, uint32_t type_spec); MONO_API void mono_metadata_free_type (MonoType *type); @@ -435,6 +437,7 @@ MONO_RT_EXTERNAL_ONLY MONO_API MonoMethodSignature *mono_metadata_parse_signature (MonoImage *image, uint32_t token); +MONO_RT_EXTERNAL_ONLY MONO_API MonoMethodSignature *mono_metadata_parse_method_signature (MonoImage *m, int def, const char *ptr, diff --git a/mono/metadata/method-builder-ilgen-internals.h b/mono/metadata/method-builder-ilgen-internals.h new file mode 100644 index 0000000000..86c4b01f22 --- /dev/null +++ b/mono/metadata/method-builder-ilgen-internals.h @@ -0,0 +1,33 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_METHOD_BUILDER_ILGEN_INTERNALS_H__ +#define __MONO_METHOD_BUILDER_ILGEN_INTERNALS_H__ + +#include "config.h" +#include +#include +#include +#include +#include +#include + +/* ilgen version */ +struct _MonoMethodBuilder { + MonoMethod *method; + char *name; + gboolean no_dup_name; + GList *locals_list; + int locals; + gboolean dynamic; + gboolean skip_visibility, init_locals; + guint32 code_size, pos; + unsigned char *code; + int num_clauses; + MonoExceptionClause *clauses; + const char **param_names; +}; + +#endif diff --git a/mono/metadata/method-builder-ilgen.c b/mono/metadata/method-builder-ilgen.c new file mode 100644 index 0000000000..457845e3f6 --- /dev/null +++ b/mono/metadata/method-builder-ilgen.c @@ -0,0 +1,619 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#include "config.h" +#include "loader.h" +#include "mono/metadata/abi-details.h" +#include "mono/metadata/method-builder.h" +#include "mono/metadata/method-builder-ilgen.h" +#include "mono/metadata/method-builder-ilgen-internals.h" +#include "mono/metadata/tabledefs.h" +#include "mono/metadata/exception.h" +#include "mono/metadata/appdomain.h" +#include "mono/metadata/debug-helpers.h" +#include "mono/metadata/metadata-internals.h" +#include "mono/metadata/domain-internals.h" +#include +#include + +#define OPDEF(a,b,c,d,e,f,g,h,i,j) \ + a = i, + +enum { +#include "mono/cil/opcode.def" + LAST = 0xff +}; +#undef OPDEF + +static MonoMethodBuilder * +new_base_ilgen (MonoClass *klass, MonoWrapperType type) +{ + MonoMethodBuilder *mb; + MonoMethod *m; + + g_assert (klass != NULL); + + mb = g_new0 (MonoMethodBuilder, 1); + + mb->method = m = (MonoMethod *)g_new0 (MonoMethodWrapper, 1); + + m->klass = klass; + m->inline_info = 1; + m->wrapper_type = type; + + mb->code_size = 40; + mb->code = (unsigned char *)g_malloc (mb->code_size); + mb->init_locals = TRUE; + + /* placeholder for the wrapper always at index 1 */ + mono_mb_add_data (mb, NULL); + + return mb; +} + +static void +free_ilgen (MonoMethodBuilder *mb) +{ + GList *l; + + for (l = mb->locals_list; l; l = l->next) { + /* Allocated in mono_mb_add_local () */ + g_free (l->data); + } + g_list_free (mb->locals_list); + if (!mb->dynamic) { + g_free (mb->method); + if (!mb->no_dup_name) + g_free (mb->name); + g_free (mb->code); + } + g_free (mb); +} + +static MonoMethod * +create_method_ilgen (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack) +{ + MonoMethodHeader *header; + MonoMethodWrapper *mw; + MonoImage *image; + MonoMethod *method; + GList *l; + int i; + + g_assert (mb != NULL); + + image = mb->method->klass->image; + + if (mb->dynamic) { + method = mb->method; + mw = (MonoMethodWrapper*)method; + + method->name = mb->name; + method->dynamic = TRUE; + + mw->header = header = (MonoMethodHeader *) + g_malloc0 (MONO_SIZEOF_METHOD_HEADER + mb->locals * sizeof (MonoType *)); + + header->code = mb->code; + + for (i = 0, l = mb->locals_list; l; l = l->next, i++) { + header->locals [i] = (MonoType*)l->data; + } + } else + { + /* Realloc the method info into a mempool */ + + method = (MonoMethod *)mono_image_alloc0 (image, sizeof (MonoMethodWrapper)); + memcpy (method, mb->method, sizeof (MonoMethodWrapper)); + mw = (MonoMethodWrapper*) method; + + if (mb->no_dup_name) + method->name = mb->name; + else + method->name = mono_image_strdup (image, mb->name); + + mw->header = header = (MonoMethodHeader *) + mono_image_alloc0 (image, MONO_SIZEOF_METHOD_HEADER + mb->locals * sizeof (MonoType *)); + + header->code = (const unsigned char *)mono_image_alloc (image, mb->pos); + memcpy ((char*)header->code, mb->code, mb->pos); + + for (i = 0, l = mb->locals_list; l; l = l->next, i++) { + header->locals [i] = (MonoType*)l->data; + } + } + + /* Free the locals list so mono_mb_free () doesn't free the types twice */ + g_list_free (mb->locals_list); + mb->locals_list = NULL; + + method->signature = signature; + if (!signature->hasthis) + method->flags |= METHOD_ATTRIBUTE_STATIC; + + if (max_stack < 8) + max_stack = 8; + + header->max_stack = max_stack; + + header->code_size = mb->pos; + header->num_locals = mb->locals; + header->init_locals = mb->init_locals; + + header->num_clauses = mb->num_clauses; + header->clauses = mb->clauses; + + method->skip_visibility = mb->skip_visibility; + + i = g_list_length ((GList *)mw->method_data); + if (i) { + GList *tmp; + void **data; + l = g_list_reverse ((GList *)mw->method_data); + if (method_is_dynamic (method)) + data = (void **)g_malloc (sizeof (gpointer) * (i + 1)); + else + data = (void **)mono_image_alloc (image, sizeof (gpointer) * (i + 1)); + /* store the size in the first element */ + data [0] = GUINT_TO_POINTER (i); + i = 1; + for (tmp = l; tmp; tmp = tmp->next) { + data [i++] = tmp->data; + } + g_list_free (l); + + mw->method_data = data; + } + + /*{ + static int total_code = 0; + static int total_alloc = 0; + total_code += mb->pos; + total_alloc += mb->code_size; + g_print ("code size: %d of %d (allocated: %d)\n", mb->pos, total_code, total_alloc); + }*/ + +#ifdef DEBUG_RUNTIME_CODE + printf ("RUNTIME CODE FOR %s\n", mono_method_full_name (method, TRUE)); + printf ("%s\n", mono_disasm_code (&marshal_dh, method, mb->code, mb->code + mb->pos)); +#endif + + if (mb->param_names) { + char **param_names = (char **)mono_image_alloc0 (image, signature->param_count * sizeof (gpointer)); + for (i = 0; i < signature->param_count; ++i) + param_names [i] = mono_image_strdup (image, mb->param_names [i]); + + mono_image_lock (image); + if (!image->wrapper_param_names) + image->wrapper_param_names = g_hash_table_new (NULL, NULL); + g_hash_table_insert (image->wrapper_param_names, method, param_names); + mono_image_unlock (image); + } + + return method; +} + +void +mono_method_builder_ilgen_init (void) +{ + MonoMethodBuilderCallbacks cb; + cb.version = MONO_METHOD_BUILDER_CALLBACKS_VERSION; + cb.new_base = new_base_ilgen; + cb.free = free_ilgen; + cb.create_method = create_method_ilgen; + mono_install_method_builder_callbacks (&cb); +} + +/** + * mono_mb_add_local: + */ +int +mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type) +{ + int res; + MonoType *t; + + /* + * Have to make a copy early since type might be sig->ret, + * which is transient, see mono_metadata_signature_dup_internal_with_padding (). + */ + t = mono_metadata_type_dup (NULL, type); + + g_assert (mb != NULL); + g_assert (type != NULL); + + res = mb->locals; + mb->locals_list = g_list_append (mb->locals_list, t); + mb->locals++; + + return res; +} + +/** + * mono_mb_patch_addr: + */ +void +mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value) +{ + mb->code [pos] = value & 0xff; + mb->code [pos + 1] = (value >> 8) & 0xff; + mb->code [pos + 2] = (value >> 16) & 0xff; + mb->code [pos + 3] = (value >> 24) & 0xff; +} + +/** + * mono_mb_patch_addr_s: + */ +void +mono_mb_patch_addr_s (MonoMethodBuilder *mb, int pos, gint8 value) +{ + *((gint8 *)(&mb->code [pos])) = value; +} + +/** + * mono_mb_emit_byte: + */ +void +mono_mb_emit_byte (MonoMethodBuilder *mb, guint8 op) +{ + if (mb->pos >= mb->code_size) { + mb->code_size += mb->code_size >> 1; + mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); + } + + mb->code [mb->pos++] = op; +} + +/** + * mono_mb_emit_ldflda: + */ +void +mono_mb_emit_ldflda (MonoMethodBuilder *mb, gint32 offset) +{ + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_OBJADDR); + + if (offset) { + mono_mb_emit_icon (mb, offset); + mono_mb_emit_byte (mb, CEE_ADD); + } +} + +/** + * mono_mb_emit_i4: + */ +void +mono_mb_emit_i4 (MonoMethodBuilder *mb, gint32 data) +{ + if ((mb->pos + 4) >= mb->code_size) { + mb->code_size += mb->code_size >> 1; + mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); + } + + mono_mb_patch_addr (mb, mb->pos, data); + mb->pos += 4; +} + +void +mono_mb_emit_i8 (MonoMethodBuilder *mb, gint64 data) +{ + if ((mb->pos + 8) >= mb->code_size) { + mb->code_size += mb->code_size >> 1; + mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); + } + + mono_mb_patch_addr (mb, mb->pos, data); + mono_mb_patch_addr (mb, mb->pos + 4, data >> 32); + mb->pos += 8; +} + +/** + * mono_mb_emit_i2: + */ +void +mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data) +{ + if ((mb->pos + 2) >= mb->code_size) { + mb->code_size += mb->code_size >> 1; + mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); + } + + mb->code [mb->pos] = data & 0xff; + mb->code [mb->pos + 1] = (data >> 8) & 0xff; + mb->pos += 2; +} + +void +mono_mb_emit_op (MonoMethodBuilder *mb, guint8 op, gpointer data) +{ + mono_mb_emit_byte (mb, op); + mono_mb_emit_i4 (mb, mono_mb_add_data (mb, data)); +} + +/** + * mono_mb_emit_ldstr: + */ +void +mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str) +{ + mono_mb_emit_op (mb, CEE_LDSTR, str); +} + +/** + * mono_mb_emit_ldarg: + */ +void +mono_mb_emit_ldarg (MonoMethodBuilder *mb, guint argnum) +{ + if (argnum < 4) { + mono_mb_emit_byte (mb, CEE_LDARG_0 + argnum); + } else if (argnum < 256) { + mono_mb_emit_byte (mb, CEE_LDARG_S); + mono_mb_emit_byte (mb, argnum); + } else { + mono_mb_emit_byte (mb, CEE_PREFIX1); + mono_mb_emit_byte (mb, CEE_LDARG); + mono_mb_emit_i2 (mb, argnum); + } +} + +/** + * mono_mb_emit_ldarg_addr: + */ +void +mono_mb_emit_ldarg_addr (MonoMethodBuilder *mb, guint argnum) +{ + if (argnum < 256) { + mono_mb_emit_byte (mb, CEE_LDARGA_S); + mono_mb_emit_byte (mb, argnum); + } else { + mono_mb_emit_byte (mb, CEE_PREFIX1); + mono_mb_emit_byte (mb, CEE_LDARGA); + mono_mb_emit_i2 (mb, argnum); + } +} + +/** + * mono_mb_emit_ldloc_addr: + */ +void +mono_mb_emit_ldloc_addr (MonoMethodBuilder *mb, guint locnum) +{ + if (locnum < 256) { + mono_mb_emit_byte (mb, CEE_LDLOCA_S); + mono_mb_emit_byte (mb, locnum); + } else { + mono_mb_emit_byte (mb, CEE_PREFIX1); + mono_mb_emit_byte (mb, CEE_LDLOCA); + mono_mb_emit_i2 (mb, locnum); + } +} + +/** + * mono_mb_emit_ldloc: + */ +void +mono_mb_emit_ldloc (MonoMethodBuilder *mb, guint num) +{ + if (num < 4) { + mono_mb_emit_byte (mb, CEE_LDLOC_0 + num); + } else if (num < 256) { + mono_mb_emit_byte (mb, CEE_LDLOC_S); + mono_mb_emit_byte (mb, num); + } else { + mono_mb_emit_byte (mb, CEE_PREFIX1); + mono_mb_emit_byte (mb, CEE_LDLOC); + mono_mb_emit_i2 (mb, num); + } +} + +/** + * mono_mb_emit_stloc: + */ +void +mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num) +{ + if (num < 4) { + mono_mb_emit_byte (mb, CEE_STLOC_0 + num); + } else if (num < 256) { + mono_mb_emit_byte (mb, CEE_STLOC_S); + mono_mb_emit_byte (mb, num); + } else { + mono_mb_emit_byte (mb, CEE_PREFIX1); + mono_mb_emit_byte (mb, CEE_STLOC); + mono_mb_emit_i2 (mb, num); + } +} + +/** + * mono_mb_emit_icon: + */ +void +mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value) +{ + if (value >= -1 && value < 8) { + mono_mb_emit_byte (mb, CEE_LDC_I4_0 + value); + } else if (value >= -128 && value <= 127) { + mono_mb_emit_byte (mb, CEE_LDC_I4_S); + mono_mb_emit_byte (mb, value); + } else { + mono_mb_emit_byte (mb, CEE_LDC_I4); + mono_mb_emit_i4 (mb, value); + } +} + +void +mono_mb_emit_icon8 (MonoMethodBuilder *mb, gint64 value) +{ + mono_mb_emit_byte (mb, CEE_LDC_I8); + mono_mb_emit_i8 (mb, value); +} + +int +mono_mb_get_label (MonoMethodBuilder *mb) +{ + return mb->pos; +} + +int +mono_mb_get_pos (MonoMethodBuilder *mb) +{ + return mb->pos; +} + +/** + * mono_mb_emit_branch: + */ +guint32 +mono_mb_emit_branch (MonoMethodBuilder *mb, guint8 op) +{ + guint32 res; + mono_mb_emit_byte (mb, op); + res = mb->pos; + mono_mb_emit_i4 (mb, 0); + return res; +} + +guint32 +mono_mb_emit_short_branch (MonoMethodBuilder *mb, guint8 op) +{ + guint32 res; + mono_mb_emit_byte (mb, op); + res = mb->pos; + mono_mb_emit_byte (mb, 0); + + return res; +} + +void +mono_mb_emit_branch_label (MonoMethodBuilder *mb, guint8 op, guint32 label) +{ + mono_mb_emit_byte (mb, op); + mono_mb_emit_i4 (mb, label - (mb->pos + 4)); +} + +void +mono_mb_patch_branch (MonoMethodBuilder *mb, guint32 pos) +{ + mono_mb_patch_addr (mb, pos, mb->pos - (pos + 4)); +} + +void +mono_mb_patch_short_branch (MonoMethodBuilder *mb, guint32 pos) +{ + mono_mb_patch_addr_s (mb, pos, mb->pos - (pos + 1)); +} + +void +mono_mb_emit_ptr (MonoMethodBuilder *mb, gpointer ptr) +{ + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_op (mb, CEE_MONO_LDPTR, ptr); +} + +void +mono_mb_emit_calli (MonoMethodBuilder *mb, MonoMethodSignature *sig) +{ + mono_mb_emit_op (mb, CEE_CALLI, sig); +} + +/** + * mono_mb_emit_managed_call: + */ +void +mono_mb_emit_managed_call (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *opt_sig) +{ + mono_mb_emit_op (mb, CEE_CALL, method); +} + +/** + * mono_mb_emit_native_call: + */ +void +mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpointer func) +{ + mono_mb_emit_ptr (mb, func); + mono_mb_emit_calli (mb, sig); +} + +void +mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func) +{ + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_op (mb, CEE_MONO_ICALL, func); +} + +void +mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg) +{ + 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); + g_assert (ctor); + mono_mb_emit_op (mb, CEE_NEWOBJ, ctor); + if (msg != NULL) { + mono_mb_emit_byte (mb, CEE_DUP); + mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoException, message)); + mono_mb_emit_ldstr (mb, (char*)msg); + mono_mb_emit_byte (mb, CEE_STIND_REF); + } + mono_mb_emit_byte (mb, CEE_THROW); +} + +/** + * mono_mb_emit_exception: + */ +void +mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg) +{ + mono_mb_emit_exception_full (mb, "System", exc_name, msg); +} + +/** + * mono_mb_emit_exception_for_error: + */ +void +mono_mb_emit_exception_for_error (MonoMethodBuilder *mb, MonoError *error) +{ + /* + * If at some point there is need to support other types of errors, + * the behaviour should conform with mono_error_prepare_exception(). + */ + g_assert (mono_error_get_error_code (error) == MONO_ERROR_GENERIC && "Unsupported error code."); + mono_mb_emit_exception_full (mb, "System", mono_error_get_exception_name (error), mono_error_get_message (error)); +} + +/** + * mono_mb_emit_add_to_local: + */ +void +mono_mb_emit_add_to_local (MonoMethodBuilder *mb, guint16 local, gint32 incr) +{ + mono_mb_emit_ldloc (mb, local); + mono_mb_emit_icon (mb, incr); + mono_mb_emit_byte (mb, CEE_ADD); + mono_mb_emit_stloc (mb, local); +} + +void +mono_mb_set_clauses (MonoMethodBuilder *mb, int num_clauses, MonoExceptionClause *clauses) +{ + mb->num_clauses = num_clauses; + mb->clauses = clauses; +} + +/* + * mono_mb_set_param_names: + * + * PARAM_NAMES should have length equal to the sig->param_count, the caller retains + * ownership of the array, and its entries. + */ +void +mono_mb_set_param_names (MonoMethodBuilder *mb, const char **param_names) +{ + mb->param_names = param_names; +} diff --git a/mono/metadata/method-builder-ilgen.h b/mono/metadata/method-builder-ilgen.h new file mode 100644 index 0000000000..a75300bf14 --- /dev/null +++ b/mono/metadata/method-builder-ilgen.h @@ -0,0 +1,125 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_METHOD_BUILDER_ILGEN_H__ +#define __MONO_METHOD_BUILDER_ILGEN_H__ + +#include "config.h" +#include +#include +#include +#include +#include +#include + +MONO_API void +mono_method_builder_ilgen_init (void); + +void +mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value); + +void +mono_mb_patch_addr_s (MonoMethodBuilder *mb, int pos, gint8 value); + +void +mono_mb_patch_branch (MonoMethodBuilder *mb, guint32 pos); + +void +mono_mb_patch_short_branch (MonoMethodBuilder *mb, guint32 pos); + +int +mono_mb_get_label (MonoMethodBuilder *mb); + +int +mono_mb_get_pos (MonoMethodBuilder *mb); + +void +mono_mb_emit_ptr (MonoMethodBuilder *mb, gpointer ptr); + +void +mono_mb_emit_calli (MonoMethodBuilder *mb, MonoMethodSignature *sig); + +void +mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpointer func); + +void +mono_mb_emit_managed_call (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *opt_sig); + +void +mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func); + +int +mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type); + +void +mono_mb_emit_ldarg (MonoMethodBuilder *mb, guint argnum); + +void +mono_mb_emit_ldarg_addr (MonoMethodBuilder *mb, guint argnum); + +void +mono_mb_emit_ldloc (MonoMethodBuilder *mb, guint num); + +void +mono_mb_emit_ldloc_addr (MonoMethodBuilder *mb, guint locnum); + +void +mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num); + +void +mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg); + +void +mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg); + +void +mono_mb_emit_exception_for_error (MonoMethodBuilder *mb, MonoError *error); + +void +mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value); + +void +mono_mb_emit_icon8 (MonoMethodBuilder *mb, gint64 value); + +guint32 +mono_mb_emit_branch (MonoMethodBuilder *mb, guint8 op); + +guint32 +mono_mb_emit_short_branch (MonoMethodBuilder *mb, guint8 op); + +void +mono_mb_emit_branch_label (MonoMethodBuilder *mb, guint8 op, guint32 label); + +void +mono_mb_emit_add_to_local (MonoMethodBuilder *mb, guint16 local, gint32 incr); + +void +mono_mb_emit_ldflda (MonoMethodBuilder *mb, gint32 offset); + +void +mono_mb_emit_byte (MonoMethodBuilder *mb, guint8 op); + +void +mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data); + +void +mono_mb_emit_i4 (MonoMethodBuilder *mb, gint32 data); + +void +mono_mb_emit_i8 (MonoMethodBuilder *mb, gint64 data); + +void +mono_mb_emit_op (MonoMethodBuilder *mb, guint8 op, gpointer data); + +void +mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str); + +void +mono_mb_set_clauses (MonoMethodBuilder *mb, int num_clauses, MonoExceptionClause *clauses); + +void +mono_mb_set_param_names (MonoMethodBuilder *mb, const char **param_names); + +#endif diff --git a/mono/metadata/method-builder-internals.h b/mono/metadata/method-builder-internals.h new file mode 100644 index 0000000000..48466e262e --- /dev/null +++ b/mono/metadata/method-builder-internals.h @@ -0,0 +1,24 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_METHOD_BUILDER_INTERNALS_H__ +#define __MONO_METHOD_BUILDER_INTERNALS_H__ + +#include "config.h" +#include +#include +#include +#include +#include +#include + +/* noilgen version */ +struct _MonoMethodBuilder { + MonoMethod *method; + char *name; + gboolean no_dup_name; +}; + +#endif diff --git a/mono/metadata/method-builder.c b/mono/metadata/method-builder.c index ccff8c91a0..c9e40d6c95 100644 --- a/mono/metadata/method-builder.c +++ b/mono/metadata/method-builder.c @@ -14,6 +14,8 @@ #include "loader.h" #include "mono/metadata/abi-details.h" #include "mono/metadata/method-builder.h" +#include "mono/metadata/method-builder-internals.h" +#include "mono/metadata/method-builder-ilgen.h" #include "mono/metadata/tabledefs.h" #include "mono/metadata/exception.h" #include "mono/metadata/appdomain.h" @@ -51,8 +53,11 @@ static MonoDisHelper marshal_dh = { }; #endif +static MonoMethodBuilderCallbacks mb_cb; +static gboolean cb_inited = FALSE; + static MonoMethodBuilder * -mono_mb_new_base (MonoClass *klass, MonoWrapperType type) +new_base_noilgen (MonoClass *klass, MonoWrapperType type) { MonoMethodBuilder *mb; MonoMethod *m; @@ -67,76 +72,24 @@ mono_mb_new_base (MonoClass *klass, MonoWrapperType type) m->inline_info = 1; m->wrapper_type = type; -#ifdef ENABLE_ILGEN - mb->code_size = 40; - mb->code = (unsigned char *)g_malloc (mb->code_size); - mb->init_locals = TRUE; -#endif /* placeholder for the wrapper always at index 1 */ mono_mb_add_data (mb, NULL); return mb; } -MonoMethodBuilder * -mono_mb_new_no_dup_name (MonoClass *klass, const char *name, MonoWrapperType type) +static void +free_noilgen (MonoMethodBuilder *mb) { - MonoMethodBuilder *mb = mono_mb_new_base (klass, type); - mb->name = (char*)name; - mb->no_dup_name = TRUE; - return mb; -} - -/** - * mono_mb_new: - */ -MonoMethodBuilder * -mono_mb_new (MonoClass *klass, const char *name, MonoWrapperType type) -{ - MonoMethodBuilder *mb = mono_mb_new_base (klass, type); - mb->name = g_strdup (name); - return mb; -} - -/** - * mono_mb_free: - */ -void -mono_mb_free (MonoMethodBuilder *mb) -{ -#ifdef ENABLE_ILGEN - GList *l; - - for (l = mb->locals_list; l; l = l->next) { - /* Allocated in mono_mb_add_local () */ - g_free (l->data); - } - g_list_free (mb->locals_list); - if (!mb->dynamic) { - g_free (mb->method); - if (!mb->no_dup_name) - g_free (mb->name); - g_free (mb->code); - } -#else g_free (mb->method); if (!mb->no_dup_name) g_free (mb->name); -#endif g_free (mb); } -/** - * mono_mb_create_method: - * Create a \c MonoMethod from this method builder. - * \returns the newly created method. - */ -MonoMethod * -mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack) +static MonoMethod * +create_method_noilgen (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack) { -#ifdef ENABLE_ILGEN - MonoMethodHeader *header; -#endif MonoMethodWrapper *mw; MonoImage *image; MonoMethod *method; @@ -147,24 +100,6 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in image = mb->method->klass->image; -#ifdef ENABLE_ILGEN - if (mb->dynamic) { - method = mb->method; - mw = (MonoMethodWrapper*)method; - - method->name = mb->name; - method->dynamic = TRUE; - - mw->header = header = (MonoMethodHeader *) - g_malloc0 (MONO_SIZEOF_METHOD_HEADER + mb->locals * sizeof (MonoType *)); - - header->code = mb->code; - - for (i = 0, l = mb->locals_list; l; l = l->next, i++) { - header->locals [i] = (MonoType*)l->data; - } - } else -#endif { /* Realloc the method info into a mempool */ @@ -176,46 +111,12 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in method->name = mb->name; else method->name = mono_image_strdup (image, mb->name); - -#ifdef ENABLE_ILGEN - mw->header = header = (MonoMethodHeader *) - mono_image_alloc0 (image, MONO_SIZEOF_METHOD_HEADER + mb->locals * sizeof (MonoType *)); - - header->code = (const unsigned char *)mono_image_alloc (image, mb->pos); - memcpy ((char*)header->code, mb->code, mb->pos); - - for (i = 0, l = mb->locals_list; l; l = l->next, i++) { - header->locals [i] = (MonoType*)l->data; - } -#endif } -#ifdef ENABLE_ILGEN - /* Free the locals list so mono_mb_free () doesn't free the types twice */ - g_list_free (mb->locals_list); - mb->locals_list = NULL; -#endif - method->signature = signature; if (!signature->hasthis) method->flags |= METHOD_ATTRIBUTE_STATIC; -#ifdef ENABLE_ILGEN - if (max_stack < 8) - max_stack = 8; - - header->max_stack = max_stack; - - header->code_size = mb->pos; - header->num_locals = mb->locals; - header->init_locals = mb->init_locals; - - header->num_clauses = mb->num_clauses; - header->clauses = mb->clauses; - - method->skip_visibility = mb->skip_visibility; -#endif - i = g_list_length ((GList *)mw->method_data); if (i) { GList *tmp; @@ -236,36 +137,83 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in mw->method_data = data; } -#ifdef ENABLE_ILGEN - /*{ - static int total_code = 0; - static int total_alloc = 0; - total_code += mb->pos; - total_alloc += mb->code_size; - g_print ("code size: %d of %d (allocated: %d)\n", mb->pos, total_code, total_alloc); - }*/ - -#ifdef DEBUG_RUNTIME_CODE - printf ("RUNTIME CODE FOR %s\n", mono_method_full_name (method, TRUE)); - printf ("%s\n", mono_disasm_code (&marshal_dh, method, mb->code, mb->code + mb->pos)); -#endif - - if (mb->param_names) { - char **param_names = (char **)mono_image_alloc0 (image, signature->param_count * sizeof (gpointer)); - for (i = 0; i < signature->param_count; ++i) - param_names [i] = mono_image_strdup (image, mb->param_names [i]); - - mono_image_lock (image); - if (!image->wrapper_param_names) - image->wrapper_param_names = g_hash_table_new (NULL, NULL); - g_hash_table_insert (image->wrapper_param_names, method, param_names); - mono_image_unlock (image); - } -#endif - return method; } + +void +mono_install_method_builder_callbacks (MonoMethodBuilderCallbacks *cb) +{ + g_assert (!cb_inited); + g_assert (cb->version == MONO_METHOD_BUILDER_CALLBACKS_VERSION); + memcpy (&mb_cb, cb, sizeof (MonoMethodBuilderCallbacks)); + cb_inited = TRUE; +} + +static void +install_noilgen (void) +{ + MonoMethodBuilderCallbacks cb; + cb.version = MONO_METHOD_BUILDER_CALLBACKS_VERSION; + cb.new_base = new_base_noilgen; + cb.free = free_noilgen; + cb.create_method = create_method_noilgen; + mono_install_method_builder_callbacks (&cb); +} + +static MonoMethodBuilderCallbacks * +get_mb_cb (void) +{ + if (G_UNLIKELY (!cb_inited)) { +#ifdef ENABLE_ILGEN + mono_method_builder_ilgen_init (); +#else + install_noilgen (); +#endif + } + return &mb_cb; +} + +MonoMethodBuilder * +mono_mb_new_no_dup_name (MonoClass *klass, const char *name, MonoWrapperType type) +{ + MonoMethodBuilder *mb = get_mb_cb ()->new_base (klass, type); + mb->name = (char*)name; + mb->no_dup_name = TRUE; + return mb; +} + +/** + * mono_mb_new: + */ +MonoMethodBuilder * +mono_mb_new (MonoClass *klass, const char *name, MonoWrapperType type) +{ + MonoMethodBuilder *mb = get_mb_cb ()->new_base (klass, type); + mb->name = g_strdup (name); + return mb; +} + +/** + * mono_mb_free: + */ +void +mono_mb_free (MonoMethodBuilder *mb) +{ + get_mb_cb ()->free (mb); +} + +/** + * mono_mb_create_method: + * Create a \c MonoMethod from this method builder. + * \returns the newly created method. + */ +MonoMethod * +mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack) +{ + return get_mb_cb ()->create_method (mb, signature, max_stack); +} + /** * mono_mb_add_data: */ @@ -284,418 +232,3 @@ mono_mb_add_data (MonoMethodBuilder *mb, gpointer data) return g_list_length ((GList *)mw->method_data); } -#ifdef ENABLE_ILGEN - -/** - * mono_mb_add_local: - */ -int -mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type) -{ - int res; - MonoType *t; - - /* - * Have to make a copy early since type might be sig->ret, - * which is transient, see mono_metadata_signature_dup_internal_with_padding (). - */ - t = mono_metadata_type_dup (NULL, type); - - g_assert (mb != NULL); - g_assert (type != NULL); - - res = mb->locals; - mb->locals_list = g_list_append (mb->locals_list, t); - mb->locals++; - - return res; -} - -/** - * mono_mb_patch_addr: - */ -void -mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value) -{ - mb->code [pos] = value & 0xff; - mb->code [pos + 1] = (value >> 8) & 0xff; - mb->code [pos + 2] = (value >> 16) & 0xff; - mb->code [pos + 3] = (value >> 24) & 0xff; -} - -/** - * mono_mb_patch_addr_s: - */ -void -mono_mb_patch_addr_s (MonoMethodBuilder *mb, int pos, gint8 value) -{ - *((gint8 *)(&mb->code [pos])) = value; -} - -/** - * mono_mb_emit_byte: - */ -void -mono_mb_emit_byte (MonoMethodBuilder *mb, guint8 op) -{ - if (mb->pos >= mb->code_size) { - mb->code_size += mb->code_size >> 1; - mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); - } - - mb->code [mb->pos++] = op; -} - -/** - * mono_mb_emit_ldflda: - */ -void -mono_mb_emit_ldflda (MonoMethodBuilder *mb, gint32 offset) -{ - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_OBJADDR); - - if (offset) { - mono_mb_emit_icon (mb, offset); - mono_mb_emit_byte (mb, CEE_ADD); - } -} - -/** - * mono_mb_emit_i4: - */ -void -mono_mb_emit_i4 (MonoMethodBuilder *mb, gint32 data) -{ - if ((mb->pos + 4) >= mb->code_size) { - mb->code_size += mb->code_size >> 1; - mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); - } - - mono_mb_patch_addr (mb, mb->pos, data); - mb->pos += 4; -} - -void -mono_mb_emit_i8 (MonoMethodBuilder *mb, gint64 data) -{ - if ((mb->pos + 8) >= mb->code_size) { - mb->code_size += mb->code_size >> 1; - mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); - } - - mono_mb_patch_addr (mb, mb->pos, data); - mono_mb_patch_addr (mb, mb->pos + 4, data >> 32); - mb->pos += 8; -} - -/** - * mono_mb_emit_i2: - */ -void -mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data) -{ - if ((mb->pos + 2) >= mb->code_size) { - mb->code_size += mb->code_size >> 1; - mb->code = (unsigned char *)g_realloc (mb->code, mb->code_size); - } - - mb->code [mb->pos] = data & 0xff; - mb->code [mb->pos + 1] = (data >> 8) & 0xff; - mb->pos += 2; -} - -void -mono_mb_emit_op (MonoMethodBuilder *mb, guint8 op, gpointer data) -{ - mono_mb_emit_byte (mb, op); - mono_mb_emit_i4 (mb, mono_mb_add_data (mb, data)); -} - -/** - * mono_mb_emit_ldstr: - */ -void -mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str) -{ - mono_mb_emit_op (mb, CEE_LDSTR, str); -} - -/** - * mono_mb_emit_ldarg: - */ -void -mono_mb_emit_ldarg (MonoMethodBuilder *mb, guint argnum) -{ - if (argnum < 4) { - mono_mb_emit_byte (mb, CEE_LDARG_0 + argnum); - } else if (argnum < 256) { - mono_mb_emit_byte (mb, CEE_LDARG_S); - mono_mb_emit_byte (mb, argnum); - } else { - mono_mb_emit_byte (mb, CEE_PREFIX1); - mono_mb_emit_byte (mb, CEE_LDARG); - mono_mb_emit_i2 (mb, argnum); - } -} - -/** - * mono_mb_emit_ldarg_addr: - */ -void -mono_mb_emit_ldarg_addr (MonoMethodBuilder *mb, guint argnum) -{ - if (argnum < 256) { - mono_mb_emit_byte (mb, CEE_LDARGA_S); - mono_mb_emit_byte (mb, argnum); - } else { - mono_mb_emit_byte (mb, CEE_PREFIX1); - mono_mb_emit_byte (mb, CEE_LDARGA); - mono_mb_emit_i2 (mb, argnum); - } -} - -/** - * mono_mb_emit_ldloc_addr: - */ -void -mono_mb_emit_ldloc_addr (MonoMethodBuilder *mb, guint locnum) -{ - if (locnum < 256) { - mono_mb_emit_byte (mb, CEE_LDLOCA_S); - mono_mb_emit_byte (mb, locnum); - } else { - mono_mb_emit_byte (mb, CEE_PREFIX1); - mono_mb_emit_byte (mb, CEE_LDLOCA); - mono_mb_emit_i2 (mb, locnum); - } -} - -/** - * mono_mb_emit_ldloc: - */ -void -mono_mb_emit_ldloc (MonoMethodBuilder *mb, guint num) -{ - if (num < 4) { - mono_mb_emit_byte (mb, CEE_LDLOC_0 + num); - } else if (num < 256) { - mono_mb_emit_byte (mb, CEE_LDLOC_S); - mono_mb_emit_byte (mb, num); - } else { - mono_mb_emit_byte (mb, CEE_PREFIX1); - mono_mb_emit_byte (mb, CEE_LDLOC); - mono_mb_emit_i2 (mb, num); - } -} - -/** - * mono_mb_emit_stloc: - */ -void -mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num) -{ - if (num < 4) { - mono_mb_emit_byte (mb, CEE_STLOC_0 + num); - } else if (num < 256) { - mono_mb_emit_byte (mb, CEE_STLOC_S); - mono_mb_emit_byte (mb, num); - } else { - mono_mb_emit_byte (mb, CEE_PREFIX1); - mono_mb_emit_byte (mb, CEE_STLOC); - mono_mb_emit_i2 (mb, num); - } -} - -/** - * mono_mb_emit_icon: - */ -void -mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value) -{ - if (value >= -1 && value < 8) { - mono_mb_emit_byte (mb, CEE_LDC_I4_0 + value); - } else if (value >= -128 && value <= 127) { - mono_mb_emit_byte (mb, CEE_LDC_I4_S); - mono_mb_emit_byte (mb, value); - } else { - mono_mb_emit_byte (mb, CEE_LDC_I4); - mono_mb_emit_i4 (mb, value); - } -} - -void -mono_mb_emit_icon8 (MonoMethodBuilder *mb, gint64 value) -{ - mono_mb_emit_byte (mb, CEE_LDC_I8); - mono_mb_emit_i8 (mb, value); -} - -int -mono_mb_get_label (MonoMethodBuilder *mb) -{ - return mb->pos; -} - -int -mono_mb_get_pos (MonoMethodBuilder *mb) -{ - return mb->pos; -} - -/** - * mono_mb_emit_branch: - */ -guint32 -mono_mb_emit_branch (MonoMethodBuilder *mb, guint8 op) -{ - guint32 res; - mono_mb_emit_byte (mb, op); - res = mb->pos; - mono_mb_emit_i4 (mb, 0); - return res; -} - -guint32 -mono_mb_emit_short_branch (MonoMethodBuilder *mb, guint8 op) -{ - guint32 res; - mono_mb_emit_byte (mb, op); - res = mb->pos; - mono_mb_emit_byte (mb, 0); - - return res; -} - -void -mono_mb_emit_branch_label (MonoMethodBuilder *mb, guint8 op, guint32 label) -{ - mono_mb_emit_byte (mb, op); - mono_mb_emit_i4 (mb, label - (mb->pos + 4)); -} - -void -mono_mb_patch_branch (MonoMethodBuilder *mb, guint32 pos) -{ - mono_mb_patch_addr (mb, pos, mb->pos - (pos + 4)); -} - -void -mono_mb_patch_short_branch (MonoMethodBuilder *mb, guint32 pos) -{ - mono_mb_patch_addr_s (mb, pos, mb->pos - (pos + 1)); -} - -void -mono_mb_emit_ptr (MonoMethodBuilder *mb, gpointer ptr) -{ - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_op (mb, CEE_MONO_LDPTR, ptr); -} - -void -mono_mb_emit_calli (MonoMethodBuilder *mb, MonoMethodSignature *sig) -{ - mono_mb_emit_op (mb, CEE_CALLI, sig); -} - -/** - * mono_mb_emit_managed_call: - */ -void -mono_mb_emit_managed_call (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *opt_sig) -{ - mono_mb_emit_op (mb, CEE_CALL, method); -} - -/** - * mono_mb_emit_native_call: - */ -void -mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpointer func) -{ - mono_mb_emit_ptr (mb, func); - mono_mb_emit_calli (mb, sig); -} - -void -mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func) -{ - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_op (mb, CEE_MONO_ICALL, func); -} - -void -mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg) -{ - 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); - g_assert (ctor); - mono_mb_emit_op (mb, CEE_NEWOBJ, ctor); - if (msg != NULL) { - mono_mb_emit_byte (mb, CEE_DUP); - mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoException, message)); - mono_mb_emit_ldstr (mb, (char*)msg); - mono_mb_emit_byte (mb, CEE_STIND_REF); - } - mono_mb_emit_byte (mb, CEE_THROW); -} - -/** - * mono_mb_emit_exception: - */ -void -mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg) -{ - mono_mb_emit_exception_full (mb, "System", exc_name, msg); -} - -/** - * mono_mb_emit_exception_for_error: - */ -void -mono_mb_emit_exception_for_error (MonoMethodBuilder *mb, MonoError *error) -{ - /* - * If at some point there is need to support other types of errors, - * the behaviour should conform with mono_error_prepare_exception(). - */ - g_assert (mono_error_get_error_code (error) == MONO_ERROR_GENERIC && "Unsupported error code."); - mono_mb_emit_exception_full (mb, "System", mono_error_get_exception_name (error), mono_error_get_message (error)); -} - -/** - * mono_mb_emit_add_to_local: - */ -void -mono_mb_emit_add_to_local (MonoMethodBuilder *mb, guint16 local, gint32 incr) -{ - mono_mb_emit_ldloc (mb, local); - mono_mb_emit_icon (mb, incr); - mono_mb_emit_byte (mb, CEE_ADD); - mono_mb_emit_stloc (mb, local); -} - -void -mono_mb_set_clauses (MonoMethodBuilder *mb, int num_clauses, MonoExceptionClause *clauses) -{ - mb->num_clauses = num_clauses; - mb->clauses = clauses; -} - -/* - * mono_mb_set_param_names: - * - * PARAM_NAMES should have length equal to the sig->param_count, the caller retains - * ownership of the array, and its entries. - */ -void -mono_mb_set_param_names (MonoMethodBuilder *mb, const char **param_names) -{ - mb->param_names = param_names; -} - -#endif /* DISABLE_JIT */ diff --git a/mono/metadata/method-builder.h b/mono/metadata/method-builder.h index 92d71dd4ea..7b2402a154 100644 --- a/mono/metadata/method-builder.h +++ b/mono/metadata/method-builder.h @@ -21,22 +21,16 @@ G_BEGIN_DECLS -typedef struct _MonoMethodBuilder { - MonoMethod *method; - char *name; - gboolean no_dup_name; -#ifdef ENABLE_ILGEN - GList *locals_list; - int locals; - gboolean dynamic; - gboolean skip_visibility, init_locals; - guint32 code_size, pos; - unsigned char *code; - int num_clauses; - MonoExceptionClause *clauses; - const char **param_names; -#endif -} MonoMethodBuilder; +typedef struct _MonoMethodBuilder MonoMethodBuilder; + +#define MONO_METHOD_BUILDER_CALLBACKS_VERSION 1 + +typedef struct { + int version; + MonoMethodBuilder* (*new_base) (MonoClass *klass, MonoWrapperType type); + void (*free) (MonoMethodBuilder *mb); + MonoMethod* (*create_method) (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack); +} MonoMethodBuilderCallbacks; MonoMethodBuilder * mono_mb_new (MonoClass *klass, const char *name, MonoWrapperType type); @@ -53,113 +47,8 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in guint32 mono_mb_add_data (MonoMethodBuilder *mb, gpointer data); -#ifdef ENABLE_ILGEN void -mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value); - -void -mono_mb_patch_addr_s (MonoMethodBuilder *mb, int pos, gint8 value); - -void -mono_mb_patch_branch (MonoMethodBuilder *mb, guint32 pos); - -void -mono_mb_patch_short_branch (MonoMethodBuilder *mb, guint32 pos); - -int -mono_mb_get_label (MonoMethodBuilder *mb); - -int -mono_mb_get_pos (MonoMethodBuilder *mb); - -void -mono_mb_emit_ptr (MonoMethodBuilder *mb, gpointer ptr); - -void -mono_mb_emit_calli (MonoMethodBuilder *mb, MonoMethodSignature *sig); - -void -mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpointer func); - -void -mono_mb_emit_managed_call (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *opt_sig); - -void -mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func); - -int -mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type); - -void -mono_mb_emit_ldarg (MonoMethodBuilder *mb, guint argnum); - -void -mono_mb_emit_ldarg_addr (MonoMethodBuilder *mb, guint argnum); - -void -mono_mb_emit_ldloc (MonoMethodBuilder *mb, guint num); - -void -mono_mb_emit_ldloc_addr (MonoMethodBuilder *mb, guint locnum); - -void -mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num); - -void -mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg); - -void -mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg); - -void -mono_mb_emit_exception_for_error (MonoMethodBuilder *mb, MonoError *error); - -void -mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value); - -void -mono_mb_emit_icon8 (MonoMethodBuilder *mb, gint64 value); - -guint32 -mono_mb_emit_branch (MonoMethodBuilder *mb, guint8 op); - -guint32 -mono_mb_emit_short_branch (MonoMethodBuilder *mb, guint8 op); - -void -mono_mb_emit_branch_label (MonoMethodBuilder *mb, guint8 op, guint32 label); - -void -mono_mb_emit_add_to_local (MonoMethodBuilder *mb, guint16 local, gint32 incr); - -void -mono_mb_emit_ldflda (MonoMethodBuilder *mb, gint32 offset); - -void -mono_mb_emit_byte (MonoMethodBuilder *mb, guint8 op); - -void -mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data); - -void -mono_mb_emit_i4 (MonoMethodBuilder *mb, gint32 data); - -void -mono_mb_emit_i8 (MonoMethodBuilder *mb, gint64 data); - -void -mono_mb_emit_op (MonoMethodBuilder *mb, guint8 op, gpointer data); - -void -mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str); - -void -mono_mb_set_clauses (MonoMethodBuilder *mb, int num_clauses, MonoExceptionClause *clauses); - -void -mono_mb_set_param_names (MonoMethodBuilder *mb, const char **param_names); - -#endif +mono_install_method_builder_callbacks (MonoMethodBuilderCallbacks *cb); G_END_DECLS diff --git a/mono/metadata/mono-conc-hash.c b/mono/metadata/mono-conc-hash.c index f7a50b905c..2aa1fe225b 100644 --- a/mono/metadata/mono-conc-hash.c +++ b/mono/metadata/mono-conc-hash.c @@ -38,6 +38,7 @@ struct _MonoConcGHashTable { GDestroyNotify value_destroy_func; MonoGHashGCType gc_type; MonoGCRootSource source; + void *key; const char *msg; }; @@ -46,16 +47,16 @@ static conc_table* conc_table_new (MonoConcGHashTable *hash, int size) { conc_table *table = g_new0 (conc_table, 1); - + table->keys = g_new0 (void*, size); table->values = g_new0 (void*, size); table->table_size = size; table->gc_type = hash->gc_type; if (hash->gc_type & MONO_HASH_KEY_GC) - mono_gc_register_root_wbarrier ((char*)table->keys, sizeof (MonoObject*) * size, mono_gc_make_vector_descr (), hash->source, hash->msg); + mono_gc_register_root_wbarrier ((char*)table->keys, sizeof (MonoObject*) * size, mono_gc_make_vector_descr (), hash->source, hash->key, hash->msg); if (hash->gc_type & MONO_HASH_VALUE_GC) - mono_gc_register_root_wbarrier ((char*)table->values, sizeof (MonoObject*) * size, mono_gc_make_vector_descr (), hash->source, hash->msg); + mono_gc_register_root_wbarrier ((char*)table->values, sizeof (MonoObject*) * size, mono_gc_make_vector_descr (), hash->source, hash->key, hash->msg); return table; } @@ -168,7 +169,7 @@ expand_table (MonoConcGHashTable *hash_table) MonoConcGHashTable * -mono_conc_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg) +mono_conc_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg) { MonoConcGHashTable *hash; @@ -183,6 +184,7 @@ mono_conc_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, hash->overflow_count = (int)(INITIAL_SIZE * LOAD_FACTOR); hash->gc_type = type; hash->source = source; + hash->key = key; hash->msg = msg; hash->table = conc_table_new (hash, INITIAL_SIZE); @@ -429,4 +431,4 @@ mono_conc_g_hash_table_remove (MonoConcGHashTable *hash_table, gconstpointer key i = (i + 1) & table_mask; } } -} \ No newline at end of file +} diff --git a/mono/metadata/mono-conc-hash.h b/mono/metadata/mono-conc-hash.h index 67b77ef2ca..e15629c309 100644 --- a/mono/metadata/mono-conc-hash.h +++ b/mono/metadata/mono-conc-hash.h @@ -11,7 +11,7 @@ typedef struct _MonoConcGHashTable MonoConcGHashTable; -MonoConcGHashTable * mono_conc_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg); +MonoConcGHashTable * mono_conc_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg); gpointer mono_conc_g_hash_table_lookup (MonoConcGHashTable *hash, gconstpointer key); gboolean mono_conc_g_hash_table_lookup_extended (MonoConcGHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value); void mono_conc_g_hash_table_foreach (MonoConcGHashTable *hash, GHFunc func, gpointer user_data); diff --git a/mono/metadata/mono-config.c b/mono/metadata/mono-config.c index c3840963bd..16d4ad56e4 100644 --- a/mono/metadata/mono-config.c +++ b/mono/metadata/mono-config.c @@ -59,7 +59,7 @@ #elif defined(sparc) || defined(__sparc__) #define CONFIG_CPU "sparc" #define CONFIG_WORDSIZE "32" -#elif defined(__ppc64__) || defined(__powerpc64__) || defined(TARGET_POWERPC) +#elif defined(__ppc64__) || defined(__powerpc64__) || defined(_ARCH_64) || defined(TARGET_POWERPC) #define CONFIG_WORDSIZE "64" #ifdef __mono_ppc_ilp32__ # define CONFIG_CPU "ppc64ilp32" @@ -131,27 +131,27 @@ static void start_element (GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, - GError **error); + GError **gerror); static void end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, - GError **error); + GError **gerror); static void parse_text (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, - GError **error); + GError **gerror); static void passthrough (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, - GError **error); + GError **gerror); static void parse_error (GMarkupParseContext *context, - GError *error, + GError *gerror, gpointer user_data); static const GMarkupParser @@ -199,7 +199,7 @@ static void start_element (GMarkupParseContext *context, const gchar **attribute_names, const gchar **attribute_values, gpointer user_data, - GError **error) + GError **gerror) { ParseState *state = (ParseState *)user_data; if (!state->current) { @@ -214,7 +214,7 @@ static void start_element (GMarkupParseContext *context, static void end_element (GMarkupParseContext *context, const gchar *element_name, gpointer user_data, - GError **error) + GError **gerror) { ParseState *state = (ParseState *)user_data; if (state->current) { @@ -233,7 +233,7 @@ static void parse_text (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, - GError **error) + GError **gerror) { ParseState *state = (ParseState *)user_data; if (state->current && state->current->text) @@ -244,13 +244,13 @@ static void passthrough (GMarkupParseContext *context, const gchar *text, gsize text_len, gpointer user_data, - GError **error) + GError **gerror) { /* do nothing */ } static void parse_error (GMarkupParseContext *context, - GError *error, + GError *gerror, gpointer user_data) { ParseState *state = (ParseState *)user_data; @@ -258,7 +258,7 @@ static void parse_error (GMarkupParseContext *context, const gchar *filename; filename = state && state->user_data ? (gchar *) state->user_data : ""; - msg = error && error->message ? error->message : ""; + msg = gerror && gerror->message ? gerror->message : ""; g_warning ("Error parsing %s: %s", filename, msg); } diff --git a/mono/metadata/mono-gc.h b/mono/metadata/mono-gc.h index bd1262a67b..247e32eaab 100644 --- a/mono/metadata/mono-gc.h +++ b/mono/metadata/mono-gc.h @@ -12,37 +12,90 @@ MONO_BEGIN_DECLS typedef int (*MonoGCReferences) (MonoObject *obj, MonoClass *klass, uintptr_t size, uintptr_t num, MonoObject **refs, uintptr_t *offsets, void *data); +/** + * This enum is used by the profiler API when reporting root registration. + */ typedef enum { - // Roots external to Mono. Embedders may only use this value. + /** + * Roots external to Mono. Embedders may only use this value. + */ MONO_ROOT_SOURCE_EXTERNAL = 0, - // Thread stack. Must not be used to register roots. + /** + * Thread call stack. + * + * The \c key parameter is a thread ID as a \c uintptr_t. + */ MONO_ROOT_SOURCE_STACK = 1, - // Roots in the finalizer queue. Must not be used to register roots. + /** + * Roots in the finalizer queue. This is a pseudo-root. + */ MONO_ROOT_SOURCE_FINALIZER_QUEUE = 2, - // Managed static variables. + /** + * Managed \c static variables. + * + * The \c key parameter is a \c MonoVTable pointer. + */ MONO_ROOT_SOURCE_STATIC = 3, - // Static variables with ThreadStaticAttribute. + /** + * Managed \c static variables with \c ThreadStaticAttribute. + * + * The \c key parameter is a thread ID as a \c uintptr_t. + */ MONO_ROOT_SOURCE_THREAD_STATIC = 4, - // Static variables with ContextStaticAttribute. + /** + * Managed \c static variables with \c ContextStaticAttribute. + * + * The \c key parameter is a \c MonoAppContext pointer. + */ MONO_ROOT_SOURCE_CONTEXT_STATIC = 5, - // GCHandle structures. + /** + * \c GCHandle structures. + */ MONO_ROOT_SOURCE_GC_HANDLE = 6, - // Roots in the just-in-time compiler. + /** + * Roots in the just-in-time compiler. + */ MONO_ROOT_SOURCE_JIT = 7, - // Roots in the threading subsystem. + /** + * Roots in the threading subsystem. + * + * The \c key parameter, if not \c NULL, is a thread ID as a \c uintptr_t. + */ MONO_ROOT_SOURCE_THREADING = 8, - // Roots in application domains. + /** + * Roots in application domains. + * + * The \c key parameter, if not \c NULL, is a \c MonoDomain pointer. + */ MONO_ROOT_SOURCE_DOMAIN = 9, - // Roots in reflection code. + /** + * Roots in reflection code. + * + * The \c key parameter, if not \c NULL, is a \c MonoVTable pointer. + */ MONO_ROOT_SOURCE_REFLECTION = 10, - // Roots from P/Invoke or other marshaling. + /** + * Roots from P/Invoke or other marshaling infrastructure. + */ MONO_ROOT_SOURCE_MARSHAL = 11, - // Roots in the thread pool data structures. + /** + * Roots in the thread pool data structures. + */ MONO_ROOT_SOURCE_THREAD_POOL = 12, - // Roots in the debugger agent. + /** + * Roots in the debugger agent. + */ MONO_ROOT_SOURCE_DEBUGGER = 13, - // Handle structures, used for object passed to internal functions + /** + * Roots in the runtime handle stack. This is a pseudo-root. + * + * The \c key parameter is a thread ID as a \c uintptr_t. + */ MONO_ROOT_SOURCE_HANDLE = 14, + /** + * Roots in the ephemeron arrays. This is a pseudo-root. + */ + MONO_ROOT_SOURCE_EPHEMERON = 15, } MonoGCRootSource; typedef enum { diff --git a/mono/metadata/mono-hash.c b/mono/metadata/mono-hash.c index 3074e86d37..a8a2d9b1e1 100644 --- a/mono/metadata/mono-hash.c +++ b/mono/metadata/mono-hash.c @@ -49,6 +49,7 @@ struct _MonoGHashTable { GDestroyNotify value_destroy_func, key_destroy_func; MonoGHashGCType gc_type; MonoGCRootSource source; + void *key; const char *msg; }; @@ -138,7 +139,7 @@ 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, const char *msg) +mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg) { MonoGHashTable *hash; @@ -156,15 +157,16 @@ mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, Mono hash->gc_type = type; hash->source = source; + hash->key = key; hash->msg = msg; if (type > MONO_HASH_KEY_VALUE_GC) g_error ("wrong type for gc hashtable"); if (hash->gc_type & MONO_HASH_KEY_GC) - mono_gc_register_root_wbarrier ((char*)hash->keys, sizeof (MonoObject*) * hash->table_size, mono_gc_make_vector_descr (), hash->source, hash->msg); + mono_gc_register_root_wbarrier ((char*)hash->keys, sizeof (MonoObject*) * hash->table_size, mono_gc_make_vector_descr (), hash->source, hash->key, hash->msg); if (hash->gc_type & MONO_HASH_VALUE_GC) - mono_gc_register_root_wbarrier ((char*)hash->values, sizeof (MonoObject*) * hash->table_size, mono_gc_make_vector_descr (), hash->source, hash->msg); + mono_gc_register_root_wbarrier ((char*)hash->values, sizeof (MonoObject*) * hash->table_size, mono_gc_make_vector_descr (), hash->source, hash->key, hash->msg); return hash; } @@ -221,9 +223,9 @@ rehash (MonoGHashTable *hash) data.values = g_new0 (MonoObject*, data.new_size); if (hash->gc_type & MONO_HASH_KEY_GC) - mono_gc_register_root_wbarrier ((char*)data.keys, sizeof (MonoObject*) * data.new_size, mono_gc_make_vector_descr (), hash->source, hash->msg); + mono_gc_register_root_wbarrier ((char*)data.keys, sizeof (MonoObject*) * data.new_size, mono_gc_make_vector_descr (), hash->source, hash->key, hash->msg); if (hash->gc_type & MONO_HASH_VALUE_GC) - mono_gc_register_root_wbarrier ((char*)data.values, sizeof (MonoObject*) * data.new_size, mono_gc_make_vector_descr (), hash->source, hash->msg); + mono_gc_register_root_wbarrier ((char*)data.values, sizeof (MonoObject*) * data.new_size, mono_gc_make_vector_descr (), hash->source, hash->key, hash->msg); if (!mono_threads_is_coop_enabled ()) { mono_gc_invoke_with_gc_lock (do_rehash, &data); @@ -279,8 +281,10 @@ mono_g_hash_table_lookup_extended (MonoGHashTable *hash, gconstpointer key, gpoi slot = mono_g_hash_table_find_slot (hash, key); if (hash->keys [slot]) { - *orig_key = hash->keys [slot]; - *value = hash->values [slot]; + if (orig_key) + *orig_key = hash->keys [slot]; + if (value) + *value = hash->values [slot]; return TRUE; } diff --git a/mono/metadata/mono-hash.h b/mono/metadata/mono-hash.h index 10e3ca390e..4e945a04e7 100644 --- a/mono/metadata/mono-hash.h +++ b/mono/metadata/mono-hash.h @@ -26,7 +26,7 @@ extern gint32 mono_g_hash_table_max_chain_length; typedef struct _MonoGHashTable MonoGHashTable; -MONO_API MonoGHashTable *mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, const char *msg); +MONO_API MonoGHashTable *mono_g_hash_table_new_type (GHashFunc hash_func, GEqualFunc key_equal_func, MonoGHashGCType type, MonoGCRootSource source, void *key, const char *msg); MONO_API guint mono_g_hash_table_size (MonoGHashTable *hash); MONO_API gpointer mono_g_hash_table_lookup (MonoGHashTable *hash, gconstpointer key); MONO_API gboolean mono_g_hash_table_lookup_extended (MonoGHashTable *hash, gconstpointer key, gpointer *orig_key, gpointer *value); diff --git a/mono/metadata/mono-mlist.c b/mono/metadata/mono-mlist.c index fcf91ae3a6..96a8806839 100644 --- a/mono/metadata/mono-mlist.c +++ b/mono/metadata/mono-mlist.c @@ -45,9 +45,9 @@ static MonoVTable *monolist_item_vtable = NULL; MonoMList* mono_mlist_alloc (MonoObject *data) { - MonoError error; - MonoMList *result = mono_mlist_alloc_checked (data, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMList *result = mono_mlist_alloc_checked (data, error); + mono_error_cleanup (error); return result; } @@ -69,8 +69,8 @@ mono_mlist_alloc_checked (MonoObject *data, MonoError *error) MonoMList* res; if (!monolist_item_vtable) { MonoClass *klass = mono_class_load_from_name (mono_defaults.corlib, "System", "MonoListItem"); - monolist_item_vtable = mono_class_vtable (mono_get_root_domain (), klass); - g_assert (monolist_item_vtable); + monolist_item_vtable = mono_class_vtable_checked (mono_get_root_domain (), klass, error); + mono_error_assert_ok (error); } res = (MonoMList*)mono_object_new_specific_checked (monolist_item_vtable, error); return_val_if_nok (error, NULL); @@ -171,9 +171,9 @@ mono_mlist_last (MonoMList* list) MonoMList* mono_mlist_prepend (MonoMList* list, MonoObject *data) { - MonoError error; - MonoMList *result = mono_mlist_prepend_checked (list, data, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMList *result = mono_mlist_prepend_checked (list, data, error); + mono_error_cleanup (error); return result; } @@ -209,9 +209,9 @@ mono_mlist_prepend_checked (MonoMList* list, MonoObject *data, MonoError *error) MonoMList* mono_mlist_append (MonoMList* list, MonoObject *data) { - MonoError error; - MonoMList *result = mono_mlist_append_checked (list, data, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoMList *result = mono_mlist_append_checked (list, data, error); + mono_error_cleanup (error); return result; } diff --git a/mono/metadata/mono-perfcounters.c b/mono/metadata/mono-perfcounters.c index 378750c0c2..7a6df9921f 100644 --- a/mono/metadata/mono-perfcounters.c +++ b/mono/metadata/mono-perfcounters.c @@ -993,10 +993,10 @@ mono_mem_counter (ImplVtable *vtable, MonoBoolean only_value, MonoCounterSample sample->rawValue = 0; return TRUE; case COUNTER_MEM_PHYS_TOTAL: - sample->rawValue = mono_determine_physical_ram_size ();; + sample->rawValue = mono_determine_physical_ram_size (); return TRUE; case COUNTER_MEM_PHYS_AVAILABLE: - sample->rawValue = mono_determine_physical_ram_available_size ();; + sample->rawValue = mono_determine_physical_ram_available_size (); return TRUE; } return FALSE; @@ -1245,7 +1245,6 @@ custom_get_instance (SharedCategory *cat, SharedCounter *scounter, char* name) inst = (SharedInstance*) shared_data_reserve_room (size, FTYPE_INSTANCE); if (!inst) { perfctr_unlock (); - g_free (name); return NULL; } inst->category_offset = (char*)cat - (char*)shared_area; @@ -1317,27 +1316,24 @@ find_category (MonoString *category) void* mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, - MonoString* machine, int *type, MonoBoolean *custom) + int *type, MonoBoolean *custom) { - MonoError error; + ERROR_DECL (error); const CategoryDesc *cdesc; void *result = NULL; - /* no support for counters on other machines */ - if (mono_string_compare_ascii (machine, ".")) - return NULL; cdesc = find_category (category); if (!cdesc) { SharedCategory *scat = find_custom_category (category); if (!scat) return NULL; *custom = TRUE; - result = custom_get_impl (scat, counter, instance, type, &error); - if (mono_error_set_pending_exception (&error)) + result = custom_get_impl (scat, counter, instance, type, error); + if (mono_error_set_pending_exception (error)) return NULL; return result; } - gchar *c_instance = mono_string_to_utf8_checked (instance, &error); - if (mono_error_set_pending_exception (&error)) + gchar *c_instance = mono_string_to_utf8_checked (instance, error); + if (mono_error_set_pending_exception (error)) return NULL; switch (cdesc->id) { case CATEGORY_CPU: @@ -1420,42 +1416,36 @@ mono_perfcounter_category_del (MonoString *name) /* this is an icall */ MonoString* -mono_perfcounter_category_help (MonoString *category, MonoString *machine) +mono_perfcounter_category_help (MonoString *category) { - MonoError error; + ERROR_DECL (error); MonoString *result = NULL; const CategoryDesc *cdesc; - error_init (&error); - /* no support for counters on other machines */ - if (mono_string_compare_ascii (machine, ".")) - return NULL; + error_init (error); cdesc = find_category (category); if (!cdesc) { SharedCategory *scat = find_custom_category (category); if (!scat) return NULL; - result = mono_string_new_checked (mono_domain_get (), custom_category_help (scat), &error); - if (mono_error_set_pending_exception (&error)) + result = mono_string_new_checked (mono_domain_get (), custom_category_help (scat), error); + if (mono_error_set_pending_exception (error)) return NULL; return result; } - result = mono_string_new_checked (mono_domain_get (), cdesc->help, &error); - if (mono_error_set_pending_exception (&error)) + result = mono_string_new_checked (mono_domain_get (), cdesc->help, error); + if (mono_error_set_pending_exception (error)) return NULL; return result; } /* - * Check if the category named @category exists on @machine. If @counter is not NULL, return + * Check if the category named @category exists. If @counter is not NULL, return * TRUE only if a counter with that name exists in the category. */ MonoBoolean -mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine) +mono_perfcounter_category_exists (MonoString *counter, MonoString *category) { const CategoryDesc *cdesc; - /* no support for counters on other machines */ - if (mono_string_compare_ascii (machine, ".")) - return FALSE; cdesc = find_category (category); if (!cdesc) { SharedCategory *scat = find_custom_category (category); @@ -1490,7 +1480,7 @@ typedef struct { MonoBoolean mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items) { - MonoError error; + ERROR_DECL (error); int result = FALSE; int i, size; int num_counters = mono_array_length (items); @@ -1502,22 +1492,22 @@ mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoA SharedCategory *cat; /* FIXME: ensure there isn't a category created already */ - name = mono_string_to_utf8_checked (category, &error); - if (!mono_error_ok (&error)) + name = mono_string_to_utf8_checked (category, error); + if (!mono_error_ok (error)) goto failure; - chelp = mono_string_to_utf8_checked (help, &error); - if (!mono_error_ok (&error)) + chelp = mono_string_to_utf8_checked (help, error); + if (!mono_error_ok (error)) goto failure; counter_info = g_new0 (char*, num_counters * 2); /* calculate the size we need structure size + name/help + 2 0 string terminators */ size = G_STRUCT_OFFSET (SharedCategory, name) + strlen (name) + strlen (chelp) + 2; for (i = 0; i < num_counters; ++i) { CounterCreationData *data = mono_array_get (items, CounterCreationData*, i); - counter_info [i * 2] = mono_string_to_utf8_checked (data->name, &error); - if (!mono_error_ok (&error)) + counter_info [i * 2] = mono_string_to_utf8_checked (data->name, error); + if (!mono_error_ok (error)) goto failure; - counter_info [i * 2 + 1] = mono_string_to_utf8_checked (data->help, &error); - if (!mono_error_ok (&error)) + counter_info [i * 2 + 1] = mono_string_to_utf8_checked (data->help, error); + if (!mono_error_ok (error)) goto failure; size += sizeof (SharedCounter) + 1; /* 1 is for the help 0 terminator */ } @@ -1567,29 +1557,25 @@ failure: } g_free (name); g_free (chelp); - mono_error_cleanup (&error); + mono_error_cleanup (error); return result; } -int -mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine) +MonoBoolean +mono_perfcounter_instance_exists (MonoString *instance, MonoString *category) { - MonoError error; + ERROR_DECL (error); const CategoryDesc *cdesc; SharedInstance *sinst; char *name; - /* no support for counters on other machines */ - /*FIXME: machine appears to be wrong - if (mono_string_compare_ascii (machine, ".")) - return FALSE;*/ cdesc = find_category (category); if (!cdesc) { SharedCategory *scat; scat = find_custom_category (category); if (!scat) return FALSE; - name = mono_string_to_utf8_checked (instance, &error); - if (mono_error_set_pending_exception (&error)) + name = mono_string_to_utf8_checked (instance, error); + if (mono_error_set_pending_exception (error)) return FALSE; sinst = find_custom_instance (scat, name); g_free (name); @@ -1603,71 +1589,59 @@ mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, Mo /* this is an icall */ MonoArray* -mono_perfcounter_category_names (MonoString *machine) +mono_perfcounter_category_names (void) { - MonoError error; + ERROR_DECL (error); int i; MonoArray *res; MonoDomain *domain = mono_domain_get (); GSList *custom_categories, *tmp; - /* no support for counters on other machines */ - if (mono_string_compare_ascii (machine, ".")) { - res = mono_array_new_checked (domain, mono_get_string_class (), 0, &error); - mono_error_set_pending_exception (&error); - return res; - } perfctr_lock (); custom_categories = get_custom_categories (); - res = mono_array_new_checked (domain, mono_get_string_class (), NUM_CATEGORIES + g_slist_length (custom_categories), &error); - if (mono_error_set_pending_exception (&error)) { + res = mono_array_new_checked (domain, mono_get_string_class (), NUM_CATEGORIES + g_slist_length (custom_categories), error); + if (mono_error_set_pending_exception (error)) { perfctr_unlock (); return NULL; } for (i = 0; i < NUM_CATEGORIES; ++i) { const CategoryDesc *cdesc = &predef_categories [i]; - MonoString *name = mono_string_new_checked (domain, cdesc->name, &error); - goto_if_nok (&error, leave); + MonoString *name = mono_string_new_checked (domain, cdesc->name, error); + goto_if_nok (error, leave); mono_array_setref (res, i, name); } for (tmp = custom_categories; tmp; tmp = tmp->next) { SharedCategory *scat = (SharedCategory *)tmp->data; - MonoString *name = mono_string_new_checked (domain, scat->name, &error); - goto_if_nok (&error, leave); + MonoString *name = mono_string_new_checked (domain, scat->name, error); + goto_if_nok (error, leave); mono_array_setref (res, i, name); i++; } leave: perfctr_unlock (); g_slist_free (custom_categories); - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return res; } MonoArray* -mono_perfcounter_counter_names (MonoString *category, MonoString *machine) +mono_perfcounter_counter_names (MonoString *category) { - MonoError error; + ERROR_DECL (error); int i; SharedCategory *scat; const CategoryDesc *cdesc; MonoArray *res; MonoDomain *domain = mono_domain_get (); - /* no support for counters on other machines */ - if (mono_string_compare_ascii (machine, ".")) { - res = mono_array_new_checked (domain, mono_get_string_class (), 0, &error); - mono_error_set_pending_exception (&error); - return res; - } cdesc = find_category (category); if (cdesc) { - res = mono_array_new_checked (domain, mono_get_string_class (), cdesc [1].first_counter - cdesc->first_counter, &error); - if (mono_error_set_pending_exception (&error)) + res = mono_array_new_checked (domain, mono_get_string_class (), cdesc [1].first_counter - cdesc->first_counter, error); + if (mono_error_set_pending_exception (error)) return NULL; for (i = cdesc->first_counter; i < cdesc [1].first_counter; ++i) { const CounterDesc *desc = &predef_counters [i]; - MonoString *name = mono_string_new_checked (domain, desc->name, &error); - if (mono_error_set_pending_exception (&error)) + MonoString *name = mono_string_new_checked (domain, desc->name, error); + if (mono_error_set_pending_exception (error)) return NULL; mono_array_setref (res, i - cdesc->first_counter, name); } @@ -1678,25 +1652,25 @@ mono_perfcounter_counter_names (MonoString *category, MonoString *machine) if (scat) { char *p = custom_category_counters (scat); int i; - res = mono_array_new_checked (domain, mono_get_string_class (), scat->num_counters, &error); - if (mono_error_set_pending_exception (&error)) { + res = mono_array_new_checked (domain, mono_get_string_class (), scat->num_counters, error); + if (mono_error_set_pending_exception (error)) { perfctr_unlock (); return NULL; } for (i = 0; i < scat->num_counters; ++i) { - MonoString *str = mono_string_new_checked (domain, p + 1, &error); - goto_if_nok (&error, leave); + MonoString *str = mono_string_new_checked (domain, p + 1, error); + goto_if_nok (error, leave); mono_array_setref (res, i, str); p += 2; /* skip counter type */ p += strlen (p) + 1; /* skip counter name */ p += strlen (p) + 1; /* skip counter help */ } } else - res = mono_array_new_checked (domain, mono_get_string_class (), 0, &error); + res = mono_array_new_checked (domain, mono_get_string_class (), 0, error); leave: perfctr_unlock (); - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return res; } @@ -1843,41 +1817,36 @@ get_custom_instances (MonoString *category, MonoError *error) } MonoArray* -mono_perfcounter_instance_names (MonoString *category, MonoString *machine) +mono_perfcounter_instance_names (MonoString *category) { - MonoError error; + ERROR_DECL (error); const CategoryDesc* cat; MonoArray *result = NULL; - if (mono_string_compare_ascii (machine, ".")) { - result = mono_array_new_checked (mono_domain_get (), mono_get_string_class (), 0, &error); - mono_error_set_pending_exception (&error); - return result; - } cat = find_category (category); if (!cat) { - MonoArray *result = get_custom_instances (category, &error); - mono_error_set_pending_exception (&error); + MonoArray *result = get_custom_instances (category, error); + mono_error_set_pending_exception (error); return result; } switch (cat->instance_type) { case MonoInstance: - result = get_mono_instances (&error); + result = get_mono_instances (error); break; case CPUInstance: - result = get_cpu_instances (&error); + result = get_cpu_instances (error); break; case ProcessInstance: - result = get_processes_instances (&error); + result = get_processes_instances (error); break; case NetworkInterfaceInstance: - result = get_networkinterface_instances (&error); + result = get_networkinterface_instances (error); break; case ThreadInstance: default: - result = mono_array_new_checked (mono_domain_get (), mono_get_string_class (), 0, &error); + result = mono_array_new_checked (mono_domain_get (), mono_get_string_class (), 0, error); } - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return result; } @@ -1940,7 +1909,7 @@ mono_perfcounter_foreach (PerfCounterEnumCallback cb, gpointer data) #else void* -mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, MonoString* machine, int *type, MonoBoolean *custom) +mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, int *type, MonoBoolean *custom) { g_assert_not_reached (); } @@ -1971,13 +1940,13 @@ mono_perfcounter_category_del (MonoString *name) } MonoString* -mono_perfcounter_category_help (MonoString *category, MonoString *machine) +mono_perfcounter_category_help (MonoString *category) { g_assert_not_reached (); } MonoBoolean -mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine) +mono_perfcounter_category_exists (MonoString *counter, MonoString *category) { g_assert_not_reached (); } @@ -1988,26 +1957,26 @@ mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoA g_assert_not_reached (); } -int -mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine) +MonoBoolean +mono_perfcounter_instance_exists (MonoString *instance, MonoString *category) { g_assert_not_reached (); } MonoArray* -mono_perfcounter_category_names (MonoString *machine) +mono_perfcounter_category_names (void) { g_assert_not_reached (); } MonoArray* -mono_perfcounter_counter_names (MonoString *category, MonoString *machine) +mono_perfcounter_counter_names (MonoString *category) { g_assert_not_reached (); } MonoArray* -mono_perfcounter_instance_names (MonoString *category, MonoString *machine) +mono_perfcounter_instance_names (MonoString *category) { g_assert_not_reached (); } diff --git a/mono/metadata/mono-perfcounters.h b/mono/metadata/mono-perfcounters.h index e7c702f449..47329537c1 100644 --- a/mono/metadata/mono-perfcounters.h +++ b/mono/metadata/mono-perfcounters.h @@ -12,7 +12,7 @@ typedef struct _MonoCounterSample MonoCounterSample; void* mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance, - MonoString* machine, int *type, MonoBoolean *custom); + int *type, MonoBoolean *custom); MonoBoolean mono_perfcounter_get_sample (void *impl, MonoBoolean only_value, MonoCounterSample *sample); @@ -21,13 +21,13 @@ void mono_perfcounter_free_data (void *impl); /* Category icalls */ MonoBoolean mono_perfcounter_category_del (MonoString *name); -MonoString* mono_perfcounter_category_help (MonoString *category, MonoString *machine); -MonoBoolean mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine); +MonoString* mono_perfcounter_category_help (MonoString *category); +MonoBoolean mono_perfcounter_category_exists (MonoString *counter, MonoString *category); MonoBoolean mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items); -int mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine); -MonoArray* mono_perfcounter_category_names (MonoString *machine); -MonoArray* mono_perfcounter_counter_names (MonoString *category, MonoString *machine); -MonoArray* mono_perfcounter_instance_names (MonoString *category, MonoString *machine); +MonoBoolean mono_perfcounter_instance_exists (MonoString *instance, MonoString *category); +MonoArray* mono_perfcounter_category_names (void); +MonoArray* mono_perfcounter_counter_names (MonoString *category); +MonoArray* mono_perfcounter_instance_names (MonoString *category); typedef gboolean (*PerfCounterEnumCallback) (char *category_name, char *name, unsigned char type, gint64 value, gpointer user_data); MONO_API void mono_perfcounter_foreach (PerfCounterEnumCallback cb, gpointer user_data); diff --git a/mono/metadata/mono-ptr-array.h b/mono/metadata/mono-ptr-array.h index 61589f3bbb..70694eff8f 100644 --- a/mono/metadata/mono-ptr-array.h +++ b/mono/metadata/mono-ptr-array.h @@ -25,18 +25,20 @@ typedef struct { int size; int capacity; MonoGCRootSource source; + void *key; const char *msg; } MonoPtrArray; #define MONO_PTR_ARRAY_MAX_ON_STACK (16) -#define mono_ptr_array_init(ARRAY, INITIAL_SIZE, SOURCE, MSG) do {\ +#define mono_ptr_array_init(ARRAY, INITIAL_SIZE, SOURCE, KEY, MSG) do {\ (ARRAY).size = 0; \ (ARRAY).capacity = MAX (INITIAL_SIZE, MONO_PTR_ARRAY_MAX_ON_STACK); \ (ARRAY).source = SOURCE; \ + (ARRAY).key = KEY; \ (ARRAY).msg = MSG; \ (ARRAY).data = INITIAL_SIZE > MONO_PTR_ARRAY_MAX_ON_STACK \ - ? (void **)mono_gc_alloc_fixed (sizeof (void*) * INITIAL_SIZE, mono_gc_make_root_descr_all_refs (INITIAL_SIZE), SOURCE, MSG) \ + ? (void **)mono_gc_alloc_fixed (sizeof (void*) * INITIAL_SIZE, mono_gc_make_root_descr_all_refs (INITIAL_SIZE), SOURCE, NULL, MSG) \ : g_newa (void*, MONO_PTR_ARRAY_MAX_ON_STACK); \ } while (0) @@ -47,7 +49,7 @@ typedef struct { #define mono_ptr_array_append(ARRAY, VALUE) do { \ if ((ARRAY).size >= (ARRAY).capacity) {\ - void **__tmp = (void **)mono_gc_alloc_fixed (sizeof (void*) * (ARRAY).capacity * 2, mono_gc_make_root_descr_all_refs ((ARRAY).capacity * 2), (ARRAY).source, (ARRAY).msg); \ + void **__tmp = (void **)mono_gc_alloc_fixed (sizeof (void*) * (ARRAY).capacity * 2, mono_gc_make_root_descr_all_refs ((ARRAY).capacity * 2), (ARRAY).source, (ARRAY).key, (ARRAY).msg); \ mono_gc_memmove_aligned ((void *)__tmp, (ARRAY).data, (ARRAY).capacity * sizeof (void*)); \ if ((ARRAY).capacity > MONO_PTR_ARRAY_MAX_ON_STACK) \ mono_gc_free_fixed ((ARRAY).data); \ diff --git a/mono/metadata/mono-route.c b/mono/metadata/mono-route.c index 44dfb52cd8..d4a7ffe3c2 100644 --- a/mono/metadata/mono-route.c +++ b/mono/metadata/mono-route.c @@ -23,7 +23,7 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal(MonoString *iface, MonoArray **gw_addr_list) { - MonoError error; + ERROR_DECL (error); size_t needed; in_addr_t in; int mib[6]; @@ -34,8 +34,8 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfacePrope MonoDomain *domain = mono_domain_get (); - ifacename = mono_string_to_utf8_checked(iface, &error); - if (mono_error_set_pending_exception (&error)) + ifacename = mono_string_to_utf8_checked(iface, error); + if (mono_error_set_pending_exception (error)) return FALSE; if ((ifindex = if_nametoindex(ifacename)) == 0) @@ -76,8 +76,8 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfacePrope num_gws++; } - *gw_addr_list = mono_array_new_checked (domain, mono_get_string_class (), num_gws, &error); - goto_if_nok (&error, leave); + *gw_addr_list = mono_array_new_checked (domain, mono_get_string_class (), num_gws, error); + goto_if_nok (error, leave); for (next = buf; next < lim; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)next; @@ -103,14 +103,14 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfacePrope // snprintf output truncated continue; - addr_string = mono_string_new_checked (domain, addr, &error); - goto_if_nok (&error, leave); + addr_string = mono_string_new_checked (domain, addr, error); + goto_if_nok (error, leave); mono_array_setref (*gw_addr_list, gwnum, addr_string); gwnum++; } leave: g_free (buf); - return is_ok (&error); + return is_ok (error); } in_addr_t gateway_from_rtm(struct rt_msghdr *rtm) diff --git a/mono/metadata/mono-route.h b/mono/metadata/mono-route.h index 03d179d71c..26d729aaed 100644 --- a/mono/metadata/mono-route.h +++ b/mono/metadata/mono-route.h @@ -8,6 +8,7 @@ #if defined(HOST_DARWIN) || defined(HOST_BSD) #include +#include /* in_addr_t */ #if defined (HOST_IOS) || defined (HOST_WATCHOS) || defined (HOST_APPLETVOS) // The iOS SDK does not provide the net/route.h header but using the Darwin version works fine. diff --git a/mono/metadata/mono-security-windows.c b/mono/metadata/mono-security-windows.c index bfdc96a9bb..2369e8b72e 100644 --- a/mono/metadata/mono-security-windows.c +++ b/mono/metadata/mono-security-windows.c @@ -152,7 +152,7 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoStringHand MonoArray* ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) { - MonoError error; + ERROR_DECL (error); MonoArray *array = NULL; MonoDomain *domain = mono_domain_get (); @@ -165,8 +165,8 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) int i=0; int num = tg->GroupCount; - array = mono_array_new_checked (domain, mono_get_string_class (), num, &error); - if (mono_error_set_pending_exception (&error)) { + array = mono_array_new_checked (domain, mono_get_string_class (), num, error); + if (mono_error_set_pending_exception (error)) { g_free (tg); return NULL; } @@ -176,11 +176,11 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) gunichar2 *uniname = GetSidName (NULL, tg->Groups [i].Sid, &size); if (uniname) { - MonoString *str = mono_string_new_utf16_checked (domain, uniname, size, &error); - if (!is_ok (&error)) { + MonoString *str = mono_string_new_utf16_checked (domain, uniname, size, error); + if (!is_ok (error)) { g_free (uniname); g_free (tg); - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return NULL; } mono_array_setref (array, i, str); @@ -193,8 +193,8 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) if (!array) { /* return empty array of string, i.e. string [0] */ - array = mono_array_new_checked (domain, mono_get_string_class (), 0, &error); - mono_error_set_pending_exception (&error); + array = mono_array_new_checked (domain, mono_get_string_class (), 0, error); + mono_error_set_pending_exception (error); } return array; } diff --git a/mono/metadata/mono-security.c b/mono/metadata/mono-security.c index 52c8efcf69..ce62effea9 100644 --- a/mono/metadata/mono-security.c +++ b/mono/metadata/mono-security.c @@ -329,7 +329,7 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoStringHand MonoArray* ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) { - MonoError error; + ERROR_DECL (error); MonoArray *array = NULL; MonoDomain *domain = mono_domain_get (); @@ -338,8 +338,8 @@ ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) if (!array) { /* return empty array of string, i.e. string [0] */ - array = mono_array_new_checked (domain, mono_get_string_class (), 0, &error); - mono_error_set_pending_exception (&error); + array = mono_array_new_checked (domain, mono_get_string_class (), 0, error); + mono_error_set_pending_exception (error); } return array; } @@ -609,16 +609,16 @@ static MonoImage *system_security_assembly = NULL; void ves_icall_System_Security_SecureString_DecryptInternal (MonoArray *data, MonoObject *scope) { - MonoError error; - invoke_protected_memory_method (data, scope, FALSE, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + invoke_protected_memory_method (data, scope, FALSE, error); + mono_error_set_pending_exception (error); } void ves_icall_System_Security_SecureString_EncryptInternal (MonoArray* data, MonoObject *scope) { - MonoError error; - invoke_protected_memory_method (data, scope, TRUE, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + invoke_protected_memory_method (data, scope, TRUE, error); + mono_error_set_pending_exception (error); } void invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gboolean encrypt, MonoError *error) diff --git a/mono/metadata/null-gc-handles.c b/mono/metadata/null-gc-handles.c index f038a0e8a9..60e372bd6e 100644 --- a/mono/metadata/null-gc-handles.c +++ b/mono/metadata/null-gc-handles.c @@ -116,7 +116,7 @@ handle_data_alloc_entries (HandleData *handles) handles->entries = (void **)g_malloc0 (sizeof (*handles->entries) * handles->size); handles->domain_ids = (guint16 *)g_malloc0 (sizeof (*handles->domain_ids) * handles->size); } else { - handles->entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * handles->size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, "gc handles table"); + handles->entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * handles->size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, "GC Handle Table (Null)"); } handles->bitmap = (guint32 *)g_malloc0 (handles->size / CHAR_BIT); } @@ -183,7 +183,7 @@ handle_data_grow (HandleData *handles, gboolean track) handles->domain_ids = domain_ids; } else { gpointer *entries; - entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * new_size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, "gc handles table"); + entries = (void **)mono_gc_alloc_fixed (sizeof (*handles->entries) * new_size, NULL, MONO_ROOT_SOURCE_GC_HANDLE, "GC Handle Table (Null)"); mono_gc_memmove_aligned (entries, handles->entries, sizeof (*handles->entries) * handles->size); mono_gc_free_fixed (handles->entries); handles->entries = entries; diff --git a/mono/metadata/null-gc.c b/mono/metadata/null-gc.c index 1f780b337f..6e35625cbe 100644 --- a/mono/metadata/null-gc.c +++ b/mono/metadata/null-gc.c @@ -110,11 +110,18 @@ mono_object_is_alive (MonoObject* o) } int -mono_gc_register_root (char *start, size_t size, void *descr, MonoGCRootSource source, const char *msg) +mono_gc_register_root (char *start, size_t size, void *descr, MonoGCRootSource source, void *key, const char *msg) { return TRUE; } +int +mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg) +{ + return TRUE; +} + + void mono_gc_deregister_root (char* addr) { @@ -157,7 +164,7 @@ mono_gc_make_root_descr_all_refs (int numbits) } void* -mono_gc_alloc_fixed (size_t size, void *descr, MonoGCRootSource source, const char *msg) +mono_gc_alloc_fixed (size_t size, void *descr, MonoGCRootSource source, void *key, const char *msg) { return g_malloc0 (size); } @@ -524,6 +531,13 @@ BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reser } #endif +MonoVTable * +mono_gc_get_vtable (MonoObject *obj) +{ + // No pointer tagging. + return obj->vtable; +} + guint mono_gc_get_vtable_bits (MonoClass *klass) { diff --git a/mono/metadata/object-forward.h b/mono/metadata/object-forward.h new file mode 100644 index 0000000000..be15a1fbe7 --- /dev/null +++ b/mono/metadata/object-forward.h @@ -0,0 +1,13 @@ +/** + * \file + * + * Forward declarations of opaque types, and typedefs thereof. + * + */ + +#ifndef __MONO_OBJECT_FORWARD_H__ +#define __MONO_OBJECT_FORWARD_H__ + +typedef struct _MonoReflectionTypeBuilder MonoReflectionTypeBuilder; + +#endif /* __MONO_OBJECT_FORWARD_H__ */ diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h index cb42761d6c..30ad967764 100644 --- a/mono/metadata/object-internals.h +++ b/mono/metadata/object-internals.h @@ -5,6 +5,7 @@ #ifndef __MONO_OBJECT_INTERNALS_H__ #define __MONO_OBJECT_INTERNALS_H__ +#include #include #include #include @@ -15,6 +16,7 @@ #include "mono/utils/mono-compiler.h" #include "mono/utils/mono-error.h" #include "mono/utils/mono-error-internals.h" +#include "mono/utils/mono-machine.h" #include "mono/utils/mono-stack-unwinding.h" #include "mono/utils/mono-tls.h" #include "mono/utils/mono-coop-mutex.h" @@ -84,15 +86,17 @@ tmp_klass; }) /* eclass should be a run-time constant */ #define mono_array_new_cached(domain, eclass, size, error) ({ \ - MonoVTable *__vtable = mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)); \ - MonoArray *__arr = mono_array_new_specific_checked (__vtable, (size), (error)); \ - __arr; }) + MonoVTable *__vtable = mono_class_vtable_checked ((domain), mono_array_class_get_cached ((eclass), 1), (error)); \ + MonoArray *__arr = NULL; \ + if (is_ok ((error))) \ + __arr = mono_array_new_specific_checked (__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_array_class_get ((eclass), (rank)) -#define mono_array_new_cached(domain, eclass, size, error) mono_array_new_specific_checked (mono_class_vtable ((domain), mono_array_class_get_cached ((eclass), 1)), (size), (error)) +#define mono_array_new_cached(domain, eclass, size, error) mono_array_new_checked ((domain), (eclass), (size), (error)) #endif @@ -119,8 +123,8 @@ struct _MonoArray { MonoArrayBounds *bounds; /* total number of elements of the array */ mono_array_size_t max_length; - /* we use double to ensure proper alignment on platforms that need it */ - double vector [MONO_ZERO_LEN_ARRAY]; + /* we use mono_64bitaligned_t to ensure proper alignment on platforms that need it */ + mono_64bitaligned_t vector [MONO_ZERO_LEN_ARRAY]; }; #define MONO_SIZEOF_MONO_ARRAY (sizeof (MonoArray) - MONO_ZERO_LEN_ARRAY * sizeof (double)) @@ -435,12 +439,6 @@ struct _MonoInternalThread { gpointer last; }; -/* It's safe to access System.Threading.InternalThread from native code via a - * raw pointer because all instances should be pinned. But for uniformity of - * icall wrapping, let's declare a MonoInternalThreadHandle anyway. - */ -TYPED_HANDLE_DECL (MonoInternalThread); - struct _MonoThread { MonoObject obj; struct _MonoInternalThread *internal_thread; @@ -631,6 +629,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); + void (*runtime_telemetry_callback) (void); } MonoRuntimeCallbacks; typedef gboolean (*MonoInternalStackWalk) (MonoStackFrameInfo *frame, MonoContext *ctx, gpointer data); @@ -1234,7 +1233,7 @@ typedef enum { MonoTypeBuilderFinished = 2 } MonoTypeBuilderState; -typedef struct { +struct _MonoReflectionTypeBuilder { MonoReflectionType type; MonoString *name; MonoString *nspace; @@ -1260,7 +1259,7 @@ typedef struct { MonoArray *permissions; MonoReflectionType *created; gint32 state; -} MonoReflectionTypeBuilder; +}; /* Safely access System.Reflection.Emit.TypeBuilder from native code */ TYPED_HANDLE_DECL (MonoReflectionTypeBuilder); @@ -1474,7 +1473,11 @@ typedef struct { static inline MonoInternalThread* mono_internal_thread_handle_ptr (MonoInternalThreadHandle h) { - return MONO_HANDLE_RAW (h); /* Safe */ + /* The SUPPRESS here prevents a Centrinel warning due to merely seeing this + * function definition. Callees will still get a warning unless we + * attach a suppress attribute to the declaration. + */ + return MONO_HANDLE_SUPPRESS (MONO_HANDLE_RAW (h)); } gboolean mono_image_create_pefile (MonoReflectionModuleBuilder *module, gpointer file, MonoError *error); @@ -1543,9 +1546,6 @@ mono_string_handle_length (MonoStringHandle s); char * mono_string_handle_to_utf8 (MonoStringHandle s, MonoError *error); -char * -mono_string_to_utf8_mp (MonoMemPool *mp, MonoString *s, MonoError *error); - char * mono_string_to_utf8_image (MonoImage *image, MonoStringHandle s, MonoError *error); @@ -1781,12 +1781,6 @@ mono_object_try_to_string (MonoObject *obj, MonoObject **exc, MonoError *error); char * mono_string_to_utf8_ignore (MonoString *s); -char * -mono_string_to_utf8_image_ignore (MonoImage *image, MonoString *s); - -char * -mono_string_to_utf8_mp_ignore (MonoMemPool *mp, MonoString *s); - gboolean mono_monitor_is_il_fastpath_wrapper (MonoMethod *method); @@ -1847,6 +1841,9 @@ mono_string_new_len_checked (MonoDomain *domain, const char *text, guint length, MonoString* mono_string_new_checked (MonoDomain *domain, const char *text, MonoError *merror); +MonoString* +mono_string_new_wtf8_len_checked (MonoDomain *domain, const char *text, guint length, MonoError *error); + MonoString * mono_string_new_utf16_checked (MonoDomain *domain, const guint16 *text, gint32 len, MonoError *error); diff --git a/mono/metadata/object-offsets.h b/mono/metadata/object-offsets.h index a4f2c27ea1..79520e6f4a 100644 --- a/mono/metadata/object-offsets.h +++ b/mono/metadata/object-offsets.h @@ -161,7 +161,6 @@ DECL_OFFSET(MonoMethodRuntimeGenericContext, class_vtable) DECL_OFFSET(MonoJitTlsData, lmf) DECL_OFFSET(MonoJitTlsData, class_cast_from) DECL_OFFSET(MonoJitTlsData, class_cast_to) -DECL_OFFSET(MonoJitTlsData, restore_stack_prot) DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, locals_size) DECL_OFFSET(MonoGSharedVtMethodRuntimeInfo, entries) //XXX more to fix here @@ -280,13 +279,11 @@ DECL_OFFSET(SeqPointInfo, ss_tramp_addr) DECL_OFFSET(SeqPointInfo, bp_addrs) #endif -#ifndef DISABLE_INTERPRETER -DECL_OFFSET(InterpMethodArguments, ilen) -DECL_OFFSET(InterpMethodArguments, iargs) -DECL_OFFSET(InterpMethodArguments, flen) -DECL_OFFSET(InterpMethodArguments, fargs) -DECL_OFFSET(InterpMethodArguments, retval) -DECL_OFFSET(InterpMethodArguments, is_float_ret) +#if defined(TARGET_AMD64) || defined(TARGET_ARM) || defined(TARGET_ARM64) +DECL_OFFSET(CallContext, gregs) +DECL_OFFSET(CallContext, fregs) +DECL_OFFSET(CallContext, stack_size) +DECL_OFFSET(CallContext, stack) #endif #endif //DISABLE_JIT_OFFSETS diff --git a/mono/metadata/object.c.REMOVED.git-id b/mono/metadata/object.c.REMOVED.git-id index fb73aed053..a4ee0409c1 100644 --- a/mono/metadata/object.c.REMOVED.git-id +++ b/mono/metadata/object.c.REMOVED.git-id @@ -1 +1 @@ -747376a1b2b8aeb6ffcc236dd5320f5bf832d725 \ No newline at end of file +df97ddd7a540f619e38bb477346042e39ce3481a \ No newline at end of file diff --git a/mono/metadata/object.h b/mono/metadata/object.h index 9608cfc076..77f4adb88f 100644 --- a/mono/metadata/object.h +++ b/mono/metadata/object.h @@ -200,6 +200,9 @@ mono_value_copy (void* dest, void* src, MonoClass *klass); MONO_API void mono_value_copy_array (MonoArray *dest, int dest_idx, void* src, int count); +MONO_API MonoVTable * +mono_object_get_vtable (MonoObject *obj); + MONO_API MonoDomain* mono_object_get_domain (MonoObject *obj); @@ -244,6 +247,10 @@ MONO_RT_EXTERNAL_ONLY MONO_API void mono_raise_exception (MonoException *ex); +MONO_RT_EXTERNAL_ONLY +MONO_API mono_bool +mono_runtime_set_pending_exception (MonoException *exc, mono_bool overwrite); + MONO_RT_EXTERNAL_ONLY MONO_API void mono_reraise_exception (MonoException *ex); @@ -256,6 +263,12 @@ MONO_RT_EXTERNAL_ONLY MONO_API void mono_runtime_class_init (MonoVTable *vtable); +MONO_API MonoDomain * +mono_vtable_domain (MonoVTable *vtable); + +MONO_API MonoClass * +mono_vtable_class (MonoVTable *vtable); + MONO_API MonoMethod* mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method); diff --git a/mono/metadata/profiler-events.h b/mono/metadata/profiler-events.h index e22d1c5961..b4533e2d07 100644 --- a/mono/metadata/profiler-events.h +++ b/mono/metadata/profiler-events.h @@ -12,6 +12,7 @@ * MONO_PROFILER_EVENT_2(name, type, arg1_type, arg1_name, arg2_type, arg2_name) * MONO_PROFILER_EVENT_3(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name) * MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) + * MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) * * To add new callbacks to the API, simply add a line in this file and use * MONO_PROFILER_RAISE to raise the event wherever. @@ -22,11 +23,15 @@ * to prevent errors in existing code, you must add something like this at the * beginning of this file: * - * #ifndef MONO_PROFILER_EVENT_5 - * #define MONO_PROFILER_EVENT_5(...) # Do nothing. + * #ifndef MONO_PROFILER_EVENT_6 + * #define MONO_PROFILER_EVENT_6(...) # Do nothing. * #endif */ +#ifndef MONO_PROFILER_EVENT_5 +#define MONO_PROFILER_EVENT_5(...) +#endif + MONO_PROFILER_EVENT_0(runtime_initialized, RuntimeInitialized) MONO_PROFILER_EVENT_0(runtime_shutdown_begin, RuntimeShutdownBegin) MONO_PROFILER_EVENT_0(runtime_shutdown_end, RuntimeShutdownEnd) @@ -51,6 +56,10 @@ MONO_PROFILER_EVENT_1(class_loading, ClassLoading, MonoClass *, klass) MONO_PROFILER_EVENT_1(class_failed, ClassFailed, MonoClass *, klass) MONO_PROFILER_EVENT_1(class_loaded, ClassLoaded, MonoClass *, klass) +MONO_PROFILER_EVENT_1(vtable_loading, VTableLoading, MonoVTable *, vtable) +MONO_PROFILER_EVENT_1(vtable_failed, VTableFailed, MonoVTable *, vtable) +MONO_PROFILER_EVENT_1(vtable_loaded, VTableLoaded, MonoVTable *, vtable) + MONO_PROFILER_EVENT_1(image_loading, ModuleLoading, MonoImage *, image) MONO_PROFILER_EVENT_1(image_failed, ModuleFailed, MonoImage *, image) MONO_PROFILER_EVENT_1(image_loaded, ModuleLoaded, MonoImage *, image) @@ -74,6 +83,7 @@ MONO_PROFILER_EVENT_1(exception_throw, ExceptionThrow, MonoObject *, exception) MONO_PROFILER_EVENT_4(exception_clause, ExceptionClause, MonoMethod *, method, uint32_t, index, MonoExceptionEnum, type, MonoObject *, exception) MONO_PROFILER_EVENT_2(gc_event, GCEvent, MonoProfilerGCEvent, event, uint32_t, generation) +MONO_PROFILER_EVENT_3(gc_event2, GCEvent2, MonoProfilerGCEvent, event, uint32_t, generation, mono_bool, is_serial) MONO_PROFILER_EVENT_1(gc_allocation, GCAllocation, MonoObject *, object) MONO_PROFILER_EVENT_2(gc_moves, GCMoves, MonoObject *const *, objects, uint64_t, count) MONO_PROFILER_EVENT_1(gc_resize, GCResize, uintptr_t, size) @@ -83,18 +93,9 @@ MONO_PROFILER_EVENT_0(gc_finalizing, GCFinalizing) MONO_PROFILER_EVENT_0(gc_finalized, GCFinalized) MONO_PROFILER_EVENT_1(gc_finalizing_object, GCFinalizingObject, MonoObject *, object) MONO_PROFILER_EVENT_1(gc_finalized_object, GCFinalizedObject, MonoObject *, object) - -/* - * This callback provides very low quality data and doesn't really match how - * roots are actually handled in the runtime. It will be replaced with a more - * sensible callback in the future. **This will be a breaking change.** - * - * In the meantime, you must define MONO_PROFILER_UNSTABLE_GC_ROOTS to be able - * to use this interface. - */ -#ifdef MONO_PROFILER_UNSTABLE_GC_ROOTS -MONO_PROFILER_EVENT_4(gc_roots, GCRoots, MonoObject *const *, roots, const MonoProfilerGCRootType *, types, const uintptr_t *, extra, uint64_t, count) -#endif +MONO_PROFILER_EVENT_5(gc_root_register, RootRegister, const mono_byte *, start, uintptr_t, size, MonoGCRootSource, source, const void *, key, const char *, name) +MONO_PROFILER_EVENT_1(gc_root_unregister, RootUnregister, const mono_byte *, start) +MONO_PROFILER_EVENT_3(gc_roots, GCRoots, uint64_t, count, const mono_byte *const *, addresses, MonoObject *const *, objects) MONO_PROFILER_EVENT_1(monitor_contention, MonitorContention, MonoObject *, object) MONO_PROFILER_EVENT_1(monitor_failed, MonitorFailed, MonoObject *, object) diff --git a/mono/metadata/profiler-private.h b/mono/metadata/profiler-private.h index 0a46667ca4..3c0fe896c4 100644 --- a/mono/metadata/profiler-private.h +++ b/mono/metadata/profiler-private.h @@ -8,7 +8,6 @@ #define __MONO_PROFILER_PRIVATE_H__ #include -#define MONO_PROFILER_UNSTABLE_GC_ROOTS #include #include #include @@ -33,12 +32,15 @@ struct _MonoProfilerDesc { _MONO_PROFILER_EVENT(name) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT }; @@ -78,12 +80,15 @@ typedef struct { _MONO_PROFILER_EVENT(name) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT } MonoProfilerState; @@ -150,12 +155,15 @@ mono_profiler_allocations_enabled (void) _MONO_PROFILER_EVENT(name, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name, arg5_type arg5_name) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT /* These are the macros the rest of the runtime should use. */ diff --git a/mono/metadata/profiler.c b/mono/metadata/profiler.c index 8a581a3066..c1850434cc 100644 --- a/mono/metadata/profiler.c +++ b/mono/metadata/profiler.c @@ -314,13 +314,12 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, coverage_unlock (); - MonoError error; - MonoMethodHeader *header = mono_method_get_header_checked (method, &error); - mono_error_assert_ok (&error); + MonoMethodHeaderSummary header; - guint32 size; + g_assert (mono_method_get_header_summary (method, &header)); - const unsigned char *start = mono_method_header_get_code (header, &size, NULL); + guint32 size = header.code_size; + const unsigned char *start = header.code; const unsigned char *end = start + size; MonoDebugMethodInfo *minfo = mono_debug_lookup_method (method); @@ -362,7 +361,6 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, g_free (sym_seq_points); g_ptr_array_free (source_file_list, TRUE); - mono_metadata_free_mh (header); return TRUE; } @@ -398,8 +396,6 @@ mono_profiler_get_coverage_data (MonoProfilerHandle handle, MonoMethod *method, } } - mono_metadata_free_mh (header); - return TRUE; } @@ -774,12 +770,15 @@ mono_profiler_cleanup (void) _MONO_PROFILER_EVENT(name) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT } @@ -795,12 +794,15 @@ mono_profiler_cleanup (void) _MONO_PROFILER_EVENT(name, type) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name, type) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name, type) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT MonoProfilerHandle head = mono_profiler_state.profilers; @@ -877,12 +879,15 @@ update_callback (volatile gpointer *location, gpointer new_, volatile gint32 *co _MONO_PROFILER_EVENT(name, type) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name, type) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name, type) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT #define _MONO_PROFILER_EVENT(name, type, params, args) \ @@ -905,12 +910,15 @@ update_callback (volatile gpointer *location, gpointer new_, volatile gint32 *co _MONO_PROFILER_EVENT(name, type, (arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name), (h->prof, arg1_name, arg2_name, arg3_name)) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name, type, (arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name), (h->prof, arg1_name, arg2_name, arg3_name, arg4_name)) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name, type, (arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name, arg5_type arg5_name), (h->prof, arg1_name, arg2_name, arg3_name, arg4_name, arg5_name)) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT /* diff --git a/mono/metadata/profiler.h b/mono/metadata/profiler.h index 596c668585..11ddd4b71d 100644 --- a/mono/metadata/profiler.h +++ b/mono/metadata/profiler.h @@ -112,24 +112,6 @@ MONO_API void *mono_profiler_call_context_get_local (MonoProfilerCallContext *co MONO_API void *mono_profiler_call_context_get_result (MonoProfilerCallContext *context); MONO_API void mono_profiler_call_context_free_buffer (void *buffer); -#ifdef MONO_PROFILER_UNSTABLE_GC_ROOTS -typedef enum { - /* Upper 2 bytes. */ - MONO_PROFILER_GC_ROOT_PINNING = 1 << 8, - MONO_PROFILER_GC_ROOT_WEAKREF = 2 << 8, - MONO_PROFILER_GC_ROOT_INTERIOR = 4 << 8, - - /* Lower 2 bytes (flags). */ - MONO_PROFILER_GC_ROOT_STACK = 1 << 0, - MONO_PROFILER_GC_ROOT_FINALIZER = 1 << 1, - MONO_PROFILER_GC_ROOT_HANDLE = 1 << 2, - MONO_PROFILER_GC_ROOT_OTHER = 1 << 3, - MONO_PROFILER_GC_ROOT_MISC = 1 << 4, - - MONO_PROFILER_GC_ROOT_TYPEMASK = 0xff, -} MonoProfilerGCRootType; -#endif - typedef enum { /** * The \c data parameter is a \c MonoMethod pointer. @@ -205,12 +187,15 @@ typedef enum { _MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(type, MonoProfiler *prof, arg1_type arg1_name, arg2_type arg2_name, arg3_type arg3_name, arg4_type arg4_name, arg5_type arg5_name) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT #define _MONO_PROFILER_EVENT(name, type) \ @@ -225,12 +210,15 @@ typedef enum { _MONO_PROFILER_EVENT(name, type) #define MONO_PROFILER_EVENT_4(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name) \ _MONO_PROFILER_EVENT(name, type) +#define MONO_PROFILER_EVENT_5(name, type, arg1_type, arg1_name, arg2_type, arg2_name, arg3_type, arg3_name, arg4_type, arg4_name, arg5_type, arg5_name) \ + _MONO_PROFILER_EVENT(name, type) #include #undef MONO_PROFILER_EVENT_0 #undef MONO_PROFILER_EVENT_1 #undef MONO_PROFILER_EVENT_2 #undef MONO_PROFILER_EVENT_3 #undef MONO_PROFILER_EVENT_4 +#undef MONO_PROFILER_EVENT_5 #undef _MONO_PROFILER_EVENT MONO_END_DECLS diff --git a/mono/metadata/rand.c b/mono/metadata/rand.c index 31eb980fab..6729f87481 100644 --- a/mono/metadata/rand.c +++ b/mono/metadata/rand.c @@ -36,10 +36,10 @@ ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (M gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry) { - 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); + mono_rand_try_get_bytes (&handle, mono_array_addr (arry, guchar, 0), mono_array_length (arry), error); + mono_error_set_pending_exception (error); return handle; } diff --git a/mono/metadata/reflection-cache.h b/mono/metadata/reflection-cache.h index bba3cda2d1..9fd05486f2 100644 --- a/mono/metadata/reflection-cache.h +++ b/mono/metadata/reflection-cache.h @@ -56,7 +56,7 @@ cache_object (MonoDomain *domain, MonoClass *klass, gpointer item, MonoObject* o mono_domain_lock (domain); if (!domain->refobject_hash) - domain->refobject_hash = mono_conc_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table"); + domain->refobject_hash = mono_conc_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, domain, "Domain Reflection Object Table"); obj = (MonoObject*) mono_conc_g_hash_table_lookup (domain->refobject_hash, &pe); if (obj == NULL) { @@ -80,7 +80,7 @@ cache_object_handle (MonoDomain *domain, MonoClass *klass, gpointer item, MonoOb mono_domain_lock (domain); if (!domain->refobject_hash) - domain->refobject_hash = mono_conc_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table"); + domain->refobject_hash = mono_conc_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, domain, "Domain Reflection Object Table"); MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_conc_g_hash_table_lookup (domain->refobject_hash, &pe)); if (MONO_HANDLE_IS_NULL (obj)) { diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 277076d6af..77b6940382 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -218,9 +218,9 @@ MonoReflectionAssembly* mono_assembly_get_object (MonoDomain *domain, MonoAssembly *assembly) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionAssemblyHandle result = mono_assembly_get_object_handle (domain, assembly, &error); - mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */ + ERROR_DECL (error); + MonoReflectionAssemblyHandle result = mono_assembly_get_object_handle (domain, assembly, error); + mono_error_cleanup (error); /* FIXME new API that doesn't swallow the error */ HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -255,9 +255,9 @@ MonoReflectionModule* mono_module_get_object (MonoDomain *domain, MonoImage *image) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionModuleHandle result = mono_module_get_object_handle (domain, image, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionModuleHandle result = mono_module_get_object_handle (domain, image, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -319,9 +319,9 @@ MonoReflectionModule* mono_module_file_get_object (MonoDomain *domain, MonoImage *image, int table_index) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionModuleHandle result = mono_module_file_get_object_handle (domain, image, table_index, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionModuleHandle result = mono_module_file_get_object_handle (domain, image, table_index, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -425,9 +425,9 @@ mono_type_normalize (MonoType *type) MonoReflectionType* mono_type_get_object (MonoDomain *domain, MonoType *type) { - MonoError error; - MonoReflectionType *ret = mono_type_get_object_checked (domain, type, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionType *ret = mono_type_get_object_checked (domain, type, error); + mono_error_cleanup (error); return ret; } @@ -472,7 +472,7 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err mono_domain_lock (domain); if (!domain->type_hash) domain->type_hash = mono_g_hash_table_new_type ((GHashFunc)mono_metadata_type_hash, - (GCompareFunc)mono_metadata_type_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection types table"); + (GCompareFunc)mono_metadata_type_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, domain, "Domain Reflection Type Table"); if ((res = (MonoReflectionType *)mono_g_hash_table_lookup (domain->type_hash, type))) { mono_domain_unlock (domain); mono_loader_unlock (); @@ -489,8 +489,11 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err norm_type = mono_type_normalize (type); if (norm_type != type) { res = mono_type_get_object_checked (domain, norm_type, error); - if (!mono_error_ok (error)) + if (!mono_error_ok (error)) { + mono_domain_unlock (domain); + mono_loader_unlock (); return NULL; + } mono_g_hash_table_insert (domain->type_hash, type, res); mono_domain_unlock (domain); mono_loader_unlock (); @@ -527,8 +530,11 @@ mono_type_get_object_checked (MonoDomain *domain, MonoType *type, MonoError *err } /* This is stored in vtables/JITted code so it has to be pinned */ res = (MonoReflectionType *)mono_object_new_pinned (domain, mono_defaults.runtimetype_class, error); - if (!mono_error_ok (error)) + if (!mono_error_ok (error)) { + mono_domain_unlock (domain); + mono_loader_unlock (); return NULL; + } res->type = type; mono_g_hash_table_insert (domain->type_hash, type, res); @@ -563,9 +569,9 @@ MonoReflectionMethod* mono_method_get_object (MonoDomain *domain, MonoMethod *method, MonoClass *refclass) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionMethodHandle ret = mono_method_get_object_handle (domain, method, refclass, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionMethodHandle ret = mono_method_get_object_handle (domain, method, refclass, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (ret); } @@ -677,9 +683,9 @@ MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionFieldHandle result = mono_field_get_object_handle (domain, klass, field, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionFieldHandle result = mono_field_get_object_handle (domain, klass, field, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -757,9 +763,9 @@ MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionPropertyHandle result = mono_property_get_object_handle (domain, klass, property, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionPropertyHandle result = mono_property_get_object_handle (domain, klass, property, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -822,9 +828,9 @@ MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionEventHandle result = mono_event_get_object_handle (domain, klass, event, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionEventHandle result = mono_event_get_object_handle (domain, klass, event, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -871,7 +877,7 @@ mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *e static MonoObjectHandle mono_get_reflection_missing_object (MonoDomain *domain) { - MonoError error; + ERROR_DECL (error); static MonoClassField *missing_value_field = NULL; if (!missing_value_field) { @@ -882,8 +888,8 @@ mono_get_reflection_missing_object (MonoDomain *domain) g_assert (missing_value_field); } /* FIXME change mono_field_get_value_object_checked to return a handle */ - MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_field_get_value_object_checked (domain, missing_value_field, NULL, &error)); - mono_error_assert_ok (&error); + MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_field_get_value_object_checked (domain, missing_value_field, NULL, error)); + mono_error_assert_ok (error); return obj; } @@ -1099,9 +1105,9 @@ MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoArrayHandle result = mono_param_get_objects_internal (domain, method, NULL, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + MonoArrayHandle result = mono_param_get_objects_internal (domain, method, NULL, error); + mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -1165,9 +1171,9 @@ MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoReflectionMethodBodyHandle result = mono_method_body_get_object_handle (domain, method, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoReflectionMethodBodyHandle result = mono_method_body_get_object_handle (domain, method, error); + mono_error_cleanup (error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -1289,9 +1295,9 @@ MonoObject * mono_get_dbnull_object (MonoDomain *domain) { HANDLE_FUNCTION_ENTER (); - MonoError error; - MonoObjectHandle obj = get_dbnull_object (domain, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + MonoObjectHandle obj = get_dbnull_object (domain, error); + mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_OBJ (obj); } @@ -1786,9 +1792,9 @@ mono_identifier_unescape_info (MonoTypeNameParse *info) int mono_reflection_parse_type (char *name, MonoTypeNameParse *info) { - MonoError error; - gboolean result = mono_reflection_parse_type_checked (name, info, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + gboolean result = mono_reflection_parse_type_checked (name, info, error); + mono_error_cleanup (error); return result ? 1 : 0; } @@ -2010,9 +2016,9 @@ leave: */ MonoType* mono_reflection_get_type (MonoImage* image, MonoTypeNameParse *info, gboolean ignorecase, gboolean *type_resolve) { - MonoError error; - MonoType *result = mono_reflection_get_type_with_rootimage (image, image, info, ignorecase, type_resolve, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + MonoType *result = mono_reflection_get_type_with_rootimage (image, image, info, ignorecase, type_resolve, error); + mono_error_cleanup (error); return result; } @@ -2139,7 +2145,7 @@ mono_reflection_get_type_with_rootimage (MonoImage *rootimage, MonoImage* image, for (mod = info->nested; mod; mod = mod->next) g_string_append_printf (fullName, "+%s", (char*)mod->data); - assembly = mono_domain_try_type_resolve_checked ( mono_domain_get (), fullName->str, NULL, error); + assembly = mono_domain_try_type_resolve_name ( mono_domain_get (), fullName->str, error); if (!is_ok (error)) { g_string_free (fullName, TRUE); return NULL; @@ -2195,9 +2201,12 @@ mono_reflection_free_type_info (MonoTypeNameParse *info) MonoType* mono_reflection_type_from_name (char *name, MonoImage *image) { - MonoError error; - MonoType *result = mono_reflection_type_from_name_checked (name, image, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + error_init (error); + + MonoType * const result = mono_reflection_type_from_name_checked (name, image, error); + + mono_error_cleanup (error); return result; } @@ -2222,7 +2231,7 @@ mono_reflection_type_from_name_checked (char *name, MonoImage *image, MonoError tmp = g_strdup (name); /*g_print ("requested type %s\n", str);*/ - MonoError parse_error; + ERROR_DECL_VALUE (parse_error); if (!mono_reflection_parse_type_checked (tmp, &info, &parse_error)) { mono_error_cleanup (&parse_error); goto leave; @@ -2244,9 +2253,9 @@ mono_reflection_get_token (MonoObject *obj_raw) { HANDLE_FUNCTION_ENTER (); MONO_HANDLE_DCL (MonoObject, obj); - MonoError error; - guint32 result = mono_reflection_get_token_checked (obj, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + guint32 result = mono_reflection_get_token_checked (obj, error); + mono_error_assert_ok (error); HANDLE_FUNCTION_RETURN_VAL (result); } @@ -2959,7 +2968,7 @@ mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass, Mono params [0] = mono_type_get_object_checked (mono_domain_get (), &oklass->byval_arg, error); return_val_if_nok (error, FALSE); - MonoError inner_error; + ERROR_DECL_VALUE (inner_error); res = mono_runtime_try_invoke (method, mono_class_get_ref_info_raw (klass), params, &exc, &inner_error); /* FIXME use handles */ if (exc || !is_ok (&inner_error)) { @@ -2979,9 +2988,9 @@ mono_reflection_type_get_type (MonoReflectionType *reftype) { g_assert (reftype); - MonoError error; - MonoType *result = mono_reflection_type_get_handle (reftype, &error); - mono_error_assert_ok (&error); + ERROR_DECL (error); + MonoType *result = mono_reflection_type_get_handle (reftype, error); + mono_error_assert_ok (error); return result; } diff --git a/mono/metadata/remoting.c b/mono/metadata/remoting.c index 73d7cfb698..65bca8cc8d 100644 --- a/mono/metadata/remoting.c +++ b/mono/metadata/remoting.c @@ -12,6 +12,7 @@ #include "config.h" #include "mono/metadata/handle.h" +#include "mono/metadata/method-builder-ilgen-internals.h" #include "mono/metadata/remoting.h" #include "mono/metadata/marshal.h" #include "mono/metadata/marshal-internals.h" @@ -233,15 +234,15 @@ mono_remoting_marshal_init (void) static MonoReflectionType * type_from_handle (MonoType *handle) { - MonoError error; + ERROR_DECL (error); MonoReflectionType *ret; MonoDomain *domain = mono_domain_get (); MonoClass *klass = mono_class_from_mono_type (handle); mono_class_init (klass); - ret = mono_type_get_object_checked (domain, handle, &error); - mono_error_set_pending_exception (&error); + ret = mono_type_get_object_checked (domain, handle, error); + mono_error_set_pending_exception (error); return ret; } @@ -373,7 +374,7 @@ mono_remoting_mb_create_and_cache (MonoMethod *key, MonoMethodBuilder *mb, static MonoObject * mono_remoting_wrapper (MonoMethod *method, gpointer *params) { - MonoError error; + ERROR_DECL (error); MonoMethodMessage *msg; MonoTransparentProxy *this_obj; MonoObject *res, *exc; @@ -402,8 +403,8 @@ mono_remoting_wrapper (MonoMethod *method, gpointer *params) } else { /* runtime_invoke expects a boxed instance */ if (mono_class_is_nullable (mono_class_from_mono_type (sig->params [i]))) { - mparams[i] = mono_nullable_box ((guint8 *)params [i], klass, &error); - goto_if_nok (&error, fail); + mparams[i] = mono_nullable_box ((guint8 *)params [i], klass, error); + goto_if_nok (error, fail); } else mparams[i] = params [i]; } @@ -412,31 +413,31 @@ mono_remoting_wrapper (MonoMethod *method, gpointer *params) } } - res = mono_runtime_invoke_checked (method, method->klass->valuetype? mono_object_unbox ((MonoObject*)this_obj): this_obj, mparams, &error); - goto_if_nok (&error, fail); + res = mono_runtime_invoke_checked (method, method->klass->valuetype? mono_object_unbox ((MonoObject*)this_obj): this_obj, mparams, error); + goto_if_nok (error, fail); return res; } - msg = mono_method_call_message_new (method, params, NULL, NULL, NULL, &error); - goto_if_nok (&error, fail); + msg = mono_method_call_message_new (method, params, NULL, NULL, NULL, error); + goto_if_nok (error, fail); - res = mono_remoting_invoke ((MonoObject *)this_obj->rp, msg, &exc, &out_args, &error); - goto_if_nok (&error, fail); + res = mono_remoting_invoke ((MonoObject *)this_obj->rp, msg, &exc, &out_args, error); + goto_if_nok (error, fail); if (exc) { - error_init (&error); + error_init (error); exc = (MonoObject*) mono_remoting_update_exception ((MonoException*)exc); - mono_error_set_exception_instance (&error, (MonoException *)exc); + mono_error_set_exception_instance (error, (MonoException *)exc); goto fail; } - mono_method_return_message_restore (method, params, out_args, &error); - goto_if_nok (&error, fail); + mono_method_return_message_restore (method, params, out_args, error); + goto_if_nok (error, fail); return res; fail: - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return NULL; } @@ -476,7 +477,7 @@ mono_remoting_update_exception (MonoException *exc) * mono_marshal_get_remoting_invoke: */ MonoMethod * -mono_marshal_get_remoting_invoke (MonoMethod *method) +mono_marshal_get_remoting_invoke (MonoMethod *method, MonoError *error) { MonoMethodSignature *sig; MonoMethodBuilder *mb; @@ -485,6 +486,7 @@ mono_marshal_get_remoting_invoke (MonoMethod *method) WrapperInfo *info; g_assert (method); + error_init (error); if (method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE || method->wrapper_type == MONO_WRAPPER_XDOMAIN_INVOKE) return method; @@ -492,8 +494,8 @@ mono_marshal_get_remoting_invoke (MonoMethod *method) /* this seems to be the best plase to put this, as all remoting invokes seem to get filtered through here */ #ifndef DISABLE_COM if (mono_class_is_com_object (method->klass) || method->klass == mono_class_try_get_com_object_class ()) { - MonoVTable *vtable = mono_class_vtable (mono_domain_get (), method->klass); - g_assert (vtable); /*FIXME do proper error handling*/ + MonoVTable *vtable = mono_class_vtable_checked (mono_domain_get (), method->klass, error); + return_val_if_nok (error, NULL); if (!mono_vtable_is_remote (vtable)) { return mono_cominterop_get_invoke (method); @@ -554,7 +556,7 @@ mono_marshal_get_remoting_invoke (MonoMethod *method) static void mono_marshal_xdomain_copy_out_value (MonoObject *src, MonoObject *dst) { - MonoError error; + ERROR_DECL (error); if (src == NULL || dst == NULL) return; g_assert (mono_object_class (src) == mono_object_class (dst)); @@ -568,8 +570,8 @@ mono_marshal_xdomain_copy_out_value (MonoObject *src, MonoObject *dst) int i, len = mono_array_length ((MonoArray *)dst); for (i = 0; i < len; i++) { MonoObject *item = (MonoObject *)mono_array_get ((MonoArray *)src, gpointer, i); - MonoObject *item_copy = mono_marshal_xdomain_copy_value (item, &error); - if (mono_error_set_pending_exception (&error)) + MonoObject *item_copy = mono_marshal_xdomain_copy_value (item, error); + if (mono_error_set_pending_exception (error)) return; mono_array_setref ((MonoArray *)dst, i, item_copy); } @@ -639,9 +641,9 @@ mono_marshal_emit_switch_domain (MonoMethodBuilder *mb) gpointer mono_compile_method_icall (MonoMethod *method) { - MonoError error; - gpointer result = mono_compile_method_checked (method, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + gpointer result = mono_compile_method_checked (method, error); + mono_error_set_pending_exception (error); return result; } @@ -956,7 +958,7 @@ mono_marshal_get_xappdomain_dispatch (MonoMethod *method, int *marshal_types, in * Generates a fast remoting wrapper for cross app domain calls. */ MonoMethod * -mono_marshal_get_xappdomain_invoke (MonoMethod *method) +mono_marshal_get_xappdomain_invoke (MonoMethod *method, MonoError *error) { MonoMethodSignature *sig; MonoMethodBuilder *mb; @@ -973,6 +975,7 @@ mono_marshal_get_xappdomain_invoke (MonoMethod *method) WrapperInfo *info; g_assert (method); + error_init (error); if (method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE || method->wrapper_type == MONO_WRAPPER_XDOMAIN_INVOKE) return method; @@ -984,7 +987,7 @@ mono_marshal_get_xappdomain_invoke (MonoMethod *method) mono_remoting_marshal_init (); if (!mono_marshal_supports_fast_xdomain (method)) - return mono_marshal_get_remoting_invoke (method); + return mono_marshal_get_remoting_invoke (method, error); if ((res = mono_marshal_remoting_find_in_cache (method, MONO_WRAPPER_XDOMAIN_INVOKE))) return res; @@ -1077,7 +1080,12 @@ mono_marshal_get_xappdomain_invoke (MonoMethod *method) for (i = 0; i < sig->param_count; i++) mono_mb_emit_ldarg (mb, i + 1); - mono_mb_emit_managed_call (mb, mono_marshal_get_remoting_invoke (method), NULL); + MonoMethod * remoting_invoke_method = mono_marshal_get_remoting_invoke (method, error); + if (!is_ok (error)) { + mono_mb_free (mb); + return NULL; + } + mono_mb_emit_managed_call (mb, remoting_invoke_method, NULL); mono_mb_emit_byte (mb, CEE_RET); mono_mb_patch_short_branch (mb, pos_dispatch); @@ -1286,10 +1294,11 @@ mono_marshal_get_xappdomain_invoke (MonoMethod *method) * mono_marshal_get_remoting_invoke_for_target: */ MonoMethod * -mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type) +mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type, MonoError *error) { + error_init (error); if (target_type == MONO_REMOTING_TARGET_APPDOMAIN) { - return mono_marshal_get_xappdomain_invoke (method); + return mono_marshal_get_xappdomain_invoke (method, error); } else if (target_type == MONO_REMOTING_TARGET_COMINTEROP) { #ifndef DISABLE_COM return mono_cominterop_get_invoke (method); @@ -1297,7 +1306,7 @@ mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTar g_assert_not_reached (); #endif } else { - return mono_marshal_get_remoting_invoke (method); + return mono_marshal_get_remoting_invoke (method, error); } /* Not erached */ return NULL; @@ -1306,14 +1315,15 @@ mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTar G_GNUC_UNUSED static gpointer mono_marshal_load_remoting_wrapper (MonoRealProxy *rp, MonoMethod *method) { - MonoError error; + ERROR_DECL (error); MonoMethod *marshal_method = NULL; if (rp->target_domain_id != -1) - marshal_method = mono_marshal_get_xappdomain_invoke (method); + marshal_method = mono_marshal_get_xappdomain_invoke (method, error); else - marshal_method = mono_marshal_get_remoting_invoke (method); - gpointer compiled_ptr = mono_compile_method_checked (marshal_method, &error); - mono_error_assert_ok (&error); + marshal_method = mono_marshal_get_remoting_invoke (method, error); + mono_error_assert_ok (error); + gpointer compiled_ptr = mono_compile_method_checked (marshal_method, error); + mono_error_assert_ok (error); return compiled_ptr; } @@ -1321,7 +1331,7 @@ mono_marshal_load_remoting_wrapper (MonoRealProxy *rp, MonoMethod *method) * mono_marshal_get_remoting_invoke_with_check: */ MonoMethod * -mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) +mono_marshal_get_remoting_invoke_with_check (MonoMethod *method, MonoError *error) { MonoMethodSignature *sig; MonoMethodBuilder *mb; @@ -1330,6 +1340,7 @@ mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) int i, pos, pos_rem; g_assert (method); + error_init (error); if (method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK) return method; @@ -1356,14 +1367,22 @@ mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) pos_rem = mono_mb_emit_xdomain_check (mb, CEE_BEQ); /* wrapper for cross app domain calls */ - native = mono_marshal_get_xappdomain_invoke (method); + native = mono_marshal_get_xappdomain_invoke (method, error); + if (!is_ok (error)) { + mono_mb_free (mb); + return NULL; + } mono_mb_emit_managed_call (mb, native, mono_method_signature (native)); mono_mb_emit_byte (mb, CEE_RET); mono_mb_patch_branch (mb, pos_rem); } /* wrapper for normal remote calls */ - native = mono_marshal_get_remoting_invoke (method); + native = mono_marshal_get_remoting_invoke (method, error); + if (!is_ok (error)) { + mono_mb_free (mb); + return NULL; + } mono_mb_emit_managed_call (mb, native, mono_method_signature (native)); mono_mb_emit_byte (mb, CEE_RET); @@ -1597,6 +1616,8 @@ mono_marshal_get_ldflda_wrapper (MonoType *type) if ((res = mono_marshal_find_in_cache (cache, klass))) return res; + mono_remoting_marshal_init (); + /* we add the %p pointer value of klass because class names are not unique */ name = g_strdup_printf ("__ldflda_wrapper_%p_%s.%s", klass, klass->name_space, klass->name); mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_LDFLDA); @@ -1917,7 +1938,7 @@ mono_upgrade_remote_class_wrapper (MonoReflectionType *rtype_raw, MonoTransparen MONO_HANDLE_DCL (MonoTransparentProxy, tproxy); MonoDomain *domain = MONO_HANDLE_DOMAIN (tproxy); MonoClass *klass = mono_class_from_mono_type (MONO_HANDLE_GETVAL (rtype, type)); - mono_upgrade_remote_class (domain, MONO_HANDLE_CAST (MonoObject, tproxy), klass, &error); + mono_upgrade_remote_class (domain, MONO_HANDLE_CAST (MonoObject, tproxy), klass, error); ICALL_RETURN (); } @@ -2081,9 +2102,9 @@ mono_marshal_xdomain_copy_value (MonoObject* val_raw, MonoError *error) MonoObject * ves_icall_mono_marshal_xdomain_copy_value (MonoObject *val) { - MonoError error; - MonoObject *result = mono_marshal_xdomain_copy_value (val, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + MonoObject *result = mono_marshal_xdomain_copy_value (val, error); + mono_error_set_pending_exception (error); return result; } diff --git a/mono/metadata/remoting.h b/mono/metadata/remoting.h index aeeb4bb8a4..856b3d4f16 100644 --- a/mono/metadata/remoting.h +++ b/mono/metadata/remoting.h @@ -19,16 +19,16 @@ void mono_remoting_init (void); #ifndef DISABLE_REMOTING MonoMethod * -mono_marshal_get_remoting_invoke (MonoMethod *method); +mono_marshal_get_remoting_invoke (MonoMethod *method, MonoError *error); MonoMethod * -mono_marshal_get_xappdomain_invoke (MonoMethod *method); +mono_marshal_get_xappdomain_invoke (MonoMethod *method, MonoError *error); MonoMethod * -mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type); +mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type, MonoError *error); MonoMethod * -mono_marshal_get_remoting_invoke_with_check (MonoMethod *method); +mono_marshal_get_remoting_invoke_with_check (MonoMethod *method, MonoError *error); MonoMethod * mono_marshal_get_stfld_wrapper (MonoType *type); diff --git a/mono/metadata/runtime.c b/mono/metadata/runtime.c index e0edcfa7b2..188c1bc761 100644 --- a/mono/metadata/runtime.c +++ b/mono/metadata/runtime.c @@ -54,7 +54,7 @@ mono_runtime_is_shutting_down (void) static void fire_process_exit_event (MonoDomain *domain, gpointer user_data) { - MonoError error; + ERROR_DECL (error); MonoClassField *field; gpointer pa [2]; MonoObject *delegate, *exc; @@ -68,8 +68,8 @@ fire_process_exit_event (MonoDomain *domain, gpointer user_data) pa [0] = domain; pa [1] = NULL; - mono_runtime_delegate_try_invoke (delegate, pa, &exc, &error); - mono_error_cleanup (&error); + mono_runtime_delegate_try_invoke (delegate, pa, &exc, error); + mono_error_cleanup (error); } static void diff --git a/mono/metadata/security-core-clr.c b/mono/metadata/security-core-clr.c index 3498ef3c57..e81cadc460 100644 --- a/mono/metadata/security-core-clr.c +++ b/mono/metadata/security-core-clr.c @@ -515,13 +515,13 @@ check_field_access (MonoMethod *caller, MonoClassField *field) { /* if get_reflection_caller returns NULL then we assume the caller has NO privilege */ if (caller) { - MonoError error; + ERROR_DECL (error); MonoClass *klass; /* this check can occur before the field's type is resolved (and that can fail) */ - mono_field_get_type_checked (field, &error); - if (!mono_error_ok (&error)) { - mono_error_cleanup (&error); + mono_field_get_type_checked (field, error); + if (!mono_error_ok (error)) { + mono_error_cleanup (error); return FALSE; } @@ -935,10 +935,10 @@ mono_security_core_clr_level_from_cinfo (MonoCustomAttrInfo *cinfo, MonoImage *i static MonoSecurityCoreCLRLevel mono_security_core_clr_class_level_no_platform_check (MonoClass *klass) { - MonoError error; + ERROR_DECL (error); MonoSecurityCoreCLRLevel level = MONO_SECURITY_CORE_CLR_TRANSPARENT; - MonoCustomAttrInfo *cinfo = mono_custom_attrs_from_class_checked (klass, &error); - mono_error_cleanup (&error); + MonoCustomAttrInfo *cinfo = mono_custom_attrs_from_class_checked (klass, error); + mono_error_cleanup (error); if (cinfo) { level = mono_security_core_clr_level_from_cinfo (cinfo, klass->image); mono_custom_attrs_free (cinfo); @@ -976,7 +976,7 @@ mono_security_core_clr_class_level (MonoClass *klass) MonoSecurityCoreCLRLevel mono_security_core_clr_field_level (MonoClassField *field, gboolean with_class_level) { - MonoError error; + ERROR_DECL (error); MonoCustomAttrInfo *cinfo; MonoSecurityCoreCLRLevel level = MONO_SECURITY_CORE_CLR_TRANSPARENT; @@ -988,8 +988,8 @@ mono_security_core_clr_field_level (MonoClassField *field, gboolean with_class_l if (!mono_security_core_clr_test && !mono_security_core_clr_is_platform_image (field->parent->image)) return level; - cinfo = mono_custom_attrs_from_field_checked (field->parent, field, &error); - mono_error_cleanup (&error); + cinfo = mono_custom_attrs_from_field_checked (field->parent, field, error); + mono_error_cleanup (error); if (cinfo) { level = mono_security_core_clr_level_from_cinfo (cinfo, field->parent->image); mono_custom_attrs_free (cinfo); @@ -1012,7 +1012,7 @@ mono_security_core_clr_field_level (MonoClassField *field, gboolean with_class_l MonoSecurityCoreCLRLevel mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level) { - MonoError error; + ERROR_DECL (error); MonoCustomAttrInfo *cinfo; MonoSecurityCoreCLRLevel level = MONO_SECURITY_CORE_CLR_TRANSPARENT; @@ -1024,8 +1024,8 @@ mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_lev if (!mono_security_core_clr_test && !mono_security_core_clr_is_platform_image (method->klass->image)) return level; - cinfo = mono_custom_attrs_from_method_checked (method, &error); - mono_error_cleanup (&error); + cinfo = mono_custom_attrs_from_method_checked (method, error); + mono_error_cleanup (error); if (cinfo) { level = mono_security_core_clr_level_from_cinfo (cinfo, method->klass->image); mono_custom_attrs_free (cinfo); diff --git a/mono/metadata/sgen-client-mono.h b/mono/metadata/sgen-client-mono.h index 02dad81d66..a5af82696c 100644 --- a/mono/metadata/sgen-client-mono.h +++ b/mono/metadata/sgen-client-mono.h @@ -77,6 +77,7 @@ struct _SgenClientThreadInfo { extern void mono_sgen_register_moved_object (void *obj, void *destination); extern void mono_sgen_gc_event_moves (void); +extern void mono_sgen_gc_event_resize (void); extern void mono_sgen_init_stw (void); @@ -288,28 +289,11 @@ sgen_client_binary_protocol_collection_requested (int generation, size_t request MONO_GC_REQUESTED (generation, requested_size, force); } -static void G_GNUC_UNUSED -sgen_client_binary_protocol_collection_begin (int minor_gc_count, int generation) -{ - MONO_GC_BEGIN (generation); +void +sgen_client_binary_protocol_collection_begin (int minor_gc_count, int generation); - MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_START, generation)); - -#ifndef DISABLE_PERFCOUNTERS - if (generation == GENERATION_NURSERY) - mono_atomic_inc_i32 (&mono_perfcounters->gc_collections0); - else - mono_atomic_inc_i32 (&mono_perfcounters->gc_collections1); -#endif -} - -static void G_GNUC_UNUSED -sgen_client_binary_protocol_collection_end (int minor_gc_count, int generation, long long num_objects_scanned, long long num_unique_objects_scanned) -{ - MONO_GC_END (generation); - - MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_END, generation)); -} +void +sgen_client_binary_protocol_collection_end (int minor_gc_count, int generation, long long num_objects_scanned, long long num_unique_objects_scanned); static void G_GNUC_UNUSED sgen_client_binary_protocol_concurrent_start (void) @@ -686,6 +670,18 @@ sgen_client_binary_protocol_pin_stats (int objects_pinned_in_nursery, size_t byt { } +static void G_GNUC_UNUSED +sgen_client_root_registered (char *start, size_t size, int source, void *key, const char *msg) +{ + MONO_PROFILER_RAISE (gc_root_register, ((const mono_byte *) start, size, source, key, msg)); +} + +static void G_GNUC_UNUSED +sgen_client_root_deregistered (char *start) +{ + MONO_PROFILER_RAISE (gc_root_unregister, ((const mono_byte *) start)); +} + static void G_GNUC_UNUSED sgen_client_binary_protocol_worker_finish_stats (int worker_index, int generation, gboolean forced, long long major_scan, long long los_scan, long long work_time) { diff --git a/mono/metadata/sgen-mono-ilgen.c b/mono/metadata/sgen-mono-ilgen.c new file mode 100644 index 0000000000..fd0712cfca --- /dev/null +++ b/mono/metadata/sgen-mono-ilgen.c @@ -0,0 +1,545 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#include "config.h" +#ifdef HAVE_SGEN_GC + +#include "metadata/method-builder.h" +#include "metadata/method-builder-ilgen.h" +#include "metadata/method-builder-ilgen-internals.h" +#include "sgen/sgen-gc.h" +#include "sgen/sgen-protocol.h" +#include "metadata/monitor.h" +#include "sgen/sgen-layout-stats.h" +#include "sgen/sgen-client.h" +#include "sgen/sgen-cardtable.h" +#include "sgen/sgen-pinning.h" +#include "sgen/sgen-workers.h" +#include "metadata/marshal.h" +#include "metadata/abi-details.h" +#include "metadata/mono-gc.h" +#include "metadata/runtime.h" +#include "metadata/sgen-bridge-internals.h" +#include "metadata/sgen-mono.h" +#include "metadata/sgen-mono-ilgen.h" +#include "metadata/gc-internals.h" +#include "metadata/handle.h" +#include "utils/mono-memory-model.h" +#include "utils/mono-logger-internals.h" +#include "utils/mono-threads-coop.h" +#include "utils/mono-threads.h" +#include "metadata/w32handle.h" + +#define OPDEF(a,b,c,d,e,f,g,h,i,j) \ + a = i, + +enum { +#include "mono/cil/opcode.def" + CEE_LAST +}; + +#undef OPDEF + +#ifdef MANAGED_ALLOCATION +// Cache the SgenThreadInfo pointer in a local 'var'. +#define EMIT_TLS_ACCESS_VAR(mb, var) \ + do { \ + var = mono_mb_add_local ((mb), &mono_defaults.int_class->byval_arg); \ + mono_mb_emit_byte ((mb), MONO_CUSTOM_PREFIX); \ + mono_mb_emit_byte ((mb), CEE_MONO_TLS); \ + mono_mb_emit_i4 ((mb), TLS_KEY_SGEN_THREAD_INFO); \ + mono_mb_emit_stloc ((mb), (var)); \ + } while (0) + +#define EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR(mb, var) \ + do { \ + mono_mb_emit_ldloc ((mb), (var)); \ + mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenClientThreadInfo, in_critical_region)); \ + mono_mb_emit_byte ((mb), CEE_ADD); \ + } while (0) + +#define EMIT_TLS_ACCESS_NEXT_ADDR(mb, var) do { \ + mono_mb_emit_ldloc ((mb), (var)); \ + mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenThreadInfo, tlab_next)); \ + mono_mb_emit_byte ((mb), CEE_ADD); \ + } while (0) + +#define EMIT_TLS_ACCESS_TEMP_END(mb, var) do { \ + mono_mb_emit_ldloc ((mb), (var)); \ + mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenThreadInfo, tlab_temp_end)); \ + mono_mb_emit_byte ((mb), CEE_ADD); \ + mono_mb_emit_byte ((mb), CEE_LDIND_I); \ + } while (0) +#endif + +static void +emit_nursery_check (MonoMethodBuilder *mb, int *nursery_check_return_labels, gboolean is_concurrent) +{ + int shifted_nursery_start = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + + memset (nursery_check_return_labels, 0, sizeof (int) * 2); + // if (ptr_in_nursery (ptr)) return; + /* + * Masking out the bits might be faster, but we would have to use 64 bit + * immediates, which might be slower. + */ + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_START); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_BITS); + mono_mb_emit_byte (mb, CEE_SHR_UN); + mono_mb_emit_stloc (mb, shifted_nursery_start); + + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_BITS); + mono_mb_emit_byte (mb, CEE_SHR_UN); + mono_mb_emit_ldloc (mb, shifted_nursery_start); + nursery_check_return_labels [0] = mono_mb_emit_branch (mb, CEE_BEQ); + + if (!is_concurrent) { + // if (!ptr_in_nursery (*ptr)) return; + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_byte (mb, CEE_LDIND_I); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_BITS); + mono_mb_emit_byte (mb, CEE_SHR_UN); + mono_mb_emit_ldloc (mb, shifted_nursery_start); + nursery_check_return_labels [1] = mono_mb_emit_branch (mb, CEE_BNE_UN); + } +} + +static void +emit_nursery_check_ilgen (MonoMethodBuilder *mb, gboolean is_concurrent) +{ +#ifdef MANAGED_WBARRIER + int i, nursery_check_labels [2]; + emit_nursery_check (mb, nursery_check_labels, is_concurrent); + /* + addr = sgen_cardtable + ((address >> CARD_BITS) & CARD_MASK) + *addr = 1; + + sgen_cardtable: + LDC_PTR sgen_cardtable + + address >> CARD_BITS + LDARG_0 + LDC_I4 CARD_BITS + SHR_UN + if (SGEN_HAVE_OVERLAPPING_CARDS) { + LDC_PTR card_table_mask + AND + } + AND + ldc_i4_1 + stind_i1 + */ + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDPTR_CARD_TABLE); + mono_mb_emit_ldarg (mb, 0); + 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 + mono_mb_emit_icon8 (mb, CARD_MASK); +#else + mono_mb_emit_icon (mb, CARD_MASK); +#endif + mono_mb_emit_byte (mb, CEE_CONV_I); + mono_mb_emit_byte (mb, CEE_AND); +#endif + mono_mb_emit_byte (mb, CEE_ADD); + mono_mb_emit_icon (mb, 1); + mono_mb_emit_byte (mb, CEE_STIND_I1); + + // return; + for (i = 0; i < 2; ++i) { + if (nursery_check_labels [i]) + mono_mb_patch_branch (mb, nursery_check_labels [i]); + } + mono_mb_emit_byte (mb, CEE_RET); +#else + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_icall (mb, mono_gc_wbarrier_generic_nostore); + mono_mb_emit_byte (mb, CEE_RET); +#endif +} + +static void +emit_managed_allocater_ilgen (MonoMethodBuilder *mb, gboolean slowpath, gboolean profiler, int atype) +{ + int p_var, size_var, real_size_var, thread_var G_GNUC_UNUSED; + int tlab_next_addr_var, new_next_var; + guint32 fastpath_branch, max_size_branch, no_oom_branch; + + if (slowpath) { + switch (atype) { + case ATYPE_NORMAL: + case ATYPE_SMALL: + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_icall (mb, ves_icall_object_new_specific); + break; + case ATYPE_VECTOR: + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icall (mb, ves_icall_array_new_specific); + break; + case ATYPE_STRING: + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icall (mb, ves_icall_string_alloc); + break; + default: + g_assert_not_reached (); + } + + goto done; + } + + /* + * Tls access might call foreign code or code without jinfo. This can + * only happen if we are outside of the critical region. + */ + EMIT_TLS_ACCESS_VAR (mb, thread_var); + + size_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + if (atype == ATYPE_SMALL) { + /* size_var = size_arg */ + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_stloc (mb, size_var); + } else if (atype == ATYPE_NORMAL) { + /* size = vtable->klass->instance_size; */ + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoVTable, klass)); + mono_mb_emit_byte (mb, CEE_ADD); + mono_mb_emit_byte (mb, CEE_LDIND_I); + mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoClass, instance_size)); + mono_mb_emit_byte (mb, CEE_ADD); + /* FIXME: assert instance_size stays a 4 byte integer */ + mono_mb_emit_byte (mb, CEE_LDIND_U4); + mono_mb_emit_byte (mb, CEE_CONV_I); + mono_mb_emit_stloc (mb, size_var); + } else if (atype == ATYPE_VECTOR) { + MonoExceptionClause *clause; + int pos, pos_leave, pos_error; + MonoClass *oom_exc_class; + MonoMethod *ctor; + + /* + * n > MONO_ARRAY_MAX_INDEX => OutOfMemoryException + * n < 0 => OverflowException + * + * We can do an unsigned comparison to catch both cases, then in the error + * case compare signed to distinguish between them. + */ + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icon (mb, MONO_ARRAY_MAX_INDEX); + mono_mb_emit_byte (mb, CEE_CONV_U); + pos = mono_mb_emit_short_branch (mb, CEE_BLE_UN_S); + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icon (mb, 0); + pos_error = mono_mb_emit_short_branch (mb, CEE_BLT_S); + mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); + mono_mb_patch_short_branch (mb, pos_error); + mono_mb_emit_exception (mb, "OverflowException", NULL); + + mono_mb_patch_short_branch (mb, pos); + + clause = (MonoExceptionClause *)mono_image_alloc0 (mono_defaults.corlib, sizeof (MonoExceptionClause)); + clause->try_offset = mono_mb_get_label (mb); + + /* vtable->klass->sizes.element_size */ + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoVTable, klass)); + mono_mb_emit_byte (mb, CEE_ADD); + mono_mb_emit_byte (mb, CEE_LDIND_I); + mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoClass, sizes)); + mono_mb_emit_byte (mb, CEE_ADD); + mono_mb_emit_byte (mb, CEE_LDIND_U4); + mono_mb_emit_byte (mb, CEE_CONV_I); + + /* * n */ + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_byte (mb, CEE_MUL_OVF_UN); + /* + sizeof (MonoArray) */ + mono_mb_emit_icon (mb, MONO_SIZEOF_MONO_ARRAY); + mono_mb_emit_byte (mb, CEE_ADD_OVF_UN); + mono_mb_emit_stloc (mb, size_var); + + pos_leave = mono_mb_emit_branch (mb, CEE_LEAVE); + + /* catch */ + clause->flags = MONO_EXCEPTION_CLAUSE_NONE; + clause->try_len = mono_mb_get_pos (mb) - clause->try_offset; + clause->data.catch_class = mono_class_load_from_name (mono_defaults.corlib, + "System", "OverflowException"); + clause->handler_offset = mono_mb_get_label (mb); + + 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); + g_assert (ctor); + + mono_mb_emit_byte (mb, CEE_POP); + mono_mb_emit_op (mb, CEE_NEWOBJ, ctor); + mono_mb_emit_byte (mb, CEE_THROW); + + clause->handler_len = mono_mb_get_pos (mb) - clause->handler_offset; + mono_mb_set_clauses (mb, 1, clause); + mono_mb_patch_branch (mb, pos_leave); + /* end catch */ + } else if (atype == ATYPE_STRING) { + int pos; + + /* + * a string allocator method takes the args: (vtable, len) + * + * bytes = offsetof (MonoString, chars) + ((len + 1) * 2) + * + * condition: + * + * bytes <= INT32_MAX - (SGEN_ALLOC_ALIGN - 1) + * + * therefore: + * + * offsetof (MonoString, chars) + ((len + 1) * 2) <= INT32_MAX - (SGEN_ALLOC_ALIGN - 1) + * len <= (INT32_MAX - (SGEN_ALLOC_ALIGN - 1) - offsetof (MonoString, chars)) / 2 - 1 + */ + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icon (mb, (INT32_MAX - (SGEN_ALLOC_ALIGN - 1) - MONO_STRUCT_OFFSET (MonoString, chars)) / 2 - 1); + pos = mono_mb_emit_short_branch (mb, MONO_CEE_BLE_UN_S); + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); + mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); + mono_mb_patch_short_branch (mb, pos); + + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icon (mb, 1); + mono_mb_emit_byte (mb, MONO_CEE_SHL); + //WE manually fold the above + 2 here + mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoString, chars) + 2); + mono_mb_emit_byte (mb, CEE_ADD); + mono_mb_emit_stloc (mb, size_var); + } else { + g_assert_not_reached (); + } + +#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION + EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var); + mono_mb_emit_byte (mb, CEE_LDC_I4_1); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4); + mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE); +#endif + + if (nursery_canaries_enabled ()) { + real_size_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + mono_mb_emit_ldloc (mb, size_var); + mono_mb_emit_stloc(mb, real_size_var); + } + else + real_size_var = size_var; + + /* size += ALLOC_ALIGN - 1; */ + mono_mb_emit_ldloc (mb, size_var); + mono_mb_emit_icon (mb, SGEN_ALLOC_ALIGN - 1); + mono_mb_emit_byte (mb, CEE_ADD); + /* size &= ~(ALLOC_ALIGN - 1); */ + mono_mb_emit_icon (mb, ~(SGEN_ALLOC_ALIGN - 1)); + mono_mb_emit_byte (mb, CEE_AND); + mono_mb_emit_stloc (mb, size_var); + + /* if (size > MAX_SMALL_OBJ_SIZE) goto slowpath */ + if (atype != ATYPE_SMALL) { + mono_mb_emit_ldloc (mb, size_var); + mono_mb_emit_icon (mb, SGEN_MAX_SMALL_OBJ_SIZE); + max_size_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BGT_UN_S); + } + + /* + * We need to modify tlab_next, but the JIT only supports reading, so we read + * another tls var holding its address instead. + */ + + /* tlab_next_addr (local) = tlab_next_addr (TLS var) */ + tlab_next_addr_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + EMIT_TLS_ACCESS_NEXT_ADDR (mb, thread_var); + mono_mb_emit_stloc (mb, tlab_next_addr_var); + + /* p = (void**)tlab_next; */ + p_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + mono_mb_emit_ldloc (mb, tlab_next_addr_var); + mono_mb_emit_byte (mb, CEE_LDIND_I); + mono_mb_emit_stloc (mb, p_var); + + /* new_next = (char*)p + size; */ + new_next_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); + mono_mb_emit_ldloc (mb, p_var); + mono_mb_emit_ldloc (mb, size_var); + mono_mb_emit_byte (mb, CEE_CONV_I); + mono_mb_emit_byte (mb, CEE_ADD); + + if (nursery_canaries_enabled ()) { + mono_mb_emit_icon (mb, CANARY_SIZE); + mono_mb_emit_byte (mb, CEE_ADD); + } + mono_mb_emit_stloc (mb, new_next_var); + + /* if (G_LIKELY (new_next < tlab_temp_end)) */ + mono_mb_emit_ldloc (mb, new_next_var); + EMIT_TLS_ACCESS_TEMP_END (mb, thread_var); + fastpath_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BLT_UN_S); + + /* Slowpath */ + if (atype != ATYPE_SMALL) + mono_mb_patch_short_branch (mb, max_size_branch); + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); + /* + * We are no longer in a critical section. We need to do this before calling + * to unmanaged land in order to avoid stw deadlocks since unmanaged code + * might take locks. + */ +#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION + EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var); + mono_mb_emit_byte (mb, CEE_LDC_I4_0); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4); + mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE); +#endif + + /* FIXME: mono_gc_alloc_obj takes a 'size_t' as an argument, not an int32 */ + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_ldloc (mb, real_size_var); + if (atype == ATYPE_NORMAL || atype == ATYPE_SMALL) { + mono_mb_emit_icall (mb, mono_gc_alloc_obj); + } else if (atype == ATYPE_VECTOR) { + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icall (mb, mono_gc_alloc_vector); + } else if (atype == ATYPE_STRING) { + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_icall (mb, mono_gc_alloc_string); + } else { + g_assert_not_reached (); + } + + /* if (ret == NULL) throw OOM; */ + mono_mb_emit_byte (mb, CEE_DUP); + no_oom_branch = mono_mb_emit_branch (mb, CEE_BRTRUE); + mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); + + mono_mb_patch_branch (mb, no_oom_branch); + mono_mb_emit_byte (mb, CEE_RET); + + /* Fastpath */ + mono_mb_patch_short_branch (mb, fastpath_branch); + + /* FIXME: Memory barrier */ + + /* tlab_next = new_next */ + mono_mb_emit_ldloc (mb, tlab_next_addr_var); + mono_mb_emit_ldloc (mb, new_next_var); + mono_mb_emit_byte (mb, CEE_STIND_I); + + /* *p = vtable; */ + mono_mb_emit_ldloc (mb, p_var); + mono_mb_emit_ldarg (mb, 0); + mono_mb_emit_byte (mb, CEE_STIND_I); + + /* mark object end with nursery word */ + if (nursery_canaries_enabled ()) { + mono_mb_emit_ldloc (mb, p_var); + mono_mb_emit_ldloc (mb, real_size_var); + mono_mb_emit_byte (mb, MONO_CEE_ADD); + mono_mb_emit_icon8 (mb, (mword) CANARY_STRING); + mono_mb_emit_icon (mb, CANARY_SIZE); + mono_mb_emit_byte (mb, MONO_CEE_PREFIX1); + mono_mb_emit_byte (mb, CEE_CPBLK); + } + + if (atype == ATYPE_VECTOR) { + /* arr->max_length = max_length; */ + mono_mb_emit_ldloc (mb, p_var); + mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoArray, max_length)); + mono_mb_emit_ldarg (mb, 1); +#ifdef MONO_BIG_ARRAYS + mono_mb_emit_byte (mb, CEE_STIND_I); +#else + mono_mb_emit_byte (mb, CEE_STIND_I4); +#endif + } else if (atype == ATYPE_STRING) { + /* need to set length and clear the last char */ + /* s->length = len; */ + mono_mb_emit_ldloc (mb, p_var); + mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoString, length)); + mono_mb_emit_byte (mb, MONO_CEE_ADD); + mono_mb_emit_ldarg (mb, 1); + mono_mb_emit_byte (mb, MONO_CEE_STIND_I4); + } + +#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION + EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var); + mono_mb_emit_byte (mb, CEE_LDC_I4_0); + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4); +#else + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_MEMORY_BARRIER); +#endif + /* + We must make sure both vtable and max_length are globaly visible before returning to managed land. + */ + mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_REL); + + /* return p */ + mono_mb_emit_ldloc (mb, p_var); + + done: + + /* + * It's important that we do this outside of the critical region as we + * will be invoking arbitrary code. + */ + if (profiler) { + /* + * if (G_UNLIKELY (*&mono_profiler_state.gc_allocation_count)) { + * mono_profiler_raise_gc_allocation (p); + * } + */ + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_LDPTR_PROFILER_ALLOCATION_COUNT); + mono_mb_emit_byte (mb, CEE_LDIND_U4); + + int prof_br = mono_mb_emit_short_branch (mb, CEE_BRFALSE_S); + + mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); + mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); + mono_mb_emit_byte (mb, CEE_DUP); + mono_mb_emit_icall (mb, mono_profiler_raise_gc_allocation); + + mono_mb_patch_short_branch (mb, prof_br); + } + + mono_mb_emit_byte (mb, CEE_RET); + mb->init_locals = FALSE; +} + +void +mono_sgen_mono_ilgen_init (void) +{ + MonoSgenMonoCallbacks cb; + cb.version = MONO_SGEN_MONO_CALLBACKS_VERSION; + cb.emit_nursery_check = emit_nursery_check_ilgen; + cb.emit_managed_allocater = emit_managed_allocater_ilgen; + mono_install_sgen_mono_callbacks (&cb); +} +#endif + diff --git a/mono/metadata/sgen-mono-ilgen.h b/mono/metadata/sgen-mono-ilgen.h new file mode 100644 index 0000000000..f7200d330d --- /dev/null +++ b/mono/metadata/sgen-mono-ilgen.h @@ -0,0 +1,13 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_SGEN_MONO_ILGEN_H__ +#define __MONO_SGEN_MONO_ILGEN_H__ + +#include "config.h" + +MONO_API void +mono_sgen_mono_ilgen_init (void); +#endif diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index 6ad19b1d76..732078718b 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -24,6 +24,8 @@ #include "metadata/mono-gc.h" #include "metadata/runtime.h" #include "metadata/sgen-bridge-internals.h" +#include "metadata/sgen-mono.h" +#include "metadata/sgen-mono-ilgen.h" #include "metadata/gc-internals.h" #include "metadata/handle.h" #include "utils/mono-memory-model.h" @@ -52,16 +54,6 @@ static MonoGCCallbacks gc_callbacks; #define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) -#define OPDEF(a,b,c,d,e,f,g,h,i,j) \ - a = i, - -enum { -#include "mono/cil/opcode.def" - CEE_LAST -}; - -#undef OPDEF - /* * Write barriers */ @@ -225,45 +217,50 @@ mono_gc_is_critical_method (MonoMethod *method) return sgen_is_critical_method (method); } -#ifdef ENABLE_ILGEN +static void +emit_nursery_check_noilgen (MonoMethodBuilder *mb, gboolean is_concurrent) +{ +} + +static MonoSgenMonoCallbacks sgenmono_cb; +static gboolean cb_inited = FALSE; + +void +mono_install_sgen_mono_callbacks (MonoSgenMonoCallbacks *cb) +{ + g_assert (!cb_inited); + g_assert (cb->version == MONO_SGEN_MONO_CALLBACKS_VERSION); + memcpy (&sgenmono_cb, cb, sizeof (MonoSgenMonoCallbacks)); + cb_inited = TRUE; +} static void -emit_nursery_check (MonoMethodBuilder *mb, int *nursery_check_return_labels, gboolean is_concurrent) +emit_managed_allocater_noilgen (MonoMethodBuilder *mb, gboolean slowpath, gboolean profiler, int atype) { - int shifted_nursery_start = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - - memset (nursery_check_return_labels, 0, sizeof (int) * 2); - // if (ptr_in_nursery (ptr)) return; - /* - * Masking out the bits might be faster, but we would have to use 64 bit - * immediates, which might be slower. - */ - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_START); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_BITS); - mono_mb_emit_byte (mb, CEE_SHR_UN); - mono_mb_emit_stloc (mb, shifted_nursery_start); - - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_BITS); - mono_mb_emit_byte (mb, CEE_SHR_UN); - mono_mb_emit_ldloc (mb, shifted_nursery_start); - nursery_check_return_labels [0] = mono_mb_emit_branch (mb, CEE_BEQ); - - if (!is_concurrent) { - // if (!ptr_in_nursery (*ptr)) return; - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_byte (mb, CEE_LDIND_I); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_LDPTR_NURSERY_BITS); - mono_mb_emit_byte (mb, CEE_SHR_UN); - mono_mb_emit_ldloc (mb, shifted_nursery_start); - nursery_check_return_labels [1] = mono_mb_emit_branch (mb, CEE_BNE_UN); - } } + +static void +install_noilgen (void) +{ + MonoSgenMonoCallbacks cb; + cb.version = MONO_SGEN_MONO_CALLBACKS_VERSION; + cb.emit_nursery_check = emit_nursery_check_noilgen; + cb.emit_managed_allocater = emit_managed_allocater_noilgen; + mono_install_sgen_mono_callbacks (&cb); +} + +static MonoSgenMonoCallbacks * +get_sgen_mono_cb (void) +{ + if (G_UNLIKELY (!cb_inited)) { +#ifdef ENABLE_ILGEN + mono_sgen_mono_ilgen_init (); +#else + install_noilgen (); #endif + } + return &sgenmono_cb; +} MonoMethod* mono_gc_get_specific_write_barrier (gboolean is_concurrent) @@ -273,10 +270,6 @@ mono_gc_get_specific_write_barrier (gboolean is_concurrent) MonoMethodSignature *sig; MonoMethod **write_barrier_method_addr; WrapperInfo *info; -#ifdef MANAGED_WBARRIER - int i, nursery_check_labels [2]; -#endif - // FIXME: Maybe create a separate version for ctors (the branch would be // correctly predicted more times) if (is_concurrent) @@ -297,59 +290,8 @@ mono_gc_get_specific_write_barrier (gboolean is_concurrent) else mb = mono_mb_new (mono_defaults.object_class, "wbarrier_noconc", MONO_WRAPPER_WRITE_BARRIER); -#ifdef ENABLE_ILGEN -#ifdef MANAGED_WBARRIER - emit_nursery_check (mb, nursery_check_labels, is_concurrent); - /* - addr = sgen_cardtable + ((address >> CARD_BITS) & CARD_MASK) - *addr = 1; + get_sgen_mono_cb ()->emit_nursery_check (mb, is_concurrent); - sgen_cardtable: - LDC_PTR sgen_cardtable - - address >> CARD_BITS - LDARG_0 - LDC_I4 CARD_BITS - SHR_UN - if (SGEN_HAVE_OVERLAPPING_CARDS) { - LDC_PTR card_table_mask - AND - } - AND - ldc_i4_1 - stind_i1 - */ - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_LDPTR_CARD_TABLE); - mono_mb_emit_ldarg (mb, 0); - 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 - mono_mb_emit_icon8 (mb, CARD_MASK); -#else - mono_mb_emit_icon (mb, CARD_MASK); -#endif - mono_mb_emit_byte (mb, CEE_CONV_I); - mono_mb_emit_byte (mb, CEE_AND); -#endif - mono_mb_emit_byte (mb, CEE_ADD); - mono_mb_emit_icon (mb, 1); - mono_mb_emit_byte (mb, CEE_STIND_I1); - - // return; - for (i = 0; i < 2; ++i) { - if (nursery_check_labels [i]) - mono_mb_patch_branch (mb, nursery_check_labels [i]); - } - mono_mb_emit_byte (mb, CEE_RET); -#else - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_icall (mb, mono_gc_wbarrier_generic_nostore); - mono_mb_emit_byte (mb, CEE_RET); -#endif -#endif res = mono_mb_create_method (mb, sig, 16); info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE); mono_marshal_set_wrapper_info (res, info); @@ -443,6 +385,13 @@ sgen_client_zero_array_fill_header (void *p, size_t size) } } +MonoVTable * +mono_gc_get_vtable (MonoObject *obj) +{ + // See sgen/sgen-tagged-pointer.h. + return SGEN_LOAD_VTABLE (obj); +} + /* * Finalization */ @@ -862,7 +811,7 @@ mono_gc_clear_domain (MonoDomain * domain) binary_protocol_domain_unload_begin (domain); - sgen_stop_world (0); + sgen_stop_world (0, FALSE); if (sgen_concurrent_collection_in_progress ()) sgen_perform_collection (0, GENERATION_OLD, "clear domain", TRUE, FALSE); @@ -930,7 +879,7 @@ mono_gc_clear_domain (MonoDomain * domain) sgen_object_layout_dump (stdout); } - sgen_restart_world (0); + sgen_restart_world (0, FALSE); binary_protocol_domain_unload_end (domain); binary_protocol_flush_buffers (FALSE); @@ -979,13 +928,13 @@ mono_gc_alloc_mature (MonoVTable *vtable, size_t size) * mono_gc_alloc_fixed: */ void* -mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg) +mono_gc_alloc_fixed (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg) { /* FIXME: do a single allocation */ void *res = g_calloc (1, size); if (!res) return NULL; - if (!mono_gc_register_root ((char *)res, size, descr, source, msg)) { + if (!mono_gc_register_root ((char *)res, size, descr, source, key, msg)) { g_free (res); res = NULL; } @@ -1006,42 +955,12 @@ mono_gc_free_fixed (void* addr) * Managed allocator */ +#ifdef MANAGED_ALLOCATION static MonoMethod* alloc_method_cache [ATYPE_NUM]; static MonoMethod* slowpath_alloc_method_cache [ATYPE_NUM]; static MonoMethod* profiler_alloc_method_cache [ATYPE_NUM]; static gboolean use_managed_allocator = TRUE; -#ifdef MANAGED_ALLOCATION -// Cache the SgenThreadInfo pointer in a local 'var'. -#define EMIT_TLS_ACCESS_VAR(mb, var) \ - do { \ - var = mono_mb_add_local ((mb), &mono_defaults.int_class->byval_arg); \ - mono_mb_emit_byte ((mb), MONO_CUSTOM_PREFIX); \ - mono_mb_emit_byte ((mb), CEE_MONO_TLS); \ - mono_mb_emit_i4 ((mb), TLS_KEY_SGEN_THREAD_INFO); \ - mono_mb_emit_stloc ((mb), (var)); \ - } while (0) - -#define EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR(mb, var) \ - do { \ - mono_mb_emit_ldloc ((mb), (var)); \ - mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenClientThreadInfo, in_critical_region)); \ - mono_mb_emit_byte ((mb), CEE_ADD); \ - } while (0) - -#define EMIT_TLS_ACCESS_NEXT_ADDR(mb, var) do { \ - mono_mb_emit_ldloc ((mb), (var)); \ - mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenThreadInfo, tlab_next)); \ - mono_mb_emit_byte ((mb), CEE_ADD); \ - } while (0) - -#define EMIT_TLS_ACCESS_TEMP_END(mb, var) do { \ - mono_mb_emit_ldloc ((mb), (var)); \ - mono_mb_emit_icon ((mb), MONO_STRUCT_OFFSET (SgenThreadInfo, tlab_temp_end)); \ - mono_mb_emit_byte ((mb), CEE_ADD); \ - mono_mb_emit_byte ((mb), CEE_LDIND_I); \ - } while (0) - /* FIXME: Do this in the JIT, where specialized allocation sequences can be created * for each class. This is currently not easy to do, as it is hard to generate basic * blocks + branches, but it is easy with the linear IL codebase. @@ -1053,15 +972,12 @@ static gboolean use_managed_allocator = TRUE; static MonoMethod* create_allocator (int atype, ManagedAllocatorVariant variant) { - int p_var, size_var, real_size_var, thread_var G_GNUC_UNUSED; gboolean slowpath = variant == MANAGED_ALLOCATOR_SLOW_PATH; gboolean profiler = variant == MANAGED_ALLOCATOR_PROFILER; - guint32 fastpath_branch, max_size_branch, no_oom_branch; MonoMethodBuilder *mb; MonoMethod *res; MonoMethodSignature *csig; static gboolean registered = FALSE; - int tlab_next_addr_var, new_next_var; const char *name = NULL; WrapperInfo *info; int num_params, i; @@ -1104,375 +1020,15 @@ create_allocator (int atype, ManagedAllocatorVariant variant) mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_ALLOC); -#ifdef ENABLE_ILGEN - if (slowpath) { - switch (atype) { - case ATYPE_NORMAL: - case ATYPE_SMALL: - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_icall (mb, ves_icall_object_new_specific); - break; - case ATYPE_VECTOR: - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icall (mb, ves_icall_array_new_specific); - break; - case ATYPE_STRING: - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icall (mb, ves_icall_string_alloc); - break; - default: - g_assert_not_reached (); - } - - goto done; - } - - /* - * Tls access might call foreign code or code without jinfo. This can - * only happen if we are outside of the critical region. - */ - EMIT_TLS_ACCESS_VAR (mb, thread_var); - - size_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - if (atype == ATYPE_SMALL) { - /* size_var = size_arg */ - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_stloc (mb, size_var); - } else if (atype == ATYPE_NORMAL) { - /* size = vtable->klass->instance_size; */ - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoVTable, klass)); - mono_mb_emit_byte (mb, CEE_ADD); - mono_mb_emit_byte (mb, CEE_LDIND_I); - mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoClass, instance_size)); - mono_mb_emit_byte (mb, CEE_ADD); - /* FIXME: assert instance_size stays a 4 byte integer */ - mono_mb_emit_byte (mb, CEE_LDIND_U4); - mono_mb_emit_byte (mb, CEE_CONV_I); - mono_mb_emit_stloc (mb, size_var); - } else if (atype == ATYPE_VECTOR) { - MonoExceptionClause *clause; - int pos, pos_leave, pos_error; - MonoClass *oom_exc_class; - MonoMethod *ctor; - - /* - * n > MONO_ARRAY_MAX_INDEX => OutOfMemoryException - * n < 0 => OverflowException - * - * We can do an unsigned comparison to catch both cases, then in the error - * case compare signed to distinguish between them. - */ - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icon (mb, MONO_ARRAY_MAX_INDEX); - mono_mb_emit_byte (mb, CEE_CONV_U); - pos = mono_mb_emit_short_branch (mb, CEE_BLE_UN_S); - - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icon (mb, 0); - pos_error = mono_mb_emit_short_branch (mb, CEE_BLT_S); - mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); - mono_mb_patch_short_branch (mb, pos_error); - mono_mb_emit_exception (mb, "OverflowException", NULL); - - mono_mb_patch_short_branch (mb, pos); - - clause = (MonoExceptionClause *)mono_image_alloc0 (mono_defaults.corlib, sizeof (MonoExceptionClause)); - clause->try_offset = mono_mb_get_label (mb); - - /* vtable->klass->sizes.element_size */ - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoVTable, klass)); - mono_mb_emit_byte (mb, CEE_ADD); - mono_mb_emit_byte (mb, CEE_LDIND_I); - mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoClass, sizes)); - mono_mb_emit_byte (mb, CEE_ADD); - mono_mb_emit_byte (mb, CEE_LDIND_U4); - mono_mb_emit_byte (mb, CEE_CONV_I); - - /* * n */ - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_byte (mb, CEE_MUL_OVF_UN); - /* + sizeof (MonoArray) */ - mono_mb_emit_icon (mb, MONO_SIZEOF_MONO_ARRAY); - mono_mb_emit_byte (mb, CEE_ADD_OVF_UN); - mono_mb_emit_stloc (mb, size_var); - - pos_leave = mono_mb_emit_branch (mb, CEE_LEAVE); - - /* catch */ - clause->flags = MONO_EXCEPTION_CLAUSE_NONE; - clause->try_len = mono_mb_get_pos (mb) - clause->try_offset; - clause->data.catch_class = mono_class_load_from_name (mono_defaults.corlib, - "System", "OverflowException"); - clause->handler_offset = mono_mb_get_label (mb); - - 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); - g_assert (ctor); - - mono_mb_emit_byte (mb, CEE_POP); - mono_mb_emit_op (mb, CEE_NEWOBJ, ctor); - mono_mb_emit_byte (mb, CEE_THROW); - - clause->handler_len = mono_mb_get_pos (mb) - clause->handler_offset; - mono_mb_set_clauses (mb, 1, clause); - mono_mb_patch_branch (mb, pos_leave); - /* end catch */ - } else if (atype == ATYPE_STRING) { - int pos; - - /* - * a string allocator method takes the args: (vtable, len) - * - * bytes = offsetof (MonoString, chars) + ((len + 1) * 2) - * - * condition: - * - * bytes <= INT32_MAX - (SGEN_ALLOC_ALIGN - 1) - * - * therefore: - * - * offsetof (MonoString, chars) + ((len + 1) * 2) <= INT32_MAX - (SGEN_ALLOC_ALIGN - 1) - * len <= (INT32_MAX - (SGEN_ALLOC_ALIGN - 1) - offsetof (MonoString, chars)) / 2 - 1 - */ - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icon (mb, (INT32_MAX - (SGEN_ALLOC_ALIGN - 1) - MONO_STRUCT_OFFSET (MonoString, chars)) / 2 - 1); - pos = mono_mb_emit_short_branch (mb, MONO_CEE_BLE_UN_S); - - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); - mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); - mono_mb_patch_short_branch (mb, pos); - - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icon (mb, 1); - mono_mb_emit_byte (mb, MONO_CEE_SHL); - //WE manually fold the above + 2 here - mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoString, chars) + 2); - mono_mb_emit_byte (mb, CEE_ADD); - mono_mb_emit_stloc (mb, size_var); - } else { - g_assert_not_reached (); - } - -#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION - EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var); - mono_mb_emit_byte (mb, CEE_LDC_I4_1); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4); - mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE); -#endif - - if (nursery_canaries_enabled ()) { - real_size_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - mono_mb_emit_ldloc (mb, size_var); - mono_mb_emit_stloc(mb, real_size_var); - } - else - real_size_var = size_var; - - /* size += ALLOC_ALIGN - 1; */ - mono_mb_emit_ldloc (mb, size_var); - mono_mb_emit_icon (mb, SGEN_ALLOC_ALIGN - 1); - mono_mb_emit_byte (mb, CEE_ADD); - /* size &= ~(ALLOC_ALIGN - 1); */ - mono_mb_emit_icon (mb, ~(SGEN_ALLOC_ALIGN - 1)); - mono_mb_emit_byte (mb, CEE_AND); - mono_mb_emit_stloc (mb, size_var); - - /* if (size > MAX_SMALL_OBJ_SIZE) goto slowpath */ - if (atype != ATYPE_SMALL) { - mono_mb_emit_ldloc (mb, size_var); - mono_mb_emit_icon (mb, SGEN_MAX_SMALL_OBJ_SIZE); - max_size_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BGT_UN_S); - } - - /* - * We need to modify tlab_next, but the JIT only supports reading, so we read - * another tls var holding its address instead. - */ - - /* tlab_next_addr (local) = tlab_next_addr (TLS var) */ - tlab_next_addr_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - EMIT_TLS_ACCESS_NEXT_ADDR (mb, thread_var); - mono_mb_emit_stloc (mb, tlab_next_addr_var); - - /* p = (void**)tlab_next; */ - p_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - mono_mb_emit_ldloc (mb, tlab_next_addr_var); - mono_mb_emit_byte (mb, CEE_LDIND_I); - mono_mb_emit_stloc (mb, p_var); - - /* new_next = (char*)p + size; */ - new_next_var = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg); - mono_mb_emit_ldloc (mb, p_var); - mono_mb_emit_ldloc (mb, size_var); - mono_mb_emit_byte (mb, CEE_CONV_I); - mono_mb_emit_byte (mb, CEE_ADD); - - if (nursery_canaries_enabled ()) { - mono_mb_emit_icon (mb, CANARY_SIZE); - mono_mb_emit_byte (mb, CEE_ADD); - } - mono_mb_emit_stloc (mb, new_next_var); - - /* if (G_LIKELY (new_next < tlab_temp_end)) */ - mono_mb_emit_ldloc (mb, new_next_var); - EMIT_TLS_ACCESS_TEMP_END (mb, thread_var); - fastpath_branch = mono_mb_emit_short_branch (mb, MONO_CEE_BLT_UN_S); - - /* Slowpath */ - if (atype != ATYPE_SMALL) - mono_mb_patch_short_branch (mb, max_size_branch); - - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); - /* - * We are no longer in a critical section. We need to do this before calling - * to unmanaged land in order to avoid stw deadlocks since unmanaged code - * might take locks. - */ -#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION - EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var); - mono_mb_emit_byte (mb, CEE_LDC_I4_0); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4); - mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_NONE); -#endif - - /* FIXME: mono_gc_alloc_obj takes a 'size_t' as an argument, not an int32 */ - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_ldloc (mb, real_size_var); - if (atype == ATYPE_NORMAL || atype == ATYPE_SMALL) { - mono_mb_emit_icall (mb, mono_gc_alloc_obj); - } else if (atype == ATYPE_VECTOR) { - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icall (mb, mono_gc_alloc_vector); - } else if (atype == ATYPE_STRING) { - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_icall (mb, mono_gc_alloc_string); - } else { - g_assert_not_reached (); - } - - /* if (ret == NULL) throw OOM; */ - mono_mb_emit_byte (mb, CEE_DUP); - no_oom_branch = mono_mb_emit_branch (mb, CEE_BRTRUE); - mono_mb_emit_exception (mb, "OutOfMemoryException", NULL); - - mono_mb_patch_branch (mb, no_oom_branch); - mono_mb_emit_byte (mb, CEE_RET); - - /* Fastpath */ - mono_mb_patch_short_branch (mb, fastpath_branch); - - /* FIXME: Memory barrier */ - - /* tlab_next = new_next */ - mono_mb_emit_ldloc (mb, tlab_next_addr_var); - mono_mb_emit_ldloc (mb, new_next_var); - mono_mb_emit_byte (mb, CEE_STIND_I); - - /* *p = vtable; */ - mono_mb_emit_ldloc (mb, p_var); - mono_mb_emit_ldarg (mb, 0); - mono_mb_emit_byte (mb, CEE_STIND_I); - - /* mark object end with nursery word */ - if (nursery_canaries_enabled ()) { - mono_mb_emit_ldloc (mb, p_var); - mono_mb_emit_ldloc (mb, real_size_var); - mono_mb_emit_byte (mb, MONO_CEE_ADD); - mono_mb_emit_icon8 (mb, (mword) CANARY_STRING); - mono_mb_emit_icon (mb, CANARY_SIZE); - mono_mb_emit_byte (mb, MONO_CEE_PREFIX1); - mono_mb_emit_byte (mb, CEE_CPBLK); - } - - if (atype == ATYPE_VECTOR) { - /* arr->max_length = max_length; */ - mono_mb_emit_ldloc (mb, p_var); - mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoArray, max_length)); - mono_mb_emit_ldarg (mb, 1); -#ifdef MONO_BIG_ARRAYS - mono_mb_emit_byte (mb, CEE_STIND_I); -#else - mono_mb_emit_byte (mb, CEE_STIND_I4); -#endif - } else if (atype == ATYPE_STRING) { - /* need to set length and clear the last char */ - /* s->length = len; */ - mono_mb_emit_ldloc (mb, p_var); - mono_mb_emit_icon (mb, MONO_STRUCT_OFFSET (MonoString, length)); - mono_mb_emit_byte (mb, MONO_CEE_ADD); - mono_mb_emit_ldarg (mb, 1); - mono_mb_emit_byte (mb, MONO_CEE_STIND_I4); - } - -#ifdef MANAGED_ALLOCATOR_CAN_USE_CRITICAL_REGION - EMIT_TLS_ACCESS_IN_CRITICAL_REGION_ADDR (mb, thread_var); - mono_mb_emit_byte (mb, CEE_LDC_I4_0); - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_ATOMIC_STORE_I4); -#else - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_MEMORY_BARRIER); -#endif - /* - We must make sure both vtable and max_length are globaly visible before returning to managed land. - */ - mono_mb_emit_i4 (mb, MONO_MEMORY_BARRIER_REL); - - /* return p */ - mono_mb_emit_ldloc (mb, p_var); - - done: - - /* - * It's important that we do this outside of the critical region as we - * will be invoking arbitrary code. - */ - if (profiler) { - /* - * if (G_UNLIKELY (*&mono_profiler_state.gc_allocation_count)) { - * mono_profiler_raise_gc_allocation (p); - * } - */ - - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_LDPTR_PROFILER_ALLOCATION_COUNT); - mono_mb_emit_byte (mb, CEE_LDIND_U4); - - int prof_br = mono_mb_emit_short_branch (mb, CEE_BRFALSE_S); - - mono_mb_emit_byte (mb, MONO_CUSTOM_PREFIX); - mono_mb_emit_byte (mb, CEE_MONO_NOT_TAKEN); - mono_mb_emit_byte (mb, CEE_DUP); - mono_mb_emit_icall (mb, mono_profiler_raise_gc_allocation); - - mono_mb_patch_short_branch (mb, prof_br); - } - - mono_mb_emit_byte (mb, CEE_RET); -#endif + get_sgen_mono_cb ()->emit_managed_allocater (mb, slowpath, profiler, atype); info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE); info->d.alloc.gc_name = "sgen"; info->d.alloc.alloc_type = atype; -#ifdef ENABLE_ILGEN - mb->init_locals = FALSE; -#endif - res = mono_mb_create (mb, csig, 8, info); mono_mb_free (mb); - return res; } #endif @@ -1875,11 +1431,14 @@ mono_gc_set_string_length (MonoString *str, gint32 new_length) */ #define GC_ROOT_NUM 32 +#define SPECIAL_ADDRESS_FIN_QUEUE ((void*)1) +#define SPECIAL_ADDRESS_CRIT_FIN_QUEUE ((void*)2) +#define SPECIAL_ADDRESS_EPHEMERON ((void*)3) + typedef struct { int count; /* must be the first field */ + void *addresses [GC_ROOT_NUM]; void *objects [GC_ROOT_NUM]; - int root_types [GC_ROOT_NUM]; - uintptr_t extra_info [GC_ROOT_NUM]; } GCRootReport; static void @@ -1887,63 +1446,34 @@ notify_gc_roots (GCRootReport *report) { if (!report->count) return; - MONO_PROFILER_RAISE (gc_roots, ((MonoObject **) report->objects, (MonoProfilerGCRootType *) report->root_types, report->extra_info, report->count)); + MONO_PROFILER_RAISE (gc_roots, (report->count, (const mono_byte *const *)report->addresses, (MonoObject *const *) report->objects)); report->count = 0; } static void -add_profile_gc_root (GCRootReport *report, void *object, int rtype, uintptr_t extra_info) +report_gc_root (GCRootReport *report, void *address, void *object) { if (report->count == GC_ROOT_NUM) notify_gc_roots (report); + report->addresses [report->count] = address; report->objects [report->count] = object; - report->root_types [report->count] = rtype; - report->extra_info [report->count++] = (uintptr_t)SGEN_LOAD_VTABLE (object)->klass; + report->count++; } -void -sgen_client_nursery_objects_pinned (void **definitely_pinned, int count) -{ - if (MONO_PROFILER_ENABLED (gc_roots)) { - GCRootReport report; - int idx; - report.count = 0; - for (idx = 0; idx < count; ++idx) - add_profile_gc_root (&report, definitely_pinned [idx], MONO_PROFILER_GC_ROOT_PINNING | MONO_PROFILER_GC_ROOT_MISC, 0); - notify_gc_roots (&report); - } -} - -static void -report_finalizer_roots_from_queue (SgenPointerQueue *queue) -{ - GCRootReport report; - size_t i; - - report.count = 0; - for (i = 0; i < queue->next_slot; ++i) { - void *obj = queue->data [i]; - if (!obj) - continue; - add_profile_gc_root (&report, obj, MONO_PROFILER_GC_ROOT_FINALIZER, 0); - } - notify_gc_roots (&report); -} - -static void -report_finalizer_roots (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue) -{ - report_finalizer_roots_from_queue (fin_ready_queue); - report_finalizer_roots_from_queue (critical_fin_queue); -} - -static GCRootReport *root_report; - static void single_arg_report_root (MonoObject **obj, void *gc_data) { + GCRootReport *report = gc_data; if (*obj) - add_profile_gc_root (root_report, *obj, MONO_PROFILER_GC_ROOT_OTHER, 0); + report_gc_root (report, obj, *obj); +} + +static void +two_args_report_root (void *address, MonoObject *obj, void *gc_data) +{ + GCRootReport *report = gc_data; + if (obj) + report_gc_root (report, address, obj); } static void @@ -1953,9 +1483,8 @@ precisely_report_roots_from (GCRootReport *report, void** start_root, void** end case ROOT_DESC_BITMAP: desc >>= ROOT_DESC_TYPE_SHIFT; while (desc) { - if ((desc & 1) && *start_root) { - add_profile_gc_root (report, *start_root, MONO_PROFILER_GC_ROOT_OTHER, 0); - } + if ((desc & 1) && *start_root) + report_gc_root (report, start_root, *start_root); desc >>= 1; start_root++; } @@ -1969,9 +1498,8 @@ precisely_report_roots_from (GCRootReport *report, void** start_root, void** end gsize bmap = *bitmap_data++; void **objptr = start_run; while (bmap) { - if ((bmap & 1) && *objptr) { - add_profile_gc_root (report, *objptr, MONO_PROFILER_GC_ROOT_OTHER, 0); - } + if ((bmap & 1) && *objptr) + report_gc_root (report, objptr, *objptr); bmap >>= 1; ++objptr; } @@ -1984,14 +1512,17 @@ precisely_report_roots_from (GCRootReport *report, void** start_root, void** end for (p = start_root; p < end_root; p++) { if (*p) - add_profile_gc_root (report, *p, MONO_PROFILER_GC_ROOT_OTHER, 0); + report_gc_root (report, p, *p); } break; } case ROOT_DESC_USER: { MonoGCRootMarkFunc marker = (MonoGCRootMarkFunc)sgen_get_user_descriptor_func (desc); - root_report = report; - marker ((MonoObject**)start_root, single_arg_report_root, NULL); + + if ((void*)marker == (void*)sgen_mark_normal_gc_handles) + sgen_gc_handles_report_roots (two_args_report_root, report); + else + marker ((MonoObject**)start_root, single_arg_report_root, report); break; } case ROOT_DESC_RUN_LEN: @@ -2002,15 +1533,194 @@ precisely_report_roots_from (GCRootReport *report, void** start_root, void** end } static void -report_registered_roots_by_type (int root_type) +report_pinning_roots (GCRootReport *report, void **start, void **end) +{ + while (start < end) { + mword addr = (mword)*start; + addr &= ~(SGEN_ALLOC_ALIGN - 1); + if (addr) + report_gc_root (report, start, (void*)addr); + + start++; + } +} + +static SgenPointerQueue pinned_objects = SGEN_POINTER_QUEUE_INIT (INTERNAL_MEM_MOVED_OBJECT); +static mword lower_bound, upper_bound; + +static GCObject* +find_pinned_obj (char *addr) +{ + size_t idx = sgen_pointer_queue_search (&pinned_objects, addr); + + if (idx != pinned_objects.next_slot) { + if (pinned_objects.data [idx] == addr) + return pinned_objects.data [idx]; + if (idx == 0) + return NULL; + } + + GCObject *obj = pinned_objects.data [idx - 1]; + if (addr > (char*)obj && addr < ((char*)obj + sgen_safe_object_get_size (obj))) + return obj; + return NULL; +} + + +/* + * We pass @root_report_address so register are properly accounted towards their thread +*/ +static void +report_conservative_roots (GCRootReport *report, char *root_report_address, void **start, void **end) +{ + while (start < end) { + mword addr = (mword)*start; + addr &= ~(SGEN_ALLOC_ALIGN - 1); + + if (addr < lower_bound || addr > upper_bound) { + ++start; + continue; + } + + GCObject *obj = find_pinned_obj ((char*)addr); + if (obj) + report_gc_root (report, root_report_address, obj); + start++; + } +} + +typedef struct { + gboolean precise; + GCRootReport *report; + SgenThreadInfo *info; +} ReportHandleStackRoot; + +static void +report_handle_stack_root (gpointer *ptr, gpointer user_data) +{ + ReportHandleStackRoot *ud = user_data; + GCRootReport *report = ud->report; + gpointer addr = ud->info->client_info.info.handle_stack; + + // Note: We know that *ptr != NULL. + if (ud->precise) + report_gc_root (report, addr, *ptr); + else + report_conservative_roots (report, addr, ptr, ptr + 1); +} + +static void +report_handle_stack_roots (GCRootReport *report, SgenThreadInfo *info, gboolean precise) +{ + ReportHandleStackRoot ud = { + .precise = precise, + .report = report, + .info = info, + }; + + mono_handle_stack_scan ((HandleStack *) info->client_info.info.handle_stack, report_handle_stack_root, &ud, ud.precise, FALSE); +} + +static void +report_stack_roots (void) +{ + GCRootReport report = {0}; + FOREACH_THREAD (info) { + void *aligned_stack_start; + + if (info->client_info.skip) { + continue; + } else if (info->client_info.gc_disabled) { + continue; + } else if (!mono_thread_info_is_live (info)) { + continue; + } else if (!info->client_info.stack_start) { + continue; + } + + g_assert (info->client_info.stack_start); + g_assert (info->client_info.info.stack_end); + + aligned_stack_start = (void*)(mword) ALIGN_TO ((mword)info->client_info.stack_start, SIZEOF_VOID_P); +#ifdef HOST_WIN32 + /* Windows uses a guard page before the committed stack memory pages to detect when the + stack needs to be grown. If we suspend a thread just after a function prolog has + decremented the stack pointer to point into the guard page but before the thread has + been able to read or write to that page, starting the stack scan at aligned_stack_start + will raise a STATUS_GUARD_PAGE_VIOLATION and the process will crash. This code uses + VirtualQuery() to determine whether stack_start points into the guard page and then + updates aligned_stack_start to point at the next non-guard page. */ + MEMORY_BASIC_INFORMATION mem_info; + SIZE_T result = VirtualQuery (info->client_info.stack_start, &mem_info, sizeof(mem_info)); + g_assert (result != 0); + if (mem_info.Protect & PAGE_GUARD) { + aligned_stack_start = ((char*) mem_info.BaseAddress) + mem_info.RegionSize; + } +#endif + + g_assert (info->client_info.suspend_done); + + report_conservative_roots (&report, aligned_stack_start, (void **)aligned_stack_start, (void **)info->client_info.info.stack_end); + report_conservative_roots (&report, aligned_stack_start, (void**)&info->client_info.ctx, (void**)(&info->client_info.ctx + 1)); + + report_handle_stack_roots (&report, info, FALSE); + report_handle_stack_roots (&report, info, TRUE); + } FOREACH_THREAD_END + + notify_gc_roots (&report); +} + +static void +report_pin_queue (void) +{ + lower_bound = SIZE_MAX; + upper_bound = 0; + + //sort the addresses + sgen_pointer_queue_sort_uniq (&pinned_objects); + + for (int i = 0; i < pinned_objects.next_slot; ++i) { + GCObject *obj = pinned_objects.data [i]; + ssize_t size = sgen_safe_object_get_size (obj); + + ssize_t addr = (ssize_t)obj; + lower_bound = MIN (lower_bound, addr); + upper_bound = MAX (upper_bound, addr + size); + } + + report_stack_roots (); + sgen_pointer_queue_clear (&pinned_objects); +} + +static void +report_finalizer_roots_from_queue (SgenPointerQueue *queue, void* queue_address) { GCRootReport report; + size_t i; + + report.count = 0; + for (i = 0; i < queue->next_slot; ++i) { + void *obj = queue->data [i]; + if (!obj) + continue; + report_gc_root (&report, queue_address, obj); + } + notify_gc_roots (&report); +} + +static void +report_registered_roots_by_type (int root_type) +{ + GCRootReport report = { 0 }; void **start_root; RootRecord *root; report.count = 0; SGEN_HASH_TABLE_FOREACH (&roots_hash [root_type], void **, start_root, RootRecord *, root) { - SGEN_LOG (6, "Precise root scan %p-%p (desc: %p)", start_root, root->end_root, (void*)root->root_desc); - precisely_report_roots_from (&report, start_root, (void**)root->end_root, root->root_desc); + SGEN_LOG (6, "Profiler root scan %p-%p (desc: %p)", start_root, root->end_root, (void*)root->root_desc); + if (root_type == ROOT_TYPE_PINNED) + report_pinning_roots (&report, start_root, (void**)root->end_root); + else + precisely_report_roots_from (&report, start_root, (void**)root->end_root, root->root_desc); } SGEN_HASH_TABLE_FOREACH_END; notify_gc_roots (&report); } @@ -2018,52 +1728,118 @@ report_registered_roots_by_type (int root_type) static void report_registered_roots (void) { - report_registered_roots_by_type (ROOT_TYPE_NORMAL); - report_registered_roots_by_type (ROOT_TYPE_WBARRIER); + for (int i = 0; i < ROOT_TYPE_NUM; ++i) + report_registered_roots_by_type (i); +} + +static void +report_ephemeron_roots (void) +{ + EphemeronLinkNode *current = ephemeron_list; + Ephemeron *cur, *array_end; + GCObject *tombstone; + GCRootReport report = { 0 }; + + for (current = ephemeron_list; current; current = current->next) { + MonoArray *array = current->array; + + if (!sgen_is_object_alive_for_current_gen ((GCObject*)array)) + continue; + + cur = mono_array_addr (array, Ephemeron, 0); + array_end = cur + mono_array_length_fast (array); + tombstone = SGEN_LOAD_VTABLE ((GCObject*)array)->domain->ephemeron_tombstone; + + for (; cur < array_end; ++cur) { + GCObject *key = cur->key; + + if (!key || key == tombstone) + continue; + + if (cur->value && sgen_is_object_alive_for_current_gen (key)) + report_gc_root (&report, SPECIAL_ADDRESS_EPHEMERON, cur->value); + } + } + + notify_gc_roots (&report); +} + +static void +sgen_report_all_roots (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue) +{ + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; + + report_registered_roots (); + report_ephemeron_roots (); + report_pin_queue (); + report_finalizer_roots_from_queue (fin_ready_queue, SPECIAL_ADDRESS_FIN_QUEUE); + report_finalizer_roots_from_queue (critical_fin_queue, SPECIAL_ADDRESS_CRIT_FIN_QUEUE); } void -sgen_client_collecting_minor (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue) +sgen_client_pinning_start (void) { - if (MONO_PROFILER_ENABLED (gc_roots)) - report_registered_roots (); + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; - if (MONO_PROFILER_ENABLED (gc_roots)) - report_finalizer_roots (fin_ready_queue, critical_fin_queue); + sgen_pointer_queue_clear (&pinned_objects); } -static GCRootReport major_root_report; -static gboolean profile_roots; +void +sgen_client_pinning_end (void) +{ + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; +} void -sgen_client_collecting_major_1 (void) +sgen_client_nursery_objects_pinned (void **definitely_pinned, int count) { - profile_roots = MONO_PROFILER_ENABLED (gc_roots); - memset (&major_root_report, 0, sizeof (GCRootReport)); + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; + + for (int i = 0; i < count; ++i) + sgen_pointer_queue_add (&pinned_objects, definitely_pinned [i]); } void sgen_client_pinned_los_object (GCObject *obj) { - if (profile_roots) - add_profile_gc_root (&major_root_report, (char*)obj, MONO_PROFILER_GC_ROOT_PINNING | MONO_PROFILER_GC_ROOT_MISC, 0); + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; + + sgen_pointer_queue_add (&pinned_objects, obj); } void -sgen_client_collecting_major_2 (void) +sgen_client_pinned_cemented_object (GCObject *obj) { - if (profile_roots) - notify_gc_roots (&major_root_report); + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; - if (MONO_PROFILER_ENABLED (gc_roots)) - report_registered_roots (); + // TODO: How do we report this in a way that makes sense? } void -sgen_client_collecting_major_3 (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue) +sgen_client_pinned_major_heap_object (GCObject *obj) { - if (MONO_PROFILER_ENABLED (gc_roots)) - report_finalizer_roots (fin_ready_queue, critical_fin_queue); + if (!MONO_PROFILER_ENABLED (gc_roots)) + return; + + sgen_pointer_queue_add (&pinned_objects, obj); +} + +void +sgen_client_collecting_minor_report_roots (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue) +{ + sgen_report_all_roots (fin_ready_queue, critical_fin_queue); +} + +void +sgen_client_collecting_major_report_roots (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue) +{ + sgen_report_all_roots (fin_ready_queue, critical_fin_queue); } #define MOVED_OBJECTS_NUM 64 @@ -2454,12 +2230,12 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p beginning of the object. */ if (precise) - mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, (GcScanFunc)ctx.ops->copy_or_mark_object, ctx.queue, 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, }; - mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, pin_handle_stack_interior_ptrs, &ud, precise); + mono_handle_stack_scan ((HandleStack*)info->client_info.info.handle_stack, pin_handle_stack_interior_ptrs, &ud, precise, FALSE); } } } FOREACH_THREAD_END @@ -2490,15 +2266,15 @@ mono_gc_set_stack_end (void *stack_end) */ int -mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg) +mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg) { - return sgen_register_root (start, size, descr, descr ? ROOT_TYPE_NORMAL : ROOT_TYPE_PINNED, source, msg); + return sgen_register_root (start, size, descr, descr ? ROOT_TYPE_NORMAL : ROOT_TYPE_PINNED, source, key, msg); } int -mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg) +mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, void *key, const char *msg) { - return sgen_register_root (start, size, descr, ROOT_TYPE_WBARRIER, source, msg); + return sgen_register_root (start, size, descr, ROOT_TYPE_WBARRIER, source, key, msg); } void @@ -2529,10 +2305,30 @@ mono_gc_pthread_create (pthread_t *new_thread, const pthread_attr_t *attr, void * Miscellaneous */ +static size_t last_heap_size = -1; +static size_t worker_heap_size; + void sgen_client_total_allocated_heap_changed (size_t allocated_heap) { mono_runtime_resource_check_limit (MONO_RESOURCE_GC_HEAP, allocated_heap); + + /* + * This function can be called from SGen's worker threads. We want to try + * and avoid exposing those threads to the profiler API, so save the heap + * size value and report it later when the main GC thread calls + * mono_sgen_gc_event_resize (). + */ + worker_heap_size = allocated_heap; +} + +void +mono_sgen_gc_event_resize (void) +{ + if (worker_heap_size != last_heap_size) { + last_heap_size = worker_heap_size; + MONO_PROFILER_RAISE (gc_resize, (last_heap_size)); + } } gboolean @@ -3109,4 +2905,47 @@ sgen_client_get_weak_bitmap (MonoVTable *vt, int *nbits) return mono_class_get_weak_bitmap (klass, nbits); } +void +sgen_client_binary_protocol_collection_begin (int minor_gc_count, int generation) +{ + static gboolean pseudo_roots_registered; + + MONO_GC_BEGIN (generation); + + MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_START, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_START, generation, generation == GENERATION_OLD && concurrent_collection_in_progress)); + + if (!pseudo_roots_registered) { + pseudo_roots_registered = TRUE; + MONO_PROFILER_RAISE (gc_root_register, (SPECIAL_ADDRESS_FIN_QUEUE, 1, MONO_ROOT_SOURCE_FINALIZER_QUEUE, NULL, "Finalizer Queue")); + MONO_PROFILER_RAISE (gc_root_register, (SPECIAL_ADDRESS_CRIT_FIN_QUEUE, 1, MONO_ROOT_SOURCE_FINALIZER_QUEUE, NULL, "Finalizer Queue (Critical)")); + MONO_PROFILER_RAISE (gc_root_register, (SPECIAL_ADDRESS_EPHEMERON, 1, MONO_ROOT_SOURCE_EPHEMERON, NULL, "Ephemerons")); + } + +#ifndef DISABLE_PERFCOUNTERS + if (generation == GENERATION_NURSERY) + mono_atomic_inc_i32 (&mono_perfcounters->gc_collections0); + else + mono_atomic_inc_i32 (&mono_perfcounters->gc_collections1); +#endif +} + +void +sgen_client_binary_protocol_collection_end (int minor_gc_count, int generation, long long num_objects_scanned, long long num_unique_objects_scanned) +{ + MONO_GC_END (generation); + + MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_END, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_END, generation, generation == GENERATION_OLD && concurrent_collection_in_progress)); +} + +#ifdef HOST_WASM +void +sgen_client_schedule_background_job (void (*cb)(void)) +{ + mono_threads_schedule_background_job (cb); +} + +#endif + #endif diff --git a/mono/metadata/sgen-mono.h b/mono/metadata/sgen-mono.h new file mode 100644 index 0000000000..cbce48db0f --- /dev/null +++ b/mono/metadata/sgen-mono.h @@ -0,0 +1,20 @@ +/** + * \file + * Copyright 2018 Microsoft + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ +#ifndef __MONO_SGEN_MONO_H__ +#define __MONO_SGEN_MONO_H__ + +#define MONO_SGEN_MONO_CALLBACKS_VERSION 1 + +typedef struct { + int version; + void (*emit_nursery_check) (MonoMethodBuilder *mb, gboolean is_concurrent); + void (*emit_managed_allocater) (MonoMethodBuilder *mb, gboolean slowpath, gboolean profiler, int atype); +} MonoSgenMonoCallbacks; + +void +mono_install_sgen_mono_callbacks (MonoSgenMonoCallbacks *cb); + +#endif diff --git a/mono/metadata/sgen-stw.c b/mono/metadata/sgen-stw.c index a8a1b9bf32..14eedd7496 100644 --- a/mono/metadata/sgen-stw.c +++ b/mono/metadata/sgen-stw.c @@ -102,15 +102,17 @@ static guint64 time_restart_world; /* LOCKING: assumes the GC lock is held */ void -sgen_client_stop_world (int generation) +sgen_client_stop_world (int generation, gboolean serial_collection) { TV_DECLARE (end_handshake); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_PRE_STOP_WORLD, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_PRE_STOP_WORLD, generation, serial_collection)); acquire_gc_locks (); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_PRE_STOP_WORLD_LOCKED, generation, serial_collection)); /* We start to scan after locks are taking, this ensures we won't be interrupted. */ sgen_process_togglerefs (); @@ -126,6 +128,7 @@ sgen_client_stop_world (int generation) SGEN_LOG (3, "world stopped"); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_POST_STOP_WORLD, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_POST_STOP_WORLD, generation, serial_collection)); TV_GETTIME (end_handshake); time_stop_world += TV_ELAPSED (stop_world_time, end_handshake); @@ -137,7 +140,7 @@ sgen_client_stop_world (int generation) /* LOCKING: assumes the GC lock is held */ void -sgen_client_restart_world (int generation, gint64 *stw_time) +sgen_client_restart_world (int generation, gboolean serial_collection, gint64 *stw_time) { TV_DECLARE (end_sw); TV_DECLARE (start_handshake); @@ -148,7 +151,11 @@ sgen_client_restart_world (int generation, gint64 *stw_time) if (MONO_PROFILER_ENABLED (gc_moves)) mono_sgen_gc_event_moves (); + if (MONO_PROFILER_ENABLED (gc_resize)) + mono_sgen_gc_event_resize (); + MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_PRE_START_WORLD, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_PRE_START_WORLD, generation, serial_collection)); FOREACH_THREAD (info) { info->client_info.stack_start = NULL; @@ -168,6 +175,7 @@ sgen_client_restart_world (int generation, gint64 *stw_time) SGEN_LOG (2, "restarted (pause time: %d usec, max: %d)", (int)usec, (int)max_pause_usec); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_POST_START_WORLD, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_POST_START_WORLD, generation, serial_collection)); /* * We must release the thread info suspend lock after doing @@ -182,6 +190,7 @@ sgen_client_restart_world (int generation, gint64 *stw_time) release_gc_locks (); MONO_PROFILER_RAISE (gc_event, (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, generation)); + MONO_PROFILER_RAISE (gc_event2, (MONO_GC_EVENT_POST_START_WORLD_UNLOCKED, generation, serial_collection)); *stw_time = usec; } diff --git a/mono/metadata/sre-encode.c b/mono/metadata/sre-encode.c index e7a0e0a697..f4afc9c752 100644 --- a/mono/metadata/sre-encode.c +++ b/mono/metadata/sre-encode.c @@ -674,9 +674,9 @@ mono_dynimage_encode_fieldref_signature (MonoDynamicImage *assembly, MonoImage * if (type->num_mods) { for (i = 0; i < type->num_mods; ++i) { if (field_image) { - MonoError error; - MonoClass *klass = mono_class_get_checked (field_image, type->modifiers [i].token, &error); - g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */ + ERROR_DECL (error); + MonoClass *klass = mono_class_get_checked (field_image, type->modifiers [i].token, error); + g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ token = mono_image_typedef_or_ref (assembly, &klass->byval_arg); } else { diff --git a/mono/metadata/sre-save.c.REMOVED.git-id b/mono/metadata/sre-save.c.REMOVED.git-id index 439117adfb..0b7d6b445a 100644 --- a/mono/metadata/sre-save.c.REMOVED.git-id +++ b/mono/metadata/sre-save.c.REMOVED.git-id @@ -1 +1 @@ -710d9bde53cbb6d258a0f532897eb908142855b7 \ No newline at end of file +9aea70328b683631954aba3c0a997f6b5f267d00 \ 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 95878ab5c3..41d691b83f 100644 --- a/mono/metadata/sre.c.REMOVED.git-id +++ b/mono/metadata/sre.c.REMOVED.git-id @@ -1 +1 @@ -c66116963bfc3d54bd7a7e2db807e92d9cca29fc \ No newline at end of file +1b2eaa34de14e975711936cb42c318551e3ab9f1 \ No newline at end of file diff --git a/mono/metadata/string-icalls.c b/mono/metadata/string-icalls.c index e6cbc3dbfe..7009843980 100644 --- a/mono/metadata/string-icalls.c +++ b/mono/metadata/string-icalls.c @@ -36,9 +36,9 @@ ves_icall_System_String_ctor_RedirectToCreateString (void) MonoString * ves_icall_System_String_InternalAllocateStr (gint32 length) { - MonoError error; - MonoString *str = mono_string_new_size_checked (mono_domain_get (), length, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + MonoString *str = mono_string_new_size_checked (mono_domain_get (), length, error); + mono_error_set_pending_exception (error); return str; } @@ -46,12 +46,12 @@ ves_icall_System_String_InternalAllocateStr (gint32 length) MonoString * ves_icall_System_String_InternalIntern (MonoString *str) { - MonoError error; + ERROR_DECL (error); MonoString *res; - res = mono_string_intern_checked (str, &error); + res = mono_string_intern_checked (str, error); if (!res) { - mono_error_set_pending_exception (&error); + mono_error_set_pending_exception (error); return NULL; } return res; diff --git a/mono/metadata/threadpool-io.c b/mono/metadata/threadpool-io.c index 5f114d0810..62d5f57c10 100644 --- a/mono/metadata/threadpool-io.c +++ b/mono/metadata/threadpool-io.c @@ -179,7 +179,15 @@ selector_thread_wakeup_drain_pipes (void) if (received == 0) break; if (received == -1) { +#ifdef ERESTART + /* + * some unices (like AIX) send ERESTART, which doesn't + * exist on some other OSes errno + */ + if (errno != EINTR && errno != EAGAIN && errno != ERESTART) +#else if (errno != EINTR && errno != EAGAIN) +#endif g_warning ("selector_thread_wakeup_drain_pipes: read () failed, error (%d) %s\n", errno, g_strerror (errno)); break; } @@ -247,7 +255,7 @@ filter_jobs_for_domain (gpointer key, gpointer value, gpointer user_data) static void wait_callback (gint fd, gint events, gpointer user_data) { - MonoError error; + ERROR_DECL (error); if (mono_runtime_is_shutting_down ()) return; @@ -274,16 +282,16 @@ wait_callback (gint fd, gint events, gpointer user_data) if (list && (events & EVENT_IN) != 0) { MonoIOSelectorJob *job = get_job_for_event (&list, EVENT_IN); if (job) { - mono_threadpool_enqueue_work_item (((MonoObject*) job)->vtable->domain, (MonoObject*) job, &error); - mono_error_assert_ok (&error); + mono_threadpool_enqueue_work_item (((MonoObject*) job)->vtable->domain, (MonoObject*) job, error); + mono_error_assert_ok (error); } } if (list && (events & EVENT_OUT) != 0) { MonoIOSelectorJob *job = get_job_for_event (&list, EVENT_OUT); if (job) { - mono_threadpool_enqueue_work_item (((MonoObject*) job)->vtable->domain, (MonoObject*) job, &error); - mono_error_assert_ok (&error); + mono_threadpool_enqueue_work_item (((MonoObject*) job)->vtable->domain, (MonoObject*) job, error); + mono_error_assert_ok (error); } } @@ -316,15 +324,20 @@ selector_thread_interrupt (gpointer unused) static gsize WINAPI selector_thread (gpointer data) { - MonoError error; + ERROR_DECL (error); MonoGHashTable *states; + MonoString *thread_name = mono_string_new_checked (mono_get_root_domain (), "Thread Pool I/O Selector", error); + mono_error_assert_ok (error); + mono_thread_set_name_internal (mono_thread_internal_current (), thread_name, FALSE, TRUE, error); + mono_error_assert_ok (error); + if (mono_runtime_is_shutting_down ()) { io_selector_running = FALSE; return 0; } - states = mono_g_hash_table_new_type (g_direct_hash, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_THREAD_POOL, "i/o thread pool states table"); + states = mono_g_hash_table_new_type (g_direct_hash, NULL, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_THREAD_POOL, NULL, "Thread Pool I/O State Table"); while (!mono_runtime_is_shutting_down ()) { gint i, j; @@ -357,8 +370,8 @@ selector_thread (gpointer data) g_assert (job); exists = mono_g_hash_table_lookup_extended (states, GINT_TO_POINTER (fd), &k, (gpointer*) &list); - list = mono_mlist_append_checked (list, (MonoObject*) job, &error); - mono_error_assert_ok (&error); + list = mono_mlist_append_checked (list, (MonoObject*) job, error); + mono_error_assert_ok (error); mono_g_hash_table_replace (states, GINT_TO_POINTER (fd), list); operations = get_operations_for_jobs (list); @@ -388,8 +401,8 @@ selector_thread (gpointer data) } for (; list; list = mono_mlist_remove_item (list, list)) { - mono_threadpool_enqueue_work_item (mono_object_domain (mono_mlist_get_data (list)), mono_mlist_get_data (list), &error); - mono_error_assert_ok (&error); + mono_threadpool_enqueue_work_item (mono_object_domain (mono_mlist_get_data (list)), mono_mlist_get_data (list), error); + mono_error_assert_ok (error); } mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_SELECTOR, "io threadpool: del fd %3d", fd); @@ -541,7 +554,7 @@ initialize (void) mono_coop_mutex_init (&threadpool_io->updates_lock); mono_coop_cond_init (&threadpool_io->updates_cond); - mono_gc_register_root ((char *)&threadpool_io->updates [0], sizeof (threadpool_io->updates), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_THREAD_POOL, "i/o thread pool updates list"); + mono_gc_register_root ((char *)&threadpool_io->updates [0], sizeof (threadpool_io->updates), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_THREAD_POOL, NULL, "Thread Pool I/O Update List"); threadpool_io->updates_size = 0; @@ -563,9 +576,9 @@ initialize (void) io_selector_running = TRUE; - MonoError error; - if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, &error)) - g_error ("initialize: mono_thread_create_internal () failed due to %s", mono_error_get_message (&error)); + ERROR_DECL (error); + if (!mono_thread_create_internal (mono_get_root_domain (), selector_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, error)) + g_error ("initialize: mono_thread_create_internal () failed due to %s", mono_error_get_message (error)); mono_coop_mutex_unlock (&threadpool_io->updates_lock); } diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 8b340c34a1..ecf031fdec 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -131,9 +131,8 @@ typedef struct { ThreadPoolWorkerCounter counters; - MonoCoopMutex parked_threads_lock; + MonoCoopSem parked_threads_sem; gint32 parked_threads_count; - MonoCoopCond parked_threads_cond; volatile gint32 work_items_count; @@ -205,19 +204,18 @@ rand_create (void) static guint32 rand_next (gpointer *handle, guint32 min, guint32 max) { - MonoError error; + ERROR_DECL (error); guint32 val; - mono_rand_try_get_uint32 (handle, &val, min, max, &error); + mono_rand_try_get_uint32 (handle, &val, min, max, error); // FIXME handle error - mono_error_assert_ok (&error); + mono_error_assert_ok (error); return val; } static void destroy (gpointer data) { - mono_coop_mutex_destroy (&worker.parked_threads_lock); - mono_coop_cond_destroy (&worker.parked_threads_cond); + mono_coop_sem_destroy (&worker.parked_threads_sem); mono_coop_mutex_destroy (&worker.worker_creation_lock); @@ -238,9 +236,8 @@ mono_threadpool_worker_init (MonoThreadPoolWorkerCallback callback) worker.callback = callback; - mono_coop_mutex_init (&worker.parked_threads_lock); + mono_coop_sem_init (&worker.parked_threads_sem, 0); worker.parked_threads_count = 0; - mono_coop_cond_init (&worker.parked_threads_cond); worker.worker_creation_current_second = -1; mono_coop_mutex_init (&worker.worker_creation_lock); @@ -359,69 +356,60 @@ mono_threadpool_worker_request (void) mono_refcount_dec (&worker); } -static void -worker_wait_interrupt (gpointer unused) -{ - /* If the runtime is not shutting down, we are not using this mechanism to wake up a unparked thread, and if the - * runtime is shutting down, then we need to wake up ALL the threads. - * It might be a bit wasteful, but I witnessed shutdown hang where the main thread would abort and then wait for all - * background threads to exit (see mono_thread_manage). This would go wrong because not all threadpool threads would - * be unparked. It would end up getting unstucked because of the timeout, but that would delay shutdown by 5-60s. */ - if (!mono_runtime_is_shutting_down ()) - return; - - if (!mono_refcount_tryinc (&worker)) - return; - - mono_coop_mutex_lock (&worker.parked_threads_lock); - mono_coop_cond_broadcast (&worker.parked_threads_cond); - mono_coop_mutex_unlock (&worker.parked_threads_lock); - - mono_refcount_dec (&worker); -} - /* return TRUE if timeout, FALSE otherwise (worker unpark or interrupt) */ static gboolean worker_park (void) { gboolean timeout = FALSE; gboolean interrupted = FALSE; + 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 ()))); - mono_coop_mutex_lock (&worker.parked_threads_lock); - if (!mono_runtime_is_shutting_down ()) { static gpointer rand_handle = NULL; - MonoInternalThread *thread; ThreadPoolWorkerCounter counter; - if (!rand_handle) + if (!rand_handle) { rand_handle = rand_create (); - g_assert (rand_handle); - - thread = mono_thread_internal_current (); - g_assert (thread); + g_assert (rand_handle); + } COUNTER_ATOMIC (counter, { counter._.working --; counter._.parked ++; }); - worker.parked_threads_count += 1; + do { + old = mono_atomic_load_i32 (&worker.parked_threads_count); + g_assert (old >= G_MININT32); - mono_thread_info_install_interrupt (worker_wait_interrupt, NULL, &interrupted); - if (interrupted) - goto done; + new = old + 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); - if (mono_coop_cond_timedwait (&worker.parked_threads_cond, &worker.parked_threads_lock, rand_next (&rand_handle, 5 * 1000, 60 * 1000)) != 0) + 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: + break; + case MONO_SEM_TIMEDWAIT_RET_ALERTED: + interrupted = TRUE; + break; + case MONO_SEM_TIMEDWAIT_RET_TIMEDOUT: timeout = TRUE; + break; + default: + g_assert_not_reached (); + } - mono_thread_info_uninstall_interrupt (&interrupted); + if (interrupted || timeout) { + /* If the semaphore was posted, then worker.parked_threads_count was decremented in worker_try_unpark */ + do { + old = mono_atomic_load_i32 (&worker.parked_threads_count); + g_assert (old > G_MININT32); -done: - worker.parked_threads_count -= 1; + new = old - 1; + } while (mono_atomic_cas_i32 (&worker.parked_threads_count, new, old) != old); + } COUNTER_ATOMIC (counter, { counter._.working ++; @@ -429,8 +417,6 @@ done: }); } - mono_coop_mutex_unlock (&worker.parked_threads_lock); - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s", GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), timeout ? "yes" : "no", interrupted ? "yes" : "no"); @@ -440,17 +426,26 @@ done: static gboolean worker_try_unpark (void) { - gboolean res = FALSE; + gboolean res = TRUE; + 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 ()))); - mono_coop_mutex_lock (&worker.parked_threads_lock); - if (worker.parked_threads_count > 0) { - mono_coop_cond_signal (&worker.parked_threads_cond); - res = TRUE; - } - mono_coop_mutex_unlock (&worker.parked_threads_lock); + do { + old = mono_atomic_load_i32 (&worker.parked_threads_count); + g_assert (old > G_MININT32); + + if (old <= 0) { + res = FALSE; + break; + } + + 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); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try unpark worker, success? %s", GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), res ? "yes" : "no"); @@ -513,7 +508,7 @@ worker_thread (gpointer unused) static gboolean worker_try_create (void) { - MonoError error; + ERROR_DECL (error); MonoInternalThread *thread; gint64 current_ticks; gint32 now; @@ -556,11 +551,11 @@ worker_try_create (void) counter._.starting ++; }); - thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL, &error); + thread = mono_thread_create_internal (mono_get_root_domain (), worker_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL, error); if (!thread) { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, failed: could not create thread due to %s", - GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), mono_error_get_message (&error)); - mono_error_cleanup (&error); + GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), mono_error_get_message (error)); + mono_error_cleanup (error); COUNTER_ATOMIC (counter, { counter._.starting --; @@ -571,6 +566,10 @@ worker_try_create (void) return FALSE; } +#ifndef DISABLE_PERFCOUNTERS + mono_atomic_inc_i32 (&mono_perfcounters->threadpool_threads); +#endif + worker.worker_creation_current_count += 1; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] try create worker, created %p, now = %d count = %d", @@ -767,7 +766,7 @@ monitor_thread (gpointer unused) static void monitor_ensure_running (void) { - MonoError error; + ERROR_DECL (error); for (;;) { switch (worker.monitor_status) { case MONITOR_STATUS_REQUESTED: @@ -783,10 +782,10 @@ monitor_ensure_running (void) return; if (mono_atomic_cas_i32 (&worker.monitor_status, MONITOR_STATUS_REQUESTED, MONITOR_STATUS_NOT_RUNNING) == MONITOR_STATUS_NOT_RUNNING) { // printf ("monitor_thread: creating\n"); - if (!mono_thread_create_internal (mono_get_root_domain (), monitor_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, &error)) { + if (!mono_thread_create_internal (mono_get_root_domain (), monitor_thread, NULL, MONO_THREAD_CREATE_FLAGS_THREADPOOL | MONO_THREAD_CREATE_FLAGS_SMALL_STACK, error)) { // printf ("monitor_thread: creating failed\n"); worker.monitor_status = MONITOR_STATUS_NOT_RUNNING; - mono_error_cleanup (&error); + mono_error_cleanup (error); mono_refcount_dec (&worker); } return; diff --git a/mono/metadata/threadpool-worker-wasm.c b/mono/metadata/threadpool-worker-wasm.c new file mode 100644 index 0000000000..8877df9602 --- /dev/null +++ b/mono/metadata/threadpool-worker-wasm.c @@ -0,0 +1,77 @@ +/** + * \file + * native threadpool worker + * + * Author: + * Ludovic Henry (ludovic.henry@xamarin.com) + * + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ + +#include +#define _USE_MATH_DEFINES // needed by MSVC to define math constants +#include +#include +#include + +#include +#include + +static MonoThreadPoolWorkerCallback tp_cb; +static gboolean cb_scheduled; + +void +mono_threadpool_worker_init (MonoThreadPoolWorkerCallback callback) +{ + tp_cb = callback; +} + +void +mono_threadpool_worker_cleanup (void) +{ +} + +gint32 +mono_threadpool_worker_get_min (void) +{ + return 1; +} + +gboolean +mono_threadpool_worker_set_min (gint32 value) +{ + return value == 1; +} + +gint32 +mono_threadpool_worker_get_max (void) +{ + return 1; +} + +gboolean +mono_threadpool_worker_set_max (gint32 value) +{ + return value == 1; +} + +static void +fire_tp_callback (void) +{ + cb_scheduled = FALSE; + tp_cb (); +} + +void +mono_threadpool_worker_request (void) +{ + if (!cb_scheduled) + mono_threads_schedule_background_job (fire_tp_callback); + cb_scheduled = TRUE; +} + +gboolean +mono_threadpool_worker_notify_completed (void) +{ + return FALSE; +} diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c index 1b58cc2126..acf07d6765 100644 --- a/mono/metadata/threadpool.c +++ b/mono/metadata/threadpool.c @@ -286,7 +286,7 @@ try_invoke_perform_wait_callback (MonoObject** exc, MonoError *error) static void worker_callback (void) { - MonoError error; + ERROR_DECL (error); ThreadPoolDomain *tpdomain, *previous_tpdomain; ThreadPoolCounter counter; MonoInternalThread *thread; @@ -350,25 +350,25 @@ worker_callback (void) domains_unlock (); - MonoString *thread_name = mono_string_new_checked (mono_get_root_domain (), "Threadpool worker", &error); - mono_error_assert_ok (&error); - mono_thread_set_name_internal (thread, thread_name, FALSE, TRUE, &error); - mono_error_assert_ok (&error); + MonoString *thread_name = mono_string_new_checked (mono_get_root_domain (), "Thread Pool Worker", error); + mono_error_assert_ok (error); + mono_thread_set_name_internal (thread, thread_name, FALSE, TRUE, error); + mono_error_assert_ok (error); - mono_thread_clr_state (thread, (MonoThreadState)~ThreadState_Background); - if (!mono_thread_test_state (thread , ThreadState_Background)) - ves_icall_System_Threading_Thread_SetState (thread, ThreadState_Background); + mono_thread_clear_and_set_state (thread, + (MonoThreadState)~ThreadState_Background, + ThreadState_Background); mono_thread_push_appdomain_ref (tpdomain->domain); if (mono_domain_set (tpdomain->domain, FALSE)) { MonoObject *exc = NULL, *res; - res = try_invoke_perform_wait_callback (&exc, &error); - if (exc || !mono_error_ok(&error)) { + res = try_invoke_perform_wait_callback (&exc, error); + if (exc || !mono_error_ok(error)) { if (exc == NULL) - exc = (MonoObject *) mono_error_convert_to_exception (&error); + exc = (MonoObject *) mono_error_convert_to_exception (error); else - mono_error_cleanup (&error); + mono_error_cleanup (error); mono_thread_internal_unhandled_exception (exc); } else if (res && *(MonoBoolean*) mono_object_unbox (res) == FALSE) { retire = TRUE; @@ -736,13 +736,21 @@ ves_icall_System_Threading_ThreadPool_NotifyWorkItemProgressNative (void) mono_threadpool_worker_notify_completed (); } +void +ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void) +{ +#ifndef DISABLE_PERFCOUNTERS + mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems); +#endif +} + void ves_icall_System_Threading_ThreadPool_ReportThreadStatus (MonoBoolean is_working) { // TODO - MonoError error; - mono_error_set_not_implemented (&error, ""); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + mono_error_set_not_implemented (error, ""); + mono_error_set_pending_exception (error); } MonoBoolean @@ -801,9 +809,9 @@ MonoBoolean G_GNUC_UNUSED ves_icall_System_Threading_ThreadPool_PostQueuedCompletionStatus (MonoNativeOverlapped *native_overlapped) { /* This copy the behavior of the current Mono implementation */ - MonoError error; - mono_error_set_not_implemented (&error, ""); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + mono_error_set_not_implemented (error, ""); + mono_error_set_pending_exception (error); return FALSE; } diff --git a/mono/metadata/threadpool.h b/mono/metadata/threadpool.h index 91b404fe27..efe0ced567 100644 --- a/mono/metadata/threadpool.h +++ b/mono/metadata/threadpool.h @@ -46,6 +46,8 @@ ves_icall_System_Threading_ThreadPool_NotifyWorkItemComplete (void); void ves_icall_System_Threading_ThreadPool_NotifyWorkItemProgressNative (void); void +ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void); +void ves_icall_System_Threading_ThreadPool_ReportThreadStatus (MonoBoolean is_working); MonoBoolean ves_icall_System_Threading_ThreadPool_RequestWorkerThread (void); diff --git a/mono/metadata/threads-types.h b/mono/metadata/threads-types.h index 2feb0ba4f8..2814818714 100644 --- a/mono/metadata/threads-types.h +++ b/mono/metadata/threads-types.h @@ -55,6 +55,12 @@ typedef enum { typedef struct _MonoInternalThread MonoInternalThread; +/* It's safe to access System.Threading.InternalThread from native code via a + * raw pointer because all instances should be pinned. But for uniformity of + * icall wrapping, let's declare a MonoInternalThreadHandle anyway. + */ +TYPED_HANDLE_DECL (MonoInternalThread); + typedef void (*MonoThreadCleanupFunc) (MonoNativeThreadId tid); /* INFO has type MonoThreadInfo* */ typedef void (*MonoThreadNotifyPendingExcFunc) (gpointer info); @@ -76,21 +82,22 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, Mo void mono_threads_install_cleanup (MonoThreadCleanupFunc func); void ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThread *this_obj); -gpointer ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this_obj, MonoObject *start); +MonoBoolean +ves_icall_System_Threading_Thread_Thread_internal (MonoThread *this_obj, MonoObject *start); void ves_icall_System_Threading_InternalThread_Thread_free_internal(MonoInternalThread *this_obj); void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms); gboolean ves_icall_System_Threading_Thread_Join_internal(MonoThread *this_obj, int ms); gint32 ves_icall_System_Threading_Thread_GetDomainID (void); gboolean ves_icall_System_Threading_Thread_Yield (void); -MonoString* ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThread *this_obj); +MonoStringHandle ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThreadHandle this_obj, MonoError *error); void ves_icall_System_Threading_Thread_SetName_internal (MonoInternalThread *this_obj, MonoString *name); -int ves_icall_System_Threading_Thread_GetPriority (MonoThread *this_obj); -void ves_icall_System_Threading_Thread_SetPriority (MonoThread *this_obj, int priority); +int ves_icall_System_Threading_Thread_GetPriority (MonoThreadObjectHandle this_obj, MonoError *error); +void ves_icall_System_Threading_Thread_SetPriority (MonoThreadObjectHandle this_obj, int priority, MonoError *error); MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentCulture (MonoInternalThread *this_obj); void ves_icall_System_Threading_Thread_SetCachedCurrentCulture (MonoThread *this_obj, MonoObject *culture); MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentUICulture (MonoInternalThread *this_obj); void ves_icall_System_Threading_Thread_SetCachedCurrentUICulture (MonoThread *this_obj, MonoObject *culture); -MonoThread *ves_icall_System_Threading_Thread_GetCurrentThread (void); +MonoThreadObjectHandle ves_icall_System_Threading_Thread_GetCurrentThread (MonoError *error); gint32 ves_icall_System_Threading_WaitHandle_Wait_internal(gpointer *handles, gint32 numhandles, MonoBoolean waitall, gint32 ms, MonoError *error); gint32 ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal (gpointer toSignal, gpointer toWait, gint32 ms, MonoError *error); @@ -135,9 +142,9 @@ void ves_icall_System_Threading_Thread_ResetAbort (MonoThread *this_obj); MonoObject* ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThread *thread); void ves_icall_System_Threading_Thread_Suspend (MonoThread *this_obj); void ves_icall_System_Threading_Thread_Resume (MonoThread *thread); -void ves_icall_System_Threading_Thread_ClrState (MonoInternalThread *thread, guint32 state); -void ves_icall_System_Threading_Thread_SetState (MonoInternalThread *thread, guint32 state); -guint32 ves_icall_System_Threading_Thread_GetState (MonoInternalThread *thread); +void ves_icall_System_Threading_Thread_ClrState (MonoInternalThreadHandle thread, guint32 state, MonoError *error); +void ves_icall_System_Threading_Thread_SetState (MonoInternalThreadHandle thread_handle, guint32 state, MonoError *error); +guint32 ves_icall_System_Threading_Thread_GetState (MonoInternalThreadHandle thread_handle, MonoError *error); gint8 ves_icall_System_Threading_Thread_VolatileRead1 (void *ptr); gint16 ves_icall_System_Threading_Thread_VolatileRead2 (void *ptr); @@ -205,6 +212,7 @@ void mono_thread_set_state (MonoInternalThread *thread, MonoThreadState state); void mono_thread_clr_state (MonoInternalThread *thread, MonoThreadState state); gboolean mono_thread_test_state (MonoInternalThread *thread, MonoThreadState test); gboolean mono_thread_test_and_set_state (MonoInternalThread *thread, MonoThreadState test, MonoThreadState set); +void mono_thread_clear_and_set_state (MonoInternalThread *thread, MonoThreadState clear, MonoThreadState set); void mono_thread_init_apartment_state (void); void mono_thread_cleanup_apartment_state (void); @@ -267,4 +275,7 @@ mono_thread_internal_describe (MonoInternalThread *internal, GString *str); gboolean mono_thread_internal_is_current (MonoInternalThread *internal); +gboolean +mono_threads_is_current_thread_in_protected_block (void); + #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 1849d782c4..d8f14ab5aa 100644 --- a/mono/metadata/threads.c.REMOVED.git-id +++ b/mono/metadata/threads.c.REMOVED.git-id @@ -1 +1 @@ -e5ab853cd3c68b19321c1f59cc7c08e00e1bcd9b \ No newline at end of file +7fe367ede840af0a8a635e62ec4c21df49278b84 \ No newline at end of file diff --git a/mono/metadata/verify.c.REMOVED.git-id b/mono/metadata/verify.c.REMOVED.git-id index bcefba9d5e..54d2a5eaa8 100644 --- a/mono/metadata/verify.c.REMOVED.git-id +++ b/mono/metadata/verify.c.REMOVED.git-id @@ -1 +1 @@ -e509ed680c13c646aedb4b49a84abf321204d2f3 \ No newline at end of file +6fda18789202511c5496ed7280a140609a9101ac \ No newline at end of file diff --git a/mono/metadata/w32error-unix.c b/mono/metadata/w32error-unix.c index d6cc76bc5f..c69aada6ca 100644 --- a/mono/metadata/w32error-unix.c +++ b/mono/metadata/w32error-unix.c @@ -54,7 +54,9 @@ mono_w32error_unix_to_win32 (guint32 error) case ENOENT: case ENOTDIR: return ERROR_FILE_NOT_FOUND; case ENOSPC: return ERROR_HANDLE_DISK_FULL; +#if !defined(_AIX) || (defined(_AIX) && defined(_LINUX_SOURCE_COMPAT)) case ENOTEMPTY: return ERROR_DIR_NOT_EMPTY; +#endif case ENOEXEC: return ERROR_BAD_FORMAT; case ENAMETOOLONG: return ERROR_FILENAME_EXCED_RANGE; #ifdef EINPROGRESS @@ -63,6 +65,9 @@ mono_w32error_unix_to_win32 (guint32 error) case ENOSYS: return ERROR_NOT_SUPPORTED; case EBADF: return ERROR_INVALID_HANDLE; case EIO: return ERROR_INVALID_HANDLE; +#ifdef ERESTART + case ERESTART: +#endif case EINTR: return ERROR_IO_PENDING; /* best match I could find */ case EPIPE: return ERROR_WRITE_FAULT; case ELOOP: return ERROR_CANT_RESOLVE_FILENAME; diff --git a/mono/metadata/w32file-unix.c.REMOVED.git-id b/mono/metadata/w32file-unix.c.REMOVED.git-id index e7f47017bb..c605e88f85 100644 --- a/mono/metadata/w32file-unix.c.REMOVED.git-id +++ b/mono/metadata/w32file-unix.c.REMOVED.git-id @@ -1 +1 @@ -94d9b547da3a662f87ae7b00efb45c91a57360d3 \ No newline at end of file +435b5915c1cf7c6e5e50d5a865a4269cdc6eb0b9 \ No newline at end of file diff --git a/mono/metadata/w32file-win32.c b/mono/metadata/w32file-win32.c index 7d08aefdee..b8e63409c8 100644 --- a/mono/metadata/w32file-win32.c +++ b/mono/metadata/w32file-win32.c @@ -141,16 +141,6 @@ mono_w32file_get_type (gpointer handle) return res; } -gboolean -mono_w32file_get_times (gpointer handle, FILETIME *create_time, FILETIME *access_time, FILETIME *write_time) -{ - gboolean res; - MONO_ENTER_GC_SAFE; - res = GetFileTime (handle, create_time, access_time, write_time); - MONO_EXIT_GC_SAFE; - return res; -} - gboolean mono_w32file_set_times (gpointer handle, const FILETIME *create_time, const FILETIME *access_time, const FILETIME *write_time) { diff --git a/mono/metadata/w32file.c b/mono/metadata/w32file.c index 2fbb9a0005..c2af53ab79 100644 --- a/mono/metadata/w32file.c +++ b/mono/metadata/w32file.c @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -847,11 +847,11 @@ void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position, gint64 mono_filesize_from_path (MonoString *string) { - MonoError error; + ERROR_DECL (error); struct stat buf; gint64 res; - char *path = mono_string_to_utf8_checked (string, &error); - mono_error_raise_exception_deprecated (&error); /* OK to throw, external only without a good alternative */ + char *path = mono_string_to_utf8_checked (string, error); + mono_error_raise_exception_deprecated (error); /* OK to throw, external only without a good alternative */ gint stat_res; MONO_ENTER_GC_SAFE; diff --git a/mono/metadata/w32file.h b/mono/metadata/w32file.h index 73673495a2..67fb2fcb65 100644 --- a/mono/metadata/w32file.h +++ b/mono/metadata/w32file.h @@ -427,9 +427,6 @@ mono_w32file_get_file_size (gpointer handle, gint32 *error); gint mono_w32file_get_type (gpointer handle); -gboolean -mono_w32file_get_times (gpointer handle, FILETIME *create_time, FILETIME *access_time, FILETIME *write_time); - gboolean mono_w32file_set_times (gpointer handle, const FILETIME *create_time, const FILETIME *access_time, const FILETIME *write_time); diff --git a/mono/metadata/w32handle.c b/mono/metadata/w32handle.c index 5ba22cab55..81733f1151 100644 --- a/mono/metadata/w32handle.c +++ b/mono/metadata/w32handle.c @@ -24,23 +24,19 @@ #undef DEBUG_REFS -#define SLOT_MAX (1024 * 32) +#define HANDLES_PER_SLOT 240 -/* must be a power of 2 */ -#define HANDLE_PER_SLOT (256) +typedef struct _MonoW32HandleSlot MonoW32HandleSlot; +struct _MonoW32HandleSlot { + MonoW32HandleSlot *next; + MonoW32Handle handles[HANDLES_PER_SLOT]; +}; static MonoW32HandleCapability handle_caps [MONO_W32TYPE_COUNT]; static MonoW32HandleOps *handle_ops [MONO_W32TYPE_COUNT]; -/* - * We can hold SLOT_MAX * HANDLE_PER_SLOT handles. - * If 4M handles are not enough... Oh, well... we will crash. - */ -#define SLOT_INDEX(x) (x / HANDLE_PER_SLOT) -#define SLOT_OFFSET(x) (x % HANDLE_PER_SLOT) - -static MonoW32Handle **private_handles; -static guint32 private_handles_size = 0; +static MonoW32HandleSlot *handles_slots_first; +static MonoW32HandleSlot *handles_slots_last; /* * This is an internal handle which is used for handling waiting for multiple handles. @@ -163,7 +159,7 @@ mono_w32handle_init (void) mono_coop_cond_init (&global_signal_cond); mono_coop_mutex_init (&global_signal_mutex); - private_handles = g_new0 (MonoW32Handle*, SLOT_MAX); + handles_slots_first = handles_slots_last = g_new0 (MonoW32HandleSlot, 1); initialized = TRUE; } @@ -171,15 +167,15 @@ mono_w32handle_init (void) void mono_w32handle_cleanup (void) { - int i; + MonoW32HandleSlot *slot, *slot_next; g_assert (!shutting_down); shutting_down = TRUE; - for (i = 0; i < SLOT_MAX; ++i) - g_free (private_handles [i]); - - g_free (private_handles); + for (slot = handles_slots_first; slot; slot = slot_next) { + slot_next = slot->next; + g_free (slot); + } } static gsize @@ -196,62 +192,71 @@ mono_w32handle_ops_typesize (MonoW32Type type); static MonoW32Handle* mono_w32handle_new_internal (MonoW32Type type, gpointer handle_specific) { - guint32 i, k, count; - static guint32 last = 0; - gboolean retry = FALSE; - - /* A linear scan should be fast enough. Start from the last - * allocation, assuming that handles are allocated more often - * than they're freed. Leave the space reserved for file - * descriptors - */ + static MonoW32HandleSlot *slot_last = NULL; + static guint32 index_last = 0; + MonoW32HandleSlot *slot; + guint32 index; + gboolean retried; - if (last == 0) { - /* We need to go from 1 since a handle of value 0 can be considered invalid in managed code */ - last = 1; - } else { - retry = TRUE; + if (!slot_last) { + slot_last = handles_slots_first; + g_assert (slot_last); } -again: - count = last; - for(i = SLOT_INDEX (count); i < private_handles_size; i++) { - if (private_handles [i]) { - for (k = SLOT_OFFSET (count); k < HANDLE_PER_SLOT; k++) { - MonoW32Handle *handle_data = &private_handles [i][k]; + /* A linear scan should be fast enough. Start from the last allocation, assuming that handles are allocated more + * often than they're freed. */ - if (handle_data->type == MONO_W32TYPE_UNUSED) { - last = count + 1; +retry_from_beginning: + retried = FALSE; - g_assert (handle_data->ref == 0); + slot = slot_last; + g_assert (slot); - handle_data->type = type; - handle_data->signalled = FALSE; - handle_data->ref = 1; + index = index_last; + g_assert (index >= 0); + g_assert (index <= HANDLES_PER_SLOT); - mono_coop_cond_init (&handle_data->signal_cond); - mono_coop_mutex_init (&handle_data->signal_mutex); +retry: + for(; slot; slot = slot->next) { + for (; index < HANDLES_PER_SLOT; index++) { + MonoW32Handle *handle_data = &slot->handles [index]; - if (handle_specific) - handle_data->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type)); + if (handle_data->type == MONO_W32TYPE_UNUSED) { + slot_last = slot; + index_last = index + 1; - return handle_data; - } - count++; + g_assert (handle_data->ref == 0); + + handle_data->type = type; + handle_data->signalled = FALSE; + handle_data->ref = 1; + + mono_coop_cond_init (&handle_data->signal_cond); + mono_coop_mutex_init (&handle_data->signal_mutex); + + if (handle_specific) + handle_data->specific = g_memdup (handle_specific, mono_w32handle_ops_typesize (type)); + + return handle_data; } } + index = 0; } - if (retry) { + if (!retried) { /* Try again from the beginning */ - last = 1; - retry = FALSE; - goto again; + slot = handles_slots_first; + index = 0; + retried = TRUE; + goto retry; } - /* Will need to expand the array. The caller will sort it out */ + handles_slots_last = (handles_slots_last->next = g_new0 (MonoW32HandleSlot, 1)); + goto retry_from_beginning; - return GINT_TO_POINTER (-1); + /* We already went around and didn't find a slot, so let's put ourselves on the empty slot we just allocated */ + slot_last = handles_slots_last; + index_last = 0; } gpointer @@ -263,18 +268,8 @@ mono_w32handle_new (MonoW32Type type, gpointer handle_specific) mono_coop_mutex_lock (&scan_mutex); - while ((handle_data = mono_w32handle_new_internal (type, handle_specific)) == GINT_TO_POINTER (-1)) { - /* Try and expand the array, and have another go */ - if (private_handles_size >= SLOT_MAX) { - mono_coop_mutex_unlock (&scan_mutex); - - /* We ran out of slots */ - mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER_HANDLE, "%s: failed to create %s handle", __func__, mono_w32handle_ops_typename (type)); - return INVALID_HANDLE_VALUE; - } - - private_handles [private_handles_size ++] = g_new0 (MonoW32Handle, HANDLE_PER_SLOT); - } + handle_data = mono_w32handle_new_internal (type, handle_specific); + g_assert (handle_data); mono_coop_mutex_unlock (&scan_mutex); @@ -346,21 +341,20 @@ mono_w32handle_lookup_and_ref (gpointer handle, MonoW32Handle **handle_data) void mono_w32handle_foreach (gboolean (*on_each)(MonoW32Handle *handle_data, gpointer user_data), gpointer user_data) { + MonoW32HandleSlot *slot; GPtrArray *handles_to_destroy; - guint32 i, k; + guint32 i; handles_to_destroy = NULL; mono_coop_mutex_lock (&scan_mutex); - for (i = SLOT_INDEX (0); i < private_handles_size; i++) { - if (!private_handles [i]) - continue; - for (k = SLOT_OFFSET (0); k < HANDLE_PER_SLOT; k++) { + for (slot = handles_slots_first; slot; slot = slot->next) { + for (i = 0; i < HANDLES_PER_SLOT; i++) { MonoW32Handle *handle_data; gboolean destroy, finished; - handle_data = &private_handles [i][k]; + handle_data = &slot->handles [i]; if (handle_data->type == MONO_W32TYPE_UNUSED) continue; diff --git a/mono/metadata/w32mutex-unix.c b/mono/metadata/w32mutex-unix.c index d0ede1ccb1..f28414fe1f 100644 --- a/mono/metadata/w32mutex-unix.c +++ b/mono/metadata/w32mutex-unix.c @@ -469,14 +469,9 @@ cleanup: } void -mono_w32mutex_abandon (void) +mono_w32mutex_abandon (MonoInternalThread *internal) { - MonoInternalThread *internal; - - g_assert (mono_thread_internal_current_is_attached ()); - - internal = mono_thread_internal_current (); - g_assert (internal); + g_assert (mono_thread_internal_is_current (internal)); if (!internal->owned_mutexes) return; diff --git a/mono/metadata/w32mutex.h b/mono/metadata/w32mutex.h index 3757315915..499b3236ef 100644 --- a/mono/metadata/w32mutex.h +++ b/mono/metadata/w32mutex.h @@ -31,7 +31,7 @@ mono_w32mutex_get_namespace (MonoW32HandleNamedMutex *mutex); #ifndef HOST_WIN32 void -mono_w32mutex_abandon (void); +mono_w32mutex_abandon (MonoInternalThread *internal); #endif #endif /* _MONO_METADATA_W32MUTEX_H_ */ diff --git a/mono/metadata/w32process-unix-bsd.c b/mono/metadata/w32process-unix-bsd.c index 34eac0459e..7cd859c7aa 100644 --- a/mono/metadata/w32process-unix-bsd.c +++ b/mono/metadata/w32process-unix-bsd.c @@ -8,6 +8,7 @@ #ifdef USE_BSD_BACKEND #include +#include #include #include #if !defined(__OpenBSD__) diff --git a/mono/metadata/w32process-unix.c.REMOVED.git-id b/mono/metadata/w32process-unix.c.REMOVED.git-id index 07106fdf1a..a17410cabb 100644 --- a/mono/metadata/w32process-unix.c.REMOVED.git-id +++ b/mono/metadata/w32process-unix.c.REMOVED.git-id @@ -1 +1 @@ -24784657bc53a5a85df3e43f2e6a3ab73786fdba \ No newline at end of file +b327300d125ae58d206c06ff56664b15ca2c6cf4 \ No newline at end of file diff --git a/mono/metadata/w32process-win32.c b/mono/metadata/w32process-win32.c index 2b90f908f3..973d355434 100644 --- a/mono/metadata/w32process-win32.c +++ b/mono/metadata/w32process-win32.c @@ -238,7 +238,7 @@ process_get_shell_arguments (MonoW32ProcessStartInfo *proc_start_info, MonoStrin { gchar *spath = NULL; gchar *new_cmd, *cmd_utf8; - MonoError mono_error; + ERROR_DECL_VALUE (mono_error); *cmd = proc_start_info->arguments; @@ -354,7 +354,7 @@ mono_process_win_enum_processes (DWORD *pids, DWORD count, DWORD *needed) MonoArray * ves_icall_System_Diagnostics_Process_GetProcesses_internal (void) { - MonoError error; + ERROR_DECL (error); MonoArray *procs; gboolean ret; DWORD needed; @@ -382,8 +382,8 @@ ves_icall_System_Diagnostics_Process_GetProcesses_internal (void) } while (TRUE); count = needed / sizeof (guint32); - procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, &error); - if (mono_error_set_pending_exception (&error)) { + procs = mono_array_new_checked (mono_domain_get (), mono_get_int32_class (), count, error); + if (mono_error_set_pending_exception (error)) { g_free (pids); return NULL; } diff --git a/mono/metadata/w32process.c b/mono/metadata/w32process.c index b4720d029b..13b60cb876 100644 --- a/mono/metadata/w32process.c +++ b/mono/metadata/w32process.c @@ -428,19 +428,19 @@ cleanup: void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename) { - MonoError error; + ERROR_DECL (error); stash_system_image (mono_object_class (this_obj)->image); - mono_w32process_get_fileversion (this_obj, mono_string_chars (filename), &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + mono_w32process_get_fileversion (this_obj, mono_string_chars (filename), error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return; } - process_set_field_string (this_obj, "filename", mono_string_chars (filename), mono_string_length (filename), &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + process_set_field_string (this_obj, "filename", mono_string_chars (filename), mono_string_length (filename), error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); } } @@ -562,7 +562,7 @@ process_get_module (MonoAssembly *assembly, MonoClass *proc_class, MonoError *er MonoArray * ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process) { - MonoError error; + ERROR_DECL (error); MonoArray *temp_arr = NULL; MonoArray *arr; HMODULE mods[1024]; @@ -584,17 +584,17 @@ ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, module_count += needed / sizeof(HMODULE); count = module_count + assembly_count; - temp_arr = mono_array_new_checked (mono_domain_get (), get_process_module_class (), count, &error); - if (mono_error_set_pending_exception (&error)) + temp_arr = mono_array_new_checked (mono_domain_get (), get_process_module_class (), count, error); + if (mono_error_set_pending_exception (error)) return NULL; for (i = 0; i < module_count; i++) { if (mono_w32process_module_get_name (process, mods[i], modname, MAX_PATH) && mono_w32process_module_get_filename (process, mods[i], filename, MAX_PATH)) { - MonoObject *module = process_add_module (process, mods[i], filename, modname, get_process_module_class (), &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + MonoObject *module = process_add_module (process, mods[i], filename, modname, get_process_module_class (), error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } mono_array_setref (temp_arr, num_added++, module); @@ -604,9 +604,9 @@ ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, if (assemblies) { for (i = 0; i < assembly_count; i++) { MonoAssembly *ass = (MonoAssembly *)g_ptr_array_index (assemblies, i); - MonoObject *module = process_get_module (ass, get_process_module_class (), &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + MonoObject *module = process_get_module (ass, get_process_module_class (), error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } mono_array_setref (temp_arr, num_added++, module); @@ -618,8 +618,8 @@ ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, arr = temp_arr; } else { /* shorter version of the array */ - arr = mono_array_new_checked (mono_domain_get (), get_process_module_class (), num_added, &error); - if (mono_error_set_pending_exception (&error)) + arr = mono_array_new_checked (mono_domain_get (), get_process_module_class (), num_added, error); + if (mono_error_set_pending_exception (error)) return NULL; for (i = 0; i < num_added; i++) @@ -636,7 +636,7 @@ ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, MonoString * ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process) { - MonoError error; + ERROR_DECL (error); MonoString *string; gunichar2 name[MAX_PATH]; guint32 len; @@ -652,9 +652,9 @@ ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process) if (len == 0) return NULL; - string = mono_string_new_utf16_checked (mono_domain_get (), name, len, &error); - if (!mono_error_ok (&error)) - mono_error_set_pending_exception (&error); + string = mono_string_new_utf16_checked (mono_domain_get (), name, len, error); + if (!mono_error_ok (error)) + mono_error_set_pending_exception (error); return string; } diff --git a/mono/mini/Makefile.am b/mono/mini/Makefile.am index 09d1c2e821..8059fde3c9 100644 --- a/mono/mini/Makefile.am +++ b/mono/mini/Makefile.am @@ -30,18 +30,6 @@ sgen_libs = \ $(monodir)/mono/utils/libmonoutils.la \ $(GLIB_LIBS) $(LIBICONV) -boehm_static_libs= \ - $(monodir)/mono/metadata/libmonoruntime-static.la \ - $(monodir)/mono/utils/libmonoutils.la \ - $(GLIB_LIBS) $(LIBICONV) \ - $(libgc_static_libs) - -sgen_static_libs = \ - $(monodir)/mono/metadata/libmonoruntimesgen-static.la \ - $(monodir)/mono/sgen/libmonosgen-static.la \ - $(monodir)/mono/utils/libmonoutils.la \ - $(GLIB_LIBS) $(LIBICONV) - 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 @@ -67,6 +55,7 @@ AM_CFLAGS = \ -I$(top_srcdir) \ $(GLIB_CFLAGS) \ $(LLVM_CFLAGS) \ + $(JEMALLOC_CFLAGS) \ $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS) AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS) @@ -94,12 +83,12 @@ endif if SUPPORT_SGEN sgen_binaries = mono-sgen sgen_libraries = libmonosgen-2.0.la -sgen_static_libraries = libmini-static.la $(sgen_static_libs) +sgen_static_libraries = libmini.la $(interp_libs_with_mini) $(sgen_libs) endif if SUPPORT_BOEHM boehm_libraries = libmonoboehm-2.0.la -boehm_static_libraries = libmini-static.la $(boehm_static_libs) +boehm_static_libraries = libmini.la $(interp_libs_with_mini) $(boehm_libs) boehm_binaries = mono-boehm endif @@ -149,17 +138,17 @@ endif lib_LTLIBRARIES = $(shared_libraries) +if DISABLE_INTERPRETER +lib_LTLIBRARIES += $(interp_libs) +endif + if SHARED_MONO mini_common_lib = libmini.la else mini_common_lib = endif -if DISABLE_EXECUTABLES noinst_LTLIBRARIES = $(mini_common_lib) -else -noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la -endif if LOADED_LLVM lib_LTLIBRARIES += libmono-llvm.la @@ -192,20 +181,12 @@ mono_sgen_CFLAGS = $(AM_CFLAGS) # We build this after libmono was built so it contains the date when the final # link was done if SUPPORT_BOEHM -if DISABLE_EXECUTABLES -buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la -else -buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la -endif +buildver-boehm.h: libmini.la $(monodir)/mono/metadata/libmonoruntime.la @echo "const char *build_date = \"`date`\";" > buildver-boehm.h mono_boehm-main.$(OBJEXT): buildver-boehm.h endif -if DISABLE_EXECUTABLES -buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la -else -buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la -endif +buildver-sgen.h: libmini.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la @echo "const char *build_date = \"`date`\";" > buildver-sgen.h mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h main-sgen.$(OBJEXT): buildver-sgen.h @@ -247,7 +228,7 @@ mono_boehm_LDADD = \ $(MONO_DTRACE_OBJECT) mono_boehm_LDFLAGS = \ - $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags) + $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) mono_sgen_LDADD = \ $(MONO_SGEN_LIB) \ @@ -257,7 +238,7 @@ mono_sgen_LDADD = \ -lm \ $(MONO_DTRACE_OBJECT) -mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags) +mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) if BITCODE libmonoldflags += -no-undefined @@ -386,10 +367,6 @@ llvm_sources = \ endif endif -if DISABLE_INTERPRETER -interp_sources = \ - interp/interp.h -else interp_sources = \ interp/hacks.h \ interp/interp.h \ @@ -399,6 +376,11 @@ interp_sources = \ interp/mintops.def \ interp/mintops.c \ interp/transform.c + +interp_libs = libmono-ee-interp.la + +if !DISABLE_INTERPRETER +interp_libs_with_mini = $(interp_libs) endif if ENABLE_LLVM @@ -484,6 +466,7 @@ common_sources = \ mini-profiler.c \ interp-stubs.c \ aot-runtime.h \ + ee.h \ mini-runtime.h test_sources = \ @@ -544,6 +527,7 @@ if WASM arch_sources = $(wasm_sources) arch_built=cpu-wasm.h arch_define=__wasm__ +target_define=TARGET_WASM endif if X86 @@ -635,27 +619,34 @@ os_sources = $(darwin_sources) $(posix_sources) monobin_platform_ldflags=-framework CoreFoundation -framework Foundation endif -libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(interp_sources) $(arch_sources) $(os_sources) -libmini_la_CFLAGS = $(mono_CFLAGS) +if MONO_JEMALLOC_ENABLED +libmonoldflags += $(JEMALLOC_LDFLAGS) +mono_CFLAGS += $(JEMALLOC_CFLAGS) +endif -libmonoboehm_2_0_la_SOURCES = -libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) -libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -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 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) +libmono_ee_interp_la_SOURCES = $(interp_sources) +libmono_ee_interp_la_CFLAGS = $(mono_CFLAGS) +libmono_ee_interp_la_LDFLAGS = $(libmonoldflags) +if BITCODE +libmono_ee_interp_la_LIBADD = libmonosgen-2.0.la +endif # # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain # compile time dependencies on boehm/sgen. # -libmini_static_la_SOURCES = $(libmini_la_SOURCES) -libmini_static_la_CFLAGS = $(AM_CFLAGS) -libmini_static_la_LDFLAGS = -static -libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT) +libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources) +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) $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) +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) $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) +libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit @@ -928,7 +919,11 @@ version.h: Makefile echo "#define FULL_VERSION \"$$branch/$$version\""; \ ); \ else \ - echo "#define FULL_VERSION \"tarball\""; \ + if test -z "$$MONO_BRANCH" -o -z "$$MONO_BUILD_REVISION"; then \ + echo "#define FULL_VERSION \"tarball\""; \ + else \ + echo "#define FULL_VERSION \"$$MONO_BRANCH/$$MONO_BUILD_REVISION\""; \ + fi \ fi > version.h # Utility target for patching libtool to speed up linking diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index 09d1c2e821..8059fde3c9 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -30,18 +30,6 @@ sgen_libs = \ $(monodir)/mono/utils/libmonoutils.la \ $(GLIB_LIBS) $(LIBICONV) -boehm_static_libs= \ - $(monodir)/mono/metadata/libmonoruntime-static.la \ - $(monodir)/mono/utils/libmonoutils.la \ - $(GLIB_LIBS) $(LIBICONV) \ - $(libgc_static_libs) - -sgen_static_libs = \ - $(monodir)/mono/metadata/libmonoruntimesgen-static.la \ - $(monodir)/mono/sgen/libmonosgen-static.la \ - $(monodir)/mono/utils/libmonoutils.la \ - $(GLIB_LIBS) $(LIBICONV) - 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 @@ -67,6 +55,7 @@ AM_CFLAGS = \ -I$(top_srcdir) \ $(GLIB_CFLAGS) \ $(LLVM_CFLAGS) \ + $(JEMALLOC_CFLAGS) \ $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS) AM_CXXFLAGS = $(LLVM_CXXFLAGS) $(GLIB_CFLAGS) @@ -94,12 +83,12 @@ endif if SUPPORT_SGEN sgen_binaries = mono-sgen sgen_libraries = libmonosgen-2.0.la -sgen_static_libraries = libmini-static.la $(sgen_static_libs) +sgen_static_libraries = libmini.la $(interp_libs_with_mini) $(sgen_libs) endif if SUPPORT_BOEHM boehm_libraries = libmonoboehm-2.0.la -boehm_static_libraries = libmini-static.la $(boehm_static_libs) +boehm_static_libraries = libmini.la $(interp_libs_with_mini) $(boehm_libs) boehm_binaries = mono-boehm endif @@ -149,17 +138,17 @@ endif lib_LTLIBRARIES = $(shared_libraries) +if DISABLE_INTERPRETER +lib_LTLIBRARIES += $(interp_libs) +endif + if SHARED_MONO mini_common_lib = libmini.la else mini_common_lib = endif -if DISABLE_EXECUTABLES noinst_LTLIBRARIES = $(mini_common_lib) -else -noinst_LTLIBRARIES = $(mini_common_lib) libmini-static.la -endif if LOADED_LLVM lib_LTLIBRARIES += libmono-llvm.la @@ -192,20 +181,12 @@ mono_sgen_CFLAGS = $(AM_CFLAGS) # We build this after libmono was built so it contains the date when the final # link was done if SUPPORT_BOEHM -if DISABLE_EXECUTABLES -buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime.la -else -buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la -endif +buildver-boehm.h: libmini.la $(monodir)/mono/metadata/libmonoruntime.la @echo "const char *build_date = \"`date`\";" > buildver-boehm.h mono_boehm-main.$(OBJEXT): buildver-boehm.h endif -if DISABLE_EXECUTABLES -buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la -else -buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la $(monodir)/mono/sgen/libmonosgen-static.la -endif +buildver-sgen.h: libmini.la $(monodir)/mono/metadata/libmonoruntimesgen.la $(monodir)/mono/sgen/libmonosgen.la @echo "const char *build_date = \"`date`\";" > buildver-sgen.h mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h main-sgen.$(OBJEXT): buildver-sgen.h @@ -247,7 +228,7 @@ mono_boehm_LDADD = \ $(MONO_DTRACE_OBJECT) mono_boehm_LDFLAGS = \ - $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags) + $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) mono_sgen_LDADD = \ $(MONO_SGEN_LIB) \ @@ -257,7 +238,7 @@ mono_sgen_LDADD = \ -lm \ $(MONO_DTRACE_OBJECT) -mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags) +mono_sgen_LDFLAGS = $(static_flags) $(monobinldflags) $(monobin_platform_ldflags) if BITCODE libmonoldflags += -no-undefined @@ -386,10 +367,6 @@ llvm_sources = \ endif endif -if DISABLE_INTERPRETER -interp_sources = \ - interp/interp.h -else interp_sources = \ interp/hacks.h \ interp/interp.h \ @@ -399,6 +376,11 @@ interp_sources = \ interp/mintops.def \ interp/mintops.c \ interp/transform.c + +interp_libs = libmono-ee-interp.la + +if !DISABLE_INTERPRETER +interp_libs_with_mini = $(interp_libs) endif if ENABLE_LLVM @@ -484,6 +466,7 @@ common_sources = \ mini-profiler.c \ interp-stubs.c \ aot-runtime.h \ + ee.h \ mini-runtime.h test_sources = \ @@ -544,6 +527,7 @@ if WASM arch_sources = $(wasm_sources) arch_built=cpu-wasm.h arch_define=__wasm__ +target_define=TARGET_WASM endif if X86 @@ -635,27 +619,34 @@ os_sources = $(darwin_sources) $(posix_sources) monobin_platform_ldflags=-framework CoreFoundation -framework Foundation endif -libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(interp_sources) $(arch_sources) $(os_sources) -libmini_la_CFLAGS = $(mono_CFLAGS) +if MONO_JEMALLOC_ENABLED +libmonoldflags += $(JEMALLOC_LDFLAGS) +mono_CFLAGS += $(JEMALLOC_CFLAGS) +endif -libmonoboehm_2_0_la_SOURCES = -libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS) -libmonoboehm_2_0_la_LIBADD = libmini.la $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -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 $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) -libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) +libmono_ee_interp_la_SOURCES = $(interp_sources) +libmono_ee_interp_la_CFLAGS = $(mono_CFLAGS) +libmono_ee_interp_la_LDFLAGS = $(libmonoldflags) +if BITCODE +libmono_ee_interp_la_LIBADD = libmonosgen-2.0.la +endif # # This library is shared between mono and mono-sgen, since the code in mini/ doesn't contain # compile time dependencies on boehm/sgen. # -libmini_static_la_SOURCES = $(libmini_la_SOURCES) -libmini_static_la_CFLAGS = $(AM_CFLAGS) -libmini_static_la_LDFLAGS = -static -libmini_static_la_LIBADD = $(MONO_DTRACE_OBJECT) +libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(llvm_runtime_sources) $(arch_sources) $(os_sources) +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) $(boehm_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) +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) $(sgen_libs) $(LIBMONO_DTRACE_OBJECT) $(LLVMMONOF) +libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags) $(monobin_platform_ldflags) libmonoincludedir = $(includedir)/mono-$(API_VER)/mono/jit @@ -928,7 +919,11 @@ version.h: Makefile echo "#define FULL_VERSION \"$$branch/$$version\""; \ ); \ else \ - echo "#define FULL_VERSION \"tarball\""; \ + if test -z "$$MONO_BRANCH" -o -z "$$MONO_BUILD_REVISION"; then \ + echo "#define FULL_VERSION \"tarball\""; \ + else \ + echo "#define FULL_VERSION \"$$MONO_BRANCH/$$MONO_BUILD_REVISION\""; \ + fi \ fi > version.h # Utility target for patching libtool to speed up linking diff --git a/mono/mini/Makefile.in.REMOVED.git-id b/mono/mini/Makefile.in.REMOVED.git-id index 7921ccbf52..6e3351c8a9 100644 --- a/mono/mini/Makefile.in.REMOVED.git-id +++ b/mono/mini/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -79ad89bfa38a6955409bbde7832246a94e04d3a9 \ No newline at end of file +65b252a2198ccae81c9cbabed24fcb6a69d4ddd8 \ No newline at end of file diff --git a/mono/mini/aot-compiler.c.REMOVED.git-id b/mono/mini/aot-compiler.c.REMOVED.git-id index d7b7622de2..8f7fdeb43f 100644 --- a/mono/mini/aot-compiler.c.REMOVED.git-id +++ b/mono/mini/aot-compiler.c.REMOVED.git-id @@ -1 +1 @@ -f9fa15982725467ea01450523aba24e102695d39 \ No newline at end of file +0a964f9d46c0c1c78cb33cad45bd7be6f537dd4f \ No newline at end of file diff --git a/mono/mini/aot-runtime-wasm.c b/mono/mini/aot-runtime-wasm.c index fa9b7ad0bd..4541b6d99d 100644 --- a/mono/mini/aot-runtime-wasm.c +++ b/mono/mini/aot-runtime-wasm.c @@ -121,19 +121,22 @@ get_long_arg (InterpMethodArguments *margs, int idx) #include "wasm_m2n_invoke.g.h" static void -wasm_enter_icall_trampoline (void *target_func, InterpMethodArguments *margs) +wasm_interp_to_native_trampoline (void *target_func, InterpMethodArguments *margs) { - static char cookie [8]; - static int c_count; + char cookie [32]; + int c_count; MonoMethodSignature *sig = margs->sig; c_count = sig->param_count + sig->hasthis + 1; + g_assert (c_count < sizeof (cookie)); //ensure we don't overflow the local + cookie [0] = type_to_c (sig->ret); if (sig->hasthis) cookie [1] = 'I'; - for (int i = 0; i < sig->param_count; ++i) - cookie [1 + sig->hasthis + i ] = type_to_c (sig->params [i]); + for (int i = 0; i < sig->param_count; ++i) { + cookie [1 + sig->hasthis + i] = type_to_c (sig->params [i]); + } cookie [c_count] = 0; icall_trampoline_dispatch (cookie, target_func, margs); @@ -154,8 +157,8 @@ mono_aot_get_trampoline_full (const char *name, MonoTrampInfo **out_tinfo) code = wasm_rethrow_exception; else if (!strcmp (name, "throw_corlib_exception")) code = wasm_throw_corlib_exception; - else if (!strcmp (name, "enter_icall_trampoline")) - code = wasm_enter_icall_trampoline; + else if (!strcmp (name, "interp_to_native_trampoline")) + code = wasm_interp_to_native_trampoline; g_assert (code); diff --git a/mono/mini/aot-runtime.c.REMOVED.git-id b/mono/mini/aot-runtime.c.REMOVED.git-id index 82d629bc30..8c4d1bc98e 100644 --- a/mono/mini/aot-runtime.c.REMOVED.git-id +++ b/mono/mini/aot-runtime.c.REMOVED.git-id @@ -1 +1 @@ -e31719bf87ac644309f75387f00b04a3ee48cdab \ No newline at end of file +3897ff261c812f0c8b906c55bc59b56b9cd568db \ No newline at end of file diff --git a/mono/mini/aot-tests.cs b/mono/mini/aot-tests.cs index b2378a9f8f..5d749c10ac 100644 --- a/mono/mini/aot-tests.cs +++ b/mono/mini/aot-tests.cs @@ -422,6 +422,7 @@ 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/branch-opts.c b/mono/mini/branch-opts.c index 0dab1240f8..4280c595ef 100644 --- a/mono/mini/branch-opts.c +++ b/mono/mini/branch-opts.c @@ -15,6 +15,7 @@ #ifndef DISABLE_JIT #include "mini.h" +#include "mini-runtime.h" /* * Returns true if @bb is a basic block which falls through the next block. diff --git a/mono/mini/builtin-types.cs b/mono/mini/builtin-types.cs index de06a0dc57..48f79eaf03 100644 --- a/mono/mini/builtin-types.cs +++ b/mono/mini/builtin-types.cs @@ -66,7 +66,6 @@ public class BuiltinTests { return 0; } -#if FALSE static int test_0_nint_inc () { var x = (nint)10; @@ -84,7 +83,6 @@ public class BuiltinTests { return 1; return 0; } -#endif static int test_0_nint_add () { @@ -330,7 +328,6 @@ public class BuiltinTests { return 0; } -#if FALSE static int test_0_nuint_inc () { var x = (nuint)10; @@ -348,7 +345,6 @@ public class BuiltinTests { return 1; return 0; } -#endif static int test_0_nuint_add () { @@ -1067,7 +1063,7 @@ namespace System #endif } - public static explicit operator nint (long v) + public static implicit operator nint (long v) { #if NINT_JIT_OPTIMIZED throw new NotImplementedException (); @@ -1187,13 +1183,6 @@ namespace System public static nint operator ~ (nint v) { return new nint (~v.v); } #endif -#if NINT_JIT_OPTIMIZED - public static nint operator ++ (nint v) { throw new NotImplementedException (); } - public static nint operator -- (nint v) { throw new NotImplementedException (); } -#else - public static nint operator ++ (nint v) { return new nint (v.v + 1); } - public static nint operator -- (nint v) { return new nint (v.v - 1); } -#endif #if NINT_JIT_OPTIMIZED public static nint operator + (nint l, nint r) { throw new NotImplementedException (); } @@ -1614,7 +1603,7 @@ namespace System #endif } - public static explicit operator nuint (ulong v) + public static implicit operator nuint (ulong v) { #if NINT_JIT_OPTIMIZED throw new NotImplementedException (); @@ -1710,14 +1699,6 @@ namespace System public static nuint operator ~ (nuint v) { return new nuint (~v.v); } #endif -#if NINT_JIT_OPTIMIZED - public static nuint operator ++ (nuint v) { throw new NotImplementedException (); } - public static nuint operator -- (nuint v) { throw new NotImplementedException (); } -#else - public static nuint operator ++ (nuint v) { return new nuint (v.v + 1); } - public static nuint operator -- (nuint v) { return new nuint (v.v - 1); } -#endif - #if NINT_JIT_OPTIMIZED public static nuint operator + (nuint l, nuint r) { throw new NotImplementedException (); } public static nuint operator - (nuint l, nuint r) { throw new NotImplementedException (); } diff --git a/mono/mini/debug-mini.c b/mono/mini/debug-mini.c index 30874eb3cf..fb49311687 100644 --- a/mono/mini/debug-mini.c +++ b/mono/mini/debug-mini.c @@ -9,6 +9,7 @@ */ #include "mini.h" +#include "mini-runtime.h" #include "jit.h" #include "config.h" #include @@ -121,7 +122,7 @@ static void mono_debug_add_vg_method (MonoMethod *method, MonoDebugMethodJitInfo *jit) { #ifdef VALGRIND_ADD_LINE_INFO - MonoError error; + ERROR_DECL (error); MonoMethodHeader *header; MonoDebugMethodInfo *minfo; int i; @@ -134,8 +135,8 @@ mono_debug_add_vg_method (MonoMethod *method, MonoDebugMethodJitInfo *jit) if (!RUNNING_ON_VALGRIND) return; - header = mono_method_get_header_checked (method, &error); - mono_error_assert_ok (&error); /* FIXME don't swallow the error */ + header = mono_method_get_header_checked (method, error); + mono_error_assert_ok (error); /* FIXME don't swallow the error */ full_name = mono_method_full_name (method, TRUE); @@ -530,15 +531,15 @@ deserialize_variable (MonoDebugVarInfo *var, guint8 *p, guint8 **endbuf) static MonoDebugMethodJitInfo * deserialize_debug_info (MonoMethod *method, guint8 *code_start, guint8 *buf, guint32 buf_len) { - MonoError error; + ERROR_DECL (error); MonoMethodHeader *header; gint32 offset, native_offset, prev_offset, prev_native_offset; MonoDebugMethodJitInfo *jit; guint8 *p; int i; - header = mono_method_get_header_checked (method, &error); - mono_error_assert_ok (&error); /* FIXME don't swallow the error */ + header = mono_method_get_header_checked (method, error); + mono_error_assert_ok (error); /* FIXME don't swallow the error */ jit = g_new0 (MonoDebugMethodJitInfo, 1); jit->code_start = code_start; diff --git a/mono/mini/debugger-agent.c.REMOVED.git-id b/mono/mini/debugger-agent.c.REMOVED.git-id index 0d0bff6460..32f59be555 100644 --- a/mono/mini/debugger-agent.c.REMOVED.git-id +++ b/mono/mini/debugger-agent.c.REMOVED.git-id @@ -1 +1 @@ -e92a894073bc6bc41e7d2cdd901c7010ae02314b \ No newline at end of file +95715e6783b065dfdef915e1121847560e674f5b \ No newline at end of file diff --git a/mono/mini/decompose.c b/mono/mini/decompose.c index 5fb9aa8e0f..1d8e45f718 100644 --- a/mono/mini/decompose.c +++ b/mono/mini/decompose.c @@ -11,6 +11,7 @@ */ #include "mini.h" +#include "mini-runtime.h" #include "ir-emit.h" #include "jit-icalls.h" @@ -1527,10 +1528,11 @@ mono_decompose_array_access_opts (MonoCompile *cfg) dest->dreg = ins->dreg; } else { MonoClass *array_class = mono_array_class_get (ins->inst_newa_class, 1); - MonoVTable *vtable = mono_class_vtable (cfg->domain, array_class); + ERROR_DECL_VALUE (vt_error); + MonoVTable *vtable = mono_class_vtable_checked (cfg->domain, array_class, &vt_error); MonoMethod *managed_alloc = mono_gc_get_managed_array_allocator (array_class); - g_assert (vtable); /*This shall not fail since we check for this condition on OP_NEWARR creation*/ + mono_error_assert_ok (&vt_error); /*This shall not fail since we check for this condition on OP_NEWARR creation*/ NEW_VTABLECONST (cfg, iargs [0], vtable); MONO_ADD_INS (cfg->cbb, iargs [0]); MONO_INST_NEW (cfg, iargs [1], OP_MOVE); diff --git a/mono/mini/driver.c b/mono/mini/driver.c index a058e521a4..8444991055 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -373,10 +373,10 @@ mini_regression_step (MonoImage *image, int verbose, int *total_run, int *total, if (mini_stats_fd) fprintf (mini_stats_fd, "["); for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) { - MonoError error; - MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error); + ERROR_DECL (error); + MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, error); if (!method) { - mono_error_cleanup (&error); /* FIXME don't swallow the error */ + mono_error_cleanup (error); /* FIXME don't swallow the error */ continue; } if (strncmp (method->name, "test_", 5) == 0) { @@ -392,9 +392,9 @@ mini_regression_step (MonoImage *image, int verbose, int *total_run, int *total, if (verbose >= 2) g_print ("Running '%s' ...\n", method->name); #ifdef MONO_USE_AOT_COMPILER - MonoError error; - func = (TestMethod)mono_aot_get_method_checked (mono_get_root_domain (), method, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + func = (TestMethod)mono_aot_get_method_checked (mono_get_root_domain (), method, error); + mono_error_cleanup (error); if (!func) func = (TestMethod)(gpointer)cfg->native_code; #else @@ -472,10 +472,10 @@ mini_regression (MonoImage *image, int verbose, int *total_run) /* load the metadata */ for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) { - MonoError error; - method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error); + ERROR_DECL (error); + method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, error); if (!method) { - mono_error_cleanup (&error); + mono_error_cleanup (error); continue; } mono_class_init (method->klass); @@ -581,10 +581,10 @@ interp_regression_step (MonoImage *image, int verbose, int *total_run, int *tota g_timer_start (timer); for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) { MonoObject *exc = NULL; - MonoError error; - MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error); + ERROR_DECL (error); + MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, error); if (!method) { - mono_error_cleanup (&error); /* FIXME don't swallow the error */ + mono_error_cleanup (error); /* FIXME don't swallow the error */ continue; } @@ -605,8 +605,8 @@ interp_regression_step (MonoImage *image, int verbose, int *total_run, int *tota } } else { /* no filter, check for `Category' attribute on method */ filter = TRUE; - MonoCustomAttrInfo* ainfo = mono_custom_attrs_from_method_checked (method, &error); - mono_error_cleanup (&error); + MonoCustomAttrInfo* ainfo = mono_custom_attrs_from_method_checked (method, error); + mono_error_cleanup (error); if (ainfo) { int j; @@ -619,15 +619,15 @@ interp_regression_step (MonoImage *image, int verbose, int *total_run, int *tota if (strcmp (klass->name, "CategoryAttribute")) continue; - MonoObject *obj = mono_custom_attrs_get_attr_checked (ainfo, klass, &error); + MonoObject *obj = mono_custom_attrs_get_attr_checked (ainfo, klass, error); /* 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); + * 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); - MonoObject *str = mini_get_interp_callbacks ()->runtime_invoke (getter, obj, NULL, &exc, &error); - mono_error_cleanup (&error); - char *utf8_str = mono_string_to_utf8_checked ((MonoString *) str, &error); - mono_error_cleanup (&error); + MonoObject *str = mini_get_interp_callbacks ()->runtime_invoke (getter, obj, NULL, &exc, error); + mono_error_cleanup (error); + char *utf8_str = mono_string_to_utf8_checked ((MonoString *) str, error); + mono_error_cleanup (error); if (!strcmp (utf8_str, "!INTERPRETER")) { g_print ("skip %s...\n", method->name); filter = FALSE; @@ -636,7 +636,7 @@ interp_regression_step (MonoImage *image, int verbose, int *total_run, int *tota } } if (strncmp (method->name, "test_", 5) == 0 && filter) { - MonoError interp_error; + ERROR_DECL_VALUE (interp_error); MonoObject *exc = NULL; result_obj = mini_get_interp_callbacks ()->runtime_invoke (method, NULL, NULL, &exc, &interp_error); @@ -686,10 +686,10 @@ interp_regression (MonoImage *image, int verbose, int *total_run) /* load the metadata */ for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) { - MonoError error; - method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error); + ERROR_DECL (error); + method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, error); if (!method) { - mono_error_cleanup (&error); + mono_error_cleanup (error); continue; } mono_class_init (method->klass); @@ -1014,7 +1014,7 @@ small_id_thread_func (gpointer arg) static void jit_info_table_test (MonoDomain *domain) { - MonoError error; + ERROR_DECL (error); int i; g_print ("testing jit_info_table\n"); @@ -1044,8 +1044,8 @@ jit_info_table_test (MonoDomain *domain) */ for (i = 0; i < num_threads; ++i) { - mono_thread_create_checked (domain, test_thread_func, &thread_datas [i], &error); - mono_error_assert_ok (&error); + mono_thread_create_checked (domain, test_thread_func, &thread_datas [i], error); + mono_error_assert_ok (error); } } #endif @@ -1078,16 +1078,16 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args) int i, count = 0, fail_count = 0; for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) { - MonoError error; + ERROR_DECL (error); guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1); MonoMethodSignature *sig; if (mono_metadata_has_generic_params (image, token)) continue; - method = mono_get_method_checked (image, token, NULL, NULL, &error); + method = mono_get_method_checked (image, token, NULL, NULL, error); if (!method) { - mono_error_cleanup (&error); /* FIXME don't swallow the error */ + mono_error_cleanup (error); /* FIXME don't swallow the error */ continue; } if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || @@ -1139,7 +1139,7 @@ compile_all_methods_thread_main (CompileAllThreadArgs *args) static void compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recompilation_times) { - MonoError error; + ERROR_DECL (error); CompileAllThreadArgs args; args.ass = ass; @@ -1151,8 +1151,8 @@ compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recom * Need to create a mono thread since compilation might trigger * running of managed code. */ - mono_thread_create_checked (mono_domain_get (), compile_all_methods_thread_main, &args, &error); - mono_error_assert_ok (&error); + mono_thread_create_checked (mono_domain_get (), compile_all_methods_thread_main, &args, error); + mono_error_assert_ok (error); mono_thread_manage (); } @@ -1167,7 +1167,7 @@ compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recom int mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[]) { - MonoError error; + ERROR_DECL (error); MonoImage *image = mono_assembly_get_image (assembly); MonoMethod *method; guint32 entry = mono_image_get_entry_point (image); @@ -1179,10 +1179,10 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[ return 1; } - method = mono_get_method_checked (image, entry, NULL, NULL, &error); + method = mono_get_method_checked (image, entry, NULL, NULL, error); if (method == NULL){ - g_print ("The entry point method could not be loaded due to %s\n", mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_print ("The entry point method could not be loaded due to %s\n", mono_error_get_message (error)); + mono_error_cleanup (error); mono_environment_exitcode_set (1); return 1; } @@ -1199,9 +1199,9 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[ } return res; } else { - int res = mono_runtime_run_main_checked (method, argc, argv, &error); - if (!is_ok (&error)) { - MonoException *ex = mono_error_convert_to_exception (&error); + int res = mono_runtime_run_main_checked (method, argc, argv, error); + if (!is_ok (error)) { + MonoException *ex = mono_error_convert_to_exception (error); if (ex) { mono_unhandled_exception (&ex->object); mono_invoke_unhandled_exception_hook (&ex->object); @@ -1283,7 +1283,7 @@ static void main_thread_handler (gpointer user_data) static int load_agent (MonoDomain *domain, char *desc) { - MonoError error; + ERROR_DECL (error); char* col = strchr (desc, ':'); char *agent, *args; MonoAssembly *agent_assembly; @@ -1322,10 +1322,10 @@ load_agent (MonoDomain *domain, char *desc) return 1; } - method = mono_get_method_checked (image, entry, NULL, NULL, &error); + method = mono_get_method_checked (image, entry, NULL, NULL, error); if (method == NULL){ - g_print ("The entry point method of assembly '%s' could not be loaded due to %s\n", agent, mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_print ("The entry point method of assembly '%s' could not be loaded due to %s\n", agent, mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } @@ -1333,18 +1333,18 @@ load_agent (MonoDomain *domain, char *desc) mono_thread_set_main (mono_thread_current ()); if (args) { - main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, 1, &error); + main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, 1, error); if (main_args) { - MonoString *str = mono_string_new_checked (domain, args, &error); + MonoString *str = mono_string_new_checked (domain, args, error); if (str) mono_array_set (main_args, MonoString*, 0, str); } } else { - main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, 0, &error); + main_args = (MonoArray*)mono_array_new_checked (domain, mono_defaults.string_class, 0, error); } if (!main_args) { - g_print ("Could not allocate array for main args of assembly '%s' due to %s\n", agent, mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_print ("Could not allocate array for main args of assembly '%s' due to %s\n", agent, mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } @@ -1352,10 +1352,10 @@ load_agent (MonoDomain *domain, char *desc) pa [0] = main_args; /* Pass NULL as 'exc' so unhandled exceptions abort the runtime */ - mono_runtime_invoke_checked (method, NULL, pa, &error); - if (!is_ok (&error)) { - g_print ("The entry point method of assembly '%s' could not execute due to %s\n", agent, mono_error_get_message (&error)); - mono_error_cleanup (&error); + mono_runtime_invoke_checked (method, NULL, pa, error); + if (!is_ok (error)) { + g_print ("The entry point method of assembly '%s' could not execute due to %s\n", agent, mono_error_get_message (error)); + mono_error_cleanup (error); g_free (agent); return 1; } @@ -1752,14 +1752,12 @@ apply_root_domain_configuration_file_bindings (MonoDomain *domain, char *root_do static void mono_enable_interp (const char *opts) { -#ifndef DISABLE_INTERPRETER mono_use_interpreter = TRUE; if (opts) - mono_interp_parse_options (opts); -#endif + mono_interp_opts_string = opts; #ifdef DISABLE_INTERPRETER - g_warning ("Mono IL interpreter support is missing\n"); + g_error ("Mono IL interpreter support is missing\n"); #endif #ifdef MONO_CROSS_COMPILE @@ -1824,6 +1822,20 @@ mono_main (int argc, char* argv[]) if (g_hasenv ("MONO_NO_SMP")) mono_set_use_smp (FALSE); + +#ifdef MONO_JEMALLOC_ENABLED + + gboolean use_jemalloc = FALSE; +#ifdef MONO_JEMALLOC_DEFAULT + use_jemalloc = TRUE; +#endif + if (!use_jemalloc) + use_jemalloc = g_hasenv ("MONO_USE_JEMALLOC"); + + if (use_jemalloc) + mono_init_jemalloc (); + +#endif g_log_set_always_fatal (G_LOG_LEVEL_ERROR); g_log_set_fatal_mask (G_LOG_DOMAIN, G_LOG_LEVEL_ERROR); @@ -2268,7 +2280,6 @@ mono_main (int argc, char* argv[]) case DO_SINGLE_METHOD_REGRESSION: mono_do_single_method_regression = TRUE; case DO_REGRESSION: -#ifndef DISABLE_INTERPRETER if (mono_use_interpreter) { if (mono_interp_regression_list (2, argc -i, argv + i)) { g_print ("Regression ERRORS!\n"); @@ -2278,7 +2289,6 @@ mono_main (int argc, char* argv[]) // mini_cleanup (domain); return 0; } -#endif if (mini_regression_list (mini_verbose, argc -i, argv + i)) { g_print ("Regression ERRORS!\n"); mini_cleanup (domain); diff --git a/mono/mini/dwarfwriter.c b/mono/mini/dwarfwriter.c index 9f2c405b68..9d4a591f48 100644 --- a/mono/mini/dwarfwriter.c +++ b/mono/mini/dwarfwriter.c @@ -1299,7 +1299,7 @@ static const guint8 *token_handler_ip; static char* token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) { - MonoError error; + ERROR_DECL (error); char *res, *desc; MonoMethod *cmethod; MonoClass *klass; @@ -1316,8 +1316,8 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) if (method->wrapper_type) { klass = (MonoClass *)data; } else { - klass = mono_class_get_checked (method->klass->image, token, &error); - g_assert (mono_error_ok (&error)); /* FIXME error handling */ + klass = mono_class_get_checked (method->klass->image, token, error); + g_assert (mono_error_ok (error)); /* FIXME error handling */ } res = g_strdup_printf ("<%s>", klass->name); break; @@ -1327,10 +1327,10 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) if (method->wrapper_type) { cmethod = (MonoMethod *)data; } else { - MonoError error; - cmethod = mono_get_method_checked (method->klass->image, token, NULL, NULL, &error); + ERROR_DECL (error); + cmethod = mono_get_method_checked (method->klass->image, token, NULL, NULL, error); if (!cmethod) - g_error ("Could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */ + g_error ("Could not load method due to %s", mono_error_get_message (error)); /* FIXME don't swallow the error */ } desc = mono_method_full_name (cmethod, TRUE); res = g_strdup_printf ("<%s>", desc); @@ -1352,8 +1352,8 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) if (method->wrapper_type) { field = (MonoClassField *)data; } else { - field = mono_field_from_token_checked (method->klass->image, token, &klass, NULL, &error); - g_assert (mono_error_ok (&error)); /* FIXME error handling */ + field = mono_field_from_token_checked (method->klass->image, token, &klass, NULL, error); + g_assert (mono_error_ok (error)); /* FIXME error handling */ } desc = mono_field_full_name (field); res = g_strdup_printf ("<%s>", desc); @@ -1377,11 +1377,11 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token) static char* disasm_ins (MonoMethod *method, const guchar *ip, const guint8 **endip) { - MonoError error; + ERROR_DECL (error); char *dis; MonoDisHelper dh; - MonoMethodHeader *header = mono_method_get_header_checked (method, &error); - mono_error_assert_ok (&error); /* FIXME don't swallow the error */ + MonoMethodHeader *header = mono_method_get_header_checked (method, error); + mono_error_assert_ok (error); /* FIXME don't swallow the error */ memset (&dh, 0, sizeof (dh)); dh.newline = ""; @@ -1496,19 +1496,19 @@ emit_line_number_info (MonoDwarfWriter *w, MonoMethod *method, guint8 *code, guint32 code_size, MonoDebugMethodJitInfo *debug_info) { - MonoError error; + ERROR_DECL (error); guint32 prev_line = 0; guint32 prev_native_offset = 0; int i, file_index, il_offset, prev_il_offset; gboolean first = TRUE; MonoDebugSourceLocation *loc; char *prev_file_name = NULL; - MonoMethodHeader *header = mono_method_get_header_checked (method, &error); + MonoMethodHeader *header = mono_method_get_header_checked (method, error); MonoDebugMethodInfo *minfo; MonoDebugLineNumberEntry *ln_array; int *native_to_il_offset = NULL; - mono_error_assert_ok (&error); /* FIXME don't swallow the error */ + mono_error_assert_ok (error); /* FIXME don't swallow the error */ if (!w->emit_line) { mono_metadata_free_mh (header); @@ -1755,7 +1755,7 @@ void mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, char *linkage_name, guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info) { - MonoError error; + ERROR_DECL (error); char *name; MonoMethodSignature *sig; MonoMethodHeader *header; @@ -1770,8 +1770,8 @@ mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod emit_section_change (w, ".debug_info", 0); sig = mono_method_signature (method); - header = mono_method_get_header_checked (method, &error); - mono_error_assert_ok (&error); /* FIXME don't swallow the error */ + header = mono_method_get_header_checked (method, error); + mono_error_assert_ok (error); /* FIXME don't swallow the error */ /* Parameter types */ for (i = 0; i < sig->param_count + sig->hasthis; ++i) { diff --git a/mono/mini/ee.h b/mono/mini/ee.h new file mode 100644 index 0000000000..fd1f30a718 --- /dev/null +++ b/mono/mini/ee.h @@ -0,0 +1,59 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include + +#ifndef __MONO_EE_H__ +#define __MONO_EE_H__ + +#define MONO_EE_API_VERSION 0x1 + +typedef struct _MonoInterpStackIter MonoInterpStackIter; + +/* Needed for stack allocation */ +struct _MonoInterpStackIter { + gpointer dummy [8]; +}; + +typedef gpointer MonoInterpFrameHandle; + +struct _MonoEECallbacks { + gpointer (*create_method_pointer) (MonoMethod *method, MonoError *error); + MonoObject* (*runtime_invoke) (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error); + void (*init_delegate) (MonoDelegate *del); + gpointer (*get_remoting_invoke) (gpointer imethod, MonoError *error); + gpointer (*create_trampoline) (MonoDomain *domain, MonoMethod *method, MonoError *error); + void (*walk_stack_with_ctx) (MonoInternalStackWalk func, MonoContext *ctx, MonoUnwindOptions options, void *user_data); + void (*set_resume_state) (MonoJitTlsData *jit_tls, MonoException *ex, MonoJitExceptionInfo *ei, MonoInterpFrameHandle interp_frame, gpointer handler_ip); + gboolean (*run_finally) (StackFrameInfo *frame, int clause_index, gpointer handler_ip); + gboolean (*run_filter) (StackFrameInfo *frame, MonoException *ex, int clause_index, gpointer handler_ip); + void (*frame_iter_init) (MonoInterpStackIter *iter, gpointer interp_exit_data); + gboolean (*frame_iter_next) (MonoInterpStackIter *iter, StackFrameInfo *frame); + MonoJitInfo* (*find_jit_info) (MonoDomain *domain, MonoMethod *method); + void (*set_breakpoint) (MonoJitInfo *jinfo, gpointer ip); + void (*clear_breakpoint) (MonoJitInfo *jinfo, gpointer ip); + MonoJitInfo* (*frame_get_jit_info) (MonoInterpFrameHandle frame); + gpointer (*frame_get_ip) (MonoInterpFrameHandle frame); + gpointer (*frame_get_arg) (MonoInterpFrameHandle frame, int pos); + gpointer (*frame_get_local) (MonoInterpFrameHandle frame, int pos); + gpointer (*frame_get_this) (MonoInterpFrameHandle frame); + void (*frame_arg_to_data) (MonoInterpFrameHandle frame, MonoMethodSignature *sig, int index, gpointer data); + void (*data_to_frame_arg) (MonoInterpFrameHandle frame, MonoMethodSignature *sig, int index, gpointer data); + gpointer (*frame_arg_to_storage) (MonoInterpFrameHandle frame, MonoMethodSignature *sig, int index); + MonoInterpFrameHandle (*frame_get_parent) (MonoInterpFrameHandle frame); + void (*start_single_stepping) (void); + void (*stop_single_stepping) (void); +}; + +typedef struct _MonoEECallbacks MonoEECallbacks; + +#endif /* __MONO_EE_H__ */ diff --git a/mono/mini/exceptions-amd64.c b/mono/mini/exceptions-amd64.c index 6870052bc3..90423fad0a 100644 --- a/mono/mini/exceptions-amd64.c +++ b/mono/mini/exceptions-amd64.c @@ -382,20 +382,20 @@ mono_amd64_throw_exception (guint64 dummy1, guint64 dummy2, guint64 dummy3, guin guint64 dummy5, guint64 dummy6, MonoContext *mctx, MonoObject *exc, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; /* mctx is on the caller's stack */ memcpy (&ctx, mctx, sizeof (MonoContext)); - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); /* adjust eip so that it point into the call instruction */ ctx.gregs [AMD64_RIP] --; @@ -813,12 +813,20 @@ mono_arch_ip_from_context (void *sigctx) #endif } -static void -restore_soft_guard_pages (void) +static MonoObject* +restore_soft_guard_pages () { MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); if (jit_tls->stack_ovf_guard_base) mono_mprotect (jit_tls->stack_ovf_guard_base, jit_tls->stack_ovf_guard_size, MONO_MMAP_NONE); + + if (jit_tls->stack_ovf_pending) { + MonoDomain *domain = mono_domain_get (); + jit_tls->stack_ovf_pending = 0; + return (MonoObject *) domain->stack_overflow_ex; + } + + return NULL; } /* @@ -851,8 +859,11 @@ altstack_handle_and_restore (MonoContext *ctx, MonoObject *obj, gboolean stack_o mctx = *ctx; mono_handle_exception (&mctx, obj); - if (stack_ovf) + if (stack_ovf) { + MonoJitTlsData *jit_tls = (MonoJitTlsData *) mono_tls_get_jit_tls (); + jit_tls->stack_ovf_pending = 1; prepare_for_guard_pages (&mctx); + } mono_restore_context (&mctx); } diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c index a3ab2ac90e..d2df1efb7e 100644 --- a/mono/mini/exceptions-arm.c +++ b/mono/mini/exceptions-arm.c @@ -144,7 +144,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) void mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; gboolean rethrow = sp & 1; @@ -160,14 +160,14 @@ mono_arm_throw_exception (MonoObject *exc, mgreg_t pc, mgreg_t sp, mgreg_t *int_ memcpy (((guint8*)&ctx.regs) + (ARMREG_R4 * sizeof (mgreg_t)), int_regs, 8 * sizeof (mgreg_t)); memcpy (&ctx.fregs, fp_regs, sizeof (double) * 16); - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); mono_handle_exception (&ctx, exc); mono_restore_context (&ctx); g_assert_not_reached (); diff --git a/mono/mini/exceptions-arm64.c b/mono/mini/exceptions-arm64.c index 53bb332b69..26769714e8 100644 --- a/mono/mini/exceptions-arm64.c +++ b/mono/mini/exceptions-arm64.c @@ -376,7 +376,7 @@ mono_arch_exceptions_init (void) void mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble *fp_regs, gboolean corlib, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; MonoObject *exc = NULL; guint32 ex_token_index, ex_token; @@ -400,14 +400,14 @@ mono_arm_throw_exception (gpointer arg, mgreg_t pc, mgreg_t *int_regs, gdouble * ctx.has_fregs = 1; ctx.pc = pc; - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); mono_handle_exception (&ctx, exc); diff --git a/mono/mini/exceptions-mips.c b/mono/mini/exceptions-mips.c index 850fcc084a..9efa0894fb 100644 --- a/mono/mini/exceptions-mips.c +++ b/mono/mini/exceptions-mips.c @@ -179,7 +179,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) static void throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; #ifdef DEBUG_EXCEPTIONS @@ -198,14 +198,14 @@ throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, gboolean memset (&ctx.sc_fpregs, 0, sizeof (mips_freg) * MONO_SAVED_FREGS); MONO_CONTEXT_SET_IP (&ctx, eip); - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); mono_handle_exception (&ctx, exc); #ifdef DEBUG_EXCEPTIONS g_print ("throw_exception: restore to pc=%p sp=%p fp=%p ctx=%p\n", diff --git a/mono/mini/exceptions-ppc.c b/mono/mini/exceptions-ppc.c index d00ed4c942..4101eaf3e9 100644 --- a/mono/mini/exceptions-ppc.c +++ b/mono/mini/exceptions-ppc.c @@ -324,7 +324,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) void mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; /* adjust eip so that it point into the call instruction */ @@ -338,14 +338,14 @@ mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, memcpy (&ctx.regs, int_regs, sizeof (mgreg_t) * MONO_MAX_IREGS); memcpy (&ctx.fregs, fp_regs, sizeof (double) * MONO_MAX_FREGS); - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); mono_handle_exception (&ctx, exc); mono_restore_context (&ctx); diff --git a/mono/mini/exceptions-s390x.c b/mono/mini/exceptions-s390x.c index 4f7694acbe..d0527a3b8d 100644 --- a/mono/mini/exceptions-s390x.c +++ b/mono/mini/exceptions-s390x.c @@ -242,7 +242,7 @@ throw_exception (MonoObject *exc, unsigned long ip, unsigned long sp, gulong *int_regs, gdouble *fp_regs, gint32 *acc_regs, guint fpc, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; int iReg; @@ -264,14 +264,14 @@ throw_exception (MonoObject *exc, unsigned long ip, unsigned long sp, MONO_CONTEXT_SET_BP (&ctx, sp); MONO_CONTEXT_SET_IP (&ctx, ip); - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); // mono_arch_handle_exception (&ctx, exc, FALSE); mono_handle_exception (&ctx, exc); mono_restore_context(&ctx); diff --git a/mono/mini/exceptions-sparc.c b/mono/mini/exceptions-sparc.c index f7010b13f8..25cd6390aa 100644 --- a/mono/mini/exceptions-sparc.c +++ b/mono/mini/exceptions-sparc.c @@ -167,7 +167,7 @@ mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) static void throw_exception (MonoObject *exc, gpointer sp, gpointer ip, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; static void (*restore_context) (MonoContext *); gpointer *window; @@ -180,14 +180,14 @@ throw_exception (MonoObject *exc, gpointer sp, gpointer ip, gboolean rethrow) ctx.ip = ip; ctx.fp = (gpointer*)(MONO_SPARC_WINDOW_ADDR (sp) [sparc_i6 - 16]); - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); mono_handle_exception (&ctx, exc); restore_context (&ctx); diff --git a/mono/mini/exceptions-x86.c b/mono/mini/exceptions-x86.c index b4df2f2c03..1bdefb54bb 100644 --- a/mono/mini/exceptions-x86.c +++ b/mono/mini/exceptions-x86.c @@ -455,7 +455,7 @@ void mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc, mgreg_t eip, gboolean rethrow) { - MonoError error; + ERROR_DECL (error); MonoContext ctx; ctx.esp = regs [X86_ESP]; @@ -473,14 +473,14 @@ mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc, g_assert ((ctx.esp % MONO_ARCH_FRAME_ALIGNMENT) == 0); #endif - if (mono_object_isinst_checked (exc, mono_defaults.exception_class, &error)) { + if (mono_object_isinst_checked (exc, mono_defaults.exception_class, error)) { MonoException *mono_ex = (MonoException*)exc; if (!rethrow) { mono_ex->stack_trace = NULL; mono_ex->trace_ips = NULL; } } - mono_error_assert_ok (&error); + mono_error_assert_ok (error); /* adjust eip so that it point into the call instruction */ ctx.eip -= 1; @@ -1034,12 +1034,20 @@ mono_arch_handle_exception (void *sigctx, gpointer obj) #endif } -static void -restore_soft_guard_pages (void) +static MonoObject* +restore_soft_guard_pages () { MonoJitTlsData *jit_tls = mono_tls_get_jit_tls (); + if (jit_tls->stack_ovf_guard_base) mono_mprotect (jit_tls->stack_ovf_guard_base, jit_tls->stack_ovf_guard_size, MONO_MMAP_NONE); + + if (jit_tls->stack_ovf_pending) { + MonoDomain *domain = mono_domain_get (); + jit_tls->stack_ovf_pending = 0; + return (MonoObject *) domain->stack_overflow_ex; + } + return NULL; } /* @@ -1054,12 +1062,13 @@ prepare_for_guard_pages (MonoContext *mctx) gpointer *sp; sp = (gpointer)(mctx->esp); sp -= 1; - /* the resturn addr */ + /* the return addr */ sp [0] = (gpointer)(mctx->eip); mctx->eip = (unsigned long)restore_soft_guard_pages; mctx->esp = (unsigned long)sp; } + static void altstack_handle_and_restore (MonoContext *ctx, gpointer obj, gboolean stack_ovf) { @@ -1068,8 +1077,11 @@ altstack_handle_and_restore (MonoContext *ctx, gpointer obj, gboolean stack_ovf) mctx = *ctx; mono_handle_exception (&mctx, obj); - if (stack_ovf) + if (stack_ovf) { + MonoJitTlsData *jit_tls = (MonoJitTlsData *) mono_tls_get_jit_tls (); + jit_tls->stack_ovf_pending = 1; prepare_for_guard_pages (&mctx); + } mono_restore_context (&mctx); } diff --git a/mono/mini/genmdesc.py b/mono/mini/genmdesc.py old mode 100644 new mode 100755 index 2f85ccb9ac..bc820ee679 --- a/mono/mini/genmdesc.py +++ b/mono/mini/genmdesc.py @@ -25,7 +25,8 @@ allowed_defines = { "TARGET_X86" : 1, "TARGET_POWERPC" : 1, "TARGET_SPARC" : 1, "TARGET_S390X" : 1, - "TARGET_MIPS" : 1 + "TARGET_MIPS" : 1, + "TARGET_WASM" : 1 } class OpDef: diff --git a/mono/mini/gshared.cs b/mono/mini/gshared.cs index 089c583cbf..0c93aca01b 100644 --- a/mono/mini/gshared.cs +++ b/mono/mini/gshared.cs @@ -1107,6 +1107,7 @@ public class Tests interface IConstrainedCalls { Pair vtype_ret(T t, T2 t2) where T: IReturnVType; AnEnum enum_ret(T t, T2 t2) where T: IReturnVType; + int normal_args (T t, T2 t2, int i1, int i2, string s, ref int i3) where T : IConstrained2; } public interface IReturnVType { @@ -1114,6 +1115,10 @@ public class Tests AnEnum return_enum (); } + public interface IConstrained2 { + int normal_args (int i1, int i2, string s, ref int i3); + } + public class CConstrainedCalls : IConstrainedCalls { [MethodImplAttribute (MethodImplOptions.NoInlining)] public Pair vtype_ret(T t, T2 t2) where T : IReturnVType { @@ -1124,6 +1129,10 @@ public class Tests public AnEnum enum_ret(T t, T2 t2) where T : IReturnVType { return t.return_enum (); } + + public int normal_args (T t, T2 t2, int i1, int i2, string s, ref int i3) where T : IConstrained2 { + return t.normal_args (i1, i2, s, ref i3); + } } class ReturnVType : IReturnVType { @@ -1135,6 +1144,13 @@ public class Tests } } + class ConstrainedCalls : IConstrained2 { + public int normal_args (int i1, int i2, string s, ref int i3) { + i3 = i3 + 1; + return i1 + i2 + i3 + s.Length; + } + } + public static int test_0_constrained_vtype_ret () { IConstrainedCalls c = new CConstrainedCalls (); var r = c.vtype_ret (new ReturnVType (), 1); @@ -1151,6 +1167,14 @@ public class Tests return 0; } + public static int test_14_constrained_normal_args () { + IConstrainedCalls c = new CConstrainedCalls (); + + int val = 3; + var r = c.normal_args (new ConstrainedCalls (), 0, 1, 2, "ABC", ref val); + return r + val; + } + public struct Pair { public T1 First; public T2 Second; diff --git a/mono/mini/interp-stubs.c b/mono/mini/interp-stubs.c index e35227ed15..28d3a63934 100644 --- a/mono/mini/interp-stubs.c +++ b/mono/mini/interp-stubs.c @@ -126,14 +126,12 @@ stub_init_delegate (MonoDelegate *del) g_assert_not_reached (); } -#ifndef DISABLE_REMOTING static gpointer stub_get_remoting_invoke (gpointer imethod, MonoError *error) { g_assert_not_reached (); return NULL; } -#endif static gpointer stub_create_trampoline (MonoDomain *domain, MonoMethod *method, MonoError *error) @@ -151,13 +149,15 @@ stub_walk_stack_with_ctx (MonoInternalStackWalk func, MonoContext *ctx, MonoUnwi void mono_interp_stub_init (void) { - MonoInterpCallbacks c; + if (mini_get_interp_callbacks ()->create_method_pointer) + /* already initialized */ + return; + + MonoEECallbacks c; c.create_method_pointer = stub_create_method_pointer; c.runtime_invoke = stub_runtime_invoke; c.init_delegate = stub_init_delegate; -#ifndef DISABLE_REMOTING c.get_remoting_invoke = stub_get_remoting_invoke; -#endif c.create_trampoline = stub_create_trampoline; c.walk_stack_with_ctx = stub_walk_stack_with_ctx; c.set_resume_state = stub_set_resume_state; diff --git a/mono/mini/interp/interp-internals.h b/mono/mini/interp/interp-internals.h index 9acd88c0fd..4713b8ca68 100644 --- a/mono/mini/interp/interp-internals.h +++ b/mono/mini/interp/interp-internals.h @@ -8,7 +8,6 @@ #include #include #include -#include "config.h" #include "interp.h" #define MINT_TYPE_I1 0 @@ -137,8 +136,6 @@ struct _InterpFrame { typedef struct { MonoDomain *original_domain; InterpFrame *current_frame; - unsigned char search_for_handler; - /* Resume state for resuming execution in mixed mode */ gboolean has_resume_state; /* Frame to resume execution at */ diff --git a/mono/mini/interp/interp.c.REMOVED.git-id b/mono/mini/interp/interp.c.REMOVED.git-id index e541123915..e53d658545 100644 --- a/mono/mini/interp/interp.c.REMOVED.git-id +++ b/mono/mini/interp/interp.c.REMOVED.git-id @@ -1 +1 @@ -1aac7e249a886d1ba32cd5872de142a3b1ea282e \ No newline at end of file +cff128861e5b755a79ec07d1bce5fce43e427dad \ No newline at end of file diff --git a/mono/mini/interp/interp.h b/mono/mini/interp/interp.h index ea0a8cd63f..c64d3334b9 100644 --- a/mono/mini/interp/interp.h +++ b/mono/mini/interp/interp.h @@ -28,45 +28,10 @@ struct _InterpMethodArguments { typedef struct _InterpMethodArguments InterpMethodArguments; -typedef struct _MonoInterpStackIter MonoInterpStackIter; - -/* Needed for stack allocation */ -struct _MonoInterpStackIter { - gpointer dummy [8]; -}; - -typedef gpointer MonoInterpFrameHandle; - - -struct _MonoInterpCallbacks { - gpointer (*create_method_pointer) (MonoMethod *method, MonoError *error); - MonoObject* (*runtime_invoke) (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error); - void (*init_delegate) (MonoDelegate *del); -#ifndef DISABLE_REMOTING - gpointer (*get_remoting_invoke) (gpointer imethod, MonoError *error); -#endif - gpointer (*create_trampoline) (MonoDomain *domain, MonoMethod *method, MonoError *error); - void (*walk_stack_with_ctx) (MonoInternalStackWalk func, MonoContext *ctx, MonoUnwindOptions options, void *user_data); - void (*set_resume_state) (MonoJitTlsData *jit_tls, MonoException *ex, MonoJitExceptionInfo *ei, MonoInterpFrameHandle interp_frame, gpointer handler_ip); - gboolean (*run_finally) (StackFrameInfo *frame, int clause_index, gpointer handler_ip); - gboolean (*run_filter) (StackFrameInfo *frame, MonoException *ex, int clause_index, gpointer handler_ip); - void (*frame_iter_init) (MonoInterpStackIter *iter, gpointer interp_exit_data); - gboolean (*frame_iter_next) (MonoInterpStackIter *iter, StackFrameInfo *frame); - MonoJitInfo* (*find_jit_info) (MonoDomain *domain, MonoMethod *method); - void (*set_breakpoint) (MonoJitInfo *jinfo, gpointer ip); - void (*clear_breakpoint) (MonoJitInfo *jinfo, gpointer ip); - MonoJitInfo* (*frame_get_jit_info) (MonoInterpFrameHandle frame); - gpointer (*frame_get_ip) (MonoInterpFrameHandle frame); - gpointer (*frame_get_arg) (MonoInterpFrameHandle frame, int pos); - gpointer (*frame_get_local) (MonoInterpFrameHandle frame, int pos); - gpointer (*frame_get_this) (MonoInterpFrameHandle frame); - MonoInterpFrameHandle (*frame_get_parent) (MonoInterpFrameHandle frame); - void (*start_single_stepping) (void); - void (*stop_single_stepping) (void); -}; - -void mono_interp_parse_options (const char *options); - -void mono_interp_init (void); +/* must be called either + * - by mini_init () + * - xor, before mini_init () is called (embedding scenario). + */ +MONO_API void mono_ee_interp_init (const char *); #endif /* __MONO_MINI_INTERPRETER_H__ */ diff --git a/mono/mini/interp/mintops.def b/mono/mini/interp/mintops.def index a2af633882..80c8a2940d 100644 --- a/mono/mini/interp/mintops.def +++ b/mono/mini/interp/mintops.def @@ -258,6 +258,7 @@ OPDEF(MINT_BLT_UN_R8_S, "blt.un.r8.s", 2, MintOpShortBranch) OPDEF(MINT_SWITCH, "switch", 0, MintOpSwitch) OPDEF(MINT_LDSTR, "ldstr", 2, MintOpMethodToken) /* not really */ +OPDEF(MINT_LDSTR_TOKEN, "ldstr.token", 2, MintOpMethodToken) /* not really */ OPDEF(MINT_CALL, "call", 2, MintOpMethodToken) OPDEF(MINT_VCALL, "vcall", 2, MintOpMethodToken) @@ -326,12 +327,14 @@ OPDEF(MINT_ADD_I8, "add.i8", 1, MintOpNoArgs) OPDEF(MINT_ADD_R8, "add.r8", 1, MintOpNoArgs) OPDEF(MINT_ADD1_I4, "add1.i4", 1, MintOpNoArgs) +OPDEF(MINT_ADD1_I8, "add1.i8", 1, MintOpNoArgs) OPDEF(MINT_SUB_I4, "sub.i4", 1, MintOpNoArgs) OPDEF(MINT_SUB_I8, "sub.i8", 1, MintOpNoArgs) OPDEF(MINT_SUB_R8, "sub.r8", 1, MintOpNoArgs) OPDEF(MINT_SUB1_I4, "sub1.i4", 1, MintOpNoArgs) +OPDEF(MINT_SUB1_I8, "sub1.i8", 1, MintOpNoArgs) OPDEF(MINT_MUL_I4, "mul.i4", 1, MintOpNoArgs) OPDEF(MINT_MUL_I8, "mul.i8", 1, MintOpNoArgs) @@ -533,6 +536,8 @@ 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_MONO_LDPTR, "mono_ldptr", 2, MintOpClassToken) OPDEF(MINT_MONO_TLS, "mono_tls", 3, MintOpInt) OPDEF(MINT_MONO_NEWOBJ, "mono_newobj", 2, MintOpClassToken) @@ -550,6 +555,9 @@ OPDEF(MINT_SDB_INTR_LOC, "sdb_intr_loc", 1, MintOpNoArgs) OPDEF(MINT_SDB_SEQ_POINT, "sdb_seq_point", 1, MintOpNoArgs) OPDEF(MINT_SDB_BREAKPOINT, "sdb_breakpoint", 1, 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 * the STINARG* opcodes have executed. diff --git a/mono/mini/interp/transform.c.REMOVED.git-id b/mono/mini/interp/transform.c.REMOVED.git-id index f4d971568a..2d5ab92ccf 100644 --- a/mono/mini/interp/transform.c.REMOVED.git-id +++ b/mono/mini/interp/transform.c.REMOVED.git-id @@ -1 +1 @@ -dee825fc2661c782253025322454caa9108fdb91 \ No newline at end of file +2024e2faa2c369548911c13756565c494f8a5cb1 \ No newline at end of file diff --git a/mono/mini/ir-emit.h b/mono/mini/ir-emit.h index 4402816aa5..ad13b93015 100644 --- a/mono/mini/ir-emit.h +++ b/mono/mini/ir-emit.h @@ -324,7 +324,9 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) NEW_AOTCONST ((cfg), (dest), MONO_PATCH_INFO_METHOD_RGCTX, (method)); \ } else { \ MonoMethodRuntimeGenericContext *mrgctx; \ - mrgctx = mono_method_lookup_rgctx (mono_class_vtable ((cfg)->domain, (method)->klass), mini_method_get_context ((method))->method_inst); \ + MonoVTable *vt = mono_class_vtable_checked ((cfg)->domain, (method)->klass, &(cfg)->error); \ + mono_error_assert_ok (&(cfg)->error); \ + mrgctx = mono_method_lookup_rgctx (vt, mini_method_get_context ((method))->method_inst); \ NEW_PCONST ((cfg), (dest), (mrgctx)); \ } \ } while (0) diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c index 44960ceb04..895cb879e4 100644 --- a/mono/mini/jit-icalls.c +++ b/mono/mini/jit-icalls.c @@ -35,13 +35,13 @@ void* mono_ldftn (MonoMethod *method) { gpointer addr; - MonoError error; + ERROR_DECL (error); if (mono_llvm_only) { // FIXME: No error handling - addr = mono_compile_method_checked (method, &error); - mono_error_assert_ok (&error); + addr = mono_compile_method_checked (method, error); + mono_error_assert_ok (error); g_assert (addr); if (mono_method_needs_static_rgctx_invoke (method, FALSE)) @@ -52,9 +52,9 @@ mono_ldftn (MonoMethod *method) return addr; } - addr = mono_create_jump_trampoline (mono_domain_get (), method, FALSE, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + addr = mono_create_jump_trampoline (mono_domain_get (), method, FALSE, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } return mono_create_ftnptr (mono_domain_get (), addr); @@ -63,7 +63,7 @@ mono_ldftn (MonoMethod *method) static void* ldvirtfn_internal (MonoObject *obj, MonoMethod *method, gboolean gshared) { - MonoError error; + ERROR_DECL (error); MonoMethod *res; if (obj == NULL) { @@ -82,9 +82,9 @@ ldvirtfn_internal (MonoObject *obj, MonoMethod *method, gboolean gshared) context.class_inst = mono_class_get_generic_container (res->klass)->context.class_inst; context.method_inst = mono_method_get_context (method)->method_inst; - res = mono_class_inflate_generic_method_checked (res, &context, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + res = mono_class_inflate_generic_method_checked (res, &context, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } } @@ -109,13 +109,13 @@ mono_ldvirtfn_gshared (MonoObject *obj, MonoMethod *method) void mono_helper_stelem_ref_check (MonoArray *array, MonoObject *val) { - MonoError error; + ERROR_DECL (error); if (!array) { mono_set_pending_exception (mono_get_exception_null_reference ()); return; } - if (val && !mono_object_isinst_checked (val, array->obj.vtable->klass->element_class, &error)) { - if (mono_error_set_pending_exception (&error)) + if (val && !mono_object_isinst_checked (val, array->obj.vtable->klass->element_class, error)) { + if (mono_error_set_pending_exception (error)) return; mono_set_pending_exception (mono_get_exception_array_type_mismatch ()); return; @@ -674,7 +674,7 @@ mono_fload_r4_arg (double val) MonoArray * mono_array_new_va (MonoMethod *cm, ...) { - MonoError error; + ERROR_DECL (error); MonoArray *arr; MonoDomain *domain = mono_domain_get (); va_list ap; @@ -709,10 +709,10 @@ mono_array_new_va (MonoMethod *cm, ...) } va_end(ap); - arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, &error); + arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -723,7 +723,7 @@ mono_array_new_va (MonoMethod *cm, ...) MonoArray * mono_array_new_1 (MonoMethod *cm, guint32 length) { - MonoError error; + ERROR_DECL (error); MonoArray *arr; MonoDomain *domain = mono_domain_get (); uintptr_t lengths [1]; @@ -745,10 +745,10 @@ mono_array_new_1 (MonoMethod *cm, guint32 length) lower_bounds = NULL; } - arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, &error); + arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -758,7 +758,7 @@ mono_array_new_1 (MonoMethod *cm, guint32 length) MonoArray * mono_array_new_2 (MonoMethod *cm, guint32 length1, guint32 length2) { - MonoError error; + ERROR_DECL (error); MonoArray *arr; MonoDomain *domain = mono_domain_get (); uintptr_t lengths [2]; @@ -781,10 +781,10 @@ mono_array_new_2 (MonoMethod *cm, guint32 length1, guint32 length2) lower_bounds = NULL; } - arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, &error); + arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -794,7 +794,7 @@ mono_array_new_2 (MonoMethod *cm, guint32 length1, guint32 length2) MonoArray * mono_array_new_3 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3) { - MonoError error; + ERROR_DECL (error); MonoArray *arr; MonoDomain *domain = mono_domain_get (); uintptr_t lengths [3]; @@ -818,10 +818,10 @@ mono_array_new_3 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 leng lower_bounds = NULL; } - arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, &error); + arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -831,7 +831,7 @@ mono_array_new_3 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 leng MonoArray * mono_array_new_4 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3, guint32 length4) { - MonoError error; + ERROR_DECL (error); MonoArray *arr; MonoDomain *domain = mono_domain_get (); uintptr_t lengths [4]; @@ -856,10 +856,10 @@ mono_array_new_4 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 leng lower_bounds = NULL; } - arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, &error); + arr = mono_array_new_full_checked (domain, cm->klass, lengths, lower_bounds, error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -869,7 +869,7 @@ mono_array_new_4 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 leng gpointer mono_class_static_field_address (MonoDomain *domain, MonoClassField *field) { - MonoError error; + ERROR_DECL (error); MonoVTable *vtable; gpointer addr; @@ -877,14 +877,14 @@ mono_class_static_field_address (MonoDomain *domain, MonoClassField *field) mono_class_init (field->parent); - vtable = mono_class_vtable_full (domain, field->parent, &error); - if (!is_ok (&error)) { - mono_error_set_pending_exception (&error); + vtable = mono_class_vtable_checked (domain, field->parent, error); + if (!is_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } if (!vtable->initialized) { - if (!mono_runtime_class_init_full (vtable, &error)) { - mono_error_set_pending_exception (&error); + if (!mono_runtime_class_init_full (vtable, error)) { + mono_error_set_pending_exception (error); return NULL; } } @@ -907,13 +907,13 @@ mono_class_static_field_address (MonoDomain *domain, MonoClassField *field) gpointer mono_ldtoken_wrapper (MonoImage *image, int token, MonoGenericContext *context) { - MonoError error; + ERROR_DECL (error); MonoClass *handle_class; gpointer res; - res = mono_ldtoken_checked (image, token, &handle_class, context, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + res = mono_ldtoken_checked (image, token, &handle_class, context, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } mono_class_init (handle_class); @@ -1095,7 +1095,7 @@ mono_lconv_to_r8_un (guint64 a) gpointer mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg) { - MonoError error; + ERROR_DECL (error); MonoMethod *vmethod; gpointer addr; MonoGenericContext *context = mono_method_get_context (method); @@ -1111,8 +1111,8 @@ mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointe g_assert (!mono_class_is_ginst (vmethod->klass) || !mono_class_get_generic_class (vmethod->klass)->context.class_inst->is_open); g_assert (!context->method_inst || !context->method_inst->is_open); - addr = mono_compile_method_checked (vmethod, &error); - if (mono_error_set_pending_exception (&error)) + addr = mono_compile_method_checked (vmethod, error); + if (mono_error_set_pending_exception (error)) return NULL; addr = mini_add_method_trampoline (vmethod, addr, mono_method_needs_static_rgctx_invoke (vmethod, FALSE), FALSE); @@ -1129,44 +1129,44 @@ mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointe MonoString* ves_icall_mono_ldstr (MonoDomain *domain, MonoImage *image, guint32 idx) { - MonoError error; - MonoString *result = mono_ldstr_checked (domain, image, idx, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + MonoString *result = mono_ldstr_checked (domain, image, idx, error); + mono_error_set_pending_exception (error); return result; } MonoString* mono_helper_ldstr (MonoImage *image, guint32 idx) { - MonoError error; - MonoString *result = mono_ldstr_checked (mono_domain_get (), image, idx, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + MonoString *result = mono_ldstr_checked (mono_domain_get (), image, idx, error); + mono_error_set_pending_exception (error); return result; } MonoString* mono_helper_ldstr_mscorlib (guint32 idx) { - MonoError error; - MonoString *result = mono_ldstr_checked (mono_domain_get (), mono_defaults.corlib, idx, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + MonoString *result = mono_ldstr_checked (mono_domain_get (), mono_defaults.corlib, idx, error); + mono_error_set_pending_exception (error); return result; } MonoObject* mono_helper_newobj_mscorlib (guint32 idx) { - MonoError error; - MonoClass *klass = mono_class_get_checked (mono_defaults.corlib, MONO_TOKEN_TYPE_DEF | idx, &error); + ERROR_DECL (error); + MonoClass *klass = mono_class_get_checked (mono_defaults.corlib, MONO_TOKEN_TYPE_DEF | idx, error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } - MonoObject *obj = mono_object_new_checked (mono_domain_get (), klass, &error); - if (!mono_error_ok (&error)) - mono_error_set_pending_exception (&error); + MonoObject *obj = mono_object_new_checked (mono_domain_get (), klass, error); + if (!mono_error_ok (error)) + mono_error_set_pending_exception (error); return obj; } @@ -1189,27 +1189,27 @@ mono_create_corlib_exception_0 (guint32 token) MonoException * mono_create_corlib_exception_1 (guint32 token, MonoString *arg) { - MonoError error; + ERROR_DECL (error); MonoException *ret = mono_exception_from_token_two_strings_checked ( - mono_defaults.corlib, token, arg, NULL, &error); - mono_error_set_pending_exception (&error); + mono_defaults.corlib, token, arg, NULL, error); + mono_error_set_pending_exception (error); return ret; } MonoException * mono_create_corlib_exception_2 (guint32 token, MonoString *arg1, MonoString *arg2) { - MonoError error; + ERROR_DECL (error); MonoException *ret = mono_exception_from_token_two_strings_checked ( - mono_defaults.corlib, token, arg1, arg2, &error); - mono_error_set_pending_exception (&error); + mono_defaults.corlib, token, arg1, arg2, error); + mono_error_set_pending_exception (error); return ret; } MonoObject* mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass) { - MonoError error; + ERROR_DECL (error); MonoJitTlsData *jit_tls = NULL; MonoClass *oklass; @@ -1224,9 +1224,9 @@ mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass) oklass = obj->vtable->klass; if ((klass->enumtype && oklass == klass->element_class) || (oklass->enumtype && klass == oklass->element_class)) return obj; - if (mono_object_isinst_checked (obj, klass, &error)) + if (mono_object_isinst_checked (obj, klass, error)) return obj; - if (mono_error_set_pending_exception (&error)) + if (mono_error_set_pending_exception (error)) return NULL; if (mini_get_debug_options ()->better_cast_details) { @@ -1243,7 +1243,7 @@ mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass) MonoObject* mono_object_castclass_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cache) { - MonoError error; + ERROR_DECL (error); MonoJitTlsData *jit_tls = NULL; gpointer cached_vtable, obj_vtable; @@ -1261,11 +1261,11 @@ mono_object_castclass_with_cache (MonoObject *obj, MonoClass *klass, gpointer *c if (cached_vtable == obj_vtable) return obj; - if (mono_object_isinst_checked (obj, klass, &error)) { + if (mono_object_isinst_checked (obj, klass, error)) { *cache = obj_vtable; return obj; } - if (mono_error_set_pending_exception (&error)) + if (mono_error_set_pending_exception (error)) return NULL; if (mini_get_debug_options ()->better_cast_details) { @@ -1282,7 +1282,7 @@ mono_object_castclass_with_cache (MonoObject *obj, MonoClass *klass, gpointer *c MonoObject* mono_object_isinst_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cache) { - MonoError error; + ERROR_DECL (error); size_t cached_vtable, obj_vtable; if (!obj) @@ -1295,11 +1295,11 @@ mono_object_isinst_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cach return (cached_vtable & 0x1) ? NULL : obj; } - if (mono_object_isinst_checked (obj, klass, &error)) { + if (mono_object_isinst_checked (obj, klass, error)) { *cache = (gpointer)obj_vtable; return obj; } else { - if (mono_error_set_pending_exception (&error)) + if (mono_error_set_pending_exception (error)) return NULL; /*negative cache*/ *cache = (gpointer)(obj_vtable | 0x1); @@ -1310,7 +1310,7 @@ mono_object_isinst_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cach gpointer mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpointer func) { - MonoError error; + ERROR_DECL (error); MonoMarshalSpec **mspecs; MonoMethodPInvoke piinfo; MonoMethod *m; @@ -1320,8 +1320,8 @@ mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpoin m = mono_marshal_get_native_func_wrapper (image, sig, &piinfo, mspecs, func); - gpointer compiled_ptr = mono_compile_method_checked (m, &error); - mono_error_set_pending_exception (&error); + gpointer compiled_ptr = mono_compile_method_checked (m, error); + mono_error_set_pending_exception (error); return compiled_ptr; } @@ -1360,8 +1360,10 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k vt_slot += iface_offset; } m = klass->vtable [vt_slot]; - if (cmethod->is_inflated) - m = mono_class_inflate_generic_method (m, mono_method_get_context (cmethod)); + if (cmethod->is_inflated) { + m = mono_class_inflate_generic_method_full_checked (m, NULL, mono_method_get_context (cmethod), error); + return_val_if_nok (error, NULL); + } } if (klass->valuetype && (m->klass == mono_defaults.object_class || m->klass == mono_defaults.enum_class->parent || m->klass == mono_defaults.enum_class)) { @@ -1403,15 +1405,15 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k MonoObject* mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gboolean deref_arg, gpointer *args) { - MonoError error; + ERROR_DECL (error); MonoObject *o; MonoMethod *m; gpointer this_arg; gpointer new_args [16]; - m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -1428,9 +1430,9 @@ mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *kl this_arg = NULL; } - o = mono_runtime_invoke_checked (m, this_arg, args, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + o = mono_runtime_invoke_checked (m, this_arg, args, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -1450,42 +1452,42 @@ void ves_icall_runtime_class_init (MonoVTable *vtable) { MONO_REQ_GC_UNSAFE_MODE; - MonoError error; + ERROR_DECL (error); - mono_runtime_class_init_full (vtable, &error); - mono_error_set_pending_exception (&error); + mono_runtime_class_init_full (vtable, error); + mono_error_set_pending_exception (error); } void mono_generic_class_init (MonoVTable *vtable) { - MonoError error; - mono_runtime_class_init_full (vtable, &error); - mono_error_set_pending_exception (&error); + ERROR_DECL (error); + mono_runtime_class_init_full (vtable, error); + mono_error_set_pending_exception (error); } void ves_icall_mono_delegate_ctor (MonoObject *this_obj_raw, MonoObject *target_raw, gpointer addr) { HANDLE_FUNCTION_ENTER (); - MonoError error; + ERROR_DECL (error); MONO_HANDLE_DCL (MonoObject, this_obj); MONO_HANDLE_DCL (MonoObject, target); - mono_delegate_ctor (this_obj, target, addr, &error); - mono_error_set_pending_exception (&error); + mono_delegate_ctor (this_obj, target, addr, error); + mono_error_set_pending_exception (error); HANDLE_FUNCTION_RETURN (); } gpointer mono_fill_class_rgctx (MonoVTable *vtable, int index) { - MonoError error; + ERROR_DECL (error); gpointer res; - res = mono_class_fill_runtime_generic_context (vtable, index, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + res = mono_class_fill_runtime_generic_context (vtable, index, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } return res; @@ -1494,12 +1496,12 @@ mono_fill_class_rgctx (MonoVTable *vtable, int index) gpointer mono_fill_method_rgctx (MonoMethodRuntimeGenericContext *mrgctx, int index) { - MonoError error; + ERROR_DECL (error); gpointer res; - res = mono_method_fill_runtime_generic_context (mrgctx, index, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + res = mono_method_fill_runtime_generic_context (mrgctx, index, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } return res; @@ -1565,10 +1567,10 @@ resolve_iface_call (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method, gpointer mono_resolve_iface_call_gsharedvt (MonoObject *this_obj, int imt_slot, MonoMethod *imt_method, gpointer *out_arg) { - MonoError error; - gpointer res = resolve_iface_call (this_obj, imt_slot, imt_method, out_arg, TRUE, &error); - if (!is_ok (&error)) { - MonoException *ex = mono_error_convert_to_exception (&error); + ERROR_DECL (error); + gpointer res = resolve_iface_call (this_obj, imt_slot, imt_method, out_arg, TRUE, error); + if (!is_ok (error)) { + MonoException *ex = mono_error_convert_to_exception (error); mono_llvm_throw_exception ((MonoObject*)ex); } return res; @@ -1675,10 +1677,10 @@ mono_resolve_vcall_gsharedvt (MonoObject *this_obj, int slot, MonoMethod *imt_me { g_assert (this_obj); - MonoError error; - gpointer result = resolve_vcall (this_obj->vtable, slot, imt_method, out_arg, TRUE, &error); - if (!is_ok (&error)) { - MonoException *ex = mono_error_convert_to_exception (&error); + ERROR_DECL (error); + gpointer result = resolve_vcall (this_obj->vtable, slot, imt_method, out_arg, TRUE, error); + if (!is_ok (error)) { + MonoException *ex = mono_error_convert_to_exception (error); mono_llvm_throw_exception ((MonoObject*)ex); } return result; @@ -1696,7 +1698,7 @@ mono_resolve_generic_virtual_call (MonoVTable *vt, int slot, MonoMethod *generic MonoMethod *m; gpointer addr, compiled_method; gboolean need_unbox_tramp = FALSE; - MonoError error; + ERROR_DECL (error); MonoGenericContext context = { NULL, NULL }; MonoMethod *declaring; gpointer arg = NULL; @@ -1718,15 +1720,15 @@ mono_resolve_generic_virtual_call (MonoVTable *vt, int slot, MonoMethod *generic g_assert (generic_virtual->is_inflated); context.method_inst = ((MonoMethodInflated*)generic_virtual)->context.method_inst; - m = mono_class_inflate_generic_method_checked (declaring, &context, &error); - g_assert (mono_error_ok (&error)); + m = mono_class_inflate_generic_method_checked (declaring, &context, error); + g_assert (mono_error_ok (error)); if (vt->klass->valuetype) need_unbox_tramp = TRUE; // FIXME: This can throw exceptions - addr = compiled_method = mono_compile_method_checked (m, &error); - mono_error_assert_ok (&error); + addr = compiled_method = mono_compile_method_checked (m, error); + mono_error_assert_ok (error); g_assert (addr); addr = mini_add_method_wrappers_llvmonly (m, addr, FALSE, need_unbox_tramp, &arg); @@ -1753,7 +1755,7 @@ mono_resolve_generic_virtual_call (MonoVTable *vt, int slot, MonoMethod *generic MonoFtnDesc* mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMethod *generic_virtual) { - MonoError error; + ERROR_DECL (error); MonoMethod *m, *variant_iface; gpointer addr, aot_addr, compiled_method; gboolean need_unbox_tramp = FALSE; @@ -1763,9 +1765,9 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho imt = (gpointer*)vt - MONO_IMT_SIZE; - mini_resolve_imt_method (vt, imt + imt_slot, generic_virtual, &m, &aot_addr, &need_rgctx_tramp, &variant_iface, &error); - if (!is_ok (&error)) { - MonoException *ex = mono_error_convert_to_exception (&error); + mini_resolve_imt_method (vt, imt + imt_slot, generic_virtual, &m, &aot_addr, &need_rgctx_tramp, &variant_iface, error); + if (!is_ok (error)) { + MonoException *ex = mono_error_convert_to_exception (error); mono_llvm_throw_exception ((MonoObject*)ex); } @@ -1775,9 +1777,9 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) m = mono_marshal_get_synchronized_wrapper (m); - addr = compiled_method = mono_compile_method_checked (m, &error); - if (!is_ok (&error)) - mono_llvm_raise_exception (mono_error_convert_to_exception (&error)); + addr = compiled_method = mono_compile_method_checked (m, error); + if (!is_ok (error)) + mono_llvm_raise_exception (mono_error_convert_to_exception (error)); g_assert (addr); addr = mini_add_method_wrappers_llvmonly (m, addr, FALSE, need_unbox_tramp, &arg); @@ -1804,13 +1806,13 @@ mono_resolve_generic_virtual_iface_call (MonoVTable *vt, int imt_slot, MonoMetho gpointer mono_init_vtable_slot (MonoVTable *vtable, int slot) { - MonoError error; + ERROR_DECL (error); gpointer arg = NULL; gpointer addr; gpointer *ftnptr; - addr = resolve_vcall (vtable, slot, NULL, &arg, FALSE, &error); - if (mono_error_set_pending_exception (&error)) + addr = resolve_vcall (vtable, slot, NULL, &arg, FALSE, error); + if (mono_error_set_pending_exception (error)) return NULL; ftnptr = mono_domain_alloc0 (vtable->domain, 2 * sizeof (gpointer)); ftnptr [0] = addr; @@ -1831,7 +1833,7 @@ mono_init_vtable_slot (MonoVTable *vtable, int slot) void mono_llvmonly_init_delegate (MonoDelegate *del) { - MonoError error; + ERROR_DECL (error); MonoFtnDesc *ftndesc = *(MonoFtnDesc**)del->method_code; /* @@ -1844,8 +1846,8 @@ mono_llvmonly_init_delegate (MonoDelegate *del) if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) m = mono_marshal_get_synchronized_wrapper (m); - gpointer addr = mono_compile_method_checked (m, &error); - if (mono_error_set_pending_exception (&error)) + gpointer addr = mono_compile_method_checked (m, error); + if (mono_error_set_pending_exception (error)) return; if (m->klass->valuetype && mono_method_signature (m)->hasthis) @@ -1864,7 +1866,7 @@ mono_llvmonly_init_delegate (MonoDelegate *del) void mono_llvmonly_init_delegate_virtual (MonoDelegate *del, MonoObject *target, MonoMethod *method) { - MonoError error; + ERROR_DECL (error); g_assert (target); @@ -1874,8 +1876,8 @@ mono_llvmonly_init_delegate_virtual (MonoDelegate *del, MonoObject *target, Mono method = mono_marshal_get_synchronized_wrapper (method); del->method = method; - del->method_ptr = mono_compile_method_checked (method, &error); - if (mono_error_set_pending_exception (&error)) + del->method_ptr = mono_compile_method_checked (method, error); + if (mono_error_set_pending_exception (error)) return; if (method->klass->valuetype) del->method_ptr = mono_aot_get_unbox_trampoline (method); @@ -1886,17 +1888,17 @@ MonoObject* mono_get_assembly_object (MonoImage *image) { ICALL_ENTRY(); - MonoObjectHandle result = MONO_HANDLE_CAST (MonoObject, mono_assembly_get_object_handle (mono_domain_get (), image->assembly, &error)); + MonoObjectHandle result = MONO_HANDLE_CAST (MonoObject, mono_assembly_get_object_handle (mono_domain_get (), image->assembly, error)); ICALL_RETURN_OBJ (result); } MonoObject* mono_get_method_object (MonoMethod *method) { - MonoError error; + ERROR_DECL (error); MonoObject * result; - result = (MonoObject*)mono_method_get_object_checked (mono_domain_get (), method, method->klass, &error); - mono_error_set_pending_exception (&error); + result = (MonoObject*)mono_method_get_object_checked (mono_domain_get (), method, method->klass, error); + mono_error_set_pending_exception (error); return result; } @@ -1913,11 +1915,11 @@ mono_throw_method_access (MonoMethod *caller, MonoMethod *callee) { char *caller_name = mono_method_get_reflection_name (caller); char *callee_name = mono_method_get_reflection_name (callee); - MonoError error; + ERROR_DECL (error); - error_init (&error); - mono_error_set_generic_error (&error, "System", "MethodAccessException", "Method `%s' is inaccessible from method `%s'", callee_name, caller_name); - mono_error_set_pending_exception (&error); + error_init (error); + mono_error_set_generic_error (error, "System", "MethodAccessException", "Method `%s' is inaccessible from method `%s'", callee_name, caller_name); + mono_error_set_pending_exception (error); g_free (callee_name); g_free (caller_name); } diff --git a/mono/mini/main.c b/mono/mini/main.c index 874548e3b1..0192135f7d 100644 --- a/mono/mini/main.c +++ b/mono/mini/main.c @@ -16,6 +16,9 @@ */ #include #include +#ifndef HOST_WIN32 +#include +#endif #include #include #include @@ -185,6 +188,47 @@ save_library (int fd, uint64_t offset, uint64_t size, const char *destfname) g_free (buffer); } +#ifndef HOST_WIN32 +static gboolean +search_directories(const char *envPath, const char *program, char **new_program) +{ + gchar **paths = NULL; + gint i; + + paths = g_strsplit (envPath, G_SEARCHPATH_SEPARATOR_S, 0); + g_assert (paths); + + for (i = 0; paths [i]; ++i) { + gchar *path = paths [i]; + gint path_len = strlen (path); + DIR *dir; + struct dirent *ent; + + if (path_len == 0) + continue; + + dir = opendir (path); + if (!dir) + continue; + + while ((ent = readdir (dir))){ + if (!strcmp (ent->d_name, program)){ + *new_program = g_strdup_printf ("%s%s%s", path, path [path_len - 1] == '/' ? "" : "/", program); + closedir (dir); + g_strfreev (paths); + return TRUE; + } + } + + closedir (dir); + } + + *new_program = NULL; + g_strfreev (paths); + return FALSE; +} +#endif + static gboolean probe_embedded (const char *program, int *ref_argc, char **ref_argv []) { @@ -204,6 +248,20 @@ probe_embedded (const char *program, int *ref_argc, char **ref_argv []) int j; int fd = open (program, O_RDONLY); +#ifndef HOST_WIN32 + if (fd == -1){ + // Also search through the PATH in case the program was run from a different directory + gchar* envPath = getenv ("PATH"); + if (envPath){ + gchar *new_program = NULL; + if (search_directories (envPath, program, &new_program)){ + fd = open (new_program, O_RDONLY); + g_free (new_program); + new_program = NULL; + } + } + } +#endif if (fd == -1) return FALSE; if ((sigstart = lseek (fd, -24, SEEK_END)) == -1) diff --git a/mono/mini/method-to-ir.c.REMOVED.git-id b/mono/mini/method-to-ir.c.REMOVED.git-id index 5ece74df95..2551c3cff9 100644 --- a/mono/mini/method-to-ir.c.REMOVED.git-id +++ b/mono/mini/method-to-ir.c.REMOVED.git-id @@ -1 +1 @@ -364b81e690f2369d9ddc8d556c4ac5747d3b02b6 \ No newline at end of file +79872f8eecab893a5cc7113659b5780a5f494f0a \ No newline at end of file diff --git a/mono/mini/mini-amd64-gsharedvt.c b/mono/mini/mini-amd64-gsharedvt.c index d6cc6a743e..dc78a80691 100644 --- a/mono/mini/mini-amd64-gsharedvt.c +++ b/mono/mini/mini-amd64-gsharedvt.c @@ -57,6 +57,7 @@ storage_name (ArgStorage st) } } +#ifdef DEBUG_AMD64_GSHAREDVT static char * arg_info_desc (ArgInfo *info) { @@ -72,6 +73,7 @@ arg_info_desc (ArgInfo *info) return g_string_free (str, FALSE); } +#endif static inline void add_to_map (GPtrArray *map, int src, int dst) diff --git a/mono/mini/mini-amd64-gsharedvt.h b/mono/mini/mini-amd64-gsharedvt.h index 9cb873e567..5cc7a480a7 100644 --- a/mono/mini/mini-amd64-gsharedvt.h +++ b/mono/mini/mini-amd64-gsharedvt.h @@ -37,20 +37,6 @@ typedef enum { GSHAREDVT_RET_NUM, } GSharedVtRetMarshal; -static const char* ret_marshal_name[] = { - "GSHAREDVT_RET_NONE", - "GSHAREDVT_RET_I1", - "GSHAREDVT_RET_U1", - "GSHAREDVT_RET_I2", - "GSHAREDVT_RET_U2", - "GSHAREDVT_RET_I4", - "GSHAREDVT_RET_U4", - "GSHAREDVT_RET_I8", - "GSHAREDVT_RET_IREGS_1", - "GSHAREDVT_RET_R8", - "GSHAREDVT_RET_NUM", -}; - #ifdef DEBUG_AMD64_GSHAREDVT #define DEBUG_AMD64_GSHAREDVT_PRINT printf #else diff --git a/mono/mini/mini-amd64.c.REMOVED.git-id b/mono/mini/mini-amd64.c.REMOVED.git-id index 353d3eafb3..5c853f7e99 100644 --- a/mono/mini/mini-amd64.c.REMOVED.git-id +++ b/mono/mini/mini-amd64.c.REMOVED.git-id @@ -1 +1 @@ -bce50bdd90275294e11ebe2e04d66fd42fc80dee \ No newline at end of file +91e1e78fbac343ad581d1761878b8f403ce84f1f \ No newline at end of file diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h index 694362db63..536c27f1af 100644 --- a/mono/mini/mini-amd64.h +++ b/mono/mini/mini-amd64.h @@ -126,8 +126,6 @@ struct sigcontext { #define MONO_ARCH_SIGNAL_STACK_SIZE (16 * 1024) #endif -#define MONO_ARCH_HAVE_RESTORE_STACK_SUPPORT 1 - #define MONO_ARCH_CPU_SPEC mono_amd64_desc #define MONO_MAX_IREGS 16 @@ -233,6 +231,8 @@ static AMD64_XMM_Reg_No float_return_regs [] = { AMD64_XMM0 }; #else #define PARAM_REGS 6 #define FLOAT_PARAM_REGS 8 +#define RETURN_REGS 2 +#define FLOAT_RETURN_REGS 2 static const AMD64_Reg_No param_regs [] = {AMD64_RDI, AMD64_RSI, AMD64_RDX, AMD64_RCX, AMD64_R8, AMD64_R9}; @@ -326,6 +326,15 @@ typedef struct { ArgInfo args [1]; } CallInfo; +typedef struct { + /* General registers */ + mgreg_t gregs [AMD64_NREG]; + /* Floating registers */ + double fregs [AMD64_XMM_NREG]; + /* Stack usage, used for passing params on stack */ + size_t stack_size; + gpointer *stack; +} CallContext; #define MONO_CONTEXT_SET_LLVM_EXC_REG(ctx, exc) do { (ctx)->gregs [AMD64_RAX] = (gsize)exc; } while (0) #define MONO_CONTEXT_SET_LLVM_EH_SELECTOR_REG(ctx, sel) do { (ctx)->gregs [AMD64_RDX] = (gsize)(sel); } while (0) @@ -366,7 +375,7 @@ typedef struct { */ #define MONO_ARCH_VARARG_ICALLS 1 -#if !defined( HOST_WIN32 ) && defined (HAVE_SIGACTION) +#if !defined( HOST_WIN32 ) && !defined(__HAIKU__) && defined (HAVE_SIGACTION) #define MONO_ARCH_USE_SIGACTION 1 @@ -443,6 +452,8 @@ typedef struct { #define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1 #define MONO_ARCH_HAVE_GENERAL_RGCTX_LAZY_FETCH_TRAMPOLINE 1 +#define MONO_ARCH_HAVE_INTERP_PINVOKE_TRAMP + #if defined(TARGET_OSX) || defined(__linux__) #define MONO_ARCH_HAVE_UNWIND_BACKTRACE 1 #endif diff --git a/mono/mini/mini-arm.c.REMOVED.git-id b/mono/mini/mini-arm.c.REMOVED.git-id index 9cf8501d19..07856fc39b 100644 --- a/mono/mini/mini-arm.c.REMOVED.git-id +++ b/mono/mini/mini-arm.c.REMOVED.git-id @@ -1 +1 @@ -fe2c74bda38d98c0458b65532f4b6f696d1a9b80 \ No newline at end of file +d1990aee1f3b34c75453c63bedb0afae4793e7a7 \ No newline at end of file diff --git a/mono/mini/mini-arm.h b/mono/mini/mini-arm.h index 1f7990e097..2211bbe1a3 100644 --- a/mono/mini/mini-arm.h +++ b/mono/mini/mini-arm.h @@ -223,6 +223,19 @@ typedef struct { ArgInfo args [1]; } CallInfo; +#define PARAM_REGS 4 +#define FP_PARAM_REGS 8 + +typedef struct { + /* General registers */ + mgreg_t gregs [PARAM_REGS]; + /* Floating registers */ + float fregs [FP_PARAM_REGS * 2]; + /* Stack usage, used for passing params on stack */ + guint32 stack_size; + guint8 *stack; +} CallContext; + /* Structure used by the sequence points in AOTed code */ typedef struct { gpointer ss_trigger_page; @@ -231,10 +244,6 @@ typedef struct { guint8* bp_addrs [MONO_ZERO_LEN_ARRAY]; } SeqPointInfo; - -#define PARAM_REGS 4 -#define FP_PARAM_REGS 8 - typedef struct { double fpregs [FP_PARAM_REGS]; mgreg_t res, res2; @@ -352,6 +361,8 @@ typedef struct MonoCompileArch { #define MONO_ARCH_HAVE_PATCH_CODE_NEW 1 #define MONO_ARCH_HAVE_OP_GENERIC_CLASS_INIT 1 +#define MONO_ARCH_HAVE_INTERP_PINVOKE_TRAMP 1 + #if defined(TARGET_WATCHOS) || (defined(__linux__) && !defined(TARGET_ANDROID)) #define MONO_ARCH_DISABLE_HW_TRAPS 1 #define MONO_ARCH_HAVE_UNWIND_BACKTRACE 1 diff --git a/mono/mini/mini-arm64.c.REMOVED.git-id b/mono/mini/mini-arm64.c.REMOVED.git-id index 027876c9ca..b49529ece8 100644 --- a/mono/mini/mini-arm64.c.REMOVED.git-id +++ b/mono/mini/mini-arm64.c.REMOVED.git-id @@ -1 +1 @@ -33e5a40b241d520cf4a8eb5274551fb83985185c \ No newline at end of file +a83e686bbdd60f7d511d5e1db1d4b014dafb1957 \ No newline at end of file diff --git a/mono/mini/mini-arm64.h b/mono/mini/mini-arm64.h index 960b3e2725..e2c7dc9537 100644 --- a/mono/mini/mini-arm64.h +++ b/mono/mini/mini-arm64.h @@ -154,6 +154,8 @@ typedef struct { #define MONO_ARCH_HAVE_OPCODE_NEEDS_EMULATION 1 #define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1 +#define MONO_ARCH_HAVE_INTERP_PINVOKE_TRAMP 1 + #ifdef TARGET_IOS #define MONO_ARCH_REDZONE_SIZE 128 @@ -228,6 +230,15 @@ typedef struct { ArgInfo args [1]; } CallInfo; +typedef struct { + /* General registers + ARMREG_R8 for indirect returns */ + mgreg_t gregs [PARAM_REGS + 1]; + /* Floating registers */ + double fregs [FP_PARAM_REGS]; + /* Stack usage, used for passing params on stack */ + guint32 stack_size; + guint8* stack; +} CallContext; guint8* mono_arm_emit_imm64 (guint8 *code, int dreg, gint64 imm); diff --git a/mono/mini/mini-codegen.c b/mono/mini/mini-codegen.c index 4482640343..090b3c914a 100644 --- a/mono/mini/mini-codegen.c +++ b/mono/mini/mini-codegen.c @@ -21,6 +21,7 @@ #include #include "mini.h" +#include "mini-runtime.h" #include "trace.h" #include "mini-arch.h" diff --git a/mono/mini/mini-darwin.c b/mono/mini/mini-darwin.c index bce049427a..05962a0717 100644 --- a/mono/mini/mini-darwin.c +++ b/mono/mini/mini-darwin.c @@ -52,6 +52,7 @@ #include #include "mini.h" +#include "mini-runtime.h" #include #include #include "trace.h" diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c new file mode 100644 index 0000000000..ce160ba71c --- /dev/null +++ b/mono/mini/mini-exceptions.c @@ -0,0 +1,3436 @@ +/** + * \file + * generic exception support + * + * Authors: + * Dietmar Maurer (dietmar@ximian.com) + * Mono Team (mono-list@lists.ximian.com) + * + * Copyright 2001-2003 Ximian, Inc. + * Copyright 2003-2008 Novell, Inc. + * Copyright 2011 Xamarin Inc (http://www.xamarin.com). + * Licensed under the MIT license. See LICENSE file in the project root for full license information. + */ + +#include +#include +#include + +#ifdef HAVE_SIGNAL_H +#include +#endif + +#ifdef HAVE_EXECINFO_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_SYS_WAIT_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_SYS_SYSCALL_H +#include +#endif + +#ifdef HAVE_SYS_PRCTL_H +#include +#endif + +#ifdef HAVE_UNWIND_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mini.h" +#include "trace.h" +#include "debugger-agent.h" +#include "seq-points.h" +#include "llvm-runtime.h" +#include "mini-llvm.h" +#include "aot-runtime.h" +#include "mini-runtime.h" +#include "interp/interp.h" + +#ifdef ENABLE_LLVM +#include "mini-llvm-cpp.h" +#endif + +#ifdef TARGET_ARM +#include "mini-arm.h" +#endif + +#ifndef MONO_ARCH_CONTEXT_DEF +#define MONO_ARCH_CONTEXT_DEF +#endif + +/* + * Raw frame information is stored in MonoException.trace_ips as an IntPtr[]. + * This structure represents one entry. + * This should consists of pointers only. + */ +typedef struct +{ + gpointer ip; + gpointer generic_info; + /* Only for interpreter frames */ + MonoJitInfo *ji; +} ExceptionTraceIp; + +/* Number of words in trace_ips belonging to one entry */ +#define TRACE_IP_ENTRY_SIZE (sizeof (ExceptionTraceIp) / sizeof (gpointer)) + +static gpointer restore_context_func, call_filter_func; +static gpointer throw_exception_func, rethrow_exception_func; +static gpointer throw_corlib_exception_func; + +static void mono_walk_stack_full (MonoJitStackWalk func, MonoContext *start_ctx, MonoDomain *domain, MonoJitTlsData *jit_tls, MonoLMF *lmf, MonoUnwindOptions unwind_options, gpointer user_data); +static void mono_raise_exception_with_ctx (MonoException *exc, MonoContext *ctx); +static void mono_runtime_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data); +static gboolean mono_current_thread_has_handle_block_guard (void); +static gboolean mono_install_handler_block_guard (MonoThreadUnwindState *ctx); + +static gboolean +first_managed (MonoStackFrameInfo *frame, MonoContext *ctx, gpointer addr) +{ + gpointer **data = (gpointer **)addr; + + if (!frame->managed) + return FALSE; + + if (!ctx) { + // FIXME: Happens with llvm_only + *data = NULL; + return TRUE; + } + + *data = MONO_CONTEXT_GET_SP (ctx); + g_assert (*data); + return TRUE; +} + +static gpointer +mono_thread_get_managed_sp (void) +{ + gpointer addr = NULL; + mono_walk_stack (first_managed, MONO_UNWIND_SIGNAL_SAFE, &addr); + return addr; +} + +static inline void +mini_clear_abort_threshold (void) +{ + MonoJitTlsData *jit_tls = mono_get_jit_tls (); + jit_tls->abort_exc_stack_threshold = NULL; +} + +static inline void +mini_set_abort_threshold (MonoContext *ctx) +{ + gpointer sp = MONO_CONTEXT_GET_SP (ctx); + MonoJitTlsData *jit_tls = mono_get_jit_tls (); + // Only move it up, to avoid thrown/caught + // exceptions lower in the stack from triggering + // a rethrow + gboolean above_threshold = (gsize) sp >= (gsize) jit_tls->abort_exc_stack_threshold; + if (!jit_tls->abort_exc_stack_threshold || above_threshold) { + jit_tls->abort_exc_stack_threshold = sp; + } +} + +// Note: In the case that the frame is above where the thread abort +// was set we bump the threshold so that functions called from the new, +// higher threshold don't trigger the thread abort exception +static inline gboolean +mini_above_abort_threshold (void) +{ + gpointer sp = mono_thread_get_managed_sp (); + MonoJitTlsData *jit_tls = (MonoJitTlsData*) mono_tls_get_jit_tls (); + + if (!sp) + return TRUE; + + gboolean above_threshold = (gsize) sp >= (gsize) jit_tls->abort_exc_stack_threshold; + + if (above_threshold) + jit_tls->abort_exc_stack_threshold = sp; + + return above_threshold; +} + +static int +mono_get_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset) +{ + SeqPoint sp; + if (mono_find_prev_seq_point_for_native_offset (domain, method, native_offset, NULL, &sp)) + return sp.il_offset; + return -1; +} + +void +mono_exceptions_init (void) +{ + MonoRuntimeExceptionHandlingCallbacks cbs; + if (mono_aot_only) { + restore_context_func = mono_aot_get_trampoline ("restore_context"); + call_filter_func = mono_aot_get_trampoline ("call_filter"); + throw_exception_func = mono_aot_get_trampoline ("throw_exception"); + rethrow_exception_func = mono_aot_get_trampoline ("rethrow_exception"); + } else { + MonoTrampInfo *info; + + restore_context_func = mono_arch_get_restore_context (&info, FALSE); + mono_tramp_info_register (info, NULL); + call_filter_func = mono_arch_get_call_filter (&info, FALSE); + mono_tramp_info_register (info, NULL); + throw_exception_func = mono_arch_get_throw_exception (&info, FALSE); + mono_tramp_info_register (info, NULL); + rethrow_exception_func = mono_arch_get_rethrow_exception (&info, FALSE); + mono_tramp_info_register (info, NULL); + } + +#ifdef MONO_ARCH_HAVE_EXCEPTIONS_INIT + mono_arch_exceptions_init (); +#endif + if (mono_use_interpreter) + cbs.mono_walk_stack_with_ctx = mini_get_interp_callbacks ()->walk_stack_with_ctx; + else + cbs.mono_walk_stack_with_ctx = mono_runtime_walk_stack_with_ctx; + + cbs.mono_walk_stack_with_state = mono_walk_stack_with_state; + + if (mono_llvm_only) { + cbs.mono_raise_exception = mono_llvm_raise_exception; + cbs.mono_reraise_exception = mono_llvm_reraise_exception; + } else { + cbs.mono_raise_exception = (void (*)(MonoException *))mono_get_throw_exception (); + cbs.mono_reraise_exception = (void (*)(MonoException *))mono_get_rethrow_exception (); + } + cbs.mono_raise_exception_with_ctx = mono_raise_exception_with_ctx; + cbs.mono_exception_walk_trace = mono_exception_walk_trace; + cbs.mono_install_handler_block_guard = mono_install_handler_block_guard; + cbs.mono_current_thread_has_handle_block_guard = mono_current_thread_has_handle_block_guard; + cbs.mono_clear_abort_threshold = mini_clear_abort_threshold; + cbs.mono_above_abort_threshold = mini_above_abort_threshold; + mono_install_eh_callbacks (&cbs); + mono_install_get_seq_point (mono_get_seq_point_for_native_offset); +} + +gpointer +mono_get_throw_exception (void) +{ + g_assert (throw_exception_func); + return throw_exception_func; +} + +gpointer +mono_get_rethrow_exception (void) +{ + g_assert (rethrow_exception_func); + return rethrow_exception_func; +} + +gpointer +mono_get_call_filter (void) +{ + g_assert (call_filter_func); + return call_filter_func; +} + +gpointer +mono_get_restore_context (void) +{ + g_assert (restore_context_func); + return restore_context_func; +} + +gpointer +mono_get_throw_corlib_exception (void) +{ + gpointer code = NULL; + MonoTrampInfo *info; + + /* This depends on corlib classes so cannot be inited in mono_exceptions_init () */ + if (throw_corlib_exception_func) + return throw_corlib_exception_func; + + if (mono_aot_only) + code = mono_aot_get_trampoline ("throw_corlib_exception"); + else { + code = mono_arch_get_throw_corlib_exception (&info, FALSE); + mono_tramp_info_register (info, NULL); + } + + mono_memory_barrier (); + + throw_corlib_exception_func = code; + + return throw_corlib_exception_func; +} + +/* + * mono_get_throw_exception_addr: + * + * Return an address which stores the result of + * mono_get_throw_exception. + */ +gpointer +mono_get_throw_exception_addr (void) +{ + return &throw_exception_func; +} + +static gboolean +is_address_protected (MonoJitInfo *ji, MonoJitExceptionInfo *ei, gpointer ip) +{ + MonoTryBlockHoleTableJitInfo *table; + int i; + guint32 offset; + guint16 clause; + + if (ei->try_start > ip || ip >= ei->try_end) + return FALSE; + + if (!ji->has_try_block_holes) + return TRUE; + + table = mono_jit_info_get_try_block_hole_table_info (ji); + offset = (guint32)((char*)ip - (char*)ji->code_start); + clause = (guint16)(ei - ji->clauses); + g_assert (clause < ji->num_clauses); + + for (i = 0; i < table->num_holes; ++i) { + MonoTryBlockHoleJitInfo *hole = &table->holes [i]; + if (hole->clause == clause && hole->offset <= offset && hole->offset + hole->length > offset) + return FALSE; + } + return TRUE; +} + +#ifdef MONO_ARCH_HAVE_UNWIND_BACKTRACE + +#if 0 +static gboolean show_native_addresses = TRUE; +#else +static gboolean show_native_addresses = FALSE; +#endif + +static _Unwind_Reason_Code +build_stack_trace (struct _Unwind_Context *frame_ctx, void *state) +{ + MonoDomain *domain = mono_domain_get (); + uintptr_t ip = _Unwind_GetIP (frame_ctx); + + if (show_native_addresses || mono_jit_info_table_find (domain, (char*)ip)) { + GList **trace_ips = (GList **)state; + *trace_ips = g_list_prepend (*trace_ips, (gpointer)ip); + } + + return _URC_NO_REASON; +} + +static GSList* +get_unwind_backtrace (void) +{ + GSList *ips = NULL; + + _Unwind_Backtrace (build_stack_trace, &ips); + + return g_slist_reverse (ips); +} + +#else + +static GSList* +get_unwind_backtrace (void) +{ + return NULL; +} + +#endif + +static gboolean +arch_unwind_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, + MonoJitInfo *ji, MonoContext *ctx, + MonoContext *new_ctx, MonoLMF **lmf, + mgreg_t **save_locations, + StackFrameInfo *frame) +{ + if (!ji && *lmf) { + if (((guint64)(*lmf)->previous_lmf) & 2) { + MonoLMFExt *ext = (MonoLMFExt*)(*lmf); + + memset (frame, 0, sizeof (StackFrameInfo)); + frame->ji = ji; + + *new_ctx = *ctx; + + if (ext->debugger_invoke) { + /* + * This LMF entry is created by the soft debug code to mark transitions to + * managed code done during invokes. + */ + frame->type = FRAME_TYPE_DEBUGGER_INVOKE; + memcpy (new_ctx, &ext->ctx, sizeof (MonoContext)); + } else if (ext->interp_exit) { + frame->type = FRAME_TYPE_INTERP_TO_MANAGED; + frame->interp_exit_data = ext->interp_exit_data; + } else { + g_assert_not_reached (); + } + + *lmf = (MonoLMF *)(((guint64)(*lmf)->previous_lmf) & ~3); + + return TRUE; + } + } + + return mono_arch_unwind_frame (domain, jit_tls, ji, ctx, new_ctx, lmf, save_locations, frame); +} + +/* + * find_jit_info: + * + * Translate between the mono_arch_unwind_frame function and the old API. + */ +static MonoJitInfo * +find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx, + MonoContext *new_ctx, MonoLMF **lmf, gboolean *managed) +{ + StackFrameInfo frame; + MonoJitInfo *ji; + gboolean err; + gpointer ip = MONO_CONTEXT_GET_IP (ctx); + + /* Avoid costly table lookup during stack overflow */ + if (prev_ji && (ip > prev_ji->code_start && ((guint8*)ip < ((guint8*)prev_ji->code_start) + prev_ji->code_size))) + ji = prev_ji; + else + ji = mini_jit_info_table_find (domain, (char *)ip, NULL); + + if (managed) + *managed = FALSE; + + err = arch_unwind_frame (domain, jit_tls, ji, ctx, new_ctx, lmf, NULL, &frame); + if (!err) + return (MonoJitInfo *)-1; + + if (*lmf && ((*lmf) != jit_tls->first_lmf) && ((gpointer)MONO_CONTEXT_GET_SP (new_ctx) >= (gpointer)(*lmf))) { + /* + * Remove any unused lmf. + * Mask out the lower bits which might be used to hold additional information. + */ + *lmf = (MonoLMF *)(((gsize)(*lmf)->previous_lmf) & ~(SIZEOF_VOID_P -1)); + } + + /* Convert between the new and the old APIs */ + switch (frame.type) { + case FRAME_TYPE_MANAGED: + if (managed) + *managed = TRUE; + return frame.ji; + case FRAME_TYPE_TRAMPOLINE: + return frame.ji; + case FRAME_TYPE_MANAGED_TO_NATIVE: + if (frame.ji) + return frame.ji; + else { + memset (res, 0, sizeof (MonoJitInfo)); + res->d.method = frame.method; + return res; + } + case FRAME_TYPE_DEBUGGER_INVOKE: { + MonoContext tmp_ctx; + + /* + * The normal exception handling code can't handle this frame, so just + * skip it. + */ + ji = find_jit_info (domain, jit_tls, res, NULL, new_ctx, &tmp_ctx, lmf, managed); + memcpy (new_ctx, &tmp_ctx, sizeof (MonoContext)); + return ji; + } + default: + g_assert_not_reached (); + return NULL; + } +} + +/* mono_find_jit_info: + * + * This function is used to gather information from @ctx. It return the + * MonoJitInfo of the corresponding function, unwinds one stack frame and + * stores the resulting context into @new_ctx. It also stores a string + * describing the stack location into @trace (if not NULL), and modifies + * the @lmf if necessary. @native_offset return the IP offset from the + * start of the function or -1 if that info is not available. + */ +MonoJitInfo * +mono_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx, + MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset, + gboolean *managed) +{ + gboolean managed2; + gpointer ip = MONO_CONTEXT_GET_IP (ctx); + MonoJitInfo *ji; + MonoMethod *method = NULL; + + if (trace) + *trace = NULL; + + if (native_offset) + *native_offset = -1; + + if (managed) + *managed = FALSE; + + ji = find_jit_info (domain, jit_tls, res, prev_ji, ctx, new_ctx, lmf, &managed2); + + if (ji == (gpointer)-1) + return ji; + + if (ji && !ji->is_trampoline) + method = jinfo_get_method (ji); + + if (managed2 || (method && method->wrapper_type)) { + const char *real_ip, *start; + gint32 offset; + + start = (const char *)ji->code_start; + if (!managed2) + /* ctx->ip points into native code */ + real_ip = (const char*)MONO_CONTEXT_GET_IP (new_ctx); + else + real_ip = (const char*)ip; + + if ((real_ip >= start) && (real_ip <= start + ji->code_size)) + offset = real_ip - start; + else + offset = -1; + + if (native_offset) + *native_offset = offset; + + if (managed) + if (!method->wrapper_type || method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) + *managed = TRUE; + + if (trace) + *trace = mono_debug_print_stack_frame (method, offset, domain); + } else { + if (trace) { + char *fname = mono_method_full_name (jinfo_get_method (res), TRUE); + *trace = g_strdup_printf ("in (unmanaged) %s", fname); + g_free (fname); + } + } + + return ji; +} + +/* + * mono_find_jit_info_ext: + * + * A version of mono_find_jit_info which returns all data in the StackFrameInfo + * structure. + * A note about frames of type FRAME_TYPE_MANAGED_TO_NATIVE: + * - These frames are used to mark managed-to-native transitions, so CTX will refer to native + * code, and new_ctx will refer to the last managed frame. The caller should unwind once more + * to obtain the last managed frame. + * If SAVE_LOCATIONS is not NULL, it should point to an array of size MONO_MAX_IREGS. + * On return, it will be filled with the locations where callee saved registers are saved + * by the current frame. This is returned outside of StackFrameInfo because it can be + * quite large on some platforms. + * If ASYNC true, this function will be async safe, but some fields of frame and frame->ji will + * not be set. + */ +gboolean +mono_find_jit_info_ext (MonoDomain *domain, MonoJitTlsData *jit_tls, + MonoJitInfo *prev_ji, MonoContext *ctx, + MonoContext *new_ctx, char **trace, MonoLMF **lmf, + mgreg_t **save_locations, + StackFrameInfo *frame) +{ + gboolean err; + gpointer ip = MONO_CONTEXT_GET_IP (ctx); + MonoJitInfo *ji; + MonoDomain *target_domain = domain; + MonoMethod *method = NULL; + gboolean async = mono_thread_info_is_async_context (); + + if (trace) + *trace = NULL; + + /* Avoid costly table lookup during stack overflow */ + if (prev_ji && (ip > prev_ji->code_start && ((guint8*)ip < ((guint8*)prev_ji->code_start) + prev_ji->code_size))) + ji = prev_ji; + else + ji = mini_jit_info_table_find (domain, (char *)ip, &target_domain); + + if (!target_domain) + target_domain = domain; + + if (save_locations) + memset (save_locations, 0, MONO_MAX_IREGS * sizeof (mgreg_t*)); + + err = arch_unwind_frame (target_domain, jit_tls, ji, ctx, new_ctx, lmf, save_locations, frame); + if (!err) + return FALSE; + + if (frame->type != FRAME_TYPE_INTERP_TO_MANAGED && *lmf && ((*lmf) != jit_tls->first_lmf) && ((gpointer)MONO_CONTEXT_GET_SP (new_ctx) >= (gpointer)(*lmf))) { + /* + * Remove any unused lmf. + * Mask out the lower bits which might be used to hold additional information. + */ + *lmf = (MonoLMF *)(((gsize)(*lmf)->previous_lmf) & ~(SIZEOF_VOID_P -1)); + } + + if (frame->ji && !frame->ji->is_trampoline && !frame->ji->async) + method = jinfo_get_method (frame->ji); + + if (frame->type == FRAME_TYPE_MANAGED && method) { + if (!method->wrapper_type || method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) + frame->managed = TRUE; + } + + if (frame->type == FRAME_TYPE_MANAGED_TO_NATIVE) { + /* + * This type of frame is just a marker, the caller should unwind once more to get the + * last managed frame. + */ + frame->ji = NULL; + frame->method = NULL; + } + + frame->native_offset = -1; + frame->domain = target_domain; + frame->async_context = async; + frame->frame_addr = MONO_CONTEXT_GET_SP (ctx); + + ji = frame->ji; + + if (frame->type == FRAME_TYPE_MANAGED) + frame->method = method; + + if (ji && (frame->managed || (method && method->wrapper_type))) { + const char *real_ip, *start; + + start = (const char *)ji->code_start; + if (frame->type == FRAME_TYPE_MANAGED) + real_ip = (const char*)ip; + else + /* ctx->ip points into native code */ + real_ip = (const char*)MONO_CONTEXT_GET_IP (new_ctx); + + if ((real_ip >= start) && (real_ip <= start + ji->code_size)) + frame->native_offset = real_ip - start; + else { + frame->native_offset = -1; + } + + if (trace) + *trace = mono_debug_print_stack_frame (method, frame->native_offset, domain); + } else { + if (trace && frame->method) { + char *fname = mono_method_full_name (frame->method, TRUE); + *trace = g_strdup_printf ("in (unmanaged) %s", fname); + g_free (fname); + } + } + + return TRUE; +} + +typedef struct { + gboolean in_interp; + MonoInterpStackIter interp_iter; + gpointer last_frame_addr; +} Unwinder; + +static void +unwinder_init (Unwinder *unwinder) +{ + memset (unwinder, 0, sizeof (Unwinder)); +} + +#if defined(__GNUC__) && defined(TARGET_ARM64) +/* gcc 4.9.2 seems to miscompile this on arm64 */ +static __attribute__((optimize("O0"))) gboolean +#else +static gboolean +#endif +unwinder_unwind_frame (Unwinder *unwinder, + MonoDomain *domain, MonoJitTlsData *jit_tls, + MonoJitInfo *prev_ji, MonoContext *ctx, + MonoContext *new_ctx, char **trace, MonoLMF **lmf, + mgreg_t **save_locations, + StackFrameInfo *frame) +{ + gpointer parent; + if (unwinder->in_interp) { + memcpy (new_ctx, ctx, sizeof (MonoContext)); + + /* Process debugger invokes */ + /* The DEBUGGER_INVOKE should be returned before the first interpreter frame for the invoke */ + if (unwinder->last_frame_addr > (gpointer)(*lmf)) { + if (((guint64)(*lmf)->previous_lmf) & 2) { + MonoLMFExt *ext = (MonoLMFExt*)(*lmf); + if (ext->debugger_invoke) { + *lmf = (MonoLMF *)(((guint64)(*lmf)->previous_lmf) & ~7); + frame->type = FRAME_TYPE_DEBUGGER_INVOKE; + return TRUE; + } + } + } + + unwinder->in_interp = mini_get_interp_callbacks ()->frame_iter_next (&unwinder->interp_iter, frame); + if (frame->type == FRAME_TYPE_INTERP) { + parent = mini_get_interp_callbacks ()->frame_get_parent (frame->interp_frame); + unwinder->last_frame_addr = parent; + } + if (!unwinder->in_interp) + return unwinder_unwind_frame (unwinder, domain, jit_tls, prev_ji, ctx, new_ctx, trace, lmf, save_locations, frame); + return TRUE; + } else { + gboolean res = mono_find_jit_info_ext (domain, jit_tls, prev_ji, ctx, new_ctx, trace, lmf, + save_locations, frame); + if (!res) + return FALSE; + if (frame->type == FRAME_TYPE_INTERP_TO_MANAGED) { + unwinder->in_interp = TRUE; + mini_get_interp_callbacks ()->frame_iter_init (&unwinder->interp_iter, frame->interp_exit_data); + parent = mini_get_interp_callbacks ()->frame_get_parent (frame->interp_exit_data); + MONO_CONTEXT_SET_SP (new_ctx, parent); + } + unwinder->last_frame_addr = frame->frame_addr; + return TRUE; + } +} + +/* + * This function is async-safe. + */ +static gpointer +get_generic_info_from_stack_frame (MonoJitInfo *ji, MonoContext *ctx) +{ + MonoGenericJitInfo *gi; + MonoMethod *method; + gpointer info; + + if (!ji->has_generic_jit_info) + return NULL; + gi = mono_jit_info_get_generic_jit_info (ji); + if (!gi->has_this) + return NULL; + + info = NULL; + /* + * Search location list if available, it contains the precise location of the + * argument for every pc offset, even if the method was interrupted while it was in + * its prolog. + */ + if (gi->nlocs) { + int offset = (mgreg_t)MONO_CONTEXT_GET_IP (ctx) - (mgreg_t)ji->code_start; + int i; + + for (i = 0; i < gi->nlocs; ++i) { + MonoDwarfLocListEntry *entry = &gi->locations [i]; + + if (offset >= entry->from && (offset < entry->to || entry->to == 0)) { + if (entry->is_reg) + info = (gpointer)mono_arch_context_get_int_reg (ctx, entry->reg); + else + info = *(gpointer*)(gpointer)((char*)mono_arch_context_get_int_reg (ctx, entry->reg) + entry->offset); + break; + } + } + g_assert (i < gi->nlocs); + } else { + if (gi->this_in_reg) + info = (gpointer)mono_arch_context_get_int_reg (ctx, gi->this_reg); + else + info = *(gpointer*)(gpointer)((char*)mono_arch_context_get_int_reg (ctx, gi->this_reg) + + gi->this_offset); + } + + method = jinfo_get_method (ji); + if (mono_method_get_context (method)->method_inst) { + /* A MonoMethodRuntimeGenericContext* */ + return info; + } else if ((method->flags & METHOD_ATTRIBUTE_STATIC) || method->klass->valuetype) { + /* A MonoVTable* */ + return info; + } else { + /* Avoid returning a managed object */ + MonoObject *this_obj = (MonoObject *)info; + + return this_obj->vtable; + } +} + +/* + * generic_info is either a MonoMethodRuntimeGenericContext or a MonoVTable. + */ +static MonoGenericContext +get_generic_context_from_stack_frame (MonoJitInfo *ji, gpointer generic_info) +{ + MonoGenericContext context = { NULL, NULL }; + MonoClass *klass, *method_container_class; + MonoMethod *method; + + g_assert (generic_info); + + method = jinfo_get_method (ji); + g_assert (method->is_inflated); + if (mono_method_get_context (method)->method_inst) { + MonoMethodRuntimeGenericContext *mrgctx = (MonoMethodRuntimeGenericContext *)generic_info; + + klass = mrgctx->class_vtable->klass; + context.method_inst = mrgctx->method_inst; + g_assert (context.method_inst); + } else { + MonoVTable *vtable = (MonoVTable *)generic_info; + + klass = vtable->klass; + } + + //g_assert (!mono_class_is_gtd (method->klass)); + if (mono_class_is_ginst (method->klass)) + method_container_class = mono_class_get_generic_class (method->klass)->container_class; + else + method_container_class = method->klass; + + /* class might refer to a subclass of method's class */ + while (!(klass == method->klass || (mono_class_is_ginst (klass) && mono_class_get_generic_class (klass)->container_class == method_container_class))) { + klass = klass->parent; + g_assert (klass); + } + + if (mono_class_is_ginst (klass) || mono_class_is_gtd (klass)) + context.class_inst = mini_class_get_context (klass)->class_inst; + + if (mono_class_is_ginst (klass)) + g_assert (mono_class_has_parent_and_ignore_generics (mono_class_get_generic_class (klass)->container_class, method_container_class)); + else + g_assert (mono_class_has_parent_and_ignore_generics (klass, method_container_class)); + + return context; +} + +static MonoMethod* +get_method_from_stack_frame (MonoJitInfo *ji, gpointer generic_info) +{ + ERROR_DECL (error); + MonoGenericContext context; + MonoMethod *method; + + if (!ji->has_generic_jit_info || !mono_jit_info_get_generic_jit_info (ji)->has_this) + return jinfo_get_method (ji); + context = get_generic_context_from_stack_frame (ji, generic_info); + + method = jinfo_get_method (ji); + method = mono_method_get_declaring_generic_method (method); + method = mono_class_inflate_generic_method_checked (method, &context, error); + g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */ + + return method; +} + +/** + * mono_exception_walk_native_trace: + * \param ex The exception object whose frames should be walked + * \param func callback to call for each stack frame + * \param user_data data passed to the callback + * This function walks the stacktrace of an exception. For + * each frame the callback function is called with the relevant info. + * The walk ends when no more stack frames are found or when the callback + * returns a TRUE value. + */ + +gboolean +mono_exception_walk_trace (MonoException *ex, MonoExceptionFrameWalk func, gpointer user_data) +{ + MONO_REQ_GC_UNSAFE_MODE; + + MonoDomain *domain = mono_domain_get (); + MonoArray *ta = ex->trace_ips; + int len, i; + + if (ta == NULL) + return FALSE; + + len = mono_array_length (ta) / TRACE_IP_ENTRY_SIZE; + for (i = 0; i < len; i++) { + ExceptionTraceIp trace_ip; + + memcpy (&trace_ip, mono_array_addr_fast (ta, ExceptionTraceIp, i), sizeof (ExceptionTraceIp)); + gpointer ip = trace_ip.ip; + gpointer generic_info = trace_ip.generic_info; + MonoJitInfo *ji = mono_jit_info_table_find (domain, (char *)ip); + + if (ji == NULL) { + if (func (NULL, ip, 0, FALSE, user_data)) + return TRUE; + } else { + MonoMethod *method = get_method_from_stack_frame (ji, generic_info); + if (func (method, ji->code_start, (char *) ip - (char *) ji->code_start, TRUE, user_data)) + return TRUE; + } + } + + return len > 0; +} + +MonoArray * +ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info) +{ + ERROR_DECL (error); + MonoDomain *domain = mono_domain_get (); + MonoArray *res; + MonoArray *ta = exc->trace_ips; + MonoDebugSourceLocation *location; + int i, len; + + if (ta == NULL) { + /* Exception is not thrown yet */ + res = mono_array_new_checked (domain, mono_defaults.stack_frame_class, 0, error); + mono_error_set_pending_exception (error); + return res; + } + + len = mono_array_length (ta) / TRACE_IP_ENTRY_SIZE; + + res = mono_array_new_checked (domain, mono_defaults.stack_frame_class, len > skip ? len - skip : 0, error); + if (mono_error_set_pending_exception (error)) + return NULL; + + for (i = skip; i < len; i++) { + MonoJitInfo *ji; + MonoStackFrame *sf = (MonoStackFrame *)mono_object_new_checked (domain, mono_defaults.stack_frame_class, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); + return NULL; + } + ExceptionTraceIp trace_ip; + memcpy (&trace_ip, mono_array_addr_fast (ta, ExceptionTraceIp, i), sizeof (ExceptionTraceIp)); + gpointer ip = trace_ip.ip; + gpointer generic_info = trace_ip.generic_info; + MonoMethod *method; + + if (trace_ip.ji) { + ji = trace_ip.ji; + } else { + ji = mono_jit_info_table_find (domain, (char *)ip); + if (ji == NULL) { + /* Unmanaged frame */ + mono_array_setref (res, i, sf); + continue; + } + } + + g_assert (ji != NULL); + + if (mono_llvm_only || !generic_info) + /* Can't resolve actual method */ + method = jinfo_get_method (ji); + else + method = get_method_from_stack_frame (ji, generic_info); + if (jinfo_get_method (ji)->wrapper_type) { + char *s; + + sf->method = NULL; + s = mono_method_get_name_full (method, TRUE, FALSE, MONO_TYPE_NAME_FORMAT_REFLECTION); + MonoString *name = mono_string_new_checked (domain, s, error); + g_free (s); + if (!is_ok (error)) { + mono_error_set_pending_exception (error); + return NULL; + } + MONO_OBJECT_SETREF (sf, internal_method_name, name); + } + else { + MonoReflectionMethod *rm = mono_method_get_object_checked (domain, method, NULL, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); + return NULL; + } + MONO_OBJECT_SETREF (sf, method, rm); + } + + sf->method_index = ji->from_aot ? mono_aot_find_method_index (method) : 0xffffff; + sf->method_address = (gsize) ji->code_start; + sf->native_offset = (char *)ip - (char *)ji->code_start; + + /* + * mono_debug_lookup_source_location() returns both the file / line number information + * and the IL offset. Note that computing the IL offset is already an expensive + * operation, so we shouldn't call this method twice. + */ + location = mono_debug_lookup_source_location (jinfo_get_method (ji), sf->native_offset, domain); + if (location) { + sf->il_offset = location->il_offset; + } else { + SeqPoint sp; + if (mono_find_prev_seq_point_for_native_offset (domain, jinfo_get_method (ji), sf->native_offset, NULL, &sp)) + sf->il_offset = sp.il_offset; + else + sf->il_offset = -1; + } + + if (need_file_info) { + if (location && location->source_file) { + MonoString *filename = mono_string_new_checked (domain, location->source_file, error); + if (!is_ok (error)) { + mono_error_set_pending_exception (error); + return NULL; + } + MONO_OBJECT_SETREF (sf, filename, filename); + sf->line = location->row; + sf->column = location->column; + } else { + sf->line = sf->column = 0; + sf->filename = NULL; + } + } + + mono_debug_free_source_location (location); + mono_array_setref (res, i, sf); + } + + return res; +} + +static void +mono_runtime_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data) +{ + if (!start_ctx) { + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + if (jit_tls && jit_tls->orig_ex_ctx_set) + start_ctx = &jit_tls->orig_ex_ctx; + } + mono_walk_stack_with_ctx (func, start_ctx, unwind_options, user_data); +} +/** + * mono_walk_stack_with_ctx: + * Unwind the current thread starting at \p start_ctx. + * If \p start_ctx is null, we capture the current context. + */ +void +mono_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data) +{ + MonoContext extra_ctx; + MonoThreadInfo *thread = mono_thread_info_current_unchecked (); + MONO_ARCH_CONTEXT_DEF + + if (!thread || !thread->jit_data) + return; + + if (!start_ctx) { + mono_arch_flush_register_windows (); + +#ifdef MONO_INIT_CONTEXT_FROM_CURRENT + MONO_INIT_CONTEXT_FROM_CURRENT (&extra_ctx); +#else + MONO_INIT_CONTEXT_FROM_FUNC (&extra_ctx, mono_walk_stack_with_ctx); +#endif + start_ctx = &extra_ctx; + } + + mono_walk_stack_full (func, start_ctx, mono_domain_get (), (MonoJitTlsData *)thread->jit_data, mono_get_lmf (), unwind_options, user_data); +} + +/** + * mono_walk_stack_with_state: + * Unwind a thread described by \p state. + * + * State must be valid (state->valid == TRUE). + * + * If you are using this function to unwind another thread, make sure it is suspended. + * + * If \p state is null, we capture the current context. + */ +void +mono_walk_stack_with_state (MonoJitStackWalk func, MonoThreadUnwindState *state, MonoUnwindOptions unwind_options, void *user_data) +{ + MonoThreadUnwindState extra_state; + if (!state) { + g_assert (!mono_thread_info_is_async_context ()); + if (!mono_thread_state_init_from_current (&extra_state)) + return; + state = &extra_state; + } + + g_assert (state->valid); + + if (!state->unwind_data [MONO_UNWIND_DATA_DOMAIN]) + /* Not attached */ + return; + + mono_walk_stack_full (func, + &state->ctx, + (MonoDomain *)state->unwind_data [MONO_UNWIND_DATA_DOMAIN], + (MonoJitTlsData *)state->unwind_data [MONO_UNWIND_DATA_JIT_TLS], + (MonoLMF *)state->unwind_data [MONO_UNWIND_DATA_LMF], + unwind_options, user_data); +} + +void +mono_walk_stack (MonoJitStackWalk func, MonoUnwindOptions options, void *user_data) +{ + MonoThreadUnwindState state; + if (!mono_thread_state_init_from_current (&state)) + return; + mono_walk_stack_with_state (func, &state, options, user_data); +} + +/** + * mono_walk_stack_full: + * \param func callback to call for each stack frame + * \param domain starting appdomain, can be NULL to use the current domain + * \param unwind_options what extra information the unwinder should gather + * \param start_ctx starting state of the stack walk, can be NULL. + * \param thread the thread whose stack to walk, can be NULL to use the current thread + * \param lmf the LMF of \p thread, can be NULL to use the LMF of the current thread + * \param user_data data passed to the callback + * This function walks the stack of a thread, starting from the state + * represented by \p start_ctx. For each frame the callback + * function is called with the relevant info. The walk ends when no more + * managed stack frames are found or when the callback returns a TRUE value. + */ +static void +mono_walk_stack_full (MonoJitStackWalk func, MonoContext *start_ctx, MonoDomain *domain, MonoJitTlsData *jit_tls, MonoLMF *lmf, MonoUnwindOptions unwind_options, gpointer user_data) +{ + gint il_offset, i; + MonoContext ctx, new_ctx; + StackFrameInfo frame; + gboolean res; + mgreg_t *reg_locations [MONO_MAX_IREGS]; + mgreg_t *new_reg_locations [MONO_MAX_IREGS]; + gboolean get_reg_locations = unwind_options & MONO_UNWIND_REG_LOCATIONS; + gboolean async = mono_thread_info_is_async_context (); + Unwinder unwinder; + + if (mono_llvm_only) { + GSList *l, *ips; + + if (async) + return; + + ips = get_unwind_backtrace (); + for (l = ips; l; l = l->next) { + guint8 *ip = (guint8*)l->data; + memset (&frame, 0, sizeof (StackFrameInfo)); + frame.ji = mini_jit_info_table_find (domain, (char*)ip, &frame.domain); + if (!frame.ji || frame.ji->is_trampoline) + continue; + frame.type = FRAME_TYPE_MANAGED; + frame.method = jinfo_get_method (frame.ji); + // FIXME: Cannot lookup the actual method + frame.actual_method = frame.method; + if (frame.type == FRAME_TYPE_MANAGED) { + if (!frame.method->wrapper_type || frame.method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) + frame.managed = TRUE; + } + frame.native_offset = ip - (guint8*)frame.ji->code_start; + frame.il_offset = -1; + + if (func (&frame, NULL, user_data)) + break; + } + g_free (ips); + return; + } + + g_assert (start_ctx); + g_assert (domain); + g_assert (jit_tls); + /*The LMF will be null if the target have no managed frames.*/ + /* g_assert (lmf); */ + + if (async) + g_assert (unwind_options == MONO_UNWIND_NONE); + + memcpy (&ctx, start_ctx, sizeof (MonoContext)); + memset (reg_locations, 0, sizeof (reg_locations)); + + unwinder_init (&unwinder); + + while (MONO_CONTEXT_GET_SP (&ctx) < jit_tls->end_of_stack) { + frame.lmf = lmf; + res = unwinder_unwind_frame (&unwinder, domain, jit_tls, NULL, &ctx, &new_ctx, NULL, &lmf, get_reg_locations ? new_reg_locations : NULL, &frame); + if (!res) + return; + + if ((unwind_options & MONO_UNWIND_LOOKUP_IL_OFFSET) && frame.ji && !frame.ji->is_trampoline) { + MonoDebugSourceLocation *source; + + source = mono_debug_lookup_source_location (jinfo_get_method (frame.ji), frame.native_offset, domain); + if (source) { + il_offset = source->il_offset; + } else { + SeqPoint sp; + if (mono_find_prev_seq_point_for_native_offset (domain, jinfo_get_method (frame.ji), frame.native_offset, NULL, &sp)) + il_offset = sp.il_offset; + else + il_offset = -1; + } + mono_debug_free_source_location (source); + } else + il_offset = -1; + + frame.il_offset = il_offset; + + if ((unwind_options & MONO_UNWIND_LOOKUP_ACTUAL_METHOD) && frame.ji && !frame.ji->is_trampoline) { + frame.actual_method = get_method_from_stack_frame (frame.ji, get_generic_info_from_stack_frame (frame.ji, &ctx)); + } else { + frame.actual_method = frame.method; + } + + if (get_reg_locations) + frame.reg_locations = reg_locations; + + if (func (&frame, &ctx, user_data)) + return; + + if (get_reg_locations) { + for (i = 0; i < MONO_MAX_IREGS; ++i) + if (new_reg_locations [i]) + reg_locations [i] = new_reg_locations [i]; + } + + ctx = new_ctx; + } +} + +MonoBoolean +ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info, + MonoReflectionMethod **method, + gint32 *iloffset, gint32 *native_offset, + MonoString **file, gint32 *line, gint32 *column) +{ + ERROR_DECL (error); + MonoDomain *domain = mono_domain_get (); + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + MonoLMF *lmf = mono_get_lmf (); + MonoJitInfo *ji = NULL; + MonoContext ctx, new_ctx; + MonoDebugSourceLocation *location; + MonoMethod *jmethod = NULL, *actual_method; + StackFrameInfo frame; + gboolean res; + Unwinder unwinder; + int il_offset = -1; + + MONO_ARCH_CONTEXT_DEF; + + if (mono_llvm_only) { + GSList *l, *ips; + MonoDomain *frame_domain; + guint8 *frame_ip = NULL; + + /* FIXME: Generalize this code with an interface which returns an array of StackFrame structures */ + jmethod = NULL; + ips = get_unwind_backtrace (); + for (l = ips; l && skip >= 0; l = l->next) { + guint8 *ip = (guint8*)l->data; + + frame_ip = ip; + + ji = mini_jit_info_table_find (mono_domain_get (), (char*)ip, &frame_domain); + if (!ji || ji->is_trampoline) + continue; + + /* The skip count passed by the caller depends on us not filtering out MANAGED_TO_NATIVE */ + jmethod = jinfo_get_method (ji); + if (jmethod->wrapper_type != MONO_WRAPPER_NONE && jmethod->wrapper_type != MONO_WRAPPER_DYNAMIC_METHOD && jmethod->wrapper_type != MONO_WRAPPER_MANAGED_TO_NATIVE) + continue; + skip--; + } + g_slist_free (ips); + if (!jmethod || !l) + return FALSE; + /* No way to resolve generic instances */ + actual_method = jmethod; + *native_offset = frame_ip - (guint8*)ji->code_start; + } else { + mono_arch_flush_register_windows (); + +#ifdef MONO_INIT_CONTEXT_FROM_CURRENT + MONO_INIT_CONTEXT_FROM_CURRENT (&ctx); +#else + MONO_INIT_CONTEXT_FROM_FUNC (&ctx, ves_icall_get_frame_info); +#endif + + unwinder_init (&unwinder); + + new_ctx = ctx; + do { + ctx = new_ctx; + res = unwinder_unwind_frame (&unwinder, domain, jit_tls, NULL, &ctx, &new_ctx, NULL, &lmf, NULL, &frame); + if (!res) + return FALSE; + switch (frame.type) { + case FRAME_TYPE_MANAGED_TO_NATIVE: + case FRAME_TYPE_DEBUGGER_INVOKE: + case FRAME_TYPE_TRAMPOLINE: + case FRAME_TYPE_INTERP_TO_MANAGED: + continue; + case FRAME_TYPE_INTERP: + skip--; + break; + default: + ji = frame.ji; + *native_offset = frame.native_offset; + + /* The skip count passed by the caller depends on us not filtering out MANAGED_TO_NATIVE */ + jmethod = jinfo_get_method (ji); + if (jmethod->wrapper_type != MONO_WRAPPER_NONE && jmethod->wrapper_type != MONO_WRAPPER_DYNAMIC_METHOD && jmethod->wrapper_type != MONO_WRAPPER_MANAGED_TO_NATIVE) + continue; + skip--; + break; + } + } while (skip >= 0); + + if (frame.type == FRAME_TYPE_INTERP) { + jmethod = frame.method; + actual_method = frame.actual_method; + *native_offset = frame.native_offset; + } else { + actual_method = get_method_from_stack_frame (ji, get_generic_info_from_stack_frame (ji, &ctx)); + } + } + + MonoReflectionMethod *rm = mono_method_get_object_checked (domain, actual_method, NULL, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); + return FALSE; + } + mono_gc_wbarrier_generic_store (method, (MonoObject*) rm); + + if (il_offset != -1) { + location = mono_debug_lookup_source_location_by_il (jmethod, il_offset, domain); + } else { + location = mono_debug_lookup_source_location (jmethod, *native_offset, domain); + } + if (location) + *iloffset = location->il_offset; + else + *iloffset = 0; + + if (need_file_info) { + if (location) { + MonoString *filename = mono_string_new_checked (domain, location->source_file, error); + if (!is_ok (error)) { + mono_error_set_pending_exception (error); + return FALSE; + } + mono_gc_wbarrier_generic_store (file, (MonoObject*)filename); + *line = location->row; + *column = location->column; + } else { + *file = NULL; + *line = *column = 0; + } + } + + mono_debug_free_source_location (location); + + return TRUE; +} + +static MonoClass* +get_exception_catch_class (MonoJitExceptionInfo *ei, MonoJitInfo *ji, MonoContext *ctx) +{ + ERROR_DECL (error); + MonoClass *catch_class = ei->data.catch_class; + MonoType *inflated_type; + MonoGenericContext context; + + /*MonoJitExceptionInfo::data is an union used by filter and finally clauses too.*/ + if (!catch_class || ei->flags != MONO_EXCEPTION_CLAUSE_NONE) + return NULL; + + if (!ji->has_generic_jit_info || !mono_jit_info_get_generic_jit_info (ji)->has_this) + return catch_class; + context = get_generic_context_from_stack_frame (ji, get_generic_info_from_stack_frame (ji, ctx)); + + /* FIXME: we shouldn't inflate but instead put the + type in the rgctx and fetch it from there. It + might be a good idea to do this lazily, i.e. only + when the exception is actually thrown, so as not to + waste space for exception clauses which might never + be encountered. */ + inflated_type = mono_class_inflate_generic_type_checked (&catch_class->byval_arg, &context, error); + mono_error_assert_ok (error); /* FIXME don't swallow the error */ + + catch_class = mono_class_from_mono_type (inflated_type); + mono_metadata_free_type (inflated_type); + + return catch_class; +} + +/* + * mini_jit_info_table_find_ext: + * + * Same as mono_jit_info_table_find, but search all the domains of the current thread + * if ADDR is not found in DOMAIN. The domain where the method was found is stored into + * OUT_DOMAIN if it is not NULL. + */ +MonoJitInfo* +mini_jit_info_table_find_ext (MonoDomain *domain, char *addr, gboolean allow_trampolines, MonoDomain **out_domain) +{ + MonoJitInfo *ji; + MonoInternalThread *t = mono_thread_internal_current (); + gpointer *refs; + + if (out_domain) + *out_domain = NULL; + + ji = mono_jit_info_table_find_internal (domain, addr, TRUE, allow_trampolines); + if (ji) { + if (out_domain) + *out_domain = domain; + return ji; + } + + /* maybe it is shared code, so we also search in the root domain */ + if (domain != mono_get_root_domain ()) { + ji = mono_jit_info_table_find_internal (mono_get_root_domain (), addr, TRUE, allow_trampolines); + if (ji) { + if (out_domain) + *out_domain = mono_get_root_domain (); + return ji; + } + } + + if (!t) + return NULL; + + refs = (gpointer *)((t->appdomain_refs) ? *(gpointer *) t->appdomain_refs : NULL); + for (; refs && *refs; refs++) { + if (*refs != domain && *refs != mono_get_root_domain ()) { + ji = mono_jit_info_table_find_internal ((MonoDomain*) *refs, addr, TRUE, allow_trampolines); + if (ji) { + if (out_domain) + *out_domain = (MonoDomain*) *refs; + return ji; + } + } + } + + return NULL; +} + +MonoJitInfo* +mini_jit_info_table_find (MonoDomain *domain, char *addr, MonoDomain **out_domain) +{ + return mini_jit_info_table_find_ext (domain, addr, FALSE, out_domain); +} + +/* Class lazy loading functions */ +static GENERATE_GET_CLASS_WITH_CACHE (runtime_compat_attr, "System.Runtime.CompilerServices", "RuntimeCompatibilityAttribute") + +/* + * wrap_non_exception_throws: + * + * Determine whenever M's assembly has a RuntimeCompatibilityAttribute with the + * WrapNonExceptionThrows flag set. + */ +static gboolean +wrap_non_exception_throws (MonoMethod *m) +{ + ERROR_DECL (error); + MonoAssembly *ass = m->klass->image->assembly; + MonoCustomAttrInfo* attrs; + MonoClass *klass; + int i; + gboolean val = FALSE; + + if (m->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) { + MonoDynamicMethod *dm = (MonoDynamicMethod *)m; + if (dm->assembly) + ass = dm->assembly; + } + g_assert (ass); + if (ass->wrap_non_exception_throws_inited) + return ass->wrap_non_exception_throws; + + klass = mono_class_get_runtime_compat_attr_class (); + + attrs = mono_custom_attrs_from_assembly_checked (ass, FALSE, error); + mono_error_cleanup (error); /* FIXME don't swallow the error */ + if (attrs) { + for (i = 0; i < attrs->num_attrs; ++i) { + MonoCustomAttrEntry *attr = &attrs->attrs [i]; + const gchar *p; + int num_named, named_type, name_len; + char *name; + + if (!attr->ctor || attr->ctor->klass != klass) + continue; + /* Decode the RuntimeCompatibilityAttribute. See reflection.c */ + p = (const char*)attr->data; + g_assert (read16 (p) == 0x0001); + p += 2; + num_named = read16 (p); + if (num_named != 1) + continue; + p += 2; + named_type = *p; + p ++; + /* data_type = *p; */ + p ++; + /* Property */ + if (named_type != 0x54) + continue; + name_len = mono_metadata_decode_blob_size (p, &p); + name = (char *)g_malloc (name_len + 1); + memcpy (name, p, name_len); + name [name_len] = 0; + p += name_len; + g_assert (!strcmp (name, "WrapNonExceptionThrows")); + g_free (name); + /* The value is a BOOLEAN */ + val = *p; + } + mono_custom_attrs_free (attrs); + } + + ass->wrap_non_exception_throws = val; + mono_memory_barrier (); + ass->wrap_non_exception_throws_inited = TRUE; + + return val; +} + +#define MAX_UNMANAGED_BACKTRACE 128 +static MonoArray* +build_native_trace (MonoError *error) +{ + error_init (error); +/* This puppy only makes sense on mobile, IOW, ARM. */ +#if defined (HAVE_BACKTRACE_SYMBOLS) && defined (TARGET_ARM) + MonoArray *res; + void *native_trace [MAX_UNMANAGED_BACKTRACE]; + int size = -1; + MONO_ENTER_GC_SAFE; + size = backtrace (native_trace, MAX_UNMANAGED_BACKTRACE); + MONO_EXIT_GC_SAFE; + int i; + + if (!size) + return NULL; + res = mono_array_new_checked (mono_domain_get (), mono_defaults.int_class, size, error); + return_val_if_nok (error, NULL); + + for (i = 0; i < size; i++) + mono_array_set (res, gpointer, i, native_trace [i]); + return res; +#else + return NULL; +#endif +} + +static void +setup_stack_trace (MonoException *mono_ex, GSList *dynamic_methods, GList **trace_ips) +{ + if (mono_ex) { + *trace_ips = g_list_reverse (*trace_ips); + ERROR_DECL (error); + MonoArray *ips_arr = mono_glist_to_array (*trace_ips, mono_defaults.int_class, error); + mono_error_assert_ok (error); + MONO_OBJECT_SETREF (mono_ex, trace_ips, ips_arr); + MONO_OBJECT_SETREF (mono_ex, native_trace_ips, build_native_trace (error)); + mono_error_assert_ok (error); + if (dynamic_methods) { + /* These methods could go away anytime, so save a reference to them in the exception object */ + GSList *l; + MonoMList *list = NULL; + + for (l = dynamic_methods; l; l = l->next) { + guint32 dis_link; + MonoDomain *domain = mono_domain_get (); + + if (domain->method_to_dyn_method) { + mono_domain_lock (domain); + dis_link = (guint32)(size_t)g_hash_table_lookup (domain->method_to_dyn_method, l->data); + mono_domain_unlock (domain); + if (dis_link) { + MonoObject *o = mono_gchandle_get_target (dis_link); + if (o) { + list = mono_mlist_prepend_checked (list, o, error); + mono_error_assert_ok (error); + } + } + } + } + + MONO_OBJECT_SETREF (mono_ex, dynamic_methods, list); + } + } + g_list_free (*trace_ips); + *trace_ips = NULL; +} + +/* + * handle_exception_first_pass: + * + * The first pass of exception handling. Unwind the stack until a catch clause which can catch + * OBJ is found. Store the index of the filter clause which caught the exception into + * OUT_FILTER_IDX. Return TRUE if the exception is caught, FALSE otherwise. + */ +static gboolean +handle_exception_first_pass (MonoContext *ctx, MonoObject *obj, gint32 *out_filter_idx, MonoJitInfo **out_ji, MonoJitInfo **out_prev_ji, MonoObject *non_exception, StackFrameInfo *catch_frame) +{ + ERROR_DECL (error); + MonoDomain *domain = mono_domain_get (); + MonoJitInfo *ji = NULL; + static int (*call_filter) (MonoContext *, gpointer) = NULL; + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + MonoLMF *lmf = mono_get_lmf (); + GList *trace_ips = NULL; + GSList *dynamic_methods = NULL; + MonoException *mono_ex; + gboolean stack_overflow = FALSE; + MonoContext initial_ctx; + MonoMethod *method; + int frame_count = 0; + gint32 filter_idx; + int i; + MonoObject *ex_obj; + Unwinder unwinder; + gboolean in_interp; + + g_assert (ctx != NULL); + + if (obj == (MonoObject *)domain->stack_overflow_ex) + stack_overflow = TRUE; + + mono_ex = (MonoException*)obj; + MonoArray *initial_trace_ips = mono_ex->trace_ips; + if (initial_trace_ips) { + int len = mono_array_length (initial_trace_ips) / TRACE_IP_ENTRY_SIZE; + + for (i = 0; i < (len - 1); i++) { + for (int j = 0; j < TRACE_IP_ENTRY_SIZE; ++j) { + gpointer p = mono_array_get (initial_trace_ips, gpointer, (i * TRACE_IP_ENTRY_SIZE) + j); + trace_ips = g_list_prepend (trace_ips, p); + } + } + } + + if (!mono_object_isinst_checked (obj, mono_defaults.exception_class, error)) { + mono_error_assert_ok (error); + mono_ex = NULL; + } + + if (!call_filter) + call_filter = (int (*) (MonoContext *, void *))mono_get_call_filter (); + + g_assert (jit_tls->end_of_stack); + g_assert (jit_tls->abort_func); + + if (out_filter_idx) + *out_filter_idx = -1; + if (out_ji) + *out_ji = NULL; + if (out_prev_ji) + *out_prev_ji = NULL; + filter_idx = 0; + initial_ctx = *ctx; + + unwinder_init (&unwinder); + + while (1) { + MonoContext new_ctx; + guint32 free_stack; + int clause_index_start = 0; + gboolean unwind_res = TRUE; + + StackFrameInfo frame; + + if (out_prev_ji) + *out_prev_ji = ji; + + unwind_res = unwinder_unwind_frame (&unwinder, domain, jit_tls, NULL, ctx, &new_ctx, NULL, &lmf, NULL, &frame); + if (!unwind_res) { + setup_stack_trace (mono_ex, dynamic_methods, &trace_ips); + g_slist_free (dynamic_methods); + return FALSE; + } + + switch (frame.type) { + case FRAME_TYPE_DEBUGGER_INVOKE: + case FRAME_TYPE_MANAGED_TO_NATIVE: + case FRAME_TYPE_TRAMPOLINE: + case FRAME_TYPE_INTERP_TO_MANAGED: + *ctx = new_ctx; + continue; + case FRAME_TYPE_INTERP: + case FRAME_TYPE_MANAGED: + break; + default: + g_assert_not_reached (); + break; + } + + in_interp = frame.type == FRAME_TYPE_INTERP; + ji = frame.ji; + + gpointer ip; + if (in_interp) + ip = (guint8*)ji->code_start + frame.native_offset; + else + ip = MONO_CONTEXT_GET_IP (ctx); + + frame_count ++; + method = jinfo_get_method (ji); + //printf ("M: %s %d.\n", mono_method_full_name (method, TRUE), frame_count); + + if (mini_get_debug_options ()->reverse_pinvoke_exceptions && method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED) { + g_error ("A native frame was found while unwinding the stack after an exception.\n" + "The native frame called the managed method:\n%s\n", + mono_method_full_name (method, TRUE)); + } + + if (method->wrapper_type != MONO_WRAPPER_RUNTIME_INVOKE && mono_ex) { + // avoid giant stack traces during a stack overflow + if (frame_count < 1000) { + trace_ips = g_list_prepend (trace_ips, ip); + trace_ips = g_list_prepend (trace_ips, get_generic_info_from_stack_frame (ji, ctx)); + trace_ips = g_list_prepend (trace_ips, ji); + } + } + + if (method->dynamic) + dynamic_methods = g_slist_prepend (dynamic_methods, method); + + if (stack_overflow) { + free_stack = (guint8*)(MONO_CONTEXT_GET_SP (ctx)) - (guint8*)(MONO_CONTEXT_GET_SP (&initial_ctx)); + } else { + free_stack = 0xffffff; + } + + for (i = clause_index_start; i < ji->num_clauses; i++) { + MonoJitExceptionInfo *ei = &ji->clauses [i]; + gboolean filtered = FALSE; + + /* + * During stack overflow, wait till the unwinding frees some stack + * space before running handlers/finalizers. + */ + if (free_stack <= (64 * 1024)) + continue; + + if (is_address_protected (ji, ei, ip)) { + /* catch block */ + MonoClass *catch_class = get_exception_catch_class (ei, ji, ctx); + + /* + * Have to unwrap RuntimeWrappedExceptions if the + * method's assembly doesn't have a RuntimeCompatibilityAttribute. + */ + if (non_exception && !wrap_non_exception_throws (method)) + ex_obj = non_exception; + else + ex_obj = obj; + + if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) { +#ifndef DISABLE_PERFCOUNTERS + mono_atomic_inc_i32 (&mono_perfcounters->exceptions_filters); +#endif + + if (!ji->is_interp) { +#ifndef MONO_CROSS_COMPILE +#ifdef MONO_CONTEXT_SET_LLVM_EXC_REG + if (ji->from_llvm) + MONO_CONTEXT_SET_LLVM_EXC_REG (ctx, ex_obj); + else + /* Can't pass the ex object in a register yet to filter clauses, because call_filter () might not support it */ + *((gpointer *)(gpointer)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = ex_obj; +#else + g_assert (!ji->from_llvm); + /* store the exception object in bp + ei->exvar_offset */ + *((gpointer *)(gpointer)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = ex_obj; +#endif +#endif + +#ifdef MONO_CONTEXT_SET_LLVM_EH_SELECTOR_REG + /* + * Pass the original il clause index to the landing pad so it can + * branch to the landing pad associated with the il clause. + * This is needed because llvm compiled code assumes that the EH + * code always branches to the innermost landing pad. + */ + if (ji->from_llvm) + MONO_CONTEXT_SET_LLVM_EH_SELECTOR_REG (ctx, ei->clause_index); +#endif + } + + mono_debugger_agent_begin_exception_filter (mono_ex, ctx, &initial_ctx); + if (ji->is_interp) { + filtered = mini_get_interp_callbacks ()->run_filter (&frame, (MonoException*)ex_obj, i, ei->data.filter); + } else { + filtered = call_filter (ctx, ei->data.filter); + } + mono_debugger_agent_end_exception_filter (mono_ex, ctx, &initial_ctx); + if (filtered && out_filter_idx) + *out_filter_idx = filter_idx; + if (out_ji) + *out_ji = ji; + filter_idx ++; + + if (filtered) { + setup_stack_trace (mono_ex, dynamic_methods, &trace_ips); + g_slist_free (dynamic_methods); + /* mono_debugger_agent_handle_exception () needs this */ + mini_set_abort_threshold (ctx); + MONO_CONTEXT_SET_IP (ctx, ei->handler_start); + frame.native_offset = (char*)ei->handler_start - (char*)ji->code_start; + *catch_frame = frame; + return TRUE; + } + } + + ERROR_DECL_VALUE (isinst_error); + error_init (&isinst_error); + if (ei->flags == MONO_EXCEPTION_CLAUSE_NONE && mono_object_isinst_checked (ex_obj, catch_class, error)) { + setup_stack_trace (mono_ex, dynamic_methods, &trace_ips); + g_slist_free (dynamic_methods); + + if (out_ji) + *out_ji = ji; + + /* mono_debugger_agent_handle_exception () needs this */ + if (!in_interp) + MONO_CONTEXT_SET_IP (ctx, ei->handler_start); + frame.native_offset = (char*)ei->handler_start - (char*)ji->code_start; + *catch_frame = frame; + return TRUE; + } + mono_error_cleanup (&isinst_error); + } + } + + *ctx = new_ctx; + } + + g_assert_not_reached (); +} + +/** + * mono_handle_exception_internal: + * \param ctx saved processor state + * \param obj the exception object + * \param resume whenever to resume unwinding based on the state in \c MonoJitTlsData. + */ +static gboolean +mono_handle_exception_internal (MonoContext *ctx, MonoObject *obj, gboolean resume, MonoJitInfo **out_ji) +{ + ERROR_DECL (error); + MonoDomain *domain = mono_domain_get (); + MonoJitInfo *ji, *prev_ji; + static int (*call_filter) (MonoContext *, gpointer) = NULL; + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + MonoLMF *lmf = mono_get_lmf (); + MonoException *mono_ex; + gboolean stack_overflow = FALSE; + MonoContext initial_ctx; + MonoMethod *method; + int frame_count = 0; + gint32 filter_idx, first_filter_idx = 0; + int i; + MonoObject *ex_obj; + MonoObject *non_exception = NULL; + Unwinder unwinder; + gboolean in_interp; + + g_assert (ctx != NULL); + if (!obj) { + MonoException *ex = mono_get_exception_null_reference (); + MonoString *msg = mono_string_new_checked (domain, "Object reference not set to an instance of an object", error); + mono_error_assert_ok (error); + MONO_OBJECT_SETREF (ex, message, msg); + obj = (MonoObject *)ex; + } + + /* + * Allocate a new exception object instead of the preconstructed ones. + */ + if (obj == (MonoObject *)domain->stack_overflow_ex) { + /* + * It is not a good idea to try and put even more pressure on the little stack available. + * obj = mono_get_exception_stack_overflow (); + */ + stack_overflow = TRUE; + } + else if (obj == (MonoObject *)domain->null_reference_ex) { + obj = (MonoObject *)mono_get_exception_null_reference (); + } + + if (!mono_object_isinst_checked (obj, mono_defaults.exception_class, error)) { + mono_error_assert_ok (error); + non_exception = obj; + obj = (MonoObject *)mono_get_exception_runtime_wrapped_checked (obj, error); + mono_error_assert_ok (error); + } + + mono_ex = (MonoException*)obj; + + if (mini_get_debug_options ()->suspend_on_exception) { + mono_runtime_printf_err ("Exception thrown, suspending..."); + while (1) + ; + } + + if (mono_object_isinst_checked (obj, mono_defaults.exception_class, error)) { + mono_ex = (MonoException*)obj; + } else { + mono_error_assert_ok (error); + mono_ex = NULL; + } + + if (mono_ex && jit_tls->class_cast_from) { + if (!strcmp (mono_ex->object.vtable->klass->name, "InvalidCastException")) { + char *from_name = mono_type_get_full_name (jit_tls->class_cast_from); + char *to_name = mono_type_get_full_name (jit_tls->class_cast_to); + char *msg = g_strdup_printf ("Unable to cast object of type '%s' to type '%s'.", from_name, to_name); + mono_ex->message = mono_string_new_checked (domain, msg, error); + g_free (from_name); + g_free (to_name); + if (!is_ok (error)) { + mono_runtime_printf_err ("Error creating class cast exception message '%s'\n", msg); + mono_error_assert_ok (error); + } + g_free (msg); + } + if (!strcmp (mono_ex->object.vtable->klass->name, "ArrayTypeMismatchException")) { + char *from_name = mono_type_get_full_name (jit_tls->class_cast_from); + char *to_name = mono_type_get_full_name (jit_tls->class_cast_to); + char *msg = g_strdup_printf ("Source array of type '%s' cannot be cast to destination array type '%s'.", from_name, to_name); + mono_ex->message = mono_string_new_checked (domain, msg, error); + g_free (from_name); + g_free (to_name); + if (!is_ok (error)) { + mono_runtime_printf_err ("Error creating array type mismatch exception message '%s'\n", msg); + mono_error_assert_ok (error); + } + g_free (msg); + } + } + + if (!call_filter) + call_filter = (int (*)(MonoContext *, void*))mono_get_call_filter (); + + g_assert (jit_tls->end_of_stack); + g_assert (jit_tls->abort_func); + + /* + * We set orig_ex_ctx_set to TRUE/FALSE around profiler calls to make sure it doesn't + * end up being TRUE on any code path. + */ + memcpy (&jit_tls->orig_ex_ctx, ctx, sizeof (MonoContext)); + + if (!resume) { + gboolean res; + + MonoContext ctx_cp = *ctx; + if (mono_trace_is_enabled ()) { + MonoMethod *system_exception_get_message = mono_class_get_method_from_name (mono_defaults.exception_class, "get_Message", 0); + MonoMethod *get_message = system_exception_get_message == NULL ? NULL : mono_object_get_virtual_method (obj, system_exception_get_message); + MonoObject *message; + const char *type_name = mono_class_get_name (mono_object_class (mono_ex)); + char *msg = NULL; + if (get_message == NULL) { + message = NULL; + } else if (!strcmp (type_name, "OutOfMemoryException") || !strcmp (type_name, "StackOverflowException")) { + message = NULL; + msg = g_strdup_printf ("(No exception message for: %s)\n", type_name); + } else { + MonoObject *exc = NULL; + message = mono_runtime_try_invoke (get_message, obj, NULL, &exc, error); + g_assert (exc == NULL); + mono_error_assert_ok (error); + } + if (msg == NULL) { + if (message) { + msg = mono_string_to_utf8_checked ((MonoString *) message, error); + if (!is_ok (error)) { + mono_error_cleanup (error); + msg = g_strdup ("(error while display System.Exception.Message property)"); + } + } else { + msg = g_strdup ("(System.Exception.Message property not available)"); + } + } + g_print ("[%p:] EXCEPTION handling: %s.%s: %s\n", (void*)mono_native_thread_id_get (), mono_object_class (obj)->name_space, mono_object_class (obj)->name, msg); + g_free (msg); + if (mono_ex && mono_trace_eval_exception (mono_object_class (mono_ex))) + mono_print_thread_dump_from_ctx (ctx); + } + jit_tls->orig_ex_ctx_set = TRUE; + MONO_PROFILER_RAISE (exception_throw, (obj)); + jit_tls->orig_ex_ctx_set = FALSE; + + StackFrameInfo catch_frame; + res = handle_exception_first_pass (&ctx_cp, obj, &first_filter_idx, &ji, &prev_ji, non_exception, &catch_frame); + + if (!res) { + if (mini_get_debug_options ()->break_on_exc) + G_BREAKPOINT (); + mono_debugger_agent_handle_exception ((MonoException *)obj, ctx, NULL, NULL); + + if (mini_get_debug_options ()->suspend_on_unhandled) { + mono_runtime_printf_err ("Unhandled exception, suspending..."); + while (1) + ; + } + + // FIXME: This runs managed code so it might cause another stack overflow when + // we are handling a stack overflow + mini_set_abort_threshold (ctx); + mono_unhandled_exception (obj); + } else { + gboolean unhandled = FALSE; + + /* + * The exceptions caught by the mono_runtime_invoke_checked () calls + * in the threadpool needs to be treated as unhandled (#669836). + * + * FIXME: The check below is hackish, but its hard to distinguish + * these runtime invoke calls from others in the runtime. + */ + if (ji && jinfo_get_method (ji)->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE) { + if (prev_ji && jinfo_get_method (prev_ji) == mono_defaults.threadpool_perform_wait_callback_method) + unhandled = TRUE; + } + + if (unhandled) + mono_debugger_agent_handle_exception ((MonoException *)obj, ctx, NULL, NULL); + else + mono_debugger_agent_handle_exception ((MonoException *)obj, ctx, &ctx_cp, &catch_frame); + } + } + + if (out_ji) + *out_ji = NULL; + filter_idx = 0; + initial_ctx = *ctx; + + unwinder_init (&unwinder); + + while (1) { + MonoContext new_ctx; + guint32 free_stack; + int clause_index_start = 0; + gboolean unwind_res = TRUE; + StackFrameInfo frame; + gpointer ip; + + if (resume) { + resume = FALSE; + ji = jit_tls->resume_state.ji; + new_ctx = jit_tls->resume_state.new_ctx; + clause_index_start = jit_tls->resume_state.clause_index; + lmf = jit_tls->resume_state.lmf; + first_filter_idx = jit_tls->resume_state.first_filter_idx; + filter_idx = jit_tls->resume_state.filter_idx; + in_interp = FALSE; + } else { + unwind_res = unwinder_unwind_frame (&unwinder, domain, jit_tls, NULL, ctx, &new_ctx, NULL, &lmf, NULL, &frame); + if (!unwind_res) { + *(mono_get_lmf_addr ()) = lmf; + + jit_tls->abort_func (obj); + g_assert_not_reached (); + } + switch (frame.type) { + case FRAME_TYPE_DEBUGGER_INVOKE: + case FRAME_TYPE_MANAGED_TO_NATIVE: + case FRAME_TYPE_TRAMPOLINE: + *ctx = new_ctx; + continue; + case FRAME_TYPE_INTERP_TO_MANAGED: + continue; + case FRAME_TYPE_INTERP: + case FRAME_TYPE_MANAGED: + break; + default: + g_assert_not_reached (); + break; + } + in_interp = frame.type == FRAME_TYPE_INTERP; + ji = frame.ji; + } + + if (in_interp) + ip = (guint8*)ji->code_start + frame.native_offset; + else + ip = MONO_CONTEXT_GET_IP (ctx); + + method = jinfo_get_method (ji); + frame_count ++; + //printf ("M: %s %d.\n", mono_method_full_name (method, TRUE), frame_count); + + if (stack_overflow) { + free_stack = (guint8*)(MONO_CONTEXT_GET_SP (ctx)) - (guint8*)(MONO_CONTEXT_GET_SP (&initial_ctx)); + } else { + free_stack = 0xffffff; + } + + for (i = clause_index_start; i < ji->num_clauses; i++) { + MonoJitExceptionInfo *ei = &ji->clauses [i]; + gboolean filtered = FALSE; + + /* + * During stack overflow, wait till the unwinding frees some stack + * space before running handlers/finalizers. + */ + if (free_stack <= (64 * 1024)) + continue; + + if (is_address_protected (ji, ei, ip)) { + /* catch block */ + MonoClass *catch_class = get_exception_catch_class (ei, ji, ctx); + + /* + * Have to unwrap RuntimeWrappedExceptions if the + * method's assembly doesn't have a RuntimeCompatibilityAttribute. + */ + if (non_exception && !wrap_non_exception_throws (method)) + ex_obj = non_exception; + else + ex_obj = obj; + + if (((ei->flags == MONO_EXCEPTION_CLAUSE_NONE) || (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER))) { +#ifndef MONO_CROSS_COMPILE +#ifdef MONO_CONTEXT_SET_LLVM_EXC_REG + MONO_CONTEXT_SET_LLVM_EXC_REG (ctx, ex_obj); +#else + g_assert (!ji->from_llvm); + /* store the exception object in bp + ei->exvar_offset */ + *((gpointer *)(gpointer)((char *)MONO_CONTEXT_GET_BP (ctx) + ei->exvar_offset)) = ex_obj; +#endif +#endif + } + +#ifdef MONO_CONTEXT_SET_LLVM_EH_SELECTOR_REG + if (ji->from_llvm) + MONO_CONTEXT_SET_LLVM_EH_SELECTOR_REG (ctx, ei->clause_index); +#endif + + if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) { + /* + * Filter clauses should only be run in the + * first pass of exception handling. + */ + filtered = (filter_idx == first_filter_idx); + filter_idx ++; + } + + error_init (error); + if ((ei->flags == MONO_EXCEPTION_CLAUSE_NONE && + mono_object_isinst_checked (ex_obj, catch_class, error)) || filtered) { + /* + * This guards against the situation that we abort a thread that is executing a finally clause + * that was called by the EH machinery. It won't have a guard trampoline installed, so we must + * check for this situation here and resume interruption if we are below the guarded block. + */ + if (G_UNLIKELY (jit_tls->handler_block)) { + gboolean is_outside = FALSE; + gpointer prot_bp = MONO_CONTEXT_GET_BP (&jit_tls->handler_block_context); + gpointer catch_bp = MONO_CONTEXT_GET_BP (ctx); + //FIXME make this stack direction aware + + if (catch_bp > prot_bp) { + is_outside = TRUE; + } else if (catch_bp == prot_bp) { + /* Can be either try { try { } catch {} } finally {} or try { try { } finally {} } catch {} + * So we check if the catch handler_start is protected by the guarded handler protected region + * + * Assumptions: + * If there is an outstanding guarded_block return address, it means the current thread must be aborted. + * This is the only way to reach out the guarded block as other cases are handled by the trampoline. + * There aren't any further finally/fault handler blocks down the stack over this exception. + * This must be ensured by the code that installs the guard trampoline. + */ + g_assert (ji == mini_jit_info_table_find (domain, (char *)MONO_CONTEXT_GET_IP (&jit_tls->handler_block_context), NULL)); + + if (!is_address_protected (ji, jit_tls->handler_block, ei->handler_start)) { + is_outside = TRUE; + } + } + if (is_outside) { + jit_tls->handler_block = NULL; + mono_thread_resume_interruption (TRUE); /*We ignore the exception here, it will be raised later*/ + } + } + + if (mono_trace_is_enabled () && mono_trace_eval (method)) + g_print ("EXCEPTION: catch found at clause %d of %s\n", i, mono_method_full_name (method, TRUE)); + jit_tls->orig_ex_ctx_set = TRUE; + MONO_PROFILER_RAISE (exception_clause, (method, i, ei->flags, ex_obj)); + jit_tls->orig_ex_ctx_set = FALSE; + mini_set_abort_threshold (ctx); + + if (in_interp) { + /* + * ctx->pc points into the interpreter, after the call which transitioned to + * JITted code. Store the unwind state into the + * interpeter state, then resume, the interpreter will unwind itself until + * it reaches the target frame and will continue execution from there. + * The resuming is kinda hackish, from the native code standpoint, it looks + * like the call which transitioned to JITted code has succeeded, but the + * return value register etc. is not set, so we have to be careful. + */ + mini_get_interp_callbacks ()->set_resume_state (jit_tls, mono_ex, ei, frame.interp_frame, ei->handler_start); + /* Undo the IP adjustment done by mono_arch_unwind_frame () */ +#if defined(TARGET_AMD64) + ctx->gregs [AMD64_RIP] ++; +#elif defined(TARGET_ARM) + ctx->pc ++; + if (mono_arm_thumb_supported ()) + ctx->pc |= 1; +#elif defined(TARGET_ARM64) + ctx->pc ++; +#elif defined (HOST_WASM) + //nada? +#else + NOT_IMPLEMENTED; +#endif + } else { + MONO_CONTEXT_SET_IP (ctx, ei->handler_start); + } + mono_set_lmf (lmf); +#ifndef DISABLE_PERFCOUNTERS + mono_atomic_fetch_add_i32 (&mono_perfcounters->exceptions_depth, frame_count); +#endif + if (obj == (MonoObject *)domain->stack_overflow_ex) + jit_tls->handling_stack_ovf = FALSE; + + return 0; + } + mono_error_cleanup (error); + if (ei->flags == MONO_EXCEPTION_CLAUSE_FAULT) { + if (mono_trace_is_enabled () && mono_trace_eval (method)) + g_print ("EXCEPTION: fault clause %d of %s\n", i, mono_method_full_name (method, TRUE)); + jit_tls->orig_ex_ctx_set = TRUE; + MONO_PROFILER_RAISE (exception_clause, (method, i, ei->flags, ex_obj)); + jit_tls->orig_ex_ctx_set = FALSE; + } + if (ei->flags == MONO_EXCEPTION_CLAUSE_FINALLY) { + if (mono_trace_is_enabled () && mono_trace_eval (method)) + g_print ("EXCEPTION: finally clause %d of %s\n", i, mono_method_full_name (method, TRUE)); + jit_tls->orig_ex_ctx_set = TRUE; + MONO_PROFILER_RAISE (exception_clause, (method, i, ei->flags, ex_obj)); + jit_tls->orig_ex_ctx_set = FALSE; +#ifndef DISABLE_PERFCOUNTERS + mono_atomic_inc_i32 (&mono_perfcounters->exceptions_finallys); +#endif + } + if (ei->flags == MONO_EXCEPTION_CLAUSE_FAULT || ei->flags == MONO_EXCEPTION_CLAUSE_FINALLY) { + mono_set_lmf (lmf); + if (ji->from_llvm) { + /* + * LLVM compiled finally handlers follow the design + * of the c++ ehabi, i.e. they call a resume function + * at the end instead of returning to the caller. + * So save the exception handling state, + * mono_resume_unwind () will call us again to continue + * the unwinding. + */ + jit_tls->resume_state.ex_obj = obj; + jit_tls->resume_state.ji = ji; + jit_tls->resume_state.clause_index = i + 1; + jit_tls->resume_state.ctx = *ctx; + jit_tls->resume_state.new_ctx = new_ctx; + jit_tls->resume_state.lmf = lmf; + jit_tls->resume_state.first_filter_idx = first_filter_idx; + jit_tls->resume_state.filter_idx = filter_idx; + mini_set_abort_threshold (ctx); + MONO_CONTEXT_SET_IP (ctx, ei->handler_start); + return 0; + } else { + mini_set_abort_threshold (ctx); + if (in_interp) { + gboolean has_ex = mini_get_interp_callbacks ()->run_finally (&frame, i, ei->handler_start); + if (has_ex) + return 0; + } else { + call_filter (ctx, ei->handler_start); + } + } + } + } + } + + if (MONO_PROFILER_ENABLED (method_exception_leave) && + mono_profiler_get_call_instrumentation_flags (method) & MONO_PROFILER_CALL_INSTRUMENTATION_EXCEPTION_LEAVE) { + jit_tls->orig_ex_ctx_set = TRUE; + MONO_PROFILER_RAISE (method_exception_leave, (method, ex_obj)); + jit_tls->orig_ex_ctx_set = FALSE; + } + + *ctx = new_ctx; + } + + g_assert_not_reached (); +} + +/** + * mono_debugger_run_finally: + * \param start_ctx saved processor state + * This method is called by the Mono Debugger to call all \c finally clauses of the + * current stack frame. It's used when the user issues a \c return command to make + * the current stack frame return. After returning from this method, the debugger + * unwinds the stack one frame and gives control back to the user. + * NOTE: This method is only used when running inside the Mono Debugger. + */ +void +mono_debugger_run_finally (MonoContext *start_ctx) +{ + static int (*call_filter) (MonoContext *, gpointer) = NULL; + MonoDomain *domain = mono_domain_get (); + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + MonoLMF *lmf = mono_get_lmf (); + MonoContext ctx, new_ctx; + MonoJitInfo *ji, rji; + int i; + + ctx = *start_ctx; + + ji = mono_find_jit_info (domain, jit_tls, &rji, NULL, &ctx, &new_ctx, NULL, &lmf, NULL, NULL); + if (!ji || ji == (gpointer)-1) + return; + + if (!call_filter) + call_filter = (int (*)(MonoContext *, void *))mono_get_call_filter (); + + for (i = 0; i < ji->num_clauses; i++) { + MonoJitExceptionInfo *ei = &ji->clauses [i]; + + if (is_address_protected (ji, ei, MONO_CONTEXT_GET_IP (&ctx)) && + (ei->flags & MONO_EXCEPTION_CLAUSE_FINALLY)) { + call_filter (&ctx, ei->handler_start); + } + } +} + +/** + * mono_handle_exception: + * \param ctx saved processor state + * \param obj the exception object + * + * Handle the exception OBJ starting from the state CTX. Modify CTX to point to the handler clause if the exception is caught, and + * return TRUE. + */ +gboolean +mono_handle_exception (MonoContext *ctx, MonoObject *obj) +{ + MONO_REQ_GC_UNSAFE_MODE; + +#ifndef DISABLE_PERFCOUNTERS + mono_atomic_inc_i32 (&mono_perfcounters->exceptions_thrown); +#endif + + return mono_handle_exception_internal (ctx, obj, FALSE, NULL); +} + +#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK + +#ifndef MONO_ARCH_USE_SIGACTION +#error "Can't use sigaltstack without sigaction" +#endif + +#define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) + +void +mono_setup_altstack (MonoJitTlsData *tls) +{ + size_t stsize = 0; + stack_t sa; + guint8 *staddr = NULL; + + if (mono_running_on_valgrind ()) + return; + + mono_thread_info_get_stack_bounds (&staddr, &stsize); + + g_assert (staddr); + + tls->end_of_stack = staddr + stsize; + tls->stack_size = stsize; + + /*g_print ("thread %p, stack_base: %p, stack_size: %d\n", (gpointer)pthread_self (), staddr, stsize);*/ + + tls->stack_ovf_guard_base = staddr + mono_pagesize (); + tls->stack_ovf_guard_size = ALIGN_TO (8 * 4096, mono_pagesize ()); + + g_assert ((guint8*)&sa >= (guint8*)tls->stack_ovf_guard_base + tls->stack_ovf_guard_size); + + if (mono_mprotect (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_NONE)) { + /* mprotect can fail for the main thread stack */ + gpointer gaddr = mono_valloc (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_NONE|MONO_MMAP_PRIVATE|MONO_MMAP_ANON|MONO_MMAP_FIXED, MONO_MEM_ACCOUNT_EXCEPTIONS); + g_assert (gaddr == tls->stack_ovf_guard_base); + tls->stack_ovf_valloced = TRUE; + } + + /* Setup an alternate signal stack */ + tls->signal_stack = mono_valloc (0, MONO_ARCH_SIGNAL_STACK_SIZE, MONO_MMAP_READ|MONO_MMAP_WRITE|MONO_MMAP_PRIVATE|MONO_MMAP_ANON, MONO_MEM_ACCOUNT_EXCEPTIONS); + tls->signal_stack_size = MONO_ARCH_SIGNAL_STACK_SIZE; + + g_assert (tls->signal_stack); + + sa.ss_sp = tls->signal_stack; + sa.ss_size = MONO_ARCH_SIGNAL_STACK_SIZE; + sa.ss_flags = 0; + g_assert (sigaltstack (&sa, NULL) == 0); + + mono_gc_register_altstack ((char*)tls->stack_ovf_guard_base + tls->stack_ovf_guard_size, (char*)staddr + stsize - ((char*)tls->stack_ovf_guard_base + tls->stack_ovf_guard_size), tls->signal_stack, tls->signal_stack_size); +} + +void +mono_free_altstack (MonoJitTlsData *tls) +{ + stack_t sa; + int err; + + sa.ss_sp = tls->signal_stack; + sa.ss_size = MONO_ARCH_SIGNAL_STACK_SIZE; + sa.ss_flags = SS_DISABLE; + err = sigaltstack (&sa, NULL); + g_assert (err == 0); + + if (tls->signal_stack) + mono_vfree (tls->signal_stack, MONO_ARCH_SIGNAL_STACK_SIZE, MONO_MEM_ACCOUNT_EXCEPTIONS); + if (tls->stack_ovf_valloced) + mono_vfree (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MEM_ACCOUNT_EXCEPTIONS); + else + mono_mprotect (tls->stack_ovf_guard_base, tls->stack_ovf_guard_size, MONO_MMAP_READ|MONO_MMAP_WRITE); +} + +#else /* !MONO_ARCH_SIGSEGV_ON_ALTSTACK */ + +void +mono_setup_altstack (MonoJitTlsData *tls) +{ +} + +void +mono_free_altstack (MonoJitTlsData *tls) +{ +} + +#endif /* MONO_ARCH_SIGSEGV_ON_ALTSTACK */ + +gboolean +mono_handle_soft_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, guint8* fault_addr) +{ + if (mono_llvm_only) + return FALSE; + + /* we got a stack overflow in the soft-guard pages + * There are two cases: + * 1) managed code caused the overflow: we unprotect the soft-guard page + * and let the arch-specific code trigger the exception handling mechanism + * in the thread stack. The soft-guard pages will be protected again as the stack is unwound. + * 2) unmanaged code caused the overflow: we unprotect the soft-guard page + * and hope we can continue with those enabled, at least until the hard-guard page + * is hit. The alternative to continuing here is to just print a message and abort. + * We may add in the future the code to protect the pages again in the codepath + * when we return from unmanaged to managed code. + */ + if (jit_tls->stack_ovf_guard_size && fault_addr >= (guint8*)jit_tls->stack_ovf_guard_base && + fault_addr < (guint8*)jit_tls->stack_ovf_guard_base + jit_tls->stack_ovf_guard_size) { + gboolean handled = FALSE; + + mono_mprotect (jit_tls->stack_ovf_guard_base, jit_tls->stack_ovf_guard_size, MONO_MMAP_READ|MONO_MMAP_WRITE); +#ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK + if (ji) { + mono_arch_handle_altstack_exception (ctx, siginfo, fault_addr, TRUE); + handled = TRUE; + } +#endif + if (!handled) { + /* We print a message: after this even managed stack overflows + * may crash the runtime + */ + mono_runtime_printf_err ("Stack overflow in unmanaged: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr); + if (!jit_tls->handling_stack_ovf) { + jit_tls->handling_stack_ovf = 1; + } else { + /*fprintf (stderr, "Already handling stack overflow\n");*/ + } + } + return TRUE; + } + return FALSE; +} + +typedef struct { + MonoMethod *omethod; + int count; +} PrintOverflowUserData; + +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX +static gboolean +print_overflow_stack_frame (StackFrameInfo *frame, MonoContext *ctx, gpointer data) +{ + MonoMethod *method = NULL; + PrintOverflowUserData *user_data = (PrintOverflowUserData *)data; + gchar *location; + + if (frame->ji && frame->type != FRAME_TYPE_TRAMPOLINE) + method = jinfo_get_method (frame->ji); + + if (method) { + if (user_data->count == 0) { + /* The first frame is in its prolog, so a line number cannot be computed */ + user_data->count ++; + return FALSE; + } + + /* If this is a one method overflow, skip the other instances */ + if (method == user_data->omethod) + return FALSE; + + location = mono_debug_print_stack_frame (method, frame->native_offset, mono_domain_get ()); + mono_runtime_printf_err (" %s", location); + g_free (location); + + if (user_data->count == 1) { + mono_runtime_printf_err (" <...>"); + user_data->omethod = method; + } else { + user_data->omethod = NULL; + } + + user_data->count ++; + } else + mono_runtime_printf_err (" at <0x%05x>", frame->native_offset); + + return FALSE; +} +#endif + +void +mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr) +{ +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX + PrintOverflowUserData ud; + MonoContext mctx; +#endif + + /* we don't do much now, but we can warn the user with a useful message */ + mono_runtime_printf_err ("Stack overflow: IP: %p, fault addr: %p", mono_arch_ip_from_context (ctx), fault_addr); + +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX + mono_sigctx_to_monoctx (ctx, &mctx); + + mono_runtime_printf_err ("Stacktrace:"); + + memset (&ud, 0, sizeof (ud)); + + mono_walk_stack_with_ctx (print_overflow_stack_frame, &mctx, MONO_UNWIND_LOOKUP_ACTUAL_METHOD, &ud); +#else + if (ji && !ji->is_trampoline && jinfo_get_method (ji)) + mono_runtime_printf_err ("At %s", mono_method_full_name (jinfo_get_method (ji), TRUE)); + else + mono_runtime_printf_err ("At ."); +#endif + + _exit (1); +} + +static gboolean +print_stack_frame_to_stderr (StackFrameInfo *frame, MonoContext *ctx, gpointer data) +{ + MonoMethod *method = NULL; + + if (frame->ji && frame->type != FRAME_TYPE_TRAMPOLINE) + method = jinfo_get_method (frame->ji); + + if (method) { + gchar *location = mono_debug_print_stack_frame (method, frame->native_offset, mono_domain_get ()); + mono_runtime_printf_err (" %s", location); + g_free (location); + } else + mono_runtime_printf_err (" at <0x%05x>", frame->native_offset); + + return FALSE; +} + +static G_GNUC_UNUSED gboolean +print_stack_frame_to_string (StackFrameInfo *frame, MonoContext *ctx, gpointer data) +{ + GString *p = (GString*)data; + MonoMethod *method = NULL; + + if (frame->ji && frame->type != FRAME_TYPE_TRAMPOLINE) + method = jinfo_get_method (frame->ji); + + if (method && frame->domain) { + gchar *location = mono_debug_print_stack_frame (method, frame->native_offset, frame->domain); + g_string_append_printf (p, " %s\n", location); + g_free (location); + } else + g_string_append_printf (p, " at <0x%05x>\n", frame->native_offset); + + return FALSE; +} + +#ifndef MONO_CROSS_COMPILE + +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:"); + + while (fgets (line, sizeof (line), fp)) { + // strip newline + size_t len = strlen (line) - 1; + if (len >= 0 && line [len] == '\n') + line [len] = '\0'; + + mono_runtime_printf_err ("%s", line); + } + + fclose (fp); +#else + /* do nothing */ +#endif +} + +static gboolean handle_crash_loop = FALSE; + +/* + * mono_handle_native_crash: + * + * Handle a native crash (e.g. SIGSEGV) while in native code by + * printing diagnostic information and aborting. + */ +void +mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) +{ +#ifdef MONO_ARCH_USE_SIGACTION + struct sigaction sa; +#endif + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + + if (handle_crash_loop) + return; + + if (mini_get_debug_options ()->suspend_on_native_crash) { + mono_runtime_printf_err ("Received %s, suspending...", signal); +#ifdef HOST_WIN32 + while (1) + ; +#else + while (1) { + sleep (1); + } +#endif + } + + /* prevent infinite loops in crash handling */ + handle_crash_loop = TRUE; + + /* !jit_tls means the thread was not registered with the runtime */ + if (jit_tls && mono_thread_internal_current ()) { + mono_runtime_printf_err ("Stacktrace:\n"); + + /* FIXME: Is MONO_UNWIND_LOOKUP_IL_OFFSET correct here? */ + mono_walk_stack (print_stack_frame_to_stderr, MONO_UNWIND_LOOKUP_IL_OFFSET, NULL); + } + + print_process_map (); + +#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 */ + +#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 (); + + /* + * 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) + if (mono_merp_enabled ()) { + if (pid == 0) { + MonoContext mctx; + if (!ctx) { + mono_runtime_printf_err ("\nMust always pass non-null context when using merp.\n"); + exit (1); + } + + mono_sigctx_to_monoctx (ctx, &mctx); + + intptr_t thread_pointer = (intptr_t) MONO_CONTEXT_GET_SP (&mctx); + + mono_merp_invoke (crashed_pid, thread_pointer, signal); + + 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 + + /* + * A SIGSEGV indicates something went very wrong so we can no longer depend + * on anything working. So try to print out lots of diagnostics, starting + * with ones which have a greater chance of working. + */ + mono_runtime_printf_err ( + "\n" + "=================================================================\n" + "Got a %s while executing native code. This usually indicates\n" + "a fatal error in the mono runtime or one of the native libraries \n" + "used by your application.\n" + "=================================================================\n", + signal); + +#ifdef MONO_ARCH_USE_SIGACTION + sa.sa_handler = SIG_DFL; + sigemptyset (&sa.sa_mask); + sa.sa_flags = 0; + + /* Remove our SIGABRT handler */ + g_assert (sigaction (SIGABRT, &sa, NULL) != -1); + + /* On some systems we get a SIGILL when calling abort (), because it might + * fail to raise SIGABRT */ + g_assert (sigaction (SIGILL, &sa, NULL) != -1); +#endif + + if (!mono_do_crash_chaining) { + /*Android abort is a fluke, it doesn't abort, it triggers another segv. */ +#if defined (HOST_ANDROID) + exit (-1); +#else + abort (); +#endif + } +} + +#else + +void +mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) +{ + g_assert_not_reached (); +} + +#endif /* !MONO_CROSS_COMPILE */ + +static void +mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx) +{ + MonoInternalThread *thread = mono_thread_internal_current (); +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX + MonoContext ctx; +#endif + GString* text; + char *name; + GError *gerror = NULL; + + if (!thread) + return; + + text = g_string_new (0); + if (thread->name) { + name = g_utf16_to_utf8 (thread->name, thread->name_len, NULL, NULL, &gerror); + g_assert (!gerror); + g_string_append_printf (text, "\n\"%s\"", name); + g_free (name); + } + else if (thread->threadpool_thread) + g_string_append (text, "\n\"\""); + else + g_string_append (text, "\n\"\""); + + g_string_append_printf (text, " tid=0x%p this=0x%p ", (gpointer)(gsize)thread->tid, thread); + mono_thread_internal_describe (thread, text); + g_string_append (text, "\n"); + +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX + if (start_ctx) { + memcpy (&ctx, start_ctx, sizeof (MonoContext)); + } else if (!sigctx) + MONO_INIT_CONTEXT_FROM_FUNC (&ctx, mono_print_thread_dump); + else + mono_sigctx_to_monoctx (sigctx, &ctx); + + mono_walk_stack_with_ctx (print_stack_frame_to_string, &ctx, MONO_UNWIND_LOOKUP_ALL, text); +#else + mono_runtime_printf ("\t"); +#endif + + mono_runtime_printf ("%s", text->str); + +#if HOST_WIN32 && TARGET_WIN32 && _DEBUG + OutputDebugStringA(text->str); +#endif + + g_string_free (text, TRUE); + mono_runtime_stdout_fflush (); +} + +/** + * mono_print_thread_dump: + * + * Print information about the current thread to stdout. + * \p sigctx can be NULL, allowing this to be called from gdb. + */ +void +mono_print_thread_dump (void *sigctx) +{ + mono_print_thread_dump_internal (sigctx, NULL); +} + +void +mono_print_thread_dump_from_ctx (MonoContext *ctx) +{ + mono_print_thread_dump_internal (NULL, ctx); +} + +/* + * mono_resume_unwind: + * + * This is called by a trampoline from LLVM compiled finally clauses to continue + * unwinding. + */ +void +mono_resume_unwind (MonoContext *ctx) +{ + MONO_REQ_GC_UNSAFE_MODE; + + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + MonoContext new_ctx; + + MONO_CONTEXT_SET_IP (ctx, MONO_CONTEXT_GET_IP (&jit_tls->resume_state.ctx)); + MONO_CONTEXT_SET_SP (ctx, MONO_CONTEXT_GET_SP (&jit_tls->resume_state.ctx)); + new_ctx = *ctx; + + mono_handle_exception_internal (&new_ctx, (MonoObject *)jit_tls->resume_state.ex_obj, TRUE, NULL); + + mono_restore_context (&new_ctx); +} + +typedef struct { + MonoJitInfo *ji; + MonoContext ctx; + MonoJitExceptionInfo *ei; +} FindHandlerBlockData; + +static gboolean +find_last_handler_block (StackFrameInfo *frame, MonoContext *ctx, gpointer data) +{ + int i; + gpointer ip; + FindHandlerBlockData *pdata = (FindHandlerBlockData *)data; + MonoJitInfo *ji = frame->ji; + + if (!ji) + return FALSE; + + ip = MONO_CONTEXT_GET_IP (ctx); + + for (i = 0; i < ji->num_clauses; ++i) { + MonoJitExceptionInfo *ei = ji->clauses + i; + if (ei->flags != MONO_EXCEPTION_CLAUSE_FINALLY) + continue; + /*If ip points to the first instruction it means the handler block didn't start + so we can leave its execution to the EH machinery*/ + if (ei->handler_start <= ip && ip < ei->data.handler_end) { + pdata->ji = ji; + pdata->ei = ei; + pdata->ctx = *ctx; + break; + } + } + return FALSE; +} + + +static void +install_handler_block_guard (MonoJitInfo *ji, MonoContext *ctx) +{ + int i; + MonoJitExceptionInfo *clause = NULL; + gpointer ip; + guint8 *bp; + + ip = MONO_CONTEXT_GET_IP (ctx); + + for (i = 0; i < ji->num_clauses; ++i) { + clause = &ji->clauses [i]; + if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY) + continue; + if (clause->handler_start <= ip && clause->data.handler_end > ip) + break; + } + + /*no matching finally */ + if (i == ji->num_clauses) + return; + + /*Load the spvar*/ + bp = (guint8*)MONO_CONTEXT_GET_BP (ctx); + *(bp + clause->exvar_offset) = 1; +} + +/* + * Finds the bottom handler block running and install a block guard if needed. + */ +static gboolean +mono_install_handler_block_guard (MonoThreadUnwindState *ctx) +{ + FindHandlerBlockData data = { 0 }; + MonoJitTlsData *jit_tls = (MonoJitTlsData *)ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS]; + + /* Guard against a null MonoJitTlsData. This can happens if the thread receives the + * interrupt signal before the JIT has time to initialize its TLS data for the given thread. + */ + if (!jit_tls || jit_tls->handler_block) + return FALSE; + + /* Do an async safe stack walk */ + mono_thread_info_set_is_async_context (TRUE); + mono_walk_stack_with_state (find_last_handler_block, ctx, MONO_UNWIND_NONE, &data); + mono_thread_info_set_is_async_context (FALSE); + + if (!data.ji) + return FALSE; + + memcpy (&jit_tls->handler_block_context, &data.ctx, sizeof (MonoContext)); + + install_handler_block_guard (data.ji, &data.ctx); + + jit_tls->handler_block = data.ei; + + return TRUE; +} + +static gboolean +mono_current_thread_has_handle_block_guard (void) +{ + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + return jit_tls && jit_tls->handler_block != NULL; +} + +void +mono_set_cast_details (MonoClass *from, MonoClass *to) +{ + MonoJitTlsData *jit_tls = NULL; + + if (mini_get_debug_options ()->better_cast_details) { + jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + jit_tls->class_cast_from = from; + jit_tls->class_cast_to = to; + } +} + + +/*returns false if the thread is not attached*/ +gboolean +mono_thread_state_init_from_sigctx (MonoThreadUnwindState *ctx, void *sigctx) +{ +#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX + MonoThreadInfo *thread = mono_thread_info_current_unchecked (); + if (!thread) { + ctx->valid = FALSE; + return FALSE; + } + + if (sigctx) { + mono_sigctx_to_monoctx (sigctx, &ctx->ctx); + + ctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = mono_domain_get (); + ctx->unwind_data [MONO_UNWIND_DATA_LMF] = mono_get_lmf (); + ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = thread->jit_data; + } + else { + mono_thread_state_init (ctx); + } + + if (!ctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] || !ctx->unwind_data [MONO_UNWIND_DATA_LMF]) + return FALSE; + + ctx->valid = TRUE; + return TRUE; +#else + g_error ("Implement mono_arch_sigctx_to_monoctx for the current target"); + return FALSE; +#endif +} + +void +mono_thread_state_init (MonoThreadUnwindState *ctx) +{ + MonoThreadInfo *thread = mono_thread_info_current_unchecked (); + +#if defined(MONO_CROSS_COMPILE) + ctx->valid = FALSE; //A cross compiler doesn't need to suspend. +#elif MONO_ARCH_HAS_MONO_CONTEXT + MONO_CONTEXT_GET_CURRENT (ctx->ctx); +#else + g_error ("Use a null sigctx requires a working mono-context"); +#endif + + ctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = mono_domain_get (); + ctx->unwind_data [MONO_UNWIND_DATA_LMF] = mono_get_lmf (); + ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = thread ? thread->jit_data : NULL; + ctx->valid = TRUE; +} + + +gboolean +mono_thread_state_init_from_monoctx (MonoThreadUnwindState *ctx, MonoContext *mctx) +{ + MonoThreadInfo *thread = mono_thread_info_current_unchecked (); + if (!thread) { + ctx->valid = FALSE; + return FALSE; + } + + ctx->ctx = *mctx; + ctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = mono_domain_get (); + ctx->unwind_data [MONO_UNWIND_DATA_LMF] = mono_get_lmf (); + ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = thread->jit_data; + ctx->valid = TRUE; + return TRUE; +} + +/*returns false if the thread is not attached*/ +gboolean +mono_thread_state_init_from_current (MonoThreadUnwindState *ctx) +{ + MonoThreadInfo *thread = mono_thread_info_current_unchecked (); + MONO_ARCH_CONTEXT_DEF + + mono_arch_flush_register_windows (); + + if (!thread || !thread->jit_data) { + ctx->valid = FALSE; + return FALSE; + } +#ifdef MONO_INIT_CONTEXT_FROM_CURRENT + MONO_INIT_CONTEXT_FROM_CURRENT (&ctx->ctx); +#else + MONO_INIT_CONTEXT_FROM_FUNC (&ctx->ctx, mono_thread_state_init_from_current); +#endif + + ctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = mono_domain_get (); + ctx->unwind_data [MONO_UNWIND_DATA_LMF] = mono_get_lmf (); + ctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = thread->jit_data; + ctx->valid = TRUE; + return TRUE; +} + +static void +mono_raise_exception_with_ctx (MonoException *exc, MonoContext *ctx) +{ + mono_handle_exception (ctx, (MonoObject *)exc); + mono_restore_context (ctx); +} + +/*FIXME Move all monoctx -> sigctx conversion to signal handlers once all archs support utils/mono-context */ +void +mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) +{ +#ifdef MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK + MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); + jit_tls->ex_ctx = *ctx; + + mono_arch_setup_async_callback (ctx, async_cb, user_data); +#else + g_error ("This target doesn't support mono_arch_setup_async_callback"); +#endif +} + +/* + * mono_restore_context: + * + * Call the architecture specific restore context function. + */ +void +mono_restore_context (MonoContext *ctx) +{ + static void (*restore_context) (MonoContext *); + + if (!restore_context) + restore_context = (void (*)(MonoContext *))mono_get_restore_context (); + restore_context (ctx); + g_assert_not_reached (); +} + +/* + * mono_jinfo_get_unwind_info: + * + * Return the unwind info for JI. + */ +guint8* +mono_jinfo_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len) +{ + if (ji->has_unwind_info) { + /* The address/length in the MonoJitInfo structure itself */ + MonoUnwindJitInfo *info = mono_jit_info_get_unwind_info (ji); + *unwind_info_len = info->unw_info_len; + return info->unw_info; + } else if (ji->from_aot) + return mono_aot_get_unwind_info (ji, unwind_info_len); + else + return mono_get_cached_unwind_info (ji->unwind_info, unwind_info_len); +} + +int +mono_jinfo_get_epilog_size (MonoJitInfo *ji) +{ + MonoArchEHJitInfo *info; + + info = mono_jit_info_get_arch_eh_info (ji); + g_assert (info); + + return info->epilog_size; +} + +/* + * LLVM/Bitcode exception handling. + */ + +static void +throw_exception (MonoObject *ex, gboolean rethrow) +{ + MONO_REQ_GC_UNSAFE_MODE; + + ERROR_DECL (error); + MonoJitTlsData *jit_tls = mono_get_jit_tls (); + MonoException *mono_ex; + + if (!mono_object_isinst_checked (ex, mono_defaults.exception_class, error)) { + mono_error_assert_ok (error); + mono_ex = mono_get_exception_runtime_wrapped_checked (ex, error); + mono_error_assert_ok (error); + jit_tls->thrown_non_exc = mono_gchandle_new (ex, FALSE); + } + else + mono_ex = (MonoException*)ex; + + // Note: Not pinned + jit_tls->thrown_exc = mono_gchandle_new ((MonoObject*)mono_ex, FALSE); + + if (!rethrow) { +#ifdef MONO_ARCH_HAVE_UNWIND_BACKTRACE + GList *l, *ips = NULL; + GList *trace; + + _Unwind_Backtrace (build_stack_trace, &ips); + /* The list contains ip-gshared info pairs */ + trace = NULL; + ips = g_list_reverse (ips); + for (l = ips; l; l = l->next) { + trace = g_list_append (trace, l->data); + trace = g_list_append (trace, NULL); + trace = g_list_append (trace, NULL); + } + MonoArray *ips_arr = mono_glist_to_array (trace, mono_defaults.int_class, error); + mono_error_assert_ok (error); + MONO_OBJECT_SETREF (mono_ex, trace_ips, ips_arr); + g_list_free (l); + g_list_free (trace); +#endif + } + + mono_llvm_cpp_throw_exception (); +} + +void +mono_llvm_throw_exception (MonoObject *ex) +{ + throw_exception (ex, FALSE); +} + +void +mono_llvm_rethrow_exception (MonoObject *ex) +{ + throw_exception (ex, TRUE); +} + +void +mono_llvm_raise_exception (MonoException *e) +{ + mono_llvm_throw_exception ((MonoObject*)e); +} + +void +mono_llvm_reraise_exception (MonoException *e) +{ + mono_llvm_rethrow_exception ((MonoObject*)e); +} + +void +mono_llvm_throw_corlib_exception (guint32 ex_token_index) +{ + guint32 ex_token = MONO_TOKEN_TYPE_DEF | ex_token_index; + MonoException *ex; + + ex = mono_exception_from_token (mono_defaults.exception_class->image, ex_token); + + mono_llvm_throw_exception ((MonoObject*)ex); +} + +/* + * mono_llvm_resume_exception: + * + * Resume exception propagation. + */ +void +mono_llvm_resume_exception (void) +{ + mono_llvm_cpp_throw_exception (); +} + +/* + * mono_llvm_load_exception: + * + * Return the currently thrown exception. + */ +MonoObject * +mono_llvm_load_exception (void) +{ + ERROR_DECL (error); + MonoJitTlsData *jit_tls = mono_get_jit_tls (); + + MonoException *mono_ex = (MonoException*)mono_gchandle_get_target (jit_tls->thrown_exc); + + if (mono_ex->trace_ips) { + GList *trace_ips = NULL; + gpointer ip = MONO_RETURN_ADDRESS (); + + size_t upper = mono_array_length (mono_ex->trace_ips); + + for (int i = 0; i < upper; i += TRACE_IP_ENTRY_SIZE) { + gpointer curr_ip = mono_array_get (mono_ex->trace_ips, gpointer, i); + for (int j = 0; j < TRACE_IP_ENTRY_SIZE; ++j) { + gpointer p = mono_array_get (mono_ex->trace_ips, gpointer, i + j); + trace_ips = g_list_append (trace_ips, p); + } + if (ip == curr_ip) + break; + } + + // FIXME: Does this work correctly for rethrows? + // We may be discarding useful information + // when this gets GC'ed + MonoArray *ips_arr = mono_glist_to_array (trace_ips, mono_defaults.int_class, error); + mono_error_assert_ok (error); + MONO_OBJECT_SETREF (mono_ex, trace_ips, ips_arr); + g_list_free (trace_ips); + + // FIXME: + //MONO_OBJECT_SETREF (mono_ex, stack_trace, ves_icall_System_Exception_get_trace (mono_ex)); + } else { + MONO_OBJECT_SETREF (mono_ex, trace_ips, mono_array_new_checked (mono_domain_get (), mono_defaults.int_class, 0, error)); + mono_error_assert_ok (error); + MONO_OBJECT_SETREF (mono_ex, stack_trace, mono_array_new_checked (mono_domain_get (), mono_defaults.stack_frame_class, 0, error)); + mono_error_assert_ok (error); + } + + return &mono_ex->object; +} + +/* + * mono_llvm_clear_exception: + * + * Mark the currently thrown exception as handled. + */ +void +mono_llvm_clear_exception (void) +{ + MonoJitTlsData *jit_tls = mono_get_jit_tls (); + mono_gchandle_free (jit_tls->thrown_exc); + jit_tls->thrown_exc = 0; + if (jit_tls->thrown_non_exc) + mono_gchandle_free (jit_tls->thrown_non_exc); + jit_tls->thrown_non_exc = 0; + + mono_memory_barrier (); +} + +/* + * mono_llvm_match_exception: + * + * Return the innermost clause containing REGION_START-REGION_END which can handle + * the current exception. + */ +gint32 +mono_llvm_match_exception (MonoJitInfo *jinfo, guint32 region_start, guint32 region_end, gpointer rgctx, MonoObject *this_obj) +{ + ERROR_DECL (error); + MonoJitTlsData *jit_tls = mono_get_jit_tls (); + MonoObject *exc; + gint32 index = -1; + + g_assert (jit_tls->thrown_exc); + exc = mono_gchandle_get_target (jit_tls->thrown_exc); + if (jit_tls->thrown_non_exc) { + /* + * Have to unwrap RuntimeWrappedExceptions if the + * method's assembly doesn't have a RuntimeCompatibilityAttribute. + */ + if (!wrap_non_exception_throws (jinfo_get_method (jinfo))) + exc = mono_gchandle_get_target (jit_tls->thrown_non_exc); + } + + for (int i = 0; i < jinfo->num_clauses; i++) { + MonoJitExceptionInfo *ei = &jinfo->clauses [i]; + MonoClass *catch_class; + + if (! (ei->try_offset == region_start && ei->try_offset + ei->try_len == region_end) ) + continue; + + catch_class = ei->data.catch_class; + if (mono_class_is_open_constructed_type (&catch_class->byval_arg)) { + MonoGenericContext context; + MonoType *inflated_type; + + g_assert (rgctx || this_obj); + context = get_generic_context_from_stack_frame (jinfo, rgctx ? rgctx : this_obj->vtable); + inflated_type = mono_class_inflate_generic_type_checked (&catch_class->byval_arg, &context, error); + mono_error_assert_ok (error); /* FIXME don't swallow the error */ + + catch_class = mono_class_from_mono_type (inflated_type); + mono_metadata_free_type (inflated_type); + } + + // FIXME: Handle edge cases handled in get_exception_catch_class + if (ei->flags == MONO_EXCEPTION_CLAUSE_NONE && mono_object_isinst_checked (exc, catch_class, error)) { + index = ei->clause_index; + break; + } else + mono_error_assert_ok (error); + + if (ei->flags == MONO_EXCEPTION_CLAUSE_FILTER) { + g_assert_not_reached (); + } + } + + return index; +} + +#ifdef ENABLE_LLVM +_Unwind_Reason_Code +mono_debug_personality (int a, _Unwind_Action b, +uint64_t c, struct _Unwind_Exception *d, struct _Unwind_Context *e) +{ + g_assert_not_reached (); +} +#else +void +mono_debug_personality (void); + +void +mono_debug_personality (void) +{ + g_assert_not_reached (); +} +#endif diff --git a/mono/mini/mini-exceptions.c.REMOVED.git-id b/mono/mini/mini-exceptions.c.REMOVED.git-id deleted file mode 100644 index 404174be9e..0000000000 --- a/mono/mini/mini-exceptions.c.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -bda7e14f3437c9f6c6eeae4f0380ce7f33c6d040 \ No newline at end of file diff --git a/mono/mini/mini-gc.c b/mono/mini/mini-gc.c index b21dd1be32..5d95290ed8 100644 --- a/mono/mini/mini-gc.c +++ b/mono/mini/mini-gc.c @@ -12,6 +12,7 @@ #include "config.h" #include "mini-gc.h" +#include "mini-runtime.h" #include static gboolean diff --git a/mono/mini/mini-generic-sharing.c.REMOVED.git-id b/mono/mini/mini-generic-sharing.c.REMOVED.git-id index 3df82764d5..57564f35c3 100644 --- a/mono/mini/mini-generic-sharing.c.REMOVED.git-id +++ b/mono/mini/mini-generic-sharing.c.REMOVED.git-id @@ -1 +1 @@ -1e8657d2ce6d4d44fb7252e8bd75f4aa56073f23 \ No newline at end of file +dff97edefd1576fbe199e3e8370bd0420aff5353 \ 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 99f37d60a5..290f73089e 100644 --- a/mono/mini/mini-llvm.c.REMOVED.git-id +++ b/mono/mini/mini-llvm.c.REMOVED.git-id @@ -1 +1 @@ -1f777878668f30a90f030b7e0a061a93b283535c \ No newline at end of file +230af7a2d0778f0ea7c9b6b897dafeca0497ac88 \ 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 f8dd0c937e..fc10e18dce 100644 --- a/mono/mini/mini-mips.c.REMOVED.git-id +++ b/mono/mini/mini-mips.c.REMOVED.git-id @@ -1 +1 @@ -c2c164d57b30bf813a6a29865c6b01b23292840b \ No newline at end of file +8452e9714a37dce0f68e415219379fb3f647b05c \ No newline at end of file diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index 8db0345497..c462fe13e5 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -72,6 +72,7 @@ #include #include #include +#include #endif #if defined(HOST_WATCHOS) @@ -209,6 +210,20 @@ MONO_SIG_HANDLER_FUNC (static, sigabrt_signal_handler) } } +#ifdef TARGET_OSX +MONO_SIG_HANDLER_FUNC (static, sigterm_signal_handler) +{ + MONO_SIG_HANDLER_INFO_TYPE *info = MONO_SIG_HANDLER_GET_INFO (); + MONO_SIG_HANDLER_GET_CONTEXT; + + if (mono_merp_enabled ()) + mono_handle_native_crash ("SIGTERM", ctx, info); + + mono_chain_signal (MONO_SIG_HANDLER_PARAMS); + exit (1); +} +#endif + #if (defined (USE_POSIX_BACKEND) && defined (SIGRTMIN)) || defined (SIGPROF) #define HAVE_PROFILER_SIGNAL #endif @@ -360,6 +375,15 @@ remove_signal_handler (int signo) } } +#ifdef TARGET_OSX +void +mini_register_sigterm_handler (void) +{ + /* always catch SIGTERM, conditionals inside of handler */ + add_signal_handler (SIGTERM, sigterm_signal_handler, 0); +} +#endif + void mono_runtime_posix_install_handlers (void) { diff --git a/mono/mini/mini-ppc.c.REMOVED.git-id b/mono/mini/mini-ppc.c.REMOVED.git-id index bd04267bc6..ab8ef3b4b8 100644 --- a/mono/mini/mini-ppc.c.REMOVED.git-id +++ b/mono/mini/mini-ppc.c.REMOVED.git-id @@ -1 +1 @@ -c25f39004a911d396c8185ed625593cf01ba8f28 \ No newline at end of file +7370aebd3f42fa943264a8b70c9e5404df8480c1 \ No newline at end of file diff --git a/mono/mini/mini-ppc.h b/mono/mini/mini-ppc.h index fc8ea3d121..167f6ed115 100644 --- a/mono/mini/mini-ppc.h +++ b/mono/mini/mini-ppc.h @@ -86,6 +86,11 @@ typedef struct MonoCompileArch { #else /* must be __mono_ppc__ */ +#if defined(_AIX) +/* 32 and 64 bit AIX use function descriptors */ +#define PPC_USES_FUNCTION_DESCRIPTOR +#endif + #define MONO_ARCH_EMULATE_FCONV_TO_I8 1 #define MONO_ARCH_EMULATE_LCONV_TO_R8 1 #define MONO_ARCH_EMULATE_LCONV_TO_R4 1 @@ -144,6 +149,32 @@ typedef struct MonoCompileArch { #define PPC_RETURN_SMALL_STRUCTS_IN_REGS 0 #define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 0 #define MONO_ARCH_RETURN_CAN_USE_MULTIPLE_REGISTERS 0 +#elif defined(_AIX) +/* FIXME: are these values valid? on 32-bit? */ +#define PPC_RET_ADDR_OFFSET 16 +#if defined(__mono_ppc64__) +#define PPC_STACK_PARAM_OFFSET 112 +#define PPC_MINIMAL_STACK_SIZE 112 +#else +#define PPC_STACK_PARAM_OFFSET 56 +#define PPC_MINIMAL_STACK_SIZE 56 +#endif +#define PPC_LARGEST_STRUCT_SIZE_TO_RETURN_VIA_REGISTERS 0 +#define PPC_MOST_FLOAT_STRUCT_MEMBERS_TO_RETURN_VIA_REGISTERS 0 +#define PPC_PASS_SMALL_FLOAT_STRUCTS_IN_FR_REGS 0 +#define PPC_RETURN_SMALL_FLOAT_STRUCTS_IN_FR_REGS 0 +#define PPC_RETURN_SMALL_STRUCTS_IN_REGS 0 +#define MONO_ARCH_HAVE_DECOMPOSE_VTYPE_OPTS 0 +#define MONO_ARCH_RETURN_CAN_USE_MULTIPLE_REGISTERS 0 +//#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1 +#define PPC_MINIMAL_PARAM_AREA_SIZE 64 +#define PPC_LAST_FPARG_REG ppc_f13 +#define PPC_PASS_STRUCTS_BY_VALUE 1 +#define PPC_THREAD_PTR_REG ppc_r13 +#define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1 +#define PPC_FIRST_ARG_REG ppc_r3 +#define PPC_LAST_ARG_REG ppc_r10 +#define PPC_FIRST_FPARG_REG ppc_f1 #else /* Linux */ #ifdef __mono_ppc64__ @@ -332,7 +363,8 @@ extern guint8* mono_ppc_create_pre_code_ftnptr (guint8 *code); #define UCONTEXT_REG_FPRn(ctx, n) #define UCONTEXT_REG_NIP(ctx) #define UCONTEXT_REG_LNK(ctx) - +#elif defined (_AIX) +#define MONO_ARCH_USE_SIGACTION 1 #else /* For other operating systems, we pull the definition from an external file */ #include "mini-ppc-os.h" diff --git a/mono/mini/mini-profiler.c b/mono/mini/mini-profiler.c index 4fdf12918e..c05660e751 100644 --- a/mono/mini/mini-profiler.c +++ b/mono/mini/mini-profiler.c @@ -236,9 +236,9 @@ mini_profiler_context_get_argument (MonoProfilerCallContext *ctx, guint32 pos) gpointer mini_profiler_context_get_local (MonoProfilerCallContext *ctx, guint32 pos) { - MonoError error; - MonoMethodHeader *header = mono_method_get_header_checked (ctx->method, &error); - mono_error_assert_ok (&error); // Must be a valid method at this point. + ERROR_DECL (error); + MonoMethodHeader *header = mono_method_get_header_checked (ctx->method, error); + mono_error_assert_ok (error); // Must be a valid method at this point. if (pos >= header->num_locals) { mono_metadata_free_mh (header); diff --git a/mono/mini/mini-runtime.c.REMOVED.git-id b/mono/mini/mini-runtime.c.REMOVED.git-id index 34746a90ab..620db05d50 100644 --- a/mono/mini/mini-runtime.c.REMOVED.git-id +++ b/mono/mini/mini-runtime.c.REMOVED.git-id @@ -1 +1 @@ -9bdd6b5b7f9581d202295705465ed680495f6d2f \ No newline at end of file +bf3d8b37974e590dfaa3878724c9ff2a8945448b \ No newline at end of file diff --git a/mono/mini/mini-runtime.h b/mono/mini/mini-runtime.h index c4dcd503f6..835f77400c 100644 --- a/mono/mini/mini-runtime.h +++ b/mono/mini/mini-runtime.h @@ -13,6 +13,7 @@ #define __MONO_MINI_RUNTIME_H__ #include "mini.h" +#include "ee.h" /* Per-domain information maintained by the JIT */ typedef struct @@ -72,13 +73,13 @@ struct MonoJitTlsData { guint32 stack_size; MonoLMF *lmf; MonoLMF *first_lmf; - gpointer restore_stack_prot; - guint32 handling_stack_ovf; + guint handling_stack_ovf : 1; gpointer signal_stack; guint32 signal_stack_size; gpointer stack_ovf_guard_base; guint32 stack_ovf_guard_size; guint stack_ovf_valloced : 1; + guint stack_ovf_pending : 1; void (*abort_func) (MonoObject *object); /* Used to implement --debug=casts */ MonoClass *class_cast_from, *class_cast_to; @@ -152,18 +153,199 @@ typedef struct { gpointer interp_exit_data; } MonoLMFExt; +typedef struct { + gboolean handle_sigint; + gboolean keep_delegates; + gboolean reverse_pinvoke_exceptions; + gboolean collect_pagefault_stats; + gboolean break_on_unverified; + gboolean better_cast_details; + gboolean mdb_optimizations; + gboolean no_gdb_backtrace; + gboolean suspend_on_native_crash; + gboolean suspend_on_exception; + gboolean suspend_on_unhandled; + gboolean dyn_runtime_invoke; + gboolean gdb; + gboolean lldb; + gboolean use_fallback_tls; + /* + * Whenever data such as next sequence points and flags is required. + * Next sequence points and flags are required by the debugger agent. + */ + gboolean gen_sdb_seq_points; + gboolean no_seq_points_compact_data; + /* + * Setting single_imm_size should guarantee that each time managed code is compiled + * the same instructions and registers are used, regardless of the size of used values. + */ + gboolean single_imm_size; + gboolean explicit_null_checks; + /* + * Fill stack frames with 0x2a in method prologs. This helps with the + * debugging of the stack marking code in the GC. + */ + gboolean init_stacks; + + /* + * Whenever to implement single stepping and breakpoints without signals in the + * soft debugger. This is useful on platforms without signals, like the ps3, or during + * runtime debugging, since it avoids SIGSEGVs when a single step location or breakpoint + * is hit. + */ + gboolean soft_breakpoints; + /* + * Whenever to break in the debugger using G_BREAKPOINT on unhandled exceptions. + */ + gboolean break_on_exc; + /* + * Load AOT JIT info eagerly. + */ + gboolean load_aot_jit_info_eagerly; + /* + * Check for pinvoke calling convention mismatches. + */ + gboolean check_pinvoke_callconv; + /* + * Translate Debugger.Break () into a native breakpoint signal + */ + gboolean native_debugger_break; + /* + * Disabling the frame pointer emit optimization can allow debuggers to more easily + * identify the stack on some platforms + */ + gboolean disable_omit_fp; +} MonoDebugOptions; + + +/* + * We need to store the image which the token refers to along with the token, + * since the image might not be the same as the image of the method which + * contains the relocation, because of inlining. + */ +typedef struct MonoJumpInfoToken { + MonoImage *image; + guint32 token; + gboolean has_context; + MonoGenericContext context; +} MonoJumpInfoToken; + +typedef struct MonoJumpInfoBBTable { + MonoBasicBlock **table; + int table_size; +} MonoJumpInfoBBTable; + +/* Contains information describing an LLVM IMT trampoline */ +typedef struct MonoJumpInfoImtTramp { + MonoMethod *method; + int vt_offset; +} MonoJumpInfoImtTramp; + +/* + * Contains information for computing the + * property given by INFO_TYPE of the runtime + * object described by DATA. + */ +struct MonoJumpInfoRgctxEntry { + MonoMethod *method; + gboolean in_mrgctx; + MonoJumpInfo *data; /* describes the data to be loaded */ + MonoRgctxInfoType info_type; +}; + +/* Contains information about a gsharedvt call */ +struct MonoJumpInfoGSharedVtCall { + /* The original signature of the call */ + MonoMethodSignature *sig; + /* The method which is called */ + MonoMethod *method; +}; + +/* + * Represents the method which is called when a virtual call is made to METHOD + * on a receiver of type KLASS. + */ +typedef struct { + /* Receiver class */ + MonoClass *klass; + /* Virtual method */ + MonoMethod *method; +} MonoJumpInfoVirtMethod; + +struct MonoJumpInfo { + MonoJumpInfo *next; + /* Relocation type for patching */ + int relocation; + union { + int i; + guint8 *p; + MonoInst *label; + } ip; + + MonoJumpInfoType type; + union { + gconstpointer target; +#if SIZEOF_VOID_P == 8 + gint64 offset; +#else + int offset; +#endif + int index; + MonoBasicBlock *bb; + MonoInst *inst; + MonoMethod *method; + MonoClass *klass; + MonoClassField *field; + MonoImage *image; + MonoVTable *vtable; + const char *name; + MonoJumpInfoToken *token; + MonoJumpInfoBBTable *table; + MonoJumpInfoRgctxEntry *rgctx_entry; + MonoJumpInfoImtTramp *imt_tramp; + MonoJumpInfoGSharedVtCall *gsharedvt; + MonoGSharedVtMethodInfo *gsharedvt_method; + MonoMethodSignature *sig; + MonoDelegateClassMethodPair *del_tramp; + /* MONO_PATCH_INFO_VIRT_METHOD */ + MonoJumpInfoVirtMethod *virt_method; + } data; +}; + +extern gboolean mono_break_on_exc; +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; +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; +extern const char* mono_interp_opts_string; +extern gboolean mono_do_single_method_regression; +extern guint32 mono_single_method_regression_opt; +extern MonoMethod *mono_current_single_method; +extern GSList *mono_single_method_list; +extern GHashTable *mono_single_method_hash; +extern GList* mono_aot_paths; +extern MonoDebugOptions debug_options; + +static inline MonoMethod* +jinfo_get_method (MonoJitInfo *ji) +{ + return mono_jit_info_get_method (ji); +} + /* main function */ MONO_API int mono_main (int argc, char* argv[]); MONO_API void mono_set_defaults (int verbose_level, guint32 opts); MONO_API void mono_parse_env_options (int *ref_argc, char **ref_argv []); MONO_API char *mono_parse_options_from (const char *options, int *ref_argc, char **ref_argv []); -/* actual definition in interp.h */ -typedef struct _MonoInterpCallbacks MonoInterpCallbacks; - void mono_interp_stub_init (void); -void mini_install_interp_callbacks (MonoInterpCallbacks *cbs); -MonoInterpCallbacks* mini_get_interp_callbacks (void); +void mini_install_interp_callbacks (MonoEECallbacks *cbs); +MonoEECallbacks* mini_get_interp_callbacks (void); MonoDomain* mini_init (const char *filename, const char *runtime_version); void mini_cleanup (MonoDomain *domain); @@ -187,5 +369,115 @@ MonoJitTlsData* mono_get_jit_tls (void); MONO_API 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); +gpointer mono_create_ftnptr (MonoDomain *domain, gpointer addr); +gconstpointer mono_icall_get_wrapper (MonoJitICallInfo* callinfo) MONO_LLVM_INTERNAL; +gconstpointer mono_icall_get_wrapper_full (MonoJitICallInfo* callinfo, gboolean do_compile); + +MonoJumpInfo* mono_patch_info_dup_mp (MonoMemPool *mp, MonoJumpInfo *patch_info); +guint mono_patch_info_hash (gconstpointer data); +gint mono_patch_info_equal (gconstpointer ka, gconstpointer kb); +MonoJumpInfo *mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJumpInfoType type, gconstpointer target); +MonoJumpInfoToken* mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token); +MonoJumpInfoToken* mono_jump_info_token_new2 (MonoMemPool *mp, MonoImage *image, guint32 token, MonoGenericContext *context); +gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error) MONO_LLVM_INTERNAL; +gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji); +gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method); +gpointer mono_jit_compile_method (MonoMethod *method, MonoError *error); +gpointer mono_jit_compile_method_jit_only (MonoMethod *method, MonoError *error); + +void mono_set_bisect_methods (guint32 opt, const char *method_list_filename); +guint32 mono_get_optimizations_for_method (MonoMethod *method, guint32 default_opt); +char* mono_opt_descr (guint32 flags); +void mono_set_verbose_level (guint32 level); +const char*mono_ji_type_to_string (MonoJumpInfoType type) MONO_LLVM_INTERNAL; +void mono_print_ji (const MonoJumpInfo *ji); +MONO_API void mono_print_method_from_ip (void *ip); +MONO_API char *mono_pmip (void *ip); +MONO_API int mono_ee_api_version (void); +gboolean mono_debug_count (void); + +#ifdef __linux__ +#define XDEBUG_ENABLED 1 +#endif + +#ifdef __linux__ +/* maybe enable also for other systems? */ +#define ENABLE_JIT_MAP 1 +void mono_enable_jit_map (void); +void mono_emit_jit_map (MonoJitInfo *jinfo); +void mono_emit_jit_tramp (void *start, int size, const char *desc); +gboolean mono_jit_map_is_enabled (void); +#else +#define mono_enable_jit_map() +#define mono_emit_jit_map(ji) +#define mono_emit_jit_tramp(s,z,d) +#define mono_jit_map_is_enabled() (0) +#endif + +/* + * 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_cross_helpers_run (void); + +/* + * Signal handling + */ + +#if defined(DISABLE_HW_TRAPS) || defined(MONO_ARCH_DISABLE_HW_TRAPS) + // Signal handlers not available +#define MONO_ARCH_NEED_DIV_CHECK 1 +#endif + +void MONO_SIG_HANDLER_SIGNATURE (mono_sigfpe_signal_handler) ; +void MONO_SIG_HANDLER_SIGNATURE (mono_sigill_signal_handler) ; +void MONO_SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler); +void MONO_SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler) ; +gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal); + +#ifdef MONO_ARCH_VARARG_ICALLS +#define ARCH_VARARG_ICALLS 1 +#else +#define ARCH_VARARG_ICALLS 0 +#endif + +#if defined (HOST_WASM) + +#define MONO_RETURN_ADDRESS_N(N) NULL +#define MONO_RETURN_ADDRESS() MONO_RETURN_ADDRESS_N(0) + + +#elif defined (__GNUC__) + +#define MONO_RETURN_ADDRESS_N(N) (__builtin_extract_return_addr (__builtin_return_address (N))) +#define MONO_RETURN_ADDRESS() MONO_RETURN_ADDRESS_N(0) + +#elif defined(_MSC_VER) + +#include +#pragma intrinsic(_ReturnAddress) + +#define MONO_RETURN_ADDRESS() _ReturnAddress() +#define MONO_RETURN_ADDRESS_N(N) NULL + +#else + +#error "Missing return address intrinsics implementation" + +#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 e1182548f1..45dd3fdbf8 100644 --- a/mono/mini/mini-s390x.c.REMOVED.git-id +++ b/mono/mini/mini-s390x.c.REMOVED.git-id @@ -1 +1 @@ -50a772b706425ec63334dacb8ae4459a31cead4c \ No newline at end of file +3fcadb7fe332842cfd9dea6e608e9500e4c5a716 \ 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 6847342f8d..0e1d1a11d2 100644 --- a/mono/mini/mini-sparc.c.REMOVED.git-id +++ b/mono/mini/mini-sparc.c.REMOVED.git-id @@ -1 +1 @@ -70199878e07843fb719533268bcdefe25345d705 \ No newline at end of file +bed8228bf24fd206d6134255110f548ddc9984a4 \ No newline at end of file diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c index 9558c91325..b4e31d35ba 100644 --- a/mono/mini/mini-trampolines.c +++ b/mono/mini/mini-trampolines.c @@ -688,7 +688,8 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable * actual_method = mono_class_inflate_generic_method_checked (declaring, &context, error); mono_error_assert_ok (error); } else { - actual_method = mono_class_get_method_generic (klass, m); + actual_method = mono_class_get_method_generic (klass, m, error); + mono_error_assert_ok (error); } g_assert (klass); @@ -835,7 +836,7 @@ gpointer mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp) { gpointer res; - MonoError error; + ERROR_DECL (error); MONO_REQ_GC_UNSAFE_MODE; @@ -843,9 +844,9 @@ mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp) UnlockedIncrement (&trampoline_calls); - res = common_call_trampoline (regs, code, (MonoMethod *)arg, NULL, NULL, &error); - if (!is_ok (&error)) { - mono_error_set_pending_exception (&error); + res = common_call_trampoline (regs, code, (MonoMethod *)arg, NULL, NULL, error); + if (!is_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } @@ -866,7 +867,7 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp) MonoVTable *vt; gpointer *vtable_slot; MonoMethod *m; - MonoError error; + ERROR_DECL (error); gpointer addr, res = NULL; UnlockedIncrement (&trampoline_calls); @@ -892,8 +893,8 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp) vtable_slot = &(vt->vtable [slot]); /* Avoid loading metadata or creating a generic vtable if possible */ - addr = mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, slot, &error); - goto_if_nok (&error, leave); + addr = mono_aot_get_method_from_vt_slot (mono_domain_get (), vt, slot, error); + goto_if_nok (error, leave); if (addr && !vt->klass->valuetype) { if (mono_domain_owns_vtable_slot (mono_domain_get (), vtable_slot)) *vtable_slot = addr; @@ -922,10 +923,10 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp) m = NULL; } - res = common_call_trampoline (regs, code, m, vt, vtable_slot, &error); + res = common_call_trampoline (regs, code, m, vt, vtable_slot, error); leave: - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } return res; @@ -937,7 +938,7 @@ mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMetho { MONO_REQ_GC_UNSAFE_MODE; - MonoError error; + ERROR_DECL (error); MonoGenericContext context = { NULL, NULL }; MonoMethod *imt_method, *declaring; gpointer addr; @@ -959,13 +960,17 @@ mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMetho imt_method = mono_arch_find_imt_method (regs, code); if (imt_method->is_inflated) context.method_inst = ((MonoMethodInflated*)imt_method)->context.method_inst; - m = mono_class_inflate_generic_method_checked (declaring, &context, &error); - g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */; - m = mono_marshal_get_remoting_invoke_with_check (m); + m = mono_class_inflate_generic_method_checked (declaring, &context, error); + g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */; + m = mono_marshal_get_remoting_invoke_with_check (m, error); + if (!is_ok (error)) { + mono_error_set_pending_exception (error); + return NULL; + } - addr = mono_jit_compile_method (m, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + addr = mono_jit_compile_method (m, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } g_assert (addr); @@ -992,7 +997,7 @@ mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, MonoMethod *method = NULL; gpointer addr; guint8 *plt_entry; - MonoError error; + ERROR_DECL (error); UnlockedIncrement (&trampoline_calls); @@ -1000,13 +1005,13 @@ mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info, token_info += sizeof (gpointer); token = *(guint32*)(gpointer)token_info; - addr = mono_aot_get_method_from_token (mono_domain_get (), image, token, &error); - if (!is_ok (&error)) - mono_error_cleanup (&error); + addr = mono_aot_get_method_from_token (mono_domain_get (), image, token, error); + if (!is_ok (error)) + mono_error_cleanup (error); if (!addr) { - method = mono_get_method_checked (image, token, NULL, NULL, &error); + method = mono_get_method_checked (image, token, NULL, NULL, error); if (!method) - g_error ("Could not load AOT trampoline due to %s", mono_error_get_message (&error)); + g_error ("Could not load AOT trampoline due to %s", mono_error_get_message (error)); /* Use the generic code */ return mono_magic_trampoline (regs, code, method, tramp); @@ -1036,14 +1041,14 @@ mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module, guint32 plt_info_offset = mono_aot_get_plt_info_offset (regs, code); gpointer res; - MonoError error; + ERROR_DECL (error); UnlockedIncrement (&trampoline_calls); - res = mono_aot_plt_resolve (aot_module, plt_info_offset, code, &error); + res = mono_aot_plt_resolve (aot_module, plt_info_offset, code, error); if (!res) { - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } // FIXME: Error handling (how ?) @@ -1064,18 +1069,18 @@ mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, gu gpointer arg = (gpointer)(gssize)r [MONO_ARCH_VTABLE_REG]; guint32 index = MONO_RGCTX_SLOT_INDEX (slot); gboolean mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot); - MonoError error; + ERROR_DECL (error); gpointer res; UnlockedIncrement (&trampoline_calls); UnlockedIncrement (&rgctx_unmanaged_lookups); if (mrgctx) - res = mono_method_fill_runtime_generic_context ((MonoMethodRuntimeGenericContext *)arg, index, &error); + res = mono_method_fill_runtime_generic_context ((MonoMethodRuntimeGenericContext *)arg, index, error); else - res = mono_class_fill_runtime_generic_context ((MonoVTable *)arg, index, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + res = mono_class_fill_runtime_generic_context ((MonoVTable *)arg, index, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } return res; @@ -1097,7 +1102,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr MonoJitInfo *ji; MonoMethod *m; MonoMethod *method = NULL; - MonoError error; + ERROR_DECL (error); gboolean multicast, callvirt = FALSE, closed_over_null = FALSE; gboolean need_rgctx_tramp = FALSE; gboolean need_unbox_tramp = FALSE; @@ -1106,7 +1111,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr MonoMethod *invoke = tramp_info->invoke; guint8 *impl_this = (guint8 *)tramp_info->impl_this; guint8 *impl_nothis = (guint8 *)tramp_info->impl_nothis; - MonoError err; + ERROR_DECL_VALUE (err); MonoMethodSignature *sig; gpointer addr, compiled_method; gboolean is_remote = FALSE; @@ -1130,11 +1135,16 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr #ifndef DISABLE_REMOTING if (delegate->target && mono_object_is_transparent_proxy (delegate->target)) { is_remote = TRUE; + error_init (&err); #ifndef DISABLE_COM if (((MonoTransparentProxy *)delegate->target)->remote_class->proxy_class != mono_class_get_com_object_class () && !mono_class_is_com_object (((MonoTransparentProxy *)delegate->target)->remote_class->proxy_class)) #endif - method = mono_marshal_get_remoting_invoke (method); + method = mono_marshal_get_remoting_invoke (method, &err); + if (!is_ok (&err)) { + mono_error_set_pending_exception (&err); + return NULL; + } } #endif if (!is_remote) { @@ -1228,9 +1238,9 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr if (enable_caching && delegate->method_code && *delegate->method_code) { delegate->method_ptr = *delegate->method_code; } else { - compiled_method = addr = mono_jit_compile_method (method, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + compiled_method = addr = mono_jit_compile_method (method, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } addr = mini_add_method_trampoline (method, compiled_method, need_rgctx_tramp, need_unbox_tramp); @@ -1258,9 +1268,9 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr if (!code) { /* The general, unoptimized case */ m = mono_marshal_get_delegate_invoke (invoke, delegate); - code = (guint8 *)mono_jit_compile_method (m, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); + code = (guint8 *)mono_jit_compile_method (m, error); + if (!mono_error_ok (error)) { + mono_error_set_pending_exception (error); return NULL; } code = (guint8 *)mini_add_method_trampoline (m, code, mono_method_needs_static_rgctx_invoke (m, FALSE), FALSE); @@ -1298,8 +1308,6 @@ mono_get_trampoline_func (MonoTrampolineType tramp_type) #endif case MONO_TRAMPOLINE_DELEGATE: return mono_delegate_trampoline; - case MONO_TRAMPOLINE_RESTORE_STACK_PROT: - return mono_altstack_restore_prot; #ifndef DISABLE_REMOTING case MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING: return mono_generic_virtual_remoting_trampoline; @@ -1340,7 +1348,6 @@ mono_trampolines_init (void) mono_trampoline_code [MONO_TRAMPOLINE_AOT_PLT] = create_trampoline_code (MONO_TRAMPOLINE_AOT_PLT); #endif mono_trampoline_code [MONO_TRAMPOLINE_DELEGATE] = create_trampoline_code (MONO_TRAMPOLINE_DELEGATE); - mono_trampoline_code [MONO_TRAMPOLINE_RESTORE_STACK_PROT] = create_trampoline_code (MONO_TRAMPOLINE_RESTORE_STACK_PROT); #ifndef DISABLE_REMOTING mono_trampoline_code [MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING] = create_trampoline_code (MONO_TRAMPOLINE_GENERIC_VIRTUAL_REMOTING); #endif @@ -1531,7 +1538,7 @@ MonoDelegateTrampInfo* mono_create_delegate_trampoline_info (MonoDomain *domain, MonoClass *klass, MonoMethod *method) { MonoMethod *invoke; - MonoError error; + ERROR_DECL (error); MonoDelegateTrampInfo *tramp_info; MonoClassMethodPair pair, *dpair; guint32 code_size = 0; @@ -1554,8 +1561,8 @@ mono_create_delegate_trampoline_info (MonoDomain *domain, MonoClass *klass, Mono tramp_info->impl_nothis = mono_arch_get_delegate_invoke_impl (mono_method_signature (invoke), FALSE); tramp_info->method = method; if (method) { - error_init (&error); - tramp_info->sig = mono_method_signature_checked (method, &error); + error_init (error); + tramp_info->sig = mono_method_signature_checked (method, error); tramp_info->need_rgctx_tramp = mono_method_needs_static_rgctx_invoke (method, FALSE); } tramp_info->invoke_impl = mono_create_specific_trampoline (tramp_info, MONO_TRAMPOLINE_DELEGATE, domain, &code_size); @@ -1660,7 +1667,6 @@ static const char*tramp_names [MONO_TRAMPOLINE_NUM] = { "aot", "aot_plt", "delegate", - "restore_stack_prot", "generic_virtual_remoting", "vcall" }; diff --git a/mono/mini/mini-wasm.h b/mono/mini/mini-wasm.h index 55adab22da..e4f76af6f0 100644 --- a/mono/mini/mini-wasm.h +++ b/mono/mini/mini-wasm.h @@ -45,4 +45,7 @@ typedef struct { #define MONO_ARCH_IMT_REG WASM_REG_0 #define MONO_ARCH_RGCTX_REG WASM_REG_0 +/* must be at a power of 2 and >= 8 */ +#define MONO_ARCH_FRAME_ALIGNMENT 16 + #endif /* __MONO_MINI_WASM_H__ */ diff --git a/mono/mini/mini-x86.c.REMOVED.git-id b/mono/mini/mini-x86.c.REMOVED.git-id index c777a92a35..df9aaaf8af 100644 --- a/mono/mini/mini-x86.c.REMOVED.git-id +++ b/mono/mini/mini-x86.c.REMOVED.git-id @@ -1 +1 @@ -314981bce62292084e45e21dead2cc906ba35805 \ No newline at end of file +7f79e2fdba6c8fb8406d80cb5d8554af451ee962 \ No newline at end of file diff --git a/mono/mini/mini-x86.h b/mono/mini/mini-x86.h index 3cf44a06b4..b7de33748f 100644 --- a/mono/mini/mini-x86.h +++ b/mono/mini/mini-x86.h @@ -78,7 +78,6 @@ LONG CALLBACK seh_handler(EXCEPTION_POINTERS* ep); #else #define MONO_ARCH_SIGNAL_STACK_SIZE (16 * 1024) #endif -#define MONO_ARCH_HAVE_RESTORE_STACK_SUPPORT 1 #define MONO_ARCH_CPU_SPEC mono_x86_desc diff --git a/mono/mini/mini.c.REMOVED.git-id b/mono/mini/mini.c.REMOVED.git-id index 5853021f02..a55d7f5538 100644 --- a/mono/mini/mini.c.REMOVED.git-id +++ b/mono/mini/mini.c.REMOVED.git-id @@ -1 +1 @@ -af642c20307dbff5cb4f53ca18e050e56fb26cb4 \ No newline at end of file +9956fa202cdd0264f9863369cd02938b3ce0549e \ 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 c9b89dae15..cc7077744a 100644 --- a/mono/mini/mini.h.REMOVED.git-id +++ b/mono/mini/mini.h.REMOVED.git-id @@ -1 +1 @@ -7de8e2236f0d81e755b21d9c55136ca3e4bb5631 \ No newline at end of file +042034c359ca78e6a61e590e4c9456e78cb4a5bb \ No newline at end of file diff --git a/mono/mini/objects.cs b/mono/mini/objects.cs index e0cea4e8ba..d873b6e784 100644 --- a/mono/mini/objects.cs +++ b/mono/mini/objects.cs @@ -1848,6 +1848,30 @@ ncells ) { return t == -122 ? 0 : 1; } + + public interface IFoo + { + int MyInt { get; } + } + + public class IFooImpl : IFoo + { + public int MyInt => 0; + } + + //gh 6266 + public static int test_0_store_to_magic_iface_array () + { + ICollection arr1 = new IFooImpl[1] { new IFooImpl() }; + ICollection arr2 = new IFooImpl[1] { new IFooImpl() }; + + ICollection[] a2d = new ICollection[2] { + arr1, + arr2, + }; + + return 0; + } } #if __MOBILE__ diff --git a/mono/mini/simd-intrinsics.c b/mono/mini/simd-intrinsics.c index 92d7a4eb56..01530aa55a 100644 --- a/mono/mini/simd-intrinsics.c +++ b/mono/mini/simd-intrinsics.c @@ -2038,10 +2038,10 @@ static void assert_handled (MonoCompile *cfg, MonoMethod *method) { MonoCustomAttrInfo *cattr; - MonoError error; + ERROR_DECL (error); if (cfg->verbose_level > 1) { - cattr = mono_custom_attrs_from_method_checked (method, &error); + cattr = mono_custom_attrs_from_method_checked (method, error); if (cattr) { gboolean has_attr = FALSE; @@ -2081,6 +2081,9 @@ emit_vector_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignatu MonoMethodSignature *sig = mono_method_signature (cmethod); MonoType *type = &cmethod->klass->byval_arg; + if (!cmethod->klass->simd_type) + return NULL; + /* * Vector2/3/4 are handled the same way, since the underlying SIMD type is the same (4 * r4). */ diff --git a/mono/mini/ssa.c b/mono/mini/ssa.c index b4dc2bf65d..187ac213f3 100644 --- a/mono/mini/ssa.c +++ b/mono/mini/ssa.c @@ -19,6 +19,7 @@ #ifndef DISABLE_JIT #include "mini.h" +#include "mini-runtime.h" #ifdef HAVE_ALLOCA_H #include #endif diff --git a/mono/mini/tasklets.c b/mono/mini/tasklets.c index 7a980a553f..9ade74f6df 100644 --- a/mono/mini/tasklets.c +++ b/mono/mini/tasklets.c @@ -113,7 +113,7 @@ continuation_store (MonoContinuation *cont, int state, MonoException **e) mono_gc_free_fixed (cont->saved_stack); cont->stack_used_size = num_bytes; cont->stack_alloc_size = num_bytes * 1.1; - cont->saved_stack = mono_gc_alloc_fixed (cont->stack_alloc_size, NULL, MONO_ROOT_SOURCE_THREADING, "saved tasklet stack"); + cont->saved_stack = mono_gc_alloc_fixed (cont->stack_alloc_size, NULL, MONO_ROOT_SOURCE_THREADING, NULL, "Tasklet Saved Stack"); tasklets_unlock (); } memcpy (cont->saved_stack, cont->return_sp, num_bytes); diff --git a/mono/mini/trace.c b/mono/mini/trace.c index a45c562d17..fb6ad1ccf5 100644 --- a/mono/mini/trace.c +++ b/mono/mini/trace.c @@ -20,6 +20,7 @@ #endif #include #include "mini.h" +#include "mini-runtime.h" #include #include #include @@ -86,17 +87,17 @@ static char * string_to_utf8 (MonoString *s) { char *as; - GError *error = NULL; + GError *gerror = NULL; g_assert (s); if (!s->length) return g_strdup (""); - as = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, NULL, &error); - if (error) { + as = g_utf16_to_utf8 (mono_string_chars (s), s->length, NULL, NULL, &gerror); + if (gerror) { /* Happens with StringBuilders */ - g_error_free (error); + g_error_free (gerror); return g_strdup (""); } else diff --git a/mono/mini/tramp-amd64.c b/mono/mini/tramp-amd64.c index a9d913beee..8dc1155023 100644 --- a/mono/mini/tramp-amd64.c +++ b/mono/mini/tramp-amd64.c @@ -363,7 +363,11 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf } for (i = 0; i < AMD64_XMM_NREG; ++i) if (AMD64_IS_ARGUMENT_XREG (i)) +#if defined(MONO_HAVE_SIMD_REG) amd64_movdqu_membase_reg (code, AMD64_RBP, saved_fpregs_offset + (i * sizeof(MonoContextSimdReg)), i); +#else + amd64_movsd_membase_reg (code, AMD64_RBP, saved_fpregs_offset + (i * sizeof(double)), i); +#endif /* Check that the stack is aligned */ amd64_mov_reg_reg (code, AMD64_R11, AMD64_RSP, sizeof (mgreg_t)); @@ -540,7 +544,11 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf amd64_mov_reg_membase (code, i, AMD64_RBP, saved_regs_offset + (i * sizeof(mgreg_t)), sizeof(mgreg_t)); for (i = 0; i < AMD64_XMM_NREG; ++i) if (AMD64_IS_ARGUMENT_XREG (i)) +#if defined(MONO_HAVE_SIMD_REG) amd64_movdqu_reg_membase (code, i, AMD64_RBP, saved_fpregs_offset + (i * sizeof(MonoContextSimdReg))); +#else + amd64_movsd_reg_membase (code, i, AMD64_RBP, saved_fpregs_offset + (i * sizeof(double))); +#endif /* Restore stack */ #if TARGET_WIN32 @@ -918,96 +926,69 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } /* - * mono_arch_get_enter_icall_trampoline: + * mono_arch_get_interp_to_native_trampoline: * * A trampoline that handles the transition from interpreter into native - * world. It requiers to set up a descriptor (InterpMethodArguments), so the + * world. It requires to set up a descriptor (CallContext), so the * trampoline can translate the arguments into the native calling convention. - * - * See also `build_args_from_sig ()` in interp.c. */ gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { #ifndef DISABLE_INTERPRETER - guint8 *start = NULL, *code, *label_gexits [INTERP_ICALL_TRAMP_IARGS], *label_fexits [INTERP_ICALL_TRAMP_FARGS], *label_leave_tramp [3], *label_is_float_ret; + guint8 *start = NULL, *code; + guint8 *label_start_copy, *label_exit_copy; MonoJumpInfo *ji = NULL; GSList *unwind_ops = NULL; - static int farg_regs[] = {AMD64_XMM0, AMD64_XMM1, AMD64_XMM2, AMD64_XMM3}; - int buf_len, i, framesize = 0, off_rbp, off_methodargs, off_targetaddr; + int buf_len, i, off_methodargs, off_targetaddr; - g_assert ((sizeof (farg_regs) / sizeof (farg_regs [0])) >= INTERP_ICALL_TRAMP_FARGS); buf_len = 512 + MONO_TRAMPOLINE_UNWINDINFO_SIZE(0); start = code = (guint8 *) mono_global_codeman_reserve (buf_len); - off_rbp = -framesize; - - framesize += sizeof (mgreg_t); - off_methodargs = -framesize; - - framesize += sizeof (mgreg_t); - off_targetaddr = -framesize; - - framesize += (INTERP_ICALL_TRAMP_IARGS - PARAM_REGS) * sizeof (mgreg_t); - amd64_push_reg (code, AMD64_RBP); amd64_mov_reg_reg (code, AMD64_RBP, AMD64_RSP, sizeof (mgreg_t)); - amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, ALIGN_TO (framesize, MONO_ARCH_FRAME_ALIGNMENT)); - /* save InterpMethodArguments* onto stack */ + /* allocate space for saving the target addr and the call context */ + amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, 2 * sizeof (mgreg_t)); + + /* save CallContext* onto stack */ + off_methodargs = - 8; amd64_mov_membase_reg (code, AMD64_RBP, off_methodargs, AMD64_ARG_REG2, sizeof (mgreg_t)); /* save target address on stack */ + off_targetaddr = - 2 * 8; amd64_mov_membase_reg (code, AMD64_RBP, off_targetaddr, AMD64_ARG_REG1, sizeof (mgreg_t)); - /* load pointer to InterpMethodArguments* into R11 */ - amd64_mov_reg_reg (code, AMD64_R11, AMD64_ARG_REG2, 8); - - /* move flen into RAX */ - amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, flen), sizeof (mgreg_t)); - /* load pointer to fargs into R11 */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, fargs), sizeof (mgreg_t)); - - for (i = 0; i < INTERP_ICALL_TRAMP_FARGS; ++i) { - amd64_test_reg_reg (code, AMD64_RAX, AMD64_RAX); - label_fexits [i] = code; - x86_branch8 (code, X86_CC_Z, 0, FALSE); - - amd64_sse_movsd_reg_membase (code, farg_regs [i], AMD64_R11, i * sizeof (double)); - amd64_dec_reg_size (code, AMD64_RAX, 1); - } - - for (i = 0; i < INTERP_ICALL_TRAMP_FARGS; i++) - x86_patch (label_fexits [i], code); - - /* load pointer to InterpMethodArguments* into R11 */ + /* load pointer to CallContext* into R11 */ amd64_mov_reg_reg (code, AMD64_R11, AMD64_ARG_REG2, sizeof (mgreg_t)); - /* move ilen into RAX */ - amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, ilen), sizeof (mgreg_t)); - int stack_offset = 0; - for (i = 0; i < INTERP_ICALL_TRAMP_IARGS; i++) { - amd64_test_reg_reg (code, AMD64_RAX, AMD64_RAX); - label_gexits [i] = code; - x86_branch32 (code, X86_CC_Z, 0, FALSE); + /* allocate the stack space necessary for the call */ + amd64_mov_reg_membase (code, AMD64_RAX, AMD64_R11, MONO_STRUCT_OFFSET (CallContext, stack_size), sizeof (mgreg_t)); + amd64_alu_reg_reg (code, X86_SUB, AMD64_RSP, AMD64_RAX); - /* load pointer to InterpMethodArguments* into R11 */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t)); - /* load pointer to iargs into R11 */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, iargs), sizeof (mgreg_t)); + /* copy stack from the CallContext, reg1 = dest, reg2 = source */ + amd64_mov_reg_reg (code, AMD64_ARG_REG1, AMD64_RSP, sizeof (mgreg_t)); + amd64_mov_reg_membase (code, AMD64_ARG_REG2, AMD64_R11, MONO_STRUCT_OFFSET (CallContext, stack), sizeof (mgreg_t)); - if (i < PARAM_REGS) { - amd64_mov_reg_membase (code, param_regs [i], AMD64_R11, i * sizeof (mgreg_t), sizeof (mgreg_t)); - } else { - amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, i * sizeof (mgreg_t), sizeof (mgreg_t)); - amd64_mov_membase_reg (code, AMD64_RSP, stack_offset, AMD64_R11, sizeof (mgreg_t)); - stack_offset += sizeof (mgreg_t); - } - amd64_dec_reg_size (code, AMD64_RAX, 1); - } + label_start_copy = code; + amd64_test_reg_reg (code, AMD64_RAX, AMD64_RAX); + label_exit_copy = code; + amd64_branch8 (code, X86_CC_Z, 0, FALSE); + amd64_mov_reg_membase (code, AMD64_ARG_REG3, AMD64_ARG_REG2, 0, sizeof (mgreg_t)); + amd64_mov_membase_reg (code, AMD64_ARG_REG1, 0, AMD64_ARG_REG3, sizeof (mgreg_t)); + amd64_alu_reg_imm (code, X86_ADD, AMD64_ARG_REG1, sizeof (mgreg_t)); + amd64_alu_reg_imm (code, X86_ADD, AMD64_ARG_REG2, sizeof (mgreg_t)); + amd64_alu_reg_imm (code, X86_SUB, AMD64_RAX, sizeof (mgreg_t)); + amd64_jump_code (code, label_start_copy); + x86_patch (label_exit_copy, code); - for (i = 0; i < INTERP_ICALL_TRAMP_IARGS; i++) - x86_patch (label_gexits [i], code); + /* set all general purpose registers from CallContext */ + for (i = 0; i < PARAM_REGS; i++) + amd64_mov_reg_membase (code, param_regs [i], AMD64_R11, MONO_STRUCT_OFFSET (CallContext, gregs) + param_regs [i] * sizeof (mgreg_t), sizeof (mgreg_t)); + + /* set all floating registers from CallContext */ + for (i = 0; i < FLOAT_PARAM_REGS; ++i) + amd64_sse_movsd_reg_membase (code, i, AMD64_R11, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); /* load target addr */ amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_targetaddr, sizeof (mgreg_t)); @@ -1015,50 +996,16 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) /* call into native function */ amd64_call_reg (code, AMD64_R11); - /* load InterpMethodArguments */ + /* save all return general purpose registers in the CallContext */ amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t)); + for (i = 0; i < RETURN_REGS; i++) + amd64_mov_membase_reg (code, AMD64_R11, MONO_STRUCT_OFFSET (CallContext, gregs) + return_regs [i] * sizeof (mgreg_t), return_regs [i], sizeof (mgreg_t)); - /* load is_float_ret */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, is_float_ret), sizeof (mgreg_t)); + /* save all return floating registers in the CallContext */ + for (i = 0; i < FLOAT_RETURN_REGS; i++) + amd64_sse_movsd_membase_reg (code, AMD64_R11, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double), i); - /* check if a float return value is expected */ - amd64_test_reg_reg (code, AMD64_R11, AMD64_R11); - - label_is_float_ret = code; - x86_branch8 (code, X86_CC_NZ, 0, FALSE); - - /* greg return */ - /* load InterpMethodArguments */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t)); - /* load retval */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, retval), sizeof (mgreg_t)); - - amd64_test_reg_reg (code, AMD64_R11, AMD64_R11); - label_leave_tramp [0] = code; - x86_branch8 (code, X86_CC_Z, 0, FALSE); - - amd64_mov_membase_reg (code, AMD64_R11, 0, AMD64_RAX, sizeof (mgreg_t)); - - label_leave_tramp [1] = code; - x86_jump8 (code, 0); - - /* freg return */ - x86_patch (label_is_float_ret, code); - /* load InterpMethodArguments */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_RBP, off_methodargs, sizeof (mgreg_t)); - /* load retval */ - amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, MONO_STRUCT_OFFSET (InterpMethodArguments, retval), sizeof (mgreg_t)); - - amd64_test_reg_reg (code, AMD64_R11, AMD64_R11); - label_leave_tramp [2] = code; - x86_branch8 (code, X86_CC_Z, 0, FALSE); - - amd64_sse_movsd_membase_reg (code, AMD64_R11, 0, AMD64_XMM0); - - for (i = 0; i < 3; i++) - x86_patch (label_leave_tramp [i], code); - - amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, ALIGN_TO (framesize, MONO_ARCH_FRAME_ALIGNMENT)); + amd64_mov_reg_reg (code, AMD64_RSP, AMD64_RBP, 8); amd64_pop_reg (code, AMD64_RBP); amd64_ret (code); @@ -1068,7 +1015,7 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL)); if (info) - *info = mono_tramp_info_create ("enter_icall_trampoline", start, code - start, ji, unwind_ops); + *info = mono_tramp_info_create ("interp_to_native_trampoline", start, code - start, ji, unwind_ops); return start; #else @@ -1136,7 +1083,7 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/tramp-arm-gsharedvt.c b/mono/mini/tramp-arm-gsharedvt.c index 4e4334a2e9..c7f2e8b1f7 100644 --- a/mono/mini/tramp-arm-gsharedvt.c +++ b/mono/mini/tramp-arm-gsharedvt.c @@ -21,6 +21,7 @@ #include "mini.h" #include "mini-arm.h" +#include "mini-runtime.h" #define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) diff --git a/mono/mini/tramp-arm.c b/mono/mini/tramp-arm.c index 3dd655b8d4..7884f08767 100644 --- a/mono/mini/tramp-arm.c +++ b/mono/mini/tramp-arm.c @@ -814,149 +814,96 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } /* - * mono_arch_get_enter_icall_trampoline: + * mono_arch_get_interp_to_native_trampoline: * * See tramp-amd64.c for documentation. */ gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { #ifndef DISABLE_INTERPRETER - const int gregs_num = INTERP_ICALL_TRAMP_IARGS; - const int fregs_num = INTERP_ICALL_TRAMP_FARGS; - - guint8 *start = NULL, *code, *label_gexits [gregs_num], *label_fexits [fregs_num], *label_leave_tramp [3], *label_is_float_ret; + guint8 *start = NULL, *code; + guint8 *label_start_copy, *label_exit_copy; MonoJumpInfo *ji = NULL; GSList *unwind_ops = NULL; - int buf_len, i, framesize, off_methodargs, off_targetaddr; + int buf_len, i, off_methodargs, off_targetaddr; const int fp_reg = ARMREG_R7; + int framesize; buf_len = 512 + 1024; start = code = (guint8 *) mono_global_codeman_reserve (buf_len); - framesize = 5 * sizeof (mgreg_t); /* lr, r4, r8, r6 and plus one */ - - off_methodargs = -framesize; - framesize += sizeof (mgreg_t); - - off_targetaddr = -framesize; - framesize += sizeof (mgreg_t); - - framesize = ALIGN_TO (framesize + 4 * sizeof (mgreg_t), MONO_ARCH_FRAME_ALIGNMENT); - - /* allocate space on stack for argument passing */ - const int stack_space = ALIGN_TO (((gregs_num - ARMREG_R3) * sizeof (mgreg_t)), MONO_ARCH_FRAME_ALIGNMENT); - - /* iOS ABI */ - ARM_PUSH (code, (1 << fp_reg) | (1 << ARMREG_LR)); + /* + * iOS ABI + * + * FIXME We save rgctx reg here so we don't regress tests. It should + * not be clobbered by native->interp transition. + */ + ARM_PUSH (code, (1 << MONO_ARCH_RGCTX_REG) | (1 << fp_reg) | (1 << ARMREG_LR)); ARM_MOV_REG_REG (code, fp_reg, ARMREG_SP); - /* use r4, r8 and r6 as scratch registers */ - ARM_PUSH (code, (1 << ARMREG_R4) | (1 << ARMREG_R8) | (1 << ARMREG_R6)); - ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, stack_space + framesize); + /* 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); + ARM_SUB_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, framesize); - /* save InterpMethodArguments* onto stack */ + /* save CallContext* onto stack */ + off_methodargs = -4; ARM_STR_IMM (code, ARMREG_R1, fp_reg, off_methodargs); /* save target address onto stack */ + off_targetaddr = -8; ARM_STR_IMM (code, ARMREG_R0, fp_reg, off_targetaddr); - /* load pointer to InterpMethodArguments* into r4 */ - ARM_MOV_REG_REG (code, ARMREG_R4, ARMREG_R1); + /* allocate the stack space necessary for the call */ + ARM_LDR_IMM (code, ARMREG_R3, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack_size)); + ARM_SUB_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_R3); - /* move flen into r8 */ - ARM_LDR_IMM (code, ARMREG_R8, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, flen)); - /* load pointer to fargs into r6 */ - ARM_LDR_IMM (code, ARMREG_R6, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, fargs)); + /* copy stack from the CallContext, R0 = dest, R1 = source */ + ARM_MOV_REG_REG (code, ARMREG_R0, ARMREG_SP); + ARM_LDR_IMM (code, ARMREG_R1, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack)); - for (i = 0; i < fregs_num; ++i) { - ARM_CMP_REG_IMM (code, ARMREG_R8, 0, 0); - label_fexits [i] = code; - ARM_B_COND (code, ARMCOND_EQ, 0); + label_start_copy = code; - g_assert (i <= ARM_VFP_D7); /* otherwise, need to pass args on stack */ - ARM_FLDD (code, i, ARMREG_R6, i * sizeof (double)); - ARM_SUB_REG_IMM8 (code, ARMREG_R8, ARMREG_R8, 1); - } + ARM_CMP_REG_IMM (code, ARMREG_R3, 0, 0); + label_exit_copy = code; + 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_B (code, 0); + arm_patch (code - 4, label_start_copy); + arm_patch (label_exit_copy, code); - for (i = 0; i < fregs_num; i++) - arm_patch (label_fexits [i], code); + 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)); - /* move ilen into r8 */ - ARM_LDR_IMM (code, ARMREG_R8, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, ilen)); - /* load pointer to iargs into r6 */ - ARM_LDR_IMM (code, ARMREG_R6, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, iargs)); - - int stack_offset = 0; - for (i = 0; i < gregs_num; i++) { - ARM_CMP_REG_IMM (code, ARMREG_R8, 0, 0); - label_gexits [i] = code; - ARM_B_COND (code, ARMCOND_EQ, 0); - - if (i <= ARMREG_R3) { - ARM_LDR_IMM (code, i, ARMREG_R6, i * sizeof (mgreg_t)); - } else { - ARM_LDR_IMM (code, ARMREG_R4, ARMREG_R6, i * sizeof (mgreg_t)); - ARM_STR_IMM (code, ARMREG_R4, ARMREG_SP, stack_offset); - stack_offset += sizeof (mgreg_t); - } - ARM_SUB_REG_IMM8 (code, ARMREG_R8, ARMREG_R8, 1); - } - - for (i = 0; i < gregs_num; i++) - arm_patch (label_gexits [i], code); + /* set all floating registers from CallContext */ + for (i = 0; i < FP_PARAM_REGS; i++) + ARM_FLDD (code, i * 2, ARMREG_IP, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); /* load target addr */ - ARM_LDR_IMM (code, ARMREG_R4, fp_reg, off_targetaddr); + ARM_LDR_IMM (code, ARMREG_IP, fp_reg, off_targetaddr); /* call into native function */ - ARM_BLX_REG (code, ARMREG_R4); + ARM_BLX_REG (code, ARMREG_IP); - /* load InterpMethodArguments */ - ARM_LDR_IMM (code, ARMREG_R4, fp_reg, off_methodargs); + /* load CallContext*/ + ARM_LDR_IMM (code, ARMREG_IP, fp_reg, off_methodargs); - /* load is_float_ret */ - ARM_LDR_IMM (code, ARMREG_R8, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, is_float_ret)); + /* 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)); - /* check if a float return value is expected */ - ARM_CMP_REG_IMM (code, ARMREG_R8, 0, 0); - label_is_float_ret = code; - ARM_B_COND (code, ARMCOND_NE, 0); + /* set all floating registers to CallContext */ + for (i = 0; i < FP_PARAM_REGS; i++) + ARM_FSTD (code, i * 2, ARMREG_IP, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); - /* greg return */ - /* load retval */ - ARM_LDR_IMM (code, ARMREG_R8, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, retval)); - - ARM_CMP_REG_IMM (code, ARMREG_R8, 0, 0); - label_leave_tramp [0] = code; - ARM_B_COND (code, ARMCOND_EQ, 0); - - /* store greg result, always write back 64bit */ - ARM_STR_IMM (code, ARMREG_R0, ARMREG_R8, 0); - ARM_STR_IMM (code, ARMREG_R1, ARMREG_R8, 4); - - label_leave_tramp [1] = code; - ARM_B_COND (code, ARMCOND_AL, 0); - - /* freg return */ - arm_patch (label_is_float_ret, code); - /* load retval */ - ARM_LDR_IMM (code, ARMREG_R8, ARMREG_R4, MONO_STRUCT_OFFSET (InterpMethodArguments, retval)); - - ARM_CMP_REG_IMM (code, ARMREG_R8, 0, 0); - label_leave_tramp [2] = code; - ARM_B_COND (code, ARMCOND_EQ, 0); - - /* store freg result */ - ARM_FSTD (code, ARM_VFP_F0, ARMREG_R8, 0); - - for (i = 0; i < 3; i++) - arm_patch (label_leave_tramp [i], code); - - ARM_ADD_REG_IMM8 (code, ARMREG_SP, ARMREG_SP, stack_space + framesize); - ARM_POP (code, (1 << ARMREG_R4) | (1 << ARMREG_R8) | (1 << ARMREG_R6)); ARM_MOV_REG_REG (code, ARMREG_SP, fp_reg); - ARM_POP (code, (1 << fp_reg) | (1 << ARMREG_PC)); + ARM_POP (code, (1 << MONO_ARCH_RGCTX_REG) | (1 << fp_reg) | (1 << ARMREG_PC)); g_assert (code - start < buf_len); @@ -964,7 +911,7 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL)); if (info) - *info = mono_tramp_info_create ("enter_icall_trampoline", start, code - start, ji, unwind_ops); + *info = mono_tramp_info_create ("interp_to_native_trampoline", start, code - start, ji, unwind_ops); return start; #else @@ -1018,7 +965,7 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/tramp-arm64.c b/mono/mini/tramp-arm64.c index a46b26ae43..b7edddaad3 100644 --- a/mono/mini/tramp-arm64.c +++ b/mono/mini/tramp-arm64.c @@ -612,18 +612,16 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } /* - * mono_arch_get_enter_icall_trampoline: + * mono_arch_get_interp_to_native_trampoline: * * See tramp-amd64.c for documentation. */ gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { #ifndef DISABLE_INTERPRETER - const int gregs_num = INTERP_ICALL_TRAMP_IARGS; - const int fregs_num = INTERP_ICALL_TRAMP_FARGS; - - guint8 *start = NULL, *code, *label_gexits [gregs_num], *label_fexits [fregs_num], *label_leave_tramp [3], *label_is_float_ret; + guint8 *start = NULL, *code; + guint8 *label_start_copy, *label_exit_copy; MonoJumpInfo *ji = NULL; GSList *unwind_ops = NULL; int buf_len, i, framesize = 0, off_methodargs, off_targetaddr; @@ -631,7 +629,7 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) buf_len = 512 + 1024; start = code = (guint8 *) mono_global_codeman_reserve (buf_len); - /* save FP and LR */ + /* allocate frame */ framesize += 2 * sizeof (mgreg_t); off_methodargs = framesize; @@ -642,109 +640,66 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) framesize = ALIGN_TO (framesize, MONO_ARCH_FRAME_ALIGNMENT); - /* allocate space on stack for argument passing */ - const int stack_space = ALIGN_TO (((gregs_num - ARMREG_R7) * sizeof (mgreg_t)), MONO_ARCH_FRAME_ALIGNMENT); + arm_subx_imm (code, ARMREG_SP, ARMREG_SP, framesize); + arm_stpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, 0); + arm_movspx (code, ARMREG_FP, ARMREG_SP); - arm_subx_imm (code, ARMREG_SP, ARMREG_SP, stack_space + framesize); - arm_stpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, stack_space); - arm_addx_imm (code, ARMREG_FP, ARMREG_SP, stack_space); - - /* save InterpMethodArguments* onto stack */ + /* save CallContext* onto stack */ arm_strx (code, ARMREG_R1, ARMREG_FP, off_methodargs); /* save target address onto stack */ arm_strx (code, ARMREG_R0, ARMREG_FP, off_targetaddr); - /* load pointer to InterpMethodArguments* into IP0 */ - arm_movx (code, ARMREG_IP0, ARMREG_R1); + /* allocate the stack space necessary for the call */ + arm_ldrx (code, ARMREG_R0, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack_size)); + arm_movspx (code, ARMREG_IP0, ARMREG_SP); + arm_subx (code, ARMREG_IP0, ARMREG_IP0, ARMREG_R0); + arm_movspx (code, ARMREG_SP, ARMREG_IP0); - /* move flen into R9 */ - arm_ldrx (code, ARMREG_R9, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, flen)); - /* load pointer to fargs into R10 */ - arm_ldrx (code, ARMREG_R10, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, fargs)); + /* copy stack from the CallContext, IP0 = dest, IP1 = source */ + arm_movspx (code, ARMREG_IP0, ARMREG_SP); + arm_ldrx (code, ARMREG_IP1, ARMREG_R1, MONO_STRUCT_OFFSET (CallContext, stack)); - for (i = 0; i < fregs_num; ++i) { - arm_cmpx_imm (code, ARMREG_R9, 0); - label_fexits [i] = code; - arm_bcc (code, ARMCOND_EQ, 0); + label_start_copy = code; - g_assert (i <= ARMREG_D7); /* otherwise, need to pass args on stack */ - arm_ldrfpx (code, i, ARMREG_R10, i * sizeof (double)); - arm_subx_imm (code, ARMREG_R9, ARMREG_R9, 1); - } + arm_cmpx_imm (code, ARMREG_R0, 0); + label_exit_copy = code; + arm_bcc (code, ARMCOND_EQ, 0); + arm_ldrx (code, ARMREG_R2, ARMREG_IP1, 0); + arm_strx (code, ARMREG_R2, ARMREG_IP0, 0); + arm_addx_imm (code, ARMREG_IP0, ARMREG_IP0, sizeof (mgreg_t)); + arm_addx_imm (code, ARMREG_IP1, ARMREG_IP1, sizeof (mgreg_t)); + arm_subx_imm (code, ARMREG_R0, ARMREG_R0, sizeof (mgreg_t)); + arm_b (code, label_start_copy); + mono_arm_patch (label_exit_copy, code, MONO_R_ARM64_BCC); - for (i = 0; i < fregs_num; i++) - mono_arm_patch (label_fexits [i], code, MONO_R_ARM64_BCC); - - /* move ilen into R9 */ - arm_ldrx (code, ARMREG_R9, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, ilen)); - /* load pointer to iargs into R10 */ - arm_ldrx (code, ARMREG_R10, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, iargs)); - - int stack_offset = 0; - for (i = 0; i < gregs_num; i++) { - arm_cmpx_imm (code, ARMREG_R9, 0); - label_gexits [i] = code; - arm_bcc (code, ARMCOND_EQ, 0); - - if (i <= ARMREG_R7) { - arm_ldrx (code, i, ARMREG_R10, i * sizeof (mgreg_t)); - } else { - arm_ldrx (code, ARMREG_R11, ARMREG_R10, i * sizeof (mgreg_t)); - arm_strx (code, ARMREG_R11, ARMREG_SP, stack_offset); - stack_offset += sizeof (mgreg_t); - } - arm_subx_imm (code, ARMREG_R9, ARMREG_R9, 1); - } - - for (i = 0; i < gregs_num; i++) - mono_arm_patch (label_gexits [i], code, MONO_R_ARM64_BCC); - - /* load target addr */ - arm_ldrx (code, ARMREG_R11, ARMREG_FP, off_targetaddr); - - /* call into native function */ - arm_blrx (code, ARMREG_R11); - - /* load InterpMethodArguments */ + /* Load CallContext* into IP0 */ arm_ldrx (code, ARMREG_IP0, ARMREG_FP, off_methodargs); - /* load is_float_ret */ - arm_ldrx (code, ARMREG_R11, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, is_float_ret)); + /* set all general purpose registers from CallContext */ + for (i = 0; i < PARAM_REGS + 1; i++) + arm_ldrx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); - /* check if a float return value is expected */ - arm_cmpx_imm (code, ARMREG_R11, 0); - label_is_float_ret = code; - arm_bcc (code, ARMCOND_NE, 0); + /* set all floating registers from CallContext */ + for (i = 0; i < FP_PARAM_REGS; i++) + arm_ldrfpx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); - /* greg return */ - /* load retval */ - arm_ldrx (code, ARMREG_R11, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, retval)); + /* load target addr */ + arm_ldrx (code, ARMREG_IP0, ARMREG_FP, off_targetaddr); - arm_cmpx_imm (code, ARMREG_R11, 0); - label_leave_tramp [0] = code; - arm_bcc (code, ARMCOND_EQ, 0); + /* call into native function */ + arm_blrx (code, ARMREG_IP0); - /* store greg result */ - arm_strx (code, ARMREG_R0, ARMREG_R11, 0); + /* load CallContext* */ + arm_ldrx (code, ARMREG_IP0, ARMREG_FP, off_methodargs); - label_leave_tramp [1] = code; - arm_bcc (code, ARMCOND_AL, 0); + /* set all general purpose registers to CallContext */ + for (i = 0; i < PARAM_REGS; i++) + arm_strx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, gregs) + i * sizeof (mgreg_t)); - /* freg return */ - mono_arm_patch (label_is_float_ret, code, MONO_R_ARM64_BCC); - /* load retval */ - arm_ldrx (code, ARMREG_R11, ARMREG_IP0, MONO_STRUCT_OFFSET (InterpMethodArguments, retval)); - - arm_cmpx_imm (code, ARMREG_R11, 0); - label_leave_tramp [2] = code; - arm_bcc (code, ARMCOND_EQ, 0); - - /* store freg result */ - arm_strfpx (code, ARMREG_D0, ARMREG_R11, 0); - - for (i = 0; i < 3; i++) - mono_arm_patch (label_leave_tramp [i], code, MONO_R_ARM64_BCC); + /* set all floating registers to CallContext */ + for (i = 0; i < FP_PARAM_REGS; i++) + arm_strfpx (code, i, ARMREG_IP0, MONO_STRUCT_OFFSET (CallContext, fregs) + i * sizeof (double)); arm_movspx (code, ARMREG_SP, ARMREG_FP); arm_ldpx (code, ARMREG_FP, ARMREG_LR, ARMREG_SP, 0); @@ -757,7 +712,7 @@ mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_EXCEPTION_HANDLING, NULL)); if (info) - *info = mono_tramp_info_create ("enter_icall_trampoline", start, code - start, ji, unwind_ops); + *info = mono_tramp_info_create ("interp_to_native_trampoline", start, code - start, ji, unwind_ops); return start; #else @@ -818,7 +773,7 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/tramp-ppc.c b/mono/mini/tramp-ppc.c index c0c113cd10..3376cc4af8 100644 --- a/mono/mini/tramp-ppc.c +++ b/mono/mini/tramp-ppc.c @@ -636,7 +636,7 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) } gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/tramp-s390x.c b/mono/mini/tramp-s390x.c index c15b35860d..3582a992f6 100644 --- a/mono/mini/tramp-s390x.c +++ b/mono/mini/tramp-s390x.c @@ -606,14 +606,14 @@ mono_arch_get_static_rgctx_trampoline (gpointer arg, gpointer addr) /*------------------------------------------------------------------*/ /* */ -/* Name - mono_arch_get_enter_icall_trampoline. */ +/* Name - mono_arch_get_interp_to_native_trampoline. */ /* */ /* Function - */ /* */ /*------------------------------------------------------------------*/ gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/tramp-wasm.c b/mono/mini/tramp-wasm.c index 50447fbae5..6f0fff47aa 100644 --- a/mono/mini/tramp-wasm.c +++ b/mono/mini/tramp-wasm.c @@ -26,9 +26,9 @@ mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *a } gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { - printf ("mono_arch_get_enter_icall_trampoline"); + printf ("mono_arch_get_interp_to_native_trampoline"); g_assert (0); return NULL; } @@ -51,4 +51,4 @@ mono_arch_get_static_rgctx_trampoline (gpointer arg, gpointer addr) { g_error ("mono_arch_get_static_rgctx_trampoline"); return NULL; -} \ No newline at end of file +} diff --git a/mono/mini/tramp-x86.c b/mono/mini/tramp-x86.c index 111f6f5803..dbb24336ce 100644 --- a/mono/mini/tramp-x86.c +++ b/mono/mini/tramp-x86.c @@ -395,7 +395,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf for (i = X86_EAX; i <= X86_EDI; ++i) { if (i == X86_ESP || i == X86_EBP) continue; - if (i == X86_EAX && !((tramp_type == MONO_TRAMPOLINE_RESTORE_STACK_PROT) || (tramp_type == MONO_TRAMPOLINE_AOT_PLT))) + if (i == X86_EAX && tramp_type != MONO_TRAMPOLINE_AOT_PLT) continue; x86_mov_reg_membase (code, i, X86_EBP, regarray_offset + (i * 4), 4); } @@ -752,7 +752,7 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo } gpointer -mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info) +mono_arch_get_interp_to_native_trampoline (MonoTrampInfo **info) { g_assert_not_reached (); return NULL; diff --git a/mono/mini/type-checking.c b/mono/mini/type-checking.c index e2335af05f..84982b9dcc 100644 --- a/mono/mini/type-checking.c +++ b/mono/mini/type-checking.c @@ -497,10 +497,9 @@ handle_castclass (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context if (!klass->rank && !cfg->compile_aot && !(cfg->opt & MONO_OPT_SHARED) && mono_class_is_sealed (klass)) { /* the remoting code is broken, access the class for now */ if (0) { /*FIXME what exactly is broken? This change refers to r39380 from 2005 and mention some remoting fixes were due.*/ - MonoVTable *vt = mono_class_vtable (cfg->domain, klass); - if (!vt) { - mono_cfg_set_exception (cfg, MONO_EXCEPTION_TYPE_LOAD); - cfg->exception_ptr = klass; + MonoVTable *vt = mono_class_vtable_checked (cfg->domain, klass, &cfg->error); + if (!is_ok (&cfg->error)) { + mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); return NULL; } MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, vt); @@ -696,10 +695,9 @@ handle_isinst (MonoCompile *cfg, MonoClass *klass, MonoInst *src, int context_us g_assert (!context_used); /* the remoting code is broken, access the class for now */ if (0) {/*FIXME what exactly is broken? This change refers to r39380 from 2005 and mention some remoting fixes were due.*/ - MonoVTable *vt = mono_class_vtable (cfg->domain, klass); - if (!vt) { - mono_cfg_set_exception (cfg, MONO_EXCEPTION_TYPE_LOAD); - cfg->exception_ptr = klass; + MonoVTable *vt = mono_class_vtable_checked (cfg->domain, klass, &cfg->error); + if (!is_ok (&cfg->error)) { + mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); return NULL; } MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, vtable_reg, vt); diff --git a/mono/mini/version.h b/mono/mini/version.h index ec50986edf..8cfdda4322 100644 --- a/mono/mini/version.h +++ b/mono/mini/version.h @@ -1 +1 @@ -#define FULL_VERSION "explicit/75be2e6" +#define FULL_VERSION "explicit/5130d89" diff --git a/mono/mini/wasm_m2n_invoke.g.h b/mono/mini/wasm_m2n_invoke.g.h index 648da62c7b..05d5067d23 100644 --- a/mono/mini/wasm_m2n_invoke.g.h +++ b/mono/mini/wasm_m2n_invoke.g.h @@ -1,3 +1,7 @@ +/* +* DON'T EDIT THIS FILE +* This file was generated by m2n-gen.cs - use it instead. +*/ static void wasm_invoke_v (void *target_func, InterpMethodArguments *margs) { @@ -131,6 +135,16 @@ wasm_invoke_iiiiiii (void *target_func, InterpMethodArguments *margs) } +static void +wasm_invoke_iiiiiiii (void *target_func, InterpMethodArguments *margs) +{ + int (*func)(int arg_0, int arg_1, int arg_2, int arg_3, int arg_4, int arg_5, int arg_6) = target_func; + + int res = func ((int)margs->iargs [0], (int)margs->iargs [1], (int)margs->iargs [2], (int)margs->iargs [3], (int)margs->iargs [4], (int)margs->iargs [5], (int)margs->iargs [6]); + *(int*)margs->retval = res; + +} + static void wasm_invoke_iiiiiiiii (void *target_func, InterpMethodArguments *margs) { @@ -141,6 +155,16 @@ wasm_invoke_iiiiiiiii (void *target_func, InterpMethodArguments *margs) } +static void +wasm_invoke_iiliiii (void *target_func, InterpMethodArguments *margs) +{ + int (*func)(int arg_0, gint64 arg_1, int arg_2, int arg_3, int arg_4, int arg_5) = target_func; + + int res = func ((int)margs->iargs [0], get_long_arg (margs, 1), (int)margs->iargs [3], (int)margs->iargs [4], (int)margs->iargs [5], (int)margs->iargs [6]); + *(int*)margs->retval = res; + +} + static void wasm_invoke_l (void *target_func, InterpMethodArguments *margs) { @@ -434,8 +458,12 @@ icall_trampoline_dispatch (const char *cookie, void *target_func, InterpMethodAr wasm_invoke_iiiiii (target_func, margs); else if (!strcmp ("IIIIIII", cookie)) wasm_invoke_iiiiiii (target_func, margs); + else if (!strcmp ("IIIIIIII", cookie)) + wasm_invoke_iiiiiiii (target_func, margs); else if (!strcmp ("IIIIIIIII", cookie)) wasm_invoke_iiiiiiiii (target_func, margs); + else if (!strcmp ("IILIIII", cookie)) + wasm_invoke_iiliiii (target_func, margs); else if (!strcmp ("L", cookie)) wasm_invoke_l (target_func, margs); else if (!strcmp ("LL", cookie)) diff --git a/mono/mini/xdebug.c b/mono/mini/xdebug.c index 7d88f7da64..855e8c5789 100644 --- a/mono/mini/xdebug.c +++ b/mono/mini/xdebug.c @@ -27,6 +27,7 @@ #include "config.h" #include #include "mini.h" +#include "mini-runtime.h" #include #ifdef HAVE_UNISTD_H diff --git a/mono/profiler/Makefile.in b/mono/profiler/Makefile.in index 3d3b57c0e6..a498f25e6c 100644 --- a/mono/profiler/Makefile.in +++ b/mono/profiler/Makefile.in @@ -86,14 +86,14 @@ subdir = mono/profiler DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -392,6 +392,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -420,6 +424,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/profiler/aot.c b/mono/profiler/aot.c index fd22478353..0f70085971 100644 --- a/mono/profiler/aot.c +++ b/mono/profiler/aot.c @@ -23,6 +23,7 @@ #include #include #include +#include struct _MonoProfiler { GHashTable *classes; @@ -357,12 +358,12 @@ add_class (MonoProfiler *prof, MonoClass *klass) static void add_method (MonoProfiler *prof, MonoMethod *m) { - MonoError error; + ERROR_DECL (error); MonoMethodSignature *sig; char *s; - sig = mono_method_signature_checked (m, &error); - g_assert (mono_error_ok (&error)); + sig = mono_method_signature_checked (m, error); + g_assert (mono_error_ok (error)); int class_id = add_class (prof, m->klass); if (class_id == -1) diff --git a/mono/profiler/coverage.c b/mono/profiler/coverage.c index 53dcc0cba2..2f791392a0 100644 --- a/mono/profiler/coverage.c +++ b/mono/profiler/coverage.c @@ -58,22 +58,12 @@ #include -#ifdef HAVE_DLFCN_H -#include -#endif -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_SYS_MMAN_H -#include -#endif - #include #include +#include #include #include -#include +#include #include @@ -81,6 +71,7 @@ #include #include #include +#include #include #include #include @@ -98,22 +89,26 @@ struct _MonoProfiler { char *args; - mono_mutex_t mutex; + volatile gint32 runtime_inited; + volatile gint32 in_shutdown; + + guint32 previous_offset; GPtrArray *data; + mono_mutex_t mutex; + GPtrArray *filters; MonoConcurrentHashTable *filtered_classes; MonoConcurrentHashTable *suppressed_assemblies; MonoConcurrentHashTable *methods; MonoConcurrentHashTable *assemblies; - MonoConcurrentHashTable *classes; + GHashTable *deferred_assemblies; + MonoConcurrentHashTable *class_to_methods; MonoConcurrentHashTable *image_to_methods; GHashTable *uncovered_methods; - - guint32 previous_offset; }; typedef struct { @@ -128,7 +123,7 @@ typedef struct { } ProfilerConfig; static ProfilerConfig coverage_config; -static struct _MonoProfiler coverage_profiler; +static MonoProfiler coverage_profiler; /* This is a very basic escape function that escapes < > and & Ideally we'd use g_markup_escape_string but that function isn't @@ -198,8 +193,6 @@ free_coverage_entry (gpointer data, gpointer userdata) static void obtain_coverage_for_method (MonoProfiler *prof, const MonoProfilerCoverageData *entry) { - g_assert (prof == &coverage_profiler); - CoverageEntry *e = g_new (CoverageEntry, 1); coverage_profiler.previous_offset = entry->il_offset; @@ -241,8 +234,8 @@ parse_generic_type_names(char *name) *new_name++ = '`'; *new_name++ = '0' + generic_members; } else { - memcpy (new_name, "<>", 8); - new_name += 8; + memcpy (new_name, "<>", 2); + new_name += 2; } generic_members = 0; @@ -443,7 +436,7 @@ dump_assembly (gpointer key, gpointer value, gpointer userdata) g_free (escaped_image_name); g_free (escaped_image_filename); - mono_conc_hashtable_foreach (coverage_profiler.classes, dump_classes_for_image, image); + mono_conc_hashtable_foreach (coverage_profiler.class_to_methods, dump_classes_for_image, image); } static void @@ -472,49 +465,30 @@ create_method_node (MonoMethod *method) } static gboolean -coverage_filter (MonoProfiler *prof, MonoMethod *method) +consider_image (MonoImage *image) { - MonoError error; - MonoClass *klass; - MonoImage *image; - MonoAssembly *assembly; - MonoMethodHeader *header; - guint32 iflags, flags, code_size; - char *fqn, *classname; - gboolean has_positive, found; - MonoLockFreeQueue *image_methods, *class_methods; - MonoLockFreeQueueNode *node; - - g_assert (prof == &coverage_profiler); - - flags = mono_method_get_flags (method, &iflags); - if ((iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || - (flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) - return FALSE; - - // Don't need to do anything else if we're already tracking this method - if (mono_conc_hashtable_lookup (coverage_profiler.methods, method)) - return TRUE; - - klass = mono_method_get_class (method); - image = mono_class_get_image (klass); - // Don't handle coverage for the core assemblies if (mono_conc_hashtable_lookup (coverage_profiler.suppressed_assemblies, (gpointer) mono_image_get_name (image)) != NULL) return FALSE; + return TRUE; +} + +static gboolean +consider_class (MonoImage *image, MonoClass *klass) +{ if (coverage_profiler.filters) { /* Check already filtered classes first */ if (mono_conc_hashtable_lookup (coverage_profiler.filtered_classes, klass)) return FALSE; - classname = mono_type_get_name (mono_class_get_type (klass)); - - fqn = g_strdup_printf ("[%s]%s", mono_image_get_name (image), classname); + char *classname = mono_type_get_name (mono_class_get_type (klass)); + char *fqn = g_strdup_printf ("[%s]%s", mono_image_get_name (image), classname); // Check positive filters first - has_positive = FALSE; - found = FALSE; + gboolean has_positive = FALSE; + gboolean found = FALSE; + for (guint i = 0; i < coverage_profiler.filters->len; ++i) { char *filter = (char *)g_ptr_array_index (coverage_profiler.filters, i); @@ -562,48 +536,195 @@ coverage_filter (MonoProfiler *prof, MonoMethod *method) g_free (classname); } - header = mono_method_get_header_checked (method, &error); - mono_error_cleanup (&error); + return TRUE; +} - mono_method_header_get_code (header, &code_size, NULL); +static MonoLockFreeQueue * +register_image (MonoImage *image) +{ + // First try the fast path... + MonoLockFreeQueue *image_methods = (MonoLockFreeQueue *) mono_conc_hashtable_lookup (coverage_profiler.image_to_methods, image); - assembly = mono_image_get_assembly (image); - - // Need to keep the assemblies around for as long as they are kept in the hashtable - // Nunit, for example, has a habit of unloading them before the coverage statistics are - // generated causing a crash. See https://bugzilla.xamarin.com/show_bug.cgi?id=39325 - mono_assembly_addref (assembly); + if (image_methods) + return image_methods; mono_os_mutex_lock (&coverage_profiler.mutex); - mono_conc_hashtable_insert (coverage_profiler.methods, method, method); - mono_conc_hashtable_insert (coverage_profiler.assemblies, assembly, assembly); - mono_os_mutex_unlock (&coverage_profiler.mutex); - image_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (coverage_profiler.image_to_methods, image); + /* + * Another thread might've inserted the image since the check above, so + * check again now that we're holding the lock. + */ + image_methods = (MonoLockFreeQueue *) mono_conc_hashtable_lookup (coverage_profiler.image_to_methods, image); if (image_methods == NULL) { image_methods = (MonoLockFreeQueue *) g_malloc (sizeof (MonoLockFreeQueue)); mono_lock_free_queue_init (image_methods); - mono_os_mutex_lock (&coverage_profiler.mutex); mono_conc_hashtable_insert (coverage_profiler.image_to_methods, image, image_methods); - mono_os_mutex_unlock (&coverage_profiler.mutex); + + MonoAssembly *assembly = mono_image_get_assembly (image); + + /* + * We have to keep all the assemblies we reference metadata in alive, + * otherwise they might be gone by the time we dump coverage data + * during shutdown. This can happen with e.g. the corlib test suite. + */ + mono_assembly_addref (assembly); + + mono_conc_hashtable_insert (coverage_profiler.assemblies, assembly, assembly); } - node = create_method_node (method); - mono_lock_free_queue_enqueue (image_methods, node); + mono_os_mutex_unlock (&coverage_profiler.mutex); - class_methods = (MonoLockFreeQueue *)mono_conc_hashtable_lookup (coverage_profiler.classes, klass); + return image_methods; +} + +static MonoLockFreeQueue * +register_class (MonoClass *klass) +{ + // First try the fast path... + MonoLockFreeQueue *class_methods = (MonoLockFreeQueue *) mono_conc_hashtable_lookup (coverage_profiler.class_to_methods, klass); + + if (class_methods) + return class_methods; + + mono_os_mutex_lock (&coverage_profiler.mutex); + + /* + * Another thread might've inserted the class since the check above, so + * check again now that we're holding the lock. + */ + class_methods = (MonoLockFreeQueue *) mono_conc_hashtable_lookup (coverage_profiler.class_to_methods, klass); if (class_methods == NULL) { class_methods = (MonoLockFreeQueue *) g_malloc (sizeof (MonoLockFreeQueue)); mono_lock_free_queue_init (class_methods); - mono_os_mutex_lock (&coverage_profiler.mutex); - mono_conc_hashtable_insert (coverage_profiler.classes, klass, class_methods); - mono_os_mutex_unlock (&coverage_profiler.mutex); + mono_conc_hashtable_insert (coverage_profiler.class_to_methods, klass, class_methods); } - node = create_method_node (method); - mono_lock_free_queue_enqueue (class_methods, node); + mono_os_mutex_unlock (&coverage_profiler.mutex); + + return class_methods; +} + +/* + * Note: It's important that we do all of this work in the assembly_loaded + * callback rather than the (more intuitive) image_loaded callback. This is + * because assembly loading has not finished by the time image_loaded is + * raised, so if the mono_class_get_checked () call below ends up needing to + * resolve typeref tokens that point to other assemblies (it almost always + * does), we end up accessing a bunch of half-initialized state, leading to + * crashes. + */ +static void +assembly_loaded (MonoProfiler *prof, MonoAssembly *assembly) +{ + /* + * When dumping coverage data at shutdown, we may end up loading some extra + * assemblies for reflection purposes (e.g. method signatures). We don't + * need to consider these assemblies for coverage since no code in them is + * ever actually executed. This avoids a deadlock where we would try to + * take the coverage profiler lock recursively. + */ + if (mono_atomic_load_i32 (&coverage_profiler.in_shutdown)) + return; + + if (!mono_atomic_load_i32 (&coverage_profiler.runtime_inited)) { + /* + * Certain assemblies (i.e. corlib) can be problematic during startup. + * The assembly_loaded callback is raised before mono_defaults.corlib + * is set, which means when we try to load classes from it, things + * break in weird ways because various mono_is_corlib_image () special + * cases throughout the runtime are suddenly false. + * + * Work around this by remembering assemblies that are loaded before + * runtime initialization has finished and processing them when we get + * the runtime_initialized callback. + */ + mono_assembly_addref (assembly); + g_hash_table_insert (coverage_profiler.deferred_assemblies, assembly, assembly); + return; + } + + MonoImage *image = mono_assembly_get_image (assembly); + + if (!consider_image (image)) + return; + + register_image (image); + + int rows = mono_image_get_table_rows (image, MONO_TABLE_TYPEDEF); + + for (int i = 1; i <= rows; i++) { + ERROR_DECL (error); + + MonoClass *klass = mono_class_get_checked (image, MONO_TOKEN_TYPE_DEF | i, error); + + /* + * Swallow the error. The program will get an exception later on anyway + * when trying to use the class. If it's an entirely unused class, + * there's not much we can do; in that case, we just won't write it as + * uncovered to the output file. + */ + mono_error_cleanup (error); + + if (!klass || !consider_class (image, klass)) + continue; + + register_class (klass); + } +} + +static void +process_deferred_assembly (gpointer key, gpointer value, gpointer userdata) +{ + MonoAssembly *assembly = key; + + assembly_loaded ((MonoProfiler *) userdata, assembly); + mono_assembly_close (assembly); +} + +static gboolean +coverage_filter (MonoProfiler *prof, MonoMethod *method) +{ + guint32 iflags, flags; + + flags = mono_method_get_flags (method, &iflags); + + if ((iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || + (flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) + return FALSE; + + // Don't need to do anything else if we're already tracking this method. + if (mono_conc_hashtable_lookup (coverage_profiler.methods, method)) + return TRUE; + + MonoClass *klass = mono_method_get_class (method); + MonoImage *image = mono_class_get_image (klass); + + if (!consider_image (image) || !consider_class (image, klass)) + return FALSE; + + MonoLockFreeQueue *image_methods = register_image (image); + MonoLockFreeQueue *class_methods = register_class (klass); + + mono_os_mutex_lock (&coverage_profiler.mutex); + + /* + * Another thread might've inserted the method since the check above, so + * check again now that we're holding the lock. + */ + if (!mono_conc_hashtable_lookup (coverage_profiler.methods, method)) { + mono_conc_hashtable_insert (coverage_profiler.methods, method, method); + mono_os_mutex_unlock (&coverage_profiler.mutex); + + // Don't need to hold the lock for these. + MonoLockFreeQueueNode *image_methods_node = create_method_node (method); + mono_lock_free_queue_enqueue (image_methods, image_methods_node); + + MonoLockFreeQueueNode *class_methods_node = create_method_node (method); + mono_lock_free_queue_enqueue (class_methods, class_methods_node); + } else + mono_os_mutex_unlock (&coverage_profiler.mutex); return TRUE; } @@ -727,7 +848,7 @@ unref_coverage_assemblies (gpointer key, gpointer value, gpointer userdata) static void cov_shutdown (MonoProfiler *prof) { - g_assert (prof == &coverage_profiler); + mono_atomic_store_i32 (&coverage_profiler.in_shutdown, TRUE); dump_coverage (); @@ -735,13 +856,18 @@ cov_shutdown (MonoProfiler *prof) mono_conc_hashtable_foreach (coverage_profiler.assemblies, unref_coverage_assemblies, NULL); mono_os_mutex_unlock (&coverage_profiler.mutex); - mono_conc_hashtable_destroy (coverage_profiler.methods); - mono_conc_hashtable_destroy (coverage_profiler.assemblies); - mono_conc_hashtable_destroy (coverage_profiler.classes); - mono_conc_hashtable_destroy (coverage_profiler.filtered_classes); + g_hash_table_destroy (coverage_profiler.uncovered_methods); mono_conc_hashtable_destroy (coverage_profiler.image_to_methods); + mono_conc_hashtable_destroy (coverage_profiler.class_to_methods); + + g_hash_table_destroy (coverage_profiler.deferred_assemblies); + mono_conc_hashtable_destroy (coverage_profiler.assemblies); + mono_conc_hashtable_destroy (coverage_profiler.methods); + mono_conc_hashtable_destroy (coverage_profiler.suppressed_assemblies); + mono_conc_hashtable_destroy (coverage_profiler.filtered_classes); + mono_os_mutex_destroy (&coverage_profiler.mutex); if (*coverage_config.output_filename == '|') { @@ -758,10 +884,15 @@ cov_shutdown (MonoProfiler *prof) static void runtime_initialized (MonoProfiler *profiler) { + mono_atomic_store_i32 (&coverage_profiler.runtime_inited, TRUE); + mono_counters_register ("Event: Coverage methods", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &coverage_methods_ctr); mono_counters_register ("Event: Coverage statements", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &coverage_statements_ctr); mono_counters_register ("Event: Coverage classes", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &coverage_classes_ctr); mono_counters_register ("Event: Coverage assemblies", MONO_COUNTER_UINT | MONO_COUNTER_PROFILER | MONO_COUNTER_MONOTONIC, &coverage_assemblies_ctr); + + // See the comment in assembly_loaded (). + g_hash_table_foreach (coverage_profiler.deferred_assemblies, process_deferred_assembly, profiler); } static void usage (void); @@ -929,20 +1060,25 @@ mono_profiler_init_coverage (const char *desc) } mono_os_mutex_init (&coverage_profiler.mutex); - coverage_profiler.methods = mono_conc_hashtable_new (NULL, NULL); - coverage_profiler.assemblies = mono_conc_hashtable_new (NULL, NULL); - coverage_profiler.classes = mono_conc_hashtable_new (NULL, NULL); - coverage_profiler.filtered_classes = mono_conc_hashtable_new (NULL, NULL); - coverage_profiler.image_to_methods = mono_conc_hashtable_new (NULL, NULL); - coverage_profiler.uncovered_methods = g_hash_table_new (NULL, NULL); - init_suppressed_assemblies (); coverage_profiler.filters = filters; + coverage_profiler.filtered_classes = mono_conc_hashtable_new (NULL, NULL); + init_suppressed_assemblies (); + + coverage_profiler.methods = mono_conc_hashtable_new (NULL, NULL); + coverage_profiler.assemblies = mono_conc_hashtable_new (NULL, NULL); + coverage_profiler.deferred_assemblies = g_hash_table_new (NULL, NULL); + + coverage_profiler.class_to_methods = mono_conc_hashtable_new (NULL, NULL); + coverage_profiler.image_to_methods = mono_conc_hashtable_new (NULL, NULL); + + coverage_profiler.uncovered_methods = g_hash_table_new (NULL, NULL); MonoProfilerHandle handle = coverage_profiler.handle = mono_profiler_create (&coverage_profiler); mono_profiler_set_runtime_shutdown_end_callback (handle, cov_shutdown); mono_profiler_set_runtime_initialized_callback (handle, runtime_initialized); + mono_profiler_set_assembly_loaded_callback (handle, assembly_loaded); mono_profiler_enable_coverage (); mono_profiler_set_coverage_filter_callback (handle, coverage_filter); diff --git a/mono/profiler/log.c.REMOVED.git-id b/mono/profiler/log.c.REMOVED.git-id index 921307cce9..6b3e1f5547 100644 --- a/mono/profiler/log.c.REMOVED.git-id +++ b/mono/profiler/log.c.REMOVED.git-id @@ -1 +1 @@ -3e36d1d595ab2a77a6726d1cf02315cd1143ed00 \ No newline at end of file +caef0e7dea62aed9cc76ce36f4baccf18d3c5bc0 \ No newline at end of file diff --git a/mono/profiler/log.h b/mono/profiler/log.h index bab555388b..8ea1991e36 100644 --- a/mono/profiler/log.h +++ b/mono/profiler/log.h @@ -2,7 +2,6 @@ #define __MONO_PROFLOG_H__ #include -#define MONO_PROFILER_UNSTABLE_GC_ROOTS #include #include @@ -10,7 +9,7 @@ #define LOG_HEADER_ID 0x4D505A01 #define LOG_VERSION_MAJOR 2 #define LOG_VERSION_MINOR 0 -#define LOG_DATA_VERSION 14 +#define LOG_DATA_VERSION 15 /* * Changes in major/minor versions: @@ -72,6 +71,13 @@ removed type field from TYPE_SAMPLE_HIT removed MONO_GC_EVENT_{MARK,RECLAIM}_{START,END} reverted the root_type field back to uleb128 + removed MONO_PROFILER_CODE_BUFFER_UNKNOWN (was never used) + renumbered the MonoProfilerCodeBufferType enum + * version 15: reverted the type, unit, and variance fields back to uleb128 + added TYPE_HEAP_ROOT_{REGISTER,UNREGISTER} + TYPE_HEAP_ROOT now has a different, saner format + added TYPE_VTABLE metadata load event + changed TYPE_ALLOC and TYPE_HEAP_OBJECT to include a vtable pointer instead of a class pointer */ /* @@ -152,7 +158,7 @@ * type alloc format: * type: TYPE_ALLOC * exinfo: zero or TYPE_ALLOC_BT - * [ptr: sleb128] class as a byte difference from ptr_base + * [vtable: sleb128] MonoVTable* as a pointer difference from ptr_base * [obj: sleb128] object address as a byte difference from obj_base * [size: uleb128] size of the object in the heap * If exinfo == TYPE_ALLOC_BT, a backtrace follows. @@ -191,7 +197,7 @@ * exinfo: one of: TYPE_END_LOAD, TYPE_END_UNLOAD (optional for TYPE_THREAD and TYPE_DOMAIN, * doesn't occur for TYPE_CLASS) * [mtype: byte] metadata type, one of: TYPE_CLASS, TYPE_IMAGE, TYPE_ASSEMBLY, TYPE_DOMAIN, - * TYPE_THREAD, TYPE_CONTEXT + * TYPE_THREAD, TYPE_CONTEXT, TYPE_VTABLE * [pointer: sleb128] pointer of the metadata type depending on mtype * if mtype == TYPE_CLASS * [image: sleb128] MonoImage* as a pointer difference from ptr_base @@ -204,9 +210,12 @@ * if mtype == TYPE_DOMAIN && exinfo == 0 * [name: string] domain friendly name * if mtype == TYPE_CONTEXT - * [domain: sleb128] domain id as pointer + * [domain: sleb128] domain id as pointer difference from ptr_base * if mtype == TYPE_THREAD && exinfo == 0 * [name: string] thread name + * if mtype == TYPE_VTABLE + * [domain: sleb128] domain id as pointer difference from ptr_base, can be zero for proxy VTables + * [class: sleb128] MonoClass* as a pointer difference from ptr_base * * type method format: * type: TYPE_METHOD @@ -250,10 +259,10 @@ * * type heap format * type: TYPE_HEAP - * exinfo: one of TYPE_HEAP_START, TYPE_HEAP_END, TYPE_HEAP_OBJECT, TYPE_HEAP_ROOT + * exinfo: one of TYPE_HEAP_START, TYPE_HEAP_END, TYPE_HEAP_OBJECT, TYPE_HEAP_ROOT, TYPE_HEAP_ROOT_REGISTER, TYPE_HEAP_ROOT_UNREGISTER * if exinfo == TYPE_HEAP_OBJECT * [object: sleb128] the object as a difference from obj_base - * [class: sleb128] the object MonoClass* as a difference from ptr_base + * [vtable: sleb128] MonoVTable* as a pointer difference from ptr_base * [size: uleb128] size of the object on the heap * [num_refs: uleb128] number of object references * each referenced objref is preceded by a uleb128 encoded offset: the @@ -265,11 +274,17 @@ * provide additional referenced objects. * if exinfo == TYPE_HEAP_ROOT * [num_roots: uleb128] number of root references - * [num_gc: uleb128] number of major gcs - * [object: sleb128] the object as a difference from obj_base - * [root_type: uleb128] the root_type: MonoProfileGCRootType (profiler.h) - * [extra_info: uleb128] the extra_info value - * object, root_type and extra_info are repeated num_roots times + * for i = 0 to num_roots + * [address: sleb128] the root address as a difference from ptr_base + * [object: sleb128] the object address as a difference from obj_base + * if exinfo == TYPE_HEAP_ROOT_REGISTER + * [start: sleb128] start address as a difference from ptr_base + * [size: uleb] size of the root region + * [source: byte] MonoGCRootSource enum value + * [key: sleb128] root key, meaning dependent on type, value as a difference from ptr_base + * [desc: string] description of the root + * if exinfo == TYPE_HEAP_ROOT_UNREGISTER + * [start: sleb128] start address as a difference from ptr_base * * type sample format * type: TYPE_SAMPLE @@ -297,16 +312,16 @@ * if section == MONO_COUNTER_PERFCOUNTERS: * [section_name: string] section name of counter * [name: string] name of counter - * [type: byte] type of counter - * [unit: byte] unit of counter - * [variance: byte] variance of counter + * [type: uleb128] type of counter + * [unit: uleb128] unit of counter + * [variance: uleb128] variance of counter * [index: uleb128] unique index of counter * if exinfo == TYPE_SAMPLE_COUNTERS * while true: * [index: uleb128] unique index of counter * if index == 0: * break - * [type: byte] type of counter value + * [type: uleb128] type of counter value * if type == string: * if value == null: * [0: byte] 0 -> value is null @@ -376,6 +391,8 @@ enum { TYPE_HEAP_END = 1 << 4, TYPE_HEAP_OBJECT = 2 << 4, TYPE_HEAP_ROOT = 3 << 4, + TYPE_HEAP_ROOT_REGISTER = 4 << 4, + TYPE_HEAP_ROOT_UNREGISTER = 5 << 4, /* extended type for TYPE_METADATA */ TYPE_END_LOAD = 2 << 4, TYPE_END_UNLOAD = 4 << 4, @@ -431,6 +448,7 @@ enum { TYPE_DOMAIN = 4, TYPE_THREAD = 5, TYPE_CONTEXT = 6, + TYPE_VTABLE = 7, }; typedef enum { diff --git a/mono/profiler/mprof-report.c.REMOVED.git-id b/mono/profiler/mprof-report.c.REMOVED.git-id index 3d667da30d..8a8d8a7358 100644 --- a/mono/profiler/mprof-report.c.REMOVED.git-id +++ b/mono/profiler/mprof-report.c.REMOVED.git-id @@ -1 +1 @@ -40076afbb903c8e0082452f1c9ae699f4de1d751 \ No newline at end of file +bca403abe16cf6c28717dcc99a23d320df91f4eb \ No newline at end of file diff --git a/mono/sgen/Makefile.am b/mono/sgen/Makefile.am index 6027f7839a..8487867def 100644 --- a/mono/sgen/Makefile.am +++ b/mono/sgen/Makefile.am @@ -1,21 +1,10 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) if SUPPORT_SGEN -if DISABLE_EXECUTABLES shared_libraries = libmonosgen.la -else -if SHARED_MONO -shared_libraries = libmonosgen.la -endif -endif -libraries = $(shared_libraries) libmonosgen-static.la endif -if DISABLE_EXECUTABLES noinst_LTLIBRARIES = $(shared_libraries) -else -noinst_LTLIBRARIES = $(libraries) -endif monosgen_sources = \ gc-internal-agnostic.h \ @@ -72,7 +61,3 @@ monosgen_sources = \ libmonosgen_la_SOURCES = $(monosgen_sources) libmonosgen_la_CFLAGS = $(SGEN_DEFINES) - -libmonosgen_static_la_SOURCES = $(libmonosgen_la_SOURCES) -libmonosgen_static_la_CFLAGS = $(SGEN_DEFINES) -libmonosgen_static_la_LDFLAGS = -static diff --git a/mono/sgen/Makefile.in b/mono/sgen/Makefile.in index 475f6bb029..2dc589d468 100644 --- a/mono/sgen/Makefile.in +++ b/mono/sgen/Makefile.in @@ -83,14 +83,14 @@ subdir = mono/sgen DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -98,46 +98,8 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -libmonosgen_static_la_LIBADD = -am__objects_1 = libmonosgen_static_la-sgen-alloc.lo \ - libmonosgen_static_la-sgen-cardtable.lo \ - libmonosgen_static_la-sgen-debug.lo \ - libmonosgen_static_la-sgen-descriptor.lo \ - libmonosgen_static_la-sgen-fin-weak-hash.lo \ - libmonosgen_static_la-sgen-gc.lo \ - libmonosgen_static_la-sgen-gchandles.lo \ - libmonosgen_static_la-sgen-gray.lo \ - libmonosgen_static_la-sgen-hash-table.lo \ - libmonosgen_static_la-sgen-internal.lo \ - libmonosgen_static_la-sgen-layout-stats.lo \ - libmonosgen_static_la-sgen-los.lo \ - libmonosgen_static_la-sgen-marksweep.lo \ - libmonosgen_static_la-sgen-memory-governor.lo \ - libmonosgen_static_la-sgen-nursery-allocator.lo \ - libmonosgen_static_la-sgen-pinning-stats.lo \ - libmonosgen_static_la-sgen-pinning.lo \ - libmonosgen_static_la-sgen-pointer-queue.lo \ - libmonosgen_static_la-sgen-array-list.lo \ - libmonosgen_static_la-sgen-protocol.lo \ - libmonosgen_static_la-sgen-qsort.lo \ - libmonosgen_static_la-sgen-simple-nursery.lo \ - libmonosgen_static_la-sgen-split-nursery.lo \ - libmonosgen_static_la-sgen-thread-pool.lo \ - libmonosgen_static_la-sgen-workers.lo -am__objects_2 = $(am__objects_1) -am_libmonosgen_static_la_OBJECTS = $(am__objects_2) -libmonosgen_static_la_OBJECTS = $(am_libmonosgen_static_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libmonosgen_static_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libmonosgen_static_la_CFLAGS) $(CFLAGS) \ - $(libmonosgen_static_la_LDFLAGS) $(LDFLAGS) -o $@ -@DISABLE_EXECUTABLES_FALSE@@SUPPORT_SGEN_TRUE@am_libmonosgen_static_la_rpath = libmonosgen_la_LIBADD = -am__objects_3 = libmonosgen_la-sgen-alloc.lo \ +am__objects_1 = libmonosgen_la-sgen-alloc.lo \ libmonosgen_la-sgen-cardtable.lo libmonosgen_la-sgen-debug.lo \ libmonosgen_la-sgen-descriptor.lo \ libmonosgen_la-sgen-fin-weak-hash.lo libmonosgen_la-sgen-gc.lo \ @@ -157,14 +119,17 @@ am__objects_3 = libmonosgen_la-sgen-alloc.lo \ libmonosgen_la-sgen-split-nursery.lo \ libmonosgen_la-sgen-thread-pool.lo \ libmonosgen_la-sgen-workers.lo -am_libmonosgen_la_OBJECTS = $(am__objects_3) +am_libmonosgen_la_OBJECTS = $(am__objects_1) libmonosgen_la_OBJECTS = $(am_libmonosgen_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = libmonosgen_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(libmonosgen_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o \ $@ -@DISABLE_EXECUTABLES_FALSE@@SHARED_MONO_TRUE@@SUPPORT_SGEN_TRUE@am_libmonosgen_la_rpath = -@DISABLE_EXECUTABLES_TRUE@@SUPPORT_SGEN_TRUE@am_libmonosgen_la_rpath = +@SUPPORT_SGEN_TRUE@am_libmonosgen_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false @@ -195,9 +160,8 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = -SOURCES = $(libmonosgen_static_la_SOURCES) $(libmonosgen_la_SOURCES) -DIST_SOURCES = $(libmonosgen_static_la_SOURCES) \ - $(libmonosgen_la_SOURCES) +SOURCES = $(libmonosgen_la_SOURCES) +DIST_SOURCES = $(libmonosgen_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -307,6 +271,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -335,6 +303,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -459,11 +430,8 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) -@DISABLE_EXECUTABLES_FALSE@@SHARED_MONO_TRUE@@SUPPORT_SGEN_TRUE@shared_libraries = libmonosgen.la -@DISABLE_EXECUTABLES_TRUE@@SUPPORT_SGEN_TRUE@shared_libraries = libmonosgen.la -@SUPPORT_SGEN_TRUE@libraries = $(shared_libraries) libmonosgen-static.la -@DISABLE_EXECUTABLES_FALSE@noinst_LTLIBRARIES = $(libraries) -@DISABLE_EXECUTABLES_TRUE@noinst_LTLIBRARIES = $(shared_libraries) +@SUPPORT_SGEN_TRUE@shared_libraries = libmonosgen.la +noinst_LTLIBRARIES = $(shared_libraries) monosgen_sources = \ gc-internal-agnostic.h \ sgen-alloc.c \ @@ -519,9 +487,6 @@ monosgen_sources = \ libmonosgen_la_SOURCES = $(monosgen_sources) libmonosgen_la_CFLAGS = $(SGEN_DEFINES) -libmonosgen_static_la_SOURCES = $(libmonosgen_la_SOURCES) -libmonosgen_static_la_CFLAGS = $(SGEN_DEFINES) -libmonosgen_static_la_LDFLAGS = -static all: all-am .SUFFIXES: @@ -568,9 +533,6 @@ clean-noinstLTLIBRARIES: rm -f $${locs}; \ } -libmonosgen-static.la: $(libmonosgen_static_la_OBJECTS) $(libmonosgen_static_la_DEPENDENCIES) $(EXTRA_libmonosgen_static_la_DEPENDENCIES) - $(AM_V_CCLD)$(libmonosgen_static_la_LINK) $(am_libmonosgen_static_la_rpath) $(libmonosgen_static_la_OBJECTS) $(libmonosgen_static_la_LIBADD) $(LIBS) - libmonosgen.la: $(libmonosgen_la_OBJECTS) $(libmonosgen_la_DEPENDENCIES) $(EXTRA_libmonosgen_la_DEPENDENCIES) $(AM_V_CCLD)$(libmonosgen_la_LINK) $(am_libmonosgen_la_rpath) $(libmonosgen_la_OBJECTS) $(libmonosgen_la_LIBADD) $(LIBS) @@ -605,31 +567,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_la-sgen-split-nursery.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_la-sgen-thread-pool.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_la-sgen-workers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-alloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-array-list.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-cardtable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-debug.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-descriptor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-fin-weak-hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-gc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-gchandles.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-gray.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-hash-table.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-internal.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-layout-stats.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-los.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-marksweep.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-memory-governor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-nursery-allocator.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-pinning-stats.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-pinning.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-pointer-queue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-protocol.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-qsort.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-simple-nursery.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-split-nursery.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-thread-pool.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmonosgen_static_la-sgen-workers.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @@ -655,181 +592,6 @@ distclean-compile: @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< -libmonosgen_static_la-sgen-alloc.lo: sgen-alloc.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-alloc.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-alloc.Tpo -c -o libmonosgen_static_la-sgen-alloc.lo `test -f 'sgen-alloc.c' || echo '$(srcdir)/'`sgen-alloc.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-alloc.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-alloc.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-alloc.c' object='libmonosgen_static_la-sgen-alloc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-alloc.lo `test -f 'sgen-alloc.c' || echo '$(srcdir)/'`sgen-alloc.c - -libmonosgen_static_la-sgen-cardtable.lo: sgen-cardtable.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-cardtable.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-cardtable.Tpo -c -o libmonosgen_static_la-sgen-cardtable.lo `test -f 'sgen-cardtable.c' || echo '$(srcdir)/'`sgen-cardtable.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-cardtable.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-cardtable.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-cardtable.c' object='libmonosgen_static_la-sgen-cardtable.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-cardtable.lo `test -f 'sgen-cardtable.c' || echo '$(srcdir)/'`sgen-cardtable.c - -libmonosgen_static_la-sgen-debug.lo: sgen-debug.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-debug.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-debug.Tpo -c -o libmonosgen_static_la-sgen-debug.lo `test -f 'sgen-debug.c' || echo '$(srcdir)/'`sgen-debug.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-debug.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-debug.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-debug.c' object='libmonosgen_static_la-sgen-debug.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-debug.lo `test -f 'sgen-debug.c' || echo '$(srcdir)/'`sgen-debug.c - -libmonosgen_static_la-sgen-descriptor.lo: sgen-descriptor.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-descriptor.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-descriptor.Tpo -c -o libmonosgen_static_la-sgen-descriptor.lo `test -f 'sgen-descriptor.c' || echo '$(srcdir)/'`sgen-descriptor.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-descriptor.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-descriptor.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-descriptor.c' object='libmonosgen_static_la-sgen-descriptor.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-descriptor.lo `test -f 'sgen-descriptor.c' || echo '$(srcdir)/'`sgen-descriptor.c - -libmonosgen_static_la-sgen-fin-weak-hash.lo: sgen-fin-weak-hash.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-fin-weak-hash.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-fin-weak-hash.Tpo -c -o libmonosgen_static_la-sgen-fin-weak-hash.lo `test -f 'sgen-fin-weak-hash.c' || echo '$(srcdir)/'`sgen-fin-weak-hash.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-fin-weak-hash.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-fin-weak-hash.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-fin-weak-hash.c' object='libmonosgen_static_la-sgen-fin-weak-hash.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-fin-weak-hash.lo `test -f 'sgen-fin-weak-hash.c' || echo '$(srcdir)/'`sgen-fin-weak-hash.c - -libmonosgen_static_la-sgen-gc.lo: sgen-gc.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-gc.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-gc.Tpo -c -o libmonosgen_static_la-sgen-gc.lo `test -f 'sgen-gc.c' || echo '$(srcdir)/'`sgen-gc.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-gc.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-gc.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-gc.c' object='libmonosgen_static_la-sgen-gc.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-gc.lo `test -f 'sgen-gc.c' || echo '$(srcdir)/'`sgen-gc.c - -libmonosgen_static_la-sgen-gchandles.lo: sgen-gchandles.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-gchandles.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-gchandles.Tpo -c -o libmonosgen_static_la-sgen-gchandles.lo `test -f 'sgen-gchandles.c' || echo '$(srcdir)/'`sgen-gchandles.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-gchandles.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-gchandles.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-gchandles.c' object='libmonosgen_static_la-sgen-gchandles.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-gchandles.lo `test -f 'sgen-gchandles.c' || echo '$(srcdir)/'`sgen-gchandles.c - -libmonosgen_static_la-sgen-gray.lo: sgen-gray.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-gray.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-gray.Tpo -c -o libmonosgen_static_la-sgen-gray.lo `test -f 'sgen-gray.c' || echo '$(srcdir)/'`sgen-gray.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-gray.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-gray.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-gray.c' object='libmonosgen_static_la-sgen-gray.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-gray.lo `test -f 'sgen-gray.c' || echo '$(srcdir)/'`sgen-gray.c - -libmonosgen_static_la-sgen-hash-table.lo: sgen-hash-table.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-hash-table.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-hash-table.Tpo -c -o libmonosgen_static_la-sgen-hash-table.lo `test -f 'sgen-hash-table.c' || echo '$(srcdir)/'`sgen-hash-table.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-hash-table.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-hash-table.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-hash-table.c' object='libmonosgen_static_la-sgen-hash-table.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-hash-table.lo `test -f 'sgen-hash-table.c' || echo '$(srcdir)/'`sgen-hash-table.c - -libmonosgen_static_la-sgen-internal.lo: sgen-internal.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-internal.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-internal.Tpo -c -o libmonosgen_static_la-sgen-internal.lo `test -f 'sgen-internal.c' || echo '$(srcdir)/'`sgen-internal.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-internal.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-internal.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-internal.c' object='libmonosgen_static_la-sgen-internal.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-internal.lo `test -f 'sgen-internal.c' || echo '$(srcdir)/'`sgen-internal.c - -libmonosgen_static_la-sgen-layout-stats.lo: sgen-layout-stats.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-layout-stats.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-layout-stats.Tpo -c -o libmonosgen_static_la-sgen-layout-stats.lo `test -f 'sgen-layout-stats.c' || echo '$(srcdir)/'`sgen-layout-stats.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-layout-stats.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-layout-stats.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-layout-stats.c' object='libmonosgen_static_la-sgen-layout-stats.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-layout-stats.lo `test -f 'sgen-layout-stats.c' || echo '$(srcdir)/'`sgen-layout-stats.c - -libmonosgen_static_la-sgen-los.lo: sgen-los.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-los.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-los.Tpo -c -o libmonosgen_static_la-sgen-los.lo `test -f 'sgen-los.c' || echo '$(srcdir)/'`sgen-los.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-los.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-los.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-los.c' object='libmonosgen_static_la-sgen-los.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-los.lo `test -f 'sgen-los.c' || echo '$(srcdir)/'`sgen-los.c - -libmonosgen_static_la-sgen-marksweep.lo: sgen-marksweep.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-marksweep.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-marksweep.Tpo -c -o libmonosgen_static_la-sgen-marksweep.lo `test -f 'sgen-marksweep.c' || echo '$(srcdir)/'`sgen-marksweep.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-marksweep.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-marksweep.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-marksweep.c' object='libmonosgen_static_la-sgen-marksweep.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-marksweep.lo `test -f 'sgen-marksweep.c' || echo '$(srcdir)/'`sgen-marksweep.c - -libmonosgen_static_la-sgen-memory-governor.lo: sgen-memory-governor.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-memory-governor.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-memory-governor.Tpo -c -o libmonosgen_static_la-sgen-memory-governor.lo `test -f 'sgen-memory-governor.c' || echo '$(srcdir)/'`sgen-memory-governor.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-memory-governor.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-memory-governor.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-memory-governor.c' object='libmonosgen_static_la-sgen-memory-governor.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-memory-governor.lo `test -f 'sgen-memory-governor.c' || echo '$(srcdir)/'`sgen-memory-governor.c - -libmonosgen_static_la-sgen-nursery-allocator.lo: sgen-nursery-allocator.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-nursery-allocator.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-nursery-allocator.Tpo -c -o libmonosgen_static_la-sgen-nursery-allocator.lo `test -f 'sgen-nursery-allocator.c' || echo '$(srcdir)/'`sgen-nursery-allocator.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-nursery-allocator.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-nursery-allocator.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-nursery-allocator.c' object='libmonosgen_static_la-sgen-nursery-allocator.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-nursery-allocator.lo `test -f 'sgen-nursery-allocator.c' || echo '$(srcdir)/'`sgen-nursery-allocator.c - -libmonosgen_static_la-sgen-pinning-stats.lo: sgen-pinning-stats.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-pinning-stats.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-pinning-stats.Tpo -c -o libmonosgen_static_la-sgen-pinning-stats.lo `test -f 'sgen-pinning-stats.c' || echo '$(srcdir)/'`sgen-pinning-stats.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-pinning-stats.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-pinning-stats.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-pinning-stats.c' object='libmonosgen_static_la-sgen-pinning-stats.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-pinning-stats.lo `test -f 'sgen-pinning-stats.c' || echo '$(srcdir)/'`sgen-pinning-stats.c - -libmonosgen_static_la-sgen-pinning.lo: sgen-pinning.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-pinning.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-pinning.Tpo -c -o libmonosgen_static_la-sgen-pinning.lo `test -f 'sgen-pinning.c' || echo '$(srcdir)/'`sgen-pinning.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-pinning.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-pinning.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-pinning.c' object='libmonosgen_static_la-sgen-pinning.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-pinning.lo `test -f 'sgen-pinning.c' || echo '$(srcdir)/'`sgen-pinning.c - -libmonosgen_static_la-sgen-pointer-queue.lo: sgen-pointer-queue.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-pointer-queue.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-pointer-queue.Tpo -c -o libmonosgen_static_la-sgen-pointer-queue.lo `test -f 'sgen-pointer-queue.c' || echo '$(srcdir)/'`sgen-pointer-queue.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-pointer-queue.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-pointer-queue.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-pointer-queue.c' object='libmonosgen_static_la-sgen-pointer-queue.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-pointer-queue.lo `test -f 'sgen-pointer-queue.c' || echo '$(srcdir)/'`sgen-pointer-queue.c - -libmonosgen_static_la-sgen-array-list.lo: sgen-array-list.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-array-list.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-array-list.Tpo -c -o libmonosgen_static_la-sgen-array-list.lo `test -f 'sgen-array-list.c' || echo '$(srcdir)/'`sgen-array-list.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-array-list.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-array-list.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-array-list.c' object='libmonosgen_static_la-sgen-array-list.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-array-list.lo `test -f 'sgen-array-list.c' || echo '$(srcdir)/'`sgen-array-list.c - -libmonosgen_static_la-sgen-protocol.lo: sgen-protocol.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-protocol.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-protocol.Tpo -c -o libmonosgen_static_la-sgen-protocol.lo `test -f 'sgen-protocol.c' || echo '$(srcdir)/'`sgen-protocol.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-protocol.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-protocol.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-protocol.c' object='libmonosgen_static_la-sgen-protocol.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-protocol.lo `test -f 'sgen-protocol.c' || echo '$(srcdir)/'`sgen-protocol.c - -libmonosgen_static_la-sgen-qsort.lo: sgen-qsort.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-qsort.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-qsort.Tpo -c -o libmonosgen_static_la-sgen-qsort.lo `test -f 'sgen-qsort.c' || echo '$(srcdir)/'`sgen-qsort.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-qsort.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-qsort.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-qsort.c' object='libmonosgen_static_la-sgen-qsort.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-qsort.lo `test -f 'sgen-qsort.c' || echo '$(srcdir)/'`sgen-qsort.c - -libmonosgen_static_la-sgen-simple-nursery.lo: sgen-simple-nursery.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-simple-nursery.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-simple-nursery.Tpo -c -o libmonosgen_static_la-sgen-simple-nursery.lo `test -f 'sgen-simple-nursery.c' || echo '$(srcdir)/'`sgen-simple-nursery.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-simple-nursery.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-simple-nursery.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-simple-nursery.c' object='libmonosgen_static_la-sgen-simple-nursery.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-simple-nursery.lo `test -f 'sgen-simple-nursery.c' || echo '$(srcdir)/'`sgen-simple-nursery.c - -libmonosgen_static_la-sgen-split-nursery.lo: sgen-split-nursery.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-split-nursery.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-split-nursery.Tpo -c -o libmonosgen_static_la-sgen-split-nursery.lo `test -f 'sgen-split-nursery.c' || echo '$(srcdir)/'`sgen-split-nursery.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-split-nursery.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-split-nursery.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-split-nursery.c' object='libmonosgen_static_la-sgen-split-nursery.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-split-nursery.lo `test -f 'sgen-split-nursery.c' || echo '$(srcdir)/'`sgen-split-nursery.c - -libmonosgen_static_la-sgen-thread-pool.lo: sgen-thread-pool.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-thread-pool.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-thread-pool.Tpo -c -o libmonosgen_static_la-sgen-thread-pool.lo `test -f 'sgen-thread-pool.c' || echo '$(srcdir)/'`sgen-thread-pool.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-thread-pool.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-thread-pool.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-thread-pool.c' object='libmonosgen_static_la-sgen-thread-pool.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-thread-pool.lo `test -f 'sgen-thread-pool.c' || echo '$(srcdir)/'`sgen-thread-pool.c - -libmonosgen_static_la-sgen-workers.lo: sgen-workers.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -MT libmonosgen_static_la-sgen-workers.lo -MD -MP -MF $(DEPDIR)/libmonosgen_static_la-sgen-workers.Tpo -c -o libmonosgen_static_la-sgen-workers.lo `test -f 'sgen-workers.c' || echo '$(srcdir)/'`sgen-workers.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_static_la-sgen-workers.Tpo $(DEPDIR)/libmonosgen_static_la-sgen-workers.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-workers.c' object='libmonosgen_static_la-sgen-workers.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_static_la_CFLAGS) $(CFLAGS) -c -o libmonosgen_static_la-sgen-workers.lo `test -f 'sgen-workers.c' || echo '$(srcdir)/'`sgen-workers.c - libmonosgen_la-sgen-alloc.lo: sgen-alloc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libmonosgen_la_CFLAGS) $(CFLAGS) -MT libmonosgen_la-sgen-alloc.lo -MD -MP -MF $(DEPDIR)/libmonosgen_la-sgen-alloc.Tpo -c -o libmonosgen_la-sgen-alloc.lo `test -f 'sgen-alloc.c' || echo '$(srcdir)/'`sgen-alloc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libmonosgen_la-sgen-alloc.Tpo $(DEPDIR)/libmonosgen_la-sgen-alloc.Plo diff --git a/mono/sgen/sgen-client.h b/mono/sgen/sgen-client.h index a0045184bd..512e312c5b 100644 --- a/mono/sgen/sgen-client.h +++ b/mono/sgen/sgen-client.h @@ -107,20 +107,31 @@ void sgen_client_nursery_objects_pinned (void **definitely_pinned, int count); /* * Called at a semi-random point during minor collections. No action is necessary. */ -void sgen_client_collecting_minor (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue); +void sgen_client_collecting_minor_report_roots (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue); /* * Called at semi-random points during major collections. No action is necessary. */ -void sgen_client_collecting_major_1 (void); -void sgen_client_collecting_major_2 (void); -void sgen_client_collecting_major_3 (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue); +void sgen_client_collecting_major_report_roots (SgenPointerQueue *fin_ready_queue, SgenPointerQueue *critical_fin_queue); /* * Called after a LOS object has been pinned. No action is necessary. */ void sgen_client_pinned_los_object (GCObject *obj); +/* + * Called for each cemented obj + */ +void sgen_client_pinned_cemented_object (GCObject *obj); + +/* + * Called for each major heap obj pinned + */ +void sgen_client_pinned_major_heap_object (GCObject *obj); + +void sgen_client_pinning_start (void); +void sgen_client_pinning_end (void); + /* * Called for every degraded allocation. No action is necessary. */ @@ -176,9 +187,9 @@ void sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gbool * Stop and restart the world, i.e., all threads that interact with the managed heap. For * single-threaded programs this is a nop. */ -void sgen_client_stop_world (int generation) +void sgen_client_stop_world (int generation, gboolean serial_collection) MONO_PERMIT (need (sgen_gc_locked)); -void sgen_client_restart_world (int generation, gint64 *stw_time) +void sgen_client_restart_world (int generation, gboolean serial_collection, gint64 *stw_time) MONO_PERMIT (need (sgen_gc_locked)); /* @@ -228,6 +239,13 @@ void sgen_client_describe_invalid_pointer (GCObject *ptr); */ gsize *sgen_client_get_weak_bitmap (GCVTable vt, int *nbits); +/* + * Scheduled @cv to be invoked later in the background. + * + * This function is idepotent WRT background execution. Meaning that calling it multiple times with the same funciton pointer before any bg execution happens will only call @cb once. + */ +void sgen_client_schedule_background_job (void (*cb)(void)); + /* * These client binary protocol functions are called from the respective binary protocol * functions. No action is necessary. We suggest implementing them as inline functions in @@ -299,4 +317,5 @@ SgenThreadInfo* mono_thread_info_current (void); * Get the current thread's small ID. This will be called on managed and worker threads. */ int mono_thread_info_get_small_id (void); + #endif diff --git a/mono/sgen/sgen-debug.c b/mono/sgen/sgen-debug.c index 904460bdfd..3fa79443e2 100644 --- a/mono/sgen/sgen-debug.c +++ b/mono/sgen/sgen-debug.c @@ -1008,9 +1008,9 @@ check_reference_for_xdomain (GCObject **ptr, GCObject *obj, MonoDomain *domain) } if (ref->vtable->klass == mono_defaults.string_class) { - MonoError error; - str = mono_string_to_utf8_checked ((MonoString*)ref, &error); - mono_error_cleanup (&error); + ERROR_DECL (error); + str = mono_string_to_utf8_checked ((MonoString*)ref, error); + mono_error_cleanup (error); } else str = NULL; g_print ("xdomain reference in %p (%s.%s) at offset %d (%s) to %p (%s.%s) (%s) - pointed to by:\n", diff --git a/mono/sgen/sgen-descriptor.h b/mono/sgen/sgen-descriptor.h index 2c7f19b18c..f10ebf6a51 100644 --- a/mono/sgen/sgen-descriptor.h +++ b/mono/sgen/sgen-descriptor.h @@ -122,6 +122,7 @@ enum { }; typedef void (*SgenUserMarkFunc) (GCObject **addr, void *gc_data); +typedef void (*SgenUserReportRootFunc) (void *addr, GCObject *obj, void *gc_data); typedef void (*SgenUserRootMarkFunc) (void *addr, SgenUserMarkFunc mark_func, void *gc_data); SgenDescriptor sgen_make_user_root_descriptor (SgenUserRootMarkFunc marker); diff --git a/mono/sgen/sgen-gc.c.REMOVED.git-id b/mono/sgen/sgen-gc.c.REMOVED.git-id index 1e3b3b3e7f..6e8e890409 100644 --- a/mono/sgen/sgen-gc.c.REMOVED.git-id +++ b/mono/sgen/sgen-gc.c.REMOVED.git-id @@ -1 +1 @@ -0cfcf2904dfad37338f14ffb0be61f89523fba1c \ No newline at end of file +036eee9ce918ffd99cdc95154daa051133476ff4 \ No newline at end of file diff --git a/mono/sgen/sgen-gc.h b/mono/sgen/sgen-gc.h index 4850b33423..cbf1da2ea9 100644 --- a/mono/sgen/sgen-gc.h +++ b/mono/sgen/sgen-gc.h @@ -394,7 +394,7 @@ enum { extern SgenHashTable roots_hash [ROOT_TYPE_NUM]; -int sgen_register_root (char *start, size_t size, SgenDescriptor descr, int root_type, int source, const char *msg) +int sgen_register_root (char *start, size_t size, SgenDescriptor descr, int root_type, int source, void *key, const char *msg) MONO_PERMIT (need (sgen_lock_gc)); void sgen_deregister_root (char* addr) MONO_PERMIT (need (sgen_lock_gc)); @@ -868,9 +868,9 @@ size_t sgen_gc_get_total_heap_allocation (void); /* STW */ -void sgen_stop_world (int generation) +void sgen_stop_world (int generation, gboolean serial_collection) MONO_PERMIT (need (sgen_gc_locked), use (sgen_stop_world), grant (sgen_world_stopped), revoke (sgen_stop_world)); -void sgen_restart_world (int generation) +void sgen_restart_world (int generation, gboolean serial_collection) MONO_PERMIT (need (sgen_gc_locked), use (sgen_world_stopped), revoke (sgen_world_stopped), grant (sgen_stop_world)); gboolean sgen_is_world_stopped (void); @@ -1016,6 +1016,8 @@ void sgen_gchandle_iterate (GCHandleType handle_type, int max_generation, SgenGC void sgen_gchandle_set_target (guint32 gchandle, GCObject *obj); void sgen_mark_normal_gc_handles (void *addr, SgenUserMarkFunc mark_func, void *gc_data) MONO_PERMIT (need (sgen_world_stopped)); +void sgen_gc_handles_report_roots (SgenUserReportRootFunc mark_func, void *gc_data) + MONO_PERMIT (need (sgen_world_stopped)); gpointer sgen_gchandle_get_metadata (guint32 gchandle); GCObject *sgen_gchandle_get_target (guint32 gchandle); void sgen_gchandle_free (guint32 gchandle); diff --git a/mono/sgen/sgen-gchandles.c b/mono/sgen/sgen-gchandles.c index 0010fc38e4..a13ca56dce 100644 --- a/mono/sgen/sgen-gchandles.c +++ b/mono/sgen/sgen-gchandles.c @@ -94,15 +94,24 @@ static void bucket_alloc_callback (gpointer *bucket, guint32 new_bucket_size, gboolean alloc) { if (alloc) - sgen_register_root ((char *)bucket, new_bucket_size, SGEN_DESCRIPTOR_NULL, ROOT_TYPE_PINNED, MONO_ROOT_SOURCE_GC_HANDLE, "pinned gc handles"); + sgen_register_root ((char *)bucket, new_bucket_size, SGEN_DESCRIPTOR_NULL, ROOT_TYPE_PINNED, MONO_ROOT_SOURCE_GC_HANDLE, NULL, "GC Handle Bucket (SGen, Pinned)"); else sgen_deregister_root ((char *)bucket); } +static void +bucket_alloc_report_root (gpointer *bucket, guint32 new_bucket_size, gboolean alloc) +{ + if (alloc) + sgen_client_root_registered ((char *)bucket, new_bucket_size, MONO_ROOT_SOURCE_GC_HANDLE, NULL, "GC Handle Bucket (SGen, Normal)"); + else + sgen_client_root_deregistered ((char *)bucket); +} + static HandleData gc_handles [] = { { SGEN_ARRAY_LIST_INIT (NULL, is_slot_set, try_occupy_slot, -1), (HANDLE_WEAK) }, { SGEN_ARRAY_LIST_INIT (NULL, is_slot_set, try_occupy_slot, -1), (HANDLE_WEAK_TRACK) }, - { SGEN_ARRAY_LIST_INIT (NULL, is_slot_set, try_occupy_slot, -1), (HANDLE_NORMAL) }, + { SGEN_ARRAY_LIST_INIT (bucket_alloc_report_root, is_slot_set, try_occupy_slot, -1), (HANDLE_NORMAL) }, { SGEN_ARRAY_LIST_INIT (bucket_alloc_callback, is_slot_set, try_occupy_slot, -1), (HANDLE_PINNED) }, { SGEN_ARRAY_LIST_INIT (NULL, is_slot_set, try_occupy_slot, -1), (HANDLE_WEAK_FIELDS) }, }; @@ -133,6 +142,22 @@ sgen_mark_normal_gc_handles (void *addr, SgenUserMarkFunc mark_func, void *gc_da } SGEN_ARRAY_LIST_END_FOREACH_SLOT; } +void +sgen_gc_handles_report_roots (SgenUserReportRootFunc report_func, void *gc_data) +{ + HandleData *handles = gc_handles_for_type (HANDLE_NORMAL); + SgenArrayList *array = &handles->entries_array; + volatile gpointer *slot; + gpointer hidden, revealed; + + SGEN_ARRAY_LIST_FOREACH_SLOT (array, slot) { + hidden = *slot; + revealed = MONO_GC_REVEAL_POINTER (hidden, FALSE); + + if (MONO_GC_HANDLE_IS_OBJECT_POINTER (hidden)) + report_func ((void*)slot, revealed, gc_data); + } SGEN_ARRAY_LIST_END_FOREACH_SLOT; +} static guint32 alloc_handle (HandleData *handles, GCObject *obj, gboolean track) diff --git a/mono/sgen/sgen-marksweep.c b/mono/sgen/sgen-marksweep.c index c17846d9de..2624aa7f51 100644 --- a/mono/sgen/sgen-marksweep.c +++ b/mono/sgen/sgen-marksweep.c @@ -1410,6 +1410,7 @@ mark_pinned_objects_in_block (MSBlockInfo *block, size_t first_entry, size_t las continue; MS_MARK_OBJECT_AND_ENQUEUE (obj, sgen_obj_get_descriptor (obj), block, queue); sgen_pin_stats_register_object (obj, GENERATION_OLD); + sgen_client_pinned_major_heap_object (obj); last_index = index; } diff --git a/mono/sgen/sgen-pinning.c b/mono/sgen/sgen-pinning.c index 6b43771a93..b23b20b588 100644 --- a/mono/sgen/sgen-pinning.c +++ b/mono/sgen/sgen-pinning.c @@ -43,6 +43,7 @@ sgen_init_pinning (void) { memset (pin_hash_filter, 0, sizeof (pin_hash_filter)); pin_queue.mem_type = INTERNAL_MEM_PIN_QUEUE; + sgen_client_pinning_start (); } void @@ -367,6 +368,7 @@ pin_from_hash (CementHashEntry *hash, gboolean has_been_reset) if (has_been_reset) SGEN_ASSERT (5, hash [i].count >= SGEN_CEMENT_THRESHOLD, "Cementing hash inconsistent"); + sgen_client_pinned_cemented_object (hash [i].obj); sgen_pin_stage_ptr (hash [i].obj); binary_protocol_cement_stage (hash [i].obj); /* FIXME: do pin stats if enabled */ diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index 6f20c32829..45dd88855d 100755 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -532,14 +532,25 @@ TESTS_CS_SRC= \ init_array_with_lazy_type.cs \ weak-fields.cs \ threads-leak.cs \ + threads-init.cs \ + bug-60848.cs \ + bug-59400.cs \ nested_type_visibility.cs if AMD64 TESTS_CS_SRC += async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs +if !HOST_WIN32 +# requires working altstack +TESTS_CS_SRC += bug-60862.cs +endif endif if X86 TESTS_CS_SRC += async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs +if !HOST_WIN32 +# requires working altstack +TESTS_CS_SRC += bug-60862.cs +endif endif TESTS_IL_SRC= \ @@ -555,7 +566,7 @@ TESTS_IL_SRC= \ locallocTest.il \ initblkTest.il \ qt-instance.il \ - vararg.il \ + vararg3.il \ bug-29859.il \ bug-78549.il \ static-fields-nonconst.il \ @@ -610,7 +621,14 @@ TESTS_IL_SRC= \ gsharing-valuetype-layout.il \ invalid_generic_instantiation.il \ bug-45841-fpstack-exceptions.il \ - instance_tailrec.il + instance_tailrec.il \ + dim-constrainedcall.il \ + dim-diamondshape.il \ + dim-genericmethods.il \ + dim-methodimpl.il \ + dim-sharedgenerics.il \ + dim-simple.il \ + dim-valuetypes.il TESTS_GSHARED_SRC = \ generics-sharing.2.cs \ @@ -718,7 +736,17 @@ INTERP_PLATFORM_DISABLED_TESTS= \ delegate-exit.exe \ delegate1.exe \ delegate3.exe \ + thunks.exe \ finalizer-exception.exe \ + delegate5.exe \ + delegate8.exe \ + bug-323114.exe \ + threadpool-exceptions3.exe \ + threadpool-exceptions6.exe \ + bug-80392.2.exe \ + remoting3.exe \ + remoting2.exe \ + appdomain-unload-callback.exe \ monitor-abort.exe endif @@ -965,14 +993,17 @@ LLVM = $(filter --llvm, $(MONO_ENV_OPTIONS)) # appdomain-thread-abort.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47054 # abort-try-holes.exe is flaky due to unwinding failure to the finally block when aborting # appdomain-marshalbyref-assemblyload.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=49308 +# dim-*: https://github.com/mono/mono/pull/6252 KNOWN_FAILING_TESTS = \ delegate-async-exception.exe \ bug-348522.2.exe \ bug-459094.exe \ delegate-invoke.exe \ bug-Xamarin-5278.exe \ + appdomain-marshalbyref-assemblyload.exe \ abort-try-holes.exe \ - appdomain-marshalbyref-assemblyload.exe + dim-constrainedcall.exe \ + dim-diamondshape.exe DISABLED_TESTS = \ $(KNOWN_FAILING_TESTS) \ @@ -989,13 +1020,13 @@ DISABLED_TESTS = \ # exit code 0, but doesn't actually execute the test. # block_guard_restore_aligment_on_exit.exe: flaky (10% of the time it hangs and thus times out) # weak-fields.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=60973 +# bug-60862.exe: missing support to map IP->method; only works on platforms with altstack support. INTERP_DISABLED_TESTS = \ $(KNOWN_FAILING_TESTS) \ $(INTERP_PLATFORM_DISABLED_TESTS) \ $(COOP_DISABLED_TESTS) \ $(if $(CI),$(CI_DISABLED_TESTS)) \ $(if $(CI_PR),$(CI_PR_DISABLED_TESTS)) \ - abort-cctor.exe \ appdomain-unload.exe \ array_load_exception.exe \ async-exc-compilation.exe \ @@ -1007,8 +1038,8 @@ INTERP_DISABLED_TESTS = \ bug-48015.exe \ bug-58782-capture-and-throw.exe \ bug-58782-plain-throw.exe \ - bug-81673.exe \ bug445361.exe \ + bug-60862.exe \ calliGenericTest.exe \ cominterop.exe \ context-static.exe \ @@ -1018,39 +1049,22 @@ INTERP_DISABLED_TESTS = \ even-odd.exe \ exception18.exe \ field-access.exe \ - finally_block_ending_in_dead_bb.exe \ handleref.exe \ - invalid_generic_instantiation.exe \ - ldftn-access.exe \ - marshal.exe \ - marshal8.exe \ - method-access.exe \ nullable_boxing.2.exe \ - pinvoke-2.2.exe \ - pinvoke-utf8.exe \ - pinvoke.exe \ - pinvoke11.exe \ pinvoke2.exe \ pinvoke3.exe \ - pinvoke_ppcc.exe \ - pinvoke_ppcd.exe \ - pinvoke_ppcf.exe \ - pinvoke_ppci.exe \ - pinvoke_ppcs.exe \ safehandle.2.exe \ stackframes-async.2.exe \ static-constructor.exe \ - test-type-ctor.exe \ thread6.exe \ threadpool-exceptions2.exe \ threadpool-exceptions4.exe \ threadpool-exceptions5.exe \ - thunks.exe \ typeload-unaligned.exe \ weak-fields.exe \ vararg.exe \ vararg2.exe \ - winx64structs.exe + vararg3.exe TESTS_CS=$(filter-out $(DISABLED_TESTS),$(TESTS_CS_SRC:.cs=.exe)) TESTS_IL=$(filter-out $(DISABLED_TESTS),$(TESTS_IL_SRC:.il=.exe)) @@ -2003,7 +2017,7 @@ TESTSAOT_STRESS_PROCESS=$(TESTS_STRESS_PROCESS:.exe=.exe$(PLATFORM_AOT_SUFFIX)) endif test-process-stress: $(TESTS_STRESS_PROCESS) $(TESTSAOT_STRESS_PROCESS) test-runner.exe - $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 600 $(TESTS_STRESS_PROCESS) + $(TOOLS_RUNTIME) $(TEST_RUNNER) --testsuite-name $@ --disabled "$(DISABLED_TESTS)" --timeout 900 $(TESTS_STRESS_PROCESS) coreclr-gcstress: $(MAKE) -C $(mono_build_root)/acceptance-tests coreclr-gcstress diff --git a/mono/tests/Makefile.in.REMOVED.git-id b/mono/tests/Makefile.in.REMOVED.git-id index 918cf589e9..c772fd1e1a 100644 --- a/mono/tests/Makefile.in.REMOVED.git-id +++ b/mono/tests/Makefile.in.REMOVED.git-id @@ -1 +1 @@ -84a771e98363ad74606456fd353212593fc429d3 \ No newline at end of file +8a8a82272702ca44a05c569b5bf95b6b7877df68 \ No newline at end of file diff --git a/mono/tests/bug-59400.cs b/mono/tests/bug-59400.cs new file mode 100644 index 0000000000..72d92888c5 --- /dev/null +++ b/mono/tests/bug-59400.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections; +using System.Collections.Generic; + +namespace MonoBug +{ + interface IValue + { + TValue Value { get; } + } + + struct ValueHolder + : IValue + { + public TValue Value { get; } + + public ValueHolder(TValue value) + { + Value = value; + } + } + + interface IPair + { + TKey Key { get; } + TValue Value { get; } + } + + struct Pair + : IPair + where TValue : class + { + public TKey Key { get; } + public TValue Value { get; } + + public Pair(TKey key, TValue value) + { + Key = key; + Value = value; + } + } + + struct IncorrectEnumerator1 + : IEnumerator>, IEnumerator> + where TValue : class + { + object IEnumerator.Current => null; + + IValue IEnumerator>.Current + { + get + { + Console.WriteLine("IEnumerator>.Current is called (correct)"); + Program.exit_code = 0; + return new ValueHolder(default(TValue)); + } + } + + ValueHolder IEnumerator>.Current + { + get + { + Console.WriteLine("IEnumerator>.Current is called (incorrect)"); + Program.exit_code = 1; + return new ValueHolder(default(TValue)); + } + } + + + public bool MoveNext() => true; + public void Reset() { } + public void Dispose() { } + } + + + class ValueBase + { } + + class Value + : ValueBase + { } + + class Program + { + internal static int exit_code; + static int Main(string[] args) + { + IEnumerator> it1 = new IncorrectEnumerator1(); + + var v1 = it1.Current; + var v2 = it1.Current; + + return Program.exit_code; + } + } +} diff --git a/mono/tests/bug-60848.cs b/mono/tests/bug-60848.cs new file mode 100644 index 0000000000..7f1183ad4e --- /dev/null +++ b/mono/tests/bug-60848.cs @@ -0,0 +1,66 @@ +using System; +using System.Text; + +[Obsolete("test")] +public static class Program +{ + public const string UnicodeLowSurrogate = "l\uDC00"; + public const string UnicodeHighSurrogate = "h\uD800"; + public const string UnicodeReplacementCharacter = "\uFFFD"; + + public static int Main () + { + int exitCode = 0; + + var tuples = new [] { + ( typeof (Program), "0074 0065 0073 0074" ), + ( typeof (A), "0068 FFFD FFFD" ), + ( typeof (B), "006C FFFD FFFD" ), + ( typeof (C), "006C FFFD FFFD 0068 FFFD FFFD" ), + ( typeof (D), "0068 FFFD FFFD 006C FFFD FFFD" ) + }; + + foreach (var tup in tuples) { + var type = tup.Item1; + var a = ((ObsoleteAttribute)type.GetCustomAttributes(true)[0]); + var m = a.Message; + + var sb = new StringBuilder(); + + if (m != null) { + foreach (var ch in m) + sb.AppendFormat("{0:X4} ", (uint)ch); + } else { + sb.Append("null"); + } + + var expected = tup.Item2; + var actual = sb.ToString().Trim(); + if (actual != expected) { + Console.WriteLine("Attribute on type {0} failed to decode:", type); + Console.WriteLine(" expected '{0}' but got '{1}'", expected, actual); + exitCode += 1; + } else { + Console.WriteLine("{0} {1}", type, actual); + } + } + + return exitCode; + } +} + +[Obsolete(Program.UnicodeHighSurrogate)] +public class A { +} + +[Obsolete(Program.UnicodeLowSurrogate)] +public class B { +} + +[Obsolete(Program.UnicodeLowSurrogate + Program.UnicodeHighSurrogate)] +public class C { +} + +[Obsolete(Program.UnicodeHighSurrogate + Program.UnicodeLowSurrogate)] +public class D { +} \ No newline at end of file diff --git a/mono/tests/bug-60862.cs b/mono/tests/bug-60862.cs new file mode 100644 index 0000000000..251838f584 --- /dev/null +++ b/mono/tests/bug-60862.cs @@ -0,0 +1,54 @@ +/* https://bugzilla.xamarin.com/show_bug.cgi?id=60862 */ +using System; +using System.Threading; + +namespace StackOverflowTest +{ + class Program + { + static bool fault = false; + static Exception ex = null; + + public static int Main(string[] args) + { + Thread t = new Thread (Run); + t.Start (); + t.Join (); + if (fault) { + if (ex == null) { + Console.WriteLine ("fault occured, but no exception object available"); + return 1; + } else { + bool is_stackoverlfow = ex is StackOverflowException; + Console.WriteLine ("fault occured: ex = " + is_stackoverlfow); + return is_stackoverlfow ? 0 : 3; + } + } + Console.WriteLine("no fault"); + return 2; + } + + static void Run() + { + try { + Execute (); + } catch(Exception e) { + ex = e; + fault = true; + } + } + + static void Execute () + { + WaitOne (); + } + + static bool WaitOne (bool killProcessOnInterrupt = false, bool throwOnInterrupt = false) + { + try { + return WaitOne(); + } catch(ThreadInterruptedException e) { } + return false; + } + } +} diff --git a/mono/tests/dim-constrainedcall.il b/mono/tests/dim-constrainedcall.il new file mode 100644 index 0000000000..0408c75f26 --- /dev/null +++ b/mono/tests/dim-constrainedcall.il @@ -0,0 +1,456 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly constrainedcall +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module constrainedcall.exe +// MVID: {6171EA0F-1009-482D-8EF6-C944886D5D66} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x01860000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IFoo +{ + .method public hidebysig newslot virtual + instance int32 Foo(int32 c) cil managed + { + // Code size 20 (0x14) + .maxstack 2 + .locals init (class IAdd V_0, + int32 V_1) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: castclass IAdd + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.1 + IL_000a: callvirt instance int32 IAdd::Add(int32) + IL_000f: stloc.1 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.1 + IL_0013: ret + } // end of method IFoo::Foo + +} // end of class IFoo + +.class interface private abstract auto ansi IAdd +{ + .method public hidebysig newslot abstract virtual + instance int32 Add(int32 c) cil managed + { + } // end of method IAdd::Add + +} // end of class IAdd + +.class private sequential ansi sealed beforefieldinit FooValue + extends [mscorlib]System.ValueType + implements IFoo, + IAdd +{ + .field public int32 val + + .method public hidebysig newslot virtual final + instance int32 Add(int32 c) cil managed + { + // Code size 26 (0x1a) + .maxstack 3 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.0 + IL_0003: ldfld int32 FooValue::val + IL_0008: ldarg.1 + IL_0009: add + IL_000a: stfld int32 FooValue::val + IL_000f: ldarg.0 + IL_0010: ldfld int32 FooValue::val + IL_0015: stloc.0 + IL_0016: br.s IL_0018 + + IL_0018: ldloc.0 + IL_0019: ret + } // end of method FooValue::Add + +} // end of class FooValue + +.class interface private abstract auto ansi IHorrible`1 +{ + .method public hidebysig newslot abstract virtual + instance int32 GetLocalVal() cil managed + { + } // end of method IHorrible`1::GetLocalVal + + .method public hidebysig newslot abstract virtual + instance void SetLocalVal(int32 val) cil managed + { + } // end of method IHorrible`1::SetLocalVal + + .method public hidebysig newslot virtual + instance int32 Horrible() cil managed + { + // Code size 26 (0x1a) + .maxstack 2 + .locals init (int32 V_0, + int32 V_1) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: callvirt instance int32 class IHorrible`1::GetLocalVal() + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldc.i4.1 + IL_000a: add + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldloc.0 + IL_000e: callvirt instance void class IHorrible`1::SetLocalVal(int32) + IL_0013: nop + IL_0014: ldloc.0 + IL_0015: stloc.1 + IL_0016: br.s IL_0018 + + IL_0018: ldloc.1 + IL_0019: ret + } // end of method IHorrible`1::Horrible + +} // end of class IHorrible`1 + +.class private sequential ansi sealed beforefieldinit HorribleCase`1 + extends [mscorlib]System.ValueType + implements class IHorrible`1>, + class IHorrible`1> +{ + .field private int32 localVal + .method public hidebysig newslot virtual final + instance int32 GetLocalVal() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 valuetype HorribleCase`1::localVal + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method HorribleCase`1::GetLocalVal + + .method public hidebysig newslot virtual final + instance void SetLocalVal(int32 val) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.1 + IL_0003: stfld int32 valuetype HorribleCase`1::localVal + IL_0008: ret + } // end of method HorribleCase`1::SetLocalVal + + .method private hidebysig newslot virtual final + instance int32 'IHorrible>.Horrible'() cil managed + { + .override method instance int32 class IHorrible`1>::Horrible() + // Code size 23 (0x17) + .maxstack 3 + .locals init (int32 V_0, + int32 V_1) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.0 + IL_0003: ldfld int32 valuetype HorribleCase`1::localVal + IL_0008: ldc.i4.1 + IL_0009: add + IL_000a: stloc.0 + IL_000b: ldloc.0 + IL_000c: stfld int32 valuetype HorribleCase`1::localVal + IL_0011: ldloc.0 + IL_0012: stloc.1 + IL_0013: br.s IL_0015 + + IL_0015: ldloc.1 + IL_0016: ret + } // end of method HorribleCase`1::'IHorrible>.Horrible' +} // end of class HorribleCase`1 + +.class private auto ansi beforefieldinit HorribleTest + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Horror<(class IHorrible`1) T,U>(!!T t) cil managed + { + // Code size 33 (0x21) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarga.s t + IL_0003: constrained. !!T + IL_0009: callvirt instance int32 class IHorrible`1::Horrible() + IL_000e: ldarga.s t + IL_0010: constrained. !!T + IL_0016: callvirt instance int32 class IHorrible`1::Horrible() + IL_001b: add + IL_001c: stloc.0 + IL_001d: br.s IL_001f + + IL_001f: ldloc.0 + IL_0020: ret + } // end of method HorribleTest::Horror + + .method public hidebysig static void RunTest() cil managed + { + // Code size 58 (0x3a) + .maxstack 2 + .locals init (valuetype HorribleCase`1 V_0) + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: initobj valuetype HorribleCase`1 + IL_0009: ldloc.0 + IL_000a: call int32 HorribleTest::Horror,class [mscorlib]System.Collections.Generic.IEnumerable`1>(!!0) + IL_000f: ldc.i4.3 + IL_0010: ceq + IL_0012: ldstr "Fail" + IL_0017: call void Test::Assert(bool, + string) + IL_001c: nop + IL_001d: ldloca.s V_0 + IL_001f: initobj valuetype HorribleCase`1 + IL_0025: ldloc.0 + IL_0026: call int32 HorribleTest::Horror,class [mscorlib]System.Collections.Generic.IList`1>(!!0) + IL_002b: ldc.i4.0 + IL_002c: ceq + IL_002e: ldstr "Fail" + IL_0033: call void Test::Assert(bool, + string) + IL_0038: nop + IL_0039: ret + } // end of method HorribleTest::RunTest + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method HorribleTest::.ctor + +} // end of class HorribleTest + +.class private auto ansi beforefieldinit SimpleConstraintTest + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 CallFoo_WithConstraints<(IFoo) T>(!!T& foo, + int32 val) cil managed + { + // Code size 19 (0x13) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.1 + IL_0003: constrained. !!T + IL_0009: callvirt instance int32 IFoo::Foo(int32) + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method SimpleConstraintTest::CallFoo_WithConstraints + + .method public hidebysig static void RunTest() cil managed + { + // Code size 75 (0x4b) + .maxstack 2 + .locals init (valuetype FooValue V_0) + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: initobj FooValue + IL_0009: ldloca.s V_0 + IL_000b: ldc.i4.s 10 + IL_000d: stfld int32 FooValue::val + IL_0012: ldstr "Calling CallFoo_WithConstraints on FooValue - expe" + + "cting IFoo::Foo" + IL_0017: call void [mscorlib]System.Console::WriteLine(string) + IL_001c: nop + IL_001d: ldloca.s V_0 + IL_001f: ldc.i4.s 10 + IL_0021: call int32 SimpleConstraintTest::CallFoo_WithConstraints(!!0&, + int32) + IL_0026: ldc.i4.s 20 + IL_0028: ceq + IL_002a: ldstr "Calling CallFoo_WithConstraints on FooValue" + IL_002f: call void Test::Assert(bool, + string) + IL_0034: nop + IL_0035: ldloc.0 + IL_0036: ldfld int32 FooValue::val + IL_003b: ldc.i4.s 10 + IL_003d: ceq + IL_003f: ldstr "Expecting boxing on CallFoo_WithConstraints" + IL_0044: call void Test::Assert(bool, + string) + IL_0049: nop + IL_004a: ret + } // end of method SimpleConstraintTest::RunTest + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method SimpleConstraintTest::.ctor + +} // end of class SimpleConstraintTest + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + // Code size 23 (0x17) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: call void HorribleTest::RunTest() + IL_0006: nop + IL_0007: call void SimpleConstraintTest::RunTest() + IL_000c: nop + IL_000d: call int32 Test::Ret() + IL_0012: stloc.0 + IL_0013: br.s IL_0015 + + IL_0015: ldloc.0 + IL_0016: ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file constrainedcall.res diff --git a/mono/tests/dim-diamondshape.il b/mono/tests/dim-diamondshape.il new file mode 100644 index 0000000000..063ebef844 --- /dev/null +++ b/mono/tests/dim-diamondshape.il @@ -0,0 +1,944 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly diamondshape +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module diamondshape.exe +// MVID: {25B467F3-D284-4DB6-BAD4-C7EAC75CF064} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x010B0000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IFoo +{ + .method public hidebysig newslot virtual + instance int32 Foo(int32 a) cil managed + { + // Code size 7 (0x7) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.1 + IL_0002: stloc.0 + IL_0003: br.s IL_0005 + + IL_0005: ldloc.0 + IL_0006: ret + } // end of method IFoo::Foo + +} // end of class IFoo + +.class interface private abstract auto ansi IFoo2 + implements IFoo +{ + .method public hidebysig newslot virtual final + instance int32 Foo(int32 a) cil managed + { + .override IFoo::Foo + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo2.Foo" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method IFoo2::IFoo.Foo + +} // end of class IFoo2 + +.class interface private abstract auto ansi IFooEx + implements IFoo +{ + .method public hidebysig newslot virtual final + instance int32 IFoo.Foo(int32 a) cil managed + { + .override IFoo::Foo + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFooEx.Foo" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method IFooEx::IFoo.Foo +} // end of class IFooEx + +.class private auto ansi beforefieldinit FooClass + extends [mscorlib]System.Object + implements IFoo2, + IFoo, + IFooEx +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method FooClass::.ctor + +} // end of class FooClass + +.class interface private abstract auto ansi I1 +{ + .method public hidebysig newslot abstract virtual + instance int32 Func(int32 a) cil managed + { + } // end of method I1::Func + +} // end of class I1 + +.class interface private abstract auto ansi I2 + implements I1 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I2.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.2 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I2::I1.Func +} // end of class I2 + +.class interface private abstract auto ansi I3 + implements I1 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I3.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.3 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I3::I1.Func +} // end of class I3 + +.class interface private abstract auto ansi I4 + implements I2, + I1, + I3 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I4.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.4 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I4::I1.Func +} // end of class I4 + +.class private auto ansi beforefieldinit I4Class + extends [mscorlib]System.Object + implements I4, + I2, + I1, + I3 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method I4Class::.ctor + +} // end of class I4Class + +.class interface private abstract auto ansi I5 + implements I1 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I5.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.5 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I5::I1.Func +} // end of class I5 + +.class interface private abstract auto ansi I6 + implements I1 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I6.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.6 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I6::I1.Func +} // end of class I6 + +.class interface private abstract auto ansi I7 + implements I5, + I1, + I6 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I7.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.7 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I7::I1.Func +} // end of class I7 + +.class interface private abstract auto ansi I8 + implements I4, + I2, + I1, + I3, + I7, + I5, + I6 +{ + .method private hidebysig newslot virtual final + instance int32 I1.Func(int32 a) cil managed + { + .override I1::Func + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At I8.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.8 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method I8::I1.Func +} // end of class I8 + +.class private auto ansi beforefieldinit I47Class + extends [mscorlib]System.Object + implements I4, + I2, + I1, + I3, + I7, + I5, + I6 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method I47Class::.ctor + +} // end of class I47Class + +.class private auto ansi beforefieldinit I8Class + extends [mscorlib]System.Object + implements I8, + I4, + I2, + I1, + I3, + I7, + I5, + I6 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method I8Class::.ctor + +} // end of class I8Class + +.class interface private abstract auto ansi GI1`1 +{ + .method public hidebysig newslot abstract virtual + instance int32 Func([out] class [mscorlib]System.Type[]& types) cil managed + { + } // end of method GI1`1::'GI1.Func' + +} // end of class GI1`1 + +.class interface private abstract auto ansi GI2`1 + implements class GI1`1 +{ +.method private hidebysig newslot virtual final + instance int32 'GI1.Func'([out] class [mscorlib]System.Type[]& types) cil managed + { + .override method instance int32 class GI1`1::Func<[1]>(class [mscorlib]System.Type[]&) + // Code size 100 (0x64) + .maxstack 5 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldc.i4.4 + IL_0002: newarr [mscorlib]System.Object + IL_0007: dup + IL_0008: ldc.i4.0 + IL_0009: ldtoken !T + IL_000e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0013: stelem.ref + IL_0014: dup + IL_0015: ldc.i4.1 + IL_0016: ldstr ", " + IL_001b: stelem.ref + IL_001c: dup + IL_001d: ldc.i4.2 + IL_001e: ldtoken !!S + IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0028: stelem.ref + IL_0029: dup + IL_002a: ldc.i4.3 + IL_002b: ldstr ", GI2" + IL_0030: stelem.ref + IL_0031: call string [mscorlib]System.String::Concat(object[]) + IL_0036: call void [mscorlib]System.Console::WriteLine(string) + IL_003b: nop + IL_003c: ldarg.1 + IL_003d: ldc.i4.2 + IL_003e: newarr [mscorlib]System.Type + IL_0043: dup + IL_0044: ldc.i4.0 + IL_0045: ldtoken !T + IL_004a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_004f: stelem.ref + IL_0050: dup + IL_0051: ldc.i4.1 + IL_0052: ldtoken !!S + IL_0057: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_005c: stelem.ref + IL_005d: stind.ref + IL_005e: ldc.i4.2 + IL_005f: stloc.0 + IL_0060: br.s IL_0062 + + IL_0062: ldloc.0 + IL_0063: ret + } // end of method G2`1::'GI1.Func' +} // end of class GI2`1 + +.class interface private abstract auto ansi GI3`1 + implements class GI1`1 +{ +.method private hidebysig newslot virtual final + instance int32 'GI1.Func'([out] class [mscorlib]System.Type[]& types) cil managed + { + .override method instance int32 class GI1`1::Func<[1]>(class [mscorlib]System.Type[]&) + // Code size 100 (0x64) + .maxstack 5 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldc.i4.4 + IL_0002: newarr [mscorlib]System.Object + IL_0007: dup + IL_0008: ldc.i4.0 + IL_0009: ldtoken !T + IL_000e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0013: stelem.ref + IL_0014: dup + IL_0015: ldc.i4.1 + IL_0016: ldstr ", " + IL_001b: stelem.ref + IL_001c: dup + IL_001d: ldc.i4.2 + IL_001e: ldtoken !!S + IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0028: stelem.ref + IL_0029: dup + IL_002a: ldc.i4.3 + IL_002b: ldstr ", GI3" + IL_0030: stelem.ref + IL_0031: call string [mscorlib]System.String::Concat(object[]) + IL_0036: call void [mscorlib]System.Console::WriteLine(string) + IL_003b: nop + IL_003c: ldarg.1 + IL_003d: ldc.i4.2 + IL_003e: newarr [mscorlib]System.Type + IL_0043: dup + IL_0044: ldc.i4.0 + IL_0045: ldtoken !T + IL_004a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_004f: stelem.ref + IL_0050: dup + IL_0051: ldc.i4.1 + IL_0052: ldtoken !!S + IL_0057: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_005c: stelem.ref + IL_005d: stind.ref + IL_005e: ldc.i4.3 + IL_005f: stloc.0 + IL_0060: br.s IL_0062 + + IL_0062: ldloc.0 + IL_0063: ret + } // end of method GI3`1::'GI1.Func' +} // end of class GI3`1 + +.class interface private abstract auto ansi GI4`1 + implements class GI2`1, + class GI1`1, + class GI3`1 +{ + .method private hidebysig newslot virtual final + instance int32 'GI1.Func'([out] class [mscorlib]System.Type[]& types) cil managed + { + .override method instance int32 class GI1`1::Func<[1]>(class [mscorlib]System.Type[]&) + // Code size 100 (0x64) + .maxstack 5 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldc.i4.4 + IL_0002: newarr [mscorlib]System.Object + IL_0007: dup + IL_0008: ldc.i4.0 + IL_0009: ldtoken !T + IL_000e: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0013: stelem.ref + IL_0014: dup + IL_0015: ldc.i4.1 + IL_0016: ldstr ", " + IL_001b: stelem.ref + IL_001c: dup + IL_001d: ldc.i4.2 + IL_001e: ldtoken !!S + IL_0023: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0028: stelem.ref + IL_0029: dup + IL_002a: ldc.i4.3 + IL_002b: ldstr ", GI4" + IL_0030: stelem.ref + IL_0031: call string [mscorlib]System.String::Concat(object[]) + IL_0036: call void [mscorlib]System.Console::WriteLine(string) + IL_003b: nop + IL_003c: ldarg.1 + IL_003d: ldc.i4.2 + IL_003e: newarr [mscorlib]System.Type + IL_0043: dup + IL_0044: ldc.i4.0 + IL_0045: ldtoken !T + IL_004a: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_004f: stelem.ref + IL_0050: dup + IL_0051: ldc.i4.1 + IL_0052: ldtoken !!S + IL_0057: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_005c: stelem.ref + IL_005d: stind.ref + IL_005e: ldc.i4.4 + IL_005f: stloc.0 + IL_0060: br.s IL_0062 + + IL_0062: ldloc.0 + IL_0063: ret + } // end of method GI4`1::'GI1.Func' +} // end of class GI4`1 + +.class private auto ansi beforefieldinit GI23Class`1 + extends [mscorlib]System.Object + implements class GI2`1, + class GI1`1, + class GI3`1 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method GI23Class`1::.ctor + +} // end of class GI23Class`1 + +.class private auto ansi beforefieldinit GI4Class`1 + extends [mscorlib]System.Object + implements class GI4`1, + class GI2`1, + class GI1`1, + class GI3`1 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method GI4Class`1::.ctor + +} // end of class GI4Class`1 + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static void Negative() cil managed + { + // Code size 225 (0xe1) + .maxstack 2 + .locals init (class FooClass V_0, + class IFoo V_1, + class I47Class V_2, + class I1 V_3, + class GI23Class`1 V_4, + class GI1`1 V_5, + class [mscorlib]System.Exception V_6, + class [mscorlib]System.Exception V_7, + class [mscorlib]System.Type[] V_8, + class [mscorlib]System.Exception V_9) + IL_0000: nop + IL_0001: newobj instance void FooClass::.ctor() + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldstr "Calling IFoo.Foo on Foo - expecting exception." + IL_000e: call void [mscorlib]System.Console::WriteLine(string) + IL_0013: nop + .try + { + IL_0014: nop + IL_0015: ldloc.1 + IL_0016: ldc.i4.s 10 + IL_0018: callvirt instance int32 IFoo::Foo(int32) + IL_001d: pop + IL_001e: ldc.i4.0 + IL_001f: ldstr "Expecting exception on Foo" + IL_0024: call void Test::Assert(bool, + string) + IL_0029: nop + IL_002a: nop + IL_002b: leave.s IL_004a + + } // end .try + catch [mscorlib]System.Exception + { + IL_002d: stloc.s V_6 + IL_002f: nop + IL_0030: ldstr "Exception caught: " + IL_0035: ldloc.s V_6 + IL_0037: callvirt instance string [mscorlib]System.Object::ToString() + IL_003c: call string [mscorlib]System.String::Concat(string, + string) + IL_0041: call void [mscorlib]System.Console::WriteLine(string) + IL_0046: nop + IL_0047: nop + IL_0048: leave.s IL_004a + + } // end handler + IL_004a: newobj instance void I47Class::.ctor() + IL_004f: stloc.2 + IL_0050: ldloc.2 + IL_0051: stloc.3 + IL_0052: ldstr "Calling I1.Func on I47Class - expecting exception" + IL_0057: call void [mscorlib]System.Console::WriteLine(string) + IL_005c: nop + .try + { + IL_005d: nop + IL_005e: ldloc.3 + IL_005f: ldc.i4.s 10 + IL_0061: callvirt instance int32 I1::Func(int32) + IL_0066: pop + IL_0067: ldc.i4.0 + IL_0068: ldstr "Expecting exception on I47Class" + IL_006d: call void Test::Assert(bool, + string) + IL_0072: nop + IL_0073: nop + IL_0074: leave.s IL_0093 + + } // end .try + catch [mscorlib]System.Exception + { + IL_0076: stloc.s V_7 + IL_0078: nop + IL_0079: ldstr "Exception caught: " + IL_007e: ldloc.s V_7 + IL_0080: callvirt instance string [mscorlib]System.Object::ToString() + IL_0085: call string [mscorlib]System.String::Concat(string, + string) + IL_008a: call void [mscorlib]System.Console::WriteLine(string) + IL_008f: nop + IL_0090: nop + IL_0091: leave.s IL_0093 + + } // end handler + IL_0093: newobj instance void class GI23Class`1::.ctor() + IL_0098: stloc.s V_4 + IL_009a: ldloc.s V_4 + IL_009c: stloc.s V_5 + IL_009e: ldstr "Calling GI1.Func on GI23Class - expecting ex" + + "ception" + IL_00a3: call void [mscorlib]System.Console::WriteLine(string) + IL_00a8: nop + .try + { + IL_00a9: nop + IL_00aa: ldloc.s V_5 + IL_00ac: ldloca.s V_8 + IL_00ae: callvirt instance int32 class GI1`1::Func(class [mscorlib]System.Type[]&) + IL_00b3: pop + IL_00b4: ldc.i4.0 + IL_00b5: ldstr "Expecting exception on GI23Class" + IL_00ba: call void Test::Assert(bool, + string) + IL_00bf: nop + IL_00c0: nop + IL_00c1: leave.s IL_00e0 + + } // end .try + catch [mscorlib]System.Exception + { + IL_00c3: stloc.s V_9 + IL_00c5: nop + IL_00c6: ldstr "Exception caught: " + IL_00cb: ldloc.s V_9 + IL_00cd: callvirt instance string [mscorlib]System.Object::ToString() + IL_00d2: call string [mscorlib]System.String::Concat(string, + string) + IL_00d7: call void [mscorlib]System.Console::WriteLine(string) + IL_00dc: nop + IL_00dd: nop + IL_00de: leave.s IL_00e0 + + } // end handler + IL_00e0: ret + } // end of method Program::Negative + + .method public hidebysig static void Positive() cil managed + { + // Code size 189 (0xbd) + .maxstack 2 + .locals init (class I4Class V_0, + class I1 V_1, + class I8Class V_2, + class GI4Class`1 V_3, + class [mscorlib]System.Type[] V_4, + class GI1`1 V_5) + IL_0000: nop + IL_0001: ldstr "Calling I1.Func on I4Class - expecting I4.Func" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: newobj instance void I4Class::.ctor() + IL_0011: stloc.0 + IL_0012: ldloc.0 + IL_0013: stloc.1 + IL_0014: ldloc.1 + IL_0015: ldc.i4.s 10 + IL_0017: callvirt instance int32 I1::Func(int32) + IL_001c: ldc.i4.s 14 + IL_001e: ceq + IL_0020: ldstr "Expecting I1.Func to land on I4.Func" + IL_0025: call void Test::Assert(bool, + string) + IL_002a: nop + IL_002b: ldstr "Calling I1.Func on I8Class - expecting I8.Func" + IL_0030: call void [mscorlib]System.Console::WriteLine(string) + IL_0035: nop + IL_0036: newobj instance void I8Class::.ctor() + IL_003b: stloc.2 + IL_003c: ldloc.2 + IL_003d: stloc.1 + IL_003e: ldloc.1 + IL_003f: ldc.i4.s 10 + IL_0041: callvirt instance int32 I1::Func(int32) + IL_0046: ldc.i4.s 18 + IL_0048: ceq + IL_004a: ldstr "Expecting I1.Func to land on I8.Func" + IL_004f: call void Test::Assert(bool, + string) + IL_0054: nop + IL_0055: ldstr "Calling GI1.Func on GI4Class - expecting G" + + "I4.Func" + IL_005a: call void [mscorlib]System.Console::WriteLine(string) + IL_005f: nop + IL_0060: newobj instance void class GI4Class`1::.ctor() + IL_0065: stloc.3 + IL_0066: ldloc.3 + IL_0067: stloc.s V_5 + IL_0069: ldloc.s V_5 + IL_006b: ldloca.s V_4 + IL_006d: callvirt instance int32 class GI1`1::Func(class [mscorlib]System.Type[]&) + IL_0072: ldc.i4.4 + IL_0073: ceq + IL_0075: ldstr "Expecting GI1.Func to land on GII4.Func" + IL_007a: call void Test::Assert(bool, + string) + IL_007f: nop + IL_0080: ldloc.s V_4 + IL_0082: ldc.i4.0 + IL_0083: ldelem.ref + IL_0084: ldtoken [mscorlib]System.Object + IL_0089: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_008e: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_0093: ldstr "T must be object" + IL_0098: call void Test::Assert(bool, + string) + IL_009d: nop + IL_009e: ldloc.s V_4 + IL_00a0: ldc.i4.1 + IL_00a1: ldelem.ref + IL_00a2: ldtoken [mscorlib]System.String + IL_00a7: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_00ac: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_00b1: ldstr "S must be string" + IL_00b6: call void Test::Assert(bool, + string) + IL_00bb: nop + IL_00bc: ret + } // end of method Program::Positive + + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + // Code size 23 (0x17) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: call void Program::Negative() + IL_0006: nop + IL_0007: call void Program::Positive() + IL_000c: nop + IL_000d: call int32 Test::Ret() + IL_0012: stloc.0 + IL_0013: br.s IL_0015 + + IL_0015: ldloc.0 + IL_0016: ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file diamondshape.res diff --git a/mono/tests/dim-genericmethods.il b/mono/tests/dim-genericmethods.il new file mode 100644 index 0000000000..d588bfbbf5 --- /dev/null +++ b/mono/tests/dim-genericmethods.il @@ -0,0 +1,357 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly genericmethods +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module genericmethods.exe +// MVID: {62CAFB9A-4CDB-4A62-8A4F-DC7648609070} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x01790000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IFoo +{ + .method public hidebysig newslot virtual + instance class [mscorlib]System.Type + Foo() cil managed + { + // Code size 37 (0x25) + .maxstack 2 + .locals init (class [mscorlib]System.Type V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo::Foo: TypeOf(T) = {0}" + IL_0006: ldtoken !!T + IL_000b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0010: call void [mscorlib]System.Console::WriteLine(string, + object) + IL_0015: nop + IL_0016: ldtoken !!T + IL_001b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0020: stloc.0 + IL_0021: br.s IL_0023 + + IL_0023: ldloc.0 + IL_0024: ret + } // end of method IFoo::Foo + +} // end of class IFoo + +.class interface private abstract auto ansi IBar`1 +{ + .method public hidebysig newslot virtual + instance class [mscorlib]System.Type + Bar1

() cil managed + { + // Code size 37 (0x25) + .maxstack 2 + .locals init (class [mscorlib]System.Type V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::Foo

: TypeOf(P) = {0}" + IL_0006: ldtoken !!P + IL_000b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0010: call void [mscorlib]System.Console::WriteLine(string, + object) + IL_0015: nop + IL_0016: ldtoken !!P + IL_001b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0020: stloc.0 + IL_0021: br.s IL_0023 + + IL_0023: ldloc.0 + IL_0024: ret + } // end of method IBar`1::Bar1 + + .method public hidebysig newslot virtual + instance class [mscorlib]System.Type + Bar2() cil managed + { + // Code size 37 (0x25) + .maxstack 2 + .locals init (class [mscorlib]System.Type V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::Bar2: TypeOf(K) = {0}" + IL_0006: ldtoken !!K + IL_000b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0010: call void [mscorlib]System.Console::WriteLine(string, + object) + IL_0015: nop + IL_0016: ldtoken !!K + IL_001b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0020: stloc.0 + IL_0021: br.s IL_0023 + + IL_0023: ldloc.0 + IL_0024: ret + } // end of method IBar`1::Bar2 + + .method public hidebysig newslot virtual + instance void Bar3([out] class [mscorlib]System.Type& t, + [out] class [mscorlib]System.Type& u) cil managed + { + // Code size 57 (0x39) + .maxstack 8 + IL_0000: nop + IL_0001: ldstr "At IBar::Bar3: TypeOf(P) = {0}, TypeOf(K)" + + " = {1}" + IL_0006: ldtoken !!P + IL_000b: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0010: ldtoken !!K + IL_0015: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_001a: call void [mscorlib]System.Console::WriteLine(string, + object, + object) + IL_001f: nop + IL_0020: ldarg.1 + IL_0021: ldtoken !!P + IL_0026: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_002b: stind.ref + IL_002c: ldarg.2 + IL_002d: ldtoken !!K + IL_0032: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0037: stind.ref + IL_0038: ret + } // end of method IBar`1::Bar3 + +} // end of class IBar`1 + +.class private auto ansi beforefieldinit FooBar`1 + extends [mscorlib]System.Object + implements IFoo, + class IBar`1 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method FooBar`1::.ctor + +} // end of class FooBar`1 + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method private hidebysig static int32 + Main(string[] args) cil managed + { + .entrypoint + // Code size 223 (0xdf) + .maxstack 3 + .locals init (class FooBar`1 V_0, + class IFoo V_1, + class IBar`1 V_2, + class [mscorlib]System.Type V_3, + class [mscorlib]System.Type V_4, + int32 V_5) + IL_0000: nop + IL_0001: newobj instance void class FooBar`1::.ctor() + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldloc.0 + IL_000a: stloc.2 + IL_000b: ldstr "Calling IFoo.Foo on FooBar - expec" + + "ting IFoo::Foo() returning typeof(string)" + IL_0010: call void [mscorlib]System.Console::WriteLine(string) + IL_0015: nop + IL_0016: ldloc.1 + IL_0017: callvirt instance class [mscorlib]System.Type IFoo::Foo() + IL_001c: ldtoken [mscorlib]System.String + IL_0021: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0026: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_002b: ldstr "Calling IFoo.Foo on FooBar" + IL_0030: call void Test::Assert(bool, + string) + IL_0035: nop + IL_0036: ldstr "Calling IBar.Bar1 on FooBar - expe" + + "cting bar.Bar1() returning typeof(string)" + IL_003b: call void [mscorlib]System.Console::WriteLine(string) + IL_0040: nop + IL_0041: ldloc.2 + IL_0042: callvirt instance class [mscorlib]System.Type class IBar`1::Bar1() + IL_0047: ldtoken [mscorlib]System.String + IL_004c: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0051: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_0056: ldstr "Calling IBar.Bar1 on FooBar" + IL_005b: call void Test::Assert(bool, + string) + IL_0060: nop + IL_0061: ldstr "Calling IBar.Bar2 on FooBar - ex" + + "pecting bar.Bar2() returning typeof(string[])" + IL_0066: call void [mscorlib]System.Console::WriteLine(string) + IL_006b: nop + IL_006c: ldloc.2 + IL_006d: callvirt instance class [mscorlib]System.Type class IBar`1::Bar2() + IL_0072: ldtoken string[] + IL_0077: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_007c: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_0081: ldstr "Calling IBar.Bar2 on FooBar" + IL_0086: call void Test::Assert(bool, + string) + IL_008b: nop + IL_008c: ldstr "Calling IBar.Bar3 - expecting ba" + + "r.Bar3() returning typeof(string), typeof(string[])" + IL_0091: call void [mscorlib]System.Console::WriteLine(string) + IL_0096: nop + IL_0097: ldloc.2 + IL_0098: ldloca.s V_3 + IL_009a: ldloca.s V_4 + IL_009c: callvirt instance void class IBar`1::Bar3(class [mscorlib]System.Type&, + class [mscorlib]System.Type&) + IL_00a1: nop + IL_00a2: ldloc.3 + IL_00a3: ldtoken [mscorlib]System.String + IL_00a8: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_00ad: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_00b2: brfalse.s IL_00c7 + + IL_00b4: ldloc.s V_4 + IL_00b6: ldtoken string[] + IL_00bb: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_00c0: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_00c5: br.s IL_00c8 + + IL_00c7: ldc.i4.0 + IL_00c8: ldstr "Calling IBar.Bar3" + IL_00cd: call void Test::Assert(bool, + string) + IL_00d2: nop + IL_00d3: call int32 Test::Ret() + IL_00d8: stloc.s V_5 + IL_00da: br.s IL_00dc + + IL_00dc: ldloc.s V_5 + IL_00de: ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file genericmethods.res diff --git a/mono/tests/dim-methodimpl.il b/mono/tests/dim-methodimpl.il new file mode 100644 index 0000000000..519ed72987 --- /dev/null +++ b/mono/tests/dim-methodimpl.il @@ -0,0 +1,1677 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly methodimpl +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module methodimpl.exe +// MVID: {F249A85F-3FD2-488F-B084-97B542AD68D6} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x02FD0000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IFoo +{ + .method public hidebysig newslot virtual + instance int32 Foo1(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IIFoo.Foo1" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 1 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo1 + + .method public hidebysig newslot virtual + instance int32 Foo2(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 2 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo2 + + .method public hidebysig newslot virtual + instance int32 Foo3(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo3" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 3 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo3 + + .method public hidebysig newslot virtual + instance int32 Foo4(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo4" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 4 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo4 + + .method public hidebysig newslot virtual + instance int32 Foo5(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo5" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 5 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo5 + + .method public hidebysig newslot virtual + instance int32 Foo6(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo6" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 6 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo6 + + .method public hidebysig newslot virtual + instance int32 Foo7(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo7" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 7 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo7 + + .method public hidebysig newslot virtual + instance int32 Foo8(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo8" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 8 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo8 + + .method public hidebysig newslot virtual + instance int32 Foo9(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo9" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 9 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFoo::Foo9 +} // end of class IFoo + +.class interface private abstract auto ansi IBar + implements IFoo +{ + .method public hidebysig newslot virtual + instance int32 Bar1(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IIBar.Bar1" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 11 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar1 + + .method public hidebysig newslot virtual + instance int32 Bar2(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 22 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar2 + + .method public hidebysig newslot virtual + instance int32 Bar3(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar3" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 33 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar3 + + .method public hidebysig newslot virtual + instance int32 Bar4(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar4" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 44 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar4 + + .method public hidebysig newslot virtual + instance int32 Bar5(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar5" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 55 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar5 + + .method public hidebysig newslot virtual + instance int32 Bar6(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar6" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 66 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar6 + + .method public hidebysig newslot virtual + instance int32 Bar7(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar7" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 77 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar7 + + .method public hidebysig newslot virtual + instance int32 Bar8(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar8" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 88 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar8 + + .method public hidebysig newslot virtual + instance int32 Bar9(int32 a) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar9" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 99 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar9 + + ////////////////////////////////////////////////////////////////////////////// + // Overriding IFoo + ////////////////////////////////////////////////////////////////////////////// + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo1(int32 a) cil managed + { + .override IFoo::Foo1 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::IFoo.Foo1" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 10 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::IFoo.Foo1 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo2(int32 a) cil managed + { + .override IFoo::Foo2 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::IFoo.Foo2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 20 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::IFoo.Foo2 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo3(int32 a) cil managed + { + .override IFoo::Foo3 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::IFoo.Foo3" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 30 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::IFoo.Foo3 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo4(int32 a) cil managed + { + .override IFoo::Foo4 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::IFoo.Foo4" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 40 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::IFoo.Foo4 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo5(int32 a) cil managed + { + .override IFoo::Foo5 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar::IFoo.Foo5" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 50 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::IFoo.Foo5 +} // end of class IBar + +.class interface private abstract auto ansi IBlah + implements IBar, + IFoo +{ + .method public hidebysig newslot virtual + instance int32 Blah1(int32 c) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah1" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 111 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::Blah1 + + .method public hidebysig newslot virtual + instance int32 Blah2(int32 c) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 222 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::Blah2 + + .method public hidebysig newslot virtual + instance int32 Blah3(int32 c) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah3" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 333 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::Blah3 + + ////////////////////////////////////////////////////////////////////////////// + // Overriding IFoo + ////////////////////////////////////////////////////////////////////////////// + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo6(int32 a) cil managed + { + .override IFoo::Foo6 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IFoo.Foo6" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 60 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IFoo.Foo6 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo7(int32 a) cil managed + { + .override IFoo::Foo7 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IFoo.Foo7" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 70 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IFoo.Foo6 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo8(int32 a) cil managed + { + .override IFoo::Foo8 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IFoo.Foo8" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 80 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IFoo.Foo8 + + .method private hidebysig newslot virtual final + instance int32 IFoo.Foo9(int32 a) cil managed + { + .override IFoo::Foo9 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IFoo.Foo9" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 90 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IFoo.Foo9 + + ////////////////////////////////////////////////////////////////////////////// + // Overriding IBar + ////////////////////////////////////////////////////////////////////////////// + + .method private hidebysig newslot virtual final + instance int32 IBar.Bar1(int32 a) cil managed + { + .override IBar::Bar1 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IBar.Bar1" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 110 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IBar.Bar1 + + .method private hidebysig newslot virtual final + instance int32 IBar.Bar2(int32 a) cil managed + { + .override IBar::Bar2 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IBar.Bar2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 220 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IBar.Bar2 + + .method private hidebysig newslot virtual final + instance int32 IBar.Bar3(int32 a) cil managed + { + .override IBar::Bar3 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IBar.Bar3" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 330 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IBar.Bar3 + + .method private hidebysig newslot virtual final + instance int32 IBar.Bar4(int32 a) cil managed + { + .override IBar::Bar4 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IBar.Bar4" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 440 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IBar.Bar4 + + .method private hidebysig newslot virtual final + instance int32 IBar.Bar5(int32 a) cil managed + { + .override IBar::Bar5 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah::IBar.Bar5" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 550 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlah::IBar.Bar5 +} // end of class IBlah + +.class private auto ansi beforefieldinit IBarImpl + extends [mscorlib]System.Object + implements IBar, + IFoo +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method IBarImpl::.ctor + +} // end of class IBarImpl + +.class private auto ansi beforefieldinit IBlahImpl + extends IBarImpl + implements IBlah, + IBar, + IFoo +{ + .method private hidebysig newslot virtual final + instance int32 IBlah.Blah2(int32 c) cil managed + { + .override IBlah::Blah2 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlahImpl::IBlah.Blah2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 2220 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlahImpl::IBlah.Blah2 + + .method private hidebysig newslot virtual final + instance int32 IBlah.Blah3(int32 c) cil managed + { + .override IBlah::Blah3 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlahImpl::IBlah.Blah2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 3330 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBlahImpl::IBlah.Blah3 + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void IBarImpl::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method IBlahImpl::.ctor + +} // end of class IBlahImpl + +.class interface private abstract auto ansi IFooBarBlah + implements IFoo, + IBar, + IBlah +{ + .method private hidebysig newslot virtual final + instance int32 IFooBarBlah.FooBarBlah1(int32 c) cil managed + { + .override IFoo::Foo1 + .override IBar::Bar1 + .override IBlah::Blah1 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFooBarBlah.FooBarBlah1" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 11111 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFooBarBlah.FooBarBlah1 + .method private hidebysig newslot virtual final + instance int32 IFooBarBlah.FooBarBlah2(int32 c) cil managed + { + .override IFoo::Foo2 + .override IBar::Bar2 + .override IBlah::Blah2 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFooBarBlah.FooBarBlah2" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 22222 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFooBarBlah.FooBarBlah1 + + .method private hidebysig newslot virtual final + instance int32 IFooBarBlah.FooBarBlah3(int32 c) cil managed + { + .override IFoo::Foo3 + .override IFoo::Foo4 + .override IFoo::Foo5 + .override IBar::Bar3 + .override IBar::Bar4 + .override IBar::Bar5 + .override IBlah::Blah3 + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFooBarBlah.FooBarBlah3" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4 33333 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IFooBarBlah.FooBarBlah3 +} // end of class IFooBarBlah + +.class private auto ansi beforefieldinit FooBarBlahImpl + implements IFooBarBlah, + IFoo, + IBar, + IBlah +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void IBlahImpl::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method FooBarBlahImpl::.ctor + +} // end of class FooBarBlahImpl + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + // Code size 23 (0x17) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: call void Program::SingleOverride() + IL_0006: nop + IL_0007: call void Program::MultiOverride() + IL_000c: nop + IL_000d: call int32 Test::Ret() + IL_0012: stloc.0 + IL_0013: br.s IL_0015 + + IL_0015: ldloc.0 + IL_0016: ret + } // end of method Program::Main + + .method private hidebysig static void SingleOverride() cil managed + { + // Code size 946 (0x3b2) + .maxstack 2 + .locals init (class IBarImpl V_0, + class IFoo V_1, + class IBar V_2, + class IBlahImpl V_3, + class IBlah V_4) + IL_0000: nop + IL_0001: newobj instance void IBarImpl::.ctor() + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldstr "Calling IFoo.Foo methods on IBarImpl..." + IL_000e: call void [mscorlib]System.Console::WriteLine(string) + IL_0013: nop + IL_0014: ldloc.1 + IL_0015: ldc.i4.1 + IL_0016: callvirt instance int32 IFoo::Foo1(int32) + IL_001b: ldc.i4.s 11 + IL_001d: ceq + IL_001f: ldstr "Calling IFoo.Foo1 on IBarImpl" + IL_0024: call void Test::Assert(bool, + string) + IL_0029: nop + IL_002a: ldloc.1 + IL_002b: ldc.i4.2 + IL_002c: callvirt instance int32 IFoo::Foo2(int32) + IL_0031: ldc.i4.s 22 + IL_0033: ceq + IL_0035: ldstr "Calling IFoo.Foo2 on IBarImpl" + IL_003a: call void Test::Assert(bool, + string) + IL_003f: nop + IL_0040: ldloc.1 + IL_0041: ldc.i4.3 + IL_0042: callvirt instance int32 IFoo::Foo3(int32) + IL_0047: ldc.i4.s 33 + IL_0049: ceq + IL_004b: ldstr "Calling IFoo.Foo3 on IBarImpl" + IL_0050: call void Test::Assert(bool, + string) + IL_0055: nop + IL_0056: ldloc.1 + IL_0057: ldc.i4.4 + IL_0058: callvirt instance int32 IFoo::Foo4(int32) + IL_005d: ldc.i4.s 44 + IL_005f: ceq + IL_0061: ldstr "Calling IFoo.Foo4 on IBarImpl" + IL_0066: call void Test::Assert(bool, + string) + IL_006b: nop + IL_006c: ldloc.1 + IL_006d: ldc.i4.5 + IL_006e: callvirt instance int32 IFoo::Foo5(int32) + IL_0073: ldc.i4.s 55 + IL_0075: ceq + IL_0077: ldstr "Calling IFoo.Foo5 on IBarImpl" + IL_007c: call void Test::Assert(bool, + string) + IL_0081: nop + IL_0082: ldloc.1 + IL_0083: ldc.i4.0 + IL_0084: callvirt instance int32 IFoo::Foo6(int32) + IL_0089: ldc.i4.6 + IL_008a: ceq + IL_008c: ldstr "Calling IFoo.Foo6 on IBarImpl" + IL_0091: call void Test::Assert(bool, + string) + IL_0096: nop + IL_0097: ldloc.1 + IL_0098: ldc.i4.0 + IL_0099: callvirt instance int32 IFoo::Foo7(int32) + IL_009e: ldc.i4.7 + IL_009f: ceq + IL_00a1: ldstr "Calling IFoo.Foo7 on IBarImpl" + IL_00a6: call void Test::Assert(bool, + string) + IL_00ab: nop + IL_00ac: ldloc.1 + IL_00ad: ldc.i4.0 + IL_00ae: callvirt instance int32 IFoo::Foo8(int32) + IL_00b3: ldc.i4.8 + IL_00b4: ceq + IL_00b6: ldstr "Calling IFoo.Foo8 on IBarImpl" + IL_00bb: call void Test::Assert(bool, + string) + IL_00c0: nop + IL_00c1: ldloc.1 + IL_00c2: ldc.i4.0 + IL_00c3: callvirt instance int32 IFoo::Foo9(int32) + IL_00c8: ldc.i4.s 9 + IL_00ca: ceq + IL_00cc: ldstr "Calling IFoo.Foo9 on IBarImpl" + IL_00d1: call void Test::Assert(bool, + string) + IL_00d6: nop + IL_00d7: ldloc.0 + IL_00d8: stloc.2 + IL_00d9: ldstr "Calling IBar.Bar methods on IBarImpl..." + IL_00de: call void [mscorlib]System.Console::WriteLine(string) + IL_00e3: nop + IL_00e4: ldloc.2 + IL_00e5: ldc.i4.0 + IL_00e6: callvirt instance int32 IBar::Bar1(int32) + IL_00eb: ldc.i4.s 11 + IL_00ed: ceq + IL_00ef: ldstr "Calling IBar.Bar1 on IBarImpl" + IL_00f4: call void Test::Assert(bool, + string) + IL_00f9: nop + IL_00fa: ldloc.2 + IL_00fb: ldc.i4.0 + IL_00fc: callvirt instance int32 IBar::Bar2(int32) + IL_0101: ldc.i4.s 22 + IL_0103: ceq + IL_0105: ldstr "Calling IBar.Bar2 on IBarImpl" + IL_010a: call void Test::Assert(bool, + string) + IL_010f: nop + IL_0110: ldloc.2 + IL_0111: ldc.i4.0 + IL_0112: callvirt instance int32 IBar::Bar3(int32) + IL_0117: ldc.i4.s 33 + IL_0119: ceq + IL_011b: ldstr "Calling IBar.Bar3 on IBarImpl" + IL_0120: call void Test::Assert(bool, + string) + IL_0125: nop + IL_0126: ldloc.2 + IL_0127: ldc.i4.0 + IL_0128: callvirt instance int32 IBar::Bar4(int32) + IL_012d: ldc.i4.s 44 + IL_012f: ceq + IL_0131: ldstr "Calling IBar.Bar4 on IBarImpl" + IL_0136: call void Test::Assert(bool, + string) + IL_013b: nop + IL_013c: ldloc.2 + IL_013d: ldc.i4.0 + IL_013e: callvirt instance int32 IBar::Bar5(int32) + IL_0143: ldc.i4.s 55 + IL_0145: ceq + IL_0147: ldstr "Calling IBar.Bar5 on IBarImpl" + IL_014c: call void Test::Assert(bool, + string) + IL_0151: nop + IL_0152: ldloc.2 + IL_0153: ldc.i4.0 + IL_0154: callvirt instance int32 IBar::Bar6(int32) + IL_0159: ldc.i4.s 66 + IL_015b: ceq + IL_015d: ldstr "Calling IBar.Bar6 on IBarImpl" + IL_0162: call void Test::Assert(bool, + string) + IL_0167: nop + IL_0168: ldloc.2 + IL_0169: ldc.i4.0 + IL_016a: callvirt instance int32 IBar::Bar7(int32) + IL_016f: ldc.i4.s 77 + IL_0171: ceq + IL_0173: ldstr "Calling IBar.Bar7 on IBarImpl" + IL_0178: call void Test::Assert(bool, + string) + IL_017d: nop + IL_017e: ldloc.2 + IL_017f: ldc.i4.0 + IL_0180: callvirt instance int32 IBar::Bar8(int32) + IL_0185: ldc.i4.s 88 + IL_0187: ceq + IL_0189: ldstr "Calling IBar.Bar8 on IBarImpl" + IL_018e: call void Test::Assert(bool, + string) + IL_0193: nop + IL_0194: ldloc.2 + IL_0195: ldc.i4.0 + IL_0196: callvirt instance int32 IBar::Bar9(int32) + IL_019b: ldc.i4.s 99 + IL_019d: ceq + IL_019f: ldstr "Calling IBar.Bar9 on IBarImpl" + IL_01a4: call void Test::Assert(bool, + string) + IL_01a9: nop + IL_01aa: newobj instance void IBlahImpl::.ctor() + IL_01af: stloc.3 + IL_01b0: ldloc.3 + IL_01b1: stloc.1 + IL_01b2: ldloc.1 + IL_01b3: ldc.i4.1 + IL_01b4: callvirt instance int32 IFoo::Foo1(int32) + IL_01b9: ldc.i4.s 11 + IL_01bb: ceq + IL_01bd: ldstr "Calling IFoo.Foo1 on IBlahImpl" + IL_01c2: call void Test::Assert(bool, + string) + IL_01c7: nop + IL_01c8: ldloc.1 + IL_01c9: ldc.i4.2 + IL_01ca: callvirt instance int32 IFoo::Foo2(int32) + IL_01cf: ldc.i4.s 22 + IL_01d1: ceq + IL_01d3: ldstr "Calling IFoo.Foo2 on IBlahImpl" + IL_01d8: call void Test::Assert(bool, + string) + IL_01dd: nop + IL_01de: ldloc.1 + IL_01df: ldc.i4.3 + IL_01e0: callvirt instance int32 IFoo::Foo3(int32) + IL_01e5: ldc.i4.s 33 + IL_01e7: ceq + IL_01e9: ldstr "Calling IFoo.Foo3 on IBlahImpl" + IL_01ee: call void Test::Assert(bool, + string) + IL_01f3: nop + IL_01f4: ldloc.1 + IL_01f5: ldc.i4.4 + IL_01f6: callvirt instance int32 IFoo::Foo4(int32) + IL_01fb: ldc.i4.s 44 + IL_01fd: ceq + IL_01ff: ldstr "Calling IFoo.Foo4 on IBlahImpl" + IL_0204: call void Test::Assert(bool, + string) + IL_0209: nop + IL_020a: ldloc.1 + IL_020b: ldc.i4.5 + IL_020c: callvirt instance int32 IFoo::Foo5(int32) + IL_0211: ldc.i4.s 55 + IL_0213: ceq + IL_0215: ldstr "Calling IFoo.Foo5 on IBlahImpl" + IL_021a: call void Test::Assert(bool, + string) + IL_021f: nop + IL_0220: ldloc.1 + IL_0221: ldc.i4.6 + IL_0222: callvirt instance int32 IFoo::Foo6(int32) + IL_0227: ldc.i4.s 66 + IL_0229: ceq + IL_022b: ldstr "Calling IFoo.Foo6 on IBlahImpl" + IL_0230: call void Test::Assert(bool, + string) + IL_0235: nop + IL_0236: ldloc.1 + IL_0237: ldc.i4.7 + IL_0238: callvirt instance int32 IFoo::Foo7(int32) + IL_023d: ldc.i4.s 77 + IL_023f: ceq + IL_0241: ldstr "Calling IFoo.Foo7 on IBlahImpl" + IL_0246: call void Test::Assert(bool, + string) + IL_024b: nop + IL_024c: ldloc.1 + IL_024d: ldc.i4.8 + IL_024e: callvirt instance int32 IFoo::Foo8(int32) + IL_0253: ldc.i4.s 88 + IL_0255: ceq + IL_0257: ldstr "Calling IFoo.Foo8 on IBlahImpl" + IL_025c: call void Test::Assert(bool, + string) + IL_0261: nop + IL_0262: ldloc.1 + IL_0263: ldc.i4.s 9 + IL_0265: callvirt instance int32 IFoo::Foo9(int32) + IL_026a: ldc.i4.s 99 + IL_026c: ceq + IL_026e: ldstr "Calling IFoo.Foo9 on IBlahImpl" + IL_0273: call void Test::Assert(bool, + string) + IL_0278: nop + IL_0279: ldloc.3 + IL_027a: stloc.2 + IL_027b: ldstr "Calling IBar.Bar methods on IBlahImpl..." + IL_0280: call void [mscorlib]System.Console::WriteLine(string) + IL_0285: nop + IL_0286: ldloc.2 + IL_0287: ldc.i4.1 + IL_0288: callvirt instance int32 IBar::Bar1(int32) + IL_028d: ldc.i4.s 111 + IL_028f: ceq + IL_0291: ldstr "Calling IBar.Bar1 on IBlahImpl" + IL_0296: call void Test::Assert(bool, + string) + IL_029b: nop + IL_029c: ldloc.2 + IL_029d: ldc.i4.2 + IL_029e: callvirt instance int32 IBar::Bar2(int32) + IL_02a3: ldc.i4 0xde + IL_02a8: ceq + IL_02aa: ldstr "Calling IBar.Bar2 on IBlahImpl" + IL_02af: call void Test::Assert(bool, + string) + IL_02b4: nop + IL_02b5: ldloc.2 + IL_02b6: ldc.i4.3 + IL_02b7: callvirt instance int32 IBar::Bar3(int32) + IL_02bc: ldc.i4 0x14d + IL_02c1: ceq + IL_02c3: ldstr "Calling IBar.Bar3 on IBlahImpl" + IL_02c8: call void Test::Assert(bool, + string) + IL_02cd: nop + IL_02ce: ldloc.2 + IL_02cf: ldc.i4.4 + IL_02d0: callvirt instance int32 IBar::Bar4(int32) + IL_02d5: ldc.i4 0x1bc + IL_02da: ceq + IL_02dc: ldstr "Calling IBar.Bar4 on IBlahImpl" + IL_02e1: call void Test::Assert(bool, + string) + IL_02e6: nop + IL_02e7: ldloc.2 + IL_02e8: ldc.i4.5 + IL_02e9: callvirt instance int32 IBar::Bar5(int32) + IL_02ee: ldc.i4 0x22b + IL_02f3: ceq + IL_02f5: ldstr "Calling IBar.Bar5 on IBlahImpl" + IL_02fa: call void Test::Assert(bool, + string) + IL_02ff: nop + IL_0300: ldloc.2 + IL_0301: ldc.i4.0 + IL_0302: callvirt instance int32 IBar::Bar6(int32) + IL_0307: ldc.i4.s 66 + IL_0309: ceq + IL_030b: ldstr "Calling IBar.Bar6 on IBlahImpl" + IL_0310: call void Test::Assert(bool, + string) + IL_0315: nop + IL_0316: ldloc.2 + IL_0317: ldc.i4.0 + IL_0318: callvirt instance int32 IBar::Bar7(int32) + IL_031d: ldc.i4.s 77 + IL_031f: ceq + IL_0321: ldstr "Calling IBar.Bar7 on IBlahImpl" + IL_0326: call void Test::Assert(bool, + string) + IL_032b: nop + IL_032c: ldloc.2 + IL_032d: ldc.i4.0 + IL_032e: callvirt instance int32 IBar::Bar8(int32) + IL_0333: ldc.i4.s 88 + IL_0335: ceq + IL_0337: ldstr "Calling IBar.Bar8 on IBlahImpl" + IL_033c: call void Test::Assert(bool, + string) + IL_0341: nop + IL_0342: ldloc.2 + IL_0343: ldc.i4.0 + IL_0344: callvirt instance int32 IBar::Bar9(int32) + IL_0349: ldc.i4.s 99 + IL_034b: ceq + IL_034d: ldstr "Calling IBar.Bar9 on IBlahImpl" + IL_0352: call void Test::Assert(bool, + string) + IL_0357: nop + IL_0358: ldloc.3 + IL_0359: stloc.s V_4 + IL_035b: ldstr "Calling IBlah.Blah methods on IBlahImpl..." + IL_0360: call void [mscorlib]System.Console::WriteLine(string) + IL_0365: nop + IL_0366: ldloc.s V_4 + IL_0368: ldc.i4.0 + IL_0369: callvirt instance int32 IBlah::Blah1(int32) + IL_036e: ldc.i4.s 111 + IL_0370: ceq + IL_0372: ldstr "Calling IBlah.Blah1 on IBlahImpl" + IL_0377: call void Test::Assert(bool, + string) + IL_037c: nop + IL_037d: ldloc.s V_4 + IL_037f: ldc.i4.2 + IL_0380: callvirt instance int32 IBlah::Blah2(int32) + IL_0385: ldc.i4 0x8ae + IL_038a: ceq + IL_038c: ldstr "Calling IBlah.Blah1 on IBlahImpl" + IL_0391: call void Test::Assert(bool, + string) + IL_0396: nop + IL_0397: ldloc.s V_4 + IL_0399: ldc.i4.3 + IL_039a: callvirt instance int32 IBlah::Blah3(int32) + IL_039f: ldc.i4 0xd05 + IL_03a4: ceq + IL_03a6: ldstr "Calling IBlah.Blah1 on IBlahImpl" + IL_03ab: call void Test::Assert(bool, + string) + IL_03b0: nop + IL_03b1: ret + } // end of method Program::SingleOverride + + .method private hidebysig static void MultiOverride() cil managed + { + // Code size 549 (0x225) + .maxstack 2 + .locals init (class FooBarBlahImpl V_0, + class IFoo V_1, + class IBar V_2, + class IBlah V_3) + IL_0000: nop + IL_0001: newobj instance void FooBarBlahImpl::.ctor() + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldstr "Calling IFoo.Foo methods on FooBarBlahImpl..." + IL_000e: call void [mscorlib]System.Console::WriteLine(string) + IL_0013: nop + IL_0014: ldloc.1 + IL_0015: ldc.i4.0 + IL_0016: callvirt instance int32 IFoo::Foo1(int32) + IL_001b: ldc.i4 0x2b67 + IL_0020: ceq + IL_0022: ldstr "Calling IFoo.Foo1 on FooBarBlahImpl" + IL_0027: call void Test::Assert(bool, + string) + IL_002c: nop + IL_002d: ldloc.1 + IL_002e: ldc.i4.0 + IL_002f: callvirt instance int32 IFoo::Foo2(int32) + IL_0034: ldc.i4 0x56ce + IL_0039: ceq + IL_003b: ldstr "Calling IFoo.Foo2 on FooBarBlahImpl" + IL_0040: call void Test::Assert(bool, + string) + IL_0045: nop + IL_0046: ldloc.1 + IL_0047: ldc.i4.0 + IL_0048: callvirt instance int32 IFoo::Foo3(int32) + IL_004d: ldc.i4 0x8235 + IL_0052: ceq + IL_0054: ldstr "Calling IFoo.Foo3 on FooBarBlahImpl" + IL_0059: call void Test::Assert(bool, + string) + IL_005e: nop + IL_005f: ldloc.1 + IL_0060: ldc.i4.0 + IL_0061: callvirt instance int32 IFoo::Foo4(int32) + IL_0066: ldc.i4 0x8235 + IL_006b: ceq + IL_006d: ldstr "Calling IFoo.Foo4 on FooBarBlahImpl" + IL_0072: call void Test::Assert(bool, + string) + IL_0077: nop + IL_0078: ldloc.1 + IL_0079: ldc.i4.0 + IL_007a: callvirt instance int32 IFoo::Foo5(int32) + IL_007f: ldc.i4 0x8235 + IL_0084: ceq + IL_0086: ldstr "Calling IFoo.Foo5 on FooBarBlahImpl" + IL_008b: call void Test::Assert(bool, + string) + IL_0090: nop + IL_0091: ldloc.1 + IL_0092: ldc.i4.6 + IL_0093: callvirt instance int32 IFoo::Foo6(int32) + IL_0098: ldc.i4.s 66 + IL_009a: ceq + IL_009c: ldstr "Calling IFoo.Foo6 on FooBarBlahImpl" + IL_00a1: call void Test::Assert(bool, + string) + IL_00a6: nop + IL_00a7: ldloc.1 + IL_00a8: ldc.i4.7 + IL_00a9: callvirt instance int32 IFoo::Foo7(int32) + IL_00ae: ldc.i4.s 77 + IL_00b0: ceq + IL_00b2: ldstr "Calling IFoo.Foo7 on FooBarBlahImpl" + IL_00b7: call void Test::Assert(bool, + string) + IL_00bc: nop + IL_00bd: ldloc.1 + IL_00be: ldc.i4.8 + IL_00bf: callvirt instance int32 IFoo::Foo8(int32) + IL_00c4: ldc.i4.s 88 + IL_00c6: ceq + IL_00c8: ldstr "Calling IFoo.Foo8 on FooBarBlahImpl" + IL_00cd: call void Test::Assert(bool, + string) + IL_00d2: nop + IL_00d3: ldloc.1 + IL_00d4: ldc.i4.s 9 + IL_00d6: callvirt instance int32 IFoo::Foo9(int32) + IL_00db: ldc.i4.s 99 + IL_00dd: ceq + IL_00df: ldstr "Calling IFoo.Foo9 on FooBarBlahImpl" + IL_00e4: call void Test::Assert(bool, + string) + IL_00e9: nop + IL_00ea: ldloc.0 + IL_00eb: stloc.2 + IL_00ec: ldstr "Calling IBar.Bar methods on FooBarBlahImpl..." + IL_00f1: call void [mscorlib]System.Console::WriteLine(string) + IL_00f6: nop + IL_00f7: ldloc.2 + IL_00f8: ldc.i4.0 + IL_00f9: callvirt instance int32 IBar::Bar1(int32) + IL_00fe: ldc.i4 0x2b67 + IL_0103: ceq + IL_0105: ldstr "Calling IBar.Bar1 on FooBarBlahImpl" + IL_010a: call void Test::Assert(bool, + string) + IL_010f: nop + IL_0110: ldloc.2 + IL_0111: ldc.i4.0 + IL_0112: callvirt instance int32 IBar::Bar2(int32) + IL_0117: ldc.i4 0x56ce + IL_011c: ceq + IL_011e: ldstr "Calling IBar.Bar2 on FooBarBlahImpl" + IL_0123: call void Test::Assert(bool, + string) + IL_0128: nop + IL_0129: ldloc.2 + IL_012a: ldc.i4.0 + IL_012b: callvirt instance int32 IBar::Bar3(int32) + IL_0130: ldc.i4 0x8235 + IL_0135: ceq + IL_0137: ldstr "Calling IBar.Bar3 on FooBarBlahImpl" + IL_013c: call void Test::Assert(bool, + string) + IL_0141: nop + IL_0142: ldloc.2 + IL_0143: ldc.i4.0 + IL_0144: callvirt instance int32 IBar::Bar4(int32) + IL_0149: ldc.i4 0x8235 + IL_014e: ceq + IL_0150: ldstr "Calling IBar.Bar4 on FooBarBlahImpl" + IL_0155: call void Test::Assert(bool, + string) + IL_015a: nop + IL_015b: ldloc.2 + IL_015c: ldc.i4.0 + IL_015d: callvirt instance int32 IBar::Bar5(int32) + IL_0162: ldc.i4 0x8235 + IL_0167: ceq + IL_0169: ldstr "Calling IBar.Bar5 on FooBarBlahImpl" + IL_016e: call void Test::Assert(bool, + string) + IL_0173: nop + IL_0174: ldloc.2 + IL_0175: ldc.i4.0 + IL_0176: callvirt instance int32 IBar::Bar6(int32) + IL_017b: ldc.i4.s 66 + IL_017d: ceq + IL_017f: ldstr "Calling IBar.Bar6 on FooBarBlahImpl" + IL_0184: call void Test::Assert(bool, + string) + IL_0189: nop + IL_018a: ldloc.2 + IL_018b: ldc.i4.0 + IL_018c: callvirt instance int32 IBar::Bar7(int32) + IL_0191: ldc.i4.s 77 + IL_0193: ceq + IL_0195: ldstr "Calling IBar.Bar7 on FooBarBlahImpl" + IL_019a: call void Test::Assert(bool, + string) + IL_019f: nop + IL_01a0: ldloc.2 + IL_01a1: ldc.i4.0 + IL_01a2: callvirt instance int32 IBar::Bar8(int32) + IL_01a7: ldc.i4.s 88 + IL_01a9: ceq + IL_01ab: ldstr "Calling IBar.Bar8 on FooBarBlahImpl" + IL_01b0: call void Test::Assert(bool, + string) + IL_01b5: nop + IL_01b6: ldloc.2 + IL_01b7: ldc.i4.0 + IL_01b8: callvirt instance int32 IBar::Bar9(int32) + IL_01bd: ldc.i4.s 99 + IL_01bf: ceq + IL_01c1: ldstr "Calling IBar.Bar9 on FooBarBlahImpl" + IL_01c6: call void Test::Assert(bool, + string) + IL_01cb: nop + IL_01cc: ldloc.0 + IL_01cd: stloc.3 + IL_01ce: ldstr "Calling IBlah.Blah methods on FooBarBlahImpl..." + IL_01d3: call void [mscorlib]System.Console::WriteLine(string) + IL_01d8: nop + IL_01d9: ldloc.3 + IL_01da: ldc.i4.0 + IL_01db: callvirt instance int32 IBlah::Blah1(int32) + IL_01e0: ldc.i4 0x2b67 + IL_01e5: ceq + IL_01e7: ldstr "Calling IBlah.Blah1 on FooBarBlahImpl" + IL_01ec: call void Test::Assert(bool, + string) + IL_01f1: nop + IL_01f2: ldloc.3 + IL_01f3: ldc.i4.0 + IL_01f4: callvirt instance int32 IBlah::Blah2(int32) + IL_01f9: ldc.i4 0x56ce + IL_01fe: ceq + IL_0200: ldstr "Calling IBlah.Blah1 on FooBarBlahImpl" + IL_0205: call void Test::Assert(bool, + string) + IL_020a: nop + IL_020b: ldloc.3 + IL_020c: ldc.i4.0 + IL_020d: callvirt instance int32 IBlah::Blah3(int32) + IL_0212: ldc.i4 0x8235 + IL_0217: ceq + IL_0219: ldstr "Calling IBlah.Blah1 on FooBarBlahImpl" + IL_021e: call void Test::Assert(bool, + string) + IL_0223: nop + IL_0224: ret + } // end of method Program::MultiOverride + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file methodimpl.res diff --git a/mono/tests/dim-sharedgenerics.il b/mono/tests/dim-sharedgenerics.il new file mode 100644 index 0000000000..270ddfd375 --- /dev/null +++ b/mono/tests/dim-sharedgenerics.il @@ -0,0 +1,275 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly sharedgenerics +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module sharedgenerics.exe +// MVID: {0DEEC74C-30FE-495C-9653-12BE5220327A} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x02D40000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IFoo`1 +{ + .method public hidebysig newslot virtual + instance class [mscorlib]System.Type + Foo(!T a) cil managed + { + // Code size 50 (0x32) + .maxstack 3 + .locals init (class [mscorlib]System.Type V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo:Arg={0}, TypeOf(T)={1}" + IL_0006: ldarga.s a + IL_0008: constrained. !T + IL_000e: callvirt instance string [mscorlib]System.Object::ToString() + IL_0013: ldtoken !T + IL_0018: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_001d: call void [mscorlib]System.Console::WriteLine(string, + object, + object) + IL_0022: nop + IL_0023: ldtoken !T + IL_0028: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_002d: stloc.0 + IL_002e: br.s IL_0030 + + IL_0030: ldloc.0 + IL_0031: ret + } // end of method IFoo`1::Foo + +} // end of class IFoo`1 + +.class interface private abstract auto ansi IBar`1<- T> +{ + .method public hidebysig newslot virtual + instance class [mscorlib]System.Type + Bar(!T b) cil managed + { + // Code size 50 (0x32) + .maxstack 3 + .locals init (class [mscorlib]System.Type V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar:Arg={0}, TypeOf(T)={1}" + IL_0006: ldarga.s b + IL_0008: constrained. !T + IL_000e: callvirt instance string [mscorlib]System.Object::ToString() + IL_0013: ldtoken !T + IL_0018: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_001d: call void [mscorlib]System.Console::WriteLine(string, + object, + object) + IL_0022: nop + IL_0023: ldtoken !T + IL_0028: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_002d: stloc.0 + IL_002e: br.s IL_0030 + + IL_0030: ldloc.0 + IL_0031: ret + } // end of method IBar`1::Bar + +} // end of class IBar`1 + +.class private auto ansi beforefieldinit FooBar`2 + extends [mscorlib]System.Object + implements class IFoo`1, + class IBar`1 +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method FooBar`2::.ctor + +} // end of class FooBar`2 + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + // Code size 126 (0x7e) + .maxstack 5 + .locals init (class FooBar`2 V_0, + class IFoo`1 V_1, + class IBar`1 V_2, + int32 V_3) + IL_0000: nop + IL_0001: newobj instance void class FooBar`2::.ctor() + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldloc.0 + IL_000a: stloc.2 + IL_000b: ldstr "Calling IFoo.Foo on FooBar" + + " - expecting default method IFoo.Foo" + IL_0010: call void [mscorlib]System.Console::WriteLine(string) + IL_0015: nop + IL_0016: ldloc.1 + IL_0017: ldstr "ABC" + IL_001c: callvirt instance class [mscorlib]System.Type class IFoo`1::Foo(!0) + IL_0021: ldtoken [mscorlib]System.String + IL_0026: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_002b: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_0030: ldstr "Calling IFoo.Foo on FooBar" + IL_0035: call void Test::Assert(bool, + string) + IL_003a: nop + IL_003b: ldstr "Calling IBar.Foo on FooBar - expecting default method IBar.Foo" + IL_0040: call void [mscorlib]System.Console::WriteLine(string) + IL_0045: nop + IL_0046: ldloc.2 + IL_0047: ldc.i4.1 + IL_0048: newarr [mscorlib]System.String + IL_004d: dup + IL_004e: ldc.i4.0 + IL_004f: ldstr "ABC" + IL_0054: stelem.ref + IL_0055: callvirt instance class [mscorlib]System.Type class IBar`1::Bar(!0) + IL_005a: ldtoken [mscorlib]System.Object + IL_005f: call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) + IL_0064: call bool [mscorlib]System.Type::op_Equality(class [mscorlib]System.Type, + class [mscorlib]System.Type) + IL_0069: ldstr "Calling IBar.Bar on FooBar" + IL_006e: call void Test::Assert(bool, + string) + IL_0073: nop + IL_0074: call int32 Test::Ret() + IL_0079: stloc.3 + IL_007a: br.s IL_007c + + IL_007c: ldloc.3 + IL_007d: ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file sharedgenerics.res diff --git a/mono/tests/dim-simple.il b/mono/tests/dim-simple.il new file mode 100644 index 0000000000..d033fb5a77 --- /dev/null +++ b/mono/tests/dim-simple.il @@ -0,0 +1,397 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly simple +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module simple.exe +// MVID: {0B8FCFD0-673A-4DEB-90CC-B96749DE09C8} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x01A80000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IBlah +{ + .method public hidebysig newslot virtual + instance int32 Blah(int32 c) cil managed + { + // Code size 39 (0x27) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldarg.0 + IL_000e: call instance int32 IBlah::Blah_Private_GetA() + IL_0013: add + IL_0014: ldarg.0 + IL_0015: call instance int32 IBlah::Blah_Internal_GetB() + IL_001a: add + IL_001b: ldarg.0 + IL_001c: call instance int32 IBlah::Blah_Protected_GetC() + IL_0021: add + IL_0022: stloc.0 + IL_0023: br.s IL_0025 + + IL_0025: ldloc.0 + IL_0026: ret + } // end of method IBlah::Blah + + .method private hidebysig instance int32 + Blah_Private_GetA() cil managed + { + // Code size 18 (0x12) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah_Private_GetA" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldc.i4.1 + IL_000d: stloc.0 + IL_000e: br.s IL_0010 + + IL_0010: ldloc.0 + IL_0011: ret + } // end of method IBlah_Impl::Blah_Private_GetA + + .method assembly hidebysig instance int32 + Blah_Internal_GetB() cil managed + { + // Code size 18 (0x12) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah_Internal_GetB" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldc.i4.2 + IL_000d: stloc.0 + IL_000e: br.s IL_0010 + + IL_0010: ldloc.0 + IL_0011: ret + } // end of method IBlah_Impl::Blah_Internal_GetB + + .method family hidebysig instance int32 + Blah_Protected_GetC() cil managed + { + // Code size 18 (0x12) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBlah.Blah_Protected_GetC" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldc.i4.3 + IL_000d: stloc.0 + IL_000e: br.s IL_0010 + + IL_0010: ldloc.0 + IL_0011: ret + } // end of method IBlah_Impl::Blah_Protected_GetC +} // end of class IBlah + +.class interface private abstract auto ansi IFoo +{ + .method public hidebysig newslot virtual + instance int32 Foo(int32 a) cil managed + { + // Code size 20 (0x14) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IFoo.Foo" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.1 + IL_000e: add + IL_000f: stloc.0 + IL_0010: br.s IL_0012 + + IL_0012: ldloc.0 + IL_0013: ret + } // end of method IFoo::Foo + +} // end of class IFoo + +.class interface private abstract auto ansi IBar +{ + .method public hidebysig newslot virtual + instance int32 Bar(int32 b) cil managed + { + // Code size 21 (0x15) + .maxstack 2 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldstr "At IBar.Bar" + IL_0006: call void [mscorlib]System.Console::WriteLine(string) + IL_000b: nop + IL_000c: ldarg.1 + IL_000d: ldc.i4.s 10 + IL_000f: add + IL_0010: stloc.0 + IL_0011: br.s IL_0013 + + IL_0013: ldloc.0 + IL_0014: ret + } // end of method IBar::Bar + +} // end of class IBar + +.class private auto ansi beforefieldinit Base + extends [mscorlib]System.Object + implements IBlah +{ + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Base::.ctor + +} // end of class Base + +.class private auto ansi beforefieldinit FooBar + extends Base + implements IFoo, + IBar +{ + .method public hidebysig instance int32 + CallBlahProtected() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 IBlah::Blah_Protected_GetC() + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method FooBar::CallBlahProtected + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void Base::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method FooBar::.ctor + +} // end of class FooBar + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + // Code size 158 (0x9e) + .maxstack 2 + .locals init (class FooBar V_0, + class IFoo V_1, + class IBar V_2, + class IBlah V_3, + int32 V_4) + IL_0000: nop + IL_0001: newobj instance void FooBar::.ctor() + IL_0006: stloc.0 + IL_0007: ldloc.0 + IL_0008: stloc.1 + IL_0009: ldloc.0 + IL_000a: stloc.2 + IL_000b: ldloc.0 + IL_000c: stloc.3 + IL_000d: ldstr "Calling IFoo.Foo on FooBar - expecting default met" + + "hod on IFoo.Foo. " + IL_0012: call void [mscorlib]System.Console::WriteLine(string) + IL_0017: nop + IL_0018: ldloc.1 + IL_0019: ldc.i4.s 10 + IL_001b: callvirt instance int32 IFoo::Foo(int32) + IL_0020: ldc.i4.s 11 + IL_0022: ceq + IL_0024: ldstr "Calling IFoo.Foo on FooBar" + IL_0029: call void Test::Assert(bool, + string) + IL_002e: nop + IL_002f: ldstr "Calling IBar.Bar on FooBar - expecting default met" + + "hod on IBar.Bar. " + IL_0034: call void [mscorlib]System.Console::WriteLine(string) + IL_0039: nop + IL_003a: ldloc.2 + IL_003b: ldc.i4.s 10 + IL_003d: callvirt instance int32 IBar::Bar(int32) + IL_0042: ldc.i4.s 20 + IL_0044: ceq + IL_0046: ldstr "Calling IBar.Bar on FooBar" + IL_004b: call void Test::Assert(bool, + string) + IL_0050: nop + IL_0051: ldstr "Calling IBlah.Blah on FooBar - expecting default m" + + "ethod on IBlah.Blah from Base. " + IL_0056: call void [mscorlib]System.Console::WriteLine(string) + IL_005b: nop + IL_005c: ldloc.3 + IL_005d: ldc.i4.s 10 + IL_005f: callvirt instance int32 IBlah::Blah(int32) + IL_0064: ldc.i4.s 16 + IL_0066: ceq + IL_0068: ldstr "Calling IBlah.Blah on FooBar" + IL_006d: call void Test::Assert(bool, + string) + IL_0072: nop + IL_0073: ldstr "Calling FooBar.CallBlahProtected - expecting prote" + + "cted methods on interface can be called" + IL_0078: call void [mscorlib]System.Console::WriteLine(string) + IL_007d: nop + IL_007e: ldloc.0 + IL_007f: callvirt instance int32 FooBar::CallBlahProtected() + IL_0084: ldc.i4.3 + IL_0085: ceq + IL_0087: ldstr "Calling FooBar.CallBlahProtected" + IL_008c: call void Test::Assert(bool, + string) + IL_0091: nop + IL_0092: call int32 Test::Ret() + IL_0097: stloc.s V_4 + IL_0099: br.s IL_009b + + IL_009b: ldloc.s V_4 + IL_009d: ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file simple.res diff --git a/mono/tests/dim-valuetypes.il b/mono/tests/dim-valuetypes.il new file mode 100644 index 0000000000..13b2084870 --- /dev/null +++ b/mono/tests/dim-valuetypes.il @@ -0,0 +1,252 @@ + +// Microsoft (R) .NET Framework IL Disassembler. Version 4.6.1055.0 +// Copyright (c) Microsoft Corporation. All rights reserved. + + + +// Metadata version: v4.0.30319 +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4.. + .ver 4:0:0:0 +} +.assembly valuetypes +{ + .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor(int32) = ( 01 00 08 00 00 00 00 00 ) + .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx + 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows. + + // --- The following custom attribute is added automatically, do not uncomment ------- + // .custom instance void [mscorlib]System.Diagnostics.DebuggableAttribute::.ctor(valuetype [mscorlib]System.Diagnostics.DebuggableAttribute/DebuggingModes) = ( 01 00 07 01 00 00 00 00 ) + + .hash algorithm 0x00008004 + .ver 0:0:0:0 +} +.module valuetypes.exe +// MVID: {E191F723-B724-4D70-B3A8-CEA89FD033D3} +.imagebase 0x00400000 +.file alignment 0x00000200 +.stackreserve 0x00100000 +.subsystem 0x0003 // WINDOWS_CUI +.corflags 0x00000001 // ILONLY +// Image base: 0x01170000 + + +// =============== CLASS MEMBERS DECLARATION =================== + +.class interface private abstract auto ansi IValue +{ + .method public hidebysig newslot abstract virtual + instance int32 GetValue() cil managed + { + } // end of method IValue::GetValue + + .method public hidebysig newslot abstract virtual + instance void SetValue(int32 a) cil managed + { + } // end of method IValue::SetValue + + .method public hidebysig newslot virtual + instance int32 Add(int32 a) cil managed + { + // Code size 26 (0x1a) + .maxstack 2 + .locals init (int32 V_0, + int32 V_1) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: call instance int32 IValue::GetValue() + IL_0007: stloc.0 + IL_0008: ldloc.0 + IL_0009: ldarg.1 + IL_000a: add + IL_000b: stloc.0 + IL_000c: ldarg.0 + IL_000d: ldloc.0 + IL_000e: call instance void IValue::SetValue(int32) + IL_0013: nop + IL_0014: ldloc.0 + IL_0015: stloc.1 + IL_0016: br.s IL_0018 + + IL_0018: ldloc.1 + IL_0019: ret + } // end of method IValue::Add + +} // end of class IValue + +.class private sequential ansi sealed beforefieldinit FooBarStruct + extends [mscorlib]System.ValueType + implements IValue +{ + .field public int32 _val + .method public hidebysig newslot virtual final + instance int32 GetValue() cil managed + { + // Code size 12 (0xc) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldfld int32 FooBarStruct::_val + IL_0007: stloc.0 + IL_0008: br.s IL_000a + + IL_000a: ldloc.0 + IL_000b: ret + } // end of method FooBarStruct::GetValue + + .method public hidebysig newslot virtual final + instance void SetValue(int32 val) cil managed + { + // Code size 9 (0x9) + .maxstack 8 + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: ldarg.1 + IL_0003: stfld int32 FooBarStruct::_val + IL_0008: ret + } // end of method FooBarStruct::SetValue +} // end of class FooBarStruct + +.class private auto ansi beforefieldinit Program + extends [mscorlib]System.Object +{ + .method public hidebysig static int32 Main() cil managed + { + .entrypoint + .maxstack 2 + .locals init (valuetype FooBarStruct V_0, + class IValue V_1, + int32 V_2) + IL_0000: nop + IL_0001: ldloca.s V_0 + IL_0003: initobj FooBarStruct + IL_0009: ldloca.s V_0 + IL_000b: ldc.i4.s 10 + IL_000d: stfld int32 FooBarStruct::_val + IL_0012: ldloc.0 + IL_0013: box FooBarStruct + IL_0018: stloc.1 + IL_0019: ldstr "Calling IFoo.Foo on FooBarStruct" + IL_001e: call void [mscorlib]System.Console::WriteLine(string) + IL_0023: nop + IL_0024: ldloc.1 + IL_0025: ldc.i4.s 10 + IL_0027: callvirt instance int32 IValue::Add(int32) + IL_002c: ldc.i4.s 20 + IL_002e: ceq + IL_0030: ldstr "Calling default method IValue.Add on FooBarStruct " + + "failed" + IL_0035: call void Test::Assert(bool, + string) + IL_003a: nop + IL_003b: ldloca V_0 + callvirt instance int32 FooBarStruct::GetValue() + ldc.i4.s 10 + ceq + ldstr "FooBarStruct value should remain unchanged" + call void Test::Assert(bool, + string) + nop + call int32 Test::Ret() + ret + } // end of method Program::Main + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Program::.ctor + +} // end of class Program + +.class private auto ansi beforefieldinit Test + extends [mscorlib]System.Object +{ + .field private static bool Pass + .method public hidebysig static int32 Ret() cil managed + { + // Code size 19 (0x13) + .maxstack 1 + .locals init (int32 V_0) + IL_0000: nop + IL_0001: ldsfld bool Test::Pass + IL_0006: brtrue.s IL_000c + + IL_0008: ldc.i4.s 101 + IL_000a: br.s IL_000e + + IL_000c: ldc.i4.s 0 + IL_000e: stloc.0 + IL_000f: br.s IL_0011 + + IL_0011: ldloc.0 + IL_0012: ret + } // end of method Test::Ret + + .method public hidebysig static void Assert(bool cond, + string msg) cil managed + { + // Code size 47 (0x2f) + .maxstack 2 + .locals init (bool V_0) + IL_0000: nop + IL_0001: ldarg.0 + IL_0002: stloc.0 + IL_0003: ldloc.0 + IL_0004: brfalse.s IL_0015 + + IL_0006: nop + IL_0007: ldstr "PASS" + IL_000c: call void [mscorlib]System.Console::WriteLine(string) + IL_0011: nop + IL_0012: nop + IL_0013: br.s IL_002e + + IL_0015: nop + IL_0016: ldstr "FAIL: " + IL_001b: ldarg.1 + IL_001c: call string [mscorlib]System.String::Concat(string, + string) + IL_0021: call void [mscorlib]System.Console::WriteLine(string) + IL_0026: nop + IL_0027: ldc.i4.0 + IL_0028: stsfld bool Test::Pass + IL_002d: nop + IL_002e: ret + } // end of method Test::Assert + + .method public hidebysig specialname rtspecialname + instance void .ctor() cil managed + { + // Code size 8 (0x8) + .maxstack 8 + IL_0000: ldarg.0 + IL_0001: call instance void [mscorlib]System.Object::.ctor() + IL_0006: nop + IL_0007: ret + } // end of method Test::.ctor + + .method private hidebysig specialname rtspecialname static + void .cctor() cil managed + { + // Code size 7 (0x7) + .maxstack 8 + IL_0000: ldc.i4.1 + IL_0001: stsfld bool Test::Pass + IL_0006: ret + } // end of method Test::.cctor + +} // end of class Test + + +// ============================================================= + +// *********** DISASSEMBLY COMPLETE *********************** +// WARNING: Created Win32 resource file valuetypes.res diff --git a/mono/tests/even-odd.il b/mono/tests/even-odd.il index a393d9eeef..ee0f8c4162 100644 --- a/mono/tests/even-odd.il +++ b/mono/tests/even-odd.il @@ -59,7 +59,7 @@ LoadOdd: .method public static void main() il managed { .entrypoint .maxstack 1 - ldc.i4 10000001 + ldc.i4 1001 call void EvenOdd::Test(int32) ret } // end of global method `main' diff --git a/mono/tests/gc-descriptors/Makefile.in b/mono/tests/gc-descriptors/Makefile.in index 66ecccb033..f110f508bb 100644 --- a/mono/tests/gc-descriptors/Makefile.in +++ b/mono/tests/gc-descriptors/Makefile.in @@ -82,14 +82,14 @@ subdir = mono/tests/gc-descriptors DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/tests/libtest.c.REMOVED.git-id b/mono/tests/libtest.c.REMOVED.git-id index a022ff973c..45b7bb7d02 100644 --- a/mono/tests/libtest.c.REMOVED.git-id +++ b/mono/tests/libtest.c.REMOVED.git-id @@ -1 +1 @@ -46f8cc5d3d522841e6afeee7fd527ce427d51504 \ No newline at end of file +e1c68d5ca8b25c0e0b0c471ceb5ea335670f714d \ No newline at end of file diff --git a/mono/tests/test-runner.cs b/mono/tests/test-runner.cs index af932e2f29..de8e58709c 100644 --- a/mono/tests/test-runner.cs +++ b/mono/tests/test-runner.cs @@ -38,6 +38,7 @@ public class TestRunner public StringBuilder stdout, stderr; public object stdoutLock = new object (), stderrLock = new object (); public string stdoutName, stderrName; + public TimeSpan duration; } class TestInfo { @@ -301,6 +302,9 @@ public class TestRunner p.BeginErrorReadLine (); if (!p.WaitForExit (timeout * 1000)) { + var end = DateTime.UtcNow; + data.duration = end - start; + lock (monitor) { timedout.Add (data); } @@ -318,22 +322,24 @@ public class TestRunner } } else if (p.ExitCode != expectedExitCode) { var end = DateTime.UtcNow; + data.duration = end - start; lock (monitor) { failed.Add (data); } if (verbose) - output.Write ("failed, time: {0}, exit code: {1}", (end - start).ToString (TEST_TIME_FORMAT), p.ExitCode); + output.Write ("failed, time: {0}, exit code: {1}", data.duration.ToString (TEST_TIME_FORMAT), p.ExitCode); } else { var end = DateTime.UtcNow; + data.duration = end - start; lock (monitor) { passed.Add (data); } if (verbose) - output.Write ("passed, time: {0}", (end - start).ToString (TEST_TIME_FORMAT)); + output.Write ("passed, time: {0}", data.duration.ToString (TEST_TIME_FORMAT)); } p.Close (); @@ -397,7 +403,7 @@ public class TestRunner writer.WriteStartElement ("test-suite"); writer.WriteAttributeString ("name", String.Format ("{0}-tests.dummy", testsuiteName)); writer.WriteAttributeString ("success", (nfailed + ntimedout == 0).ToString()); - writer.WriteAttributeString ("time", test_time.Seconds.ToString()); + writer.WriteAttributeString ("time", test_time.TotalSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString ("asserts", (nfailed + ntimedout).ToString()); // writer.WriteStartElement ("results"); @@ -405,7 +411,7 @@ public class TestRunner writer.WriteStartElement ("test-suite"); writer.WriteAttributeString ("name","MonoTests"); writer.WriteAttributeString ("success", (nfailed + ntimedout == 0).ToString()); - writer.WriteAttributeString ("time", test_time.Seconds.ToString()); + writer.WriteAttributeString ("time", test_time.TotalSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString ("asserts", (nfailed + ntimedout).ToString()); // writer.WriteStartElement ("results"); @@ -413,7 +419,7 @@ public class TestRunner writer.WriteStartElement ("test-suite"); writer.WriteAttributeString ("name", testsuiteName); writer.WriteAttributeString ("success", (nfailed + ntimedout == 0).ToString()); - writer.WriteAttributeString ("time", test_time.Seconds.ToString()); + writer.WriteAttributeString ("time", test_time.TotalSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString ("asserts", (nfailed + ntimedout).ToString()); // writer.WriteStartElement ("results"); @@ -424,7 +430,7 @@ public class TestRunner writer.WriteAttributeString ("name", String.Format ("MonoTests.{0}.{1}", testsuiteName, pd.test)); writer.WriteAttributeString ("executed", "True"); writer.WriteAttributeString ("success", "True"); - writer.WriteAttributeString ("time", "0"); + writer.WriteAttributeString ("time", pd.duration.TotalSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString ("asserts", "0"); writer.WriteEndElement (); } @@ -435,7 +441,7 @@ public class TestRunner writer.WriteAttributeString ("name", String.Format ("MonoTests.{0}.{1}", testsuiteName, pd.test)); writer.WriteAttributeString ("executed", "True"); writer.WriteAttributeString ("success", "False"); - writer.WriteAttributeString ("time", "0"); + writer.WriteAttributeString ("time", pd.duration.TotalSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString ("asserts", "1"); writer.WriteStartElement ("failure"); writer.WriteStartElement ("message"); @@ -454,7 +460,7 @@ public class TestRunner writer.WriteAttributeString ("name", String.Format ("MonoTests.{0}.{1}_timedout", testsuiteName, pd.test)); writer.WriteAttributeString ("executed", "True"); writer.WriteAttributeString ("success", "False"); - writer.WriteAttributeString ("time", "0"); + writer.WriteAttributeString ("time", pd.duration.TotalSeconds.ToString(CultureInfo.InvariantCulture)); writer.WriteAttributeString ("asserts", "1"); writer.WriteStartElement ("failure"); writer.WriteStartElement ("message"); diff --git a/mono/tests/testing_gac/Makefile.in b/mono/tests/testing_gac/Makefile.in index 445fd972dc..fa4fd3a2bf 100644 --- a/mono/tests/testing_gac/Makefile.in +++ b/mono/tests/testing_gac/Makefile.in @@ -86,14 +86,14 @@ subdir = mono/tests/testing_gac DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -205,6 +205,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -233,6 +237,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/mono/tests/threads-init.cs b/mono/tests/threads-init.cs new file mode 100644 index 0000000000..2457481568 --- /dev/null +++ b/mono/tests/threads-init.cs @@ -0,0 +1,29 @@ +using System; +using System.Threading; + +class Driver +{ + public static void Main () + { + Thread t1 = new Thread(() => { + for (int i = 0; i < 10; ++i) { + Thread t2 = new Thread(() => { + while (true) { + Thread t3 = new Thread(() => {}); + t3.IsBackground = true; + t3.Start(); + t3.Join(); + } + }); + + t2.IsBackground = true; + t2.Start (); + } + }); + + t1.IsBackground = true; + t1.Start (); + + Thread.Sleep (100); + } +} diff --git a/mono/tests/vararg.il b/mono/tests/vararg3.il similarity index 100% rename from mono/tests/vararg.il rename to mono/tests/vararg3.il diff --git a/mono/unit-tests/Makefile.am b/mono/unit-tests/Makefile.am index ddfe7ff136..536da6086a 100644 --- a/mono/unit-tests/Makefile.am +++ b/mono/unit-tests/Makefile.am @@ -13,10 +13,16 @@ MCS_NO_LIB = $(MCS_NO_UNSAFE) -unsafe MCS = $(MCS_NO_LIB) +if LOADED_LLVM +LLVMMONOF= +else +LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS) +endif + test_cflags = $(AM_CFLAGS) $(SGEN_DEFINES) test_ldadd = libtestlib.la \ - $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) + $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) $(LLVMMONOF) if HOST_DARWIN test_ldflags = -framework CoreFoundation -framework Foundation endif @@ -28,10 +34,15 @@ sgen_libs = \ $(monodir)/mono/utils/libmonoutils.la \ $(GLIB_LIBS) $(LIBICONV) +mini_libs = \ + $(monodir)/mono/mini/libmini.la + +if !DISABLE_INTERPRETER +mini_libs += $(monodir)/mono/mini/libmono-ee-interp.la +endif + if !CROSS_COMPILE if !HOST_WIN32 -if SUPPORT_BOEHM -if SUPPORT_SGEN noinst_LTLIBRARIES = libtestlib.la libtestlib_la_SOURCES = @@ -64,15 +75,20 @@ test_mono_handle_LDFLAGS = $(test_ldflags) test_mono_callspec_SOURCES = test-mono-callspec.c test_mono_callspec_CFLAGS = $(AM_CFLAGS) -test_mono_callspec_LDADD = $(test_ldadd) ../mini/libmini.la $(sgen_libs) +test_mono_callspec_LDADD = $(test_ldadd) $(mini_libs) $(sgen_libs) test_mono_callspec_LDFLAGS = $(test_ldflags) test_mono_callspec_DEPENDENCIES = callspec.exe +test_mono_string_SOURCES = test-mono-string.c +test_mono_string_CFLAGS = $(test-cflags) +test_mono_string_LDADD = $(test_ldadd) $(mini_libs) $(sgen_libs) +test_mono_string_LDFLAGS = $(test_ldflags) + check_PROGRAMS = test-sgen-qsort test-memfuncs test-mono-linked-list-set test-conc-hashtable test-mono-handle \ - test-mono-callspec + test-mono-callspec test-mono-string TESTS = test-sgen-qsort test-memfuncs test-mono-linked-list-set test-conc-hashtable test-mono-handle \ - test-mono-callspec + test-mono-callspec test-mono-string AM_TESTS_ENVIRONMENT = export MONO_PATH=$(mcs_topdir)/class/lib/build; @@ -92,8 +108,6 @@ clean-local: %.exe: %.cs $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -out:$@ $< -endif SUPPORT_SGEN -endif SUPPORT_BOEHM endif !HOST_WIN32 endif !CROSS_COMPILE diff --git a/mono/unit-tests/Makefile.in b/mono/unit-tests/Makefile.in index 15a44cb483..e59c2f3720 100644 --- a/mono/unit-tests/Makefile.in +++ b/mono/unit-tests/Makefile.in @@ -79,31 +79,34 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@check_PROGRAMS = test-sgen-qsort$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-memfuncs$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-mono-linked-list-set$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-conc-hashtable$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-mono-handle$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-mono-callspec$(EXEEXT) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@TESTS = test-sgen-qsort$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-memfuncs$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-mono-linked-list-set$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-conc-hashtable$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-mono-handle$(EXEEXT) \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ test-mono-callspec$(EXEEXT) +@DISABLE_INTERPRETER_FALSE@am__append_1 = $(monodir)/mono/mini/libmono-ee-interp.la +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@check_PROGRAMS = test-sgen-qsort$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-memfuncs$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-linked-list-set$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-conc-hashtable$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-handle$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-callspec$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-string$(EXEEXT) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@TESTS = test-sgen-qsort$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-memfuncs$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-linked-list-set$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-conc-hashtable$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-handle$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-callspec$(EXEEXT) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ test-mono-string$(EXEEXT) subdir = mono/unit-tests DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp \ $(top_srcdir)/test-driver ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -111,38 +114,43 @@ CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@libtestlib_la_DEPENDENCIES = ../metadata/libmonoruntimesgen.la \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ ../sgen/libmonosgen.la \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ ../utils/libmonoutils.la +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@libtestlib_la_DEPENDENCIES = ../metadata/libmonoruntimesgen.la \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ ../sgen/libmonosgen.la \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ ../utils/libmonoutils.la am_libtestlib_la_OBJECTS = libtestlib_la_OBJECTS = $(am_libtestlib_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_libtestlib_la_rpath = +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_libtestlib_la_rpath = am__test_conc_hashtable_SOURCES_DIST = test-conc-hashtable.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_test_conc_hashtable_OBJECTS = test_conc_hashtable-test-conc-hashtable.$(OBJEXT) +@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 = -am__DEPENDENCIES_2 = libtestlib.la $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_conc_hashtable_DEPENDENCIES = $(am__DEPENDENCIES_2) +@LOADED_LLVM_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) \ +@LOADED_LLVM_FALSE@ $(am__DEPENDENCIES_1) +am__DEPENDENCIES_3 = libtestlib.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_conc_hashtable_DEPENDENCIES = \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) test_conc_hashtable_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_conc_hashtable_CFLAGS) $(CFLAGS) \ $(test_conc_hashtable_LDFLAGS) $(LDFLAGS) -o $@ am__test_memfuncs_SOURCES_DIST = test-memfuncs.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_test_memfuncs_OBJECTS = test_memfuncs-test-memfuncs.$(OBJEXT) +@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@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_memfuncs_DEPENDENCIES = $(am__DEPENDENCIES_2) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_memfuncs_DEPENDENCIES = \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) test_memfuncs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_memfuncs_CFLAGS) \ $(CFLAGS) $(test_memfuncs_LDFLAGS) $(LDFLAGS) -o $@ am__test_mono_callspec_SOURCES_DIST = test-mono-callspec.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_test_mono_callspec_OBJECTS = test_mono_callspec-test-mono-callspec.$(OBJEXT) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_mono_callspec_OBJECTS = test_mono_callspec-test-mono-callspec.$(OBJEXT) test_mono_callspec_OBJECTS = $(am_test_mono_callspec_OBJECTS) -am__DEPENDENCIES_3 = $(monodir)/mono/metadata/libmonoruntimesgen.la \ +am__DEPENDENCIES_4 = $(monodir)/mono/metadata/libmonoruntimesgen.la \ $(monodir)/mono/sgen/libmonosgen.la \ $(monodir)/mono/utils/libmonoutils.la $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) @@ -151,27 +159,41 @@ test_mono_callspec_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(test_mono_callspec_CFLAGS) $(CFLAGS) \ $(test_mono_callspec_LDFLAGS) $(LDFLAGS) -o $@ am__test_mono_handle_SOURCES_DIST = test-mono-handle.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_test_mono_handle_OBJECTS = test_mono_handle-test-mono-handle.$(OBJEXT) +@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@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_handle_DEPENDENCIES = $(am__DEPENDENCIES_2) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_handle_DEPENDENCIES = \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) test_mono_handle_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_mono_handle_CFLAGS) $(CFLAGS) \ $(test_mono_handle_LDFLAGS) $(LDFLAGS) -o $@ am__test_mono_linked_list_set_SOURCES_DIST = \ test-mono-linked-list-set.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_test_mono_linked_list_set_OBJECTS = test_mono_linked_list_set-test-mono-linked-list-set.$(OBJEXT) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@am_test_mono_linked_list_set_OBJECTS = test_mono_linked_list_set-test-mono-linked-list-set.$(OBJEXT) test_mono_linked_list_set_OBJECTS = \ $(am_test_mono_linked_list_set_OBJECTS) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_linked_list_set_DEPENDENCIES = $(am__DEPENDENCIES_2) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_linked_list_set_DEPENDENCIES = \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) 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) \ $(test_mono_linked_list_set_LDFLAGS) $(LDFLAGS) -o $@ +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@ $(mini_libs) \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_4) +test_mono_string_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(test_mono_string_CFLAGS) $(CFLAGS) \ + $(test_mono_string_LDFLAGS) $(LDFLAGS) -o $@ am__test_sgen_qsort_SOURCES_DIST = test-sgen-qsort.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@am_test_sgen_qsort_OBJECTS = test_sgen_qsort-test-sgen-qsort.$(OBJEXT) +@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@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_sgen_qsort_DEPENDENCIES = $(am__DEPENDENCIES_2) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_sgen_qsort_DEPENDENCIES = \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(am__DEPENDENCIES_3) 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) \ @@ -210,13 +232,14 @@ SOURCES = $(libtestlib_la_SOURCES) $(test_conc_hashtable_SOURCES) \ $(test_memfuncs_SOURCES) $(test_mono_callspec_SOURCES) \ $(test_mono_handle_SOURCES) \ $(test_mono_linked_list_set_SOURCES) \ - $(test_sgen_qsort_SOURCES) + $(test_mono_string_SOURCES) $(test_sgen_qsort_SOURCES) DIST_SOURCES = $(libtestlib_la_SOURCES) \ $(am__test_conc_hashtable_SOURCES_DIST) \ $(am__test_memfuncs_SOURCES_DIST) \ $(am__test_mono_callspec_SOURCES_DIST) \ $(am__test_mono_handle_SOURCES_DIST) \ $(am__test_mono_linked_list_set_SOURCES_DIST) \ + $(am__test_mono_string_SOURCES_DIST) \ $(am__test_sgen_qsort_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ @@ -531,6 +554,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -559,6 +586,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -693,9 +723,11 @@ MCS_NO_UNSAFE = $(TOOLS_RUNTIME) $(CSC) -debug:portable \ MCS_NO_LIB = $(MCS_NO_UNSAFE) -unsafe MCS = $(MCS_NO_LIB) +@LOADED_LLVM_FALSE@LLVMMONOF = $(LLVM_LIBS) $(LLVM_LDFLAGS) +@LOADED_LLVM_TRUE@LLVMMONOF = test_cflags = $(AM_CFLAGS) $(SGEN_DEFINES) test_ldadd = libtestlib.la \ - $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) + $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV) $(LLVMMONOF) @HOST_DARWIN_TRUE@test_ldflags = -framework CoreFoundation -framework Foundation monodir = $(top_builddir) @@ -705,35 +737,40 @@ sgen_libs = \ $(monodir)/mono/utils/libmonoutils.la \ $(GLIB_LIBS) $(LIBICONV) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@noinst_LTLIBRARIES = libtestlib.la -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@libtestlib_la_SOURCES = -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@libtestlib_la_LIBADD = ../metadata/libmonoruntimesgen.la ../sgen/libmonosgen.la ../utils/libmonoutils.la -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_sgen_qsort_SOURCES = test-sgen-qsort.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_sgen_qsort_CFLAGS = $(test_cflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_sgen_qsort_LDADD = $(test_ldadd) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_sgen_qsort_LDFLAGS = $(test_ldflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_memfuncs_SOURCES = test-memfuncs.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_memfuncs_CFLAGS = $(test_cflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_memfuncs_LDADD = $(test_ldadd) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_memfuncs_LDFLAGS = $(test_ldflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_linked_list_set_SOURCES = test-mono-linked-list-set.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_linked_list_set_CFLAGS = $(test_cflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_linked_list_set_LDADD = $(test_ldadd) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_linked_list_set_LDFLAGS = $(test_ldflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_conc_hashtable_SOURCES = test-conc-hashtable.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_conc_hashtable_CFLAGS = $(test_cflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_conc_hashtable_LDADD = $(test_ldadd) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_conc_hashtable_LDFLAGS = $(test_ldflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_handle_SOURCES = test-mono-handle.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_handle_CFLAGS = $(test_cflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_handle_LDADD = $(test_ldadd) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_handle_LDFLAGS = $(test_ldflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_callspec_SOURCES = test-mono-callspec.c -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_callspec_CFLAGS = $(AM_CFLAGS) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_callspec_LDADD = $(test_ldadd) ../mini/libmini.la $(sgen_libs) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_callspec_LDFLAGS = $(test_ldflags) -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@test_mono_callspec_DEPENDENCIES = callspec.exe -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@AM_TESTS_ENVIRONMENT = export MONO_PATH=$(mcs_topdir)/class/lib/build; +mini_libs = $(monodir)/mono/mini/libmini.la $(am__append_1) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@noinst_LTLIBRARIES = libtestlib.la +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@libtestlib_la_SOURCES = +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@libtestlib_la_LIBADD = ../metadata/libmonoruntimesgen.la ../sgen/libmonosgen.la ../utils/libmonoutils.la +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_sgen_qsort_SOURCES = test-sgen-qsort.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_sgen_qsort_CFLAGS = $(test_cflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_sgen_qsort_LDADD = $(test_ldadd) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_sgen_qsort_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_memfuncs_SOURCES = test-memfuncs.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_memfuncs_CFLAGS = $(test_cflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_memfuncs_LDADD = $(test_ldadd) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_memfuncs_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_linked_list_set_SOURCES = test-mono-linked-list-set.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_linked_list_set_CFLAGS = $(test_cflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_linked_list_set_LDADD = $(test_ldadd) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_linked_list_set_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_conc_hashtable_SOURCES = test-conc-hashtable.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_conc_hashtable_CFLAGS = $(test_cflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_conc_hashtable_LDADD = $(test_ldadd) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_conc_hashtable_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_handle_SOURCES = test-mono-handle.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_handle_CFLAGS = $(test_cflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_handle_LDADD = $(test_ldadd) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_handle_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_callspec_SOURCES = test-mono-callspec.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_callspec_CFLAGS = $(AM_CFLAGS) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_callspec_LDADD = $(test_ldadd) $(mini_libs) $(sgen_libs) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_callspec_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_callspec_DEPENDENCIES = callspec.exe +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_string_SOURCES = test-mono-string.c +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_string_CFLAGS = $(test-cflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_string_LDADD = $(test_ldadd) $(mini_libs) $(sgen_libs) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@test_mono_string_LDFLAGS = $(test_ldflags) +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@AM_TESTS_ENVIRONMENT = export MONO_PATH=$(mcs_topdir)/class/lib/build; all: all-am .SUFFIXES: @@ -812,6 +849,10 @@ test-mono-linked-list-set$(EXEEXT): $(test_mono_linked_list_set_OBJECTS) $(test_ @rm -f test-mono-linked-list-set$(EXEEXT) $(AM_V_CCLD)$(test_mono_linked_list_set_LINK) $(test_mono_linked_list_set_OBJECTS) $(test_mono_linked_list_set_LDADD) $(LIBS) +test-mono-string$(EXEEXT): $(test_mono_string_OBJECTS) $(test_mono_string_DEPENDENCIES) $(EXTRA_test_mono_string_DEPENDENCIES) + @rm -f test-mono-string$(EXEEXT) + $(AM_V_CCLD)$(test_mono_string_LINK) $(test_mono_string_OBJECTS) $(test_mono_string_LDADD) $(LIBS) + test-sgen-qsort$(EXEEXT): $(test_sgen_qsort_OBJECTS) $(test_sgen_qsort_DEPENDENCIES) $(EXTRA_test_sgen_qsort_DEPENDENCIES) @rm -f test-sgen-qsort$(EXEEXT) $(AM_V_CCLD)$(test_sgen_qsort_LINK) $(test_sgen_qsort_OBJECTS) $(test_sgen_qsort_LDADD) $(LIBS) @@ -827,6 +868,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_mono_callspec-test-mono-callspec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_mono_handle-test-mono-handle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_mono_linked_list_set-test-mono-linked-list-set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_mono_string-test-mono-string.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sgen_qsort-test-sgen-qsort.Po@am__quote@ .c.o: @@ -923,6 +965,20 @@ test_mono_linked_list_set-test-mono-linked-list-set.obj: test-mono-linked-list-s @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_mono_linked_list_set_CFLAGS) $(CFLAGS) -c -o test_mono_linked_list_set-test-mono-linked-list-set.obj `if test -f 'test-mono-linked-list-set.c'; then $(CYGPATH_W) 'test-mono-linked-list-set.c'; else $(CYGPATH_W) '$(srcdir)/test-mono-linked-list-set.c'; fi` +test_mono_string-test-mono-string.o: test-mono-string.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_mono_string_CFLAGS) $(CFLAGS) -MT test_mono_string-test-mono-string.o -MD -MP -MF $(DEPDIR)/test_mono_string-test-mono-string.Tpo -c -o test_mono_string-test-mono-string.o `test -f 'test-mono-string.c' || echo '$(srcdir)/'`test-mono-string.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_mono_string-test-mono-string.Tpo $(DEPDIR)/test_mono_string-test-mono-string.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-mono-string.c' object='test_mono_string-test-mono-string.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_mono_string_CFLAGS) $(CFLAGS) -c -o test_mono_string-test-mono-string.o `test -f 'test-mono-string.c' || echo '$(srcdir)/'`test-mono-string.c + +test_mono_string-test-mono-string.obj: test-mono-string.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_mono_string_CFLAGS) $(CFLAGS) -MT test_mono_string-test-mono-string.obj -MD -MP -MF $(DEPDIR)/test_mono_string-test-mono-string.Tpo -c -o test_mono_string-test-mono-string.obj `if test -f 'test-mono-string.c'; then $(CYGPATH_W) 'test-mono-string.c'; else $(CYGPATH_W) '$(srcdir)/test-mono-string.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_mono_string-test-mono-string.Tpo $(DEPDIR)/test_mono_string-test-mono-string.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='test-mono-string.c' object='test_mono_string-test-mono-string.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_mono_string_CFLAGS) $(CFLAGS) -c -o test_mono_string-test-mono-string.obj `if test -f 'test-mono-string.c'; then $(CYGPATH_W) 'test-mono-string.c'; else $(CYGPATH_W) '$(srcdir)/test-mono-string.c'; fi` + test_sgen_qsort-test-sgen-qsort.o: test-sgen-qsort.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sgen_qsort_CFLAGS) $(CFLAGS) -MT test_sgen_qsort-test-sgen-qsort.o -MD -MP -MF $(DEPDIR)/test_sgen_qsort-test-sgen-qsort.Tpo -c -o test_sgen_qsort-test-sgen-qsort.o `test -f 'test-sgen-qsort.c' || echo '$(srcdir)/'`test-sgen-qsort.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sgen_qsort-test-sgen-qsort.Tpo $(DEPDIR)/test_sgen_qsort-test-sgen-qsort.Po @@ -1178,6 +1234,13 @@ test-mono-callspec.log: test-mono-callspec$(EXEEXT) --log-file $$b.log --trs-file $$b.trs \ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ "$$tst" $(AM_TESTS_FD_REDIRECT) +test-mono-string.log: test-mono-string$(EXEEXT) + @p='test-mono-string$(EXEEXT)'; \ + b='test-mono-string'; \ + $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ + --log-file $$b.log --trs-file $$b.trs \ + $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ + "$$tst" $(AM_TESTS_FD_REDIRECT) .test.log: @p='$<'; \ $(am__set_b); \ @@ -1225,8 +1288,6 @@ distdir: $(DISTFILES) done @CROSS_COMPILE_TRUE@check-local: @HOST_WIN32_TRUE@check-local: -@SUPPORT_BOEHM_FALSE@check-local: -@SUPPORT_SGEN_FALSE@check-local: check-am: all-am $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) $(MAKE) $(AM_MAKEFLAGS) check-TESTS check-local @@ -1268,8 +1329,6 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." @CROSS_COMPILE_TRUE@clean-local: @HOST_WIN32_TRUE@clean-local: -@SUPPORT_BOEHM_FALSE@clean-local: -@SUPPORT_SGEN_FALSE@clean-local: clean: clean-am clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ @@ -1359,21 +1418,21 @@ uninstall-am: recheck tags tags-am uninstall uninstall-am -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@.NOTPARALLEL: +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@.NOTPARALLEL: -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@check-local: -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ if [ -e test-suite.log ]; then \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ if grep -q "# FAIL: 0\|tests passed" test-suite.log; then successbool=True && failures=0; else successbool=False && failures=1; fi; \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ echo "" > TestResult-unit-tests.xml; \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ if [ $$failures -ne 0 ]; then echo ""'> TestResult-unit-tests.xml && cat test-suite.log >> TestResult-unit-tests.xml && echo "]]>" >> TestResult-unit-tests.xml; fi; \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ echo "" >> TestResult-unit-tests.xml; \ -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ fi; +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@check-local: +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ if [ -e test-suite.log ]; then \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ if grep -q "# FAIL: 0\|tests passed" test-suite.log; then successbool=True && failures=0; else successbool=False && failures=1; fi; \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ echo "" > TestResult-unit-tests.xml; \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ if [ $$failures -ne 0 ]; then echo ""'> TestResult-unit-tests.xml && cat test-suite.log >> TestResult-unit-tests.xml && echo "]]>" >> TestResult-unit-tests.xml; fi; \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ echo "" >> TestResult-unit-tests.xml; \ +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ fi; -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@clean-local: -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ rm -f callspec.exe callspec.pdb +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@clean-local: +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ rm -f callspec.exe callspec.pdb -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@%.exe: %.cs -@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@@SUPPORT_BOEHM_TRUE@@SUPPORT_SGEN_TRUE@ $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -out:$@ $< +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@%.exe: %.cs +@CROSS_COMPILE_FALSE@@HOST_WIN32_FALSE@ $(MCS) -r:$(CLASS)/System.dll -r:$(CLASS)/System.Xml.dll -r:$(CLASS)/System.Core.dll -out:$@ $< # 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/mono/unit-tests/test-mono-callspec.c b/mono/unit-tests/test-mono-callspec.c index 1db301bee6..df877210a4 100644 --- a/mono/unit-tests/test-mono-callspec.c +++ b/mono/unit-tests/test-mono-callspec.c @@ -14,6 +14,7 @@ #include #include #include +#include #define TESTPROG "callspec.exe" @@ -141,11 +142,11 @@ static MonoClass *test_mono_class_from_name (MonoImage *image, const char *name_space, const char *name) { - MonoError error; + ERROR_DECL (error); MonoClass *klass; - klass = mono_class_from_name_checked (image, name_space, name, &error); - mono_error_cleanup (&error); /* FIXME Don't swallow the error */ + klass = mono_class_from_name_checked (image, name_space, name, error); + mono_error_cleanup (error); /* FIXME Don't swallow the error */ return klass; } diff --git a/mono/unit-tests/test-mono-string.c b/mono/unit-tests/test-mono-string.c new file mode 100644 index 0000000000..62514cfb2d --- /dev/null +++ b/mono/unit-tests/test-mono-string.c @@ -0,0 +1,65 @@ +/* + * test-mono-string.c: Unit test for runtime MonoString* manipulation. + */ + +#include "config.h" +#include +#include "metadata/object-internals.h" +#include "mini/jit.h" + +static int +new_string_ok (void) +{ + ERROR_DECL (error); + MonoString *s = mono_string_new_checked (mono_domain_get (), "abcd", error); + static const gunichar2 u16s[] = { 0x61, 0x62, 0x63, 0x64, 0 }; /* u16 "abcd" */ + mono_error_assert_ok (error); + gunichar2* c = mono_string_chars (s); + + g_assert (c != NULL && !memcmp (&u16s, c, sizeof (u16s))); + return 0; +} + +static int +new_string_utf8 (void) +{ + ERROR_DECL (error); + const gunichar2 snowman = 0x2603; + static const char bytes[] = { 0xE2, 0x98, 0x83, 0x00 }; /* U+2603 NUL */ + MonoString *s = mono_string_new_checked (mono_domain_get (), bytes, error); + mono_error_assert_ok (error); + gunichar2* c = mono_string_chars (s); + g_assert (c != NULL && + (c[0] == snowman) && + (c[1] == 0)); + return 0; +} + +static int +new_string_conv_err (void) +{ + ERROR_DECL (error); + static const char bytes[] = { 'a', 0xFC, 'b', 'c', 0 }; + MonoString G_GNUC_UNUSED *s = mono_string_new_checked (mono_domain_get (), bytes, error); + g_assert (!mono_error_ok (error)); + const char *msg = mono_error_get_message (error); + g_assert (msg != NULL); + fprintf (stderr, "(expected) error message was: \"%s\"", msg); + mono_error_cleanup (error); + return 0; +} + +int +main (void) +{ + + mono_jit_init_version ("test-mono-string", "v4.0.30319"); + + int res = 0; + + res += new_string_ok (); + res += new_string_utf8 (); + res += new_string_conv_err (); + + return res; +} diff --git a/mono/unit-tests/test-sgen-qsort.c b/mono/unit-tests/test-sgen-qsort.c index ca539fb398..f1420d5f05 100644 --- a/mono/unit-tests/test-sgen-qsort.c +++ b/mono/unit-tests/test-sgen-qsort.c @@ -8,8 +8,8 @@ #include "config.h" -#include -#include +#include +#include #include #include diff --git a/mono/utils/Makefile.am b/mono/utils/Makefile.am index 67057e1059..776b5d17e4 100644 --- a/mono/utils/Makefile.am +++ b/mono/utils/Makefile.am @@ -75,6 +75,7 @@ monoutils_sources = \ mono-proclib.h \ mono-proclib-windows-internals.h \ mono-publib.c \ + mono-jemalloc.c \ mono-string.h \ mono-time.c \ mono-time.h \ @@ -141,6 +142,7 @@ monoutils_sources = \ mono-threads-openbsd.c \ mono-threads-android.c \ mono-threads-haiku.c \ + mono-threads-aix.c \ mono-threads-wasm.c \ mono-threads.h \ mono-threads-debug.h \ @@ -264,13 +266,22 @@ arch_sources += mono-hwcap-cross.c endif libmonoutils_la_SOURCES = $(monoutils_sources) $(arch_sources) +libmonoutils_la_CFLAGS = $(JEMALLOC_CFLAGS) +libmonoutils_la_LDFLAGS = $(JEMALLOC_LDFLAGS) libmonoutilsincludedir = $(includedir)/mono-$(API_VER)/mono/utils libmonoutilsinclude_HEADERS = \ mono-logger.h \ mono-error.h \ mono-publib.h \ + mono-jemalloc.h \ mono-dl-fallback.h \ mono-counters.h EXTRA_DIST = mono-embed.h mono-embed.c + +DIST_SUBDIRS = jemalloc + +if MONO_JEMALLOC_ENABLED +SUBDIRS = jemalloc +endif diff --git a/mono/utils/Makefile.in b/mono/utils/Makefile.in deleted file mode 100644 index f9720e6aac..0000000000 --- a/mono/utils/Makefile.in +++ /dev/null @@ -1,1170 +0,0 @@ -# Makefile.in generated by automake 1.14.1 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2013 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -target_triplet = @target@ -@CROSS_COMPILE_FALSE@@X86_TRUE@am__append_1 = mach-support-x86.c -@AMD64_TRUE@@CROSS_COMPILE_FALSE@am__append_2 = mach-support-amd64.c -@ARM_TRUE@@CROSS_COMPILE_FALSE@am__append_3 = mach-support-arm.c -@ARM64_TRUE@@CROSS_COMPILE_FALSE@am__append_4 = mach-support-arm64.c -@CROSS_COMPILE_TRUE@am__append_5 = mach-support-unknown.c -@CROSS_COMPILE_FALSE@@X86_TRUE@am__append_6 = mono-hwcap-x86.c -@AMD64_TRUE@@CROSS_COMPILE_FALSE@am__append_7 = mono-hwcap-x86.c -@ARM_TRUE@@CROSS_COMPILE_FALSE@am__append_8 = mono-hwcap-arm.c -@ARM64_TRUE@@CROSS_COMPILE_FALSE@am__append_9 = mono-hwcap-arm64.c -@CROSS_COMPILE_FALSE@@MIPS_TRUE@am__append_10 = mono-hwcap-mips.c -@CROSS_COMPILE_FALSE@@POWERPC_TRUE@am__append_11 = mono-hwcap-ppc.c -@CROSS_COMPILE_FALSE@@POWERPC64_TRUE@am__append_12 = mono-hwcap-ppc.c -@CROSS_COMPILE_FALSE@@SPARC_TRUE@am__append_13 = mono-hwcap-sparc.c -@CROSS_COMPILE_FALSE@@SPARC64_TRUE@am__append_14 = mono-hwcap-sparc.c -@CROSS_COMPILE_FALSE@@S390X_TRUE@am__append_15 = mono-hwcap-s390x.c -@CROSS_COMPILE_FALSE@@HOST_WASM_TRUE@am__append_16 = mono-hwcap-wasm.c -@CROSS_COMPILE_TRUE@am__append_17 = mono-hwcap-cross.c -subdir = mono/utils -DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ - $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp \ - $(libmonoutilsinclude_HEADERS) -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -libmonoutils_la_LIBADD = -am__libmonoutils_la_SOURCES_DIST = os-event-unix.c os-event-win32.c \ - mono-os-wait-win32.c mono-md5.c mono-sha1.c mono-logger.c \ - mono-logger-internals.h mono-codeman.c dlmalloc.h dlmalloc.c \ - mono-counters.c mono-compiler.h mono-complex.h mono-dl.c \ - mono-dl-windows.c mono-dl-darwin.c mono-dl-posix.c \ - mono-dl-wasm.c mono-dl.h mono-dl-windows-internals.h \ - mono-log-windows.c mono-log-common.c mono-log-posix.c \ - mono-log-android.c mono-log-darwin.c mono-merp.c mono-merp.h \ - mono-internal-hash.c mono-internal-hash.h \ - mono-io-portability.c mono-io-portability.h monobitset.c \ - mono-filemap.c mono-math.c mono-mmap.c mono-mmap-windows.c \ - mono-mmap.h mono-mmap-internals.h \ - mono-mmap-windows-internals.h mono-os-mutex.h mono-os-mutex.c \ - mono-os-wait.h mono-coop-mutex.h mono-once.h mono-lazy-init.h \ - mono-networkinterfaces.c mono-networkinterfaces.h \ - mono-proclib.c mono-proclib-windows.c mono-proclib.h \ - mono-proclib-windows-internals.h mono-publib.c mono-string.h \ - mono-time.c mono-time.h strenc.h strenc.c mono-uri.c \ - mono-poll.c mono-path.c mono-os-semaphore.h \ - mono-coop-semaphore.h mono-sigcontext.h mono-stdlib.c \ - mono-property-hash.h mono-property-hash.c mono-value-hash.h \ - mono-value-hash.c freebsd-elf_common.h freebsd-elf32.h \ - freebsd-elf64.h freebsd-dwarf.h dtrace.h gc_wrapper.h \ - mono-error.c mono-error-internals.h monobitset.h \ - mono-codeman.h mono-counters.h mono-digest.h mono-error.h \ - mono-machine.h mono-math.h mono-membar.h mono-path.h \ - mono-poll.h mono-uri.h mono-stdlib.h valgrind.h mach-support.c \ - mach-support.h memcheck.h mono-context.c mono-context.h \ - mono-stack-unwinding.h hazard-pointer.c hazard-pointer.h \ - lock-free-queue.c lock-free-queue.h lock-free-alloc.c \ - lock-free-alloc.h lock-free-array-queue.c \ - lock-free-array-queue.h mono-linked-list-set.c \ - mono-linked-list-set.h mono-threads.c \ - mono-threads-state-machine.c mono-threads-posix.c \ - mono-threads-posix-signals.c mono-threads-mach.c \ - mono-threads-mach-helper.c mono-threads-windows.c \ - mono-threads-linux.c mono-threads-freebsd.c \ - mono-threads-netbsd.c mono-threads-openbsd.c \ - mono-threads-android.c mono-threads-haiku.c \ - mono-threads-wasm.c mono-threads.h mono-threads-debug.h \ - mono-threads-api.h mono-threads-coop.c mono-threads-coop.h \ - mono-tls.h mono-tls.c linux_magic.h mono-memory-model.h \ - atomic.h atomic.c mono-hwcap.h mono-hwcap.c mono-hwcap-vars.h \ - bsearch.h bsearch.c mono-signal-handler.h \ - mono-conc-hashtable.h mono-conc-hashtable.c json.h json.c \ - networking.c networking-posix.c networking-fallback.c \ - networking-missing.c networking-windows.c networking.h \ - mono-rand.c mono-rand-windows.c mono-rand.h \ - mono-rand-windows-internals.h memfuncs.c memfuncs.h parse.c \ - parse.h checked-build.c checked-build.h os-event.h refcount.h \ - w32api.h unlocked.h ward.h mach-support-x86.c \ - mach-support-amd64.c mach-support-arm.c mach-support-arm64.c \ - mach-support-unknown.c mono-hwcap-x86.c mono-hwcap-arm.c \ - mono-hwcap-arm64.c mono-hwcap-mips.c mono-hwcap-ppc.c \ - mono-hwcap-sparc.c mono-hwcap-s390x.c mono-hwcap-wasm.c \ - mono-hwcap-cross.c -@HOST_WIN32_FALSE@am__objects_1 = os-event-unix.lo -@HOST_WIN32_TRUE@am__objects_2 = os-event-win32.lo \ -@HOST_WIN32_TRUE@ mono-os-wait-win32.lo -@HOST_WIN32_FALSE@am__objects_3 = $(am__objects_1) -@HOST_WIN32_TRUE@am__objects_3 = $(am__objects_2) -am__objects_4 = $(am__objects_3) mono-md5.lo mono-sha1.lo \ - mono-logger.lo mono-codeman.lo dlmalloc.lo mono-counters.lo \ - mono-dl.lo mono-dl-windows.lo mono-dl-darwin.lo \ - mono-dl-posix.lo mono-dl-wasm.lo mono-log-windows.lo \ - mono-log-common.lo mono-log-posix.lo mono-log-android.lo \ - mono-log-darwin.lo mono-merp.lo mono-internal-hash.lo \ - mono-io-portability.lo monobitset.lo mono-filemap.lo \ - mono-math.lo mono-mmap.lo mono-mmap-windows.lo \ - mono-os-mutex.lo mono-networkinterfaces.lo mono-proclib.lo \ - mono-proclib-windows.lo mono-publib.lo mono-time.lo strenc.lo \ - mono-uri.lo mono-poll.lo mono-path.lo mono-stdlib.lo \ - mono-property-hash.lo mono-value-hash.lo mono-error.lo \ - mach-support.lo mono-context.lo hazard-pointer.lo \ - lock-free-queue.lo lock-free-alloc.lo lock-free-array-queue.lo \ - mono-linked-list-set.lo mono-threads.lo \ - mono-threads-state-machine.lo mono-threads-posix.lo \ - mono-threads-posix-signals.lo mono-threads-mach.lo \ - mono-threads-mach-helper.lo mono-threads-windows.lo \ - mono-threads-linux.lo mono-threads-freebsd.lo \ - mono-threads-netbsd.lo mono-threads-openbsd.lo \ - mono-threads-android.lo mono-threads-haiku.lo \ - mono-threads-wasm.lo mono-threads-coop.lo mono-tls.lo \ - atomic.lo mono-hwcap.lo bsearch.lo mono-conc-hashtable.lo \ - json.lo networking.lo networking-posix.lo \ - networking-fallback.lo networking-missing.lo \ - networking-windows.lo mono-rand.lo mono-rand-windows.lo \ - memfuncs.lo parse.lo checked-build.lo -@CROSS_COMPILE_FALSE@@X86_TRUE@am__objects_5 = mach-support-x86.lo -@AMD64_TRUE@@CROSS_COMPILE_FALSE@am__objects_6 = \ -@AMD64_TRUE@@CROSS_COMPILE_FALSE@ mach-support-amd64.lo -@ARM_TRUE@@CROSS_COMPILE_FALSE@am__objects_7 = mach-support-arm.lo -@ARM64_TRUE@@CROSS_COMPILE_FALSE@am__objects_8 = \ -@ARM64_TRUE@@CROSS_COMPILE_FALSE@ mach-support-arm64.lo -@CROSS_COMPILE_TRUE@am__objects_9 = mach-support-unknown.lo -@CROSS_COMPILE_FALSE@@X86_TRUE@am__objects_10 = mono-hwcap-x86.lo -@AMD64_TRUE@@CROSS_COMPILE_FALSE@am__objects_11 = mono-hwcap-x86.lo -@ARM_TRUE@@CROSS_COMPILE_FALSE@am__objects_12 = mono-hwcap-arm.lo -@ARM64_TRUE@@CROSS_COMPILE_FALSE@am__objects_13 = mono-hwcap-arm64.lo -@CROSS_COMPILE_FALSE@@MIPS_TRUE@am__objects_14 = mono-hwcap-mips.lo -@CROSS_COMPILE_FALSE@@POWERPC_TRUE@am__objects_15 = mono-hwcap-ppc.lo -@CROSS_COMPILE_FALSE@@POWERPC64_TRUE@am__objects_16 = \ -@CROSS_COMPILE_FALSE@@POWERPC64_TRUE@ mono-hwcap-ppc.lo -@CROSS_COMPILE_FALSE@@SPARC_TRUE@am__objects_17 = mono-hwcap-sparc.lo -@CROSS_COMPILE_FALSE@@SPARC64_TRUE@am__objects_18 = \ -@CROSS_COMPILE_FALSE@@SPARC64_TRUE@ mono-hwcap-sparc.lo -@CROSS_COMPILE_FALSE@@S390X_TRUE@am__objects_19 = mono-hwcap-s390x.lo -@CROSS_COMPILE_FALSE@@HOST_WASM_TRUE@am__objects_20 = \ -@CROSS_COMPILE_FALSE@@HOST_WASM_TRUE@ mono-hwcap-wasm.lo -@CROSS_COMPILE_TRUE@am__objects_21 = mono-hwcap-cross.lo -am__objects_22 = $(am__objects_5) $(am__objects_6) $(am__objects_7) \ - $(am__objects_8) $(am__objects_9) $(am__objects_10) \ - $(am__objects_11) $(am__objects_12) $(am__objects_13) \ - $(am__objects_14) $(am__objects_15) $(am__objects_16) \ - $(am__objects_17) $(am__objects_18) $(am__objects_19) \ - $(am__objects_20) $(am__objects_21) -am_libmonoutils_la_OBJECTS = $(am__objects_4) $(am__objects_22) -libmonoutils_la_OBJECTS = $(am_libmonoutils_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libmonoutils_la_SOURCES) -DIST_SOURCES = $(am__libmonoutils_la_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libmonoutilsincludedir)" -HEADERS = $(libmonoutilsinclude_HEADERS) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AOT_BUILD_FLAGS = @AOT_BUILD_FLAGS@ -AOT_RUN_FLAGS = @AOT_RUN_FLAGS@ -API_VER = @API_VER@ -AR = @AR@ -AS = @AS@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BOEHM_DEFINES = @BOEHM_DEFINES@ -BREAKPOINT = @BREAKPOINT@ -BTLS_ARCH = @BTLS_ARCH@ -BTLS_CFLAGS = @BTLS_CFLAGS@ -BTLS_CMAKE_ARGS = @BTLS_CMAKE_ARGS@ -BTLS_PLATFORM = @BTLS_PLATFORM@ -BTLS_ROOT = @BTLS_ROOT@ -BUILD_EXEEXT = @BUILD_EXEEXT@ -CC = @CC@ -CCAS = @CCAS@ -CCASDEPMODE = @CCASDEPMODE@ -CCASFLAGS = @CCASFLAGS@ -CCDEPMODE = @CCDEPMODE@ -CC_FOR_BUILD = @CC_FOR_BUILD@ -CFLAGS = @CFLAGS@ -CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ -CMAKE = @CMAKE@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CSC = @CSC@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFAULT_PROFILE = @DEFAULT_PROFILE@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DOLT_BASH = @DOLT_BASH@ -DSYMUTIL = @DSYMUTIL@ -DTRACE = @DTRACE@ -DTRACEFLAGS = @DTRACEFLAGS@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GDKX11 = @GDKX11@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GINT_TO_POINTER = @GINT_TO_POINTER@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_LIBS = @GLIB_LIBS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUC_NORETURN = @GNUC_NORETURN@ -GNUC_PRETTY = @GNUC_PRETTY@ -GNUC_UNUSED = @GNUC_UNUSED@ -GPOINTER_TO_INT = @GPOINTER_TO_INT@ -GPOINTER_TO_UINT = @GPOINTER_TO_UINT@ -GREP = @GREP@ -GSIZE = @GSIZE@ -GSIZE_FORMAT = @GSIZE_FORMAT@ -GTKX11 = @GTKX11@ -GUINT_TO_POINTER = @GUINT_TO_POINTER@ -G_GINT32_FORMAT = @G_GINT32_FORMAT@ -G_GINT64_FORMAT = @G_GINT64_FORMAT@ -G_GUINT32_FORMAT = @G_GUINT32_FORMAT@ -G_GUINT64_FORMAT = @G_GUINT64_FORMAT@ -G_HAVE_ISO_VARARGS = @G_HAVE_ISO_VARARGS@ -HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ -HAVE_MSGFMT = @HAVE_MSGFMT@ -HOST_CC = @HOST_CC@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTL = @INTL@ -INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBC = @LIBC@ -LIBGC_CPPFLAGS = @LIBGC_CPPFLAGS@ -LIBGC_LIBS = @LIBGC_LIBS@ -LIBGC_STATIC_LIBS = @LIBGC_STATIC_LIBS@ -LIBICONV = @LIBICONV@ -LIBMONO_LA = @LIBMONO_LA@ -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@ -LN_S = @LN_S@ -LTCOMPILE = @LTCOMPILE@ -LTCXXCOMPILE = @LTCXXCOMPILE@ -LTLIBICONV = @LTLIBICONV@ -LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ -MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -ORDER = @ORDER@ -OS = @OS@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATHSEP = @PATHSEP@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PIDTYPE = @PIDTYPE@ -PKG_CONFIG = @PKG_CONFIG@ -PLATFORM_AOT_SUFFIX = @PLATFORM_AOT_SUFFIX@ -RANLIB = @RANLIB@ -SEARCHSEP = @SEARCHSEP@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SGEN_DEFINES = @SGEN_DEFINES@ -SHARED_CFLAGS = @SHARED_CFLAGS@ -SHELL = @SHELL@ -SIZEOF_VOID_P = @SIZEOF_VOID_P@ -SQLITE = @SQLITE@ -SQLITE3 = @SQLITE3@ -STRIP = @STRIP@ -TEST_PROFILE = @TEST_PROFILE@ -USE_NLS = @USE_NLS@ -VERSION = @VERSION@ -VTUNE_CFLAGS = @VTUNE_CFLAGS@ -VTUNE_LIBS = @VTUNE_LIBS@ -WERROR_CFLAGS = @WERROR_CFLAGS@ -X11 = @X11@ -XATTR_LIB = @XATTR_LIB@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -XINERAMA = @XINERAMA@ -XMKMF = @XMKMF@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -arch_target = @arch_target@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -docs_dir = @docs_dir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -export_ldflags = @export_ldflags@ -extra_runtime_ldflags = @extra_runtime_ldflags@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -ikvm_native_dir = @ikvm_native_dir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libgc_dir = @libgc_dir@ -libgdiplus_install_loc = @libgdiplus_install_loc@ -libgdiplus_loc = @libgdiplus_loc@ -libmono_cflags = @libmono_cflags@ -libmono_ldflags = @libmono_ldflags@ -libsuffix = @libsuffix@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mcs_topdir = @mcs_topdir@ -mcs_topdir_from_srcdir = @mcs_topdir_from_srcdir@ -mkdir_p = @mkdir_p@ -mono_build_root = @mono_build_root@ -mono_cfg_dir = @mono_cfg_dir@ -mono_runtime = @mono_runtime@ -ninja = @ninja@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -reloc_libdir = @reloc_libdir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -target = @target@ -target_alias = @target_alias@ -target_cpu = @target_cpu@ -target_os = @target_os@ -target_vendor = @target_vendor@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -noinst_LTLIBRARIES = libmonoutils.la -AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLAGS) $(SHARED_CFLAGS) -@ENABLE_DTRACE_TRUE@BUILT_SOURCES = mono-dtrace.h -@HOST_WIN32_TRUE@win32_sources = \ -@HOST_WIN32_TRUE@ os-event-win32.c \ -@HOST_WIN32_TRUE@ mono-os-wait-win32.c - -@HOST_WIN32_FALSE@platform_sources = $(unix_sources) -@HOST_WIN32_TRUE@platform_sources = $(win32_sources) -@HOST_WIN32_FALSE@unix_sources = \ -@HOST_WIN32_FALSE@ os-event-unix.c - -monoutils_sources = \ - $(platform_sources) \ - mono-md5.c \ - mono-sha1.c \ - mono-logger.c \ - mono-logger-internals.h \ - mono-codeman.c \ - dlmalloc.h \ - dlmalloc.c \ - mono-counters.c \ - mono-compiler.h \ - mono-complex.h \ - mono-dl.c \ - mono-dl-windows.c \ - mono-dl-darwin.c \ - mono-dl-posix.c \ - mono-dl-wasm.c \ - mono-dl.h \ - mono-dl-windows-internals.h \ - mono-log-windows.c \ - mono-log-common.c \ - mono-log-posix.c \ - mono-log-android.c \ - mono-log-darwin.c \ - mono-merp.c \ - mono-merp.h \ - mono-internal-hash.c \ - mono-internal-hash.h \ - mono-io-portability.c \ - mono-io-portability.h \ - monobitset.c \ - mono-filemap.c \ - mono-math.c \ - mono-mmap.c \ - mono-mmap-windows.c \ - mono-mmap.h \ - mono-mmap-internals.h \ - mono-mmap-windows-internals.h \ - mono-os-mutex.h \ - mono-os-mutex.c \ - mono-os-wait.h \ - mono-coop-mutex.h \ - mono-once.h \ - mono-lazy-init.h \ - mono-networkinterfaces.c \ - mono-networkinterfaces.h \ - mono-proclib.c \ - mono-proclib-windows.c \ - mono-proclib.h \ - mono-proclib-windows-internals.h \ - mono-publib.c \ - mono-string.h \ - mono-time.c \ - mono-time.h \ - strenc.h \ - strenc.c \ - mono-uri.c \ - mono-poll.c \ - mono-path.c \ - mono-os-semaphore.h \ - mono-coop-semaphore.h \ - mono-sigcontext.h \ - mono-stdlib.c \ - mono-property-hash.h \ - mono-property-hash.c \ - mono-value-hash.h \ - mono-value-hash.c \ - freebsd-elf_common.h \ - freebsd-elf32.h \ - freebsd-elf64.h \ - freebsd-dwarf.h \ - dtrace.h \ - gc_wrapper.h \ - mono-error.c \ - mono-error-internals.h \ - monobitset.h \ - mono-codeman.h \ - mono-counters.h \ - mono-digest.h \ - mono-error.h \ - mono-machine.h \ - mono-math.h \ - mono-membar.h \ - mono-path.h \ - mono-poll.h \ - mono-uri.h \ - mono-stdlib.h \ - valgrind.h \ - mach-support.c \ - mach-support.h \ - memcheck.h \ - mono-context.c \ - mono-context.h \ - mono-stack-unwinding.h \ - hazard-pointer.c \ - hazard-pointer.h \ - lock-free-queue.c \ - lock-free-queue.h \ - lock-free-alloc.c \ - lock-free-alloc.h \ - lock-free-array-queue.c \ - lock-free-array-queue.h \ - mono-linked-list-set.c \ - mono-linked-list-set.h \ - mono-threads.c \ - mono-threads-state-machine.c \ - mono-threads-posix.c \ - mono-threads-posix-signals.c \ - mono-threads-mach.c \ - mono-threads-mach-helper.c \ - mono-threads-windows.c \ - mono-threads-linux.c \ - mono-threads-freebsd.c \ - mono-threads-netbsd.c \ - mono-threads-openbsd.c \ - mono-threads-android.c \ - mono-threads-haiku.c \ - mono-threads-wasm.c \ - mono-threads.h \ - mono-threads-debug.h \ - mono-threads-api.h \ - mono-threads-coop.c \ - mono-threads-coop.h \ - mono-tls.h \ - mono-tls.c \ - linux_magic.h \ - mono-memory-model.h \ - atomic.h \ - atomic.c \ - mono-hwcap.h \ - mono-hwcap.c \ - mono-hwcap-vars.h \ - bsearch.h \ - bsearch.c \ - mono-signal-handler.h \ - mono-conc-hashtable.h \ - mono-conc-hashtable.c \ - json.h \ - json.c \ - networking.c \ - networking-posix.c \ - networking-fallback.c \ - networking-missing.c \ - networking-windows.c \ - networking.h \ - mono-rand.c \ - mono-rand-windows.c \ - mono-rand.h \ - mono-rand-windows-internals.h \ - memfuncs.c \ - memfuncs.h \ - parse.c \ - parse.h \ - checked-build.c \ - checked-build.h \ - os-event.h \ - refcount.h \ - w32api.h \ - unlocked.h \ - ward.h - -arch_sources = $(am__append_1) $(am__append_2) $(am__append_3) \ - $(am__append_4) $(am__append_5) $(am__append_6) \ - $(am__append_7) $(am__append_8) $(am__append_9) \ - $(am__append_10) $(am__append_11) $(am__append_12) \ - $(am__append_13) $(am__append_14) $(am__append_15) \ - $(am__append_16) $(am__append_17) -libmonoutils_la_SOURCES = $(monoutils_sources) $(arch_sources) -libmonoutilsincludedir = $(includedir)/mono-$(API_VER)/mono/utils -libmonoutilsinclude_HEADERS = \ - mono-logger.h \ - mono-error.h \ - mono-publib.h \ - mono-dl-fallback.h \ - mono-counters.h - -EXTRA_DIST = mono-embed.h mono-embed.c -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/utils/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign mono/utils/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libmonoutils.la: $(libmonoutils_la_OBJECTS) $(libmonoutils_la_DEPENDENCIES) $(EXTRA_libmonoutils_la_DEPENDENCIES) - $(AM_V_CCLD)$(LINK) $(libmonoutils_la_OBJECTS) $(libmonoutils_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atomic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsearch.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checked-build.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlmalloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hazard-pointer.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/json.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock-free-alloc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock-free-array-queue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lock-free-queue.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-support-amd64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-support-arm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-support-arm64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-support-unknown.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-support-x86.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mach-support.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/memfuncs.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-codeman.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-conc-hashtable.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-context.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-counters.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-dl-darwin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-dl-posix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-dl-wasm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-dl-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-dl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-error.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-filemap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-arm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-arm64.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-cross.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-mips.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-ppc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-s390x.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-sparc.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-wasm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap-x86.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-hwcap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-internal-hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-io-portability.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-linked-list-set.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-log-android.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-log-common.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-log-darwin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-log-posix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-log-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-logger.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-math.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-md5.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-merp.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-mmap-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-mmap.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-networkinterfaces.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-os-mutex.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-os-wait-win32.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-path.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-poll.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-proclib-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-proclib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-property-hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-publib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-rand-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-rand.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-sha1.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-stdlib.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-android.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-coop.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-freebsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-haiku.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-linux.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-mach-helper.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-mach.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-netbsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-openbsd.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-posix-signals.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-posix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-state-machine.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-wasm.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-threads.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-time.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-tls.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-uri.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mono-value-hash.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/monobitset.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking-fallback.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking-missing.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking-posix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking-windows.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/networking.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os-event-unix.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os-event-win32.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strenc.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-libmonoutilsincludeHEADERS: $(libmonoutilsinclude_HEADERS) - @$(NORMAL_INSTALL) - @list='$(libmonoutilsinclude_HEADERS)'; test -n "$(libmonoutilsincludedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(libmonoutilsincludedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libmonoutilsincludedir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libmonoutilsincludedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(libmonoutilsincludedir)" || exit $$?; \ - done - -uninstall-libmonoutilsincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(libmonoutilsinclude_HEADERS)'; test -n "$(libmonoutilsincludedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(libmonoutilsincludedir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-am -all-am: Makefile $(LTLIBRARIES) $(HEADERS) -installdirs: - for dir in "$(DESTDIR)$(libmonoutilsincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-libmonoutilsincludeHEADERS - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-libmonoutilsincludeHEADERS - -.MAKE: all check install install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ - clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ - ctags-am distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags 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-libmonoutilsincludeHEADERS 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-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ - uninstall-libmonoutilsincludeHEADERS - - -@ENABLE_DTRACE_TRUE@mono-dtrace.h: $(top_srcdir)/data/mono.d -@ENABLE_DTRACE_TRUE@ $(DTRACE) $(DTRACEFLAGS) -h -s $(top_srcdir)/data/mono.d -o $@ || > $@ - -# 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. -.NOEXPORT: diff --git a/mono/utils/Makefile.in.REMOVED.git-id b/mono/utils/Makefile.in.REMOVED.git-id new file mode 100644 index 0000000000..b7c323ba76 --- /dev/null +++ b/mono/utils/Makefile.in.REMOVED.git-id @@ -0,0 +1 @@ +8471f144cad8961a50d4f165dd43257c42327f05 \ No newline at end of file diff --git a/mono/utils/checked-build.c b/mono/utils/checked-build.c index 220c320bd9..6e71b975c2 100644 --- a/mono/utils/checked-build.c +++ b/mono/utils/checked-build.c @@ -38,7 +38,7 @@ mono_check_mode_enabled (MonoCheckMode query) if (G_UNLIKELY (check_mode == MONO_CHECK_MODE_UNKNOWN)) { MonoCheckMode env_check_mode = MONO_CHECK_MODE_NONE; - const gchar *env_string = g_getenv ("MONO_CHECK_MODE"); + gchar *env_string = g_getenv ("MONO_CHECK_MODE"); if (env_string) { @@ -73,7 +73,7 @@ mono_check_transition_limit (void) { static int transition_limit = -1; if (transition_limit < 0) { - const gchar *env_string = g_getenv ("MONO_CHECK_THREAD_TRANSITION_HISTORY"); + gchar *env_string = g_getenv ("MONO_CHECK_THREAD_TRANSITION_HISTORY"); if (env_string) { transition_limit = atoi (env_string); g_free (env_string); diff --git a/mono/utils/jemalloc/Makefile.am b/mono/utils/jemalloc/Makefile.am new file mode 100644 index 0000000000..02b97cb06a --- /dev/null +++ b/mono/utils/jemalloc/Makefile.am @@ -0,0 +1,49 @@ +# +# Conditional submodule for jemalloc +# +# make reset-jemalloc will checkout a version of jemalloc which is suitable for this version of mono +# into $top_srcdir/jemalloc/jemalloc. +# + +JEMALLOC_PATH=jemalloc + +SUBMODULES_CONFIG_FILE = $(top_srcdir)/mono/utils/jemalloc/SUBMODULES.json +include $(top_srcdir)/scripts/submodules/versions.mk + +$(eval $(call ValidateVersionTemplate,jemalloc,JEMALLOC)) + +# Bump the given submodule to the revision given by the REV make variable +# If COMMIT is 1, commit the change +bump-jemalloc: __bump-version-jemalloc + +# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables +# If COMMIT is 1, commit the change +bump-branch-jemalloc: __bump-branch-jemalloc + +# Bump the given submodule to its current GIT version +# If COMMIT is 1, commit the change +bump-current-jemalloc: __bump-current-version-jemalloc + +clean-local: + $(RM) -r $(JEMALLOC_PATH) + +EXTRA_DIST=SUBMODULES.json + +if MONO_JEMALLOC_ASSERT +ASSERT_OPT=--enable-debug +endif + +jemalloc: + $(MAKE) reset-jemalloc + +# Set a prefix to enable access to allocation functions with a prefix, ie so mono_jemalloc isn't named malloc by default +# Disable zone allocator, otherwise malloc uses jemalloc for things it's not set for +# We call autoconf ourselves so we can call configure and not autogen. Autogen script is broken, minor bash issues around quote escaping +jemalloc/lib/libjemalloc.a: jemalloc Makefile + cd jemalloc && autoconf && ./configure --with-jemalloc-prefix=mono_je --prefix=`pwd` $(ASSERT_OPT) $(JEMALLOC_AUTOCONF_FLAGS) --disable-zone-allocator EXTRA_CFLAGS="-I $(top_srcdir) $(GLIB_CFLAGS) $(CFLAGS) $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS) " CC="$(CC)" CXX="$(CXX)" CPPFLAGS="$(CPPFLAGS) $(JEMALLOC_CPPFLAGS) " CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" + + cd jemalloc && $(MAKE) build_lib_static + +all-local: jemalloc/lib/libjemalloc.a + + diff --git a/mono/utils/jemalloc/Makefile.in b/mono/utils/jemalloc/Makefile.in new file mode 100644 index 0000000000..401f3c0a2d --- /dev/null +++ b/mono/utils/jemalloc/Makefile.in @@ -0,0 +1,721 @@ +# Makefile.in generated by automake 1.14.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2013 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# +# Conditional submodule for jemalloc +# +# make reset-jemalloc will checkout a version of jemalloc which is suitable for this version of mono +# into $top_srcdir/jemalloc/jemalloc. +# + +# +# This is a python script and a set of make targets to implement support for conditional submodules +# Set the SUBMODULES_CONFIG_FILE make variable to the srcdir path of a SUBMODULES.json file which contains information about the submodules. +# +VPATH = @srcdir@ +am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +DIST_COMMON = $(top_srcdir)/scripts/submodules/versions.mk \ + $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ + $(top_srcdir)/mkinstalldirs +subdir = mono/utils/jemalloc +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AOT_BUILD_FLAGS = @AOT_BUILD_FLAGS@ +AOT_RUN_FLAGS = @AOT_RUN_FLAGS@ +API_VER = @API_VER@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BOEHM_DEFINES = @BOEHM_DEFINES@ +BREAKPOINT = @BREAKPOINT@ +BTLS_ARCH = @BTLS_ARCH@ +BTLS_CFLAGS = @BTLS_CFLAGS@ +BTLS_CMAKE_ARGS = @BTLS_CMAKE_ARGS@ +BTLS_PLATFORM = @BTLS_PLATFORM@ +BTLS_ROOT = @BTLS_ROOT@ +BUILD_EXEEXT = @BUILD_EXEEXT@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CC_FOR_BUILD = @CC_FOR_BUILD@ +CFLAGS = @CFLAGS@ +CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@ +CMAKE = @CMAKE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CSC = @CSC@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFAULT_PROFILE = @DEFAULT_PROFILE@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DOLT_BASH = @DOLT_BASH@ +DSYMUTIL = @DSYMUTIL@ +DTRACE = @DTRACE@ +DTRACEFLAGS = @DTRACEFLAGS@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GDKX11 = @GDKX11@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GINT_TO_POINTER = @GINT_TO_POINTER@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GNUC_NORETURN = @GNUC_NORETURN@ +GNUC_PRETTY = @GNUC_PRETTY@ +GNUC_UNUSED = @GNUC_UNUSED@ +GPOINTER_TO_INT = @GPOINTER_TO_INT@ +GPOINTER_TO_UINT = @GPOINTER_TO_UINT@ +GREP = @GREP@ +GSIZE = @GSIZE@ +GSIZE_FORMAT = @GSIZE_FORMAT@ +GTKX11 = @GTKX11@ +GUINT_TO_POINTER = @GUINT_TO_POINTER@ +G_GINT32_FORMAT = @G_GINT32_FORMAT@ +G_GINT64_FORMAT = @G_GINT64_FORMAT@ +G_GUINT32_FORMAT = @G_GUINT32_FORMAT@ +G_GUINT64_FORMAT = @G_GUINT64_FORMAT@ +G_HAVE_ISO_VARARGS = @G_HAVE_ISO_VARARGS@ +HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ +HAVE_MSGFMT = @HAVE_MSGFMT@ +HOST_CC = @HOST_CC@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTL = @INTL@ +INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBC = @LIBC@ +LIBGC_CPPFLAGS = @LIBGC_CPPFLAGS@ +LIBGC_LIBS = @LIBGC_LIBS@ +LIBGC_STATIC_LIBS = @LIBGC_STATIC_LIBS@ +LIBICONV = @LIBICONV@ +LIBMONO_LA = @LIBMONO_LA@ +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@ +LN_S = @LN_S@ +LTCOMPILE = @LTCOMPILE@ +LTCXXCOMPILE = @LTCXXCOMPILE@ +LTLIBICONV = @LTLIBICONV@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ +MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +ORDER = @ORDER@ +OS = @OS@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATHSEP = @PATHSEP@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIDTYPE = @PIDTYPE@ +PKG_CONFIG = @PKG_CONFIG@ +PLATFORM_AOT_SUFFIX = @PLATFORM_AOT_SUFFIX@ +RANLIB = @RANLIB@ +SEARCHSEP = @SEARCHSEP@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SGEN_DEFINES = @SGEN_DEFINES@ +SHARED_CFLAGS = @SHARED_CFLAGS@ +SHELL = @SHELL@ +SIZEOF_VOID_P = @SIZEOF_VOID_P@ +SQLITE = @SQLITE@ +SQLITE3 = @SQLITE3@ +STRIP = @STRIP@ +TEST_PROFILE = @TEST_PROFILE@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VTUNE_CFLAGS = @VTUNE_CFLAGS@ +VTUNE_LIBS = @VTUNE_LIBS@ +WERROR_CFLAGS = @WERROR_CFLAGS@ +X11 = @X11@ +XATTR_LIB = @XATTR_LIB@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XINERAMA = @XINERAMA@ +XMKMF = @XMKMF@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +arch_target = @arch_target@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +docs_dir = @docs_dir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +export_ldflags = @export_ldflags@ +extra_runtime_ldflags = @extra_runtime_ldflags@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +ikvm_native_dir = @ikvm_native_dir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libgc_dir = @libgc_dir@ +libgdiplus_install_loc = @libgdiplus_install_loc@ +libgdiplus_loc = @libgdiplus_loc@ +libmono_cflags = @libmono_cflags@ +libmono_ldflags = @libmono_ldflags@ +libsuffix = @libsuffix@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mcs_topdir = @mcs_topdir@ +mcs_topdir_from_srcdir = @mcs_topdir_from_srcdir@ +mkdir_p = @mkdir_p@ +mono_build_root = @mono_build_root@ +mono_cfg_dir = @mono_cfg_dir@ +mono_runtime = @mono_runtime@ +ninja = @ninja@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +reloc_libdir = @reloc_libdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +JEMALLOC_PATH = jemalloc +SUBMODULES_CONFIG_FILE = $(top_srcdir)/mono/utils/jemalloc/SUBMODULES.json +SCRIPT = $(top_srcdir)/scripts/submodules/versions.py +EXTRA_DIST = SUBMODULES.json +@MONO_JEMALLOC_ASSERT_TRUE@ASSERT_OPT = --enable-debug +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/scripts/submodules/versions.mk $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign mono/utils/jemalloc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign mono/utils/jemalloc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + 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: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags TAGS: + +ctags CTAGS: + +cscope cscopelist: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile all-local +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-local mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.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 + + +# usage $(call ValidateVersionTemplate (name,MAKEFILE VAR,repo name)) +# usage $(call ValidateVersionTemplate (mono,MONO,mono)) + +define ValidateVersionTemplate +#$(eval REPOSITORY_$(2):=$(shell test -z $(3) && echo $(1) || echo "$(3)")) +#$(eval DIRECTORY_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-dir $(1))) +#$(eval DIRECTORY_$(2):=$(shell test -z $(DIRECTORY_$(2)) && echo $(1) || echo $(DIRECTORY_$(2)))) +#$(eval MODULE_$(2):=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-url $(1))) +#$(eval NEEDED_$(2)_VERSION:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-rev $(1))) +#$(eval $(2)_BRANCH_AND_REMOTE:=$(shell python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) get-remote-branch $(1))) + +#$(eval $(2)_VERSION:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git rev-parse HEAD )) + +#$(eval NEEDED_$(2)_BRANCH:=$(word 2, $(subst /, ,$($(2)_BRANCH_AND_REMOTE)))) +#$(eval NEEDED_$(2)_REMOTE:=$(word 1, $(subst /, ,$($(2)_BRANCH_AND_REMOTE)))) +#$(eval $(2)_BRANCH:=$$$$(shell cd $($(2)_PATH) 2>/dev/null && git symbolic-ref --short HEAD 2>/dev/null)) + +validate-$(1):: + @if test x$$(IGNORE_$(2)_VERSION) = "x"; then \ + if test ! -d $($(2)_PATH); then \ + if test x$$(RESET_VERSIONS) != "x"; then \ + $(MAKE) reset-$(1) || exit 1; \ + else \ + echo "Your $(1) checkout is missing, please run 'make reset-$(1)'"; \ + touch .validate-versions-failure; \ + fi; \ + else \ + if test "x$($(2)_VERSION)" != "x$(NEEDED_$(2)_VERSION)" ; then \ + if test x$$(RESET_VERSIONS) != "x"; then \ + $(MAKE) reset-$(1) || exit 1; \ + else \ + echo "Your $(1) version is out of date, please run 'make reset-$(1)' (found $($(2)_VERSION), expected $(NEEDED_$(2)_VERSION))"; \ + test -z "$(BUILD_REVISION)" || $(MAKE) test-$(1); \ + touch .validate-versions-failure; \ + fi; \ + elif test "x$($(2)_BRANCH)" != "x$(NEEDED_$(2)_BRANCH)" ; then \ + if test x$$(RESET_VERSIONS) != "x"; then \ + test -z "$(BUILD_REVISION)" || $(MAKE) test-$(1); \ + $(MAKE) reset-$(1) || exit 1; \ + else \ + echo "Your $(1) branch is out of date, please run 'make reset-$(1)' (found $($(2)_BRANCH), expected $(NEEDED_$(2)_BRANCH))"; \ + touch .validate-versions-failure; \ + fi; \ + fi; \ + fi; \ + fi + +test-$(1):: + @echo $(1) + @echo " REPOSITORY_$(2)=$(REPOSITORY_$(2))" + @echo " DIRECTORY_$(2)=$(DIRECTORY_$(2))" + @echo " MODULE_$(2)=$(MODULE_$(2))" + @echo " NEEDED_$(2)_VERSION=$(NEEDED_$(2)_VERSION)" + @echo " $(2)_VERSION=$($(2)_VERSION)" + @echo " $(2)_BRANCH_AND_REMOTE=$($(2)_BRANCH_AND_REMOTE)" + @echo " NEEDED_$(2)_BRANCH=$(NEEDED_$(2)_BRANCH)" + @echo " NEEDED_$(2)_REMOTE=$(NEEDED_$(2)_REMOTE)" + @echo " $(2)_BRANCH=$($(2)_BRANCH)" + @echo " $(2)_PATH=$($(2)_PATH) => $(abspath $($(2)_PATH))" + +reset-$(1):: + @if test -d $($(2)_PATH); then \ + if ! (cd $($(2)_PATH) && git show $(NEEDED_$(2)_VERSION) >/dev/null 2>&1 && git log -1 $(NEEDED_$(2)_REMOTE/NEEDED_$(2)_BRANCH) >/dev/null 2>&1) ; then \ + 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 ); \ + 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)); \ + echo "*** [$(1)] git reset --hard $(NEEDED_$(2)_VERSION)" && (cd $($(2)_PATH) && git reset --hard $(NEEDED_$(2)_VERSION)); \ + fi + @echo "*** [$(1)] git submodule update --init --recursive" && (cd $($(2)_PATH) && git submodule update --init --recursive) + +print-$(1):: + @printf "*** %-16s %-45s %s (%s)\n" "$(DIRECTORY_$(2))" "$(MODULE_$(2))" "$(NEEDED_$(2)_VERSION)" "$(NEEDED_$(2)_BRANCH)" + +.PHONY: validate-$(1) reset-$(1) print-$(1) + +reset-versions:: reset-$(1) +validate-versions:: validate-$(1) +print-versions:: print-$(1) + +endef + +reset-versions:: + +validate-versions:: + @if test -e .validate-versions-failure; then \ + rm .validate-versions-failure; \ + echo One or more modules needs update; \ + exit 1; \ + else \ + echo All dependent modules up to date; \ + fi + +reset: + @$(MAKE) validate-versions RESET_VERSIONS=1 + +__bump-version-%: + @if [ "$(REV)" = "" ]; then echo "Usage: make bump-version-$* REV="; exit 1; fi + python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $(REV) + @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $(REV)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + +__bump-branch-%: + @if [ "$(BRANCH)" = "" ]; then echo "Usage: make bump-branch-$* BRANCH= REMOTE_BRANCH="; exit 1; fi + @if [ "$(REMOTE_BRANCH)" == "" ]; then echo "Usage: make bump-branch-$* BRANCH= REMOTE_BRANCH="; exit 1; fi + python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-branch $* $(BRANCH) + python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-remote-branch $* $(REMOTE_BRANCH) + @if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to switch to $(BRANCH) $(REMOTE BRANCH)." | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + +__bump-current-version-%: + REV=$(shell cd $(ACCEPTANCE_TESTS_PATH)/$* && git log -1 --pretty=format:%H); \ + python $(SCRIPT) $(SUBMODULES_CONFIG_FILE) set-rev $* $$REV; \ + if [ "$(COMMIT)" = "1" ]; then echo "[submodules] Bump $* to pick up $$REV:" | git commit -F - $(SUBMODULES_CONFIG_FILE); fi + +$(eval $(call ValidateVersionTemplate,jemalloc,JEMALLOC)) + +# Bump the given submodule to the revision given by the REV make variable +# If COMMIT is 1, commit the change +bump-jemalloc: __bump-version-jemalloc + +# Bump the given submodule to the branch given by the BRANCH/REMOTE_BRANCH make variables +# If COMMIT is 1, commit the change +bump-branch-jemalloc: __bump-branch-jemalloc + +# Bump the given submodule to its current GIT version +# If COMMIT is 1, commit the change +bump-current-jemalloc: __bump-current-version-jemalloc + +clean-local: + $(RM) -r $(JEMALLOC_PATH) + +jemalloc: + $(MAKE) reset-jemalloc + +# Set a prefix to enable access to allocation functions with a prefix, ie so mono_jemalloc isn't named malloc by default +# Disable zone allocator, otherwise malloc uses jemalloc for things it's not set for +# We call autoconf ourselves so we can call configure and not autogen. Autogen script is broken, minor bash issues around quote escaping +jemalloc/lib/libjemalloc.a: jemalloc Makefile + cd jemalloc && autoconf && ./configure --with-jemalloc-prefix=mono_je --prefix=`pwd` $(ASSERT_OPT) $(JEMALLOC_AUTOCONF_FLAGS) --disable-zone-allocator EXTRA_CFLAGS="-I $(top_srcdir) $(GLIB_CFLAGS) $(CFLAGS) $(PLATFORM_CFLAGS) $(ARCH_CFLAGS) $(SHARED_CFLAGS) " CC="$(CC)" CXX="$(CXX)" CPPFLAGS="$(CPPFLAGS) $(JEMALLOC_CPPFLAGS) " CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" + + cd jemalloc && $(MAKE) build_lib_static + +all-local: jemalloc/lib/libjemalloc.a + +# 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. +.NOEXPORT: diff --git a/mono/utils/jemalloc/SUBMODULES.json b/mono/utils/jemalloc/SUBMODULES.json new file mode 100644 index 0000000000..22bd2871d4 --- /dev/null +++ b/mono/utils/jemalloc/SUBMODULES.json @@ -0,0 +1,10 @@ +[ + { + "name": "jemalloc", + "url": "git://github.com/mono/jemalloc.git", + "rev": "896ed3a8b3f41998d4fb4d625d30ac63ef2d51fb", + "remote-branch": "origin/master", + "branch": "master", + "directory": "jemalloc" + } +] diff --git a/mono/utils/mono-context.c b/mono/utils/mono-context.c index 1349638182..4dfbbb3416 100644 --- a/mono/utils/mono-context.c +++ b/mono/utils/mono-context.c @@ -233,6 +233,27 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx) mctx->gregs [AMD64_R13] = context->R13; mctx->gregs [AMD64_R14] = context->R14; mctx->gregs [AMD64_R15] = context->R15; +#elif defined(__HAIKU__) + // Haiku uses sigcontext because there's no ucontext + struct sigcontext *ctx = (struct sigcontext *)sigctx; + + mctx->gregs [AMD64_RIP] = ctx->regs.rip; + mctx->gregs [AMD64_RAX] = ctx->regs.rax; + mctx->gregs [AMD64_RCX] = ctx->regs.rcx; + mctx->gregs [AMD64_RDX] = ctx->regs.rdx; + mctx->gregs [AMD64_RBX] = ctx->regs.rbx; + mctx->gregs [AMD64_RSP] = ctx->regs.rsp; + mctx->gregs [AMD64_RBP] = ctx->regs.rbp; + mctx->gregs [AMD64_RSI] = ctx->regs.rsi; + mctx->gregs [AMD64_RDI] = ctx->regs.rdi; + mctx->gregs [AMD64_R8] = ctx->regs.r8; + mctx->gregs [AMD64_R9] = ctx->regs.r9; + mctx->gregs [AMD64_R10] = ctx->regs.r10; + mctx->gregs [AMD64_R11] = ctx->regs.r11; + mctx->gregs [AMD64_R12] = ctx->regs.r12; + mctx->gregs [AMD64_R13] = ctx->regs.r13; + mctx->gregs [AMD64_R14] = ctx->regs.r14; + mctx->gregs [AMD64_R15] = ctx->regs.r15; #else g_assert_not_reached (); #endif @@ -305,6 +326,27 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx) context->R13 = mctx->gregs [AMD64_R13]; context->R14 = mctx->gregs [AMD64_R14]; context->R15 = mctx->gregs [AMD64_R15]; +#elif defined(__HAIKU__) + // Haiku uses sigcontext because there's no ucontext + struct sigcontext *ctx = (struct sigcontext *)sigctx; + + ctx->regs.rip = mctx->gregs [AMD64_RIP]; + ctx->regs.rax = mctx->gregs [AMD64_RAX]; + ctx->regs.rcx = mctx->gregs [AMD64_RCX]; + ctx->regs.rdx = mctx->gregs [AMD64_RDX]; + ctx->regs.rbx = mctx->gregs [AMD64_RBX]; + ctx->regs.rsp = mctx->gregs [AMD64_RSP]; + ctx->regs.rbp = mctx->gregs [AMD64_RBP]; + ctx->regs.rsi = mctx->gregs [AMD64_RSI]; + ctx->regs.rdi = mctx->gregs [AMD64_RDI]; + ctx->regs.r8 = mctx->gregs [AMD64_R8]; + ctx->regs.r9 = mctx->gregs [AMD64_R9]; + ctx->regs.r10 = mctx->gregs [AMD64_R10]; + ctx->regs.r11 = mctx->gregs [AMD64_R11]; + ctx->regs.r12 = mctx->gregs [AMD64_R12]; + ctx->regs.r13 = mctx->gregs [AMD64_R13]; + ctx->regs.r14 = mctx->gregs [AMD64_R14]; + ctx->regs.r15 = mctx->gregs [AMD64_R15]; #else g_assert_not_reached (); #endif diff --git a/mono/utils/mono-context.h b/mono/utils/mono-context.h index fa4ce7effd..c6ee591548 100644 --- a/mono/utils/mono-context.h +++ b/mono/utils/mono-context.h @@ -24,23 +24,30 @@ #if defined(TARGET_X86) #if defined(__APPLE__) +#define MONO_HAVE_SIMD_REG typedef struct __darwin_xmm_reg MonoContextSimdReg; #endif #elif defined(TARGET_AMD64) #if defined(__APPLE__) +#define MONO_HAVE_SIMD_REG typedef struct __darwin_xmm_reg MonoContextSimdReg; #elif defined(__linux__) && defined(__GLIBC__) +#define MONO_HAVE_SIMD_REG typedef struct _libc_xmmreg MonoContextSimdReg; #elif defined(HOST_WIN32) +#define MONO_HAVE_SIMD_REG #include typedef __m128d MonoContextSimdReg; #elif defined(HOST_ANDROID) +#define MONO_HAVE_SIMD_REG typedef struct _libc_xmmreg MonoContextSimdReg; #elif defined(__linux__) +#define MONO_HAVE_SIMD_REG #include typedef __m128d MonoContextSimdReg; #endif #elif defined(TARGET_ARM64) +#define MONO_HAVE_SIMD_REG typedef __uint128_t MonoContextSimdReg; #endif @@ -247,15 +254,26 @@ typedef struct { #if !defined( HOST_WIN32 ) -#if defined(HAVE_SIGACTION) || defined(__APPLE__) // the __APPLE__ check is required for the tvos simulator, which has ucontext_t but not sigaction +// the __APPLE__ check is required for the tvos simulator, which has ucontext_t but not sigaction +#if defined(HAVE_SIGACTION) || defined(__APPLE__) #define MONO_SIGNAL_USE_UCONTEXT_T 1 #endif #endif +#ifdef __HAIKU__ +/* sigcontext surrogate */ +struct sigcontext { + vregs regs; +}; + +// Haiku doesn't support this +#undef MONO_SIGNAL_USE_UCONTEXT_T +#endif + typedef struct { mgreg_t gregs [AMD64_NREG]; -#if defined(__APPLE__) || (defined(__linux__) && defined(__GLIBC__)) || defined(HOST_WIN32) +#if defined(MONO_HAVE_SIMD_REG) MonoContextSimdReg fregs [AMD64_XMM_NREG]; #else double fregs [AMD64_XMM_NREG]; diff --git a/mono/utils/mono-counters.c b/mono/utils/mono-counters.c index 8aed465939..cecaa8fa32 100644 --- a/mono/utils/mono-counters.c +++ b/mono/utils/mono-counters.c @@ -335,6 +335,12 @@ page_faults (void) return mono_process_get_data (GINT_TO_POINTER (mono_process_current_pid ()), MONO_PROCESS_FAULTS); } +static gint64 +paged_bytes (void) +{ + return mono_process_get_data (GINT_TO_POINTER (mono_process_current_pid ()), MONO_PROCESS_PAGED_BYTES); +} + // If cpu_load gets inlined on Windows then cpu_load_1min, cpu_load_5min and cpu_load_15min can be folded into a single function and that will // cause a failure when registering counters since the same function address will be used by all three functions. Preventing this method from being inlined @@ -408,6 +414,7 @@ initialize_system_counters (void) register_internal ("Working Set", SYSCOUNTER_BYTES, (gpointer) &working_set, sizeof (gint64)); register_internal ("Private Bytes", SYSCOUNTER_BYTES, (gpointer) &private_bytes, sizeof (gint64)); register_internal ("Virtual Bytes", SYSCOUNTER_BYTES, (gpointer) &virtual_bytes, sizeof (gint64)); + register_internal ("Page File Bytes", SYSCOUNTER_BYTES, (gpointer) &paged_bytes, sizeof (gint64)); register_internal ("Page Faults", SYSCOUNTER_COUNT, (gpointer) &page_faults, sizeof (gint64)); register_internal ("CPU Load Average - 1min", SYSCOUNTER_LOAD, (gpointer) &cpu_load_1min, sizeof (double)); register_internal ("CPU Load Average - 5min", SYSCOUNTER_LOAD, (gpointer) &cpu_load_5min, sizeof (double)); diff --git a/mono/utils/mono-dl-posix.c b/mono/utils/mono-dl-posix.c index ea1b595c4a..f8e71e1356 100644 --- a/mono/utils/mono-dl-posix.c +++ b/mono/utils/mono-dl-posix.c @@ -66,7 +66,19 @@ mono_dl_open_file (const char *file, int flags) if (!file) return NULL; #endif +#if defined(_AIX) + /* + * dlopen is /weird/ on AIX + * shared libraries (really, all oobjects are, since PPC is PIC) + * can cohabitate with not just SOs of the other arch, but also + * with regular objects in an archive used for static linking + * + * we have to pass RTLD_MEMBER, otherwise lib.a(lib.o) doesn't work + */ + return dlopen (file, flags | RTLD_MEMBER); +#else return dlopen (file, flags); +#endif } void diff --git a/mono/utils/mono-error-internals.h b/mono/utils/mono-error-internals.h index 045d85ec38..a1aeb511af 100644 --- a/mono/utils/mono-error-internals.h +++ b/mono/utils/mono-error-internals.h @@ -43,10 +43,71 @@ struct _MonoErrorBoxed { MonoImage *image; }; -#define error_init(error) do { \ - ((MonoErrorInternal*)(error))->error_code = MONO_ERROR_NONE; \ - ((MonoErrorInternal*)(error))->flags = 0; \ -} while (0); +/* +Historically MonoError initialization was deferred, but always had to occur, + even in success paths, as cleanup could be done unconditionally. + This was confusing. + +ERROR_DECL (error) + This is the overwhelmingly common case. + Declare and initialize a local variable, named "error", + pointing to an initialized MonoError (named "error_value", + using token pasting). + +ERROR_DECL_VALUE (foo) + Declare and initialize a local variable, named "foo"; + no pointer is produced for it. + +MONO_API_ERROR_INIT + This is used for MonoError in/out parameter on a public interface, + which must be presumed uninitialized. These are often + marked with MONO_API, MONO_RT_EXTERNAL_ONLY, MONO_PROFILER_API, etc. + Tnis includes functions called from dis, profiler, pedump, and driver. + dis, profiler, and pedump make sense, these are actually external and + uninitialized. Driver less so. + +error_init + Initialize a MonoError. These are historical and usually + but not always redundant, and should be reduced/eliminated. + All the non-redundant ones should be renamed and all the redundant + ones removed. + +error_init_reuse + This indicates an error has been cleaned up and will be reused. + Consider also changing mono_error_cleanup to call error_init_internal, + and then remove these. + +error_init_internal + Rare cases without a better name. + For example, setting up an icall frame, or initializing member data. + +new0, calloc, static + A zeroed MonoError is valid and initialized. + Zeroing an entire MonoError is overkill, unless it is near other + bulk zeroing. + +All initialization is actually bottlenecked to error_init_internal. +Different names indicate different scenarios, but the same code. +*/ +#define ERROR_DECL_VALUE(x) MonoError x; error_init_internal (&x) +#define ERROR_DECL(x) ERROR_DECL_VALUE (x##_value); MonoError * const x = &x##_value +#define error_init_internal(error) ((void)((error)->init = 0)) +#define MONO_API_ERROR_INIT(error) error_init_internal (error) +#define error_init_reuse(error) error_init_internal (error) + +// Historical deferred initialization was called error_init. + +// possible bug detection that did not work +//#define error_init(error) (is_ok (error)) + +// FIXME Eventually all error_init should be removed, however it is prudent +// to leave them in for now, at least most of them, while we sort out +// the few that are needed and to experiment with adding them back in bulk, +// i.e. in an entire source file. Some are obviously not needed. +//#define error_init(error) // nothing +#define error_init(error) error_init_internal (error) +// Function for experimentation, should go away. +//void error_init(MonoError*); #define is_ok(error) ((error)->error_code == MONO_ERROR_NONE) @@ -56,14 +117,31 @@ struct _MonoErrorBoxed { #define goto_if_nok(error,label) do { if (!is_ok ((error))) goto label; } while (0) /* Only use this in icalls */ -#define return_val_and_set_pending_if_nok(error,value) \ +#define return_val_and_set_pending_if_nok(error, value) \ +do { \ if (mono_error_set_pending_exception ((error))) \ - return (value); + return (value); \ +} while (0) \ -void -mono_error_assert_ok_pos (MonoError *error, const char* filename, int lineno) MONO_LLVM_INTERNAL; - -#define mono_error_assert_ok(e) mono_error_assert_ok_pos (e, __FILE__, __LINE__); +/* + * Three macros to assert that a MonoError is ok: + * 1. mono_error_assert_ok(e) when you just want to print the error's message on failure + * 2. mono_error_assert_ok(e,msg) when you want to print "msg, due to " + * 3. mono_error_assertf_ok(e,fmt,args...) when you want to print ", due to " + * (fmt should specify the formatting just for args). + * + * What's the difference between mono_error_assert_msg_ok (e, "foo") and + * mono_error_assertf_ok (e, "foo") ? The former works as you expect, the + * latter unhelpfully expands to + * + * g_assertf (is_ok (e), "foo, due to %s", , mono_error_get_message (err)). + * + * Note the double commas. Turns out that to get rid of that extra comma + * portably we would have to write really ugly preprocessor macros. + */ +#define mono_error_assert_ok(error) g_assertf (is_ok (error), "%s", mono_error_get_message (error)) +#define mono_error_assert_msg_ok(error, msg) g_assertf (is_ok (error), msg ", due to %s", mono_error_get_message (error)) +#define mono_error_assertf_ok(error, fmt, ...) g_assertf (is_ok (error), fmt ", due to %s", __VA_ARGS__, mono_error_get_message (error)) void mono_error_dup_strings (MonoError *error, gboolean dup_strings); diff --git a/mono/utils/mono-error.c b/mono/utils/mono-error.c index b63be628a4..89cd7d1088 100644 --- a/mono/utils/mono-error.c +++ b/mono/utils/mono-error.c @@ -162,15 +162,6 @@ mono_error_ok (MonoError *error) return error->error_code == MONO_ERROR_NONE; } -void -mono_error_assert_ok_pos (MonoError *error, const char* filename, int lineno) -{ - if (mono_error_ok (error)) - return; - - g_error ("%s:%d: %s\n", filename, lineno, mono_error_get_message (error)); -} - unsigned short mono_error_get_error_code (MonoError *error) { @@ -593,7 +584,7 @@ mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char static MonoString* string_new_cleanup (MonoDomain *domain, const char *text) { - MonoError ignored_err; + ERROR_DECL_VALUE (ignored_err); MonoString *result = mono_string_new_checked (domain, text, &ignored_err); mono_error_cleanup (&ignored_err); return result; @@ -831,7 +822,7 @@ The error object is cleant after. MonoException* mono_error_convert_to_exception (MonoError *target_error) { - MonoError error; + ERROR_DECL (error); MonoException *ex; /* Mempool stored error shouldn't be cleaned up */ @@ -840,14 +831,14 @@ mono_error_convert_to_exception (MonoError *target_error) if (mono_error_ok (target_error)) return NULL; - ex = mono_error_prepare_exception (target_error, &error); - if (!mono_error_ok (&error)) { - MonoError second_chance; + ex = mono_error_prepare_exception (target_error, error); + if (!mono_error_ok (error)) { + ERROR_DECL_VALUE (second_chance); /*Try to produce the exception for the second error. FIXME maybe we should log about the original one*/ - ex = mono_error_prepare_exception (&error, &second_chance); + ex = mono_error_prepare_exception (error, &second_chance); g_assert (mono_error_ok (&second_chance)); /*We can't reasonable handle double faults, maybe later.*/ - mono_error_cleanup (&error); + mono_error_cleanup (error); } mono_error_cleanup (target_error); return ex; diff --git a/mono/utils/mono-error.h b/mono/utils/mono-error.h index 30c4493e51..ce3949f097 100644 --- a/mono/utils/mono-error.h +++ b/mono/utils/mono-error.h @@ -49,11 +49,15 @@ enum { }; /*Keep in sync with MonoErrorInternal*/ -typedef struct _MonoError { - unsigned short error_code; - unsigned short hidden_0; /*DON'T TOUCH */ - - void *hidden_1 [12]; /*DON'T TOUCH */ +typedef union _MonoError { + // Merge two uint16 into one uint32 so it can be initialized + // with one instruction instead of two. + uint32_t init; + struct { + uint16_t error_code; + uint16_t private_flags; /*DON'T TOUCH */ + void *hidden_1 [12]; /*DON'T TOUCH */ + }; } MonoError; /* Mempool-allocated MonoError.*/ diff --git a/mono/utils/mono-hwcap-ppc.c b/mono/utils/mono-hwcap-ppc.c index c004bfe6b3..c3adc8a18b 100644 --- a/mono/utils/mono-hwcap-ppc.c +++ b/mono/utils/mono-hwcap-ppc.c @@ -25,6 +25,8 @@ #if defined(__linux__) && defined(HAVE_SYS_AUXV_H) #include #include +#elif defined(_AIX) +#include #endif void @@ -59,5 +61,17 @@ mono_hwcap_arch_init (void) if (!strcmp (str, "ppc970") || (!strncmp (str, "power", 5) && str [5] >= '4' && str [5] <= '7')) mono_hwcap_ppc_has_multiple_ls_units = TRUE; } +#elif defined(_AIX) + /* + * FIXME: ensure these are valid, and we match Linux ones + */ + mono_hwcap_ppc_is_isa_2x = __power_4_andup() ? TRUE : FALSE; + mono_hwcap_ppc_is_isa_64 = __cpu64() ? TRUE: FALSE; + /* + * I dont see a way to get extended POWER6 and the PV_6_1 + * def seems to be trigged on the POWER6 here despite not + * having these extended instructions, so POWER7 it is + */ + mono_hwcap_ppc_has_move_fpr_gpr = __power_7_andup() ? TRUE : FALSE; #endif } diff --git a/mono/utils/mono-jemalloc.c b/mono/utils/mono-jemalloc.c new file mode 100644 index 0000000000..1aa8da0993 --- /dev/null +++ b/mono/utils/mono-jemalloc.c @@ -0,0 +1,19 @@ +/** + * \file + * + * Jemalloc registration code + */ + +#include +#include + +#ifdef MONO_JEMALLOC_ENABLED + +void +mono_init_jemalloc (void) +{ + GMemVTable g_mem_vtable = { MONO_JEMALLOC_MALLOC, MONO_JEMALLOC_REALLOC, MONO_JEMALLOC_FREE, MONO_JEMALLOC_CALLOC}; + g_mem_set_vtable (&g_mem_vtable); +} + +#endif diff --git a/mono/utils/mono-jemalloc.h b/mono/utils/mono-jemalloc.h new file mode 100644 index 0000000000..6721877f51 --- /dev/null +++ b/mono/utils/mono-jemalloc.h @@ -0,0 +1,36 @@ +/** + * \file + * + * Header for jemalloc registration code + */ + +#ifndef __MONO_JEMALLOC_H__ +#define __MONO_JEMALLOC_H__ + +#if defined(MONO_JEMALLOC_ENABLED) + +#include + +/* Jemalloc can be configured in three ways. + * 1. You can use it with library loading hacks at run-time + * 2. You can use it as a global malloc replacement + * 3. You can use it with a prefix. If you use it with a prefix, you have to explicitly name the malloc function. + * + * In order to make this feature able to be toggled at run-time, I chose to use a prefix of mono_je. + * This mapping is captured below in the header, in the spirit of "no magic constants". + * + * The place that configures jemalloc and sets this prefix is in the Makefile in + * mono/jemalloc/Makefile.am + * + */ +#define MONO_JEMALLOC_MALLOC mono_jemalloc +#define MONO_JEMALLOC_REALLOC mono_jerealloc +#define MONO_JEMALLOC_FREE mono_jefree +#define MONO_JEMALLOC_CALLOC mono_jecalloc + +void mono_init_jemalloc (void); + +#endif + +#endif + diff --git a/mono/utils/mono-machine.h b/mono/utils/mono-machine.h index 5e546a9201..a5026fef79 100644 --- a/mono/utils/mono-machine.h +++ b/mono/utils/mono-machine.h @@ -26,4 +26,15 @@ typedef gint32 mgreg_t; typedef gint64 mgreg_t; #endif +/* Alignment for MonoArray.vector */ +#if defined(_AIX) +/* + * HACK: doubles in structs always align to 4 on AIX... even on 64-bit, + * which is bad for aligned usage like what System.Array.FastCopy does + */ +typedef guint64 mono_64bitaligned_t; +#else +typedef double mono_64bitaligned_t; +#endif + #endif /* __MONO_MONO_MACHINE_H__ */ diff --git a/mono/utils/mono-mmap.c b/mono/utils/mono-mmap.c index 4e5e717bce..2171f6ebd0 100644 --- a/mono/utils/mono-mmap.c +++ b/mono/utils/mono-mmap.c @@ -351,7 +351,8 @@ mono_mprotect (void *addr, size_t length, int flags) memset (addr, 0, length); #else memset (addr, 0, length); -#ifdef HAVE_MADVISE +/* some OSes (like AIX) have madvise but no MADV_FREE */ +#if defined(HAVE_MADVISE) && defined(MADV_FREE) madvise (addr, length, MADV_DONTNEED); madvise (addr, length, MADV_FREE); #else diff --git a/mono/utils/mono-proclib.c b/mono/utils/mono-proclib.c index 714d9eb7a2..1340b9db01 100644 --- a/mono/utils/mono-proclib.c +++ b/mono/utils/mono-proclib.c @@ -548,8 +548,8 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul gint64 ret; task_t task; - struct task_basic_info t_info; - mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT; + task_vm_info_data_t t_info; + mach_msg_type_number_t info_count = TASK_VM_INFO_COUNT; kern_return_t mach_ret; if (pid == getpid ()) { @@ -565,7 +565,7 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul } do { - mach_ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count); + mach_ret = task_info (task, TASK_VM_INFO, (task_info_t)&t_info, &info_count); } while (mach_ret == KERN_ABORTED); if (mach_ret != KERN_SUCCESS) { @@ -574,12 +574,29 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul RET_ERROR (MONO_PROCESS_ERROR_OTHER); } - if (strcmp (item, "VmRSS") == 0 || strcmp (item, "VmHWM") == 0 || strcmp (item, "VmData") == 0) + if(strcmp (item, "VmData") == 0) + ret = t_info.internal + t_info.compressed; + else if (strcmp (item, "VmRSS") == 0) ret = t_info.resident_size; + else if(strcmp (item, "VmHWM") == 0) + ret = t_info.resident_size_peak; else if (strcmp (item, "VmSize") == 0 || strcmp (item, "VmPeak") == 0) ret = t_info.virtual_size; - else if (strcmp (item, "Threads") == 0) + else if (strcmp (item, "Threads") == 0) { + struct task_basic_info t_info; + mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT; + do { + mach_ret = task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count); + } while (mach_ret == KERN_ABORTED); + + if (mach_ret != KERN_SUCCESS) { + if (pid != getpid ()) + mach_port_deallocate (mach_task_self (), task); + RET_ERROR (MONO_PROCESS_ERROR_OTHER); + } ret = th_count; + } else if (strcmp (item, "VmSwap") == 0) + ret = t_info.compressed; else ret = 0; @@ -809,13 +826,13 @@ get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *s { char buf [256]; char *s; - int hz = get_user_hz (); + int uhz = get_user_hz (); guint64 user_ticks = 0, nice_ticks = 0, system_ticks = 0, idle_ticks = 0, irq_ticks = 0, sirq_ticks = 0; FILE *f = fopen ("/proc/stat", "r"); if (!f) return; if (cpu_id < 0) - hz *= mono_cpu_count (); + uhz *= mono_cpu_count (); while ((s = fgets (buf, sizeof (buf), f))) { char *data = NULL; if (cpu_id < 0 && strncmp (s, "cpu", 3) == 0 && g_ascii_isspace (s [3])) { @@ -840,15 +857,15 @@ get_cpu_times (int cpu_id, gint64 *user, gint64 *systemt, gint64 *irq, gint64 *s fclose (f); if (user) - *user = (user_ticks + nice_ticks) * 10000000 / hz; + *user = (user_ticks + nice_ticks) * 10000000 / uhz; if (systemt) - *systemt = (system_ticks) * 10000000 / hz; + *systemt = (system_ticks) * 10000000 / uhz; if (irq) - *irq = (irq_ticks) * 10000000 / hz; + *irq = (irq_ticks) * 10000000 / uhz; if (sirq) - *sirq = (sirq_ticks) * 10000000 / hz; + *sirq = (sirq_ticks) * 10000000 / uhz; if (idle) - *idle = (idle_ticks) * 10000000 / hz; + *idle = (idle_ticks) * 10000000 / uhz; } /** diff --git a/mono/utils/mono-sigcontext.h b/mono/utils/mono-sigcontext.h index c20e959cc0..f3c23663a8 100644 --- a/mono/utils/mono-sigcontext.h +++ b/mono/utils/mono-sigcontext.h @@ -367,6 +367,13 @@ typedef struct ucontext { #define UCONTEXT_REG_FPRn(ctx, n) ((ctx)->uc_mcontext.mc_fpreg [(n)]) #define UCONTEXT_REG_NIP(ctx) ((ctx)->uc_mcontext.mc_srr0) #define UCONTEXT_REG_LNK(ctx) ((ctx)->uc_mcontext.mc_lr) +#elif defined(_AIX) + typedef ucontext_t os_ucontext; + + #define UCONTEXT_REG_Rn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.jmp_context.gpr[(n)]) + #define UCONTEXT_REG_FPRn(ctx, n) (((os_ucontext*)(ctx))->uc_mcontext.jmp_context.fpr[(n)]) + #define UCONTEXT_REG_NIP(ctx) (((os_ucontext*)(ctx))->uc_mcontext.jmp_context.iar) + #define UCONTEXT_REG_LNK(ctx) (((os_ucontext*)(ctx))->uc_mcontext.jmp_context.lr) #endif #elif defined(TARGET_ARM) diff --git a/mono/utils/mono-stack-unwinding.h b/mono/utils/mono-stack-unwinding.h index 82f6127a8a..01cb513f83 100644 --- a/mono/utils/mono-stack-unwinding.h +++ b/mono/utils/mono-stack-unwinding.h @@ -84,6 +84,15 @@ typedef struct { /* For FRAME_TYPE_INTERP */ gpointer interp_frame; + /* + * A stack address associated with the frame which can be used + * to compare frames. + * This is needed because ctx is not changed when unwinding through + * interpreter frames, it still refers to the last native interpreter + * frame. + */ + gpointer frame_addr; + /* The next fields are only useful for the jit */ gpointer lmf; guint32 unwind_info_len; diff --git a/mono/utils/mono-threads-aix.c b/mono/utils/mono-threads-aix.c new file mode 100644 index 0000000000..538f4d895f --- /dev/null +++ b/mono/utils/mono-threads-aix.c @@ -0,0 +1,41 @@ +/** + * \file + */ + +#include + +#if defined(_AIX) + +#include +#include + +void +mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize) +{ + /* see GC_push_all_stacks in libgc/aix_irix_threads.c + for why we do this; pthread_getattr_np exists only + on some versions of AIX and not on PASE, so use a + legacy way to get the stack information */ + struct __pthrdsinfo pi; + pthread_t pt; + int res, rbv, ps; + char rb[255]; + + pt = pthread_self(); + ps = sizeof(pi); + rbv = sizeof(rb); + + *staddr = NULL; + *stsize = (size_t)-1; + + res = pthread_getthrds_np(&pt, PTHRDSINFO_QUERY_ALL, &pi, ps, rb, &rbv); + /* FIXME: are these the right values? */ + *staddr = (void*)(pi.__pi_stackaddr); + /* + * ruby doesn't use stacksize; see: + * github.com/ruby/ruby/commit/a2594be783c727c6034308f5294333752c3845bb + */ + *stsize = pi.__pi_stackend - pi.__pi_stackaddr; +} + +#endif diff --git a/mono/utils/mono-threads-openbsd.c b/mono/utils/mono-threads-openbsd.c index 117e22108f..b6790592a6 100644 --- a/mono/utils/mono-threads-openbsd.c +++ b/mono/utils/mono-threads-openbsd.c @@ -6,31 +6,21 @@ #if defined(__OpenBSD__) +#include #include #include void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize) { - /* TODO : Determine if this code is actually still needed. It may already be covered by the case above. */ - pthread_attr_t attr; - guint8 *current = (guint8*)&attr; - - *staddr = NULL; - *stsize = (size_t)-1; - - pthread_attr_init (&attr); - stack_t ss; int rslt; rslt = pthread_stackseg_np (pthread_self (), &ss); g_assert (rslt == 0); - *staddr = (guint8*)((size_t)ss.ss_sp - ss.ss_size); + *staddr = (void*)((size_t)ss.ss_sp - ss.ss_size); *stsize = ss.ss_size; - - pthread_attr_destroy (&attr); } #endif diff --git a/mono/utils/mono-threads-wasm.c b/mono/utils/mono-threads-wasm.c index 345aca3505..040903b048 100644 --- a/mono/utils/mono-threads-wasm.c +++ b/mono/utils/mono-threads-wasm.c @@ -3,10 +3,14 @@ #include #include + #if defined (USE_WASM_BACKEND) -#include +#include +#include +#include +#include #define round_down(addr, val) ((void*)((addr) & ~((val) - 1))) @@ -154,4 +158,32 @@ mono_threads_platform_in_critical_region (MonoNativeThreadId tid) return FALSE; } + +extern void schedule_background_exec (void); + +static GSList *jobs; + +void +mono_threads_schedule_background_job (background_job_cb cb) +{ + if (!jobs) + schedule_background_exec (); + + if (!g_slist_find (jobs, cb)) + jobs = g_slist_prepend (jobs, cb); +} + +EMSCRIPTEN_KEEPALIVE void +mono_background_exec (void) +{ + GSList *j = jobs, *cur; + jobs = NULL; + + for (cur = j; cur; cur = cur->next) { + background_job_cb cb = (background_job_cb)cur->data; + cb (); + } + g_slist_free (j); +} + #endif diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index 4e77d0d558..2e58745174 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -1145,17 +1145,13 @@ mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid) if (tid == mono_native_thread_id_get ()) return; + mono_thread_info_suspend_lock (); hp = mono_hazard_pointer_get (); info = mono_thread_info_lookup (tid); - if (!info) - return; - - if (mono_thread_info_run_state (info) == STATE_DETACHED) { - mono_hazard_pointer_clear (hp, 1); + if (!info) { + mono_thread_info_suspend_unlock (); return; } - - mono_thread_info_suspend_lock (); mono_threads_begin_global_suspend (); mono_threads_suspend_abort_syscall (info); diff --git a/mono/utils/mono-threads.h b/mono/utils/mono-threads.h index d085465318..ade9380d51 100644 --- a/mono/utils/mono-threads.h +++ b/mono/utils/mono-threads.h @@ -231,8 +231,6 @@ typedef struct { */ gint32 profiler_signal_ack; - gint32 thread_pending_native_join; - #ifdef USE_WINDOWS_BACKEND gint32 thread_wait_info; #endif @@ -649,4 +647,10 @@ mono_thread_info_wait_multiple_handle (MonoThreadHandle **thread_handles, gsize void mono_threads_join_lock (void); void mono_threads_join_unlock (void); + +#ifdef HOST_WASM +typedef void (*background_job_cb)(void); +void mono_threads_schedule_background_job (background_job_cb cb); +#endif + #endif /* __MONO_THREADS_H__ */ diff --git a/mono/utils/mono-time.c b/mono/utils/mono-time.c index 4a3b270556..a3c6151a08 100644 --- a/mono/utils/mono-time.c +++ b/mono/utils/mono-time.c @@ -9,16 +9,34 @@ #include #include #include +#include #ifdef HAVE_SYS_TIME_H #include #endif -#include +#include +#include +#if HAVE_MACH_ABSOLUTE_TIME +#include +static mach_timebase_info_data_t s_TimebaseInfo; +#endif #define MTICKS_PER_SEC (10 * 1000 * 1000) +typedef enum _TimeConversionConstants +{ + tccSecondsToMillieSeconds = 1000, // 10^3 + tccSecondsToMicroSeconds = 1000000, // 10^6 + tccSecondsToNanoSeconds = 1000000000, // 10^9 + tccMillieSecondsToMicroSeconds = 1000, // 10^3 + tccMillieSecondsToNanoSeconds = 1000000, // 10^6 + tccMicroSecondsToNanoSeconds = 1000, // 10^3 + tccSecondsTo100NanoSeconds = 10000000, // 10^7 + tccMicroSecondsTo100NanoSeconds = 10 // 10^1 +} TimeConversionConstants; + gint64 mono_msec_ticks (void) { @@ -126,16 +144,65 @@ get_boot_time (void) } /* Returns the number of milliseconds from boot time: this should be monotonic */ +/* Adapted from CoreCLR: https://github.com/dotnet/coreclr/blob/66d2738ea96fcce753dec1370e79a0c78f7b6adb/src/pal/src/misc/time.cpp */ gint64 mono_msec_boottime (void) { - static gint64 boot_time = 0; - gint64 now; - if (!boot_time) - boot_time = get_boot_time (); - now = mono_100ns_datetime (); - /*printf ("now: %llu (boot: %llu) ticks: %llu\n", (gint64)now, (gint64)boot_time, (gint64)(now - boot_time));*/ - return (now - boot_time)/10000; + gint64 retval = 0; + + /* clock_gettime () is found by configure on Apple builds, but its only present from ios 10, macos 10.12, tvos 10 and watchos 3 */ +#if (defined(HAVE_CLOCK_MONOTONIC_COARSE) || defined(HAVE_CLOCK_MONOTONIC)) && !(defined(TARGET_IOS) || defined(TARGET_OSX) || defined(TARGET_WATCHOS) || defined(TARGET_TVOS)) + clockid_t clockType = +#if HAVE_CLOCK_MONOTONIC_COARSE + CLOCK_MONOTONIC_COARSE; /* good enough resolution, fastest speed */ +#else + CLOCK_MONOTONIC; +#endif + struct timespec ts; + if (clock_gettime (clockType, &ts) != 0) { + g_error ("clock_gettime(CLOCK_MONOTONIC*) failed; errno is %d", errno, strerror (errno)); + goto exit; + } + retval = (ts.tv_sec * tccSecondsToMillieSeconds) + (ts.tv_nsec / tccMillieSecondsToNanoSeconds); + +#elif HAVE_MACH_ABSOLUTE_TIME + static gboolean timebase_inited; + + if (!timebase_inited) { + kern_return_t machRet; + mach_timebase_info_data_t tmp; + machRet = mach_timebase_info (&tmp); + g_assert (machRet == KERN_SUCCESS); + /* Assume memcpy works correctly if ran concurrently */ + memcpy (&s_TimebaseInfo, &tmp, sizeof (mach_timebase_info_data_t)); + mono_memory_barrier (); + timebase_inited = TRUE; + } + retval = (mach_absolute_time () * s_TimebaseInfo.numer / s_TimebaseInfo.denom) / tccMillieSecondsToNanoSeconds; + +#elif HAVE_GETHRTIME + retval = (gint64)(gethrtime () / tccMillieSecondsToNanoSeconds); + +#elif HAVE_READ_REAL_TIME + timebasestruct_t tb; + read_real_time (&tb, TIMEBASE_SZ); + if (time_base_to_time (&tb, TIMEBASE_SZ) != 0) { + g_error ("time_base_to_time() failed; errno is %d (%s)", errno, strerror (errno)); + goto exit; + } + retval = (tb.tb_high * tccSecondsToMillieSeconds) + (tb.tb_low / tccMillieSecondsToNanoSeconds); + +#else + struct timeval tv; + if (gettimeofday (&tv, NULL) == -1) { + g_error ("gettimeofday() failed; errno is %d (%s)", errno, strerror (errno)); + goto exit; + } + retval = (tv.tv_sec * tccSecondsToMillieSeconds) + (tv.tv_usec / tccMillieSecondsToMicroSeconds); + +#endif /* HAVE_CLOCK_MONOTONIC */ +exit: + return retval; } /* Returns the number of 100ns ticks from unspecified time: this should be monotonic */ diff --git a/mono/utils/networking-posix.c b/mono/utils/networking-posix.c index caa2073a53..95e3d7df58 100644 --- a/mono/utils/networking-posix.c +++ b/mono/utils/networking-posix.c @@ -17,6 +17,9 @@ #ifdef HAVE_SYS_IOCTL_H #include #endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif #ifdef HAVE_NET_IF_H #include #endif diff --git a/msvc/Makefile.in b/msvc/Makefile.in index b677fbfa3b..adc5f22bfd 100644 --- a/msvc/Makefile.in +++ b/msvc/Makefile.in @@ -82,14 +82,14 @@ subdir = msvc DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/po/Makefile.in b/po/Makefile.in index 9f165edd70..7abd322749 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -82,14 +82,14 @@ subdir = po DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -261,6 +261,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -289,6 +293,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo index 6190777da155ccf08c7b7f6d0d204440f9ccb6d0..92dd6cf955138852c6146f93088298985d91d187 100644 GIT binary patch delta 20 bcmbQIHBW29Q!aKB1p^B!6O+wvxQw^}N|^?F delta 20 bcmbQIHBW29Q!aKx1p^B!Bg4&axQw^}N>v7O diff --git a/po/mcs/de.po.REMOVED.git-id b/po/mcs/de.po.REMOVED.git-id index 1375994bc3..dc7294558e 100644 --- a/po/mcs/de.po.REMOVED.git-id +++ b/po/mcs/de.po.REMOVED.git-id @@ -1 +1 @@ -3bd2f741ce7d19a3c43b10f9a343a09aa06c70b9 \ No newline at end of file +329437f645644091046c414cc8fa5562b5f1fc30 \ No newline at end of file diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo index 1d874115842dd7213fd09e338cfe5000d41ffaf2..65cedb7d5e3364cb0ec380fc5e3458be533074bf 100644 GIT binary patch delta 20 bcmX?Ef3kjqo+7)6f`NsViOFVD#VK+CQMm@N delta 20 bcmX?Ef3kjqo+7)Uf`NsVk>O@j#VK+CQFR8W diff --git a/po/mcs/es.po.REMOVED.git-id b/po/mcs/es.po.REMOVED.git-id index 4560cfe0d7..8f96c9caff 100644 --- a/po/mcs/es.po.REMOVED.git-id +++ b/po/mcs/es.po.REMOVED.git-id @@ -1 +1 @@ -a3a2e71b71e423306de84744017a8a706f207629 \ No newline at end of file +521098bd4ca59178fd0eb057618f26d2dfc89e54 \ No newline at end of file diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo index 51dca5ea6d5184a2720bdf250e4f9ea91f383251..e85c3447bb0b6fcc705a79bad56bfbc0b546c457 100644 GIT binary patch delta 22 dcmeyri1Gg-#tj_m>?R5Z7FH%EoB7oXv;biX2MhoJ delta 22 dcmeyri1Gg-#tj_m?1l;k7FI@voB7oXv;bho2Lu2B diff --git a/po/mcs/ja.po.REMOVED.git-id b/po/mcs/ja.po.REMOVED.git-id index e69db8cffa..4b3ae2f0bd 100644 --- a/po/mcs/ja.po.REMOVED.git-id +++ b/po/mcs/ja.po.REMOVED.git-id @@ -1 +1 @@ -996154dd8b712ff1f3f1abe8662f6279a9c2e0a3 \ No newline at end of file +a2a1cb002601b3c67db1b45f7d6e83c821313c58 \ No newline at end of file diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot index 755911b2cd..855e7c7c47 100644 --- a/po/mcs/mcs.pot +++ b/po/mcs/mcs.pot @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: mono 5.10.1.49\n" +"Project-Id-Version: mono 5.12.0.220\n" "Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n" -"POT-Creation-Date: 2018-04-21 08:21+0000\n" +"POT-Creation-Date: 2018-04-24 08:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -488,140 +488,140 @@ msgid "" "`struct', `interface', or `void' keyword" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:1721 mcs/mcs/cs-tokenizer.cs:1784 -msgid "Invalid number" -msgstr "" - -#: mcs/mcs/cs-tokenizer.cs:1999 +#: mcs/mcs/cs-tokenizer.cs:2131 #, csharp-format msgid "Unrecognized escape sequence `\\{0}'" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2018 +#: mcs/mcs/cs-tokenizer.cs:2150 msgid "Unrecognized escape sequence" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2283 +#: mcs/mcs/cs-tokenizer.cs:2415 msgid "Filename, single-line comment or end-of-line expected" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2331 +#: mcs/mcs/cs-tokenizer.cs:2463 msgid "Missing identifier to pre-processor directive" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2341 mcs/mcs/cs-tokenizer.cs:2345 +#: mcs/mcs/cs-tokenizer.cs:2473 mcs/mcs/cs-tokenizer.cs:2477 #, csharp-format msgid "Identifier expected: {0}" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2945 +#: mcs/mcs/cs-tokenizer.cs:3077 msgid "Integral constant is too large" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2950 +#: mcs/mcs/cs-tokenizer.cs:3082 +msgid "Invalid number" +msgstr "" + +#: mcs/mcs/cs-tokenizer.cs:3087 msgid "Invalid preprocessor directive" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2957 +#: mcs/mcs/cs-tokenizer.cs:3094 #, csharp-format msgid "Unexpected processor directive ({0})" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2963 +#: mcs/mcs/cs-tokenizer.cs:3100 msgid "" "Cannot define or undefine preprocessor symbols after first token in file" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2969 +#: mcs/mcs/cs-tokenizer.cs:3106 msgid "" "Preprocessor directives must appear as the first non-whitespace character on " "a line" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:2974 +#: mcs/mcs/cs-tokenizer.cs:3111 msgid "Single-line comment or end-of-line expected" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3019 mcs/mcs/cs-tokenizer.cs:4257 +#: mcs/mcs/cs-tokenizer.cs:3156 mcs/mcs/cs-tokenizer.cs:4394 msgid "Expected `#endif' directive" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3052 mcs/mcs/cs-tokenizer.cs:3073 -#: mcs/mcs/cs-tokenizer.cs:3104 mcs/mcs/cs-tokenizer.cs:4255 +#: mcs/mcs/cs-tokenizer.cs:3189 mcs/mcs/cs-tokenizer.cs:3210 +#: mcs/mcs/cs-tokenizer.cs:3241 mcs/mcs/cs-tokenizer.cs:4392 msgid "#endregion directive expected" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3153 +#: mcs/mcs/cs-tokenizer.cs:3290 msgid "Wrong preprocessor directive" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3165 +#: mcs/mcs/cs-tokenizer.cs:3302 #, csharp-format msgid "#error: '{0}'" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3183 +#: mcs/mcs/cs-tokenizer.cs:3320 msgid "The line number specified for #line directive is missing or invalid" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3237 mcs/mcs/cs-tokenizer.cs:3957 +#: mcs/mcs/cs-tokenizer.cs:3374 mcs/mcs/cs-tokenizer.cs:4094 msgid "Newline in constant" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3264 +#: mcs/mcs/cs-tokenizer.cs:3401 msgid "Unterminated string literal" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3308 mcs/mcs/cs-tokenizer.cs:3339 +#: mcs/mcs/cs-tokenizer.cs:3445 mcs/mcs/cs-tokenizer.cs:3476 #, csharp-format msgid "Unexpected character `\\{0}'" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3355 +#: mcs/mcs/cs-tokenizer.cs:3492 msgid "Identifier too long (limit is 512 chars)" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3702 +#: mcs/mcs/cs-tokenizer.cs:3839 msgid "A single-line comment may not be used in an interpolated string" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3772 +#: mcs/mcs/cs-tokenizer.cs:3909 msgid "End-of-file found, '*/' expected" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3869 +#: mcs/mcs/cs-tokenizer.cs:4006 msgid "Missing close delimiter `}' for interpolated expression" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3890 +#: mcs/mcs/cs-tokenizer.cs:4027 msgid "Keyword, identifier, or string expected after verbatim specifier: @" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3927 +#: mcs/mcs/cs-tokenizer.cs:4064 #, csharp-format msgid "Unexpected character `{0}'" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3952 +#: mcs/mcs/cs-tokenizer.cs:4089 msgid "Empty character literal" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:3973 +#: mcs/mcs/cs-tokenizer.cs:4110 msgid "Too many characters in character literal" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:4083 mcs/mcs/cs-tokenizer.cs:4146 +#: mcs/mcs/cs-tokenizer.cs:4220 mcs/mcs/cs-tokenizer.cs:4283 #, csharp-format msgid "" "A `{0}' character may only be escaped by doubling `{0}{0}' in an " "interpolated string" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:4124 +#: mcs/mcs/cs-tokenizer.cs:4261 msgid "Empty interpolated expression format specifier" msgstr "" -#: mcs/mcs/cs-tokenizer.cs:4126 +#: mcs/mcs/cs-tokenizer.cs:4263 msgid "" "A interpolated expression format specifier may not contain trailing " "whitespace" @@ -631,7 +631,7 @@ msgstr "" msgid "The operation overflows at compile time in checked mode" msgstr "" -#: mcs/mcs/cfold.cs:329 mcs/mcs/expression.cs:5110 +#: mcs/mcs/cfold.cs:329 mcs/mcs/expression.cs:5120 #, csharp-format msgid "Operator `{0}' is ambiguous on operands of type `{1}' and `{2}'" msgstr "" @@ -1187,7 +1187,7 @@ msgstr "" msgid "Expression does not have a name" msgstr "" -#: mcs/mcs/convert.cs:1308 +#: mcs/mcs/convert.cs:1315 #, csharp-format msgid "" "Ambiguous user defined operators `{0}' and `{1}' when converting from `{2}' " @@ -1428,8 +1428,8 @@ msgstr "" msgid "Internal compiler error: {0}" msgstr "" -#: mcs/mcs/ecore.cs:605 mcs/mcs/expression.cs:1932 mcs/mcs/expression.cs:8148 -#: mcs/mcs/expression.cs:8156 +#: mcs/mcs/ecore.cs:605 mcs/mcs/expression.cs:1932 mcs/mcs/expression.cs:8182 +#: mcs/mcs/expression.cs:8190 msgid "A constant value is expected" msgstr "" @@ -1965,307 +1965,316 @@ msgstr "" msgid "The type `{0}' pattern matching is not allowed" msgstr "" -#: mcs/mcs/expression.cs:2338 +#: mcs/mcs/expression.cs:2342 #, csharp-format msgid "`{0}' is not a valid pattern member" msgstr "" -#: mcs/mcs/expression.cs:2345 +#: mcs/mcs/expression.cs:2349 #, csharp-format msgid "Property `{0}.get' accessor is required" msgstr "" -#: mcs/mcs/expression.cs:2476 +#: mcs/mcs/expression.cs:2480 msgid "" "The first operand of an `as' operator may not be a tuple literal without a " "natural type" msgstr "" -#: mcs/mcs/expression.cs:2489 +#: mcs/mcs/expression.cs:2493 #, csharp-format msgid "" "The `as' operator cannot be used with a non-reference type parameter `{0}'. " "Consider adding `class' or a reference type constraint" msgstr "" -#: mcs/mcs/expression.cs:2493 +#: mcs/mcs/expression.cs:2497 #, csharp-format msgid "The `as' operator cannot be used with a non-nullable value type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:2527 +#: mcs/mcs/expression.cs:2531 #, csharp-format msgid "Cannot convert type `{0}' to `{1}' via a built-in conversion" msgstr "" -#: mcs/mcs/expression.cs:2568 +#: mcs/mcs/expression.cs:2572 #, csharp-format msgid "Cannot convert to static type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:2676 +#: mcs/mcs/expression.cs:2680 msgid "An expression tree cannot contain out variable declaration" msgstr "" -#: mcs/mcs/expression.cs:2780 +#: mcs/mcs/expression.cs:2790 msgid "" "The `default value' operator cannot be applied to an operand of a static type" msgstr "" -#: mcs/mcs/expression.cs:3467 +#: mcs/mcs/expression.cs:3477 #, csharp-format msgid "Operator `{0}' cannot be applied to operands of type `{1}' and `{2}'" msgstr "" -#: mcs/mcs/expression.cs:4274 +#: mcs/mcs/expression.cs:4284 msgid "To cast a negative value, you must enclose the value in parentheses" msgstr "" -#: mcs/mcs/expression.cs:4323 +#: mcs/mcs/expression.cs:4333 #, csharp-format msgid "Operator `{0}' cannot be applied to operand `default'" msgstr "" -#: mcs/mcs/expression.cs:4328 +#: mcs/mcs/expression.cs:4338 #, csharp-format msgid "Operator `{0}' is ambiguous on operands `default' and `default'" msgstr "" -#: mcs/mcs/expression.cs:4390 +#: mcs/mcs/expression.cs:4400 #, csharp-format msgid "" "Expression must be implicitly convertible to Boolean or its type `{0}' must " "define operator `{1}'" msgstr "" -#: mcs/mcs/expression.cs:6002 +#: mcs/mcs/expression.cs:6012 #, 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:6012 +#: mcs/mcs/expression.cs:6022 #, 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:6390 +#: mcs/mcs/expression.cs:6400 #, csharp-format msgid "" "Type of conditional expression cannot be determined as `{0}' and `{1}' " "convert implicitly to each other" msgstr "" -#: mcs/mcs/expression.cs:6403 +#: mcs/mcs/expression.cs:6413 #, 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:6751 +#: mcs/mcs/expression.cs:6450 +msgid "Both ref conditional operators must be ref values" +msgstr "" + +#: mcs/mcs/expression.cs:6455 +#, csharp-format +msgid "The ref conditional expression types `{0}' and `{1}' have to match" +msgstr "" + +#: mcs/mcs/expression.cs:6785 #, csharp-format msgid "Use of unassigned local variable `{0}'" msgstr "" -#: mcs/mcs/expression.cs:6774 +#: mcs/mcs/expression.cs:6808 #, csharp-format msgid "" "Cannot use fixed variable `{0}' inside an anonymous method, lambda " "expression or query expression" msgstr "" -#: mcs/mcs/expression.cs:6781 +#: mcs/mcs/expression.cs:6815 #, csharp-format msgid "" "Cannot use by-reference variable `{0}' inside an anonymous method, lambda " "expression, or query expression" msgstr "" -#: mcs/mcs/expression.cs:6800 +#: mcs/mcs/expression.cs:6834 #, csharp-format msgid "Cannot use uninitialized variable `{0}'" msgstr "" -#: mcs/mcs/expression.cs:6974 +#: mcs/mcs/expression.cs:7008 #, csharp-format msgid "" "Parameter `{0}' cannot be used inside `{1}' when using `ref' or `out' " "modifier" msgstr "" -#: mcs/mcs/expression.cs:7044 +#: mcs/mcs/expression.cs:7078 #, csharp-format msgid "Use of unassigned out parameter `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7217 +#: mcs/mcs/expression.cs:7251 msgid "The syntax `var (...)' as an lvalue is reserved" msgstr "" -#: mcs/mcs/expression.cs:7298 +#: mcs/mcs/expression.cs:7332 #, csharp-format msgid "Cannot invoke a non-delegate type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7309 +#: mcs/mcs/expression.cs:7343 #, csharp-format msgid "The member `{0}' cannot be used as method or delegate" msgstr "" -#: mcs/mcs/expression.cs:7331 +#: mcs/mcs/expression.cs:7365 msgid "" "Do not directly call your base class Finalize method. It is called " "automatically from your destructor" msgstr "" -#: mcs/mcs/expression.cs:7333 +#: mcs/mcs/expression.cs:7367 msgid "" "Destructors and object.Finalize cannot be called directly. Consider calling " "IDisposable.Dispose if available" msgstr "" -#: mcs/mcs/expression.cs:7366 +#: mcs/mcs/expression.cs:7400 #, 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:7461 +#: mcs/mcs/expression.cs:7495 #, csharp-format msgid "`{0}': cannot explicitly call operator or accessor" msgstr "" -#: mcs/mcs/expression.cs:7652 +#: mcs/mcs/expression.cs:7686 msgid "" "Tuple type cannot be used in an object creation expression. Use a tuple " "literal expression instead." msgstr "" -#: mcs/mcs/expression.cs:7662 +#: mcs/mcs/expression.cs:7696 #, csharp-format msgid "Unsafe type `{0}' cannot be used in an object creation expression" msgstr "" -#: mcs/mcs/expression.cs:7685 +#: mcs/mcs/expression.cs:7719 #, 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:7691 +#: mcs/mcs/expression.cs:7725 #, csharp-format msgid "" "`{0}': cannot provide arguments when creating an instance of a variable type" msgstr "" -#: mcs/mcs/expression.cs:7700 +#: mcs/mcs/expression.cs:7734 #, csharp-format msgid "Cannot create an instance of the static class `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7712 +#: mcs/mcs/expression.cs:7746 #, csharp-format msgid "Cannot create an instance of the abstract class or interface `{0}'" msgstr "" -#: mcs/mcs/expression.cs:7997 +#: mcs/mcs/expression.cs:8031 msgid "" "An implicitly typed local variable declarator cannot use an array initializer" msgstr "" -#: mcs/mcs/expression.cs:8162 mcs/mcs/expression.cs:8187 +#: mcs/mcs/expression.cs:8196 mcs/mcs/expression.cs:8221 #, csharp-format msgid "An array initializer of length `{0}' was expected" msgstr "" -#: mcs/mcs/expression.cs:8178 +#: mcs/mcs/expression.cs:8212 msgid "" "Array initializers can only be used in a variable or field initializer. Try " "using a new expression instead" msgstr "" -#: mcs/mcs/expression.cs:8195 +#: mcs/mcs/expression.cs:8229 msgid "A nested array initializer was expected" msgstr "" -#: mcs/mcs/expression.cs:8242 +#: mcs/mcs/expression.cs:8276 msgid "An expression tree cannot contain a multidimensional array initializer" msgstr "" -#: mcs/mcs/expression.cs:8278 +#: mcs/mcs/expression.cs:8312 msgid "Cannot create an array with a negative size" msgstr "" -#: mcs/mcs/expression.cs:8380 +#: mcs/mcs/expression.cs:8414 msgid "" "Can only use array initializer expressions to assign to array types. Try " "using a new expression instead" msgstr "" -#: mcs/mcs/expression.cs:8821 +#: mcs/mcs/expression.cs:8855 msgid "" "The type of an implicitly typed array cannot be inferred from the " "initializer. Try specifying array type explicitly" msgstr "" -#: mcs/mcs/expression.cs:8976 +#: mcs/mcs/expression.cs:9010 msgid "" "The `this' object cannot be used before all of its fields are assigned to" msgstr "" -#: mcs/mcs/expression.cs:8982 +#: mcs/mcs/expression.cs:9016 msgid "" "Keyword `this' is not valid in a static property, static method, or static " "field initializer" msgstr "" -#: mcs/mcs/expression.cs:8985 +#: mcs/mcs/expression.cs:9019 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:8988 +#: mcs/mcs/expression.cs:9022 msgid "Keyword `this' is not available in the current context" msgstr "" -#: mcs/mcs/expression.cs:9064 +#: mcs/mcs/expression.cs:9098 msgid "Cannot take the address of `this' because it is read-only" msgstr "" -#: mcs/mcs/expression.cs:9066 +#: mcs/mcs/expression.cs:9100 msgid "Cannot pass `this' as a ref or out argument because it is read-only" msgstr "" -#: mcs/mcs/expression.cs:9068 +#: mcs/mcs/expression.cs:9102 msgid "Cannot assign to `this' because it is read-only" msgstr "" -#: mcs/mcs/expression.cs:9136 +#: mcs/mcs/expression.cs:9170 msgid "The __arglist construct is valid only within a variable argument method" msgstr "" -#: mcs/mcs/expression.cs:9197 +#: mcs/mcs/expression.cs:9231 msgid "An expression tree cannot contain a method with variable arguments" msgstr "" -#: mcs/mcs/expression.cs:9471 +#: mcs/mcs/expression.cs:9505 msgid "The typeof operator cannot be used on the dynamic type" msgstr "" -#: mcs/mcs/expression.cs:9512 +#: mcs/mcs/expression.cs:9546 #, csharp-format msgid "`{0}': an attribute argument cannot use type parameters" msgstr "" -#: mcs/mcs/expression.cs:9727 +#: mcs/mcs/expression.cs:9761 #, csharp-format msgid "" "`{0}' does not have a predefined size, therefore sizeof can only be used in " @@ -2273,208 +2282,208 @@ msgid "" "SizeOf)" msgstr "" -#: mcs/mcs/expression.cs:9792 +#: mcs/mcs/expression.cs:9826 #, csharp-format msgid "Alias `{0}' not found" msgstr "" -#: mcs/mcs/expression.cs:9833 +#: mcs/mcs/expression.cs:9867 msgid "" "The namespace alias qualifier `::' cannot be used to invoke a method. " "Consider using `.' instead" msgstr "" -#: mcs/mcs/expression.cs:9923 +#: mcs/mcs/expression.cs:9957 msgid "Cannot perform member binding on `null' value" msgstr "" -#: mcs/mcs/expression.cs:10090 +#: mcs/mcs/expression.cs:10124 #, csharp-format msgid "" "`{0}': cannot reference a type through an expression. Consider using `{1}' " "instead" msgstr "" -#: mcs/mcs/expression.cs:10169 +#: mcs/mcs/expression.cs:10203 #, csharp-format msgid "A nested type cannot be specified through a type parameter `{0}'" msgstr "" -#: mcs/mcs/expression.cs:10177 +#: mcs/mcs/expression.cs:10211 #, csharp-format msgid "" "Alias `{0}' cannot be used with `::' since it denotes a type. Consider " "replacing `::' with `.'" msgstr "" -#: mcs/mcs/expression.cs:10246 +#: mcs/mcs/expression.cs:10280 #, csharp-format msgid "The nested type `{0}' does not exist in the type `{1}'" msgstr "" -#: mcs/mcs/expression.cs:10270 +#: mcs/mcs/expression.cs:10304 #, 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:10562 +#: mcs/mcs/expression.cs:10596 #, csharp-format msgid "Cannot apply indexing with [] to an expression of type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:10699 +#: mcs/mcs/expression.cs:10733 #, csharp-format msgid "Wrong number of indexes `{0}' inside [], expected `{1}'" msgstr "" -#: mcs/mcs/expression.cs:11137 +#: mcs/mcs/expression.cs:11171 msgid "" "The indexer base access cannot be dynamically dispatched. Consider casting " "the dynamic arguments or eliminating the base access" msgstr "" -#: mcs/mcs/expression.cs:11236 +#: mcs/mcs/expression.cs:11270 msgid "An expression tree may not contain a base access" msgstr "" -#: mcs/mcs/expression.cs:11254 +#: mcs/mcs/expression.cs:11288 msgid "Keyword `base' is not available in a static method" msgstr "" -#: mcs/mcs/expression.cs:11256 +#: mcs/mcs/expression.cs:11290 msgid "Keyword `base' is not available in the current context" msgstr "" -#: mcs/mcs/expression.cs:11294 +#: mcs/mcs/expression.cs:11328 msgid "" "A property, indexer or dynamic member access may not be passed as `ref' or " "`out' parameter" msgstr "" -#: mcs/mcs/expression.cs:11643 +#: mcs/mcs/expression.cs:11677 #, csharp-format msgid "Array elements cannot be of type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:11646 +#: mcs/mcs/expression.cs:11680 #, csharp-format msgid "Array elements cannot be of static type `{0}'" msgstr "" -#: mcs/mcs/expression.cs:11866 +#: mcs/mcs/expression.cs:11900 msgid "Cannot use a negative size with stackalloc" msgstr "" -#: mcs/mcs/expression.cs:11870 +#: mcs/mcs/expression.cs:11904 msgid "Cannot use stackalloc in finally or catch" msgstr "" -#: mcs/mcs/expression.cs:11915 +#: mcs/mcs/expression.cs:11954 #, csharp-format msgid "Cannot convert a stackalloc expression of type `{0}' to type `{1}'" msgstr "" -#: mcs/mcs/expression.cs:12057 +#: mcs/mcs/expression.cs:12114 #, csharp-format msgid "" "Member `{0}' cannot be initialized. An object initializer may only be used " "for fields, or properties" msgstr "" -#: mcs/mcs/expression.cs:12065 +#: mcs/mcs/expression.cs:12122 #, csharp-format msgid "" "Static field or property `{0}' cannot be assigned in an object initializer" msgstr "" -#: mcs/mcs/expression.cs:12136 +#: mcs/mcs/expression.cs:12193 msgid "" "An expression tree cannot contain a collection initializer with extension " "method" msgstr "" -#: mcs/mcs/expression.cs:12174 +#: mcs/mcs/expression.cs:12231 msgid "Expression tree cannot contain a dictionary initializer" msgstr "" -#: mcs/mcs/expression.cs:12299 +#: mcs/mcs/expression.cs:12356 #, 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:12310 +#: mcs/mcs/expression.cs:12367 #, csharp-format msgid "Inconsistent `{0}' member declaration" msgstr "" -#: mcs/mcs/expression.cs:12318 +#: mcs/mcs/expression.cs:12375 #, csharp-format msgid "" "An object initializer includes more than one member `{0}' initialization" msgstr "" -#: mcs/mcs/expression.cs:12336 +#: mcs/mcs/expression.cs:12393 #, csharp-format msgid "Cannot initialize object of type `{0}' with a collection initializer" msgstr "" -#: mcs/mcs/expression.cs:12481 +#: mcs/mcs/expression.cs:12538 msgid "" "Object and collection initializers cannot be used to instantiate a delegate" msgstr "" -#: mcs/mcs/expression.cs:12700 +#: mcs/mcs/expression.cs:12757 msgid "Anonymous types cannot be used in this expression" msgstr "" -#: mcs/mcs/expression.cs:12794 +#: mcs/mcs/expression.cs:12851 #, csharp-format msgid "An anonymous type property `{0}' cannot be initialized with `{1}'" msgstr "" -#: mcs/mcs/expression.cs:13034 +#: mcs/mcs/expression.cs:13091 msgid "An expression tree cannot not contain a throw expression" msgstr "" -#: mcs/mcs/expression.cs:13105 +#: mcs/mcs/expression.cs:13165 msgid "" "An expression cannot be used in this context because it may not be returned " "by reference" msgstr "" -#: mcs/mcs/expression.cs:13130 +#: mcs/mcs/expression.cs:13190 #, csharp-format msgid "" "The expression must be of type `{0}' because it is being assigned by " "reference" msgstr "" -#: mcs/mcs/expression.cs:13162 +#: mcs/mcs/expression.cs:13222 msgid "" "An expression tree lambda cannot contain a call to a method, property, or " "indexer that returns by reference" msgstr "" -#: mcs/mcs/expression.cs:13207 +#: mcs/mcs/expression.cs:13267 #, 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:13262 +#: mcs/mcs/expression.cs:13322 msgid "An expression tree cannot contain a discard" msgstr "" -#: mcs/mcs/expression.cs:13276 +#: mcs/mcs/expression.cs:13336 msgid "Cannot infer the type of implicitly-typed discard" msgstr "" -#: mcs/mcs/expression.cs:13282 +#: mcs/mcs/expression.cs:13342 msgid "Cannot assign void to a discard" msgstr "" @@ -3245,7 +3254,7 @@ msgstr "" msgid "One of the parameters of a binary operator must be the containing type" msgstr "" -#: mcs/mcs/modifiers.cs:280 +#: mcs/mcs/modifiers.cs:300 #, csharp-format msgid "The modifier `{0}' is not valid for this item" msgstr "" @@ -3422,7 +3431,8 @@ msgstr "" #: mcs/mcs/parameter.cs:1479 #, csharp-format msgid "" -"Optional parameter `{0}' of type `{1}' can only be initialized with `null'" +"Optional parameter `{0}' of type `{1}' can only be initialized with default " +"value" msgstr "" #: mcs/mcs/parameter.cs:1490 diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo index c53e1988bc435cfdd0130fffb62909e3d290cda7..37b0975a2700c6bce86e45e4f86c01166d345840 100644 GIT binary patch delta 22 ecmaF1gXP%{mJM-J*-aD-EUZjSHm6QyYzF{t0tkWt delta 22 ecmaF1gXP%{mJM-J*$ov8EUb(SH>XZzYzF{sz6g2% diff --git a/po/mcs/pt_BR.po.REMOVED.git-id b/po/mcs/pt_BR.po.REMOVED.git-id index 333e3b9239..a078269bd5 100644 --- a/po/mcs/pt_BR.po.REMOVED.git-id +++ b/po/mcs/pt_BR.po.REMOVED.git-id @@ -1 +1 @@ -91f17a26d90cbcc2669b4e7cb7f28ac826a2255b \ No newline at end of file +599e7552198e62b9b7d0e88db61fcab8152b5493 \ No newline at end of file diff --git a/runtime/Makefile.in b/runtime/Makefile.in index fe3801b4ca..da376b97da 100644 --- a/runtime/Makefile.in +++ b/runtime/Makefile.in @@ -105,14 +105,14 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(srcdir)/mono-wrapper.in \ $(srcdir)/monodis-wrapper.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -225,6 +225,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -253,6 +257,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/samples/Makefile.in b/samples/Makefile.in index 5974a32e3e..2bd28b129e 100644 --- a/samples/Makefile.in +++ b/samples/Makefile.in @@ -82,14 +82,14 @@ subdir = samples DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/scripts/Makefile.am b/scripts/Makefile.am index c647615d9e..ea3a0ce5a8 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -37,6 +37,7 @@ bin_SCRIPTS = \ peverify \ mcs \ csc \ + csc-dim \ vbc \ csi \ mono-package-runtime \ @@ -82,6 +83,7 @@ scripts_4_0 = \ crlupdate$(SCRIPT_SUFFIX) \ csharp$(SCRIPT_SUFFIX) \ httpcfg$(SCRIPT_SUFFIX) \ + illinkanalyzer$(SCRIPT_SUFFIX) \ lc$(SCRIPT_SUFFIX) \ mconfig$(SCRIPT_SUFFIX) \ mod$(SCRIPT_SUFFIX) \ @@ -159,6 +161,7 @@ EXTRA_DIST = \ update_submodules.sh \ mcs.in \ csc.in \ + csc-dim.in \ vbc.in \ dmcs.in \ csi.in \ @@ -210,6 +213,10 @@ csc: csc.in Makefile $(REWRITE_COMMON) $(srcdir)/csc.in > $@.tmp mv -f $@.tmp $@ +csc-dim: csc-dim.in Makefile + $(REWRITE_COMMON) $(srcdir)/csc-dim.in > $@.tmp + mv -f $@.tmp $@ + vbc: vbc.in Makefile $(REWRITE_COMMON) $(srcdir)/vbc.in > $@.tmp mv -f $@.tmp $@ diff --git a/scripts/Makefile.in b/scripts/Makefile.in index ee8554071c..a790c78d7f 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -85,14 +85,14 @@ DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(srcdir)/mono-find-provides.in \ $(srcdir)/mono-find-requires.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -233,6 +233,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -261,6 +265,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -409,7 +416,7 @@ COMPAT_4_0_SUFFIX = 4$(SCRIPT_SUFFIX) bin_SCRIPTS = $(scripts_4_0_umask) $(scripts_defaults) $(scripts_2_0) \ $(scripts_service) $(scripts_nunit) $(scripts_rpmhelpers) \ $(MDOC_SUBCOMMANDS) $(MDOC_COMPAT) mono-test-install peverify \ - mcs csc vbc csi mono-package-runtime mono-heapviz \ + mcs csc csc-dim vbc csi mono-package-runtime mono-heapviz \ $(scripts_mono_configuration_crypto) $(am__append_1) scripts_4_0_umask = \ makecert$(SCRIPT_SUFFIX) \ @@ -444,6 +451,7 @@ scripts_4_0 = \ crlupdate$(SCRIPT_SUFFIX) \ csharp$(SCRIPT_SUFFIX) \ httpcfg$(SCRIPT_SUFFIX) \ + illinkanalyzer$(SCRIPT_SUFFIX) \ lc$(SCRIPT_SUFFIX) \ mconfig$(SCRIPT_SUFFIX) \ mod$(SCRIPT_SUFFIX) \ @@ -520,6 +528,7 @@ EXTRA_DIST = \ update_submodules.sh \ mcs.in \ csc.in \ + csc-dim.in \ vbc.in \ dmcs.in \ csi.in \ @@ -796,6 +805,10 @@ csc: csc.in Makefile $(REWRITE_COMMON) $(srcdir)/csc.in > $@.tmp mv -f $@.tmp $@ +csc-dim: csc-dim.in Makefile + $(REWRITE_COMMON) $(srcdir)/csc-dim.in > $@.tmp + mv -f $@.tmp $@ + vbc: vbc.in Makefile $(REWRITE_COMMON) $(srcdir)/vbc.in > $@.tmp mv -f $@.tmp $@ diff --git a/scripts/csc-dim.in b/scripts/csc-dim.in new file mode 100644 index 0000000000..28507c4346 --- /dev/null +++ b/scripts/csc-dim.in @@ -0,0 +1,2 @@ +#!/bin/sh +exec @bindir@/mono --gc-params=nursery-size=64m $MONO_OPTIONS @mono_instdir@/4.5/dim/csc.exe "$@" diff --git a/scripts/mono-package-runtime b/scripts/mono-package-runtime index d71942ba0c..10e26f2693 100755 --- a/scripts/mono-package-runtime +++ b/scripts/mono-package-runtime @@ -1,4 +1,8 @@ #!/bin/sh +extension=".dylib" +if test `uname -o` = GNU/Linux; then + extension=".so" +fi if test x$2 = x; then echo usage is: mono-package-runtime MONO_INSTALL_PREFIX LABEL @@ -31,6 +35,6 @@ fi o=`pwd`/$output cd $prefix -(zip -u $o.zip bin/mono lib/mono/4.5/mscorlib.dll lib/mono/4.5/System*dll lib/mono/4.5/Mono.CSharp.dll lib/mono/4.5/Microsoft*dll lib/mono/4.5/FSharp*.dll lib/mono/4.5/I18N*dll lib/mono/4.5/Accessibility.dll lib/mono/4.5/RabbitMQ.Client.dll lib/mono/4.5/ICSharpCode.SharpZipLib.dll lib/mono/4.5/CustomMarshalers.dll etc/mono/config etc/mono/4.5/machine.config etc/mono/4.5/web.config lib/mono/4.5/Mono.Cairo.dll lib/mono/4.5/Mono.Data.Sqlite.dll lib/mono/4.5/Mono.Posix.dll lib/mono/4.5/Mono.Security.*dll lib/mono/4.5/Mono.Simd.dll) +(zip -u $o.zip bin/mono lib/mono/4.5/mscorlib.dll lib/mono/4.5/System*dll lib/mono/4.5/Mono.CSharp.dll lib/mono/4.5/Microsoft*dll lib/mono/4.5/FSharp*.dll lib/mono/4.5/I18N*dll lib/mono/4.5/Accessibility.dll lib/mono/4.5/RabbitMQ.Client.dll lib/mono/4.5/ICSharpCode.SharpZipLib.dll lib/mono/4.5/CustomMarshalers.dll etc/mono/config etc/mono/4.5/machine.config etc/mono/4.5/web.config lib/mono/4.5/Mono.Cairo.dll lib/mono/4.5/Mono.Data.Sqlite.dll lib/mono/4.5/Mono.Posix.dll lib/mono/4.5/Mono.Security.*dll lib/mono/4.5/Mono.Simd.dll lib/libMonoSupportW$extension lib/libMonoPosixHelper$extension lib/libmono-btls-shared$extension) echo Created file $o.zip diff --git a/support/Makefile.in b/support/Makefile.in index b2943b5015..116ccc124a 100644 --- a/support/Makefile.in +++ b/support/Makefile.in @@ -83,14 +83,14 @@ subdir = support DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -324,6 +324,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -352,6 +356,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/support/fstab.c b/support/fstab.c index 010342704a..d662ad97d9 100644 --- a/support/fstab.c +++ b/support/fstab.c @@ -46,6 +46,26 @@ mph_fstab_offsets[] = { MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Fstab, fs_type, MPH_STRING_OFFSET_PTR) }; +#elif defined (HAVE_FSTAB_H) && defined(_AIX) + +/* AIX defines fstab, but it has contents like checklist */ + +typedef struct fstab mph_fstab; + +static const mph_string_offset_t +fstab_offsets[] = { + MPH_STRING_OFFSET (struct fstab, fs_spec, MPH_STRING_OFFSET_PTR), + MPH_STRING_OFFSET (struct fstab, fs_file, MPH_STRING_OFFSET_PTR), + MPH_STRING_OFFSET (struct fstab, fs_type, MPH_STRING_OFFSET_PTR) +}; + +static const mph_string_offset_t +mph_fstab_offsets[] = { + MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Fstab, fs_spec, MPH_STRING_OFFSET_PTR), + MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Fstab, fs_file, MPH_STRING_OFFSET_PTR), + MPH_STRING_OFFSET (struct Mono_Posix_Syscall__Fstab, fs_type, MPH_STRING_OFFSET_PTR) +}; + #elif defined (HAVE_FSTAB_H) typedef struct fstab mph_fstab; diff --git a/support/serial.c b/support/serial.c index bbe7163553..2dba911a79 100644 --- a/support/serial.c +++ b/support/serial.c @@ -201,7 +201,7 @@ setup_baud_rate (int baud_rate, gboolean *custom_baud_rate) { switch (baud_rate) { -/*Some values are not defined on OSX and *BSD */ +/*Some values are not defined on OSX, *BSD, or AIX */ #if defined(B921600) case 921600: baud_rate = B921600; @@ -212,15 +212,21 @@ setup_baud_rate (int baud_rate, gboolean *custom_baud_rate) baud_rate = B460800; break; #endif +#if defined(B230400) case 230400: baud_rate = B230400; break; +#endif +#if defined(B115200) case 115200: baud_rate = B115200; break; +#endif +#if defined(B57600) case 57600: baud_rate = B57600; break; +#endif case 38400: baud_rate = B38400; break; diff --git a/support/signal.c b/support/signal.c index 426e268f43..503c9c270a 100644 --- a/support/signal.c +++ b/support/signal.c @@ -132,6 +132,18 @@ int Mono_Posix_FromRealTimeSignum (int offset, int *r) #endif #if HAVE_PSIGNAL + +/* + * HACK: similar to the mkdtemp one in glib; turns out gcc "helpfully" + * shadows system headers with "fixed" versions that omit functions... + * in any case, psignal is another victim of poor GNU decisions. Even + * then, we may have to do this anyways, as psignal, while present in + * libc, isn't in PASE headers - so do it anyways + */ +#if defined(_AIX) +extern void psignal(int, const char *); +#endif + int Mono_Posix_Syscall_psignal (int sig, const char* s) { diff --git a/support/sys-stat.c b/support/sys-stat.c index d6abce4a1f..af2731cccb 100644 --- a/support/sys-stat.c +++ b/support/sys-stat.c @@ -51,16 +51,24 @@ Mono_Posix_FromStat (struct Mono_Posix_Stat *from, void *_to) to->st_atime = from->st_atime_; to->st_mtime = from->st_mtime_; to->st_ctime = from->st_ctime_; -#ifdef HAVE_STRUCT_STAT_ST_ATIM +#if HAVE_STRUCT_STAT_ST_ATIMESPEC + to->st_atimespec.tv_sec = from->st_atime_; + to->st_atimespec.tv_nsec = from->st_atime_nsec; + to->st_mtimespec.tv_sec = from->st_mtime_; + to->st_mtimespec.tv_nsec = from->st_mtime_nsec; + to->st_ctimespec.tv_sec = from->st_ctime_; + to->st_ctimespec.tv_nsec = from->st_ctime_nsec; +#else +# ifdef HAVE_STRUCT_STAT_ST_ATIM to->st_atim.tv_nsec = from->st_atime_nsec; -#endif -#ifdef HAVE_STRUCT_STAT_ST_MTIM +# endif +# ifdef HAVE_STRUCT_STAT_ST_MTIM to->st_mtim.tv_nsec = from->st_mtime_nsec; -#endif -#ifdef HAVE_STRUCT_STAT_ST_CTIM +# endif +# ifdef HAVE_STRUCT_STAT_ST_CTIM to->st_ctim.tv_nsec = from->st_ctime_nsec; +# endif #endif - return 0; } @@ -87,16 +95,21 @@ Mono_Posix_ToStat (void *_from, struct Mono_Posix_Stat *to) to->st_atime_ = from->st_atime; to->st_mtime_ = from->st_mtime; to->st_ctime_ = from->st_ctime; -#ifdef HAVE_STRUCT_STAT_ST_ATIM +#if HAVE_STRUCT_STAT_ST_ATIMESPEC + to->st_atime_nsec = from->st_atimespec.tv_nsec; + to->st_mtime_nsec = from->st_mtimespec.tv_nsec; + to->st_ctime_nsec = from->st_ctimespec.tv_nsec; +#else +# ifdef HAVE_STRUCT_STAT_ST_ATIM to->st_atime_nsec = from->st_atim.tv_nsec; -#endif -#ifdef HAVE_STRUCT_STAT_ST_MTIM +# endif +# ifdef HAVE_STRUCT_STAT_ST_MTIM to->st_mtime_nsec = from->st_mtim.tv_nsec; -#endif -#ifdef HAVE_STRUCT_STAT_ST_CTIM +# endif +# ifdef HAVE_STRUCT_STAT_ST_CTIM to->st_ctime_nsec = from->st_ctim.tv_nsec; +# endif #endif - return 0; } diff --git a/support/sys-statvfs.c b/support/sys-statvfs.c index 128baaa03b..d75a658f92 100644 --- a/support/sys-statvfs.c +++ b/support/sys-statvfs.c @@ -51,7 +51,15 @@ Mono_Posix_ToStatvfs (void *_from, struct Mono_Posix_Statvfs *to) to->f_files = from->f_files; to->f_ffree = from->f_ffree; to->f_favail = from->f_favail; + /* + * On AIX with -D_ALL_SOURCE, fsid_t is a struct + * See: github.com/python/cpython/pull/4972 + */ +#if defined(_AIX) && defined(_ALL_SOURCE) + to->f_fsid = from->f_fsid.val[0]; +#else to->f_fsid = from->f_fsid; +#endif to->f_namemax = from->f_namemax; if (Mono_Posix_ToMountFlags (from->f_flag, &to->f_flag) != 0) @@ -74,7 +82,11 @@ Mono_Posix_FromStatvfs (struct Mono_Posix_Statvfs *from, void *_to) to->f_files = from->f_files; to->f_ffree = from->f_ffree; to->f_favail = from->f_favail; +#if defined(_AIX) && defined(_ALL_SOURCE) + to->f_fsid.val[0] = from->f_fsid; +#else to->f_fsid = from->f_fsid; +#endif to->f_namemax = from->f_namemax; if (Mono_Posix_FromMountFlags (from->f_flag, &flag) != 0) diff --git a/support/sys-time.c b/support/sys-time.c index 83afa0c846..4f5db9c8b2 100644 --- a/support/sys-time.c +++ b/support/sys-time.c @@ -10,6 +10,9 @@ #include #include #include +#ifdef __HAIKU__ +#include +#endif #include "map.h" #include "mph.h" @@ -47,11 +50,6 @@ Mono_Posix_Syscall_settimeofday ( struct Mono_Posix_Timeval *tv, struct Mono_Posix_Timezone *tz) { -#if defined(__HAIKU__) - /* FIXME: Haiku doesn't support this either, consider - using set_real_time_clock instead? */ - return -1; -#else struct timeval _tv = {0}; struct timeval *ptv = NULL; struct timezone _tz = {0}; @@ -69,10 +67,14 @@ Mono_Posix_Syscall_settimeofday ( ptz = &_tz; } +#ifdef __HAIKU__ + set_real_time_clock(ptv->tv_sec); + r = 0; +#else r = settimeofday (ptv, ptz); +#endif return r; -#endif } static inline struct timeval* diff --git a/support/syslog.c b/support/syslog.c index 2d8d7cbe80..44c1198348 100644 --- a/support/syslog.c +++ b/support/syslog.c @@ -55,10 +55,20 @@ Mono_Posix_Syscall_syslog2 (int priority, const char *format, ...) { va_list ap; +#if HAVE_VSYSLOG va_start (ap, format); vsyslog (priority, format, ap); va_end (ap); +#else + /* some OSes like AIX lack vsyslog; simulate with vsprintf */ + char message[256]; + va_start (ap, format); + vsnprintf(message, 256, format, ap); + va_end(ap); + + syslog(priority, message); +#endif return 0; } diff --git a/support/time.c b/support/time.c index 05ceb4ccca..9c67d8a5bd 100644 --- a/support/time.c +++ b/support/time.c @@ -49,6 +49,11 @@ Mono_Posix_Syscall_nanosleep (struct Mono_Posix_Timespec *req, #endif #ifdef HAVE_STIME +/* AIX has stime in libc, but not at all in headers, so declare here */ +#if defined(_AIX) +extern int stime(time_t); +#endif + gint32 Mono_Posix_Syscall_stime (mph_time_t *t) { diff --git a/support/unistd.c b/support/unistd.c index 145de5192e..0972f3b97e 100644 --- a/support/unistd.c +++ b/support/unistd.c @@ -20,6 +20,16 @@ #include #include #include /* for swab(3) on Mac OS X */ +#if defined(_AIX) +#include /* for get/setdomainname */ +/* + * Yet more stuff in libc that isn't in headers. + * Python does the same thing we do here. + * see: bugs.python.org/issue18259 + */ +extern int sethostname(const char *, size_t); +extern int sethostid(long); +#endif #include "mph.h" /* Don't remove or move after map.h! Works around issues with Android SDK unified headers */ #include "map.h" diff --git a/tools/Makefile.in b/tools/Makefile.in index 8e0646ab48..b694c9579d 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -82,14 +82,14 @@ subdir = tools DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -261,6 +261,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -289,6 +293,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/tools/locale-builder/Makefile.in b/tools/locale-builder/Makefile.in index 3348a07a34..89de6e59a1 100644 --- a/tools/locale-builder/Makefile.in +++ b/tools/locale-builder/Makefile.in @@ -82,14 +82,14 @@ subdir = tools/locale-builder DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -201,6 +201,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -229,6 +233,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/tools/monograph/Makefile.am b/tools/monograph/Makefile.am index b64d44c231..9e92e76342 100644 --- a/tools/monograph/Makefile.am +++ b/tools/monograph/Makefile.am @@ -7,7 +7,7 @@ if DISABLE_EXECUTABLES runtime_lib=$(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs) else static_libs= \ - $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \ + $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ $(top_builddir)/mono/utils/libmonoutils.la \ $(GLIB_LIBS) $(LIBICONV) \ $(LIBGC_STATIC_LIBS) diff --git a/tools/monograph/Makefile.in b/tools/monograph/Makefile.in index 0468513feb..0dbdbb8db2 100644 --- a/tools/monograph/Makefile.in +++ b/tools/monograph/Makefile.in @@ -84,14 +84,14 @@ subdir = tools/monograph DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -103,7 +103,7 @@ PROGRAMS = $(bin_PROGRAMS) monograph_SOURCES = monograph.c monograph_OBJECTS = monograph.$(OBJEXT) am__DEPENDENCIES_1 = -@DISABLE_EXECUTABLES_FALSE@am__DEPENDENCIES_2 = $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \ +@DISABLE_EXECUTABLES_FALSE@am__DEPENDENCIES_2 = $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ @DISABLE_EXECUTABLES_FALSE@ $(top_builddir)/mono/utils/libmonoutils.la \ @DISABLE_EXECUTABLES_FALSE@ $(am__DEPENDENCIES_1) \ @DISABLE_EXECUTABLES_FALSE@ $(am__DEPENDENCIES_1) \ @@ -262,6 +262,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -290,6 +294,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -416,7 +423,7 @@ top_srcdir = @top_srcdir@ @DISABLE_EXECUTABLES_FALSE@runtime_lib = $(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs) @DISABLE_EXECUTABLES_TRUE@runtime_lib = $(top_builddir)/mono/mini/$(LIBMONO_LA) $(static_libs) @DISABLE_EXECUTABLES_FALSE@static_libs = \ -@DISABLE_EXECUTABLES_FALSE@ $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \ +@DISABLE_EXECUTABLES_FALSE@ $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ @DISABLE_EXECUTABLES_FALSE@ $(top_builddir)/mono/utils/libmonoutils.la \ @DISABLE_EXECUTABLES_FALSE@ $(GLIB_LIBS) $(LIBICONV) \ @DISABLE_EXECUTABLES_FALSE@ $(LIBGC_STATIC_LIBS) diff --git a/tools/pedump/Makefile.am b/tools/pedump/Makefile.am index 788704a9cb..fab3205791 100644 --- a/tools/pedump/Makefile.am +++ b/tools/pedump/Makefile.am @@ -17,8 +17,8 @@ pedump_SOURCES = \ pedump.c pedump_LDADD = \ - $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \ - $(top_builddir)/mono/sgen/libmonosgen-static.la \ + $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ + $(top_builddir)/mono/sgen/libmonosgen.la \ $(top_builddir)/mono/utils/libmonoutils.la \ $(LLVM_LIBS) \ $(LLVM_LDFLAGS) \ diff --git a/tools/pedump/Makefile.in b/tools/pedump/Makefile.in index 42b9adacbb..b516ac2ae2 100644 --- a/tools/pedump/Makefile.in +++ b/tools/pedump/Makefile.in @@ -84,14 +84,14 @@ subdir = tools/pedump DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -104,8 +104,8 @@ am_pedump_OBJECTS = pedump.$(OBJEXT) pedump_OBJECTS = $(am_pedump_OBJECTS) am__DEPENDENCIES_1 = pedump_DEPENDENCIES = \ - $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \ - $(top_builddir)/mono/sgen/libmonosgen-static.la \ + $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ + $(top_builddir)/mono/sgen/libmonosgen.la \ $(top_builddir)/mono/utils/libmonoutils.la \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) @@ -257,6 +257,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -285,6 +289,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ @@ -413,8 +420,8 @@ pedump_SOURCES = \ pedump.c pedump_LDADD = \ - $(top_builddir)/mono/metadata/libmonoruntimesgen-static.la \ - $(top_builddir)/mono/sgen/libmonosgen-static.la \ + $(top_builddir)/mono/metadata/libmonoruntimesgen.la \ + $(top_builddir)/mono/sgen/libmonosgen.la \ $(top_builddir)/mono/utils/libmonoutils.la \ $(LLVM_LIBS) \ $(LLVM_LDFLAGS) \ diff --git a/tools/pedump/pedump.c b/tools/pedump/pedump.c index b75a8fed5b..5769142553 100644 --- a/tools/pedump/pedump.c +++ b/tools/pedump/pedump.c @@ -364,12 +364,12 @@ dump_verify_info (MonoImage *image, int flags, gboolean valid_only) for (i = 0; i < m->rows; ++i) { MonoMethod *method; - MonoError error; + ERROR_DECL (error); - method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL, NULL, &error); + method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i+1), NULL, NULL, error); if (!method) { - g_print ("Warning: Cannot lookup method with token 0x%08x due to %s\n", i + 1, mono_error_get_message (&error)); - mono_error_cleanup (&error); + g_print ("Warning: Cannot lookup method with token 0x%08x due to %s\n", i + 1, mono_error_get_message (error)); + mono_error_cleanup (error); continue; } errors = mono_method_verify (method, flags); @@ -515,31 +515,29 @@ verify_image_file (const char *fname) table = &image->tables [MONO_TABLE_TYPEDEF]; for (i = 1; i <= table->rows; ++i) { - MonoError error; + ERROR_DECL (error); guint32 token = i | MONO_TOKEN_TYPE_DEF; - MonoClass *klass = mono_class_get_checked (image, token, &error); + MonoClass *klass = mono_class_get_checked (image, token, error); if (!klass) { - printf ("Could not load class with token %x due to %s\n", token, mono_error_get_message (&error)); - mono_error_cleanup (&error); + printf ("Could not load class with token %x due to %s\n", token, mono_error_get_message (error)); + mono_error_cleanup (error); continue; } mono_class_init (klass); if (mono_class_has_failure (klass)) { - MonoError type_load_error; - error_init (&type_load_error); - mono_error_set_for_class_failure (&type_load_error, klass); - printf ("Could not initialize class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (&type_load_error)); - mono_error_cleanup (&type_load_error); + ERROR_DECL (type_load_error); + mono_error_set_for_class_failure (type_load_error, klass); + printf ("Could not initialize class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (type_load_error)); + mono_error_cleanup (type_load_error); ++count; } mono_class_setup_vtable (klass); if (mono_class_has_failure (klass)) { - MonoError type_load_error; - error_init (&type_load_error); - mono_error_set_for_class_failure (&type_load_error, klass); - printf ("Could not initialize vtable of class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (&type_load_error)); - mono_error_cleanup (&type_load_error); + ERROR_DECL (type_load_error); + mono_error_set_for_class_failure (type_load_error, klass); + printf ("Could not initialize vtable of class(0x%08x) %s.%s due to %s\n", token, klass->name_space, klass->name, mono_error_get_message (type_load_error)); + mono_error_cleanup (type_load_error); ++count; } } diff --git a/tools/sgen/Makefile.in b/tools/sgen/Makefile.in index 4f4f2e09dd..2bde5c536c 100644 --- a/tools/sgen/Makefile.in +++ b/tools/sgen/Makefile.in @@ -85,14 +85,14 @@ subdir = tools/sgen DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ - $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_check_compile_flag.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs @@ -282,6 +282,10 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTL = @INTL@ INVARIANT_AOT_OPTIONS = @INVARIANT_AOT_OPTIONS@ +JEMALLOC_AUTOCONF_FLAGS = @JEMALLOC_AUTOCONF_FLAGS@ +JEMALLOC_CFLAGS = @JEMALLOC_CFLAGS@ +JEMALLOC_CPPFLAGS = @JEMALLOC_CPPFLAGS@ +JEMALLOC_LDFLAGS = @JEMALLOC_LDFLAGS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBC = @LIBC@ @@ -310,6 +314,9 @@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONO_CORLIB_VERSION = @MONO_CORLIB_VERSION@ MONO_DL_NEED_USCORE = @MONO_DL_NEED_USCORE@ +MONO_JEMALLOC_ASSERT = @MONO_JEMALLOC_ASSERT@ +MONO_JEMALLOC_DEFAULT = @MONO_JEMALLOC_DEFAULT@ +MONO_JEMALLOC_ENABLED = @MONO_JEMALLOC_ENABLED@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ diff --git a/winconfig.h b/winconfig.h index d2a318fd6e..3d9313f5be 100644 --- a/winconfig.h +++ b/winconfig.h @@ -96,6 +96,9 @@ /* Disable interpreter */ /* #undef DISABLE_INTERPRETER */ +/* Some VES is available at runtime */ +#define ENABLE_ILGEN 1 + /* Enable DTrace probes */ /* #undef ENABLE_DTRACE */