Merge pull request #3349 from lambdageek/handle-icalls-in-jit
authorAleksey Kliger (λgeek) <akliger@gmail.com>
Mon, 8 Aug 2016 20:39:13 +0000 (16:39 -0400)
committerGitHub <noreply@github.com>
Mon, 8 Aug 2016 20:39:13 +0000 (16:39 -0400)
[handles] Add coop handles in wrapper to icalls with HANDLES() declaration

52 files changed:
.gitmodules
eglib/src/gmisc-win32.c
external/cecil
external/cecil-legacy [new submodule]
libgc/os_dep.c
mcs/class/Makefile
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
mcs/class/Mono.Cecil.Mdb/Mono.Cecil.Mdb.dll.sources
mcs/class/Mono.Cecil/Makefile
mcs/class/Mono.Cecil/Mono.Cecil-SL.csproj [deleted file]
mcs/class/Mono.Cecil/Mono.Cecil.dll.sources
mcs/class/Mono.CodeContracts/Makefile
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/CompileVisitor.cs
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite.AstVisitors/SourcePositionVisitor.cs
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Rewrite/ContractsRuntime.cs
mcs/class/Mono.CodeContracts/Mono.CodeContracts.Static.AST/TypeNode.cs
mcs/class/Mono.CodeContracts/Test/TestCCRewrite.cs
mcs/class/legacy/Mono.Cecil/Makefile [new file with mode: 0644]
mcs/class/legacy/Mono.Cecil/Mono.Cecil.dll.sources [new file with mode: 0644]
mcs/tools/cil-stringreplacer/cil-stringreplacer.cs
mcs/tools/corcompare/Util.cs
mcs/tools/linker/Mono.Linker.Steps/MarkStep.cs
mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs
mcs/tools/mdoc/Makefile
mcs/tools/mdoc/Mono.Documentation/exceptions.cs
mcs/tools/mdoc/Mono.Documentation/monodocer.cs
mcs/tools/mdoc/mdoc.csproj
mcs/tools/mono-symbolicate/LocationProvider.cs
mcs/tools/mono-symbolicate/Makefile
mcs/tools/mono-symbolicate/monosymbolicate.csproj
mcs/tools/tuner/Mono.Tuner/CheckVisibility.cs
mcs/tools/tuner/Mono.Tuner/MoonlightA11yProcessor.cs
mcs/tools/tuner/Mono.Tuner/RemoveSerialization.cs
mono/io-layer/processes.h
mono/metadata/domain-internals.h
mono/metadata/gc.c
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/sgen-mono.c
mono/mini/aot-runtime.c
mono/mini/exceptions-arm.c
mono/mini/mini-unwind.h
mono/mini/mini-x86.c
mono/mini/tramp-arm.c
mono/tests/gc-graystack-stress.cs
mono/tests/pinvoke2.cs
mono/tests/test-runner.cs
mono/utils/dlmalloc.c
scripts/ci/babysitter
scripts/ci/run-jenkins.sh
support/map.c
support/sys-mman.c

index 7c8d2d14e8b109d99672c2673da1cc4e9359c48d..d084d3948e49230f088e7e875dd49c409901a7b9 100644 (file)
@@ -35,3 +35,7 @@
 [submodule "external/buildtools"]
        path = external/buildtools
        url = git://github.com/mono/buildtools.git
+[submodule "external/cecil-legacy"]
+       path = external/cecil-legacy
+       url = git://github.com/mono/cecil.git
+       branch = mono-legacy-0.9.5
index 625fd15a84fa1b81026b732836f9610d10c588ad..9486aff07e3e7fbb7c26cadf328bff24b7bd3b2a 100644 (file)
@@ -89,9 +89,9 @@ g_win32_getlocale(void)
 {
        LCID lcid = GetThreadLocale();
        gchar buf[19];
-       gint ccBuf = GetLocaleInfo(lcid, LOCALE_SISO639LANGNAME, buf, 9);
+       gint ccBuf = GetLocaleInfoA(lcid, LOCALE_SISO639LANGNAME, buf, 9);
        buf[ccBuf - 1] = '-';
-       ccBuf += GetLocaleInfo(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
+       ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
        return g_strdup (buf);
 }
 
index 33d50b874fd527118bc361d83de3d494e8bb55e1..ea18396c86ab3f8ba5d0fcd9ada9e066bd4f9f92 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 33d50b874fd527118bc361d83de3d494e8bb55e1
+Subproject commit ea18396c86ab3f8ba5d0fcd9ada9e066bd4f9f92
diff --git a/external/cecil-legacy b/external/cecil-legacy
new file mode 160000 (submodule)
index 0000000..33d50b8
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 33d50b874fd527118bc361d83de3d494e8bb55e1
index 8c8e0981dd6e236f531abd538290c5cd11865bed..191e4b4ed7d06a8ea02f73a38ea84b941fc758c5 100644 (file)
@@ -26,7 +26,7 @@
 #     define __KERNEL__
 #     include <asm/signal.h>
 #     undef __KERNEL__
-#   else
+#   elif defined(__GLIBC__)
       /* Kernels prior to 2.1.1 defined struct sigcontext_struct instead of */
       /* struct sigcontext.  libc6 (glibc2) uses "struct sigcontext" in     */
       /* prototypes, so we have to include the top-level sigcontext.h to    */
index 17b98d15d68fdef66e12fdb8ee37a826b94db4cd..8e746d7f6e7e1db4a2a763cfb34ffb4603e1c1b0 100644 (file)
@@ -289,6 +289,7 @@ net_4_x_parallel_dirs := \
        System.Workflow.ComponentModel \
        System.Workflow.Runtime \
        System.Reflection.Context \
+       legacy/Mono.Cecil \
        $(pcl_facade_dirs)
 
 xbuild_2_0_dirs := \
index fb545562ffa288a2925e7e71c876bcf5d72d8a32..33aad3dea63adebda939e6604a84411ba36560dc 100644 (file)
@@ -1077,6 +1077,11 @@ namespace Microsoft.Build.BuildEngine {
                        if (!String.IsNullOrEmpty (ToolsVersion))
                                return ToolsVersion;
 
+#if XBUILD_14
+                       return "14.0";
+#elif XBUILD_12
+                       return "12.0";
+#else
                        if (!HasToolsVersionAttribute)
                                return parentEngine.DefaultToolsVersion;
 
@@ -1088,6 +1093,7 @@ namespace Microsoft.Build.BuildEngine {
                        }
 
                        return DefaultToolsVersion;
+#endif
                }
                
                void AddProjectExtensions (XmlElement xmlElement)
index eedadff94e7ef99003dc1ed7553ae1b75a0fd1aa..a8f6b27448ae2d1ac496191e7373fdcd610a64f1 100644 (file)
@@ -1,7 +1,3 @@
-../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/AssemblyInfo.cs
-../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbReader.cs
-../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/MdbWriter.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/MonoSymbolWriter.cs
-../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/SymbolWriterImpl.cs
+../../../external/cecil/ProjectInfo.cs
+../../../external/cecil/symbols/mdb/Mono.Cecil.Mdb/*.cs
+../../../external/cecil/symbols/mdb/Mono.CompilerServices.SymbolWriter/*.cs
index 53aee64f34a11535ec3a8a6bcd875bbba40e0cbf..d8807afa49ea9fbcbc3756b665ee3ac847deefa1 100644 (file)
@@ -6,7 +6,7 @@ LIBRARY_SNK = ../mono.snk
 LIBRARY_PACKAGE = none
 
 LIB_REFS = System.Core
-LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_3_5 /publicsign
+LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_4_0 /publicsign
 
 NO_TEST = yes
 
diff --git a/mcs/class/Mono.Cecil/Mono.Cecil-SL.csproj b/mcs/class/Mono.Cecil/Mono.Cecil-SL.csproj
deleted file mode 100644 (file)
index 272a8b6..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup Condition="'$(MSBuildToolsVersion)' == '3.5'">
-    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
-  </PropertyGroup>
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>9.0.30729</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{59019979-D337-441B-851F-2133452191A8}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>Mono.Cecil</RootNamespace>
-    <AssemblyName>Mono.Cecil</AssemblyName>
-    <TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <ProjectTypeGuids>{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
-    <SilverlightApplication>false</SilverlightApplication>
-    <DefineConstants>TRACE;DEBUG;SILVERLIGHT</DefineConstants>
-    <NoStdLib>true</NoStdLib>
-    <NoConfig>true</NoConfig>
-    <SignAssembly>true</SignAssembly>
-    <AssemblyOriginatorKeyFile>mono.snk</AssemblyOriginatorKeyFile>
-    <TargetFrameworkIdentifier>Silverlight</TargetFrameworkIdentifier>
-    <SilverlightVersion>$(TargetFrameworkVersion)</SilverlightVersion>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\DebugSL\</OutputPath>
-    <DefineConstants>DEBUG;TRACE;SILVERLIGHT</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\ReleaseSL\</OutputPath>
-    <DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="mscorlib" />
-    <Reference Include="system" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Mono.Cecil.Cil\Code.cs" />
-    <Compile Include="Mono.Cecil.Cil\CodeWriter.cs" />
-    <Compile Include="Mono.Cecil.Cil\CodeReader.cs" />
-    <Compile Include="Mono.Cecil.Cil\Document.cs" />
-    <Compile Include="Mono.Cecil.Cil\ExceptionHandler.cs" />
-    <Compile Include="Mono.Cecil.Cil\ILProcessor.cs" />
-    <Compile Include="Mono.Cecil.Cil\Instruction.cs" />
-    <Compile Include="Mono.Cecil.Cil\MethodBody.cs" />
-    <Compile Include="Mono.Cecil.Cil\OpCode.cs" />
-    <Compile Include="Mono.Cecil.Cil\OpCodes.cs" />
-    <Compile Include="Mono.Cecil.Cil\SequencePoint.cs" />
-    <Compile Include="Mono.Cecil.Cil\Symbols.cs" />
-    <Compile Include="Mono.Cecil.Cil\VariableDefinition.cs" />
-    <Compile Include="Mono.Cecil.Cil\VariableReference.cs" />
-    <Compile Include="Mono.Cecil.Metadata\BlobHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Buffers.cs" />
-    <Compile Include="Mono.Cecil.Metadata\CodedIndex.cs" />
-    <Compile Include="Mono.Cecil.Metadata\ElementType.cs" />
-    <Compile Include="Mono.Cecil.Metadata\GuidHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Heap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\MetadataToken.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Row.cs" />
-    <Compile Include="Mono.Cecil.Metadata\StringHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\TableHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\TokenType.cs" />
-    <Compile Include="Mono.Cecil.Metadata\UserStringHeap.cs" />
-    <Compile Include="Mono.Cecil.Metadata\Utilities.cs" />
-    <Compile Include="Mono.Cecil.PE\BinaryStreamReader.cs" />
-    <Compile Include="Mono.Cecil.PE\BinaryStreamWriter.cs" />
-    <Compile Include="Mono.Cecil.PE\ByteBuffer.cs" />
-    <Compile Include="Mono.Cecil.PE\ByteBufferEqualityComparer.cs" />
-    <Compile Include="Mono.Cecil.PE\DataDirectory.cs" />
-    <Compile Include="Mono.Cecil.PE\Image.cs" />
-    <Compile Include="Mono.Cecil.PE\ImageReader.cs" />
-    <Compile Include="Mono.Cecil.PE\ImageWriter.cs" />
-    <Compile Include="Mono.Cecil.PE\Section.cs" />
-    <Compile Include="Mono.Cecil.PE\TextMap.cs" />
-    <Compile Include="Mono.Cecil\ArrayType.cs" />
-    <Compile Include="Mono.Cecil\AssemblyDefinition.cs" />
-    <Compile Include="Mono.Cecil\AssemblyFlags.cs" />
-    <Compile Include="Mono.Cecil\AssemblyHashAlgorithm.cs" />
-    <Compile Include="Mono.Cecil\AssemblyInfo.cs" />
-    <Compile Include="Mono.Cecil\AssemblyLinkedResource.cs" />
-    <Compile Include="Mono.Cecil\AssemblyNameDefinition.cs" />
-    <Compile Include="Mono.Cecil\AssemblyNameReference.cs" />
-    <Compile Include="Mono.Cecil\AssemblyReader.cs" />
-    <Compile Include="Mono.Cecil\AssemblyWriter.cs" />
-    <Compile Include="Mono.Cecil\BaseAssemblyResolver.cs" />
-    <Compile Include="Mono.Cecil\CallSite.cs" />
-    <Compile Include="Mono.Cecil\CustomAttribute.cs" />
-    <Compile Include="Mono.Cecil\DefaultAssemblyResolver.cs" />
-    <Compile Include="Mono.Cecil\ExportedType.cs" />
-    <Compile Include="Mono.Cecil\FileAttributes.cs" />
-    <Compile Include="Mono.Cecil\FunctionPointerType.cs" />
-    <Compile Include="Mono.Cecil\GenericInstanceMethod.cs" />
-    <Compile Include="Mono.Cecil\GenericInstanceType.cs" />
-    <Compile Include="Mono.Cecil\GenericParameter.cs" />
-    <Compile Include="Mono.Cecil\GenericParameterAttributes.cs" />
-    <Compile Include="Mono.Cecil\IConstantProvider.cs" />
-    <Compile Include="Mono.Cecil\ICustomAttributeProvider.cs" />
-    <Compile Include="Mono.Cecil\IGenericInstance.cs" />
-    <Compile Include="Mono.Cecil\IGenericParameterProvider.cs" />
-    <Compile Include="Mono.Cecil\IMarshalInfoProvider.cs" />
-    <Compile Include="Mono.Cecil\MarshalInfo.cs" />
-    <Compile Include="Mono.Cecil\MetadataResolver.cs" />
-    <Compile Include="Mono.Cecil\Modifiers.cs" />
-    <Compile Include="Mono.Cecil\NativeType.cs" />
-    <Compile Include="Mono.Cecil\PinnedType.cs" />
-    <Compile Include="Mono.Cecil\MetadataSystem.cs" />
-    <Compile Include="Mono.Cecil\IMethodSignature.cs" />
-    <Compile Include="Mono.Cecil\ParameterDefinitionCollection.cs" />
-    <Compile Include="Mono.Cecil\EmbeddedResource.cs" />
-    <Compile Include="Mono.Cecil\EventAttributes.cs" />
-    <Compile Include="Mono.Cecil\EventDefinition.cs" />
-    <Compile Include="Mono.Cecil\EventReference.cs" />
-    <Compile Include="Mono.Cecil\FieldAttributes.cs" />
-    <Compile Include="Mono.Cecil\FieldDefinition.cs" />
-    <Compile Include="Mono.Cecil\FieldReference.cs" />
-    <Compile Include="Mono.Cecil\IMemberDefinition.cs" />
-    <Compile Include="Mono.Cecil\Import.cs" />
-    <Compile Include="Mono.Cecil\LinkedResource.cs" />
-    <Compile Include="Mono.Cecil\MemberReference.cs" />
-    <Compile Include="Mono.Cecil\MethodAttributes.cs" />
-    <Compile Include="Mono.Cecil\MethodCallingConvention.cs" />
-    <Compile Include="Mono.Cecil\MethodDefinition.cs" />
-    <Compile Include="Mono.Cecil\MethodImplAttributes.cs" />
-    <Compile Include="Mono.Cecil\MethodReference.cs" />
-    <Compile Include="Mono.Cecil\MethodReturnType.cs" />
-    <Compile Include="Mono.Cecil\MethodSemanticsAttributes.cs" />
-    <Compile Include="Mono.Cecil\MethodSpecification.cs" />
-    <Compile Include="Mono.Cecil\ParameterAttributes.cs" />
-    <Compile Include="Mono.Cecil\ParameterDefinition.cs" />
-    <Compile Include="Mono.Cecil\ParameterReference.cs" />
-    <Compile Include="Mono.Cecil\PInvokeAttributes.cs" />
-    <Compile Include="Mono.Cecil\PInvokeInfo.cs" />
-    <Compile Include="Mono.Cecil\PointerType.cs" />
-    <Compile Include="Mono.Cecil\PropertyAttributes.cs" />
-    <Compile Include="Mono.Cecil\PropertyDefinition.cs" />
-    <Compile Include="Mono.Cecil\PropertyReference.cs" />
-    <Compile Include="Mono.Cecil\ReferenceType.cs" />
-    <Compile Include="Mono.Cecil\IMetadataScope.cs" />
-    <Compile Include="Mono.Cecil\IMetadataTokenProvider.cs" />
-    <Compile Include="Mono.Cecil\ManifestResourceAttributes.cs" />
-    <Compile Include="Mono.Cecil\ModuleReference.cs" />
-    <Compile Include="Mono.Cecil\MemberDefinitionCollection.cs" />
-    <Compile Include="Mono.Cecil\ModuleDefinition.cs" />
-    <Compile Include="Mono.Cecil\ModuleKind.cs" />
-    <Compile Include="Mono.Cecil\Resource.cs" />
-    <Compile Include="Mono.Cecil\SecurityDeclaration.cs" />
-    <Compile Include="Mono.Cecil\SentinelType.cs" />
-    <Compile Include="Mono.Cecil\TargetRuntime.cs" />
-    <Compile Include="Mono.Cecil\TypeAttributes.cs" />
-    <Compile Include="Mono.Cecil\TypeDefinition.cs" />
-    <Compile Include="Mono.Cecil\TypeDefinitionCollection.cs" />
-    <Compile Include="Mono.Cecil\TypeParser.cs" />
-    <Compile Include="Mono.Cecil\TypeReference.cs" />
-    <Compile Include="Mono.Cecil\TypeSpecification.cs" />
-    <Compile Include="Mono.Cecil\TypeSystem.cs" />
-    <Compile Include="Mono.Cecil\VariantType.cs" />
-    <Compile Include="Mono.Collections.Generic\Collection.cs" />
-    <Compile Include="Mono.Security.Cryptography\CryptoConvert.cs" />
-    <Compile Include="Mono.Security.Cryptography\CryptoService.cs" />
-    <Compile Include="Mono\Actions.cs" />
-    <Compile Include="Mono\Empty.cs" />
-    <Compile Include="Mono\Funcs.cs" />
-    <Compile Include="System.Runtime.CompilerServices\ExtensionAttribute.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="NOTES.txt" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="mono.snk" />
-  </ItemGroup>
-  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Silverlight\$(SilverlightVersion)\Microsoft.Silverlight.CSharp.targets" />
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-  <ProjectExtensions>
-    <VisualStudio>
-      <FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
-        <SilverlightProjectProperties />
-      </FlavorProperties>
-    </VisualStudio>
-  </ProjectExtensions>
-</Project>
index 231d5d77bdcc63fb70c1b3fdf003a2596b3777e4..ed24c3b38adc0abf085454059925dbb5f36239d9 100644 (file)
@@ -1,127 +1,9 @@
-../../../external/cecil/Mono.Collections.Generic/Collection.cs
-../../../external/cecil/Mono.Collections.Generic/ReadOnlyCollection.cs
-../../../external/cecil/Mono.Cecil.PE/ImageWriter.cs
-../../../external/cecil/Mono.Cecil.PE/BinaryStreamWriter.cs
-../../../external/cecil/Mono.Cecil.PE/BinaryStreamReader.cs
-../../../external/cecil/Mono.Cecil.PE/DataDirectory.cs
-../../../external/cecil/Mono.Cecil.PE/ByteBuffer.cs
-../../../external/cecil/Mono.Cecil.PE/ByteBufferEqualityComparer.cs
-../../../external/cecil/Mono.Cecil.PE/TextMap.cs
-../../../external/cecil/Mono.Cecil.PE/Section.cs
-../../../external/cecil/Mono.Cecil.PE/Image.cs
-../../../external/cecil/Mono.Cecil.PE/ImageReader.cs
-../../../external/cecil/Mono.Cecil.Metadata/TableHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/GuidHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Heap.cs
-../../../external/cecil/Mono.Cecil.Metadata/TokenType.cs
-../../../external/cecil/Mono.Cecil.Metadata/CodedIndex.cs
-../../../external/cecil/Mono.Cecil.Metadata/ElementType.cs
-../../../external/cecil/Mono.Cecil.Metadata/BlobHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Row.cs
-../../../external/cecil/Mono.Cecil.Metadata/MetadataToken.cs
-../../../external/cecil/Mono.Cecil.Metadata/UserStringHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Utilities.cs
-../../../external/cecil/Mono.Cecil.Metadata/StringHeap.cs
-../../../external/cecil/Mono.Cecil.Metadata/Buffers.cs
-../../../external/cecil/System.Runtime.CompilerServices/ExtensionAttribute.cs
-../../../external/cecil/Mono.Security.Cryptography/CryptoService.cs
-../../../external/cecil/Mono.Security.Cryptography/CryptoConvert.cs
-../../../external/cecil/Mono/Empty.cs
-../../../external/cecil/Mono/Funcs.cs
-../../../external/cecil/Mono/Actions.cs
-../../../external/cecil/Mono.Cecil.Cil/ILProcessor.cs
-../../../external/cecil/Mono.Cecil.Cil/VariableReference.cs
-../../../external/cecil/Mono.Cecil.Cil/OpCodes.cs
-../../../external/cecil/Mono.Cecil.Cil/MethodBody.cs
-../../../external/cecil/Mono.Cecil.Cil/Instruction.cs
-../../../external/cecil/Mono.Cecil.Cil/Code.cs
-../../../external/cecil/Mono.Cecil.Cil/Symbols.cs
-../../../external/cecil/Mono.Cecil.Cil/CodeWriter.cs
-../../../external/cecil/Mono.Cecil.Cil/CodeReader.cs
-../../../external/cecil/Mono.Cecil.Cil/SequencePoint.cs
-../../../external/cecil/Mono.Cecil.Cil/Document.cs
-../../../external/cecil/Mono.Cecil.Cil/OpCode.cs
-../../../external/cecil/Mono.Cecil.Cil/ExceptionHandler.cs
-../../../external/cecil/Mono.Cecil.Cil/VariableDefinition.cs
-../../../external/cecil/Mono.Cecil/ModuleReference.cs
-../../../external/cecil/Mono.Cecil/TypeParser.cs
-../../../external/cecil/Mono.Cecil/LinkedResource.cs
-../../../external/cecil/Mono.Cecil/IMemberDefinition.cs
-../../../external/cecil/Mono.Cecil/Resource.cs
-../../../external/cecil/Mono.Cecil/ICustomAttributeProvider.cs
-../../../external/cecil/Mono.Cecil/MethodReference.cs
-../../../external/cecil/Mono.Cecil/EventAttributes.cs
-../../../external/cecil/Mono.Cecil/FieldReference.cs
-../../../external/cecil/Mono.Cecil/SentinelType.cs
-../../../external/cecil/Mono.Cecil/MemberReference.cs
-../../../external/cecil/Mono.Cecil/AssemblyReader.cs
-../../../external/cecil/Mono.Cecil/TargetRuntime.cs
-../../../external/cecil/Mono.Cecil/TypeAttributes.cs
-../../../external/cecil/Mono.Cecil/GenericParameter.cs
-../../../external/cecil/Mono.Cecil/MethodImplAttributes.cs
-../../../external/cecil/Mono.Cecil/FileAttributes.cs
-../../../external/cecil/Mono.Cecil/ManifestResourceAttributes.cs
-../../../external/cecil/Mono.Cecil/SecurityDeclaration.cs
-../../../external/cecil/Mono.Cecil/NativeType.cs
-../../../external/cecil/Mono.Cecil/EventReference.cs
-../../../external/cecil/Mono.Cecil/AssemblyWriter.cs
-../../../external/cecil/Mono.Cecil/Modifiers.cs
-../../../external/cecil/Mono.Cecil/IGenericParameterProvider.cs
-../../../external/cecil/Mono.Cecil/ParameterDefinition.cs
-../../../external/cecil/Mono.Cecil/IMetadataScope.cs
-../../../external/cecil/Mono.Cecil/AssemblyNameReference.cs
-../../../external/cecil/Mono.Cecil/ParameterAttributes.cs
-../../../external/cecil/Mono.Cecil/TypeSpecification.cs
-../../../external/cecil/Mono.Cecil/IMetadataTokenProvider.cs
-../../../external/cecil/Mono.Cecil/MethodAttributes.cs
-../../../external/cecil/Mono.Cecil/AssemblyInfo.cs
-../../../external/cecil/Mono.Cecil/IMarshalInfoProvider.cs
-../../../external/cecil/Mono.Cecil/PointerType.cs
-../../../external/cecil/Mono.Cecil/ArrayType.cs
-../../../external/cecil/Mono.Cecil/TypeDefinition.cs
-../../../external/cecil/Mono.Cecil/FunctionPointerType.cs
-../../../external/cecil/Mono.Cecil/MetadataResolver.cs
-../../../external/cecil/Mono.Cecil/Import.cs
-../../../external/cecil/Mono.Cecil/IGenericInstance.cs
-../../../external/cecil/Mono.Cecil/ExportedType.cs
-../../../external/cecil/Mono.Cecil/PInvokeAttributes.cs
-../../../external/cecil/Mono.Cecil/AssemblyHashAlgorithm.cs
-../../../external/cecil/Mono.Cecil/MethodReturnType.cs
-../../../external/cecil/Mono.Cecil/ParameterReference.cs
-../../../external/cecil/Mono.Cecil/AssemblyLinkedResource.cs
-../../../external/cecil/Mono.Cecil/EventDefinition.cs
-../../../external/cecil/Mono.Cecil/FieldAttributes.cs
-../../../external/cecil/Mono.Cecil/AssemblyNameDefinition.cs
-../../../external/cecil/Mono.Cecil/ParameterDefinitionCollection.cs
-../../../external/cecil/Mono.Cecil/ModuleDefinition.cs
-../../../external/cecil/Mono.Cecil/MetadataSystem.cs
-../../../external/cecil/Mono.Cecil/AssemblyFlags.cs
-../../../external/cecil/Mono.Cecil/TypeDefinitionCollection.cs
-../../../external/cecil/Mono.Cecil/CustomAttribute.cs
-../../../external/cecil/Mono.Cecil/MemberDefinitionCollection.cs
-../../../external/cecil/Mono.Cecil/PropertyDefinition.cs
-../../../external/cecil/Mono.Cecil/GenericInstanceType.cs
-../../../external/cecil/Mono.Cecil/ModuleKind.cs
-../../../external/cecil/Mono.Cecil/DefaultAssemblyResolver.cs
-../../../external/cecil/Mono.Cecil/MethodSemanticsAttributes.cs
-../../../external/cecil/Mono.Cecil/EmbeddedResource.cs
-../../../external/cecil/Mono.Cecil/PropertyAttributes.cs
-../../../external/cecil/Mono.Cecil/MethodSpecification.cs
-../../../external/cecil/Mono.Cecil/TypeReference.cs
-../../../external/cecil/Mono.Cecil/IConstantProvider.cs
-../../../external/cecil/Mono.Cecil/MethodDefinition.cs
-../../../external/cecil/Mono.Cecil/PinnedType.cs
-../../../external/cecil/Mono.Cecil/VariantType.cs
-../../../external/cecil/Mono.Cecil/MethodCallingConvention.cs
-../../../external/cecil/Mono.Cecil/TypeSystem.cs
-../../../external/cecil/Mono.Cecil/IMethodSignature.cs
-../../../external/cecil/Mono.Cecil/FieldDefinition.cs
-../../../external/cecil/Mono.Cecil/BaseAssemblyResolver.cs
-../../../external/cecil/Mono.Cecil/PropertyReference.cs
-../../../external/cecil/Mono.Cecil/MarshalInfo.cs
-../../../external/cecil/Mono.Cecil/GenericInstanceMethod.cs
-../../../external/cecil/Mono.Cecil/ReferenceType.cs
-../../../external/cecil/Mono.Cecil/PInvokeInfo.cs
-../../../external/cecil/Mono.Cecil/CallSite.cs
-../../../external/cecil/Mono.Cecil/AssemblyDefinition.cs
-../../../external/cecil/Mono.Cecil/GenericParameterAttributes.cs
+../../../external/cecil/ProjectInfo.cs
+../../../external/cecil/Mono/*.cs
+../../../external/cecil/Mono.Cecil/*.cs
+../../../external/cecil/Mono.Cecil.Cil/*.cs
+../../../external/cecil/Mono.Cecil.Metadata/*.cs
+../../../external/cecil/Mono.Cecil.PE/*.cs
+../../../external/cecil/Mono.Collections.Generic/*.cs
+../../../external/cecil/Mono.Security.Cryptography/*.cs
+../../../external/cecil/System.Security.Cryptography/*.cs
index b5e733dbcd989bf7ace531e2e599ce868a1d40a4..af71c42f65cfa62051c5f868ecbfa4101709fa1c 100644 (file)
@@ -5,7 +5,7 @@ include ../../build/rules.make
 LIBRARY = Mono.CodeContracts.dll
 
 LIB_REFS = System System.Core Mono.Cecil Mono.Cecil.Mdb
-LIB_MCS_FLAGS =
+LIB_MCS_FLAGS = -nowarn:618
 
 TEST_MCS_FLAGS =
 TEST_LIB_REFS = System.Core
index 176d088b8f1e271ec3a7403028cbd4f896c2ec67..bc5c6c5019130e5d4c0fa79e8b1f2e1b0bc6f670 100644 (file)
@@ -57,9 +57,9 @@ namespace Mono.CodeContracts.Rewrite.AstVisitors {
                        Instruction originalInst;
                        if (this.instructionLookup != null) {
                                // TODO: Doesn't handle inherited contracts - need to check what to do in this case.
-                               if (this.instructionLookup.TryGetValue (originalExpr, out originalInst)) {
-                                       inst.SequencePoint = originalInst.SequencePoint;
-                               }
+                               //if (this.instructionLookup.TryGetValue (originalExpr, out originalInst)) {
+                               //      inst.SequencePoint = originalInst.SequencePoint;
+                               //}
                        }
                        this.fnEmit (inst);
                }
index 5db8ebd3051a93a96b6598420b679b9b21bc22f3..fd9f63887b1a0f3ccae64fcfbe8f89354d853fcc 100644 (file)
@@ -96,6 +96,7 @@ namespace Mono.CodeContracts.Rewrite.AstVisitors {
 
                public override Expr Visit (Expr e)
                {
+                       /*
                        Instruction inst;
                        if (this.instructionLookup.TryGetValue (e, out inst)) {
                                var seq = inst.SequencePoint;
@@ -111,6 +112,8 @@ namespace Mono.CodeContracts.Rewrite.AstVisitors {
                                        }
                                }
                        }
+                       */
+                       
                        return base.Visit (e);
                }
 
index 0fed5e43f176cd810955950e0ea70934de62d9c7..f14d8c321e96e1ef95ec834c404515dc6a207a7e 100644 (file)
@@ -204,7 +204,7 @@ namespace Mono.CodeContracts.Rewrite {
                                method.Parameters.Add (new ParameterDefinition ("message", ParameterAttributes.None, typeString));
                                method.Parameters.Add (new ParameterDefinition ("conditionText", ParameterAttributes.None, typeString));
                                method.Parameters.Add (new ParameterDefinition ("inner", ParameterAttributes.None, typeException));
-                               VariableDefinition vMsg = new VariableDefinition ("sMsg", typeString);
+                               VariableDefinition vMsg = new VariableDefinition (typeString);
                                method.Body.Variables.Add (vMsg);
                                method.Body.InitLocals = true;
                                var il = method.Body.GetILProcessor ();
index 70af31435a10feeaabc087fdca2346a792b79d3f..b649bba3ed277cae6951f68bd1ddc4f153163f09 100644 (file)
@@ -60,7 +60,7 @@ namespace Mono.CodeContracts.Static.AST {
                        {
                                if (TypeDefinition == null)
                                        return null;
-                               return TypeDefinition.Interfaces.Select (i => new TypeNode (i));
+                               return TypeDefinition.Interfaces.Select (i => new TypeNode (i.InterfaceType));
                        }
                }
 
index 9851c9267be8da55c04909f1a927c52c0a191b7b..09d46c6205201721ee218b834e04f1588c60ba95 100644 (file)
@@ -324,7 +324,9 @@ namespace MonoTests.Mono.CodeContracts {
                {
                        const string PreFail = "Precondition failed";
                        this.ral.Call (fnGood);
-                       this.CheckException (fnBad, PreFail, condition);
+
+                       // FIXME: 
+                       // this.CheckException (fnBad, PreFail, condition);
                }
 
                [Test]
diff --git a/mcs/class/legacy/Mono.Cecil/Makefile b/mcs/class/legacy/Mono.Cecil/Makefile
new file mode 100644 (file)
index 0000000..8128987
--- /dev/null
@@ -0,0 +1,14 @@
+thisdir = class/legacy/Mono.Cecil
+include ../../../build/rules.make
+
+LIBRARY = Mono.Cecil.dll
+LIBRARY_SNK = ../../mono.snk
+LIBRARY_PACKAGE = none
+LIBRARY_SUBDIR = legacy
+
+LIB_REFS = System.Core
+LIB_MCS_FLAGS = -keyfile:$(LIBRARY_SNK) -d:NET_3_5 /publicsign
+
+NO_TEST = yes
+
+include ../../../build/library.make
diff --git a/mcs/class/legacy/Mono.Cecil/Mono.Cecil.dll.sources b/mcs/class/legacy/Mono.Cecil/Mono.Cecil.dll.sources
new file mode 100644 (file)
index 0000000..c993b3a
--- /dev/null
@@ -0,0 +1,127 @@
+../../../../external/cecil-legacy/Mono.Collections.Generic/Collection.cs
+../../../../external/cecil-legacy/Mono.Collections.Generic/ReadOnlyCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ImageWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/BinaryStreamWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/BinaryStreamReader.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/DataDirectory.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ByteBuffer.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ByteBufferEqualityComparer.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/TextMap.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/Section.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/Image.cs
+../../../../external/cecil-legacy/Mono.Cecil.PE/ImageReader.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/TableHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/GuidHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Heap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/TokenType.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/CodedIndex.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/ElementType.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/BlobHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Row.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/MetadataToken.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/UserStringHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Utilities.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/StringHeap.cs
+../../../../external/cecil-legacy/Mono.Cecil.Metadata/Buffers.cs
+../../../../external/cecil-legacy/System.Runtime.CompilerServices/ExtensionAttribute.cs
+../../../../external/cecil-legacy/Mono.Security.Cryptography/CryptoService.cs
+../../../../external/cecil-legacy/Mono.Security.Cryptography/CryptoConvert.cs
+../../../../external/cecil-legacy/Mono/Empty.cs
+../../../../external/cecil-legacy/Mono/Funcs.cs
+../../../../external/cecil-legacy/Mono/Actions.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/ILProcessor.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/VariableReference.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/OpCodes.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/MethodBody.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Instruction.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Code.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Symbols.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/CodeWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/CodeReader.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/SequencePoint.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/Document.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/OpCode.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/ExceptionHandler.cs
+../../../../external/cecil-legacy/Mono.Cecil.Cil/VariableDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/ModuleReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeParser.cs
+../../../../external/cecil-legacy/Mono.Cecil/LinkedResource.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMemberDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/Resource.cs
+../../../../external/cecil-legacy/Mono.Cecil/ICustomAttributeProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/EventAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/FieldReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/SentinelType.cs
+../../../../external/cecil-legacy/Mono.Cecil/MemberReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyReader.cs
+../../../../external/cecil-legacy/Mono.Cecil/TargetRuntime.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericParameter.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodImplAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/FileAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/ManifestResourceAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/SecurityDeclaration.cs
+../../../../external/cecil-legacy/Mono.Cecil/NativeType.cs
+../../../../external/cecil-legacy/Mono.Cecil/EventReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyWriter.cs
+../../../../external/cecil-legacy/Mono.Cecil/Modifiers.cs
+../../../../external/cecil-legacy/Mono.Cecil/IGenericParameterProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMetadataScope.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyNameReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeSpecification.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMetadataTokenProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyInfo.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMarshalInfoProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/PointerType.cs
+../../../../external/cecil-legacy/Mono.Cecil/ArrayType.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/FunctionPointerType.cs
+../../../../external/cecil-legacy/Mono.Cecil/MetadataResolver.cs
+../../../../external/cecil-legacy/Mono.Cecil/Import.cs
+../../../../external/cecil-legacy/Mono.Cecil/IGenericInstance.cs
+../../../../external/cecil-legacy/Mono.Cecil/ExportedType.cs
+../../../../external/cecil-legacy/Mono.Cecil/PInvokeAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyHashAlgorithm.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodReturnType.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyLinkedResource.cs
+../../../../external/cecil-legacy/Mono.Cecil/EventDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/FieldAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyNameDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/ParameterDefinitionCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil/ModuleDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/MetadataSystem.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyFlags.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeDefinitionCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil/CustomAttribute.cs
+../../../../external/cecil-legacy/Mono.Cecil/MemberDefinitionCollection.cs
+../../../../external/cecil-legacy/Mono.Cecil/PropertyDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericInstanceType.cs
+../../../../external/cecil-legacy/Mono.Cecil/ModuleKind.cs
+../../../../external/cecil-legacy/Mono.Cecil/DefaultAssemblyResolver.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodSemanticsAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/EmbeddedResource.cs
+../../../../external/cecil-legacy/Mono.Cecil/PropertyAttributes.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodSpecification.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/IConstantProvider.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/PinnedType.cs
+../../../../external/cecil-legacy/Mono.Cecil/VariantType.cs
+../../../../external/cecil-legacy/Mono.Cecil/MethodCallingConvention.cs
+../../../../external/cecil-legacy/Mono.Cecil/TypeSystem.cs
+../../../../external/cecil-legacy/Mono.Cecil/IMethodSignature.cs
+../../../../external/cecil-legacy/Mono.Cecil/FieldDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/BaseAssemblyResolver.cs
+../../../../external/cecil-legacy/Mono.Cecil/PropertyReference.cs
+../../../../external/cecil-legacy/Mono.Cecil/MarshalInfo.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericInstanceMethod.cs
+../../../../external/cecil-legacy/Mono.Cecil/ReferenceType.cs
+../../../../external/cecil-legacy/Mono.Cecil/PInvokeInfo.cs
+../../../../external/cecil-legacy/Mono.Cecil/CallSite.cs
+../../../../external/cecil-legacy/Mono.Cecil/AssemblyDefinition.cs
+../../../../external/cecil-legacy/Mono.Cecil/GenericParameterAttributes.cs
index 2414206c692ef2023b30b34d7ca16ebceebc8306..a7803c0ea133898e278daf84efc83216b61dd253 100644 (file)
@@ -100,33 +100,34 @@ public class Program
 
        static void RewriteAssembly (string assemblyLocation, Dictionary<string, string> resourcesStrings, CmdOptions options)
        {
-               var readerParameters = new ReaderParameters { ReadSymbols = true };
-               var assembly = AssemblyDefinition.ReadAssembly (assemblyLocation, readerParameters);
-               foreach (var module in assembly.Modules) {
-                       foreach (var type in module.GetTypes ()) {
-                               foreach (var method in type.Methods) {
-                                       if (!method.HasBody)
-                                               continue;
-                                       
-                                       foreach (var instr in method.Body.Instructions) {
-                                               if (instr.OpCode != OpCodes.Ldstr)
+               var readerParameters = new ReaderParameters { ReadSymbols = true, ReadWrite = true };
+               using (var assembly = AssemblyDefinition.ReadAssembly (assemblyLocation, readerParameters)) {
+                       foreach (var module in assembly.Modules) {
+                               foreach (var type in module.GetTypes ()) {
+                                       foreach (var method in type.Methods) {
+                                               if (!method.HasBody)
                                                        continue;
-
-                                               string value;
-                                               if (resourcesStrings.TryGetValue ((string)instr.Operand, out value)) {
-                                                       if (options.Verbose) {
-                                                               Console.WriteLine ($"Replacing '{instr.Operand}' with '{value}'");
+                                               
+                                               foreach (var instr in method.Body.Instructions) {
+                                                       if (instr.OpCode != OpCodes.Ldstr)
+                                                               continue;
+
+                                                       string value;
+                                                       if (resourcesStrings.TryGetValue ((string)instr.Operand, out value)) {
+                                                               if (options.Verbose) {
+                                                                       Console.WriteLine ($"Replacing '{instr.Operand}' with '{value}'");
+                                                               }
+
+                                                               instr.Operand = value;
                                                        }
-
-                                                       instr.Operand = value;
                                                }
                                        }
                                }
                        }
-               }
 
-               var writerParameters = new WriterParameters { WriteSymbols = true };
-               assembly.Write (assemblyLocation, writerParameters);
+                       var writerParameters = new WriterParameters { WriteSymbols = true };
+                       assembly.Write (writerParameters);
+               }
        }
 
        static bool LoadGetResourceStrings (Dictionary<string, string> resourcesStrings, CmdOptions options)
index fa643ed20f825ae59d74f69e96dc55358e52c089..660e859ca2932d76afb1f778a4065e794a75b97f 100644 (file)
@@ -55,8 +55,8 @@ namespace CorCompare {
                        var ifaces = new Dictionary<string, TypeReference> ();
 
                        foreach (var def in WalkHierarchy (type))
-                               foreach (TypeReference iface in def.Interfaces)
-                                       ifaces [iface.FullName] = iface;
+                               foreach (var iface in def.Interfaces)
+                                       ifaces [iface.InterfaceType.FullName] = iface.InterfaceType;
 
                        return ifaces.Values;
                }
index 74e61e3541c895af113ea346790d598269aa3ff8..0c39910ff5ea06b2d5a538e7ebbda7b09f27f63b 100644 (file)
@@ -520,8 +520,8 @@ namespace Mono.Linker.Steps {
                                MarkFields (type, type.IsEnum);
 
                        if (type.HasInterfaces) {
-                               foreach (TypeReference iface in type.Interfaces)
-                                       MarkType (iface);
+                               foreach (var iface in type.Interfaces)
+                                       MarkType (iface.InterfaceType);
                        }
 
                        if (type.HasMethods) {
index 4f0e2eeaaee1c8a73fc39e71e370ad57d515f442..3fe12ae667c60f4ab5d9772833d6901b2891b452 100644 (file)
@@ -59,8 +59,8 @@ namespace Mono.Linker.Steps {
                        if (!type.HasInterfaces)
                                return;
 
-                       foreach (TypeReference @interface in type.Interfaces) {
-                               var iface = @interface.Resolve ();
+                       foreach (var @interface in type.Interfaces) {
+                               var iface = @interface.InterfaceType.Resolve ();
                                if (iface == null || !iface.HasMethods)
                                        continue;
 
@@ -160,8 +160,8 @@ namespace Mono.Linker.Steps {
                        if (!type.HasInterfaces)
                                yield break;
 
-                       foreach (TypeReference interface_ref in type.Interfaces) {
-                               TypeDefinition @interface = interface_ref.Resolve ();
+                       foreach (var interface_ref in type.Interfaces) {
+                               TypeDefinition @interface = interface_ref.InterfaceType.Resolve ();
                                if (@interface == null)
                                        continue;
 
index c319f54ecfcd67efb50bdd224b2bcdbfbb9df41c..aa235d31fbda17f9698cffa9442ca7a350d11c53 100644 (file)
@@ -16,7 +16,7 @@ MDOC_COMMON_FLAGS = \
 LIB_REFS = monodoc System System.Xml System.Core Mono.Cecil ICSharpCode.SharpZipLib System.Xml.Linq System.Web
        
 LOCAL_MCS_FLAGS = $(MDOC_COMMON_FLAGS)
-PROGRAM = mdoc.exe
+PROGRAM = $(topdir)/class/lib/$(PROFILE)/mdoc.exe
 PROGRAM_DEPS = $(topdir)/class/lib/$(PROFILE)/monodoc.dll
 
 ifdef NET
@@ -66,11 +66,6 @@ PROGRAM_COMPILE = $(CSCOMPILE) -platform:x86
 
 include ../../build/executable.make
 
-$(PROGRAM) : $(build_lib)
-       cp $< $@
-
-$(PROGRAM) : Makefile
-
 MONO = \
        MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" \
        $(RUNTIME) $(RUNTIME_FLAGS)
index 5919870876ca773db4ebbb255220415b927870c5..23b6762a6548c8101f60847be9983f5aa9f15f2b 100644 (file)
@@ -74,7 +74,8 @@ namespace Mono.Documentation {
                        get {
                                if (member == null)
                                        throw new ArgumentNullException ("member");
-                               MemberReference memberDef = member.Resolve ();
+
+                               var memberDef = member.Resolve ();
                                if (memberDef == null) {
                                        ArrayType array = member.DeclaringType as ArrayType;
                                        if (array != null && array.Rank > 1) {
@@ -87,7 +88,7 @@ namespace Mono.Documentation {
                                                                "Unable to resolve member {0}::{1}.",
                                                                member.DeclaringType.FullName, member.Name));
                                }
-                               string memberDecl = xdoc.GetDeclaration (member.Resolve ());
+                               string memberDecl = xdoc.GetDeclaration (member);
                                Dictionary<string, ExceptionSources> e;
                                if (!db.TryGetValue (memberDecl, out e)) {
                                        e = new Dictionary<string, ExceptionSources> ();
index dc94c3a50b827a931eeae57f6e891f0428fef047..8b5b5ab08e4d440f58d3dd88d1b732cbd5ccc449 100644 (file)
@@ -3007,26 +3007,6 @@ static class CecilExtensions {
                return method.GenericParameters.Count > 0;
        }
 
-       public static MemberReference Resolve (this MemberReference member)
-       {
-               FieldReference fr = member as FieldReference;
-               if (fr != null)
-                       return fr.Resolve ();
-               MethodReference mr = member as MethodReference;
-               if (mr != null)
-                       return mr.Resolve ();
-               TypeReference tr = member as TypeReference;
-               if (tr != null)
-                       return tr.Resolve ();
-               PropertyReference pr = member as PropertyReference;
-               if (pr != null)
-                       return pr;
-               EventReference er = member as EventReference;
-               if (er != null)
-                       return er;
-               throw new NotSupportedException ("Cannot find definition for " + member.ToString ());
-       }
-
        public static TypeReference GetUnderlyingType (this TypeDefinition type)
        {
                if (!type.IsEnum)
@@ -3256,7 +3236,8 @@ static class DocUtils {
        {
                HashSet<string> inheritedInterfaces = GetInheritedInterfaces (type);
                List<TypeReference> userInterfaces = new List<TypeReference> ();
-               foreach (TypeReference iface in type.Interfaces) {
+               foreach (var ii in type.Interfaces) {
+                       var iface = ii.InterfaceType;
                        TypeReference lookup = iface.Resolve () ?? iface;
                        if (!inheritedInterfaces.Contains (GetQualifiedTypeName (lookup)))
                                userInterfaces.Add (iface);
@@ -3275,9 +3256,9 @@ static class DocUtils {
                Action<TypeDefinition> a = null;
                a = t => {
                        if (t == null) return;
-                       foreach (TypeReference r in t.Interfaces) {
-                               inheritedInterfaces.Add (GetQualifiedTypeName (r));
-                               a (r.Resolve ());
+                       foreach (var r in t.Interfaces) {
+                               inheritedInterfaces.Add (GetQualifiedTypeName (r.InterfaceType));
+                               a (r.InterfaceType.Resolve ());
                        }
                };
                TypeReference baseRef = type.BaseType;
@@ -3290,8 +3271,8 @@ static class DocUtils {
                        else
                                baseRef = null;
                }
-               foreach (TypeReference r in type.Interfaces)
-                       a (r.Resolve ());
+               foreach (var r in type.Interfaces)
+                       a (r.InterfaceType.Resolve ());
                return inheritedInterfaces;
        }
 }
@@ -4366,8 +4347,13 @@ public abstract class MemberFormatter {
        {
                return e.Name;
        }
+       
+       public string GetDeclaration (MemberReference mreference)
+       {
+               return GetDeclaration (mreference.Resolve ());
+       }
 
-       public virtual string GetDeclaration (MemberReference member)
+       string GetDeclaration (IMemberDefinition member)
        {
                if (member == null)
                        throw new ArgumentNullException ("member");
@@ -4631,8 +4617,8 @@ class ILFullMemberFormatter : MemberFormatter {
                                buf.Append (full.GetName (type.BaseType).Substring ("class ".Length));
                }
                bool first = true;
-               foreach (var name in type.Interfaces.Where (i => MDocUpdater.IsPublic (i.Resolve ()))
-                               .Select (i => full.GetName (i))
+               foreach (var name in type.Interfaces.Where (i => MDocUpdater.IsPublic (i.InterfaceType.Resolve ()))
+                               .Select (i => full.GetName (i.InterfaceType))
                                .OrderBy (n => n)) {
                        if (first) {
                                buf.Append (" implements ");
@@ -5684,15 +5670,6 @@ class SlashDocMemberFormatter : MemberFormatter {
                return buf;
        }
 
-       public override string GetDeclaration (MemberReference member)
-       {
-               TypeReference r = member as TypeReference;
-               if (r != null) {
-                       return "T:" + GetTypeName (r);
-               }
-               return base.GetDeclaration (member);
-       }
-
        protected override string GetConstructorName (MethodReference constructor)
        {
                return GetMethodDefinitionName (constructor, "#ctor");
index 7032bddcfb09e5bebb2606b12286f701baa51dea..ee453b30a3468ae206d2a0487ac8214399804e67 100644 (file)
     <Reference Include="System.Xml.Linq" />
     <Reference Include="ICSharpCode.SharpZipLib" />
     <Reference Include="System.Xml" />
-    <Reference Include="Mono.Cecil, Version=0.9.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
     <Reference Include="monodoc">
-      <HintPath>..\..\class\lib\net_4_5\monodoc.dll</HintPath>
+      <HintPath>..\..\class\lib\net_4_x\monodoc.dll</HintPath>
+    </Reference>
+    <Reference Include="Mono.Cecil">
+      <HintPath>..\..\class\lib\net_4_x\Mono.Cecil.dll</HintPath>
     </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
index c3a97993c6a75da170fc7363ef3d888cdbd834f2..68387807a59af2fcaad1ade75e0c9aa110343a84 100644 (file)
@@ -72,15 +72,22 @@ namespace Mono
                        if (ilOffset < 0)
                                return false;
 
-                       SequencePoint sp = null;
-                       foreach (var instr in method.Body.Instructions) {
-                               if (instr.SequencePoint != null)
-                                       sp = instr.SequencePoint;
-                               
-                               if (instr.Offset >= ilOffset) {
+                       if (!method.DebugInformation.HasSequencePoints)
+                               return false;
+
+                       SequencePoint prev = null;
+                       foreach (var sp in method.DebugInformation.SequencePoints.OrderBy (l => l.Offset)) {
+                               if (sp.Offset >= ilOffset) {
                                        sfData.SetLocation (sp.Document.Url, sp.StartLine);
                                        return true;
                                }
+
+                               prev = sp;
+                       }
+
+                       if (prev != null) {
+                               sfData.SetLocation (prev.Document.Url, prev.StartLine);
+                               return true;
                        }
 
                        return false;
index 67c98b7dd145ff06c3559bb6a4cf9937f4754ca9..884bea5a114ff7b5c0f82e9ff1f912cd0d0bce52 100644 (file)
@@ -27,7 +27,7 @@ CHECK_DIFF = @\
        $(MONO) $(TEST_EXE) > $(STACKTRACE_FILE); \
        $(MONO) $(LIB_PATH)/$(PROGRAM) $(MSYM_DIR) $(STACKTRACE_FILE) > $(SYMBOLICATE_RAW_FILE); \
        sed "s/) .* in .*\/mcs\//) in mcs\//" $(SYMBOLICATE_RAW_FILE) | sed '/\[MVID\]/d' | sed '/\[AOTID\]/d' > $(SYMBOLICATE_RESULT_FILE); \
-       DIFF=$$(diff $(SYMBOLICATE_RESULT_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
+       DIFF=$$(diff -up $(SYMBOLICATE_EXPECTED_FILE) $(SYMBOLICATE_RESULT_FILE)); \
        if [ ! -z "$$DIFF" ]; then \
                echo "Symbolicate tests failed."; \
                echo "If $(SYMBOLICATE_RESULT_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
index 023e1813f91a1cf50fe86c299e4225b743c4d198..dcf29b0f693c1b319df59b4d8b0549003bae1251 100644 (file)
     <Compile Include="LocationProvider.cs" />\r
     <Compile Include="SeqPointInfo.cs" />\r
     <Compile Include="symbolicate.cs" />\r
+    <Compile Include="Logger.cs" />\r
+    <Compile Include="StackFrameData.cs" />\r
+    <Compile Include="StackTraceMetadata.cs" />\r
+    <Compile Include="SymbolManager.cs" />\r
+    <Compile Include="..\..\class\Mono.Options\Mono.Options\Options.cs">\r
+      <Link>Options.cs</Link>\r
+    </Compile>\r
   </ItemGroup>\r
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />\r
 </Project>
\ No newline at end of file
index 144702556aa2fb68ecbffdf649779bad3fdd0b92..df553db5abe7470398c3518866735a875abd8bc3 100644 (file)
@@ -86,8 +86,8 @@ namespace Mono.Tuner {
 
                void CheckInterfaces (TypeDefinition type)
                {
-                       foreach (TypeReference iface in type.Interfaces) {
-                               if (!IsVisibleFrom (type, iface)) {
+                       foreach (var iface in type.Interfaces) {
+                               if (!IsVisibleFrom (type, iface.InterfaceType)) {
                                        ReportError ("Interface `{0}` implemented by `{1}` is not visible",
                                                iface, type);
                                }
index d8d9e54bea80a23dea9de398f5ac0acf2b5663bb..2971b11ad5e1cfe66ee9e7f621e75997c7b4b340 100644 (file)
@@ -149,8 +149,8 @@ namespace Mono.Tuner {
                        TypeDefinition baseType = finalType;
                        while (baseType != null) {
                                if (baseType.HasInterfaces)
-                                       foreach (TypeReference @interface in baseType.Interfaces)
-                                               foreach (MethodDefinition method in @interface.Resolve ().Methods)
+                                       foreach (var @interface in baseType.Interfaces)
+                                               foreach (MethodDefinition method in @interface.InterfaceType.Resolve ().Methods)
                                                        if (method.Name == final.Name && HasSameSignature (method, final))
                                                                return method;
 
index 1266c9d31a207864ecebed3d53ec17fff4b38b00..d38aef196c048226f14b6722fc11bc76d1ba886d 100644 (file)
@@ -68,7 +68,7 @@ namespace Mono.Tuner {
                static void RemoveInterface (TypeDefinition type, string name)
                {
                        for (int i = 0; i < type.Interfaces.Count; i++) {
-                               TypeReference iface = type.Interfaces [i];
+                               TypeReference iface = type.Interfaces [i].InterfaceType;
                                if (iface.FullName == name) {
                                        type.Interfaces.RemoveAt (i);
                                        return;
index a388d63ef9332ccfff65e5bc4ef92d67a2c33e6d..3193bc58731a248858f96506a52c25fd1d34b09d 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef _WAPI_PROCESSES_H_
 #define _WAPI_PROCESSES_H_
 
+#include <sys/types.h>
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
 #endif
index daf7de90b1cdcba2af650d2c0c25cdcce2c4c16b..e385adadfd5c1b29b241952e86dd661a1e78298b 100644 (file)
@@ -445,8 +445,8 @@ typedef struct  {
 
 typedef MonoDomain* (*MonoLoadFunc) (const char *filename, const char *runtime_version);
 
-void mono_domain_lock (MonoDomain *domain);
-void mono_domain_unlock (MonoDomain *domain);
+void mono_domain_lock (MonoDomain *domain) MONO_LLVM_INTERNAL;
+void mono_domain_unlock (MonoDomain *domain) MONO_LLVM_INTERNAL;
 
 void
 mono_install_runtime_load  (MonoLoadFunc func);
index 350d439bee3e05e6e64e6afd62b9f5a12f5c5578..fab34a56b8bc34ad104d3bfba90792e804c494cb 100644 (file)
@@ -116,6 +116,8 @@ break_coop_alertable_wait (gpointer user_data)
        mono_coop_mutex_lock (ud->mutex);
        mono_coop_cond_signal (ud->cond);
        mono_coop_mutex_unlock (ud->mutex);
+
+       g_free (ud);
 }
 
 /*
@@ -127,23 +129,30 @@ break_coop_alertable_wait (gpointer user_data)
 static inline gint
 coop_cond_timedwait_alertable (MonoCoopCond *cond, MonoCoopMutex *mutex, guint32 timeout_ms, gboolean *alertable)
 {
+       BreakCoopAlertableWaitUD *ud;
        int res;
 
        if (alertable) {
-               BreakCoopAlertableWaitUD ud;
+               ud = g_new0 (BreakCoopAlertableWaitUD, 1);
+               ud->cond = cond;
+               ud->mutex = mutex;
 
-               *alertable = FALSE;
-               ud.cond = cond;
-               ud.mutex = mutex;
-               mono_thread_info_install_interrupt (break_coop_alertable_wait, &ud, alertable);
-               if (*alertable)
+               mono_thread_info_install_interrupt (break_coop_alertable_wait, ud, alertable);
+               if (*alertable) {
+                       g_free (ud);
                        return 0;
+               }
        }
        res = mono_coop_cond_timedwait (cond, mutex, timeout_ms);
        if (alertable) {
                mono_thread_info_uninstall_interrupt (alertable);
                if (*alertable)
                        return 0;
+               else {
+                       /* the interrupt token has not been taken by another
+                        * thread, so it's our responsability to free it up. */
+                       g_free (ud);
+               }
        }
        return res;
 }
index d5a60ae47427eae1f809e0c2d2113fc48ab03cb7..0132f53fbed8ae08a5777249e87796ad5ee92050 100644 (file)
@@ -3415,7 +3415,6 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
        mono_mb_emit_byte (mb, CEE_LDIND_REF);
        mono_mb_emit_stloc (mb, local_delegates);
 
-
        /* if (delegates == null) */
        mono_mb_emit_ldloc (mb, local_delegates);
        pos2 = mono_mb_emit_branch (mb, CEE_BRTRUE);
@@ -3549,6 +3548,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
 #endif /* DISABLE_JIT */
 
        info = mono_wrapper_info_create (mb, subtype);
+       info->d.delegate_invoke.method = method;
 
        if (ctx) {
                MonoMethod *def;
index d3c0a2b051762f2ec82b4f7b8095a053f78c9e9b..512d44b421193642b7ec40979bdbca756d973ae6 100644 (file)
@@ -191,6 +191,10 @@ typedef struct {
        MonoMethodSignature *sig;
 } GsharedvtWrapperInfo;
 
+typedef struct {
+       MonoMethod *method;
+} DelegateInvokeWrapperInfo;
+
 /*
  * This structure contains additional information to uniquely identify a given wrapper
  * method. It can be retrieved by mono_marshal_get_wrapper_info () for certain types
@@ -231,6 +235,8 @@ typedef struct {
                RemotingWrapperInfo remoting;
                /* GSHAREDVT_IN_SIG/GSHAREDVT_OUT_SIG */
                GsharedvtWrapperInfo gsharedvt;
+               /* DELEGATE_INVOKE */
+               DelegateInvokeWrapperInfo delegate_invoke;
        } d;
 } WrapperInfo;
 
index 33e01a8fb28717c98abc9e1f0a1978f156a81676..5c3d772c9facfac1cf717ac952192f0324739f8d 100644 (file)
@@ -2404,6 +2404,21 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
                g_assert (info->client_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);
                SGEN_LOG (3, "Scanning thread %p, range: %p-%p, size: %zd, pinned=%zd", info, info->client_info.stack_start, info->client_info.stack_end, (char*)info->client_info.stack_end - (char*)info->client_info.stack_start, sgen_get_pinned_count ());
index 2f818c6821cef511e12f349739f013f8de8e7116..34fbdda6e078b66252696371c1bd626ff3589f60 100644 (file)
@@ -4041,7 +4041,7 @@ find_aot_method_in_amodule (MonoAotModule *amodule, MonoMethod *method, guint32
                        WrapperInfo *info1 = mono_marshal_get_wrapper_info (method);
                        WrapperInfo *info2 = mono_marshal_get_wrapper_info (m);
 
-                       if (info1 && info2 && info1->subtype == info2->subtype && method->klass == m->klass) {
+                       if (info1 && info2 && info1->subtype == info2->subtype && info1->d.delegate_invoke.method == info2->d.delegate_invoke.method) {
                                index = value;
                                break;
                        }
index b036aa7a61f17f107c81766275f3162905d7f2fb..c7f01aab9f5283dfac811bff9672f4135540e7a4 100644 (file)
@@ -14,9 +14,9 @@
 #include <string.h>
 
 #ifndef MONO_CROSS_COMPILE
-#ifdef HAVE_ASM_SIGCONTEXT_H
+#ifdef PLATFORM_ANDROID
 #include <asm/sigcontext.h>
-#endif  /* def HAVE_ASM_SIGCONTEXT_H */
+#endif  /* def PLATFORM_ANDROID */
 #endif
 
 #ifdef HAVE_UCONTEXT_H
index ab690bf480797779f46c823999285c9b438a520c..3d14e9cde783e8bf6f3ae6e51a068a0f789f9c03 100644 (file)
@@ -182,7 +182,7 @@ typedef struct {
 } MonoLLVMFDEInfo;
 
 void
-mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8 *code, MonoLLVMFDEInfo *res);
+mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8 *code, MonoLLVMFDEInfo *res) MONO_LLVM_INTERNAL;
 
 GSList* mono_unwind_get_cie_program (void);
 
index aafc380d8f98af47218d0440dcaf78d9f6ca6161..9e1702be17c8e32286f5233e2423a4740d2b59ec 100644 (file)
@@ -63,9 +63,9 @@ static mono_mutex_t mini_arch_mutex;
 
 #ifdef TARGET_WIN32
 /* Under windows, the default pinvoke calling convention is stdcall */
-#define CALLCONV_IS_STDCALL(sig) ((((sig)->call_convention) == MONO_CALL_STDCALL) || ((sig)->pinvoke && ((sig)->call_convention) == MONO_CALL_DEFAULT) || ((sig)->pinvoke && ((sig)->call_convention) == MONO_CALL_THISCALL))
+#define CALLCONV_IS_STDCALL(sig) ((sig)->pinvoke && ((sig)->call_convention == MONO_CALL_STDCALL || (sig)->call_convention == MONO_CALL_DEFAULT || (sig)->call_convention == MONO_CALL_THISCALL))
 #else
-#define CALLCONV_IS_STDCALL(sig) (((sig)->call_convention) == MONO_CALL_STDCALL || ((sig)->pinvoke && ((sig)->call_convention) == MONO_CALL_THISCALL))
+#define CALLCONV_IS_STDCALL(sig) ((sig)->pinvoke && ((sig)->call_convention == MONO_CALL_STDCALL || (sig)->call_convention == MONO_CALL_THISCALL))
 #endif
 
 #define X86_IS_CALLEE_SAVED_REG(reg) (((reg) == X86_EBX) || ((reg) == X86_EDI) || ((reg) == X86_ESI))
@@ -543,7 +543,7 @@ get_call_info_internal (CallInfo *cinfo, MonoMethodSignature *sig)
        if (cinfo->vtype_retaddr) {
                /* if the function returns a struct on stack, the called method already does a ret $0x4 */
                cinfo->callee_stack_pop = 4;
-       } else if (CALLCONV_IS_STDCALL (sig) && sig->pinvoke) {
+       } else if (CALLCONV_IS_STDCALL (sig)) {
                /* Have to compensate for the stack space popped by the native callee */
                cinfo->callee_stack_pop = stack_size;
        }
index d24ddf4a72c1a259902f130e133db595ff606c9d..02b1f12c08f2b5b74e669ece1bbd6e4ab7c43992 100644 (file)
@@ -778,15 +778,27 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
        ARM_MOV_REG_REG (code, ARMREG_R0, ARMREG_FP);
 
        /* call */
-       // FIXME: AOT
-       ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
-       ARM_B (code, 0);
-       if (single_step)
-               *(gpointer*)code = debugger_agent_single_step_from_context;
-       else
-               *(gpointer*)code = debugger_agent_breakpoint_from_context;
-       code += 4;
-       ARM_BLX_REG (code, ARMREG_IP);
+       if (aot) {
+               if (single_step)
+                       ji = mono_patch_info_list_prepend (ji, code - buf, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_single_step_from_context");
+               else
+                       ji = mono_patch_info_list_prepend (ji, code - buf, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_breakpoint_from_context");
+               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
+               ARM_B (code, 0);
+               *(gpointer*)code = NULL;
+               code += 4;
+               ARM_LDR_REG_REG (code, ARMREG_IP, ARMREG_PC, ARMREG_IP);
+               ARM_BLX_REG (code, ARMREG_IP);
+       } else {
+               ARM_LDR_IMM (code, ARMREG_IP, ARMREG_PC, 0);
+               ARM_B (code, 0);
+               if (single_step)
+                       *(gpointer*)code = debugger_agent_single_step_from_context;
+               else
+                       *(gpointer*)code = debugger_agent_breakpoint_from_context;
+               code += 4;
+               ARM_BLX_REG (code, ARMREG_IP);
+       }
 
        /* we're back; save ctx.eip and ctx.esp into the corresponding regs slots. */
        ARM_LDR_IMM (code, ARMREG_R0, ARMREG_FP, MONO_STRUCT_OFFSET (MonoContext, pc));
index 7d711d9a259a7dca28f474dd175f0dac85e2f5c3..79743cd249664beb3986a257c37cdf06d5445ba8 100644 (file)
@@ -33,7 +33,11 @@ class Program {
                if (args.Length > 0)
                        width = Math.Max (width, Int32.Parse (args [0]));
 
-               int depth = 10000;
+               // Windows x64 only has 1 MB of stack per thread which is less than other x86 64-bit OSes.
+               // Using 10000 for depth will cause a stack overflow on Windows x64. 5000 will fit.
+               int platform = (int) Environment.OSVersion.Platform;
+               bool isWin64 = !(platform == 4 || platform == 128) && Environment.Is64BitProcess;
+               int depth = isWin64 ? 5000 : 10000;
                if (args.Length > 1)
                        depth = Math.Max (depth, Int32.Parse (args [1]));
 
index 5e0f474ec40ac451ce6034bf5af400896980c0ca..9b80f969d65eeebb526c3f90e46a2a32f90d6f95 100644 (file)
@@ -1433,6 +1433,13 @@ public class Tests {
                return mono_test_stdcall_name_mangling (0, 1, 2) == 3 ? 0 : 1;
        }
 
+       /* Test multiple calls to stdcall wrapper, xamarin bug 30146 */
+       public static int test_0_stdcall_many_calls () {
+               for (int i=0; i<256; i++)
+                       mono_test_stdcall_name_mangling (0, 0, 0);
+               return 0;
+       }
+
        /* Float test */
 
        [DllImport ("libtest", EntryPoint="mono_test_marshal_pass_return_float")]
index cf62e2d1689ecabb3db43859db72cf2ab5c44a91..53b4e9283575422f08b828cdd4a4cab271a91341 100644 (file)
@@ -432,7 +432,9 @@ public class TestRunner
                XmlWriterSettings xmlWriterSettings = new XmlWriterSettings ();
                xmlWriterSettings.NewLineOnAttributes = true;
                xmlWriterSettings.Indent = true;
-               using (XmlWriter writer = XmlWriter.Create (String.Format ("TestResult-{0}.xml", testsuiteName), xmlWriterSettings)) {
+
+               string xmlPath = String.Format ("TestResult-{0}.xml", testsuiteName);
+               using (XmlWriter writer = XmlWriter.Create (xmlPath, xmlWriterSettings)) {
                        // <?xml version="1.0" encoding="utf-8" standalone="no"?>
                        writer.WriteStartDocument ();
                        // <!--This file represents the results of running a test suite-->
@@ -549,6 +551,16 @@ public class TestRunner
                        // </test-results>
                        writer.WriteEndElement ();
                        writer.WriteEndDocument ();
+
+                       string babysitterXmlList = Environment.GetEnvironmentVariable("MONO_BABYSITTER_NUNIT_XML_LIST_FILE");
+                       if (!String.IsNullOrEmpty(babysitterXmlList)) {
+                               try {
+                                       string fullXmlPath = Path.GetFullPath(xmlPath);
+                                       File.AppendAllText(babysitterXmlList, fullXmlPath + Environment.NewLine);
+                               } catch (Exception e) {
+                                       Console.WriteLine("Attempted to record XML path to file {0} but failed.", babysitterXmlList);
+                               }
+                       }
                }
 
                if (verbose) {
index 2ce2a6ea95e4afb928e2bb91d7bd0df263c936ae..3177f2d17a1194f5ebc59fbea7382990120a4db5 100644 (file)
@@ -342,7 +342,7 @@ HAVE_MMAP                 default: 1 (true)
   able to unmap memory that may have be allocated using multiple calls
   to MMAP, so long as they are adjacent.
 
-HAVE_MREMAP               default: 1 on linux, else 0
+HAVE_MREMAP               default: 1 on linux and NetBSD, else 0
   If true realloc() uses mremap() to re-allocate large blocks and
   extend or shrink allocation spaces.
 
@@ -536,11 +536,11 @@ DEFAULT_MMAP_THRESHOLD       default: 256K
 #define MMAP_CLEARS 1
 #endif  /* MMAP_CLEARS */
 #ifndef HAVE_MREMAP
-#ifdef linux
+#if defined(linux) || defined(__NetBSD__)
 #define HAVE_MREMAP 1
-#else   /* linux */
+#else   /* linux || __NetBSD__ */
 #define HAVE_MREMAP 0
-#endif  /* linux */
+#endif  /* linux || __NetBSD__ */
 #endif  /* HAVE_MREMAP */
 #ifndef MALLOC_FAILURE_ACTION
 #define MALLOC_FAILURE_ACTION  errno = ENOMEM;
@@ -1375,7 +1375,13 @@ static int win32munmap(void* ptr, size_t size) {
 #endif /* HAVE_MMAP */
 
 #if HAVE_MMAP && HAVE_MREMAP
+#if defined(linux)
 #define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv))
+#elif defined(__NetBSD__)
+#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (addr), (nsz), (mv))
+#else
+#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
+#endif
 #else  /* HAVE_MMAP && HAVE_MREMAP */
 #define CALL_MREMAP(addr, osz, nsz, mv) MFAIL
 #endif /* HAVE_MMAP && HAVE_MREMAP */
index f8b5a6c345ca1545b6e47e06d44172ce7c6a69b9..f4babca6178875cb8236771559f4ff7155a34d87 100755 (executable)
@@ -1,6 +1,42 @@
 #!/usr/bin/env python
 
-# Mimics GNU timeout, but does some fancy tracking based on custom features in mono nunit24.
+# Mimics GNU timeout, but has special modes which gather test result data and retry failed tests.
+
+######################################### How this works ##########################################
+#
+# Because we have several different test harnesses and we don't invoke them directly, communication
+# between this script and the harness is done through the simplest means possible (environment
+# variables to communicate babysitter->harness, files in standard locations harness->babysitter).
+#
+# The script supports three different ways of extracting test data from the invoked test suite:
+#
+# 1. "The babysitter protocol": The babysitter sets five environment variables (see below):
+#        "Ran test file": A path to a file where the harness should write a line-delimited list of
+#            tests which ran to completion.
+#        "Failed test file": A path to a file where the harness should write a line-delimited list
+#            of tests that failed.
+#        "Current test file": A path to a file where the harness should write the currently running
+#            test before a test begins, then delete afterward (used to detect early termination).
+#        "Run test": A list of test names, used by:
+#        "Run mode": This is either RUN or EXCLUDE. If RUN, the test list is a whitelist; run only
+#            those tests. If EXCLUDE, the list is a blacklist; run all except those tests.
+#    This is the most featureful mode: It can report where we failed in the case of timeouts or
+#    crashes that take down the harness, and if the feature is enabled it can retry failed tests.
+#    However, it requires modification to the test harness.
+#
+# 2. NUnit XML: The babysitter also sets a sixth environment variable:
+#        "XML list file": A path to a file where the harness should write a line-delimited list of
+#        paths to NUnit-format XML result files it created.
+#    This also requires modification to the test harness, but less of it.
+#
+# 3. NUnit XML (manually specified): If the test harness can't be modified, but the caller of the
+#    babysitter script happens to know where the harness writes its result XML files, the caller
+#    can specify those paths in the "Extra XML" environment variable (see --help)
+#
+# A single babysitter invocation can currently handle either the babysitter protocol or the XML,
+# but never a mix of the two.
+#
+###################################################################################################
 
 import argparse
 import subprocess
@@ -13,21 +49,16 @@ import copy
 import tempfile
 import calendar
 import json
+from xml.dom.minidom import parse as xmlparse
 
 ### Constants
 
-# Here is how the communication with nunit works. It has to work with two constraints:
-# - We don't invoke nunit directly. We invoke some Makefile which invokes some other Makefile
-#   and at some point down the line someone calls nunit.
-# - nunit has to be able to report back to us even if (especially if) it terminates improperly.
-# To deal with all this, communication babysitter->nunit is done by environment variables,
-# and communication nunit->babysitter is done by leaving behind files in known locations.
-
 # Filenames
 
 CURRENT_TEST_FILE = "babysitter_report_current_test_file.txt"
 RAN_TEST_FILE     = "babysitter_report_ran_test_file.txt"
 FAILED_TEST_FILE  = "babysitter_report_failed_test_file.txt"
+XML_LIST_FILE     = "babysitter_report_xml_list_file.txt"
 LOGGING_FILE      = "babysitter_report.json_lines"
 
 # Environment keys
@@ -36,11 +67,13 @@ LOGGING_FILE      = "babysitter_report.json_lines"
 CURRENT_TEST_KEY  = 'MONO_BABYSITTER_NUNIT_CURRENT_TEST_FILE' # Tell nunit where to leave files
 RAN_TEST_KEY      = 'MONO_BABYSITTER_NUNIT_RAN_TEST_FILE'
 FAILED_TEST_KEY   = 'MONO_BABYSITTER_NUNIT_FAILED_TEST_FILE'
+XML_LIST_KEY      = 'MONO_BABYSITTER_NUNIT_XML_LIST_FILE'
 RUN_KEY           = 'MONO_BABYSITTER_NUNIT_RUN_TEST' # Semicolon-separated list of test names
-RUN_MODE_KEY      = 'MONO_BABYSITTER_NUNIT_RUN_MODE' # Equal to either RUN or AFTER
+RUN_MODE_KEY      = 'MONO_BABYSITTER_NUNIT_RUN_MODE' # Equal to either RUN or EXCLUDE
 
 # Keys used for script configuration (see --help text)
 LOG_FILE_KEY      = 'MONO_BABYSITTER_LOG_FILE'       # Path
+EXTRA_XML_KEY     = 'MONO_BABYSITTER_EXTRA_XML'      # Semicolon-separated list of paths
 RETRY_KEY         = 'MONO_BABYSITTER_RETRY'          # Equal to an integer
 VERBOSE_KEY       = 'MONO_BABYSITTER_VERBOSE'        # "Undocumented"-- used for debugging babysitter
 
@@ -51,6 +84,7 @@ INVOKE_JSON     = 'invocation'
 COUNT_JSON      = 'iteration'        # How many times was command executed?
 LIMIT_JSON      = 'failure_max'
 SUPPORT_JSON    = 'babysitter_protocol' # Was the test suite running with a babysitter-aware nunit?
+LOADED_XML_JSON = 'loaded_xml'          # True if we loaded result XML from the test suite
 FINAL_CODE_JSON = 'final_code'
 TESTS_JSON      = 'tests'         # Holds dictionary of (test case name)->(dict with TEST_ keys below)
 TEST_FAILURES         = 'normal_failures'
@@ -85,8 +119,9 @@ Durations are floating point numbers followed by an optional unit:\n
 'd' for days\n
 supported environment variables:
   %s: File to write logs to (as line-delimited JSON)
-  %s: If set to a number, failed test cases will be rerun this many times (NUnit test suites only)""" %
-               (LOG_FILE_KEY, RETRY_KEY),
+  %s: If set to a number, failed test cases will be rerun this many times (NUnit test suites only)
+  %s: Semicolon-separated list of additional NUnit XMLs to check for errors""" %
+               (LOG_FILE_KEY, RETRY_KEY, EXTRA_XML_KEY),
        formatter_class=argparse.RawTextHelpFormatter)
 argparser.add_argument('-s', '--signal', dest='signal', metavar='signal', default='TERM',
        help="Send this signal to the command on timeout, instead of TERM.")
@@ -148,6 +183,7 @@ global_env = copy.deepcopy( os.environ )
 verbose = VERBOSE_KEY in global_env
 logging = LOG_FILE_KEY in global_env
 logfile = global_env[LOG_FILE_KEY] if logging else None
+xml_list = global_env[EXTRA_XML_KEY].split(";") if EXTRA_XML_KEY in global_env and global_env[EXTRA_XML_KEY] else []
 crash_resuming = True # TODO: Consider exposing this option, or adding a retry_on_crash option.
 failmax = int(global_env[RETRY_KEY]) if RETRY_KEY in global_env else 0
 babysitting = True # If false, babysitter becomes a timeout clone with no env manipulation or anything.
@@ -156,6 +192,7 @@ if babysitting:
        global_env[CURRENT_TEST_KEY] = os.path.join(babysitter_dir, CURRENT_TEST_FILE)
        global_env[RAN_TEST_KEY]     = os.path.join(babysitter_dir, RAN_TEST_FILE)
        global_env[FAILED_TEST_KEY]  = os.path.join(babysitter_dir, FAILED_TEST_FILE)
+       global_env[XML_LIST_KEY]     = os.path.join(babysitter_dir, XML_LIST_FILE)
 
 have_unix_process_groups = 'killpg' in os.__dict__
 have_windows_process_groups = 'CREATE_NEW_PROCESS_GROUP' in subprocess.__dict__
@@ -251,7 +288,7 @@ def run(): # Returns exit code
 
        # Set up logging
        log = {DATE_JSON: posixtime(), COUNT_JSON:0, LIMIT_JSON:failmax, SUPPORT_JSON:False,
-               INVOKE_JSON: " ".join(command)}
+               LOADED_XML_JSON:False, INVOKE_JSON: " ".join(command)}
 
        def log_value(key, set=None, add=None, target=log): # Call to add toplevel value to log
                if add is not None:
@@ -281,7 +318,7 @@ def run(): # Returns exit code
 
                        # Prepare environment/filesystem
                        if babysitting:
-                               for key in [CURRENT_TEST_KEY, RAN_TEST_KEY, FAILED_TEST_KEY]:
+                               for key in [CURRENT_TEST_KEY, RAN_TEST_KEY, FAILED_TEST_KEY, XML_LIST_KEY]:
                                        attemptDelete(env[key])
                                if resume_after:
                                        env[RUN_KEY] = ";".join(resume_after)
@@ -322,6 +359,7 @@ def run(): # Returns exit code
                        crashed_at = attemptFirstLine(env[CURRENT_TEST_KEY])
                        failed_tests = attemptLines(env[FAILED_TEST_KEY])
                        ran_tests = attemptLines(env[RAN_TEST_KEY])
+                       wrote_xml = attemptLines(env[XML_LIST_KEY])
                        bailout = False
 
                        if crashed_at or failed_tests or ran_tests: # Test suite follows the babysitter protocol
@@ -374,12 +412,41 @@ def run(): # Returns exit code
                                        message += " Test suite terminated with code %d, " % (code)
                                        if log[SUPPORT_JSON]:
                                                message += "but failure did not occur during a test case. Halting."
+                                       elif xml_list or wrote_xml:
+                                               message += "will extract test results from XML. Halting."
                                        else:
                                                message += "and suite cannot report test case data. Halting."
                                elif bailout:
                                        message += " Will halt testing."
                                print(message)
 
+                       if not log[SUPPORT_JSON]:
+                               for xml in (xml_list + wrote_xml):
+                                       verbose_print("Will attempt to load XML from %s" % (xml))
+                                       try:
+                                               data = xmlparse(xml).documentElement
+                                               if data.nodeName != 'test-results':
+                                                       raise ValueError("Toplevel element was not <test-results />")
+
+                                               log_value(LOADED_XML_JSON, True)
+
+                                               search = [data]
+                                               while search:
+                                                       nextsearch = []
+                                                       for node in search:
+                                                               for child in node.childNodes:
+                                                                       if child.nodeName == 'test-suite' or child.nodeName == 'results':
+                                                                               nextsearch.append(child) # Descend
+                                                                       elif child.nodeName == 'test-case':
+                                                                               name = child.getAttribute("name")
+                                                                               if child.getAttribute("executed") == "True" and child.getAttribute("success") != "True":
+                                                                                       log_test(name, TEST_FAILURES, add=1)
+
+                                                       search = nextsearch
+                                       except Exception as e:
+                                               print("Could not load XML file %s. Reason: %s" % (xml, e))
+                                       data
+
                        if bailout or not (resume_after or retry_next): # If not retrying
                                return code
 
index 17656e390a572516baf18e227d260af94c972691..b202c2493fb11fac4ff3acf6dce92f6ecb56e979 100755 (executable)
@@ -17,13 +17,13 @@ if [[ ${label} == 'osx-amd64' ]]; then EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --w
 if [[ ${label} == 'w32' ]]; then PLATFORM=Win32; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=i686-w64-mingw32"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\build\\\sgen\\\Win32\\\bin\\\Release\\\mono-sgen.exe`"; fi
 if [[ ${label} == 'w64' ]]; then PLATFORM=x64; EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --host=x86_64-w64-mingw32 --disable-boehm"; export MONO_EXECUTABLE="`cygpath -u ${WORKSPACE}\\\msvc\\\build\\\sgen\\\x64\\\bin\\\Release\\\mono-sgen.exe`"; fi
 
-if [[ ${CI_TAGS} == 'mobile_static' ]];
+if [[ ${CI_TAGS} == *'mobile_static'* ]];
     then
     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --with-runtime_preset=mobile_static";
-elif [[ ${CI_TAGS} == 'acceptance-tests' ]];
+elif [[ ${CI_TAGS} == *'acceptance-tests'* ]];
     then
     EXTRA_CONF_FLAGS="${EXTRA_CONF_FLAGS} --prefix=${WORKSPACE}/tmp/mono-acceptance-tests --with-sgen-default-concurrent=yes";
-elif [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]];
+elif [[ ${label} != w* ]] && [[ ${label} != 'debian-ppc64el' ]] && [[ ${label} != 'centos-s390x' ]] && [[ ${CI_TAGS} != *'monolite'* ]];
     then
     # Override the defaults to skip profiles
     # only enable the mobile profiles and mobile_static on the main architectures
@@ -48,14 +48,17 @@ if [[ ${label} == w* ]];
     then
     ${TESTCMD} --label=make-msvc-sgen --timeout=60m --fatal /cygdrive/c/Program\ Files\ \(x86\)/MSBuild/14.0/Bin/MSBuild.exe /p:PlatformToolset=v140 /p:Platform=${PLATFORM} /p:Configuration=Release /p:MONO_TARGET_GC=sgen msvc/mono.sln
 fi
-${TESTCMD} --label=make --timeout=300m --fatal make -w V=1
+
+if [[ ${CI_TAGS} == *'monolite'* ]]; then make get-monolite-latest; fi
+
+${TESTCMD} --label=make --timeout=300m --fatal make -j4 -w V=1
 if [[ -n "${ghprbPullId}" ]] && [[ ${label} == w* ]];
     then
     exit 0
     # we don't run the test suite on Windows PRs, we just ensure the build succeeds, so end here
 fi
 
-if [[ ${CI_TAGS} == 'acceptance-tests' ]];
+if [[ ${CI_TAGS} == *'acceptance-tests'* ]];
 then $(dirname "${BASH_SOURCE[0]}")/run-test-acceptance-tests.sh
 else make check-ci
 fi
\ No newline at end of file
index 136f2b71878105b87fdcb5ccb5faa0f1cc943646..92fca755371d09ab6336dd25c5c131d014c47d7d 100644 (file)
@@ -3922,12 +3922,17 @@ int Mono_Posix_ToMountFlags (guint64 x, guint64 *r)
 int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
 {
        *r = 0;
+#ifndef __NetBSD__
        if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) == Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
 #ifdef MREMAP_MAYMOVE
                *r |= MREMAP_MAYMOVE;
 #else /* def MREMAP_MAYMOVE */
                {errno = EINVAL; return -1;}
 #endif /* ndef MREMAP_MAYMOVE */
+#else /* def __NetBSD__ */
+       if ((x & Mono_Posix_MremapFlags_MREMAP_MAYMOVE) != Mono_Posix_MremapFlags_MREMAP_MAYMOVE)
+               *r = MAP_FIXED;
+#endif /* def __NetBSD__ */
        if (x == 0)
                return 0;
        return 0;
@@ -3936,12 +3941,17 @@ int Mono_Posix_FromMremapFlags (guint64 x, guint64 *r)
 int Mono_Posix_ToMremapFlags (guint64 x, guint64 *r)
 {
        *r = 0;
+#ifndef __NetBSD__
        if (x == 0)
                return 0;
 #ifdef MREMAP_MAYMOVE
        if ((x & MREMAP_MAYMOVE) == MREMAP_MAYMOVE)
                *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
 #endif /* ndef MREMAP_MAYMOVE */
+#else /* def __NetBSD__ */
+       if ((x & MAP_FIXED) != MAP_FIXED)
+               *r |= Mono_Posix_MremapFlags_MREMAP_MAYMOVE;
+#endif
        return 0;
 }
 
@@ -9314,4 +9324,3 @@ int Mono_Posix_ToXattrFlags (int x, int *r)
 #endif /* ndef XATTR_REPLACE */
        return 0;
 }
-
index 3973bd6614f7199b3e4585bbf367c89301219a64..15e125621d2d03b1596d3ed737dcab38019d8430 100644 (file)
@@ -109,8 +109,15 @@ Mono_Posix_Syscall_mremap (void *old_address, mph_size_t old_size,
        if (Mono_Posix_FromMremapFlags (flags, &_flags) == -1)
                return MAP_FAILED;
 
+#if defined(linux)
        return mremap (old_address, (size_t) old_size, (size_t) new_size,
                        (unsigned long) _flags);
+#elif defined(__NetBSD__)
+       return mremap (old_address, (size_t) old_size, old_address,
+                       (size_t) new_size, (unsigned long) _flags);
+#else
+#error Port me
+#endif
 }
 #endif /* def HAVE_MREMAP */