Merge pull request #1300 from esdrubal/unixrelativeorabsolute
authorMarek Safar <marek.safar@gmail.com>
Tue, 23 Sep 2014 14:11:15 +0000 (05:11 -0900)
committerMarek Safar <marek.safar@gmail.com>
Tue, 23 Sep 2014 14:11:15 +0000 (05:11 -0900)
Uri made from UNIX path and RelativeOrAbsolute is now relative.

161 files changed:
mcs/Makefile
mcs/build/profiles/mobile.make
mcs/build/profiles/mobile_static.make
mcs/build/profiles/monodroid.make
mcs/build/profiles/monotouch.make
mcs/class/Makefile
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListView.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ConsoleLogger.cs
mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/TargetBatchingImpl.cs
mcs/class/Microsoft.Build.Utilities/Microsoft.Build.Utilities/ToolTask.cs
mcs/class/Microsoft.Build.Utilities/Test/Microsoft.Build.Utilities/ToolTaskTest.cs
mcs/class/Mono.CSharp/Makefile
mcs/class/Mono.CSharp/mobile_static_Mono.CSharp.dll.sources [new file with mode: 0644]
mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds42.cs
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds50.cs
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs
mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsConnectionParameters.cs
mcs/class/Mono.Dynamic.Interpreter/Makefile
mcs/class/Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs
mcs/class/Mono.Security/Mono.Security.X509/X509Store.cs
mcs/class/System.ComponentModel.Composition.4.5/Makefile
mcs/class/System.ComponentModel.DataAnnotations/Makefile
mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources [new file with mode: 0644]
mcs/class/System.Core/Makefile
mcs/class/System.Core/mobile_System.Core.dll.sources
mcs/class/System.Core/mobile_common_System.Core.dll.sources [new file with mode: 0644]
mcs/class/System.Core/mobile_static_System.Core.dll.sources [new file with mode: 0644]
mcs/class/System.Core/monodroid_System.Core.dll.sources
mcs/class/System.Core/monotouch_System.Core.dll.sources
mcs/class/System.Core/xammac_System.Core.dll.sources
mcs/class/System.Data.Services.Client/mobile_System.Data.Services.Client.dll.sources
mcs/class/System.Data/System.Data.SqlClient/SqlConnection.cs
mcs/class/System.Data/System.Data.SqlClient/SqlCredential.cs [new file with mode: 0644]
mcs/class/System.Data/System.Data.dll.sources
mcs/class/System.Interactive.Async/Makefile
mcs/class/System.Interactive.Providers/Makefile
mcs/class/System.Interactive/Makefile
mcs/class/System.Numerics/Test/System.Numerics/BigIntegerTest.cs
mcs/class/System.Reactive.Core/Makefile
mcs/class/System.Reactive.Debugger/Makefile
mcs/class/System.Reactive.Experimental/Makefile
mcs/class/System.Reactive.Interfaces/Makefile
mcs/class/System.Reactive.Linq/Makefile
mcs/class/System.Reactive.PlatformServices/Makefile
mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
mcs/class/System.ServiceModel/System.ServiceModel/ClientRuntimeChannel.cs
mcs/class/System.XML/Makefile
mcs/class/System.Xaml/Makefile
mcs/class/System/Makefile
mcs/class/System/System.Diagnostics/DiagnosticsConfigurationHandler.cs
mcs/class/System/Test/System.Diagnostics/DiagnosticsConfigurationHandlerTest.cs
mcs/class/corlib/Test/System.Threading/ThreadTest.cs
mcs/errors/cs0111-12.cs [new file with mode: 0644]
mcs/errors/cs0411-24.cs [new file with mode: 0644]
mcs/errors/cs0516-3.cs [new file with mode: 0644]
mcs/errors/cs0516.cs
mcs/errors/cs0568.cs [deleted file]
mcs/errors/cs0619-58.cs [new file with mode: 0644]
mcs/errors/cs0815-7.cs [new file with mode: 0644]
mcs/errors/cs0841-5.cs [new file with mode: 0644]
mcs/errors/cs1501-18.cs [new file with mode: 0644]
mcs/errors/cs1503-17.cs [new file with mode: 0644]
mcs/errors/cs1615-3.cs [new file with mode: 0644]
mcs/errors/cs1644-45.cs [new file with mode: 0644]
mcs/errors/cs1644-46.cs [new file with mode: 0644]
mcs/errors/cs1644-47.cs [new file with mode: 0644]
mcs/errors/cs8046.cs [new file with mode: 0644]
mcs/errors/cs8047.cs [new file with mode: 0644]
mcs/errors/cs8054-2.cs [deleted file]
mcs/errors/cs8054-3.cs [deleted file]
mcs/errors/cs8054.cs [deleted file]
mcs/errors/cs8075.cs [new file with mode: 0644]
mcs/mcs/class.cs
mcs/mcs/cs-parser.jay
mcs/mcs/dynamic.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/generic.cs
mcs/mcs/method.cs
mcs/mcs/typespec.cs
mcs/tests/gtest-624.cs [new file with mode: 0644]
mcs/tests/gtest-autoproperty-10.cs [new file with mode: 0644]
mcs/tests/gtest-etree-01.cs
mcs/tests/gtest-lambda-36.cs [new file with mode: 0644]
mcs/tests/gtest-optional-34.cs [new file with mode: 0644]
mcs/tests/test-906.cs [new file with mode: 0644]
mcs/tests/test-decl-expr-01.cs [new file with mode: 0644]
mcs/tests/test-primary-ctor-07.cs
mcs/tests/ver-il-net_4_5.xml
mcs/tools/mdoc/Makefile
mcs/tools/mdoc/Mono.Documentation/monodocer.cs
mcs/tools/mdoc/Test/DocTest-DropNS-classic-secondary.cs [new file with mode: 0644]
mcs/tools/mdoc/Test/DocTest-DropNS-classic.cs [new file with mode: 0644]
mcs/tools/mdoc/Test/DocTest-DropNS-unified.cs [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/MyFramework.MyNamespace/MyClass.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/index.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/ns-MyFramework.MyNamespace.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/MyFramework.MyNamespace/MyClass.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/index.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/ns-MyFramework.MyNamespace.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/MyFramework.MyNamespace/MyClass.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/MyFramework.MyOtherNamespace/MyOtherClass.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/index.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/ns-MyFramework.MyNamespace.xml [new file with mode: 0644]
mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/ns-MyFramework.MyOtherNamespace.xml [new file with mode: 0644]
mcs/tools/mkbundle/mkbundle.cs
mcs/tools/security/Makefile
mcs/tools/security/cert-sync.cs [new file with mode: 0644]
mono/io-layer/io.c
mono/metadata/appdomain.c
mono/metadata/culture-info-tables.h
mono/metadata/decimal.c
mono/metadata/domain.c [changed mode: 0644->0755]
mono/metadata/loader.c
mono/metadata/loader.h
mono/metadata/metadata-internals.h
mono/metadata/mono-config.c
mono/metadata/reflection.c
mono/metadata/sgen-cardtable.c
mono/metadata/sgen-copy-object.h
mono/metadata/sgen-minor-copy-object.h
mono/metadata/threads.c
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/cpu-amd64.md [changed mode: 0644->0755]
mono/mini/cpu-arm64.md
mono/mini/debugger-agent.c
mono/mini/exceptions-amd64.c
mono/mini/exceptions-arm.c
mono/mini/exceptions-x86.c [changed mode: 0644->0755]
mono/mini/method-to-ir.c [changed mode: 0644->0755]
mono/mini/mini-amd64.c [changed mode: 0644->0755]
mono/mini/mini-amd64.h [changed mode: 0644->0755]
mono/mini/mini-llvm.c
mono/mini/mini-sparc.c [changed mode: 0644->0755]
mono/mini/mini-trampolines.c
mono/mini/mini-windows.c
mono/mini/mini.c [changed mode: 0644->0755]
mono/mini/mini.h [changed mode: 0644->0755]
mono/mini/tramp-amd64.c [changed mode: 0644->0755]
mono/mini/xdebug.c
mono/profiler/perf_event.h
mono/profiler/proflog.c
mono/tests/Makefile.am
mono/tests/gc-copy-stress.cs [new file with mode: 0644]
mono/tests/stress-runner.pl
mono/utils/mono-compiler.h
mono/utils/mono-context.c
mono/utils/mono-context.h
mono/utils/mono-dl.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-windows.c [changed mode: 0644->0755]
mono/utils/mono-threads.c
mono/utils/mono-threads.h
msvc/mono.props
scripts/Makefile.am
tools/locale-builder/Driver.cs

index af4495e9195b9df5acbcb5f82db0c1aa48fe13fa..9bcf32ea2fbfbe292037fee9077a50c53ba86ec8 100644 (file)
@@ -12,6 +12,7 @@ monotouch_SUBDIRS := build class
 monotouch_runtime_SUBDIRS := build class
 xammac_SUBDIRS := build class
 mobile_SUBDIRS := build class
+mobile_static_SUBDIRS := build class
 net_3_5_SUBDIRS := build class tools/xbuild
 net_4_0_SUBDIRS := build class
 net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
@@ -114,6 +115,7 @@ $(_boot_:%=profile-do--monotouch--%):         profile-do--monotouch--%:
 $(_boot_:%=profile-do--monotouch_runtime--%):  profile-do--monotouch_runtime--%:  profile-do--build--%
 $(_boot_:%=profile-do--xammac--%):            profile-do--xammac--%:            profile-do--build--%
 $(_boot_:%=profile-do--mobile--%):            profile-do--mobile--%:         profile-do--build--%
+$(_boot_:%=profile-do--mobile_static--%):     profile-do--mobile_static--%:     profile-do--build--%
 $(_boot_:%=profile-do--net_2_0--%):           profile-do--net_2_0--%:           profile-do--build--%
 $(_boot_:%=profile-do--build--%):             profile-do--build--%:             profile-do--basic--%
 
index 87c51f407c88e1fa23c79ec1f0b0b3b0ba0eb814..117ac6051512b75ac1cbf8b82af38c9185e86339 100644 (file)
@@ -12,7 +12,22 @@ profile-check:
        @:
 
 DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:MOBILE -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+
+PROFILE_MCS_FLAGS = \
+       -d:NET_1_1 \
+       -d:NET_2_0 \
+       -d:NET_2_1 \
+       -d:MOBILE \
+       -d:MOBILE_DYNAMIC \
+       -d:NET_3_5 \
+       -d:NET_4_0 \
+       -d:NET_4_5 \
+       -nowarn:1699 \
+       -nostdlib \
+       -lib:$(topdir)/class/lib/$(PROFILE) \
+       $(DEFAULT_REFERENCES) \
+       $(PLATFORM_DEBUG_FLAGS)
+
 FRAMEWORK_VERSION = 2.1
 
 NO_INSTALL = yes
index 59505666ad77c642821555b849cc1e04f4d550af..b789823519463da50495b379d55a7837c5c7e188 100644 (file)
@@ -12,7 +12,24 @@ profile-check:
        @:
 
 DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE -d:FULL_AOT_RUNTIME -d:DISABLE_REMOTING -d:DISABLE_COM -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+
+PROFILE_MCS_FLAGS = \
+       -d:NET_1_1 \
+       -d:NET_2_0 \
+       -d:NET_2_1 \
+       -d:NET_3_5 \
+       -d:NET_4_0 \
+       -d:NET_4_5 \
+       -d:MOBILE \
+       -d:FULL_AOT_RUNTIME \
+       -d:DISABLE_REMOTING \
+       -d:DISABLE_COM \
+       -nowarn:1699 \
+       -nostdlib \
+       -lib:$(topdir)/class/lib/$(PROFILE) \
+       $(DEFAULT_REFERENCES) \
+       $(PLATFORM_DEBUG_FLAGS)
+
 FRAMEWORK_VERSION = 2.1
 NO_TEST = yes
 
index 7336ced7b7bb07cbc51d343dbdfb5ef900a1ead0..c14f61c6087ffe40bcc4dc05ea6eec4846d16d99 100644 (file)
@@ -12,7 +12,24 @@ profile-check:
        @:
 
 DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE -d:MOBILE_DYNAMIC -d:MONODROID -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+
+PROFILE_MCS_FLAGS = \
+       -d:NET_1_1 \
+       -d:NET_2_0 \
+       -d:NET_2_1 \
+       -d:NET_3_5 \
+       -d:NET_4_0 \
+       -d:NET_4_5 \
+       -d:MOBILE \
+       -d:MOBILE_DYNAMIC \
+       -d:MONODROID \
+       -d:ANDROID \
+       -nowarn:1699 \
+       -nostdlib \
+       -lib:$(topdir)/class/lib/$(PROFILE) \
+       $(DEFAULT_REFERENCES) \
+       $(PLATFORM_DEBUG_FLAGS)
+
 FRAMEWORK_VERSION = 2.1
 NO_TEST = yes
 
index b841a1027ae77586dd2bc67ee774493311eba346..706463d748cd4c1021e2dd5b4bca32c4c99f4ae3 100644 (file)
@@ -12,9 +12,27 @@ profile-check:
        @:
 
 DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MOBILE -d:MONOTOUCH -d:DISABLE_REMOTING -d:DISABLE_COM -d:FULL_AOT_RUNTIME -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+
+PROFILE_MCS_FLAGS = \
+       -d:NET_1_1 \
+       -d:NET_2_0 \
+       -d:NET_2_1 \
+       -d:NET_3_5 \
+       -d:NET_4_0 \
+       -d:NET_4_5 \
+       -d:MOBILE \
+       -d:MONOTOUCH \
+       -d:DISABLE_REMOTING \
+       -d:DISABLE_COM \
+       -d:FULL_AOT_RUNTIME \
+       -nowarn:1699 \
+       -nostdlib \
+       -lib:$(topdir)/class/lib/$(PROFILE) \
+       $(DEFAULT_REFERENCES) \
+       $(PLATFORM_DEBUG_FLAGS)
+
 FRAMEWORK_VERSION = 2.1
 NO_TEST = yes
 
 # the tuner takes care of the install
-NO_INSTALL = yes
\ No newline at end of file
+NO_INSTALL = yes
index 47cf334888e2e3ab98b6b9167124b2002a7b9ba6..8ca914dca5373d0df05d5f3c483ae2bccc3d8ba6 100644 (file)
@@ -106,7 +106,7 @@ net_2_0_only_dirs := \
 
 pcl_facade_dirs := Facades
 
-mobile_dirs := \
+mobile_common_dirs := \
        corlib  \
        System  \
        System.Core     \
@@ -134,19 +134,27 @@ mobile_dirs := \
        System.Net \
        System.Windows \
        System.Xml.Serialization \
+       Mono.CSharp     \
+       Microsoft.CSharp \
        $(pcl_facade_dirs)
 
-monodroid_dirs := \
+mobile_static_dirs := \
+       $(mobile_common_dirs)   \
+       Mono.Dynamic.Interpreter
+
+mobile_dynamic_dirs := \
+       $(mobile_common_dirs)   \
        Mono.CompilerServices.SymbolWriter      \
-       Mono.CSharp     \
-       Microsoft.CSharp \
        System.Net.Http
 
 xammac_dirs := \
-       Mono.CompilerServices.SymbolWriter      \
-       Mono.CSharp     \
-       Microsoft.CSharp \
-       System.Net.Http
+       $(mobile_dynamic_dirs)
+
+monodroid_dirs := \
+       $(mobile_dynamic_dirs)
+
+monotouch_dirs := \
+       $(mobile_static_dirs)
 
 monotouch_runtime_dirs := \
        corlib \
@@ -155,11 +163,6 @@ monotouch_runtime_dirs := \
        System.XML \
        Mono.CSharp
 
-monotouch_dirs := \
-       Mono.CSharp     \
-       Microsoft.CSharp \
-       Mono.Dynamic.Interpreter
-
 net_4_0_dirs := \
        System.Numerics         \
        Microsoft.CSharp        \
@@ -229,12 +232,12 @@ xbuild_4_0_dirs := \
        Microsoft.Build
 
 net_2_0_SUBDIRS := $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
-monodroid_SUBDIRS := $(mobile_dirs) $(monodroid_dirs)
-monotouch_SUBDIRS := $(mobile_dirs) $(monotouch_dirs)
+monodroid_SUBDIRS := $(monodroid_dirs)
+monotouch_SUBDIRS := $(monotouch_dirs)
 monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
-mobile_static_SUBDIRS := $(mobile_dirs)
-mobile_SUBDIRS := $(mobile_dirs)
-xammac_SUBDIRS := $(mobile_dirs) $(xammac_dirs)
+mobile_static_SUBDIRS := $(mobile_static_dirs)
+mobile_SUBDIRS := $(mobile_dynamic_dirs)
+xammac_SUBDIRS := $(xammac_dirs)
 net_3_5_SUBDIRS := $(xbuild_2_0_dirs)
 net_4_0_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
 net_4_5_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
@@ -242,7 +245,7 @@ xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
 
 include ../build/rules.make
 
-SUBDIRS = $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_dirs) $(monotouch_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
+SUBDIRS = $(net_2_0_dirs) $(net_2_0_only_dirs) $(mobile_static_dirs) $(mobile_dynamic_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(net_4_5_dirs)
 
 DIST_ONLY_SUBDIRS = dlr aot-compiler $(xbuild_4_0_dirs)
 
index f7075e8ef8f7cfbc0c67a85dbedc54b114523b38..3af4684710ade1ef9420d2e56c7319fc0e32c4cd 100644 (file)
@@ -3663,7 +3663,8 @@ namespace System.Windows.Forms
                        if (View != View.Details) {
                                if (bounds.Left < 0)
                                        h_scroll.Value += bounds.Left;
-                               else if (bounds.Right > view_rect.Right)
+                               // Don't shift right unless right-to-left layout is active. (Xamarin bug 22483)
+                               else if (this.RightToLeftLayout && bounds.Right > view_rect.Right)
                                        h_scroll.Value += (bounds.Right - view_rect.Right);
                        }
 
index 5fb7d21899cb771de2ce7d34dfded611aebfc06e..0d776b9fbb25151d8cb566099d2e858ff4d0fe9e 100644 (file)
@@ -1018,13 +1018,27 @@ namespace Microsoft.Build.BuildEngine
                        if (!StartHandlerHasExecuted)
                                return;
 
-                       if (EventArgs is ProjectStartedEventArgs)
-                               ConsoleLogger.ProjectFinishedHandler (Sender, finished_args as ProjectFinishedEventArgs);
-                       else if (EventArgs is TargetStartedEventArgs)
-                               ConsoleLogger.TargetFinishedHandler (Sender, finished_args as TargetFinishedEventArgs);
-                       else if (EventArgs is TaskStartedEventArgs)
-                               ConsoleLogger.TaskFinishedHandler (Sender, finished_args as TaskFinishedEventArgs);
-                       else if (!(EventArgs is BuildStartedEventArgs))
+                       if (EventArgs is ProjectStartedEventArgs) {
+                               var pfa = finished_args as ProjectFinishedEventArgs;
+                               // FIXME: BuildFinishedHandlerActual sends us BuildFinishedEventArgs via PopEvent
+                               if (pfa == null)
+                                       return;
+
+                               ConsoleLogger.ProjectFinishedHandler (Sender, pfa);
+                       } else if (EventArgs is TargetStartedEventArgs) {
+                               var fa = finished_args as TargetFinishedEventArgs;
+                               // FIXME: BuildFinishedHandlerActual sends us BuildFinishedEventArgs via PopEvent
+                               if (fa == null)
+                                       return;
+
+                               ConsoleLogger.TargetFinishedHandler (Sender, fa);
+                       } else if (EventArgs is TaskStartedEventArgs) {
+                               // FIXME: BuildFinishedHandlerActual sends us BuildFinishedEventArgs via PopEvent
+                               if (!(finished_args is TaskFinishedEventArgs))
+                                       return;
+
+                               ConsoleLogger.TaskFinishedHandler (Sender, (TaskFinishedEventArgs) finished_args);
+                       } else if (!(EventArgs is BuildStartedEventArgs))
                                throw new InvalidOperationException ("Unexpected event on the stack, type: " + EventArgs.GetType ());
                }
        }
index 76284d1660e6d5b9db840a06e32f23105e58d6c7..8597b026b344a2bc2ad9d0d95bd77a7fe27ad2af 100644 (file)
@@ -99,8 +99,12 @@ namespace Microsoft.Build.BuildEngine {
                        try {
                                TaskExecutionMode taskExecutionMode;
                                string reason;
-                               if (!BuildTargetNeeded (out reason)) {
+                               bool skip_completely;
+                               if (!BuildTargetNeeded (out reason, out skip_completely)) {
                                        LogTargetSkipped (target, reason);
+                                       if (skip_completely)
+                                               return true;
+
                                        taskExecutionMode = TaskExecutionMode.SkipAndSetOutput;
                                } else {
                                        taskExecutionMode = TaskExecutionMode.Complete;
@@ -113,8 +117,27 @@ namespace Microsoft.Build.BuildEngine {
                                        //FIXME: parsing attributes repeatedly
                                        IBuildTask bt = target.BuildTasks [i];
 
+                                       // HACK: need some form of cross references checks
+                                       var tem = taskExecutionMode;
+                                       if (tem == TaskExecutionMode.SkipAndSetOutput) {
+                                               var bti = bt as BuildTask;
+
+                                               //
+                                               // BuildTargetNeeded checks only files timestamps but ignores any metadata dependencies
+                                               // that way we can end up in the situation when output metadata are populated but from
+                                               // incomplete dependencies.
+                                               //
+                                               // E.g.
+                                               // <CreateItem Include="$(IntermediateOutputPath)%(_PngImage.LogicalName)" AdditionalMetadata="LogicalName=%(_PngImage.LogicalName)">
+                                               //              <Output TaskParameter="Include" />
+                                               // </CreateItem>
+                                               //
+                                               if (bti != null && bti.Name == "CreateItem")
+                                                       tem = TaskExecutionMode.Complete;
+                                       }
+
                                        TaskBatchingImpl batchingImpl = new TaskBatchingImpl (project);
-                                       bool task_result = batchingImpl.Build (bt, taskExecutionMode, out executeOnErrors);
+                                       bool task_result = batchingImpl.Build (bt, tem, out executeOnErrors);
                                        if (task_result)
                                                continue;
 
@@ -149,15 +172,17 @@ namespace Microsoft.Build.BuildEngine {
                                ParseAttribute (outputs);
                }
 
-               bool BuildTargetNeeded (out string reason)
+               bool BuildTargetNeeded (out string reason, out bool skipCompletely)
                {
                        reason = String.Empty;
                        ITaskItem [] inputFiles;
                        ITaskItem [] outputFiles;
                        DateTime youngestInput, oldestOutput;
+                       skipCompletely = false;
 
-                       if (String.IsNullOrEmpty (inputs.Trim ()))
+                       if (String.IsNullOrEmpty (inputs.Trim ())) {
                                return true;
+                       }
 
                        if (String.IsNullOrEmpty (outputs.Trim ())) {
                                project.ParentEngine.LogError ("Target {0} has inputs but no outputs specified.", name);
@@ -178,6 +203,7 @@ namespace Microsoft.Build.BuildEngine {
                        }
 
                        if (inputFiles == null || inputFiles.Length == 0) {
+                               skipCompletely = true;
                                reason = String.Format ("No input files were specified for target {0}, skipping.", name);
                                return false;
                        }
index 74dfe4ee4fb1c13bb4b0bc909b83e339c3dc226f..572c75c1bfa48d9a365347ce5e22116c0d89a46a 100644 (file)
@@ -100,10 +100,13 @@ namespace Microsoft.Build.Utilities
                                if (string.IsNullOrEmpty (tp))
                                        return null;
 
-                               tp = Path.GetDirectoryName (tp);
-                               if (string.IsNullOrEmpty (tp))
-                                       tp = Directory.GetCurrentDirectory ();
+                               //
+                               // GenerateFullPathToTool can return path including tool name
+                               //
+                               if (string.IsNullOrEmpty (ToolExe))
+                                       return tp;
 
+                               tp = Path.GetDirectoryName (tp);
                        } else {
                                tp = ToolPath;
                        }
index bfd7c038eae47ed1523d21a13e201fbaddba410b..7c2a3843b62756086cbee792e2777bcb49c65062 100644 (file)
@@ -462,16 +462,16 @@ namespace MonoTests.Microsoft.Build.Utilities {
                        var t = new TestExecuteToolTask ();
                        t.FullPathToTool = "fpt";
                        t.BuildEngine = new MockBuildEngine ();
-                       t.ToolExe = "Makefile";
+                       t.ToolExe = "Makefile.mk";
 
                        t.OnExecuteTool = (pathToTool, responseFileCommands, commandLineCommands) => {
-                               Assert.AreEqual (Path.Combine (Directory.GetCurrentDirectory (), "Makefile"), pathToTool, "#1");
+                               Assert.AreEqual ("Makefile.mk", pathToTool, "#1");
                                Assert.AreEqual ("", responseFileCommands, "#2");
                                Assert.AreEqual ("", commandLineCommands, "#3");
 
                        };
 
-                       Assert.IsTrue (t.Execute (), "result");
+                       Assert.IsFalse (t.Execute (), "result");
                }
        }
 
index 85b86e0f4669a7666d8dec465e61e42cdecc9180..35ee0a302bc988447457c21c01aab18932af395e 100644 (file)
@@ -6,7 +6,9 @@ LIBRARY = Mono.CSharp.dll
 
 LIB_MCS_FLAGS = -r:System.Core.dll -r:System.Xml.dll -r:System.dll
 
-ifeq (monotouch, $(PROFILE))
+MOBILE_STATIC := $(filter mobile_static monotouch, $(PROFILE))
+
+ifdef MOBILE_STATIC
 LIB_MCS_FLAGS += -d:IOS_REFLECTION
 endif
 
diff --git a/mcs/class/Mono.CSharp/mobile_static_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/mobile_static_Mono.CSharp.dll.sources
new file mode 100644 (file)
index 0000000..6e4c342
--- /dev/null
@@ -0,0 +1,13 @@
+#include Mono.CSharp.dll.sources
+../corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
+../corlib/System.Reflection.Emit/FlowControl.cs
+../corlib/System.Reflection.Emit/OpCode.cs
+../corlib/System.Reflection.Emit/OpCodeNames.cs
+../corlib/System.Reflection.Emit/OpCodes.cs
+../corlib/System.Reflection.Emit/OpCodeType.cs
+../corlib/System.Reflection.Emit/OperandType.cs
+../corlib/System.Reflection.Emit/PEFileKinds.cs
+../corlib/System.Reflection.Emit/Label.cs
+../corlib/System.Reflection.Emit/MethodToken.cs
+../corlib/System.Reflection.Emit/StackBehaviour.cs
+monotouch.cs
\ No newline at end of file
index 6e4c34213bef7492a92ebe8bffe05870ec86de3c..6a71501e34c7b5bdb833a64e5e5c5f71d406c512 100644 (file)
@@ -1,13 +1,2 @@
-#include Mono.CSharp.dll.sources
-../corlib/System.Reflection.Emit/AssemblyBuilderAccess.cs
-../corlib/System.Reflection.Emit/FlowControl.cs
-../corlib/System.Reflection.Emit/OpCode.cs
-../corlib/System.Reflection.Emit/OpCodeNames.cs
-../corlib/System.Reflection.Emit/OpCodes.cs
-../corlib/System.Reflection.Emit/OpCodeType.cs
-../corlib/System.Reflection.Emit/OperandType.cs
-../corlib/System.Reflection.Emit/PEFileKinds.cs
-../corlib/System.Reflection.Emit/Label.cs
-../corlib/System.Reflection.Emit/MethodToken.cs
-../corlib/System.Reflection.Emit/StackBehaviour.cs
-monotouch.cs
\ No newline at end of file
+#include mobile_static_Mono.CSharp.dll.sources
+monotouch.cs
index 6865df9adbed27a38fcc7d789b427bc682938cb4..f06932c802620d1fed8f3fcb74fb9d5e0fb1ee26 100644 (file)
@@ -41,7 +41,9 @@ using System.ComponentModel;
 using System.Diagnostics;
 using System.Net.Sockets;
 using System.Globalization;
+using System.Security;
 using System.Text;
+using System.Runtime.InteropServices;
 
 namespace Mono.Data.Tds.Protocol
 {
@@ -1468,7 +1470,7 @@ namespace Mono.Data.Tds.Protocol
                        t3.Domain = this.connectionParms.DefaultDomain;
                        t3.Host = this.connectionParms.Hostname;
                        t3.Username = this.connectionParms.User;
-                       t3.Password = this.connectionParms.Password;
+                       t3.Password = GetPlainPassword(this.connectionParms.Password);
 
                        Comm.StartPacket (TdsPacketType.SspAuth); // 0x11
                        Comm.Append (t3.GetBytes ());
@@ -1919,6 +1921,20 @@ namespace Mono.Data.Tds.Protocol
                        comm.Skip(4);
                }
 
+               public static string GetPlainPassword(SecureString secPass)
+               {
+                       IntPtr plainString = IntPtr.Zero;
+                       try
+                       {
+                               plainString = Marshal.SecureStringToGlobalAllocUnicode(secPass);
+                               return Marshal.PtrToStringUni(plainString);
+                       }
+                       finally
+                       {
+                               Marshal.ZeroFreeGlobalAllocUnicode(plainString);
+                       }
+               }
+
                #endregion // Private Methods
 
 #if NET_2_0
index fdca83087b1cc65b930f7218a481968462430fa5..fb517d013d55841d99f8602154b2826e0e793fc9 100644 (file)
@@ -29,6 +29,7 @@
 //
 
 using System;
+using System.Security;
 
 namespace Mono.Data.Tds.Protocol {
         public sealed class Tds42 : Tds
@@ -77,7 +78,7 @@ namespace Mono.Data.Tds.Protocol {
                        Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
 
                        // password (offset 62 0x3e)
-                       tmp = Comm.Append (connectionParameters.Password, 30, pad);
+                       tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 30, pad);
                        Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
 
                        // hostproc (offset 93 0x5d)
@@ -145,7 +146,7 @@ namespace Mono.Data.Tds.Protocol {
 
                        // remote passwords
                        Comm.Append (empty, 2, pad);
-                       tmp = Comm.Append (connectionParameters.Password, 253, pad);
+                       tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 253, pad);
                        Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
 
                        // tds version
index 0d0e86c023dfa673bf24f67787908c105ffc978e..88219125df5f3d081963aed376c790a6cacc208f 100644 (file)
@@ -31,6 +31,7 @@
 using Mono.Data.Tds;
 using System;
 using System.Text;
+using System.Security;
 
 namespace Mono.Data.Tds.Protocol
 {
@@ -118,7 +119,7 @@ namespace Mono.Data.Tds.Protocol
 
                        // password (offset 62 0x3e)
                        // 62-92
-                       tmp = Comm.Append (connectionParameters.Password, 30, pad);
+                       tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 30, pad);
                        Comm.Append ((byte) (tmp.Length < 30 ? tmp.Length : 30));
 
                        // hostproc (offset 93 0x5d)
@@ -187,7 +188,7 @@ namespace Mono.Data.Tds.Protocol
                        // remote passwords
                        // 202-457      
                        Comm.Append (empty, 2, pad);
-                       tmp = Comm.Append (connectionParameters.Password, 253, pad);
+                       tmp = Comm.Append (GetPlainPassword(connectionParameters.Password), 253, pad);
                        Comm.Append ((byte) (tmp.Length < 253 ? tmp.Length + 2 : 253 + 2));
 
                        // tds version
index c67b6e8c3bb3930186f872afae041c4eacdc8a15..991727bbc00779b3441c2c7020c03f405aa85f76 100644 (file)
@@ -37,6 +37,7 @@
 using System;
 using System.Globalization;
 using System.Text;
+using System.Security;
 
 using Mono.Security.Protocol.Ntlm;
 
@@ -392,11 +393,12 @@ namespace Mono.Data.Tds.Protocol
                        return IsConnected;
                }
 
-               private static string EncryptPassword (string pass)
+               private static string EncryptPassword (SecureString secPass)
                {
                        int xormask = 0x5a5a;
-                       int len = pass.Length;
+                       int len = secPass.Length;
                        char[] chars = new char[len];
+                       string pass = GetPlainPassword(secPass);
 
                        for (int i = 0; i < len; ++i) {
                                int c = ((int) (pass[i])) ^ xormask;
index 19f676077d760f1394248c67f583b748a1044f20..e3b83aa257c9441108183f949910aee8a4c72302 100644 (file)
@@ -31,6 +31,7 @@
 //
 
 using System;
+using System.Security;
 
 namespace Mono.Data.Tds.Protocol
 {
@@ -42,7 +43,8 @@ namespace Mono.Data.Tds.Protocol
                public string Hostname;
                public string Language;
                public string LibraryName;
-               public string Password;
+               public SecureString Password;
+               public bool PasswordSet;
                public string ProgName;
                public string User;
                public bool DomainLogin;
@@ -62,7 +64,8 @@ namespace Mono.Data.Tds.Protocol
                        Hostname = System.Net.Dns.GetHostName();
                        Language = String.Empty;
                        LibraryName = "Mono";
-                       Password = String.Empty;
+                       Password = new SecureString();
+                       PasswordSet = false;
                        ProgName = "Mono";
                        User = String.Empty;
                        DomainLogin = false; 
index 76777611827eb4f543b3967a471e40bbf1ae43d3..bbb733bf693fbf4a6bafd842c33673c2487e1a93 100644 (file)
@@ -9,7 +9,9 @@ LIB_MCS_FLAGS = -r:System.dll -r:System.Core.dll \
        -d:MONO_INTERPRETER \
        -delaysign -keyfile:../mono.pub
 
-ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
+MOBILE_STATIC := $(filter mobile_static monotouch monotouch_runtime, $(PROFILE))
+
+ifdef MOBILE_STATIC
 mono_dynamic_interpreter_deps = $(the_libdir_base)plaincore/System.Core.dll
 LIB_MCS_FLAGS += -lib:$(the_libdir_base)plaincore
 endif
@@ -21,4 +23,4 @@ $(the_libdir_base)Mono.Dynamic.Interpreter.dll: $(mono_dynamic_interpreter_deps)
 $(the_libdir_base)plaincore/System.Core.dll:
        (cd ../System.Core; $(MAKE) $@)
 
-.NOTPARALLEL: $(the_libdir_base)plaincore/System.Core.dll
\ No newline at end of file
+.NOTPARALLEL: $(the_libdir_base)plaincore/System.Core.dll
index f07db9ec101aa7b2eee6c5718198511e7e18809c..14f8c73a8aeab2db00f782a1e971c334048820fe 100644 (file)
@@ -221,15 +221,13 @@ namespace Mono.Security.Cryptography {
                                                                string msg = Locale.GetText ("Could not create user key store '{0}'.");
                                                                throw new CryptographicException (String.Format (msg, _userPath), e);
                                                        }
-
-                                                       if (!ProtectUser (_userPath)) {
-                                                               string msg = Locale.GetText ("Could not secure user key store '{0}'.");
-                                                               throw new IOException (String.Format (msg, _userPath));
-                                                       } 
-
                                                        _userPathExists = true;
                                                }
                                        }
+                                       if (!IsUserProtected (_userPath) && !ProtectUser (_userPath)) {
+                                               string msg = Locale.GetText ("Could not secure user key store '{0}'.");
+                                               throw new IOException (String.Format (msg, _userPath));
+                                       }
                                }
                                // is it properly protected ?
                                if (!IsUserProtected (_userPath)) {
@@ -258,15 +256,13 @@ namespace Mono.Security.Cryptography {
                                                                string msg = Locale.GetText ("Could not create machine key store '{0}'.");
                                                                throw new CryptographicException (String.Format (msg, _machinePath), e);
                                                        }
-
-                                                       if (!ProtectMachine (_machinePath)) {
-                                                               string msg = Locale.GetText ("Could not secure machine key store '{0}'.");
-                                                               throw new IOException (String.Format (msg, _machinePath));
-                                                       }
-
                                                        _machinePathExists = true;
                                                }
                                        }
+                                       if (!IsMachineProtected (_machinePath) && !ProtectMachine (_machinePath)) {
+                                               string msg = Locale.GetText ("Could not secure machine key store '{0}'.");
+                                               throw new IOException (String.Format (msg, _machinePath));
+                                       }
                                }
                                // is it properly protected ?
                                if (!IsMachineProtected (_machinePath)) {
index c4bb4b99afc571ad78443cf986ac88853b898f7a..b22f1b5ae25e12fc20f9250a0e5e4a415b3a49a0 100644 (file)
@@ -236,8 +236,13 @@ namespace Mono.Security.X509 {
                                cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
                        KeyPairPersistence kpp = new KeyPairPersistence (cspParams);
 
-                       if (!kpp.Load ())
+                       try {
+                               if (!kpp.Load ())
+                                       return cert;
+                       }
+                       catch {
                                return cert;
+                       }
 
                        if (cert.RSA != null)
                                cert.RSA = new RSACryptoServiceProvider (cspParams);
index 4fe0fee915e66beb6fa475b0b4d11ae92bcdd157..b71beeab45da7620511d581bb002405abfe37bfb 100644 (file)
@@ -12,7 +12,7 @@ CLEAN_FILES += $(STRING_MESSAGES)
 EXTRA_DISTFILES = \
        src/ComponentModel/Strings.resx
        
-VALID_PROFILE := $(filter net_4_0 net_4_5 monotouch monodroid xammac mobile_static, $(PROFILE))
+VALID_PROFILE := $(filter net_4_0 net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.ComponentModel.Composition.dll
 NO_INSTALL = yes
index 713754ccdb374241ad47bb325e7d6979becd184d..3d9ff9e2586ef8a955a2cd599bd383f4936046aa 100644 (file)
@@ -18,7 +18,7 @@ endif
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 # This is a .NET 3.5+ assembly
-VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5 monotouch monodroid xammac mobile_static, $(PROFILE))
+VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5 monotouch monodroid xammac mobile mobile_static, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.ComponentModel.DataAnnotations.dll
 NO_INSTALL = yes
diff --git a/mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources b/mcs/class/System.ComponentModel.DataAnnotations/mobile_System.ComponentModel.DataAnnotations.dll.sources
new file mode 100644 (file)
index 0000000..3de14f5
--- /dev/null
@@ -0,0 +1 @@
+#include net_4_5_System.ComponentModel.DataAnnotations.dll.sources
index c8836d3125b776fb18810b255ddc82d0bc2c4464..f8cc33c7e8b94afff4a3eb58bfa11aa6c8cc1c0d 100644 (file)
@@ -10,17 +10,16 @@ ifneq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720
 endif
 
-ifeq (monodroid, $(PROFILE))
-LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,ANDROID
-endif
+MOBILE_DYNAMIC := $(filter monodroid xammac mobile, $(PROFILE))
+MOBILE_STATIC := $(filter mobile_static monotouch monotouch_runtime, $(PROFILE))
 
-ifeq (xammac, $(PROFILE))
+ifdef MOBILE_DYNAMIC
 LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT
 endif
 
 system_core_plain_libdir = $(the_libdir_base)plaincore
 
-ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
+ifdef MOBILE_STATIC
 extra_test_flags := -exclude:NotWorkingInterpreter
 system_core_library_deps = $(the_libdir_base)Mono.Dynamic.Interpreter.dll $(system_core_plain_libdir)/System.Core.dll
 LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR
@@ -72,4 +71,4 @@ ifneq ($(PROFILE),basic)
 csproj-local:
        $(MAKE) csproj-local intermediate=plaincore/
 endif
-endif
\ No newline at end of file
+endif
index dee2534a29bba82fc41f2fb2a2371328c7d5380d..5cd8ddf660b42a0bf108f9f4800a4f5b6703e1be 100644 (file)
@@ -1,109 +1,4 @@
-Assembly/AssemblyInfo.cs
-System/Actions.cs
-System/Funcs.cs
-System/InvalidTimeZoneException.cs
-System/TimeZoneInfo.AdjustmentRule.cs
-System/TimeZoneInfo.cs
-System/TimeZoneInfo.Serialization.cs
-System/TimeZoneInfo.TransitionTime.cs
-System/TimeZoneNotFoundException.cs
-System/Util.cs
-System.Runtime.CompilerServices/DynamicAttribute.cs
-System.Runtime.CompilerServices/ExecutionScope.cs
-System.Runtime.CompilerServices/ExtensionAttribute.cs
-System.Runtime.CompilerServices/IStrongBox.cs
-System.Runtime.CompilerServices/StrongBox_T.cs
-System.Linq/Check.cs
-System.Linq/Enumerable.cs
-System.Linq/QueryableEnumerable.cs
-System.Linq/QueryableTransformer.cs
-System.Linq/Grouping.cs
-System.Linq/IGrouping.cs
-System.Linq/IOrderedQueryable.cs
-System.Linq/IOrderedQueryable_T.cs
-System.Linq/IOrderedEnumerable_T.cs
-System.Linq/IQueryable.cs
-System.Linq/IQueryable_T.cs
-System.Linq/Lookup.cs
-System.Linq/ILookup_T.cs
-System.Linq/OrderedEnumerable.cs
-System.Linq/OrderedSequence.cs
-System.Linq/Queryable.cs
-System.Linq/QuickSort.cs
-System.Linq/SortContext.cs
-System.Linq/SortDirection.cs
-System.Linq/SortSequenceContext.cs
-System.Linq/IQueryProvider.cs
-System.Collections.Generic/HashSet.cs
-System.Security.Cryptography/Aes.cs
-System.Threading/LockRecursionPolicy.cs
-System.Threading/ReaderWriterLockSlim.cs
-System.Threading/ThreadLockState.cs
-System.Threading/ReaderWriterLockSlimExtensions.cs
-System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
-System.Linq.Parallel.QueryNodes/QueryCastNode.cs
-System.Linq.Parallel.QueryNodes/QueryChildNode.cs
-System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
-System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
-System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
-System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
-System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
-System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
-System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
-System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
-System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
-System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
-System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
-System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
-System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
-System.Linq.Parallel.QueryNodes/QuerySetNode.cs
-System.Linq.Parallel.QueryNodes/QueryStartNode.cs
-System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
-System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
-System.Linq.Parallel.QueryNodes/QueryZipNode.cs
-System.Linq.Parallel.QueryNodes/SetInclusion.cs
-System.Linq.Parallel.QueryNodes/WrapHelper.cs
-System.Linq.Parallel/AggregationList.cs
-System.Linq.Parallel/ConcurrentGrouping.cs
-System.Linq.Parallel/ConcurrentLookup.cs
-System.Linq.Parallel/INodeVisitor.cs
-System.Linq.Parallel/IVisitableNode.cs
-System.Linq.Parallel/OrderingEnumerator.cs
-System.Linq.Parallel/ParallelExecuter.cs
-System.Linq.Parallel/ParallelPartitioner.cs
-System.Linq.Parallel/ParallelQueryEnumerator.cs
-System.Linq.Parallel/ParallelQuickSort.cs
-System.Linq.Parallel/QueryCheckerVisitor.cs
-System.Linq.Parallel/QueryIsOrderedVisitor.cs
-System.Linq.Parallel/QueryOptions.cs
-System.Linq.Parallel/RangeList.cs
-System.Linq.Parallel/RepeatList.cs
-System.Linq.Parallel/ReverseList.cs
-System.Linq.Parallel/StripPartitioner.cs
-System.Linq.Parallel/TemporaryArea.cs
-System.Linq/EnumerableExecutor.cs
-System.Linq/EnumerableExecutor_T.cs
-System.Linq/EnumerableQuery.cs
-System.Linq/EnumerableQuery_T.cs
-System.Linq/OrderedParallelQuery.cs
-System.Linq/ParallelEnumerable.cs
-System.Linq/ParallelExecutionMode.cs
-System.Linq/ParallelMergeOptions.cs
-System.Linq/ParallelQuery.cs
-System.IO.MemoryMappedFiles/MemoryMappedFile.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
-System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
-System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
-System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
-Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
-Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
-System.IO/HandleInheritability.cs
-System.Threading.Tasks/TaskExtensions.cs
-System.Linq.Expressions/Extensions.cs
-System.Linq.Expressions/ExpressionTransformer.cs
-../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs
-../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs
-System.Linq.Expressions/DynamicExpressionVisitor.cs
+#include mobile_common_System.Core.dll.sources
+
+#include dynamic_System.Core.dll.sources
 
diff --git a/mcs/class/System.Core/mobile_common_System.Core.dll.sources b/mcs/class/System.Core/mobile_common_System.Core.dll.sources
new file mode 100644 (file)
index 0000000..10e8623
--- /dev/null
@@ -0,0 +1,108 @@
+Assembly/AssemblyInfo.cs
+System/Actions.cs
+System/Funcs.cs
+System/InvalidTimeZoneException.cs
+System/TimeZoneInfo.AdjustmentRule.cs
+System/TimeZoneInfo.cs
+System/TimeZoneInfo.Serialization.cs
+System/TimeZoneInfo.TransitionTime.cs
+System/TimeZoneNotFoundException.cs
+System/Util.cs
+System.Runtime.CompilerServices/DynamicAttribute.cs
+System.Runtime.CompilerServices/ExecutionScope.cs
+System.Runtime.CompilerServices/ExtensionAttribute.cs
+System.Runtime.CompilerServices/IStrongBox.cs
+System.Runtime.CompilerServices/StrongBox_T.cs
+System.Linq/Check.cs
+System.Linq/Enumerable.cs
+System.Linq/QueryableEnumerable.cs
+System.Linq/QueryableTransformer.cs
+System.Linq/Grouping.cs
+System.Linq/IGrouping.cs
+System.Linq/IOrderedQueryable.cs
+System.Linq/IOrderedQueryable_T.cs
+System.Linq/IOrderedEnumerable_T.cs
+System.Linq/IQueryable.cs
+System.Linq/IQueryable_T.cs
+System.Linq/Lookup.cs
+System.Linq/ILookup_T.cs
+System.Linq/OrderedEnumerable.cs
+System.Linq/OrderedSequence.cs
+System.Linq/Queryable.cs
+System.Linq/QuickSort.cs
+System.Linq/SortContext.cs
+System.Linq/SortDirection.cs
+System.Linq/SortSequenceContext.cs
+System.Linq/IQueryProvider.cs
+System.Collections.Generic/HashSet.cs
+System.Security.Cryptography/Aes.cs
+System.Threading/LockRecursionPolicy.cs
+System.Threading/ReaderWriterLockSlim.cs
+System.Threading/ThreadLockState.cs
+System.Threading/ReaderWriterLockSlimExtensions.cs
+System.Linq.Parallel.QueryNodes/QueryBaseNode.cs
+System.Linq.Parallel.QueryNodes/QueryCastNode.cs
+System.Linq.Parallel.QueryNodes/QueryChildNode.cs
+System.Linq.Parallel.QueryNodes/QueryConcatNode.cs
+System.Linq.Parallel.QueryNodes/QueryDefaultEmptyNode.cs
+System.Linq.Parallel.QueryNodes/QueryGroupByNode.cs
+System.Linq.Parallel.QueryNodes/QueryHeadWorkerNode.cs
+System.Linq.Parallel.QueryNodes/QueryJoinNode.cs
+System.Linq.Parallel.QueryNodes/QueryMuxNode.cs
+System.Linq.Parallel.QueryNodes/QueryOptionNode.cs
+System.Linq.Parallel.QueryNodes/QueryOrderByNode.cs
+System.Linq.Parallel.QueryNodes/QueryOrderGuardNode.cs
+System.Linq.Parallel.QueryNodes/QueryOrderedStreamNode.cs
+System.Linq.Parallel.QueryNodes/QueryReverseNode.cs
+System.Linq.Parallel.QueryNodes/QuerySelectManyNode.cs
+System.Linq.Parallel.QueryNodes/QuerySelectNode.cs
+System.Linq.Parallel.QueryNodes/QuerySetNode.cs
+System.Linq.Parallel.QueryNodes/QueryStartNode.cs
+System.Linq.Parallel.QueryNodes/QueryStreamNode.cs
+System.Linq.Parallel.QueryNodes/QueryWhereNode.cs
+System.Linq.Parallel.QueryNodes/QueryZipNode.cs
+System.Linq.Parallel.QueryNodes/SetInclusion.cs
+System.Linq.Parallel.QueryNodes/WrapHelper.cs
+System.Linq.Parallel/AggregationList.cs
+System.Linq.Parallel/ConcurrentGrouping.cs
+System.Linq.Parallel/ConcurrentLookup.cs
+System.Linq.Parallel/INodeVisitor.cs
+System.Linq.Parallel/IVisitableNode.cs
+System.Linq.Parallel/OrderingEnumerator.cs
+System.Linq.Parallel/ParallelExecuter.cs
+System.Linq.Parallel/ParallelPartitioner.cs
+System.Linq.Parallel/ParallelQueryEnumerator.cs
+System.Linq.Parallel/ParallelQuickSort.cs
+System.Linq.Parallel/QueryCheckerVisitor.cs
+System.Linq.Parallel/QueryIsOrderedVisitor.cs
+System.Linq.Parallel/QueryOptions.cs
+System.Linq.Parallel/RangeList.cs
+System.Linq.Parallel/RepeatList.cs
+System.Linq.Parallel/ReverseList.cs
+System.Linq.Parallel/StripPartitioner.cs
+System.Linq.Parallel/TemporaryArea.cs
+System.Linq/EnumerableExecutor.cs
+System.Linq/EnumerableExecutor_T.cs
+System.Linq/EnumerableQuery.cs
+System.Linq/EnumerableQuery_T.cs
+System.Linq/OrderedParallelQuery.cs
+System.Linq/ParallelEnumerable.cs
+System.Linq/ParallelExecutionMode.cs
+System.Linq/ParallelMergeOptions.cs
+System.Linq/ParallelQuery.cs
+System.IO.MemoryMappedFiles/MemoryMappedFile.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileAccess.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileOptions.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileRights.cs
+System.IO.MemoryMappedFiles/MemoryMappedFileSecurity.cs
+System.IO.MemoryMappedFiles/MemoryMappedViewStream.cs
+System.IO.MemoryMappedFiles/MemoryMappedViewAccessor.cs
+Microsoft.Win32.SafeHandles/SafeMemoryMappedFileHandle.cs
+Microsoft.Win32.SafeHandles/SafeMemoryMappedViewHandle.cs
+System.IO/HandleInheritability.cs
+System.Threading.Tasks/TaskExtensions.cs
+System.Linq.Expressions/Extensions.cs
+System.Linq.Expressions/ExpressionTransformer.cs
+../dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs
+../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs
+System.Linq.Expressions/DynamicExpressionVisitor.cs
diff --git a/mcs/class/System.Core/mobile_static_System.Core.dll.sources b/mcs/class/System.Core/mobile_static_System.Core.dll.sources
new file mode 100644 (file)
index 0000000..6da190e
--- /dev/null
@@ -0,0 +1,2 @@
+#include mobile_common_System.Core.dll.sources
+#include interpreter_System.Core.dll.sources
index c681f5a1f8b7bd6df177f0dce7e23161cf15a96f..7228e910c4247fe3f2f882e468342b0b7d167447 100644 (file)
@@ -1,4 +1,4 @@
-#include mobile_System.Core.dll.sources
+#include mobile_common_System.Core.dll.sources
 
 #include dynamic_System.Core.dll.sources
 
index fad05a08f1c16d427b2c9476f112a3f9d8585718..1296c8186d0dc9046a8747e3a91d66495b65d7d3 100644 (file)
@@ -1,3 +1,3 @@
-#include mobile_System.Core.dll.sources
+#include mobile_common_System.Core.dll.sources
 #include interpreter_System.Core.dll.sources
 System/TimeZoneInfo.MonoTouch.cs
index 6ede304927af804cfd187afbfed57cb5bc041044..5cd8ddf660b42a0bf108f9f4800a4f5b6703e1be 100644 (file)
@@ -1,4 +1,4 @@
-#include mobile_System.Core.dll.sources
+#include mobile_common_System.Core.dll.sources
 
 #include dynamic_System.Core.dll.sources
 
index 5ad9459d88a2c1a21c93891ab1fec23f77267393..37dc2990c8d1d24845da0ddfc69531c220374a84 100644 (file)
@@ -1,2 +1 @@
-#include System.Data.Services.Client.dll.sources
-./Client/AssemblyAttributes.cs
+#include net_4_5_System.Data.Services.Client.dll.sources
index 8712eca6cf9300024b0ccf802a5738eb96df6324..e1fa878c4caa3045bcd95254ba1b2c015ce3370b 100644 (file)
@@ -56,6 +56,7 @@ using System.Xml;
 #if NET_2_0
 using System.Collections.Generic;
 #endif
+using System.Security;
 
 namespace System.Data.SqlClient
 {
@@ -93,6 +94,9 @@ namespace System.Data.SqlClient
                // The connection string that identifies this connection
                string connectionString;
 
+               // The connection credentials
+               SqlCredential credentials;
+
                // The transaction object for the current transaction
                SqlTransaction transaction;
 
@@ -133,6 +137,12 @@ namespace System.Data.SqlClient
                        ConnectionString = connectionString;
                }
 
+               public SqlConnection (string connectionString, SqlCredential cred)
+               {
+                       ConnectionString = connectionString;
+                       Credentials = cred;
+               }
+
                #endregion // Constructors
 
                #region Properties
@@ -155,6 +165,15 @@ namespace System.Data.SqlClient
                        }
                }
        
+               public SqlCredential Credentials {
+                       get {
+                               return credentials;
+                       }
+                       set {
+                               credentials = value;
+                       }
+               }
+       
 #if !NET_2_0
                [DataSysDescription ("Current connection timeout value, 'Connect Timeout=X' in the ConnectionString.")] 
 #endif
@@ -563,6 +582,16 @@ namespace System.Data.SqlClient
 
                        if (!tds.IsConnected) {
                                try {
+                                       if (Credentials != null) {
+                                               if (parms.User != String.Empty)
+                                                       throw new ArgumentException("UserID already specified");
+                                               if (parms.PasswordSet)
+                                                       throw new ArgumentException("Password already specified");
+                                               if (parms.DomainLogin != false)
+                                                       throw new ArgumentException("Cannot use credentials with DomainLogin");
+                                               parms.User = Credentials.UserId;
+                                               parms.Password = Credentials.Password;
+                                       }
                                        tds.Connect (parms);
                                } catch {
                                        if (pooling)
@@ -879,7 +908,10 @@ namespace System.Data.SqlClient
                                break;
                        case "password" :
                        case "pwd" :
-                               parms.Password = value;
+                               parms.Password = new SecureString();
+                               foreach (char c in value)
+                                       parms.Password.AppendChar(c);
+                               parms.PasswordSet = true;
                                break;
                        case "persistsecurityinfo" :
                        case "persist security info" :
diff --git a/mcs/class/System.Data/System.Data.SqlClient/SqlCredential.cs b/mcs/class/System.Data/System.Data.SqlClient/SqlCredential.cs
new file mode 100644 (file)
index 0000000..5b15b48
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// System.Data.SqlClient.SqlCredential.cs
+//
+// Author:
+//   Neale Ferguson (neale@sinenomine.net)
+//
+// Copyright (C) Neale Ferguson, 2014
+//
+
+//
+// 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.Data;
+using System.Runtime.InteropServices;
+using System.Security;
+
+namespace System.Data.SqlClient {
+       /// <summary>
+       /// Describes an error from a SQL database.
+       /// </summary>
+       [Serializable]
+       public sealed class SqlCredential
+       {
+               #region Fields
+
+               string uid = "";
+               SecureString pwd = null;
+
+               #endregion // Fields
+
+               #region Constructors
+
+               public SqlCredential (string user, SecureString password)
+               {
+                       if (user == null)
+                               throw new ArgumentNullException("UserID");
+                       if (password == null)
+                               throw new ArgumentNullException("Password");
+                       this.uid = user;
+                       this.pwd = password;
+               }
+
+               #endregion // Constructors
+               
+               #region Properties
+
+               public string UserId {
+                       get { return uid; }
+               }
+
+               public SecureString Password {
+                       get { return pwd; }
+               }
+
+               #endregion
+       }
+}
index aeae903dbc907c5a880348a0459e045d06b1adfb..5ec88803ea643775ca3c14ac6048d7c1e259440e 100644 (file)
@@ -289,6 +289,7 @@ System.Data.SqlClient/SqlCommand.cs
 System.Data.SqlClient/SqlCommandBuilder.cs
 System.Data.SqlClient/SqlConnection.cs
 System.Data.SqlClient/SqlConnectionStringBuilder.cs
+System.Data.SqlClient/SqlCredential.cs
 System.Data.SqlClient/SqlDataAdapter.cs
 System.Data.SqlClient/SqlDataReader.cs
 System.Data.SqlClient/SqlDataSourceConverter.cs
index 70740170701f4bbdffef8591a21e0d51837d1eb9..71e2b0dfc58cc2359146de9e290bc0e20cfd1ad3 100644 (file)
@@ -21,7 +21,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid mobile mobile_static xammac net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Interactive.Async.dll
 NO_SIGN_ASSEMBLY = yes
index c74dccb727189de42a6991875826b4f6b193740b..ae8749cc6940caa0adafc2a20e0071b6e086108b 100644 (file)
@@ -22,7 +22,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Interactive.Providers.dll
 NO_SIGN_ASSEMBLY = yes
index ec5cd5c01df79265c08a7c60f88cc094cd9e9d7a..1429c533ef9955323768764ff68fd052328d3309 100644 (file)
@@ -21,7 +21,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Interactive.dll
 NO_SIGN_ASSEMBLY = yes
index c4ad9e811ee5d1a30089b406f242bd3fe31c0787..e9b81a71cd909269e6bb90b5d1184860302ed61c 100644 (file)
@@ -70,6 +70,7 @@ namespace MonoTests.System.Numerics
                        NfiUser.PercentNegativePattern = 2;
                        NfiUser.PercentPositivePattern = 2;
                        NfiUser.PercentSymbol = "%%%";
+                       NfiUser.NumberDecimalSeparator = ".";
                }
 
                [Test]
@@ -893,6 +894,13 @@ namespace MonoTests.System.Numerics
                        Assert.AreEqual (0m, (decimal)new BigInteger (), "#8");
                }
 
+               [SetCulture ("pt-BR")]
+               [Test]
+               public void Parse_pt_BR () 
+               {
+                       Parse ();
+               }
+
                [Test]
                public void Parse () {
                        try {
@@ -943,7 +951,8 @@ namespace MonoTests.System.Numerics
                        Assert.AreEqual (-23, (int)BigInteger.Parse("  -23  ", NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite), "#19");
 
                        Assert.AreEqual (300000, (int)BigInteger.Parse("3E5", NumberStyles.AllowExponent), "#20");
-                       Assert.AreEqual (250, (int)BigInteger.Parse("2"+Nfi.NumberDecimalSeparator+"5E2", NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint), "#21");//2.5E2 = 250
+                       var dsep = NumberFormatInfo.CurrentInfo.NumberDecimalSeparator;
+                       Assert.AreEqual (250, (int)BigInteger.Parse("2" + dsep + "5E2", NumberStyles.AllowExponent | NumberStyles.AllowDecimalPoint), "#21");//2.5E2 = 250
                        Assert.AreEqual (25, (int)BigInteger.Parse("2500E-2", NumberStyles.AllowExponent), "#22");
 
                        Assert.AreEqual ("136236974127783066520110477975349088954559032721408", BigInteger.Parse("136236974127783066520110477975349088954559032721408", NumberStyles.None).ToString(), "#23");
@@ -956,7 +965,7 @@ namespace MonoTests.System.Numerics
                        }
 
                        try {
-                               Int32.Parse ("2.09E1",  NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent);
+                               Int32.Parse ("2" + dsep + "09E1",  NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent);
                                Assert.Fail ("#26");
                        } catch (OverflowException) {
                        }
index 3f74f8bf98e316f19c0048f08abfc8329dc0d882..624018c109826410c3f77d73d2bd7ad415965f7b 100644 (file)
@@ -35,7 +35,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Reactive.Core.dll
 NO_SIGN_ASSEMBLY = yes
index c603f89a68a1e6a9b4d22b32d54e0f59ab4184c7..3e308212455700332b681ae8fd5fdf56d117b64a 100644 (file)
@@ -24,7 +24,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Reactive.Debugger.dll
 NO_SIGN_ASSEMBLY = yes
index 234a63b12d968e644acbd323c88e5ca078b93f17..834240acccced2c97b463e2d9c22a56a3bc1109c 100644 (file)
@@ -24,7 +24,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Reactive.Experimental.dll
 NO_SIGN_ASSEMBLY = yes
index acee40d296023127ef0df4d15a28239e729fe6fe..fae46634976d52c74dc03052ca9784cc990d6905 100644 (file)
@@ -21,7 +21,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Reactive.Interfaces.dll
 NO_SIGN_ASSEMBLY = yes
index 18a3360dafe6dec51060f10bb31126f2243af418..3906cfc6adc2657985fa4dea86354e732d01a364 100644 (file)
@@ -36,7 +36,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
 EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Reactive.Linq.dll
 NO_SIGN_ASSEMBLY = yes
index 187dd7702ff703129bde87582049c7256087c4be..6fccc274c42098c9503f86aa116d976ac5781c95 100644 (file)
@@ -42,7 +42,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -r:Mono.Reactive.Tests.dll
 
 EXTRA_DISTFILES = more_build_args $(RESX_RESOURCES:.resources=.resx) $(PREBUILT)
 
-VALID_PROFILE := $(filter monotouch monodroid xammac net_4_0 net_4_5, $(PROFILE))
+VALID_PROFILE := $(filter monotouch monodroid xammac mobile mobile_static net_4_0 net_4_5, $(PROFILE))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.System.Reactive.PlatformServices.dll
 NO_SIGN_ASSEMBLY = yes
index 6c0c3366f756a4cd524c4ec0d81d16dee8939b5a..805053196d436848ff667211704d42a216b67464 100644 (file)
@@ -234,6 +234,9 @@ namespace System.ServiceModel.Description
                        foreach (var fd in od.Faults)
                                o.FaultContractInfos.Add (new FaultContractInfo (fd.Action, fd.DetailType));
 
+                       o.BeginMethod = od.BeginMethod;
+                       o.EndMethod = od.EndMethod;
+
                        // FIXME: at initialization time it does not seem to 
                        // fill default formatter. It should be filled after
                        // applying all behaviors. (Tthat causes regression, so
index 929a450d22be5df1083bdfb0cc77f5210478985f..a7665b8cab6daa0a6a334a3cf3561d08c3bfdbd5 100644 (file)
@@ -237,7 +237,6 @@ namespace System.ServiceModel.Description
                        
                        for (int i = 0; i < contractMethods.Length; ++i)
                        {
-
                                MethodInfo mi = contractMethods [i];
                                OperationContractAttribute oca = GetOperationContractAttribute (mi);
                                if (oca == null)
@@ -253,7 +252,7 @@ namespace System.ServiceModel.Description
                                        if (GetOperationContractAttribute (end) != null)
                                                throw new InvalidOperationException ("Async 'End' method must not have OperationContractAttribute. It is automatically treated as the EndMethod of the corresponding 'Begin' method.");
                                }
-                               OperationDescription od = GetOrCreateOperation (cd, mi, serviceMethods [i], oca, end != null ? end.ReturnType : null, isCallback, givenServiceType);
+                               OperationDescription od = GetOrCreateOperation (cd, mi, serviceMethods [i], oca, end, isCallback, givenServiceType);
                                if (end != null)
                                        od.EndMethod = end;
                        }
@@ -286,7 +285,7 @@ namespace System.ServiceModel.Description
                static OperationDescription GetOrCreateOperation (
                        ContractDescription cd, MethodInfo mi, MethodInfo serviceMethod,
                        OperationContractAttribute oca,
-                       Type asyncReturnType,
+                       MethodInfo endMethod,
                        bool isCallback,
                        Type givenServiceType)
                {
@@ -311,7 +310,8 @@ namespace System.ServiceModel.Description
 
                                od.Messages.Add (GetMessage (od, mi, oca, true, isCallback, null));
                                if (!od.IsOneWay) {
-                                       var md = GetMessage (od, mi, oca, false, isCallback, asyncReturnType);
+                                       var asyncReturnType = endMethod != null ? endMethod.ReturnType : null;
+                                       var md = GetMessage (od, endMethod ?? mi, oca, false, isCallback, asyncReturnType);
                                        od.Messages.Add (md);
                                        var mpa = mi.ReturnParameter.GetCustomAttribute<MessageParameterAttribute> (true);
                                        if (mpa != null) {
@@ -522,8 +522,12 @@ namespace System.ServiceModel.Description
                        int index = 0;
                        foreach (ParameterInfo pi in plist) {
                                // AsyncCallback and state are extraneous.
-                               if (oca.AsyncPattern && pi.Position == plist.Length - 2)
-                                       break;
+                               if (oca.AsyncPattern) {
+                                       if (isRequest && pi.Position == plist.Length - 2)
+                                               break;
+                                       if (!isRequest && pi.Position == plist.Length - 1)
+                                               break;
+                               }
 
                                // They are ignored:
                                // - out parameter in request
index f512ea37553b7386160913aa706d17b12c01dc4c..db1c49650c16598dc9b8b01cec02eb90aad6459b 100644 (file)
@@ -281,9 +281,10 @@ namespace System.ServiceModel.Dispatcher
                        }
                        else {
                                int index = ParamsOffset (md.Body);
-                               foreach (ParameterInfo pi in requestMethodParams)
+                               foreach (ParameterInfo pi in replyMethodParams) {
                                        if (pi.IsOut || pi.ParameterType.IsByRef)
                                                parameters [pi.Position] = parts [index++];
+                               }
                                return HasReturnValue (md.Body) ? parts [0] : null;
                        }
                }
index 419892a58ce161ebc97c432c6d4e60addbeecbec..043b2ab7af08df3875689382a09e41e1210750f3 100644 (file)
@@ -71,7 +71,7 @@ namespace System.ServiceModel.MonoInternal
                #region delegates
                readonly ProcessDelegate _processDelegate;
 
-               delegate object ProcessDelegate (MethodBase method, string operationName, object [] parameters, OperationContext context);
+               delegate object ProcessDelegate (MethodBase method, string operationName, bool isAsync, ref object [] parameters, OperationContext context);
 
                readonly RequestDelegate requestDelegate;
 
@@ -436,16 +436,13 @@ namespace System.ServiceModel.MonoInternal
 
                #region Request/Output processing
 
-               class OperationParameters
-               {
-                       public object[] Parameters;
-                       public object UserData;
-               }
-
                public IAsyncResult BeginProcess (MethodBase method, string operationName, object [] parameters, AsyncCallback callback, object asyncState)
                {
-                       var p = new OperationParameters { Parameters = parameters, UserData = asyncState };
-                       return _processDelegate.BeginInvoke (method, operationName, parameters, OperationContext.Current, callback, p);
+                       var p = parameters;
+                       var retval = _processDelegate.BeginInvoke (method, operationName, true, ref p, OperationContext.Current, callback, asyncState);
+                       if (p != parameters)
+                               throw new InvalidOperationException ();
+                       return retval;
                }
 
                public object EndProcess (MethodBase method, string operationName, object [] parameters, IAsyncResult result)
@@ -455,24 +452,34 @@ namespace System.ServiceModel.MonoInternal
                        if (parameters == null)
                                throw new ArgumentNullException ("parameters");
 
-                       var p = (OperationParameters)result.AsyncState;
-                       if (p.Parameters.Length != parameters.Length)
-                               throw new ArgumentException ("Parameter array has invalid length.", "parameters");
+                       object[] p = parameters;
+                       var retval = _processDelegate.EndInvoke (ref p, result);
+                       if (p == parameters)
+                               return retval;
 
-                       for (int i = 0; i < parameters.Length; i++)
-                               parameters [i] = p.Parameters [i];
-
-                       return _processDelegate.EndInvoke (result);
+                       if (p.Length != parameters.Length)
+                               throw new InvalidOperationException ();
+                       Array.Copy (p, parameters, p.Length);
+                       return retval;
                }
 
                public object Process (MethodBase method, string operationName, object [] parameters, OperationContext context)
+               {
+                       var p = parameters;
+                       var retval = Process (method, operationName, false, ref p, context);
+                       if (p != parameters)
+                               throw new InvalidOperationException ();
+                       return retval;
+               }
+
+               object Process (MethodBase method, string operationName, bool isAsync, ref object [] parameters, OperationContext context)
                {
                        var previousContext = OperationContext.Current;
                        try {
                                // Inherit the context from the calling thread
                                OperationContext.Current = context;
 
-                               return DoProcess (method, operationName, parameters, context);
+                               return DoProcess (method, operationName, isAsync, ref parameters, context);
                        } catch (Exception ex) {
                                throw;
                        } finally {
@@ -481,7 +488,7 @@ namespace System.ServiceModel.MonoInternal
                        }
                }
 
-               object DoProcess (MethodBase method, string operationName, object [] parameters, OperationContext context)
+               object DoProcess (MethodBase method, string operationName, bool isAsync, ref object [] parameters, OperationContext context)
                {
                        if (AllowInitializationUI)
                                DisplayInitializationUI ();
@@ -491,7 +498,7 @@ namespace System.ServiceModel.MonoInternal
                                Open ();
 
                        if (!od.IsOneWay)
-                               return Request (od, parameters, context);
+                               return Request (od, isAsync, ref parameters, context);
                        else {
                                Output (od, parameters, context);
                                return null;
@@ -517,7 +524,7 @@ namespace System.ServiceModel.MonoInternal
                        Send (CreateRequest (op, parameters, context), OperationTimeout);
                }
 
-               object Request (OperationDescription od, object [] parameters, OperationContext context)
+               object Request (OperationDescription od, bool isAsync, ref object [] parameters, OperationContext context)
                {
                        ClientOperation op = runtime.Operations [od.Name];
                        object [] inspections = new object [runtime.MessageInspectors.Count];
@@ -558,10 +565,15 @@ namespace System.ServiceModel.MonoInternal
                        for (int i = 0; i < inspections.Length; i++)
                                runtime.MessageInspectors [i].AfterReceiveReply (ref res, inspections [i]);
 
-                       if (op.DeserializeReply)
-                               return op.Formatter.DeserializeReply (res, parameters);
-                       else
+                       if (!op.DeserializeReply)
                                return res;
+
+                       if (isAsync && od.EndMethod != null) {
+                               var endParams = od.EndMethod.GetParameters ();
+                               parameters = new object [endParams.Length - 1];
+                       }
+
+                       return op.Formatter.DeserializeReply (res, parameters);
                }
 
                #region Message-based Request() and Send()
index c52a56468ffe7eace41f8bd470fb029c2ec83a35..f44d93a6f0eaa473c248e7b68f906fbaaef17c43 100644 (file)
@@ -13,7 +13,7 @@ ifdef USE_BOOT_COMPILE
 LIBRARY_COMPILE = $(BOOT_COMPILE)
 endif
 
-PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammac, $(PROFILE))
+PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammac mobile mobile_static, $(PROFILE))
 
 LIB_MCS_FLAGS = -r:$(corlib) -r:System.dll -nowarn:0618,0612,0642
 ifeq (2.1, $(FRAMEWORK_VERSION))
@@ -127,4 +127,4 @@ ifneq ($(PROFILE),basic)
 csproj-local:
        $(MAKE) csproj-local intermediate=bare/
 endif
-endif
\ No newline at end of file
+endif
index 17d16132910a38e6aacef44903aa9ce0825a79d4..5104e87b042d8239c7207647c7020cbcfb65568a 100644 (file)
@@ -18,7 +18,7 @@ TEST_EXTRA_DISTFILES = \
        Test/XmlFiles/*.xml \
        Test/XmlFiles/*.xaml
 
-VALID_PROFILE := $(filter 4 monodroid monotouch, $(FRAMEWORK_VERSION_MAJOR))
+VALID_PROFILE := $(filter 4 monodroid monotouch mobile mobile_static, $(FRAMEWORK_VERSION_MAJOR))
 ifndef VALID_PROFILE
 LIBRARY_NAME = dummy-System.Xaml.dll
 NO_INSTALL = yes
index 50bc1fce7d1f6e3b9c1210b39e819903e76ed802..cfa7564d4b6c19fb604dbcad8f89f3358d09122d 100644 (file)
@@ -24,14 +24,10 @@ TEST_MCS_FLAGS = -r:System.Drawing.dll -r:Mono.Security.dll -r:System.Data -r:Sy
 
 LIB_MCS_FLAGS = -nowarn:618 -d:CONFIGURATION_2_0 -unsafe $(RESOURCE_FILES:%=-resource:%)
 TEST_MCS_FLAGS += -r:System.Configuration
-PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammac, $(PROFILE))
-NOT_SL := $(filter net_2_0 net_4_0 net_4_5 monotouch_runtime mobile xammac, $(PROFILE))
+PROFILE_ANY_MOBILE := $(filter monotouch monotouch_runtime monodroid xammaci mobile mobile_static, $(PROFILE))
 
 ifeq (2.1, $(FRAMEWORK_VERSION))
 LIB_MCS_FLAGS += -d:INSIDE_SYSTEM
-ifeq (moonlight_raw, $(PROFILE))
-LIB_MCS_FLAGS += -d:SECURITY_DEP
-endif
 endif
 ifeq (monotouch, $(subst _runtime,,$(PROFILE)))
 LIB_MCS_FLAGS += -d:SECURITY_DEP
@@ -154,4 +150,4 @@ csproj-local:
        $(MAKE) csproj-local intermediate=bare/
        $(MAKE) csproj-local intermediate=secxml/
 endif
-endif
\ No newline at end of file
+endif
index 149ad3bc5ba1deb5f6c81a9030586378d95d5975..c3937530f66f8194d19818ca022b0d2efd58b6e2 100644 (file)
@@ -94,6 +94,7 @@ namespace System.Diagnostics
                public DiagnosticsConfigurationHandler ()
                {
                        elementHandlers ["assert"] = new ElementHandler (AddAssertNode);
+                       elementHandlers ["performanceCounters"] = new ElementHandler (AddPerformanceCountersNode);
                        elementHandlers ["switches"] = new ElementHandler (AddSwitchesNode);
                        elementHandlers ["trace"] = new ElementHandler (AddTraceNode);
                        elementHandlers ["sources"] = new ElementHandler (AddSourcesNode);
@@ -181,6 +182,25 @@ namespace System.Diagnostics
                                ThrowUnrecognizedElement (node.ChildNodes[0]);
                }
 
+               private void AddPerformanceCountersNode (IDictionary d, XmlNode node)
+               {
+                       XmlAttributeCollection c = node.Attributes;
+                       string filemappingsize = GetAttribute (c, "filemappingsize", false, node);
+                       ValidateInvalidAttributes (c, node);
+                       if (filemappingsize != null) {
+                               try {
+                                       d ["filemappingsize"] = int.Parse (filemappingsize);
+                               }
+                               catch (Exception e) {
+                                       throw new ConfigurationException ("The `filemappingsize' attribute must be an integral value.",
+                                                       e, node);
+                               }
+                       }
+
+                       if (node.ChildNodes.Count > 0)
+                               ThrowUnrecognizedElement (node.ChildNodes[0]);
+               }
+
                // name and value attributes are required
                // Docs do not define "remove" or "clear" elements, but .NET recognizes
                // them
index 9af93d5a2f84ad4ba66f9b69c176687a17dd9d18..8c9049470d7eba69221ed6c8bf76aa75e4dfe493 100644 (file)
@@ -159,6 +159,30 @@ namespace MonoTests.System.Diagnostics
                        ValidateExceptions ("#TAT:BadChildren", "<assert>{0}</assert>", badChildren);
                }
 
+               [Test]
+               [Category ("NotDotNet")]
+               public void PerformanceCountersTag ()
+               {
+                       string[] goodAttributes = {
+                               "",
+                               "filemappingsize=\"1048576\"",
+                               "filemappingsize=\"0\""
+                       };
+                       ValidateSuccess ("#PCT:Good", "<performanceCounters {0}/>", goodAttributes);
+
+                       string[] badAttributes = {
+                               "FileMappingSize=\"1048576\"",
+                               "filemappingsize=\"\"",
+                               "filemappingsize=\"non-int-value\""
+                       };
+                       ValidateExceptions ("#PCT:BadAttrs", "<performanceCounters {0}/>", badAttributes);
+
+                       string[] badChildren = {
+                               "<any element=\"here\"/>"
+                       };
+                       ValidateExceptions ("#PCT:BadChildren", "<performanceCounters>{0}</performanceCounters>", badChildren);
+               }
+
                [Test]
                [Category ("NotDotNet")]
                public void TraceTag_Attributes ()
index 8c82931acc57fba450bead9ffc2953adab6b20b6..11e611563c8e791f86d121cb8da5eb540b0dd43e 100644 (file)
@@ -526,13 +526,42 @@ namespace MonoTests.System.Threading
 
                [Test]
                [ExpectedException (typeof (InvalidOperationException))]
-               public void ReName ()
+               public void Rename ()
                {
-                       Thread t = new Thread (new ThreadStart (ReName));
+                       Thread t = new Thread (new ThreadStart (Rename));
                        t.Name = "a";
                        t.Name = "b";
                }
 
+               bool rename_finished;
+               bool rename_failed;
+
+               [Test]
+               public void RenameTpThread ()
+               {
+                       object monitor = new object ();
+                       ThreadPool.QueueUserWorkItem (new WaitCallback (Rename_callback), monitor);
+                       lock (monitor) {
+                               if (!rename_finished)
+                                       Monitor.Wait (monitor);
+                       }
+                       Assert.IsFalse (rename_failed);
+               }
+
+               void Rename_callback (object o) {
+                       Thread.CurrentThread.Name = "a";
+                       try {
+                               Thread.CurrentThread.Name = "b";
+                       } catch (Exception) {
+                               rename_failed = true;
+                       }
+                       object monitor = o;
+                       lock (monitor) {
+                               rename_finished = true;
+                               Monitor.Pulse (monitor);
+                       }
+               }
+
                [Test]
                public void TestNestedThreads1()
                {
@@ -1225,6 +1254,8 @@ namespace MonoTests.System.Threading
                        Assert.AreEqual (this, arg, "obj");     
                }               
 
+               bool set_name_failed;
+
                [Test]
                public void SetNameTpThread () {
                        ThreadPool.QueueUserWorkItem(new WaitCallback(ThreadProc));
diff --git a/mcs/errors/cs0111-12.cs b/mcs/errors/cs0111-12.cs
new file mode 100644 (file)
index 0000000..034963c
--- /dev/null
@@ -0,0 +1,15 @@
+// CS0111: A member `S3.S3(string)' is already defined. Rename this member or use different parameter types
+// Line: 6
+
+struct S3 (string s)
+{
+       public S3 (string s)
+               : this (1)
+       {
+       }
+
+       public S3 (int i)
+               : this ("")
+       {
+       }
+}
diff --git a/mcs/errors/cs0411-24.cs b/mcs/errors/cs0411-24.cs
new file mode 100644 (file)
index 0000000..1462cba
--- /dev/null
@@ -0,0 +1,15 @@
+// CS0411: The type arguments for method `C.Foo<T>(out T)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+// Line: 8
+
+public class C
+{
+       public static void Main ()
+       {
+               Foo (out var y);
+       }
+
+       static void Foo<T> (out T t)
+       {
+               t = default (T);
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0516-3.cs b/mcs/errors/cs0516-3.cs
new file mode 100644 (file)
index 0000000..1ff6d06
--- /dev/null
@@ -0,0 +1,9 @@
+// CS0516: Constructor `Sample.Sample()' cannot call itself
+// Line: 6
+
+struct Sample {
+       public Sample ()
+               : this ()
+       {
+       }
+}
index 47b0fdee7303d0bb7a2a6c79eb9c39e091a66a81..5c41f8dc4e7a3233722dc1eb56fcf70ccf64f879 100644 (file)
@@ -1,9 +1,9 @@
 // CS0516: Constructor `Sample.Sample()' cannot call itself
-// Line: 5
+// Line: 6
 
 class Sample {
-        public Sample (): this () {}
+       public Sample ()
+               : this ()
+       {
+       }
 }
-
-
-
diff --git a/mcs/errors/cs0568.cs b/mcs/errors/cs0568.cs
deleted file mode 100644 (file)
index 944d7a9..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// CS0568: Structs cannot contain explicit parameterless constructors
-// Line: 5
-struct A {
-       int a;
-       A () { a = 1; }
-}
-
-class D {
-       static void Main ()
-       {
-               A [] a = new A [10];
-
-       }
-}
diff --git a/mcs/errors/cs0619-58.cs b/mcs/errors/cs0619-58.cs
new file mode 100644 (file)
index 0000000..faf79c7
--- /dev/null
@@ -0,0 +1,20 @@
+// CS0619: `S.S()' is obsolete: `ctor'
+// Line: 18
+
+using System;
+
+struct S
+{
+       [Obsolete ("ctor", true)]
+       public S ()
+       {
+       }
+}
+
+class C
+{
+       public static void Main ()
+       {
+               new S ();
+       }
+}
diff --git a/mcs/errors/cs0815-7.cs b/mcs/errors/cs0815-7.cs
new file mode 100644 (file)
index 0000000..ae41a72
--- /dev/null
@@ -0,0 +1,15 @@
+// CS0815: An implicitly typed local variable declaration cannot be initialized with `void'
+// Line: 8
+
+class X
+{
+       public static void Main ()
+       {
+               Foo (out var x = Main ());
+       }
+
+       static void Foo (out int i)
+       {
+               i = 0;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0841-5.cs b/mcs/errors/cs0841-5.cs
new file mode 100644 (file)
index 0000000..798b335
--- /dev/null
@@ -0,0 +1,15 @@
+// CS0841: A local variable `x' cannot be used before it is declared
+// Line: 8
+
+class X
+{
+       public static void Main ()
+       {
+               Foo (x, out var x);
+       }
+
+       static void Foo (int arg, out int value)
+       {
+               value = 3;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1501-18.cs b/mcs/errors/cs1501-18.cs
new file mode 100644 (file)
index 0000000..b22ab55
--- /dev/null
@@ -0,0 +1,22 @@
+// CS1501: No overload for method `Bar' takes `2' arguments
+// Line: 19
+
+using System;
+
+class T
+{
+       void Foo (int arg, Action a)
+       {
+       }
+
+       void Foo (string title, Action a)
+       {
+       }
+
+       void Bar ()
+       {
+               Foo (arg: 1, a: () => {
+                       Bar ("a", "b");
+               });
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1503-17.cs b/mcs/errors/cs1503-17.cs
new file mode 100644 (file)
index 0000000..26766c0
--- /dev/null
@@ -0,0 +1,14 @@
+// CS1501: Argument `#1' cannot convert `ref string' expression to type `ref int'
+// Line: 8
+
+class C
+{
+       public static void Main ()
+       {
+               Foo (ref var x = "");
+       }
+
+       static void Foo (ref int i)
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1615-3.cs b/mcs/errors/cs1615-3.cs
new file mode 100644 (file)
index 0000000..c64fb7f
--- /dev/null
@@ -0,0 +1,18 @@
+// CS1615: Argument `#1' does not require `out' modifier. Consider removing `out' modifier
+// Line: 8
+
+public class C
+{
+       public static void Main ()
+       {
+               Foo (out var y);
+       }
+
+       static void Foo (int x)
+       {
+       }
+
+       static void Foo (string x)
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1644-45.cs b/mcs/errors/cs1644-45.cs
new file mode 100644 (file)
index 0000000..3aa2033
--- /dev/null
@@ -0,0 +1,10 @@
+// CS1644: Feature `struct parameterless instance constructor' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 12
+// Compiler options: -langversion:5
+
+struct S
+{
+       public S ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1644-46.cs b/mcs/errors/cs1644-46.cs
new file mode 100644 (file)
index 0000000..a62e6d1
--- /dev/null
@@ -0,0 +1,8 @@
+// CS1644: Feature `struct instance member initializer' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 12
+// Compiler options: -langversion:5
+
+struct S
+{
+       int i = 0;
+}
\ No newline at end of file
diff --git a/mcs/errors/cs1644-47.cs b/mcs/errors/cs1644-47.cs
new file mode 100644 (file)
index 0000000..b756cd7
--- /dev/null
@@ -0,0 +1,11 @@
+// CS1644: Feature `declaration expression' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 12
+// Compiler options: -langversion:5
+
+class C
+{
+       public static void Main ()
+       {
+               int.TryParse ("0", out var v);
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8046.cs b/mcs/errors/cs8046.cs
new file mode 100644 (file)
index 0000000..f8b9ad5
--- /dev/null
@@ -0,0 +1,19 @@
+// CS8046: An expression tree cannot contain a declaration expression
+// Line: 11
+
+using System;
+using System.Linq.Expressions;
+
+class C
+{
+       static void Main()
+       {
+               Expression<Func<bool>> e = () => Out (out int x);
+       }
+
+       static bool Out (out int value)
+       {
+               value = 3;
+               return true;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8047.cs b/mcs/errors/cs8047.cs
new file mode 100644 (file)
index 0000000..7171d56
--- /dev/null
@@ -0,0 +1,19 @@
+// CS8047: Declaration expression cannot be used in this context
+// Line: 8
+
+public class C
+{
+       public static void Main ()
+       {
+               dynamic target = 3;
+               var x = new Test (target, out var y);
+       }
+}
+
+class Test
+{
+       public Test (int x, out int y)
+       {
+               y = 0;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8054-2.cs b/mcs/errors/cs8054-2.cs
deleted file mode 100644 (file)
index e633f17..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// CS0573: `A.a': Structs without explicit constructors cannot contain members with initializers
-// Line: 5
-
-partial struct A {
-       int a = 1;
-}
diff --git a/mcs/errors/cs8054-3.cs b/mcs/errors/cs8054-3.cs
deleted file mode 100644 (file)
index b06047f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-// CS0573: `A.a': Structs without explicit constructors cannot contain members with initializers
-// Line: 5
-
-struct A {
-       int a = 1;
-}
diff --git a/mcs/errors/cs8054.cs b/mcs/errors/cs8054.cs
deleted file mode 100644 (file)
index 4b8fc2e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-// CS8054: `S.P': Structs without explicit constructors cannot contain members with initializers
-// Line: 6
-
-struct S
-{
-       public decimal P { get; } = -3;
-}
\ No newline at end of file
diff --git a/mcs/errors/cs8075.cs b/mcs/errors/cs8075.cs
new file mode 100644 (file)
index 0000000..93333f7
--- /dev/null
@@ -0,0 +1,9 @@
+// CS8075: `A.A()': Structs parameterless instance constructor must be public
+// Line: 6
+
+struct A
+{
+       A ()
+       {
+       }
+}
index e9194d4f1f8e008012abcfd9566bc9527cc34acf..37b93b7141ad11137f5d1d89f1b2e62caeece92e 100644 (file)
@@ -963,7 +963,7 @@ namespace Mono.CSharp
                        }
                }
 
-               public virtual void RegisterFieldForInitialization (MemberCore field, FieldInitializer expression)
+               public void RegisterFieldForInitialization (MemberCore field, FieldInitializer expression)
                {
                        if (IsPartialPart)
                                PartialContainer.RegisterFieldForInitialization (field, expression);
@@ -976,6 +976,10 @@ namespace Mono.CSharp
 
                                initialized_static_fields.Add (expression);
                        } else {
+                               if (Kind == MemberKind.Struct && Compiler.Settings.Version < LanguageVersion.V_6) {
+                                       Report.FeatureIsNotAvailable (Compiler, expression.Location, "struct instance member initializer");
+                               }
+
                                if (initialized_fields == null)
                                        initialized_fields = new List<FieldInitializer> (4);
 
@@ -1046,7 +1050,7 @@ namespace Mono.CSharp
                                //
                                // Field is re-initialized to its default value => removed
                                //
-                               if (fi.IsDefaultInitializer && ec.Module.Compiler.Settings.Optimize)
+                               if (fi.IsDefaultInitializer && Kind != MemberKind.Struct && ec.Module.Compiler.Settings.Optimize)
                                        continue;
 
                                ec.AssignmentInfoOffset += fi.AssignmentOffset;
@@ -2660,8 +2664,10 @@ namespace Mono.CSharp
                        if (Kind == MemberKind.Class)
                                c.Initializer = new GeneratedBaseInitializer (Location, PrimaryConstructorBaseArguments);
 
-                       if (PrimaryConstructorParameters != null && !is_static)
+                       if (PrimaryConstructorParameters != null && !is_static) {
                                c.IsPrimaryConstructor = true;
+                               c.caching_flags |= Flags.MethodOverloadsExist;
+                       }
                        
                        AddConstructor (c, true);
                        if (PrimaryConstructorBlock == null) {
@@ -2680,6 +2686,7 @@ namespace Mono.CSharp
                        CheckProtectedModifier ();
 
                        if (PrimaryConstructorParameters != null) {
+
                                foreach (Parameter p in PrimaryConstructorParameters.FixedParameters) {
                                        if (p.Name == MemberName.Name) {
                                                Report.Error (8039, p.Location, "Primary constructor of type `{0}' has parameter of same name as containing type",
@@ -3064,10 +3071,14 @@ namespace Mono.CSharp
 
                protected override bool DoDefineMembers ()
                {
-                       if (PrimaryConstructorParameters != null)
+                       var res = base.DoDefineMembers ();
+
+                       if (PrimaryConstructorParameters != null || (initialized_fields != null && !HasUserDefaultConstructor ())) {
                                generated_primary_constructor = DefineDefaultConstructor (false);
+                               generated_primary_constructor.Define ();
+                       }
 
-                       return base.DoDefineMembers ();
+                       return res;
                }
 
                public override void Emit ()
@@ -3077,14 +3088,14 @@ namespace Mono.CSharp
                        base.Emit ();
                }
 
-               bool HasExplicitConstructor ()
+               bool HasUserDefaultConstructor ()
                {
-                       foreach (var m in Members) {
+                       foreach (var m in PartialContainer.Members) {
                                var c = m as Constructor;
                                if (c == null)
                                        continue;
 
-                               if (!c.ParameterInfo.IsEmpty)
+                               if (!c.IsStatic && c.ParameterInfo.IsEmpty)
                                        return true;
                        }
 
@@ -3143,18 +3154,6 @@ namespace Mono.CSharp
                        base_type = Compiler.BuiltinTypes.ValueType;
                        return ifaces;
                }
-
-               public override void RegisterFieldForInitialization (MemberCore field, FieldInitializer expression)
-               {
-                       if ((field.ModFlags & Modifiers.STATIC) == 0 && !HasExplicitConstructor ()) {
-                               Report.Error (8054, field.Location, "`{0}': Structs without explicit constructors cannot contain members with initializers",
-                                       field.GetSignatureForError ());
-
-                               return;
-                       }
-
-                       base.RegisterFieldForInitialization (field, expression);
-               }
        }
 
        /// <summary>
index 35dc0a9cf024caa8a4e055988fcc2b19dee9880c..2db083886ca5e52b8b2d756ec25477f33400cac2 100644 (file)
@@ -871,7 +871,7 @@ named_attribute_argument
        ;
        
 named_argument
-       : identifier_inside_body COLON opt_named_modifier expression_or_error
+       : identifier_inside_body COLON opt_named_modifier named_argument_expr
          {
                if (lang_version <= LanguageVersion.V_3)
                        FeatureIsNotAvailable (GetLocation ($1), "named argument");
@@ -884,6 +884,11 @@ named_argument
                lbag.AddLocation ($$, GetLocation($2));
          }
        ;
+
+named_argument_expr
+       : expression_or_error
+       | declaration_expression
+       ;
        
 opt_named_modifier
        : /* empty */   { $$ = null; }
@@ -2363,11 +2368,25 @@ constructor_declarator
                if (lt.Value != current_container.MemberName.Name) {
                        report.Error (1520, c.Location, "Class, struct, or interface method must have a return type");
                } else if ((mods & Modifiers.STATIC) != 0) {
+                       if (!current_local_parameters.IsEmpty) {
+                               report.Error (132, c.Location, "`{0}': The static constructor must be parameterless",
+                                       c.GetSignatureForError ());
+                       }
+
                        if ((mods & Modifiers.AccessibilityMask) != 0){
                                report.Error (515, c.Location,
                                        "`{0}': static constructor cannot have an access modifier",
                                        c.GetSignatureForError ());
                        }
+               } else {
+                       if (current_type.Kind == MemberKind.Struct && current_local_parameters.IsEmpty) {
+                               if (lang_version < LanguageVersion.V_6)
+                                       FeatureIsNotAvailable (GetLocation ($3), "struct parameterless instance constructor");
+
+                               if ((mods & Modifiers.PUBLIC) == 0) {
+                                       report.Error (8075, c.Location, "`{0}': Structs parameterless instance constructor must be public", c.GetSignatureForError ());
+                               }
+                       }
                }
 
                current_type.AddConstructor (c);
@@ -3592,11 +3611,19 @@ non_simple_argument
                $$ = new Argument ((Expression) $2, Argument.AType.Ref);
                lbag.AddLocation ($$, GetLocation ($1));
          }
+       | REF declaration_expression
+         {
+               $$ = new Argument ((Expression) $2, Argument.AType.Ref);
+         }
        | OUT variable_reference 
          { 
                $$ = new Argument ((Expression) $2, Argument.AType.Out);
                lbag.AddLocation ($$, GetLocation ($1));
          }
+       | OUT declaration_expression
+         {
+               $$ = new Argument ((Expression) $2, Argument.AType.Out);
+         }
        | ARGLIST OPEN_PARENS argument_list CLOSE_PARENS
          {
                $$ = new Argument (new Arglist ((Arguments) $3, GetLocation ($1)));
@@ -3609,6 +3636,48 @@ non_simple_argument
          }       
        ;
 
+declaration_expression
+       : OPEN_PARENS declaration_expression CLOSE_PARENS
+         {
+               $$ = new ParenthesizedExpression ((Expression) $2, GetLocation ($1));
+               lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
+         }
+/*
+       | CHECKED open_parens_any declaration_expression CLOSE_PARENS
+         {
+               $$ = new CheckedExpr ((Expression) $3, GetLocation ($1));
+               lbag.AddLocation ($$, GetLocation ($2), GetLocation ($4));
+         }
+       | UNCHECKED open_parens_any declaration_expression CLOSE_PARENS
+         {
+               $$ = new UnCheckedExpr ((Expression) $3, GetLocation ($1));
+               lbag.AddLocation ($$, GetLocation ($2), GetLocation ($4));
+         }
+*/
+       | variable_type identifier_inside_body
+         {
+               if (lang_version < LanguageVersion.V_6)
+                       FeatureIsNotAvailable (GetLocation ($1), "declaration expression");
+
+               var lt = (LocatedToken) $2;
+               var lv = new LocalVariable (current_block, lt.Value, lt.Location);
+               current_block.AddLocalName (lv);
+               $$ = new DeclarationExpression ((FullNamedExpression) $1, lv);
+         }
+       | variable_type identifier_inside_body ASSIGN expression
+         {
+               if (lang_version < LanguageVersion.V_6)
+                       FeatureIsNotAvailable (GetLocation ($1), "declaration expression");
+
+               var lt = (LocatedToken) $2;
+               var lv = new LocalVariable (current_block, lt.Value, lt.Location);
+               current_block.AddLocalName (lv);
+               $$ = new DeclarationExpression ((FullNamedExpression) $1, lv) {
+                       Initializer = (Expression) $4
+               };
+         }
+       ;
+
 variable_reference
        : expression
        ;
index 5604a3fcdc9da79542c44c435c840d12e6ac504f..8a9a0c87de2eb00488f65b94a1ea4b0ec348405d 100644 (file)
@@ -289,6 +289,13 @@ namespace Mono.CSharp
 
                protected bool DoResolveCore (ResolveContext rc)
                {
+                       foreach (var arg in arguments) {
+                               if (arg.Type == InternalType.VarOutType) {
+                                       // Should be special error message about dynamic dispatch
+                                       rc.Report.Error (8047, arg.Expr.Location, "Declaration expression cannot be used in this context");
+                               }
+                       }
+
                        if (rc.CurrentTypeParameters != null && rc.CurrentTypeParameters[0].IsMethodTypeParameter)
                                context_mvars = rc.CurrentTypeParameters;
 
index ee0fce5619152e4da989e0f99ec8db828969f0fa..7c2537c8bc7b8cdd386cacf6ad18349d7d3bbed9 100644 (file)
@@ -764,6 +764,10 @@ namespace Mono.CSharp {
                        if (ctors == null) {
                                switch (type.Kind) {
                                case MemberKind.Struct:
+                                       // Every struct has implicit default constructor if not provided by user
+                                       if (args == null)
+                                               return null;
+
                                        rc.Report.SymbolRelatedToPreviousError (type);
                                        // Report meaningful error for struct as they always have default ctor in C# context
                                        OverloadResolver.Error_ConstructorMismatch (rc, type, args == null ? 0 : args.Count, loc);
@@ -784,6 +788,18 @@ namespace Mono.CSharp {
                                return null;
                        }
 
+                       if (args == null && type.IsStruct) {
+                               bool includes_empty = false;
+                               foreach (MethodSpec ctor in ctors) {
+                                       if (ctor.Parameters.IsEmpty) {
+                                               includes_empty = true;
+                                       }
+                               }
+
+                               if (!includes_empty)
+                                       return null;
+                       }
+
                        var r = new OverloadResolver (ctors, OverloadResolver.Restrictions.NoBaseMembers, loc);
                        if (!rc.HasSet (ResolveContext.Options.BaseInitializer)) {
                                r.InstanceQualifier = new ConstructorInstanceQualifier (type);
@@ -4719,11 +4735,23 @@ namespace Mono.CSharp {
                // one being the virtual base for the parameter types and modifiers.
                //
                // A return value rates candidate method compatibility,
-               // 0 = the best, int.MaxValue = the worst
                // -1 = fatal error
+               // 0 = the best, int.MaxValue = the worst
                //
                int IsApplicable (ResolveContext ec, ref Arguments arguments, int arg_count, ref MemberSpec candidate, IParametersMember pm, ref bool params_expanded_form, ref bool dynamicArgument, ref TypeSpec returnType, bool errorMode)
                {
+                       //
+                       // Each step has allocated 10 values, it can overflow for
+                       // more than 10 arguments but that's ok as it's used for
+                       // better error reporting only
+                       //
+                       const int ArgumentCountMismatch         = 1000000000;
+                       const int NamedArgumentsMismatch        = 100000000;
+                       const int DefaultArgumentMismatch       = 10000000;
+                       const int UnexpectedTypeArguments       = 1000000;
+                       const int TypeArgumentsMismatch         = 100000;
+                       const int InflatedTypesMismatch         = 10000;
+
                        // Parameters of most-derived type used mainly for named and optional parameters
                        var pd = pm.Parameters;
 
@@ -4756,17 +4784,17 @@ namespace Mono.CSharp {
                                                        param_count--;
                                        } else if (arg_count > param_count) {
                                                int args_gap = System.Math.Abs (arg_count - param_count);
-                                               return int.MaxValue - 10000 + args_gap;
+                                               return ArgumentCountMismatch + args_gap;
                                        } else if (arg_count < param_count - optional_count) {
                                                int args_gap = System.Math.Abs (param_count - optional_count - arg_count);
-                                               return int.MaxValue - 10000 + args_gap;
+                                               return ArgumentCountMismatch + args_gap;
                                        }
                                } else if (arg_count != param_count) {
                                        int args_gap = System.Math.Abs (arg_count - param_count);
                                        if (!cpd.HasParams)
-                                               return int.MaxValue - 10000 + args_gap;
+                                               return ArgumentCountMismatch + args_gap;
                                        if (arg_count < param_count - 1)
-                                               return int.MaxValue - 10000 + args_gap;
+                                               return ArgumentCountMismatch + args_gap;
                                }
 
                                // Resize to fit optional arguments
@@ -4803,7 +4831,7 @@ namespace Mono.CSharp {
 
                                                        // Named parameter not found
                                                        if (index < 0)
-                                                               return (i + 1) * 3;
+                                                               return NamedArgumentsMismatch - i;
 
                                                        // already reordered
                                                        if (index == i)
@@ -4819,8 +4847,8 @@ namespace Mono.CSharp {
                                                                ++arg_count;
                                                                temp = null;
                                                        } else {
-                                                               if (index == arg_count) 
-                                                                       return (i + 1) * 3;
+                                                               if (index == arg_count)
+                                                                       return NamedArgumentsMismatch - i - 1;
 
                                                                temp = arguments [index];
 
@@ -4857,7 +4885,7 @@ namespace Mono.CSharp {
                        // Don't do any expensive checks when the candidate cannot succeed
                        //
                        if (arg_count != param_count && !cpd.HasParams)
-                               return (param_count - arg_count) * 2 + 1;
+                               return DefaultArgumentMismatch - System.Math.Abs (param_count - arg_count);
 
                        var dep = candidate.GetMissingDependencies ();
                        if (dep != null) {
@@ -4874,7 +4902,7 @@ namespace Mono.CSharp {
                                if (type_arguments != null) {
                                        var g_args_count = ms.Arity;
                                        if (g_args_count != type_arguments.Count)
-                                               return int.MaxValue - 20000 + System.Math.Abs (type_arguments.Count - g_args_count);
+                                               return TypeArgumentsMismatch - System.Math.Abs (type_arguments.Count - g_args_count);
 
                                        if (type_arguments.Arguments != null)
                                                ms = ms.MakeGenericMethod (ec, type_arguments.Arguments);
@@ -4906,7 +4934,7 @@ namespace Mono.CSharp {
                                        TypeSpec[] i_args = ti.InferMethodArguments (ec, ms);
 
                                        if (i_args == null)
-                                               return ti.InferenceScore - 20000;
+                                               return TypeArgumentsMismatch - ti.InferenceScore;
 
                                        //
                                        // Clear any error messages when the result was success
@@ -4916,9 +4944,10 @@ namespace Mono.CSharp {
 
                                        if (i_args.Length != 0) {
                                                if (!errorMode) {
-                                                       foreach (var ta in i_args) {
+                                                       for (int i = 0; i < i_args.Length; ++i) {
+                                                               var ta = i_args [i];
                                                                if (!ta.IsAccessible (ec))
-                                                                       return ti.InferenceScore - 10000;
+                                                                       return TypeArgumentsMismatch - i;
                                                        }
                                                }
 
@@ -4931,7 +4960,7 @@ namespace Mono.CSharp {
                                //
                                if (!CheckInflatedArguments (ms)) {
                                        candidate = ms;
-                                       return int.MaxValue - 25000;
+                                       return InflatedTypesMismatch;
                                }
 
                                //
@@ -4954,7 +4983,7 @@ namespace Mono.CSharp {
                                ptypes = pd.Types;
                        } else {
                                if (type_arguments != null)
-                                       return int.MaxValue - 15000;
+                                       return UnexpectedTypeArguments;
 
                                ptypes = cpd.Types;
                        }
@@ -5115,31 +5144,36 @@ namespace Mono.CSharp {
                        // is used and argument is not of dynamic type
                        //
                        if (((argument.Modifier | param_mod) & Parameter.Modifier.RefOutMask) != 0) {
-                               if (argument.Type != parameter) {
+                               var arg_type = argument.Type;
+
+                               if ((argument.Modifier & Parameter.Modifier.RefOutMask) != (param_mod & Parameter.Modifier.RefOutMask)) {
+                                       //
+                                       // Using dynamic for ref/out parameter can still succeed at runtime
+                                       //
+                                       if (arg_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && (argument.Modifier & Parameter.Modifier.RefOutMask) == 0 && (restrictions & Restrictions.CovariantDelegate) == 0)
+                                               return -1;
+
+                                       return 1;
+                               }
+
+                               if (arg_type != parameter) {
+                                       if (arg_type == InternalType.VarOutType)
+                                               return 0;
+
                                        //
                                        // Do full equality check after quick path
                                        //
-                                       if (!TypeSpecComparer.IsEqual (argument.Type, parameter)) {
+                                       if (!TypeSpecComparer.IsEqual (arg_type, parameter)) {
                                                //
                                                // Using dynamic for ref/out parameter can still succeed at runtime
                                                //
-                                               if (argument.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && (argument.Modifier & Parameter.Modifier.RefOutMask) == 0 && (restrictions & Restrictions.CovariantDelegate) == 0)
+                                               if (arg_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && (argument.Modifier & Parameter.Modifier.RefOutMask) == 0 && (restrictions & Restrictions.CovariantDelegate) == 0)
                                                        return -1;
 
                                                return 2;
                                        }
                                }
 
-                               if ((argument.Modifier & Parameter.Modifier.RefOutMask) != (param_mod & Parameter.Modifier.RefOutMask)) {
-                                       //
-                                       // Using dynamic for ref/out parameter can still succeed at runtime
-                                       //
-                                       if (argument.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && (argument.Modifier & Parameter.Modifier.RefOutMask) == 0 && (restrictions & Restrictions.CovariantDelegate) == 0)
-                                               return -1;
-
-                                       return 1;
-                               }
-
                        } else {
                                if (argument.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && (restrictions & Restrictions.CovariantDelegate) == 0)
                                        return -1;
@@ -5712,10 +5746,20 @@ namespace Mono.CSharp {
                                        if ((a.Modifier & Parameter.Modifier.RefOutMask) != (p_mod & Parameter.Modifier.RefOutMask))
                                                break;
 
-                                       if (a.Expr.Type == pt || TypeSpecComparer.IsEqual (a.Expr.Type, pt))
+                                       var arg_type = a.Type;
+                                       if (arg_type == pt)
                                                continue;
 
-                                       break;
+                                       if (arg_type == InternalType.VarOutType) {
+                                               //
+                                               // Set underlying variable type based on parameter type
+                                               //
+                                               ((DeclarationExpression)a.Expr).Variable.Type = pt;
+                                               continue;
+                                       }
+
+                                       if (!TypeSpecComparer.IsEqual (arg_type, pt))
+                                               break;
                                }
 
                                NamedArgument na = a as NamedArgument;
@@ -5787,6 +5831,20 @@ namespace Mono.CSharp {
                        }
 
                        if (a_idx != arg_count) {
+                               //
+                               // Convert all var out argument to error type for less confusing error reporting
+                               // when no matching overload is found
+                               //
+                               for (; a_idx < arg_count; a_idx++) {
+                                       var arg = args [a_idx];
+                                       if (arg == null)
+                                               continue;
+
+                                       if (arg.Type == InternalType.VarOutType) {
+                                               ((DeclarationExpression)arg.Expr).Variable.Type = InternalType.ErrorType;
+                                       }
+                               }
+
                                ReportArgumentMismatch (ec, a_pos, member, a, pd, pt);
                                return false;
                        }
index 823c95c3141b69f4a4134880737bfe325522225c..c784f62d1c1506055b58f9a284b7c5affb94dfb2 100644 (file)
@@ -2493,6 +2493,96 @@ namespace Mono.CSharp
                        return expr;
                }
        }
+
+       public class DeclarationExpression : Expression, IMemoryLocation
+       {
+               LocalVariableReference lvr;
+
+               public DeclarationExpression (FullNamedExpression variableType, LocalVariable variable)
+               {
+                       VariableType = variableType;
+                       Variable = variable;
+                       this.loc = variable.Location;
+               }
+
+               public LocalVariable Variable { get; set; }
+               public Expression Initializer { get; set; }
+               public FullNamedExpression VariableType { get; set; }
+
+               public void AddressOf (EmitContext ec, AddressOp mode)
+               {
+                       Variable.CreateBuilder (ec);
+
+                       if (Initializer != null) {
+                               lvr.EmitAssign (ec, Initializer, false, false);
+                       }
+
+                       lvr.AddressOf (ec, mode);
+               }
+
+               protected override void CloneTo (CloneContext clonectx, Expression t)
+               {
+                       var target = (DeclarationExpression) t;
+
+                       target.VariableType = (FullNamedExpression) VariableType.Clone (clonectx);
+
+                       if (Initializer != null)
+                               target.Initializer = Initializer.Clone (clonectx);
+               }
+
+               public override Expression CreateExpressionTree (ResolveContext rc)
+               {
+                       rc.Report.Error (8046, loc, "An expression tree cannot contain a declaration expression");
+                       return null;
+               }
+
+               bool DoResolveCommon (ResolveContext rc)
+               {
+                       var var_expr = VariableType as VarExpr;
+                       if (var_expr != null) {
+                               type = InternalType.VarOutType;
+                       } else {
+                               type = VariableType.ResolveAsType (rc);
+                               if (type == null)
+                                       return false;
+                       }
+
+                       if (Initializer != null) {
+                               Initializer = Initializer.Resolve (rc);
+
+                               if (var_expr != null && Initializer != null && var_expr.InferType (rc, Initializer)) {
+                                       type = var_expr.Type;
+                               }
+                       }
+
+                       Variable.Type = type;
+                       lvr = new LocalVariableReference (Variable, loc);
+
+                       eclass = ExprClass.Variable;
+                       return true;
+               }
+
+               protected override Expression DoResolve (ResolveContext rc)
+               {
+                       if (DoResolveCommon (rc))
+                               lvr.Resolve (rc);
+
+                       return this;
+               }
+
+               public override Expression DoResolveLValue (ResolveContext rc, Expression right_side)
+               {
+                       if (lvr == null && DoResolveCommon (rc))
+                               lvr.ResolveLValue (rc, right_side);
+
+                       return this;
+               }
+
+               public override void Emit (EmitContext ec)
+               {
+                       throw new NotImplementedException ();
+               }
+       }
        
        //
        // C# 2.0 Default value expression
@@ -6472,6 +6562,9 @@ namespace Mono.CSharp
 
                void DoResolveBase (ResolveContext ec)
                {
+                       eclass = ExprClass.Variable;
+                       type = local_info.Type;
+
                        //
                        // If we are referencing a variable from the external block
                        // flag it for capturing
@@ -6490,9 +6583,6 @@ namespace Mono.CSharp
                                        storey.CaptureLocalVariable (ec, local_info);
                                }
                        }
-
-                       eclass = ExprClass.Variable;
-                       type = local_info.Type;
                }
 
                protected override Expression DoResolve (ResolveContext ec)
@@ -6500,6 +6590,14 @@ namespace Mono.CSharp
                        local_info.SetIsUsed ();
 
                        DoResolveBase (ec);
+
+                       if (local_info.Type == InternalType.VarOutType) {
+                               ec.Report.Error (8048, loc, "Cannot use uninitialized variable `{0}'",
+                                       GetSignatureForError ());
+
+                               type = InternalType.ErrorType;
+                       }
+
                        return this;
                }
 
@@ -7341,12 +7439,6 @@ namespace Mono.CSharp
                                return null;
                        }
 
-                       //
-                       // Any struct always defines parameterless constructor
-                       //
-                       if (type.IsStruct && arguments == null)
-                               return this;
-
                        bool dynamic;
                        if (arguments != null) {
                                arguments.Resolve (ec, out dynamic);
index d369ccf816d7b2b890009caa582e119f7a6f2a02..f549432b29ab1330142ff0291f4bf4b8eacda448 100644 (file)
@@ -1325,16 +1325,22 @@ namespace Mono.CSharp {
                                foreach (var ta in targs) {
                                        var tps = ta as TypeParameterSpec;
                                        IList<TypeSpec> ifaces;
+                                       TypeSpec b_type;
                                        if (tps != null) {
-                                               var b_type = tps.GetEffectiveBase ();
-                                               if (b_type != null && b_type.BuiltinType != BuiltinTypeSpec.Type.Object && b_type.BuiltinType != BuiltinTypeSpec.Type.ValueType)
-                                                       cache.AddBaseType (b_type);
-
+                                               b_type = tps.GetEffectiveBase ();
                                                ifaces = tps.InterfacesDefined;
                                        } else {
+                                               b_type = ta;
                                                ifaces = ta.Interfaces;
                                        }
 
+                                       //
+                                       // Don't add base type which was inflated from base constraints but it's not valid
+                                       // in C# context
+                                       //
+                                       if (b_type != null && b_type.BuiltinType != BuiltinTypeSpec.Type.Object && b_type.BuiltinType != BuiltinTypeSpec.Type.ValueType && !b_type.IsStructOrEnum)
+                                               cache.AddBaseType (b_type);
+
                                        if (ifaces != null) {
                                                foreach (var iface_type in ifaces) {
                                                        cache.AddInterface (iface_type);
@@ -2758,7 +2764,7 @@ namespace Mono.CSharp {
                //
                // Tracks successful rate of type inference
                //
-               int score = int.MaxValue;
+               int score;
                readonly Arguments arguments;
                readonly int arg_count;
 
@@ -2831,12 +2837,12 @@ namespace Mono.CSharp {
                                AnonymousMethodExpression am = a.Expr as AnonymousMethodExpression;
                                if (am != null) {
                                        if (am.ExplicitTypeInference (tic, method_parameter))
-                                               --score; 
+                                               ++score; 
                                        continue;
                                }
 
                                if (a.IsByRef) {
-                                       score -= tic.ExactInference (a.Type, method_parameter);
+                                       score += tic.ExactInference (a.Type, method_parameter);
                                        continue;
                                }
 
@@ -2844,14 +2850,14 @@ namespace Mono.CSharp {
                                        continue;
 
                                if (TypeSpec.IsValueType (method_parameter)) {
-                                       score -= tic.LowerBoundInference (a.Type, method_parameter);
+                                       score += tic.LowerBoundInference (a.Type, method_parameter);
                                        continue;
                                }
 
                                //
                                // Otherwise an output type inference is made
                                //
-                               score -= tic.OutputTypeInference (ec, a.Expr, method_parameter);
+                               score += tic.OutputTypeInference (ec, a.Expr, method_parameter);
                        }
 
                        //
@@ -2901,7 +2907,7 @@ namespace Mono.CSharp {
                                        if (arguments[i] == null)
                                                continue;
 
-                                       score -= tic.OutputTypeInference (ec, arguments[i].Expr, t_i);
+                                       score += tic.OutputTypeInference (ec, arguments[i].Expr, t_i);
                                }
                        }
 
@@ -3008,7 +3014,7 @@ namespace Mono.CSharp {
                        // Some types cannot be used as type arguments
                        //
                        if ((bound.Type.Kind == MemberKind.Void && !voidAllowed) || bound.Type.IsPointer || bound.Type.IsSpecialRuntimeType ||
-                               bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod)
+                               bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType)
                                return;
 
                        var a = bounds [index];
@@ -3034,8 +3040,8 @@ namespace Mono.CSharp {
                                        continue;
                                }
 
-                               if (TypeManager.IsGenericType (t))
-                                       return AllTypesAreFixed (TypeManager.GetTypeArguments (t));
+                               if (t.IsGeneric && !AllTypesAreFixed (t.TypeArguments))
+                                       return false;
                        }
                        
                        return true;
index a78b99c6419bcf212b1a9e67b90586bed3371a7e..bd1a6aabb961db3146b10fb17e217bf798322ec8 100644 (file)
@@ -1498,15 +1498,6 @@ namespace Mono.CSharp {
                                                        "`{0}': Struct constructors cannot call base constructors", caller_builder.GetSignatureForError ());
                                                return this;
                                        }
-                               } else {
-                                       //
-                                       // It is legal to have "this" initializers that take no arguments
-                                       // in structs
-                                       //
-                                       // struct D { public D (int a) : this () {}
-                                       //
-                                       if (ec.CurrentType.IsStruct && argument_list == null)
-                                               return this;
                                }
 
                                base_ctor = ConstructorLookup (ec, type, ref argument_list, loc);
@@ -1663,12 +1654,6 @@ namespace Mono.CSharp {
                protected override bool CheckBase ()
                {
                        if ((ModFlags & Modifiers.STATIC) != 0) {
-                               if (!parameters.IsEmpty) {
-                                       Report.Error (132, Location, "`{0}': The static constructor must be parameterless",
-                                               GetSignatureForError ());
-                                       return false;
-                               }
-
                                if ((caching_flags & Flags.MethodOverloadsExist) != 0)
                                        Parent.MemberCache.CheckExistingMembersOverloads (this, parameters);
 
@@ -1683,12 +1668,6 @@ namespace Mono.CSharp {
                        if ((caching_flags & Flags.MethodOverloadsExist) != 0)
                                Parent.MemberCache.CheckExistingMembersOverloads (this, parameters);
 
-                       if (Parent.PartialContainer.Kind == MemberKind.Struct && parameters.IsEmpty) {
-                               Report.Error (568, Location, 
-                                       "Structs cannot contain explicit parameterless constructors");
-                               return false;
-                       }
-
                        CheckProtectedModifier ();
                        
                        return true;
index a33159d8478bdb6100faa7ba75f376290c667a5c..6b42112f9ed1ae938c96aea045222e19f29405fd 100644 (file)
@@ -1446,6 +1446,7 @@ namespace Mono.CSharp
                public static readonly InternalType FakeInternalType = new InternalType ("<fake$type>");
                public static readonly InternalType Namespace = new InternalType ("<namespace>");
                public static readonly InternalType ErrorType = new InternalType ("<error>");
+               public static readonly InternalType VarOutType = new InternalType ("var out");
 
                readonly string name;
 
diff --git a/mcs/tests/gtest-624.cs b/mcs/tests/gtest-624.cs
new file mode 100644 (file)
index 0000000..0299d09
--- /dev/null
@@ -0,0 +1,36 @@
+using System;
+
+class Model
+{
+       public int Value;
+}
+
+class C1<T1>
+{
+       public void Add (Func<T1, int> t)
+       {
+       }
+}
+
+abstract class C2<TModel>
+{
+       public abstract void ApplyImpl<U> (C1<U> c1) where U : TModel;
+}
+
+class C3 : C2<Model>
+{
+       public override void ApplyImpl<Foo> (C1<Foo> c1)
+       {
+               c1.Add (t => t.Value);
+       }
+}
+
+class Program
+{
+       static void Main ()
+       {
+               var v1 = new C1<Model> ();
+               var c3 = new C3 ();
+               c3.ApplyImpl (v1);
+       }
+}
diff --git a/mcs/tests/gtest-autoproperty-10.cs b/mcs/tests/gtest-autoproperty-10.cs
new file mode 100644 (file)
index 0000000..a730856
--- /dev/null
@@ -0,0 +1,16 @@
+struct S
+{
+       public decimal P { get; } = -3;
+}
+
+class X
+{
+       public static int Main ()
+       {
+               var s = new S ();
+               if (s.P != -3)
+                       return 1;
+
+               return 0;
+       }
+}
\ No newline at end of file
index e538021cd0aff253f68ddc97dfe97a30991ec39a..43f605e6b5bac62c5cb503e695ce634e447b34f9 100644 (file)
@@ -210,6 +210,14 @@ struct MyTypeImplicitOnly
        }
 }
 
+struct StructWithUserConstructor
+{
+       public StructWithUserConstructor ()
+       {
+
+       }
+}
+
 class MemberAccessData
 {
        public bool BoolValue;
@@ -2190,6 +2198,17 @@ class Tester
                Assert<MyEnum> (0, e.Compile ().Invoke ());
        }
 
+       void NewTest_8 ()
+       {
+               Expression<Func<DateTime>> e = () => new DateTime ();
+               AssertNodeType (e, ExpressionType.New);
+               Assert (null, ((NewExpression)e.Body).Constructor, "default ctor");
+
+               Expression<Func<StructWithUserConstructor>> e2 = () => new StructWithUserConstructor ();
+               AssertNodeType (e2, ExpressionType.New);
+               Assert ("Void .ctor()", ((NewExpression)e2.Body).Constructor.ToString (), "user ctor");
+       }
+
        void NotTest ()
        {
                Expression<Func<bool, bool>> e = (bool a) => !a;
diff --git a/mcs/tests/gtest-lambda-36.cs b/mcs/tests/gtest-lambda-36.cs
new file mode 100644 (file)
index 0000000..0d4d772
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+
+class D<T>
+{
+       public void S<U, V> (Func<U> ftu, Func<T, U, V> ftuv)
+       {
+       }
+}
+
+class Test
+{
+       static D<V> Factory<V> (V v)
+       {
+               return new D<V> ();
+       }
+
+       static void Main ()
+       {
+               var danon = Factory (new { q = 5 });
+               
+               danon.S (
+                       () => "x",
+                       (l, str) => new { str }
+               );
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/gtest-optional-34.cs b/mcs/tests/gtest-optional-34.cs
new file mode 100644 (file)
index 0000000..bf865a7
--- /dev/null
@@ -0,0 +1,14 @@
+public struct S
+{
+       public S (double left = 0, double top = 0)
+               : this ()
+       {
+       }
+}
+
+class X
+{
+       public static void Main ()
+       {
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-906.cs b/mcs/tests/test-906.cs
new file mode 100644 (file)
index 0000000..2af641f
--- /dev/null
@@ -0,0 +1,75 @@
+using System;
+
+struct S1
+{
+       public readonly int Value;
+       
+       public S1 ()
+       {
+               Value = 17;
+       }
+}
+
+struct S2
+{
+       public readonly int Value = 23;
+}
+
+struct S3
+{
+       public readonly int Value = 11;
+       
+       public S3 ()
+       {
+               Value = 5;
+       }
+}
+
+struct S4
+{
+       public readonly int Value = 11;
+       
+       public S4 (int v)
+       {
+       }
+}
+
+struct S5
+{
+       public readonly int Value = 7;
+       
+       public S5 (int v)
+               : this ()
+       {
+               this.Value += v;
+       }
+}
+
+class C
+{
+       static int Main ()
+       {
+               var s = new S1 ();
+               if (s.Value != 17)
+                       return 1;
+
+               var s2 = new S2 ();
+               if (s2.Value != 23)
+                       return 2;
+
+               var s3 = new S3 ();
+               if (s3.Value != 5)
+                       return 3;
+
+               var s4 = new S4 (5);
+               if (s4.Value != 11)
+                       return 4;
+
+               var s5 = new S5 (2);
+               if (s5.Value != 9)
+                       return 5;
+
+               Console.WriteLine ("ok");
+               return 0;
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-decl-expr-01.cs b/mcs/tests/test-decl-expr-01.cs
new file mode 100644 (file)
index 0000000..15e781d
--- /dev/null
@@ -0,0 +1,65 @@
+using System;
+
+class DeclarationExpression
+{
+       public static int Main ()
+       {
+               Out (out int o);
+               if (o != 3)
+                       return 1;
+
+               if (Out (out int o1)) {
+                       if (o1 != 3)
+                               return 2;
+               }
+
+               Out (out int o2 = 2);
+               if (o2 != 3)
+                       return 3;
+
+               Out (out var o3);
+               if (o3 != 3)
+                       return 4;
+
+               Ref (ref int r = 2);
+               if (r != 7)
+                       return 5;
+
+               Ref (ref ((var r2 = 3)));
+               if (r2 != 8)
+                       return 6;
+
+               Out2 (str: "b", v: out var o5);
+               if (o5 != 9)
+                       return 7;
+
+               Out3 (out var o6 = 9m);
+               if (o6.GetType () != typeof (decimal))
+                       return 8;
+
+               Console.WriteLine ("ok");
+               return 0;
+       }
+
+       static bool Out (out int value)
+       {
+               value = 3;
+               return true;
+       }
+
+       static bool Out2 (out int v, string str)
+       {
+               v = 9;
+               return true;
+       }
+
+       static void Out3<T> (out T t)
+       {
+               t = default (T);
+       }
+
+       static void Ref (ref int arg)
+       {
+               arg += 5;
+       }
+}
\ No newline at end of file
index 233cfd0d03c254b522d4b80344d7032012519c6b..2e2fc7adbbeb87951fd9fe59ed179d07880d1da1 100644 (file)
@@ -14,6 +14,21 @@ struct S (int x)
        }
 }
 
+struct S2 (int arg)
+{
+       public readonly int v = arg;
+}
+
+struct S3 (string s = "arg")
+{
+       public readonly string V2 = s;
+
+       public S3 (int i, string s = "arg2")
+               : this (s)
+       {
+       }
+}
+
 class X
 {
        public static int Main ()
@@ -24,6 +39,15 @@ class X
                if (new S ('x').y != 1)
                        return 2;
 
+               if (new S2 (2).v != 2)
+                       return 3;
+
+               if (new S3 ("x").V2 != "x")
+                       return 4;
+
+               if (new S3 (0).V2 != "arg2")
+                       return 5;
+
                return 0;
        }
 }
\ No newline at end of file
index 224e5111e271f6168b1107c4073fba58fed1d6c5..d423fd25a71703afc6880bdb7a4804f2c45d6de0 100644 (file)
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-624.cs">\r
+    <type name="Model">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="C1`1[T1]">\r
+      <method name="Void Add(System.Func`2[T1,System.Int32])" attrs="134">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="C2`1[TModel]">\r
+      <method name="Void ApplyImpl[U](C1`1[U])" attrs="1478">\r
+        <size>0</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6276">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="C3">\r
+      <method name="Void ApplyImpl[Foo](C1`1[Foo])" attrs="198">\r
+        <size>20</size>\r
+      </method>\r
+      <method name="Int32 &lt;ApplyImpl`1&gt;m__0[Foo](Foo)" attrs="145">\r
+        <size>19</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="Program">\r
+      <method name="Void Main()" attrs="145">\r
+        <size>21</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-anontype-01.cs">\r
     <type name="Test">\r
       <method name="Int32 Main()" attrs="150">\r
         <size>13</size>\r
       </method>\r
     </type>\r
+    <type name="S2">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>15</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
+  <test name="gtest-autoproperty-10.cs">\r
+    <type name="S">\r
+      <method name="System.Decimal get_P()" attrs="2182">\r
+        <size>14</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>14</size>\r
+      </method>\r
+    </type>\r
+    <type name="X">\r
+      <method name="Int32 Main()" attrs="150">\r
+        <size>48</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
   </test>\r
   <test name="gtest-collectioninit-01.cs">\r
     <type name="Test">\r
         <size>12</size>\r
       </method>\r
     </type>\r
+    <type name="StructWithUserConstructor">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>2</size>\r
+      </method>\r
+    </type>\r
+    <type name="Tester">\r
+      <method name="Void NewTest_8()" attrs="129">\r
+        <size>140</size>\r
+      </method>\r
+    </type>\r
   </test>\r
   <test name="gtest-etree-02.cs">\r
     <type name="M">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-lambda-36.cs">\r
+    <type name="D`1[T]">\r
+      <method name="Void S[U,V](System.Func`1[U], System.Func`3[T,U,V])" attrs="134">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="Test">\r
+      <method name="D`1[V] Factory[V](V)" attrs="145">\r
+        <size>14</size>\r
+      </method>\r
+      <method name="Void Main()" attrs="145">\r
+        <size>78</size>\r
+      </method>\r
+      <method name="System.String &lt;Main&gt;m__0()" attrs="145">\r
+        <size>13</size>\r
+      </method>\r
+      <method name="&lt;&gt;__AnonType1`1[System.String] &lt;Main&gt;m__1(&lt;&gt;__AnonType0`1[System.Int32], System.String)" attrs="145">\r
+        <size>14</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+    <type name="&lt;&gt;__AnonType0`1[&lt;q&gt;__T]">\r
+      <method name="&lt;q&gt;__T get_q()" attrs="2182">\r
+        <size>7</size>\r
+      </method>\r
+      <method name="Boolean Equals(System.Object)" attrs="198">\r
+        <size>39</size>\r
+      </method>\r
+      <method name="Int32 GetHashCode()" attrs="198">\r
+        <size>63</size>\r
+      </method>\r
+      <method name="System.String ToString()" attrs="198">\r
+        <size>67</size>\r
+      </method>\r
+      <method name="Void .ctor(&lt;q&gt;__T)" attrs="6278">\r
+        <size>14</size>\r
+      </method>\r
+    </type>\r
+    <type name="&lt;&gt;__AnonType1`1[&lt;str&gt;__T]">\r
+      <method name="&lt;str&gt;__T get_str()" attrs="2182">\r
+        <size>7</size>\r
+      </method>\r
+      <method name="Boolean Equals(System.Object)" attrs="198">\r
+        <size>39</size>\r
+      </method>\r
+      <method name="Int32 GetHashCode()" attrs="198">\r
+        <size>63</size>\r
+      </method>\r
+      <method name="System.String ToString()" attrs="198">\r
+        <size>67</size>\r
+      </method>\r
+      <method name="Void .ctor(&lt;str&gt;__T)" attrs="6278">\r
+        <size>14</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-linq-01.cs">\r
     <type name="from.C">\r
       <method name="Void Main()" attrs="150">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="gtest-optional-34.cs">\r
+    <type name="S">\r
+      <method name="Void .ctor(Double, Double)" attrs="6278">\r
+        <size>9</size>\r
+      </method>\r
+    </type>\r
+    <type name="X">\r
+      <method name="Void Main()" attrs="150">\r
+        <size>2</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="gtest-partial-01.cs">\r
     <type name="B`1[U]">\r
       <method name="Void .ctor()" attrs="6278">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-906.cs">\r
+    <type name="S1">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>10</size>\r
+      </method>\r
+    </type>\r
+    <type name="S2">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>9</size>\r
+      </method>\r
+    </type>\r
+    <type name="S3">\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>17</size>\r
+      </method>\r
+    </type>\r
+    <type name="S4">\r
+      <method name="Void .ctor(Int32)" attrs="6278">\r
+        <size>10</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>9</size>\r
+      </method>\r
+    </type>\r
+    <type name="S5">\r
+      <method name="Void .ctor(Int32)" attrs="6278">\r
+        <size>22</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>8</size>\r
+      </method>\r
+    </type>\r
+    <type name="C">\r
+      <method name="Int32 Main()" attrs="145">\r
+        <size>161</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-91.cs">\r
     <type name="Abstract">\r
       <method name="Void .ctor()" attrs="6276">\r
       </method>\r
     </type>\r
   </test>\r
+  <test name="test-decl-expr-01.cs">\r
+    <type name="DeclarationExpression">\r
+      <method name="Int32 Main()" attrs="150">\r
+        <size>252</size>\r
+      </method>\r
+      <method name="Boolean Out(Int32 ByRef)" attrs="145">\r
+        <size>13</size>\r
+      </method>\r
+      <method name="Boolean Out2(Int32 ByRef, System.String)" attrs="145">\r
+        <size>14</size>\r
+      </method>\r
+      <method name="Void Out3[T](T ByRef)" attrs="145">\r
+        <size>17</size>\r
+      </method>\r
+      <method name="Void Ref(Int32 ByRef)" attrs="145">\r
+        <size>8</size>\r
+      </method>\r
+      <method name="Void .ctor()" attrs="6278">\r
+        <size>7</size>\r
+      </method>\r
+    </type>\r
+  </test>\r
   <test name="test-dictinit-01.cs">\r
     <type name="Program">\r
       <method name="Int32 Main()" attrs="145">\r
     </type>\r
     <type name="X">\r
       <method name="Int32 Main()" attrs="150">\r
-        <size>69</size>\r
+        <size>180</size>\r
       </method>\r
       <method name="Void .ctor()" attrs="6278">\r
         <size>7</size>\r
       </method>\r
     </type>\r
+    <type name="S2">\r
+      <method name="Void .ctor(Int32)" attrs="6278">\r
+        <size>8</size>\r
+      </method>\r
+    </type>\r
+    <type name="S3">\r
+      <method name="Void .ctor(Int32, String)" attrs="6278">\r
+        <size>9</size>\r
+      </method>\r
+      <method name="Void .ctor(String)" attrs="6278">\r
+        <size>8</size>\r
+      </method>\r
+    </type>\r
   </test>\r
   <test name="test-primary-ctor-08.cs">\r
     <type name="S">\r
index e4ff1eed87c55e50b568f54284249beb82ce885b..ad24c3d2d4e2078d16d3c98a6e16b3d7317c2c03 100644 (file)
@@ -90,6 +90,17 @@ cleanup:
        -rm -Rf Test/en.actual Test/html.actual
        -rm -f monodocer1.exe*
 
+Test/DocTest-DropNS-classic-secondary.dll:
+       @echo $(value @)
+       $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic-secondary.cs
+
+Test/DocTest-DropNS-classic.dll:
+       @echo $(value @)
+       $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-classic.cs
+
+Test/DocTest-DropNS-unified.dll:
+       $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest-DropNS-unified.cs
+
 Test/DocTest.dll: 
        $(CSCOMPILE) $(TEST_CSCFLAGS) -debug -unsafe -target:library -out:$@ Test/DocTest.cs
 
@@ -106,6 +117,36 @@ Test/DocTest.dll-v2:
        -rm -f Test/DocTest.dll
        $(MAKE) TEST_CSCFLAGS=$(TEST_CSCFLAGS) Test/DocTest.dll
 
+check-monodocer-dropns-classic: $(PROGRAM)
+       # tests the simplest --dropns case, a single class where the root namespace was dropped.
+       -rm -Rf Test/en.actual
+       $(MAKE) Test/DocTest-DropNS-classic.dll
+       $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll
+       $(MAKE) update-monodocer-dropns-unified
+       diff --exclude=.svn -rup Test/en.expected-dropns-classic-v1 Test/en.actual
+
+check-monodocer-dropns-classic-withsecondary: $(PROGRAM)
+       # tests case where a secondary assembly is included with a --dropns parameter
+       -rm -Rf Test/en.actual
+       $(MAKE) Test/DocTest-DropNS-classic.dll
+       $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
+       $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic.dll Test/DocTest-DropNS-classic-secondary.dll
+       $(MAKE) update-monodocer-dropns-unified-withsecondary
+       diff --exclude=.svn -rup Test/en.expected-dropns-classic-withsecondary Test/en.actual
+
+update-monodocer-dropns-unified: $(PROGRAM)
+       $(MAKE) Test/DocTest-DropNS-unified.dll
+       $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll --dropns Test/DocTest-DropNS-unified.dll=MyFramework
+
+update-monodocer-dropns-unified-withsecondary: $(PROGRAM)
+       $(MAKE) Test/DocTest-DropNS-unified.dll
+       $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-unified.dll Test/DocTest-DropNS-classic-secondary.dll --dropns Test/DocTest-DropNS-unified.dll=MyFramework
+
+update-monodocer-dropns-classic-secondary: $(PROGRAM)
+       $(MAKE) Test/DocTest-DropNS-classic-secondary.dll
+       $(MONO) $(PROGRAM) update --exceptions=all -o Test/en.actual Test/DocTest-DropNS-classic-secondary.dll
+               
+
 check-monodocer-update: $(PROGRAM)
        find Test/en.expected -name \*.xml -exec rm "{}" \;
        $(MAKE) Test/DocTest.dll-v1
@@ -262,8 +303,11 @@ check-doc-tools-update: check-monodocer-since-update \
        check-monodocer-importecmadoc-update \
        check-monodocer-importslashdoc-update \
        check-monodocer-update \
+       check-monodocer-dropns-classic \
+       check-monodocer-dropns-classic-withsecondary \
        check-monodocer-delete-update \
        check-mdoc-export-html-update \
        check-mdoc-export-msxdoc-update \
-       check-mdoc-validate-update
+       check-mdoc-validate-update 
+
 
index 75a6d5ca63e3306dfd27c5996a930a3118ebe725..09763096e5592bb4d1ab98594760c1f2d95e9bea 100644 (file)
@@ -120,7 +120,7 @@ namespace Mono.Documentation {
                        string typename = t.FullName;
 
                        bool isInAssembly = MDocUpdater.IsInAssemblies (t.Module.Name);
-                       if (isInAssembly && MDocUpdater.HasDroppedNamespace () && !typename.StartsWith ("System")) {
+                       if (isInAssembly && !typename.StartsWith ("System") && MDocUpdater.HasDroppedNamespace (t)) {
                                string nameWithDropped = string.Format ("{0}.{1}", MDocUpdater.droppedNamespace, typename);
                                return nameWithDropped;
                        }
@@ -166,9 +166,30 @@ class MDocUpdater : MDocCommand
        HashSet<string> forwardedTypes = new HashSet<string> ();
 
        public static string droppedNamespace = string.Empty;
-       public static bool HasDroppedNamespace() {
-               return !string.IsNullOrWhiteSpace (droppedNamespace);
+
+       public static bool HasDroppedNamespace(TypeDefinition forType) 
+       {
+               return HasDroppedNamespace(forType.Module);
+       }
+
+       public static bool HasDroppedNamespace(MemberReference forMember) 
+       {
+               return HasDroppedNamespace(forMember.Module);
+       }
+
+       public static bool HasDroppedNamespace(AssemblyDefinition forAssembly) 
+       {
+               return HasDroppedNamespace(forAssembly.MainModule);
+       }
+
+       public static bool HasDroppedNamespace(ModuleDefinition forModule) 
+       {
+               return !string.IsNullOrWhiteSpace (droppedNamespace) && droppedAssemblies.Any(da => da == forModule.Name);
        }
+
+       
+       static List<string> droppedAssemblies = new List<string>();
+
        public string PreserveTag { get; set; }
        public static MDocUpdater Instance { get; private set; }
        public static bool SwitchingToMagicTypes { get; private set; }
@@ -236,8 +257,16 @@ class MDocUpdater : MDocCommand
                          "Only update documentation for {TYPE}.",
                                v => types.Add (v) },
                        { "dropns=",
-                               "Instructs the update process that {NAMESPACE} has been dropped, so that types and members will match existing documentation nodes.",
-                               v => droppedNamespace = v },
+                         "When processing assembly {ASSEMBLY}, strip off leading namespace {PREFIX}:\n" +
+                         "  e.g. --dropns ASSEMBLY=PREFIX",
+                         v => {
+                           var parts = v.Split ('=');
+                           if (parts.Length != 2) { Console.Error.WriteLine ("Invalid dropns input"); return; }
+                           var assembly = Path.GetFileName (parts [0].Trim ());
+                           var prefix = parts [1].Trim();
+                           droppedAssemblies.Add (assembly);
+                           droppedNamespace = prefix;
+                       } },
                        { "ntypes",
                                "If the new assembly is switching to 'magic types', then this switch should be defined.",
                                v => SwitchingToMagicTypes = true },
@@ -580,7 +609,7 @@ class MDocUpdater : MDocCommand
                        nsname
                };
 
-               if (MDocUpdater.HasDroppedNamespace ()) {
+               if (MDocUpdater.HasDroppedNamespace (type)) {
                        // If dropping namespace, types may have moved into a couple of different places.
                        var newSearchLocations = searchLocations.Union (new string[] {
                                string.Format ("{0}.{1}", droppedNamespace, nsname),
@@ -847,10 +876,10 @@ class MDocUpdater : MDocCommand
                        
                        // Add namespace and type nodes into the index file as needed
                        AddIndexType (type, index_types);
-                               
+
                        // Ensure the namespace index file exists
                        string namespaceToUse = type.Namespace;
-                       if (HasDroppedNamespace()) {
+                       if (HasDroppedNamespace(assembly)) {
                                namespaceToUse = string.Format ("{0}.{1}", droppedNamespace, namespaceToUse);
                        }
                        string onsdoc = DocUtils.PathCombine (dest, namespaceToUse + ".xml");
@@ -974,7 +1003,9 @@ class MDocUpdater : MDocCommand
                                        XmlDocument doc = new XmlDocument ();
                                        doc.Load (typefile.FullName);
                                        XmlElement e = doc.SelectSingleNode("/Type") as XmlElement;
-                                       if (e != null && !no_assembly_versions && UpdateAssemblyVersions(e, GetAssemblyVersions(), false)) {
+                                       string assemblyName = doc.SelectSingleNode ("/Type/AssemblyInfo/AssemblyName").InnerText;
+                                       AssemblyDefinition assembly = assemblies.FirstOrDefault (a => a.Name.Name == assemblyName);
+                                       if (e != null && !no_assembly_versions && assembly != null && assemblyName != null && UpdateAssemblyVersions(e, assembly, GetAssemblyVersions(assemblyName), false)) {
                                                using (TextWriter writer = OpenWrite (typefile.FullName, FileMode.Truncate))
                                                        WriteXml(doc.DocumentElement, writer);
                                                goodfiles.Add (relTypeFile);
@@ -1002,9 +1033,11 @@ class MDocUpdater : MDocCommand
                return w;
        }
 
-       private string[] GetAssemblyVersions ()
+       private string[] GetAssemblyVersions (string assemblyName)
        {
-               return (from a in assemblies select GetAssemblyVersion (a)).ToArray ();
+               return (from a in assemblies 
+                       where a.Name.Name == assemblyName 
+                       select GetAssemblyVersion (a)).ToArray ();
        }
 
        private static void CleanupIndexTypes (XmlElement index_types, HashSet<string> goodfiles)
@@ -1088,10 +1121,10 @@ class MDocUpdater : MDocCommand
                        
                        // Deleted (or signature changed)
                        if (oldmember2 == null) {
-                               if (!no_assembly_versions && UpdateAssemblyVersions (oldmember, new string[]{ GetAssemblyVersion (type.Module.Assembly) }, false))
+                               if (!no_assembly_versions && UpdateAssemblyVersions (oldmember, type.Module.Assembly, new string[]{ GetAssemblyVersion (type.Module.Assembly) }, false))
                                        continue;
 
-                               DeleteMember ("Member Removed", output, oldmember, todelete);
+                               DeleteMember ("Member Removed", output, oldmember, todelete, type);
                                continue;
                        }
                        
@@ -1101,7 +1134,7 @@ class MDocUpdater : MDocCommand
                                        // ignore, already seen
                                }
                                else if (DefaultMemberComparer.Compare (oldmember, seenmembers [sig]) == 0)
-                                       DeleteMember ("Duplicate Member Found", output, oldmember, todelete);
+                                       DeleteMember ("Duplicate Member Found", output, oldmember, todelete, type);
                                else
                                        Warning ("TODO: found a duplicate member '{0}', but it's not identical to the prior member found!", sig);
                                continue;
@@ -1232,7 +1265,7 @@ class MDocUpdater : MDocCommand
                return null;
        }
 
-       void DeleteMember (string reason, string output, XmlNode member, MyXmlNodeList todelete)
+       void DeleteMember (string reason, string output, XmlNode member, MyXmlNodeList todelete, TypeDefinition type)
        {
                string format = output != null
                        ? "{0}: File='{1}'; Signature='{4}'"
@@ -1245,7 +1278,7 @@ class MDocUpdater : MDocCommand
                                member.SelectSingleNode ("MemberSignature[@Language='C#']/@Value").Value);
                        if (!delete && MemberDocsHaveUserContent (member)) {
                                Warning ("Member deletions must be enabled with the --delete option.");
-                       } else if (HasDroppedNamespace ()) {
+                       } else if (HasDroppedNamespace (type)) {
                                // if we're dropping the namespace, add the "classic style"
                                var existingAttribute = member.Attributes ["apistyle"];
                                if (existingAttribute != null) {
@@ -1258,7 +1291,7 @@ class MDocUpdater : MDocCommand
 
                                        member.Attributes.Append (apistyleAttr);
                                }
-                       } else if (!HasDroppedNamespace () && member.Attributes ["apistyle"] != null && member.Attributes ["apistyle"].Value == "unified") {
+                       } else if (!HasDroppedNamespace (type) && member.Attributes ["apistyle"] != null && member.Attributes ["apistyle"].Value == "unified") {
                                // do nothing if there's an apistyle=new attribute and we haven't dropped the namespace
                        } else if (!string.IsNullOrWhiteSpace (PreserveTag)) {
                                // do nothing
@@ -1400,10 +1433,11 @@ class MDocUpdater : MDocCommand
                                        var node = WriteElementAttribute (root, element, "Language", f.Language, forceNewElement: true);
                                        var newnode = WriteElementAttribute (root, node, "Value", valueToUse);
                                        return newnode;
-                               });
+                               },
+                               type);
                }
                
-               string assemblyInfoNodeFilter = MDocUpdater.HasDroppedNamespace () ? "[@apistyle='unified']" : "[not(@apistyle) or @apistyle='classic']";
+               string assemblyInfoNodeFilter = MDocUpdater.HasDroppedNamespace (type) ? "[@apistyle='unified']" : "[not(@apistyle) or @apistyle='classic']";
 
                AddXmlNode(
                        root.SelectNodes ("AssemblyInfo" + assemblyInfoNodeFilter).Cast<XmlElement> ().ToArray (),
@@ -1412,12 +1446,13 @@ class MDocUpdater : MDocCommand
                        () => {
                                XmlElement ass = WriteElement(root, "AssemblyInfo", forceNewElement:true);
                                
-                               if (MDocUpdater.HasDroppedNamespace ()) ass.SetAttribute ("apistyle", "unified");
+                               if (MDocUpdater.HasDroppedNamespace (type)) ass.SetAttribute ("apistyle", "unified");
 
                                
 
                                return ass;
-                       });
+                       },
+                       type);
 
                foreach(var ass in root.SelectNodes ("AssemblyInfo" + assemblyInfoNodeFilter).Cast<XmlElement> ())
                {
@@ -1448,7 +1483,7 @@ class MDocUpdater : MDocCommand
                }
                
                if (type.IsGenericType ()) {
-                               MakeTypeParameters (root, type.GenericParameters, MDocUpdater.HasDroppedNamespace());
+                               MakeTypeParameters (root, type.GenericParameters, type, MDocUpdater.HasDroppedNamespace(type));
                } else {
                        ClearElement(root, "TypeParameters");
                }
@@ -1505,9 +1540,10 @@ class MDocUpdater : MDocCommand
                        MakeAttributes (root, GetCustomAttributes (type), type);
                
                if (DocUtils.IsDelegate (type)) {
-                               MakeTypeParameters (root, type.GenericParameters, MDocUpdater.HasDroppedNamespace());
-                       MakeParameters(root, type.GetMethod("Invoke").Parameters);
-                       MakeReturnValue(root, type.GetMethod("Invoke"));
+                       MakeTypeParameters (root, type.GenericParameters, type, MDocUpdater.HasDroppedNamespace(type));
+                       var member = type.GetMethod ("Invoke");
+                       MakeParameters(root, member, member.Parameters);
+                       MakeReturnValue(root, member);
                }
                
                DocsNodeInfo typeInfo = new DocsNodeInfo (WriteElement(root, "Docs"), type);
@@ -1567,7 +1603,8 @@ class MDocUpdater : MDocCommand
                                        var node = WriteElementAttribute (me, element, "Language", f.Language, forceNewElement:true);
                                        var newNode = WriteElementAttribute (me, node, "Value", valueToUse);
                                        return newNode;
-                               });
+                               },
+                               mi);
 
                }
 
@@ -1582,13 +1619,13 @@ class MDocUpdater : MDocCommand
 
                MakeAttributes (me, GetCustomAttributes (mi), mi.DeclaringType);
 
-               MakeReturnValue(me, mi, MDocUpdater.HasDroppedNamespace());
+               MakeReturnValue(me, mi, MDocUpdater.HasDroppedNamespace(mi));
                if (mi is MethodReference) {
                        MethodReference mb = (MethodReference) mi;
                        if (mb.IsGenericMethod ())
-                                       MakeTypeParameters (me, mb.GenericParameters, MDocUpdater.HasDroppedNamespace());
+                                       MakeTypeParameters (me, mb.GenericParameters, mi, MDocUpdater.HasDroppedNamespace(mi));
                }
-               MakeParameters(me, mi, MDocUpdater.HasDroppedNamespace());
+               MakeParameters(me, mi, MDocUpdater.HasDroppedNamespace(mi));
                
                string fieldValue;
                if (mi is FieldDefinition && GetFieldConstValue ((FieldDefinition)mi, out fieldValue))
@@ -1600,14 +1637,22 @@ class MDocUpdater : MDocCommand
                UpdateExtensionMethods (me, info);
        }
 
+       static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, MemberReference member) {
+               AddXmlNode (relevant, valueMatches, setValue, makeNewNode, member.Module);
+       }
+
+       static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, TypeDefinition type) {
+               AddXmlNode (relevant, valueMatches, setValue, makeNewNode, type.Module);
+       }
+
        /// <summary>Adds an xml node, reusing the node if it's available</summary>
        /// <param name="relevant">The existing set of nodes</param>
        /// <param name="valueMatches">Checks to see if the node's value matches what you're trying to write.</param>
        /// <param name="setValue">Sets the node's value</param>
        /// <param name="makeNewNode">Creates a new node, if valueMatches returns false.</param>
-       static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode)
+       static void AddXmlNode (XmlElement[] relevant, Func<XmlElement, bool> valueMatches, Action<XmlElement> setValue, Func<XmlElement> makeNewNode, ModuleDefinition module)
        {
-               bool shouldDuplicate = MDocUpdater.HasDroppedNamespace ();
+               bool shouldDuplicate = MDocUpdater.HasDroppedNamespace (module);
                var styleToUse = shouldDuplicate ? ApiStyle.Unified : ApiStyle.Classic;
                var existing = relevant;
                bool done = false;
@@ -2164,7 +2209,7 @@ class MDocUpdater : MDocCommand
                TypeDefinition type = member as TypeDefinition;
                if (type == null)
                        type = member.DeclaringType as TypeDefinition;
-               return UpdateAssemblyVersions(root, new string[]{ GetAssemblyVersion (type.Module.Assembly) }, add);
+               return UpdateAssemblyVersions(root, type.Module.Assembly, new string[]{ GetAssemblyVersion (type.Module.Assembly) }, add);
        }
        
        private static string GetAssemblyVersion (AssemblyDefinition assembly)
@@ -2172,7 +2217,7 @@ class MDocUpdater : MDocCommand
                return assembly.Name.Version.ToString();
        }
        
-       private static bool UpdateAssemblyVersions(XmlElement root, string[] assemblyVersions, bool add)
+       private static bool UpdateAssemblyVersions(XmlElement root, AssemblyDefinition assembly, string[] assemblyVersions, bool add)
        {
                XmlElement av = (XmlElement) root.SelectSingleNode ("AssemblyVersions");
                if (av != null) {
@@ -2182,14 +2227,14 @@ class MDocUpdater : MDocCommand
 
                string oldNodeFilter = "AssemblyInfo[not(@apistyle) or @apistyle='classic']";
                string newNodeFilter = "AssemblyInfo[@apistyle='unified']";
-               string thisNodeFilter = MDocUpdater.HasDroppedNamespace () ? newNodeFilter : oldNodeFilter;
-               string thatNodeFilter = MDocUpdater.HasDroppedNamespace () ? oldNodeFilter : newNodeFilter;
+               string thisNodeFilter = MDocUpdater.HasDroppedNamespace (assembly) ? newNodeFilter : oldNodeFilter;
+               string thatNodeFilter = MDocUpdater.HasDroppedNamespace (assembly) ? oldNodeFilter : newNodeFilter;
 
                XmlElement e = (XmlElement) root.SelectSingleNode (thisNodeFilter);
                if (e == null) {
                        e = root.OwnerDocument.CreateElement("AssemblyInfo");
 
-                       if (MDocUpdater.HasDroppedNamespace ()) {
+                       if (MDocUpdater.HasDroppedNamespace (assembly)) {
                                e.SetAttribute ("apistyle", "unified");
                        }
 
@@ -2197,7 +2242,7 @@ class MDocUpdater : MDocCommand
                }
 
                var thatNode = (XmlElement) root.SelectSingleNode (thatNodeFilter);
-               if (MDocUpdater.HasDroppedNamespace () && thatNode != null) {
+               if (MDocUpdater.HasDroppedNamespace (assembly) && thatNode != null) {
                        // there's a classic node, we should add apistyles
                        e.SetAttribute ("apistyle", "unified");
                        thatNode.SetAttribute ("apistyle", "classic");
@@ -2333,7 +2378,7 @@ class MDocUpdater : MDocCommand
                return Convert.ToInt64 (value);
        }
        
-       private void MakeParameters (XmlElement root, IList<ParameterDefinition> parameters, bool shouldDuplicateWithNew=false)
+       private void MakeParameters (XmlElement root, MemberReference member, IList<ParameterDefinition> parameters, bool shouldDuplicateWithNew=false)
        {
                XmlElement e = WriteElement(root, "Parameters");
 
@@ -2382,13 +2427,14 @@ class MDocUpdater : MDocCommand
 
                                        MakeAttributes (pe, GetCustomAttributes (p.CustomAttributes, ""));
                                        return pe;
-                               });
+                               },
+                               member);
 
                        i++;
                }
        }
        
-       private void MakeTypeParameters (XmlElement root, IList<GenericParameter> typeParams, bool shouldDuplicateWithNew)
+       private void MakeTypeParameters (XmlElement root, IList<GenericParameter> typeParams, MemberReference member, bool shouldDuplicateWithNew)
        {
                if (typeParams == null || typeParams.Count == 0) {
                        XmlElement f = (XmlElement) root.SelectSingleNode ("TypeParameters");
@@ -2450,18 +2496,19 @@ class MDocUpdater : MDocCommand
                                                }
                                        
                                                return pe;
-                                       });
+                                       },
+                               member);
                }
        }
 
        private void MakeParameters (XmlElement root, MemberReference mi, bool shouldDuplicateWithNew)
        {
                if (mi is MethodDefinition && ((MethodDefinition) mi).IsConstructor)
-                               MakeParameters (root, ((MethodDefinition)mi).Parameters, shouldDuplicateWithNew);
+                               MakeParameters (root, mi, ((MethodDefinition)mi).Parameters, shouldDuplicateWithNew);
                else if (mi is MethodDefinition) {
                        MethodDefinition mb = (MethodDefinition) mi;
                        IList<ParameterDefinition> parameters = mb.Parameters;
-                               MakeParameters(root, parameters, shouldDuplicateWithNew);
+                               MakeParameters(root, mi, parameters, shouldDuplicateWithNew);
                        if (parameters.Count > 0 && DocUtils.IsExtensionMethod (mb)) {
                                XmlElement p = (XmlElement) root.SelectSingleNode ("Parameters/Parameter[position()=1]");
                                p.SetAttribute ("RefType", "this");
@@ -2470,7 +2517,7 @@ class MDocUpdater : MDocCommand
                else if (mi is PropertyDefinition) {
                        IList<ParameterDefinition> parameters = ((PropertyDefinition)mi).Parameters;
                        if (parameters.Count > 0)
-                                       MakeParameters(root, parameters, shouldDuplicateWithNew);
+                                       MakeParameters(root, mi, parameters, shouldDuplicateWithNew);
                        else
                                return;
                }
@@ -2498,7 +2545,8 @@ class MDocUpdater : MDocCommand
                                                MakeAttributes(e, GetCustomAttributes (attributes, ""), type);
 
                                        return newNode;
-                               });
+                               },
+                       type);
        }
        
        private void MakeReturnValue (XmlElement root, MemberReference mi, bool shouldDuplicateWithNew=false)
@@ -2913,7 +2961,7 @@ static class DocUtils {
                        // first, make sure this isn't a type reference to another assembly/module
 
                        bool isInAssembly = MDocUpdater.IsInAssemblies(type.Module.Name);
-                       if (isInAssembly && MDocUpdater.HasDroppedNamespace () && !typeNS.StartsWith ("System")) {
+                       if (isInAssembly && !typeNS.StartsWith ("System") && MDocUpdater.HasDroppedNamespace (type)) {
                                typeNS = string.Format ("{0}.{1}", MDocUpdater.droppedNamespace, typeNS);
                        }
                        return typeNS;
@@ -3217,7 +3265,7 @@ class DocumentationEnumerator {
                                        // did not match ... if we're dropping the namespace, and the paramType has the dropped
                                        // namespace, we should see if it matches when added
                                        bool stillDoesntMatch = true;
-                                       if (MDocUpdater.HasDroppedNamespace() && paramType.StartsWith (MDocUpdater.droppedNamespace)) {
+                                       if (MDocUpdater.HasDroppedNamespace(type) && paramType.StartsWith (MDocUpdater.droppedNamespace)) {
                                                string withDroppedNs = string.Format ("{0}.{1}", MDocUpdater.droppedNamespace, xmlMemberType);
 
                                                stillDoesntMatch = withDroppedNs != paramType;
@@ -3270,7 +3318,7 @@ class DocumentationEnumerator {
        {
                // In case of dropping the namespace, we have to remove the dropped NS
                // so that docName will match what's in the assembly/type
-               if (MDocUpdater.HasDroppedNamespace () && docName.StartsWith(MDocUpdater.droppedNamespace + ".")) {
+               if (MDocUpdater.HasDroppedNamespace (type) && docName.StartsWith(MDocUpdater.droppedNamespace + ".")) {
                        int droppedNsLength = MDocUpdater.droppedNamespace.Length;
                        docName = docName.Substring (droppedNsLength + 1, docName.Length - droppedNsLength - 1);
                }
diff --git a/mcs/tools/mdoc/Test/DocTest-DropNS-classic-secondary.cs b/mcs/tools/mdoc/Test/DocTest-DropNS-classic-secondary.cs
new file mode 100644 (file)
index 0000000..3f929d6
--- /dev/null
@@ -0,0 +1,9 @@
+namespace MyFramework.MyOtherNamespace {
+       ///<summary>Make sure the namespace in this assembly doesn't get 'dropped'</summary>
+       public class MyOtherClass {
+               public string MyProperty {get;set;}
+               public float Hello(int value) {
+                       return 0.0f;
+               }
+       }
+}
diff --git a/mcs/tools/mdoc/Test/DocTest-DropNS-classic.cs b/mcs/tools/mdoc/Test/DocTest-DropNS-classic.cs
new file mode 100644 (file)
index 0000000..a279b0e
--- /dev/null
@@ -0,0 +1,8 @@
+namespace MyFramework.MyNamespace {
+       public class MyClass {
+               public string MyProperty {get;set;}
+               public float Hello(int value) {
+                       return 0.0f;
+               }
+       }
+}
diff --git a/mcs/tools/mdoc/Test/DocTest-DropNS-unified.cs b/mcs/tools/mdoc/Test/DocTest-DropNS-unified.cs
new file mode 100644 (file)
index 0000000..8ee5e8a
--- /dev/null
@@ -0,0 +1,8 @@
+namespace MyNamespace {
+       public class MyClass {
+               public string MyProperty {get;set;}
+               public float Hello(int value) {
+                       return 0.0f;
+               }
+       }
+}
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/MyFramework.MyNamespace/MyClass.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/MyFramework.MyNamespace/MyClass.xml
new file mode 100644 (file)
index 0000000..1e0522f
--- /dev/null
@@ -0,0 +1,67 @@
+<Type Name="MyClass" FullName="MyFramework.MyNamespace.MyClass">
+  <TypeSignature Language="C#" Value="public class MyClass" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MyClass extends System.Object" />
+  <AssemblyInfo>
+    <AssemblyName>DocTest-DropNS-classic</AssemblyName>
+    <AssemblyVersion>0.0.0.0</AssemblyVersion>
+  </AssemblyInfo>
+  <Base>
+    <BaseTypeName>System.Object</BaseTypeName>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public MyClass ();" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters />
+      <Docs>
+        <summary>To be added.</summary>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Hello">
+      <MemberSignature Language="C#" Value="public float Hello (int value);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 Hello(int32 value) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Single</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="value" Type="System.Int32" />
+      </Parameters>
+      <Docs>
+        <param name="value">To be added.</param>
+        <summary>To be added.</summary>
+        <returns>To be added.</returns>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="MyProperty">
+      <MemberSignature Language="C#" Value="public string MyProperty { get; set; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string MyProperty" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>To be added.</summary>
+        <value>To be added.</value>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/index.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/index.xml
new file mode 100644 (file)
index 0000000..4f7838b
--- /dev/null
@@ -0,0 +1,22 @@
+<Overview>
+  <Assemblies>
+    <Assembly Name="DocTest-DropNS-classic" Version="0.0.0.0">
+      <Attributes>
+        <Attribute>
+          <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
+        </Attribute>
+        <Attribute>
+          <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+        </Attribute>
+      </Attributes>
+    </Assembly>
+  </Assemblies>
+  <Remarks>To be added.</Remarks>
+  <Copyright>To be added.</Copyright>
+  <Types>
+    <Namespace Name="MyFramework.MyNamespace">
+      <Type Name="MyClass" Kind="Class" />
+    </Namespace>
+  </Types>
+  <Title>DocTest-DropNS-classic</Title>
+</Overview>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/ns-MyFramework.MyNamespace.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-v0/ns-MyFramework.MyNamespace.xml
new file mode 100644 (file)
index 0000000..74df75a
--- /dev/null
@@ -0,0 +1,6 @@
+<Namespace Name="MyFramework.MyNamespace">
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+</Namespace>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/MyFramework.MyNamespace/MyClass.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/MyFramework.MyNamespace/MyClass.xml
new file mode 100644 (file)
index 0000000..e3cda6d
--- /dev/null
@@ -0,0 +1,80 @@
+<Type Name="MyClass" FullName="MyFramework.MyNamespace.MyClass">
+  <TypeSignature Language="C#" Value="public class MyClass" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MyClass extends System.Object" />
+  <AssemblyInfo apistyle="classic">
+    <AssemblyName>DocTest-DropNS-classic</AssemblyName>
+    <AssemblyVersion>0.0.0.0</AssemblyVersion>
+  </AssemblyInfo>
+  <AssemblyInfo apistyle="unified">
+    <AssemblyName>DocTest-DropNS-unified</AssemblyName>
+    <AssemblyVersion>0.0.0.0</AssemblyVersion>
+  </AssemblyInfo>
+  <Base>
+    <BaseTypeName>System.Object</BaseTypeName>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public MyClass ();" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo apistyle="classic">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <AssemblyInfo apistyle="unified">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters />
+      <Docs>
+        <summary>To be added.</summary>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Hello">
+      <MemberSignature Language="C#" Value="public float Hello (int value);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 Hello(int32 value) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo apistyle="classic">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <AssemblyInfo apistyle="unified">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Single</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="value" Type="System.Int32" />
+      </Parameters>
+      <Docs>
+        <param name="value">To be added.</param>
+        <summary>To be added.</summary>
+        <returns>To be added.</returns>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="MyProperty">
+      <MemberSignature Language="C#" Value="public string MyProperty { get; set; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string MyProperty" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo apistyle="classic">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <AssemblyInfo apistyle="unified">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>To be added.</summary>
+        <value>To be added.</value>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/index.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/index.xml
new file mode 100644 (file)
index 0000000..edacc72
--- /dev/null
@@ -0,0 +1,22 @@
+<Overview>
+  <Assemblies>
+    <Assembly Name="DocTest-DropNS-unified" Version="0.0.0.0">
+      <Attributes>
+        <Attribute>
+          <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
+        </Attribute>
+        <Attribute>
+          <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+        </Attribute>
+      </Attributes>
+    </Assembly>
+  </Assemblies>
+  <Remarks>To be added.</Remarks>
+  <Copyright>To be added.</Copyright>
+  <Types>
+    <Namespace Name="MyFramework.MyNamespace">
+      <Type Name="MyClass" Kind="Class" />
+    </Namespace>
+  </Types>
+  <Title>DocTest-DropNS-classic</Title>
+</Overview>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/ns-MyFramework.MyNamespace.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-v1/ns-MyFramework.MyNamespace.xml
new file mode 100644 (file)
index 0000000..74df75a
--- /dev/null
@@ -0,0 +1,6 @@
+<Namespace Name="MyFramework.MyNamespace">
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+</Namespace>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/MyFramework.MyNamespace/MyClass.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/MyFramework.MyNamespace/MyClass.xml
new file mode 100644 (file)
index 0000000..e3cda6d
--- /dev/null
@@ -0,0 +1,80 @@
+<Type Name="MyClass" FullName="MyFramework.MyNamespace.MyClass">
+  <TypeSignature Language="C#" Value="public class MyClass" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MyClass extends System.Object" />
+  <AssemblyInfo apistyle="classic">
+    <AssemblyName>DocTest-DropNS-classic</AssemblyName>
+    <AssemblyVersion>0.0.0.0</AssemblyVersion>
+  </AssemblyInfo>
+  <AssemblyInfo apistyle="unified">
+    <AssemblyName>DocTest-DropNS-unified</AssemblyName>
+    <AssemblyVersion>0.0.0.0</AssemblyVersion>
+  </AssemblyInfo>
+  <Base>
+    <BaseTypeName>System.Object</BaseTypeName>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public MyClass ();" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo apistyle="classic">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <AssemblyInfo apistyle="unified">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters />
+      <Docs>
+        <summary>To be added.</summary>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Hello">
+      <MemberSignature Language="C#" Value="public float Hello (int value);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 Hello(int32 value) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo apistyle="classic">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <AssemblyInfo apistyle="unified">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Single</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="value" Type="System.Int32" />
+      </Parameters>
+      <Docs>
+        <param name="value">To be added.</param>
+        <summary>To be added.</summary>
+        <returns>To be added.</returns>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="MyProperty">
+      <MemberSignature Language="C#" Value="public string MyProperty { get; set; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string MyProperty" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo apistyle="classic">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <AssemblyInfo apistyle="unified">
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>To be added.</summary>
+        <value>To be added.</value>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/MyFramework.MyOtherNamespace/MyOtherClass.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/MyFramework.MyOtherNamespace/MyOtherClass.xml
new file mode 100644 (file)
index 0000000..a178fc4
--- /dev/null
@@ -0,0 +1,67 @@
+<Type Name="MyOtherClass" FullName="MyFramework.MyOtherNamespace.MyOtherClass">
+  <TypeSignature Language="C#" Value="public class MyOtherClass" />
+  <TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit MyOtherClass extends System.Object" />
+  <AssemblyInfo>
+    <AssemblyName>DocTest-DropNS-classic-secondary</AssemblyName>
+    <AssemblyVersion>0.0.0.0</AssemblyVersion>
+  </AssemblyInfo>
+  <Base>
+    <BaseTypeName>System.Object</BaseTypeName>
+  </Base>
+  <Interfaces />
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+  <Members>
+    <Member MemberName=".ctor">
+      <MemberSignature Language="C#" Value="public MyOtherClass ();" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
+      <MemberType>Constructor</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <Parameters />
+      <Docs>
+        <summary>To be added.</summary>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="Hello">
+      <MemberSignature Language="C#" Value="public float Hello (int value);" />
+      <MemberSignature Language="ILAsm" Value=".method public hidebysig instance float32 Hello(int32 value) cil managed" />
+      <MemberType>Method</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.Single</ReturnType>
+      </ReturnValue>
+      <Parameters>
+        <Parameter Name="value" Type="System.Int32" />
+      </Parameters>
+      <Docs>
+        <param name="value">To be added.</param>
+        <summary>To be added.</summary>
+        <returns>To be added.</returns>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+    <Member MemberName="MyProperty">
+      <MemberSignature Language="C#" Value="public string MyProperty { get; set; }" />
+      <MemberSignature Language="ILAsm" Value=".property instance string MyProperty" />
+      <MemberType>Property</MemberType>
+      <AssemblyInfo>
+        <AssemblyVersion>0.0.0.0</AssemblyVersion>
+      </AssemblyInfo>
+      <ReturnValue>
+        <ReturnType>System.String</ReturnType>
+      </ReturnValue>
+      <Docs>
+        <summary>To be added.</summary>
+        <value>To be added.</value>
+        <remarks>To be added.</remarks>
+      </Docs>
+    </Member>
+  </Members>
+</Type>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/index.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/index.xml
new file mode 100644 (file)
index 0000000..d0fb593
--- /dev/null
@@ -0,0 +1,35 @@
+<Overview>
+  <Assemblies>
+    <Assembly Name="DocTest-DropNS-unified" Version="0.0.0.0">
+      <Attributes>
+        <Attribute>
+          <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
+        </Attribute>
+        <Attribute>
+          <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+        </Attribute>
+      </Attributes>
+    </Assembly>
+    <Assembly Name="DocTest-DropNS-classic-secondary" Version="0.0.0.0">
+      <Attributes>
+        <Attribute>
+          <AttributeName>System.Diagnostics.Debuggable(System.Diagnostics.DebuggableAttribute+DebuggingModes.IgnoreSymbolStoreSequencePoints)</AttributeName>
+        </Attribute>
+        <Attribute>
+          <AttributeName>System.Runtime.CompilerServices.RuntimeCompatibility(WrapNonExceptionThrows=true)</AttributeName>
+        </Attribute>
+      </Attributes>
+    </Assembly>
+  </Assemblies>
+  <Remarks>To be added.</Remarks>
+  <Copyright>To be added.</Copyright>
+  <Types>
+    <Namespace Name="MyFramework.MyNamespace">
+      <Type Name="MyClass" Kind="Class" />
+    </Namespace>
+    <Namespace Name="MyFramework.MyOtherNamespace">
+      <Type Name="MyOtherClass" Kind="Class" />
+    </Namespace>
+  </Types>
+  <Title>Untitled</Title>
+</Overview>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/ns-MyFramework.MyNamespace.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/ns-MyFramework.MyNamespace.xml
new file mode 100644 (file)
index 0000000..74df75a
--- /dev/null
@@ -0,0 +1,6 @@
+<Namespace Name="MyFramework.MyNamespace">
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+</Namespace>
diff --git a/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/ns-MyFramework.MyOtherNamespace.xml b/mcs/tools/mdoc/Test/en.expected-dropns-classic-withsecondary/ns-MyFramework.MyOtherNamespace.xml
new file mode 100644 (file)
index 0000000..8bdef1c
--- /dev/null
@@ -0,0 +1,6 @@
+<Namespace Name="MyFramework.MyOtherNamespace">
+  <Docs>
+    <summary>To be added.</summary>
+    <remarks>To be added.</remarks>
+  </Docs>
+</Namespace>
index f13ce63d029438bedb9bb1c7ebd96c6530d93191..6e1189953777686f059a4cf8fc24af6649dcf390 100755 (executable)
@@ -715,9 +715,14 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                if (use_dos2unix == null) {
                        use_dos2unix = false;
                        try {
-                               var dos2unix = Process.Start ("dos2unix");
+                               var info = new ProcessStartInfo ("dos2unix");
+                               info.CreateNoWindow = true;
+                               info.RedirectStandardInput = true;
+                               info.UseShellExecute = false;
+                               var dos2unix = Process.Start (info);
                                dos2unix.StandardInput.WriteLine ("aaa");
                                dos2unix.StandardInput.WriteLine ("\u0004");
+                               dos2unix.StandardInput.Close ();
                                dos2unix.WaitForExit ();
                                if (dos2unix.ExitCode == 0)
                                        use_dos2unix = true;
index c9baa67ccfeeb03264046f7da6961b7ffc78692c..ba771b51660dac6eb01f7d228211b65e14f07c5a 100644 (file)
@@ -6,7 +6,7 @@ include ../../build/rules.make
 LOCAL_MCS_FLAGS = /lib:$(topdir)/class/lib/$(PROFILE) -r:Mono.Security.dll
 
 SECURITY_PROGRAMS = secutil.exe cert2spc.exe sn.exe makecert.exe chktrust.exe crlupdate.exe \
-       signcode.exe setreg.exe certmgr.exe caspol.exe permview.exe mozroots.exe
+       signcode.exe setreg.exe certmgr.exe caspol.exe permview.exe mozroots.exe cert-sync.exe
 SECURITY_PROGRAMS_2_0 = httpcfg.exe
 
 HELPER_SOURCES = AssemblyInfo.cs $(topdir)/build/common/Consts.cs
diff --git a/mcs/tools/security/cert-sync.cs b/mcs/tools/security/cert-sync.cs
new file mode 100644 (file)
index 0000000..4428067
--- /dev/null
@@ -0,0 +1,226 @@
+//
+// cert-sync.cs: Import the root certificates from Linux SSL store into Mono
+//
+// Authors:
+//     Sebastien Pouliot <sebastien@ximian.com>
+//     Jo Shields <jo.shields@xamarin.com>
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.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;
+using System.Collections;
+using System.IO;
+using System.Net;
+using System.Reflection;
+using System.Security.Cryptography;
+using System.Text;
+
+using Mono.Security.X509;
+
+[assembly: AssemblyTitle ("Linux Cert Store Sync")]
+[assembly: AssemblyDescription ("Synchronize local certs with certs from local Linux trust store.")]
+
+namespace Mono.Tools
+{
+
+       class CertSync
+       {
+       
+               static string inputFile;
+               static bool quiet;
+
+               static X509Certificate DecodeCertificate (string s)
+               {
+                       byte[] rawdata = Convert.FromBase64String (s);
+                       return new X509Certificate (rawdata);
+               }
+
+               static Stream GetFile ()
+               {
+                       try {
+                               if (inputFile != null) {
+                                       return File.OpenRead (inputFile);
+                               } else {
+                                       return null;
+                               }
+                       } catch {
+                               return null;
+                       }
+               }
+
+               static X509CertificateCollection DecodeCollection ()
+               {
+                       X509CertificateCollection roots = new X509CertificateCollection ();
+                       StringBuilder sb = new StringBuilder ();
+                       bool processing = false;
+
+                       using (Stream s = GetFile ()) {
+                               if (s == null) {
+                                       WriteLine ("Couldn't retrieve the file using the supplied information.");
+                                       return null;
+                               }
+
+                               StreamReader sr = new StreamReader (s);
+                               while (true) {
+                                       string line = sr.ReadLine ();
+                                       if (line == null)
+                                               break;
+
+                                       if (processing) {
+                                               if (line.StartsWith ("-----END CERTIFICATE-----")) {
+                                                       processing = false;
+                                                       X509Certificate root = DecodeCertificate (sb.ToString ());
+                                                       roots.Add (root);
+
+                                                       sb = new StringBuilder ();
+                                                       continue;
+                                               }
+                                               sb.Append (line);
+                                       } else {
+                                               processing = line.StartsWith ("-----BEGIN CERTIFICATE-----");
+                                       }
+                               }
+                               return roots;
+                       }
+               }
+
+               static int Process ()
+               {
+                       X509CertificateCollection roots = DecodeCollection ();
+                       if (roots == null) {
+                               return 1;
+                       } else if (roots.Count == 0) {
+                               WriteLine ("No certificates were found.");
+                               return 0;
+                       }
+                               
+                       X509Stores stores = (X509StoreManager.LocalMachine);
+                       X509CertificateCollection trusted = stores.TrustedRoot.Certificates;
+                       int additions = 0;
+                       WriteLine ("I already trust {0}, your new list has {1}", trusted.Count, roots.Count);
+                       foreach (X509Certificate root in roots) {
+                               if (!trusted.Contains (root)) {
+                                       try {
+                                               stores.TrustedRoot.Import (root);
+                                               WriteLine ("Certificate added: {0}", root.SubjectName);
+                                       } catch {
+                                               WriteLine ("Warning: Could not import {0}");
+                                       }
+                                       additions++;
+                               }
+                       }
+                       if (additions > 0)
+                               WriteLine ("{0} new root certificates were added to your trust store.", additions);
+
+                       X509CertificateCollection removed = new X509CertificateCollection ();
+                       foreach (X509Certificate trust in trusted) {
+                               if (!roots.Contains (trust)) {
+                                       removed.Add (trust);
+                               }
+                       }
+                       if (removed.Count > 0) {
+                               WriteLine ("{0} previously trusted certificates were removed.", removed.Count);
+
+                               foreach (X509Certificate old in removed) {
+                                       stores.TrustedRoot.Remove (old);
+                                       WriteLine ("Certificate removed: {0}", old.SubjectName);
+                               }
+                       }
+                       WriteLine ("Import process completed.");
+                       return 0;
+               }
+
+               static string Thumbprint (string algorithm, X509Certificate certificate)
+               {
+                       HashAlgorithm hash = HashAlgorithm.Create (algorithm);
+                       byte[] digest = hash.ComputeHash (certificate.RawData);
+                       return BitConverter.ToString (digest);
+               }
+
+               static bool ParseOptions (string[] args)
+               {
+                       if (args.Length < 1)
+                               return false;
+
+                       for (int i = 0; i < args.Length - 1; i++) {
+                               switch (args [i]) {
+                               case "--quiet":
+                                       quiet = true;
+                                       break;
+                               default:
+                                       WriteLine ("Unknown option '{0}'.");
+                                       return false;
+                               }
+                       }
+                       inputFile = args [args.Length - 1];
+                       if (!File.Exists (inputFile)) {
+                               WriteLine ("Unknown option or file not found '{0}'.");
+                               return false;
+                       }
+                       return true;
+               }
+
+               static void Header ()
+               {
+                       Console.WriteLine (new AssemblyInfo ().ToString ());
+               }
+
+               static void Help ()
+               {
+                       Console.WriteLine ("Usage: cert-sync [--quiet] system-ca-bundle.crt");
+                       Console.WriteLine ("Where system-ca-bundle.crt is in PEM format");
+               }
+
+               static void WriteLine (string str)
+               {
+                       if (!quiet)
+                               Console.WriteLine (str);
+               }
+
+               static void WriteLine (string format, params object[] args)
+               {
+                       if (!quiet)
+                               Console.WriteLine (format, args);
+               }
+
+               static int Main (string[] args)
+               {
+                       try {
+                               if (!ParseOptions (args)) {
+                                       Header ();
+                                       Help ();
+                                       return 1;
+                               }
+                               if (!quiet) {
+                                       Header ();
+                               }
+                               return Process ();
+                       } catch (Exception e) {
+                               // ignore quiet on exception
+                               Console.WriteLine ("Error: {0}", e);
+                               return 1;
+                       }
+               }
+       }
+}
\ No newline at end of file
index 169cb07617adb06ac4bcb88ea5cc6fd59adad7b6..03672d4197efd1f5439337d506be2a9cdb2a815e 100644 (file)
@@ -3904,7 +3904,7 @@ GetLogicalDriveStrings_Mtab (guint32 len, gunichar2 *buf)
 }
 #endif
 
-#if (defined(HAVE_STATVFS) || defined(HAVE_STATFS)) && !defined(PLATFORM_ANDROID)
+#if defined(HAVE_STATVFS) || defined(HAVE_STATFS)
 gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, WapiULargeInteger *free_bytes_avail,
                            WapiULargeInteger *total_number_of_bytes,
                            WapiULargeInteger *total_number_of_free_bytes)
@@ -3943,7 +3943,11 @@ gboolean GetDiskFreeSpaceEx(const gunichar2 *path_name, WapiULargeInteger *free_
                block_size = fsstat.f_frsize;
 #elif defined(HAVE_STATFS)
                ret = statfs (utf8_path_name, &fsstat);
+#if defined (MNT_RDONLY)
                isreadonly = ((fsstat.f_flags & MNT_RDONLY) == MNT_RDONLY);
+#elif defined (MS_RDONLY)
+               isreadonly = ((fsstat.f_flags & MS_RDONLY) == MS_RDONLY);
+#endif
                block_size = fsstat.f_bsize;
 #endif
        } while(ret == -1 && errno == EINTR);
index 45b9a606ab6ff7ed8e719e52af416ddffd417694..c46bdfa2db4c9b762d643ebd4d2d64c3167a300e 100644 (file)
@@ -2415,6 +2415,7 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        unload_data *thread_data;
        MonoNativeThreadId tid;
        MonoDomain *caller_domain = mono_domain_get ();
+       char *name;
 
        /* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, GetCurrentThreadId ()); */
 
@@ -2466,7 +2467,10 @@ mono_domain_try_unload (MonoDomain *domain, MonoObject **exc)
        thread_handle = mono_threads_create_thread ((LPTHREAD_START_ROUTINE)unload_thread_main, thread_data, 0, CREATE_SUSPENDED, &tid);
        if (thread_handle == NULL)
                return;
+       name = g_strdup_printf ("Unload thread for domain %x", domain);
+       mono_thread_info_set_name (tid, name);
        mono_thread_info_resume (tid);
+       g_free (name);
 
        /* Wait for the thread */       
        while (!thread_data->done && WaitForSingleObjectEx (thread_handle, INFINITE, TRUE) == WAIT_IO_COMPLETION) {
index 5df6721ed4dbe1151f1cf9e6af83f95d03eb116e..bdbeb1daf6b9fcfd947ee467885762fa09a739b8 100644 (file)
@@ -223,7 +223,7 @@ static const DateTimeFormatEntry datetime_format_entries [] = {
        {3943, 2309, 323, 331, 44, 55, 0, 0, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {36041, 36052, 13523, 36063, 36074, 36081, 36090, 36103, 36110, 36123, 36136, 36149, 0}, {36041, 36052, 13523, 36063, 36074, 36081, 36090, 36103, 36110, 36123, 36136, 36149, 0}, {36041, 36052, 13523, 36063, 36074, 36081, 36090, 36103, 36110, 36123, 36136, 36149, 0}, {36041, 36052, 13523, 36063, 36074, 36081, 36090, 36103, 36110, 36123, 36136, 36149, 0}, 0, 6, 2541, 241, {2309,1236,1210,0,0,0,0,0,0,0,0,0,0,0},{3943,254,0,0,0,0,0,0},{331,274,35,0,0,0,0,0,0,0,0,0},{323,280,23,0,0,0,0,0,0}},
        {1344, 2927, 323, 331, 1375, 1391, 1404, 1411, {1418, 1428, 1438, 1448, 1458, 1468, 1478}, {34903, 34910, 34917, 34924, 34931, 34938, 34945}, {1537, 1541, 1545, 1549, 1553, 1557, 1561}, {1655, 1660, 1665, 1670, 1675, 1680, 1685, 1690, 1695, 1700, 1706, 1712, 0}, {1655, 1660, 1665, 1670, 1675, 1680, 1685, 1690, 1695, 1700, 1706, 1712, 0}, {1655, 1660, 1665, 1670, 1675, 1680, 1685, 1690, 1695, 1700, 1706, 1712, 0}, {1655, 1660, 1665, 1670, 1675, 1680, 1685, 1690, 1695, 1700, 1706, 1712, 0}, 0, 0, 239, 241, {2927,1229,14,1765,1779,1366,1736,1210,0,0,0,0,0,0},{1344,36162,36189,2543,0,0,0,0},{331,274,0,0,0,0,0,0,0,0,0,0},{323,280,0,0,0,0,0,0,0}},
        {2568, 2587, 280, 274, 1906, 1916, 2598, 2604, {2611, 2619, 2626, 2635, 2644, 2655, 2663}, {2671, 2674, 2677, 2680, 2683, 2686, 2689}, {2018, 2403, 2692, 2403, 2692, 2409, 2018}, {2694, 2701, 2709, 2715, 2721, 2725, 2730, 2735, 2742, 2752, 2760, 2769, 0}, {2694, 2701, 2709, 2715, 2721, 2725, 2730, 2735, 2742, 2752, 2760, 2769, 0}, {2778, 2782, 2786, 2791, 2721, 2795, 2799, 2803, 2807, 2811, 2815, 2819, 0}, {2778, 2782, 2786, 2791, 2721, 2795, 2799, 2803, 2807, 2811, 2815, 2819, 0}, 2, 1, 754, 241, {2587,1245,2835,35120,2843,1210,0,0,0,0,0,0,0,0},{2568,1882,35130,0,0,0,0,0},{274,331,8214,8204,2862,8237,8242,8223,8229,0,0,0},{280,323,8274,8287,2887,2873,2902,0,0}},
-       {2909, 14812, 2936, 2947, 1906, 352, 7992, 21969, {3719, 3726, 3733, 3741, 3751, 3760, 3767}, {3776, 3780, 3784, 3788, 3792, 3796, 3800}, {2018, 2403, 2405, 3804, 2405, 2409, 2018}, {3806, 3814, 3823, 2715, 3829, 3833, 3838, 2735, 2742, 3843, 2760, 3851, 0}, {3806, 3814, 3823, 2715, 3829, 3833, 3838, 2735, 2742, 3843, 2760, 3851, 0}, {2778, 2782, 3860, 2791, 3829, 2795, 2799, 2803, 2807, 3864, 2815, 3868, 0}, {2778, 2782, 3860, 2791, 3829, 2795, 2799, 2803, 2807, 3864, 2815, 3868, 0}, 0, 0, 239, 241, {14812,1221,14,2835,1210,0,0,0,0,0,0,0,0,0},{2909,3672,0,0,0,0,0,0},{2947,35,274,331,0,0,0,0,0,0,0,0},{2936,23,280,323,0,0,0,0,0}},
+       {2909, 14812, 2936, 2947, 1906, 352, 7213, 7218, {3719, 3726, 3733, 3741, 3751, 3760, 3767}, {3776, 3780, 3784, 3788, 3792, 3796, 3800}, {2018, 2403, 2405, 3804, 2405, 2409, 2018}, {3806, 3814, 3823, 2715, 3829, 3833, 3838, 2735, 2742, 3843, 2760, 3851, 0}, {3806, 3814, 3823, 2715, 3829, 3833, 3838, 2735, 2742, 3843, 2760, 3851, 0}, {2778, 2782, 3860, 2791, 3829, 2795, 2799, 2803, 2807, 3864, 2815, 3868, 0}, {2778, 2782, 3860, 2791, 3829, 2795, 2799, 2803, 2807, 3864, 2815, 3868, 0}, 0, 0, 239, 241, {14812,1221,14,2835,1210,0,0,0,0,0,0,0,0,0},{2909,3672,0,0,0,0,0,0},{2947,35,274,331,0,0,0,0,0,0,0,0},{2936,23,280,323,0,0,0,0,0}},
        {4342, 243, 23, 35, 947, 3985, 962, 968, {3997, 4005, 4011, 4018, 4029, 4036, 4044}, {4052, 4057, 4062, 4067, 4073, 4078, 4083}, {2692, 2411, 2403, 2403, 4089, 4091, 2018}, {4093, 4099, 4107, 4113, 4119, 4124, 4130, 4136, 4143, 4154, 4162, 4172, 0}, {4182, 4188, 4196, 1102, 4202, 4207, 4213, 4219, 4226, 1140, 4237, 4247, 0}, {4257, 4262, 4062, 4267, 4272, 4277, 4282, 4287, 4292, 4298, 4303, 4308, 0}, {4257, 4262, 4062, 4267, 4272, 4277, 4282, 4287, 4292, 4298, 4303, 4308, 0}, 0, 1, 239, 241, {243,14,1229,1236,1210,0,0,0,0,0,0,0,0,0},{4313,4342,4369,0,0,0,0,0},{35,2947,331,274,0,0,0,0,0,0,0,0},{23,2936,323,280,0,0,0,0,0}},
        {36205, 243, 280, 274, 1906, 352, 1924, 1927, {4874, 4883, 4889, 4895, 4904, 4910, 4919}, {4926, 4931, 4936, 4941, 4946, 4951, 4956}, {2692, 2411, 2403, 2403, 4089, 4091, 2018}, {4961, 4969, 4978, 4983, 4989, 4993, 4998, 5006, 5012, 5022, 1148, 5030, 0}, {4961, 4969, 4978, 4983, 4989, 4993, 4998, 5006, 5012, 5022, 1148, 5030, 0}, {5040, 5046, 4978, 5053, 4989, 4993, 5058, 5006, 5064, 1195, 1200, 5070, 0}, {5040, 5046, 4978, 5053, 4989, 4993, 5058, 5006, 5064, 1195, 1200, 5070, 0}, 2, 1, 239, 241, {243,14,1245,1236,1210,0,0,0,0,0,0,0,0,0},{4857,5076,3672,0,0,0,0,0},{274,331,5085,5091,5101,0,0,0,0,0,0,0},{280,323,0,0,0,0,0,0,0}},
        {1882, 2261, 323, 331, 1906, 11991, 36228, 36238, {9068, 9077, 9089, 9096, 9104, 9114, 9120}, {9127, 9131, 9135, 9139, 9143, 9148, 9152}, {0, 0, 0, 0, 0, 0, 0}, {2413, 2420, 15113, 2434, 2440, 2444, 2449, 11959, 36246, 36256, 36264, 36273, 0}, {2413, 2420, 15113, 2434, 2440, 2444, 2449, 11959, 36246, 36256, 36264, 36273, 0}, {2497, 2501, 2505, 2509, 2440, 2513, 2517, 11966, 2525, 2529, 2533, 2537, 0}, {2497, 2501, 2505, 2509, 2440, 2513, 2517, 11966, 2525, 2529, 2533, 2537, 0}, 0, 1, 754, 241, {2261,2843,1895,2587,9640,1245,11970,1210,0,0,0,0,0,0},{1882,2554,2568,0,0,0,0,0},{331,274,0,0,0,0,0,0,0,0,0,0},{323,280,0,0,0,0,0,0,0}},
index 39d226d3b25038728185704b3d0d6d70a5f8363a..3bbd0058032c2534bb43ef4161c7faad6e2f4870 100644 (file)
@@ -577,7 +577,7 @@ my_g_bit_nth_msf (gsize mask)
        if (_BitScanReverse (&bIndex, mask))
                return bIndex;
        return -1;
-#elif defined(__x86_64__) && defined(_MSC_VER)
+#elif defined(_M_X64) && defined(_MSC_VER)
        unsigned long bIndex = 0;
        if (_BitScanReverse64 (&bIndex, mask))
                return bIndex;
@@ -597,7 +597,7 @@ my_g_bit_nth_msf (gsize mask)
        i = sizeof (gsize) * 8;
        while (i > 0) {
                i --;
-               if (mask & (1UL << i))
+               if (mask & (1ULL << i))
                        return i;
        }
        return -1;
old mode 100644 (file)
new mode 100755 (executable)
index b1b912f..013e73b
@@ -160,9 +160,13 @@ gint32
 mono_domain_get_tls_offset (void)
 {
        int offset = -1;
+
+#ifdef HOST_WIN32
+       if (appdomain_thread_id)
+               offset = appdomain_thread_id;
+#else
        MONO_THREAD_VAR_OFFSET (tls_appdomain, offset);
-/*     __asm ("jmp 1f; .section writetext, \"awx\"; 1: movl $tls_appdomain@ntpoff, %0; jmp 2f; .previous; 2:" 
-               : "=r" (offset));*/
+#endif
        return offset;
 }
 
index 09ea19b3d79a90a2d2fe986820071417c5f43f71..f7dc1497a016f82819a51cc235f723aaa9b29327 100644 (file)
@@ -2278,6 +2278,18 @@ mono_stack_walk_no_il (MonoStackWalk func, gpointer user_data)
        mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (stack_walk_adapter, NULL, MONO_UNWIND_DEFAULT, &ud);
 }
 
+/*
+ * mono_stack_walk_async_safe:
+ *
+ *   Async safe version callable from signal handlers.
+ */
+void
+mono_stack_walk_async_safe (MonoStackWalk func, gpointer user_data)
+{
+       StackWalkUserData ud = { func, user_data };
+       mono_get_eh_callbacks ()->mono_walk_stack_with_ctx (stack_walk_adapter, NULL, MONO_UNWIND_NONE, &ud);
+}
+
 static gboolean
 last_managed (MonoMethod *m, gint no, gint ilo, gboolean managed, gpointer data)
 {
index b159dee727ab7a6bb55896e513bb25ed90634fa6..ae0ca4417737da07e3487f333c08cbc8fd0eaa95 100644 (file)
@@ -90,6 +90,9 @@ mono_stack_walk         (MonoStackWalk func, void* user_data);
 MONO_API void
 mono_stack_walk_no_il   (MonoStackWalk func, void* user_data);
 
+MONO_API void
+mono_stack_walk_async_safe   (MonoStackWalk func, void* user_data);
+
 MONO_END_DECLS
 
 #endif
index c283b7aae365d41de7992da0773e812e7388c806..c738d53654ef315d6035d05158b4c962725a5962 100644 (file)
@@ -535,6 +535,7 @@ typedef struct {
         */
        GSList *apps;
        GSList *assemblies;
+       char *aot_options;
 } MonoAotCacheConfig;
 
 #define MONO_SIZEOF_METHOD_SIGNATURE (sizeof (struct _MonoMethodSignature) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
index 1e85012dd0fb002c192bb4b0c973ddfb8b02bcb1..c9e9e030b8c41354b5ddf2af83701ec657a40b3a 100644 (file)
@@ -375,7 +375,6 @@ aot_cache_start (gpointer user_data,
        for (i = 0; attribute_names [i]; ++i) {
                if (!strcmp (attribute_names [i], "app")) {
                        config->apps = g_slist_prepend (config->apps, g_strdup (attribute_values [i]));
-                       return;
                }
        }
 
@@ -391,6 +390,8 @@ aot_cache_start (gpointer user_data,
                                config->assemblies = g_slist_prepend (config->assemblies, g_strdup (part));
                        }
                        g_strfreev (parts);
+               } else if (!strcmp (attribute_names [i], "options")) {
+                       config->aot_options = g_strdup (attribute_values [i]);
                }
        }
 }
index 3ea728173df57959291e24b51ed79d795ed686d4..1b7570ef8cb10dc998350d654f8a6252461efa5a 100644 (file)
@@ -7508,14 +7508,52 @@ mono_reflection_get_type_internal (MonoImage *rootimage, MonoImage* image, MonoT
                mono_class_init (parent);
 
                while ((klass = mono_class_get_nested_types (parent, &iter))) {
-                       if (ignorecase) {
-                               if (mono_utf8_strcasecmp (klass->name, mod->data) == 0)
-                                       break;
+                       char *lastp;
+                       char *nested_name, *nested_nspace;
+                       gboolean match = TRUE;
+
+                       lastp = strrchr (mod->data, '.');
+                       if (lastp) {
+                               /* Nested classes can have namespaces */
+                               int nspace_len;
+
+                               nested_name = g_strdup (lastp + 1);
+                               nspace_len = lastp - (char*)mod->data;
+                               nested_nspace = g_malloc (nspace_len + 1);
+                               memcpy (nested_nspace, mod->data, nspace_len);
+                               nested_nspace [nspace_len] = '\0';
+
                        } else {
-                               if (strcmp (klass->name, mod->data) == 0)
-                                       break;
+                               nested_name = mod->data;
+                               nested_nspace = NULL;
                        }
+
+                       if (nested_nspace) {
+                               if (ignorecase) {
+                                       if (!(klass->name_space && mono_utf8_strcasecmp (klass->name_space, nested_nspace) == 0))
+                                               match = FALSE;
+                               } else {
+                                       if (!(klass->name_space && strcmp (klass->name_space, nested_nspace) == 0))
+                                               match = FALSE;
+                               }
+                       }
+                       if (match) {
+                               if (ignorecase) {
+                                       if (mono_utf8_strcasecmp (klass->name, nested_name) != 0)
+                                               match = FALSE;
+                               } else {
+                                       if (strcmp (klass->name, nested_name) != 0)
+                                               match = FALSE;
+                               }
+                       }
+                       if (lastp) {
+                               g_free (nested_name);
+                               g_free (nested_nspace);
+                       }
+                       if (match)
+                               break;
                }
+
                if (!klass)
                        break;
        }
index aab3bcb6153332ff59565ab941b449aea71b0fdf..472244b6312045f10e9556230a79cc826e50c4dd 100644 (file)
@@ -455,6 +455,9 @@ sgen_card_table_finish_scan_remsets (void *start_nursery, void *end_nursery, Sge
 guint8*
 mono_gc_get_card_table (int *shift_bits, gpointer *mask)
 {
+#ifndef MANAGED_WBARRIER
+       return NULL;
+#else
        if (!sgen_cardtable)
                return NULL;
 
@@ -466,6 +469,7 @@ mono_gc_get_card_table (int *shift_bits, gpointer *mask)
 #endif
 
        return sgen_cardtable;
+#endif
 }
 
 gboolean
index dec0d073fe0055530f5bb9cae12fdc79caebd6cb..adad2514d08dd2d54350ee2c7b9950aeb66b8320 100644 (file)
@@ -18,6 +18,9 @@
  * License 2.0 along with this library; if not, write to the Free
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
+
+#include "mono/utils/mono-compiler.h"
+
 extern long long stat_copy_object_called_nursery;
 extern long long stat_objects_copied_nursery;
 
@@ -31,13 +34,9 @@ extern long long stat_slots_allocated_in_vain;
  * This function can be used even if the vtable of obj is not valid
  * anymore, which is the case in the parallel collector.
  */
-static inline void
+static MONO_ALWAYS_INLINE void
 par_copy_object_no_checks (char *destination, MonoVTable *vt, void *obj, mword objsize, SgenGrayQueue *queue)
 {
-#ifdef __GNUC__
-       static const void *copy_labels [] = { &&LAB_0, &&LAB_1, &&LAB_2, &&LAB_3, &&LAB_4, &&LAB_5, &&LAB_6, &&LAB_7, &&LAB_8 };
-#endif
-
        SGEN_ASSERT (9, vt->klass->inited, "vtable %p for class %s:%s was not initialized", vt, vt->klass->name_space, vt->klass->name);
        SGEN_LOG (9, " (to %p, %s size: %lu)", destination, ((MonoObject*)obj)->vtable->klass->name, (unsigned long)objsize);
        binary_protocol_copy (obj, destination, vt, objsize);
@@ -50,35 +49,8 @@ par_copy_object_no_checks (char *destination, MonoVTable *vt, void *obj, mword o
        }
 #endif
 
-#ifdef __GNUC__
-       if (objsize <= sizeof (gpointer) * 8) {
-               mword *dest = (mword*)destination;
-               goto *copy_labels [objsize / sizeof (gpointer)];
-       LAB_8:
-               (dest) [7] = ((mword*)obj) [7];
-       LAB_7:
-               (dest) [6] = ((mword*)obj) [6];
-       LAB_6:
-               (dest) [5] = ((mword*)obj) [5];
-       LAB_5:
-               (dest) [4] = ((mword*)obj) [4];
-       LAB_4:
-               (dest) [3] = ((mword*)obj) [3];
-       LAB_3:
-               (dest) [2] = ((mword*)obj) [2];
-       LAB_2:
-               (dest) [1] = ((mword*)obj) [1];
-       LAB_1:
-               ;
-       LAB_0:
-               ;
-       } else {
-               /*can't trust memcpy doing word copies */
-               mono_gc_memmove_aligned (destination + sizeof (mword), (char*)obj + sizeof (mword), objsize - sizeof (mword));
-       }
-#else
-               mono_gc_memmove_aligned (destination + sizeof (mword), (char*)obj + sizeof (mword), objsize - sizeof (mword));
-#endif
+       memcpy (destination + sizeof (mword), (char*)obj + sizeof (mword), objsize - sizeof (mword));
+
        /* adjust array->bounds */
        SGEN_ASSERT (9, vt->gc_descr, "vtable %p for class %s:%s has no gc descriptor", vt, vt->klass->name_space, vt->klass->name);
 
@@ -99,11 +71,7 @@ par_copy_object_no_checks (char *destination, MonoVTable *vt, void *obj, mword o
 /*
  * This can return OBJ itself on OOM.
  */
-#ifdef _MSC_VER
-static __declspec(noinline) void*
-#else
-static G_GNUC_UNUSED void* __attribute__((noinline))
-#endif
+static MONO_NEVER_INLINE void*
 copy_object_no_checks (void *obj, SgenGrayQueue *queue)
 {
        MonoVTable *vt = ((MonoObject*)obj)->vtable;
index 782bbdf8de2dfe8b9994ccd92034b261a06cd250..187988e7def5fe723b6af95d294d87af839817ad 100644 (file)
@@ -25,6 +25,8 @@
 
 extern long long stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
 
+#include "mono/utils/mono-compiler.h"
+
 #include "sgen-copy-object.h"
 
 /*
@@ -47,11 +49,7 @@ extern long long stat_nursery_copy_object_failed_to_space; /* from sgen-gc.c */
  * copy_object could be made into a macro once debugged (use inline for now).
  */
 
-#ifdef _MSC_VER
-static __forceinline void
-#else
-static inline void __attribute__((always_inline))
-#endif
+static MONO_ALWAYS_INLINE void
 SERIAL_COPY_OBJECT (void **obj_slot, SgenGrayQueue *queue) 
 {
        char *forwarded;
@@ -107,11 +105,7 @@ SERIAL_COPY_OBJECT (void **obj_slot, SgenGrayQueue *queue)
  *
  *   Similar to SERIAL_COPY_OBJECT, but assumes that OBJ_SLOT is part of an object, so it handles global remsets as well.
  */
-#ifdef _MSC_VER
-static __forceinline void
-#else
-static inline void __attribute__((always_inline))
-#endif
+static MONO_ALWAYS_INLINE void
 SERIAL_COPY_OBJECT_FROM_OBJ (void **obj_slot, SgenGrayQueue *queue) 
 {
        char *forwarded;
index c189ab3e9f2bc8bdd200cb7191672430804cfdd7..b558395203660335d46f65509e15d1a59f6977ed 100644 (file)
@@ -30,9 +30,6 @@
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/runtime.h>
 #include <mono/io-layer/io-layer.h>
-#ifndef HOST_WIN32
-#include <mono/io-layer/threads.h>
-#endif
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/utils/mono-compiler.h>
@@ -1210,12 +1207,16 @@ mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, g
 {
        LOCK_THREAD (this_obj);
 
-       if (this_obj->flags & MONO_THREAD_FLAG_NAME_SET) {
+       if ((this_obj->flags & MONO_THREAD_FLAG_NAME_SET) && !this_obj->threadpool_thread) {
                UNLOCK_THREAD (this_obj);
                
                mono_raise_exception (mono_get_exception_invalid_operation ("Thread.Name can only be set once."));
                return;
        }
+       if (this_obj->name) {
+               g_free (this_obj->name);
+               this_obj->name_len = 0;
+       }
        if (name) {
                this_obj->name = g_new (gunichar2, mono_string_length (name));
                memcpy (this_obj->name, mono_string_chars (name), mono_string_length (name) * 2);
@@ -2028,12 +2029,12 @@ static void signal_thread_state_change (MonoInternalThread *thread)
         * functions in the io-layer until the signal handler calls QueueUserAPC which will
         * make it return.
         */
-       wait_handle = wapi_prepare_interrupt_thread (thread->handle);
+       wait_handle = mono_thread_info_prepare_interrupt (thread->handle);
 
        /* fixme: store the state somewhere */
        mono_thread_kill (thread, mono_thread_get_abort_signal ());
 
-       wapi_finish_interrupt_thread (wait_handle);
+       mono_thread_info_finish_interrupt (wait_handle);
 #endif /* HOST_WIN32 */
 }
 
@@ -2956,9 +2957,7 @@ void mono_thread_manage (void)
         * to get correct user and system times from getrusage/wait/time(1)).
         * This could be removed if we avoid pthread_detach() and use pthread_join().
         */
-#ifndef HOST_WIN32
        mono_thread_info_yield ();
-#endif
 }
 
 static void terminate_thread (gpointer key, gpointer value, gpointer user)
@@ -4115,10 +4114,8 @@ static MonoException* mono_thread_execute_interruption (MonoInternalThread *thre
                WaitForSingleObjectEx (GetCurrentThread(), 0, TRUE);
 #endif
                InterlockedDecrement (&thread_interruption_requested);
-#ifndef HOST_WIN32
                /* Clear the interrupted flag of the thread so it can wait again */
-               wapi_clear_interruption ();
-#endif
+               mono_thread_info_clear_interruption ();
        }
 
        if ((thread->state & ThreadState_AbortRequested) != 0) {
@@ -4208,7 +4205,7 @@ mono_thread_request_interruption (gboolean running_managed)
 #ifdef HOST_WIN32
                QueueUserAPC ((PAPCFUNC)dummy_apc, thread->handle, (ULONG_PTR)NULL);
 #else
-               wapi_self_interrupt ();
+               mono_thread_info_self_interrupt ();
 #endif
                return NULL;
        }
@@ -4241,9 +4238,8 @@ mono_thread_resume_interruption (void)
                return NULL;
        InterlockedIncrement (&thread_interruption_requested);
 
-#ifndef HOST_WIN32
-       wapi_self_interrupt ();
-#endif
+       mono_thread_info_self_interrupt ();
+
        return mono_thread_execute_interruption (thread);
 }
 
@@ -4560,9 +4556,7 @@ abort_thread_internal (MonoInternalThread *thread, gboolean can_raise_exception,
                MonoException *exc = mono_thread_request_interruption (can_raise_exception); 
                if (exc)
                        mono_raise_exception (exc);
-#ifndef HOST_WIN32
-               wapi_interrupt_thread (thread->handle);
-#endif
+               mono_thread_info_interrupt (thread->handle);
                return;
        }
 
@@ -4601,14 +4595,11 @@ abort_thread_internal (MonoInternalThread *thread, gboolean can_raise_exception,
                 * functions in the io-layer until the signal handler calls QueueUserAPC which will
                 * make it return.
                 */
-#ifndef HOST_WIN32
                gpointer interrupt_handle;
-               interrupt_handle = wapi_prepare_interrupt_thread (thread->handle);
-#endif
+
+               interrupt_handle = mono_thread_info_prepare_interrupt (thread->handle);
                mono_thread_info_finish_suspend_and_resume (info);
-#ifndef HOST_WIN32
-               wapi_finish_interrupt_thread (interrupt_handle);
-#endif
+               mono_thread_info_finish_interrupt (interrupt_handle);
        }
        /*FIXME we need to wait for interruption to complete -- figure out how much into interruption we should wait for here*/
 }
@@ -4661,21 +4652,15 @@ suspend_thread_internal (MonoInternalThread *thread, gboolean interrupt)
                if (running_managed && !protected_wrapper) {
                        transition_to_suspended (thread, info);
                } else {
-#ifndef HOST_WIN32
                        gpointer interrupt_handle;
-#endif
 
                        if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 0)
                                InterlockedIncrement (&thread_interruption_requested);
-#ifndef HOST_WIN32
                        if (interrupt)
-                               interrupt_handle = wapi_prepare_interrupt_thread (thread->handle);
-#endif
+                               interrupt_handle = mono_thread_info_prepare_interrupt (thread->handle);
                        mono_thread_info_finish_suspend_and_resume (info);
-#ifndef HOST_WIN32
                        if (interrupt)
-                               wapi_finish_interrupt_thread (interrupt_handle);
-#endif
+                               mono_thread_info_finish_interrupt (interrupt_handle);
                        UNLOCK_THREAD (thread);
                }
        }
index 299b6c2cc638d299d02a10e27058b55f2f96e848..2331d6a7a691dabcd54c7d4aa3ea236d57fd640e 100644 (file)
@@ -136,6 +136,7 @@ typedef struct MonoAotOptions {
        gboolean use_trampolines_page;
        gboolean no_instances;
        gboolean gnu_asm;
+       gboolean llvm;
        int nthreads;
        int ntrampolines;
        int nrgctx_trampolines;
@@ -3860,7 +3861,7 @@ is_vt_inst (MonoGenericInst *inst)
 
        for (i = 0; i < inst->type_argc; ++i) {
                MonoType *t = inst->type_argv [i];
-               if (t->type == MONO_TYPE_VALUETYPE)
+               if (MONO_TYPE_ISSTRUCT (t) || t->type == MONO_TYPE_VALUETYPE)
                        return TRUE;
        }
        return FALSE;
@@ -6398,6 +6399,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                        opts->mtriple = g_strdup (arg + strlen ("mtriple="));
                } else if (str_begins_with (arg, "llvm-path=")) {
                        opts->llvm_path = g_strdup (arg + strlen ("llvm-path="));
+               } else if (!strcmp (arg, "llvm")) {
+                       opts->llvm = TRUE;
                } else if (str_begins_with (arg, "readonly-value=")) {
                        add_readonly_value (opts, arg + strlen ("readonly-value="));
                } else if (str_begins_with (arg, "info")) {
@@ -6585,6 +6588,7 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
        gboolean skip;
        int index, depth;
        MonoMethod *wrapped;
+       JitFlags flags;
 
        if (acfg->aot_opts.metadata_only)
                return;
@@ -6629,7 +6633,12 @@ compile_method (MonoAotCompile *acfg, MonoMethod *method)
         * the runtime will not see AOT methods during AOT compilation,so it
         * does not need to support them by creating a fake GOT etc.
         */
-       cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), acfg->aot_opts.full_aot ? (JIT_FLAG_AOT|JIT_FLAG_FULL_AOT) : (JIT_FLAG_AOT), 0);
+       flags = JIT_FLAG_AOT;
+       if (acfg->aot_opts.full_aot)
+               flags |= JIT_FLAG_FULL_AOT;
+       if (acfg->llvm)
+               flags |= JIT_FLAG_LLVM;
+       cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), flags, 0);
        mono_loader_clear_error ();
 
        if (cfg->exception_type == MONO_EXCEPTION_GENERIC_SHARING_FAILED) {
@@ -8867,7 +8876,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                acfg->flags |= MONO_AOT_FILE_FLAG_DEBUG;
        }
 
-       if (mono_use_llvm) {
+       if (mono_use_llvm || acfg->aot_opts.llvm) {
                acfg->llvm = TRUE;
                acfg->aot_opts.asm_writer = TRUE;
                acfg->flags |= MONO_AOT_FILE_FLAG_WITH_LLVM;
@@ -9002,7 +9011,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
 
                res = emit_llvm_file (acfg);
                if (!res)
-                       return FALSE;
+                       return 1;
        }
 #endif
 
index 213d5b56ab26711df37e99cd5300756dab8097ed..81d58e784a64881335bd88354c1621f0f08774aa 100644 (file)
@@ -1452,8 +1452,10 @@ aot_cache_load_module (MonoAssembly *assembly, char **aot_name)
        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: loading from cache: '%s'.", fname);
        module = mono_dl_open (fname, MONO_DL_LAZY, NULL);
 
-       if (module)
+       if (module) {
+               mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: found in cache: '%s'.", fname);
                return module;
+       }
 
        if (!strcmp (assembly->aname.name, "mscorlib") && !mscorlib_aot_loaded)
                /*
@@ -1481,7 +1483,7 @@ aot_cache_load_module (MonoAssembly *assembly, char **aot_name)
                fclose (failure_file);
        }
 
-       mono_trace (G_LOG_LEVEL_MESSAGE, MONO_TRACE_AOT, "AOT: compiling assembly '%s'... ", assembly->image->name);
+       mono_trace (G_LOG_LEVEL_MESSAGE, MONO_TRACE_AOT, "AOT: compiling assembly '%s', logfile: '%s.log'... ", assembly->image->name, fname);
 
        /*
         * We need to invoke the AOT compiler here. There are multiple approaches:
@@ -1492,14 +1494,17 @@ aot_cache_load_module (MonoAssembly *assembly, char **aot_name)
         * - fork a new process and do the work there.
         */
        if (in_process) {
-               aot_options = g_strdup_printf ("outfile=%s,internal-logfile=%s.log", fname, fname);
+               aot_options = g_strdup_printf ("outfile=%s,internal-logfile=%s.log%s%s", fname, fname, config->aot_options ? "," : "", config->aot_options ? config->aot_options : "");
                /* Maybe due this in another thread ? */
                res = mono_compile_assembly (assembly, mono_parse_default_optimizations (NULL), aot_options);
-               if (!res) {
+               if (res) {
+                       mono_trace (G_LOG_LEVEL_MESSAGE, MONO_TRACE_AOT, "AOT: compilation failed.");
                        failure_fname = g_strdup_printf ("%s.failure", fname);
                        failure_file = fopen (failure_fname, "a+");
                        fclose (failure_file);
                        g_free (failure_fname);
+               } else {
+                       mono_trace (G_LOG_LEVEL_MESSAGE, MONO_TRACE_AOT, "AOT: compilation succeeded.");
                }
        } else {
                /*
old mode 100644 (file)
new mode 100755 (executable)
index bb6f32f..be53521
@@ -114,7 +114,7 @@ cgt: dest:c len:8
 cgt.un: dest:c len:8
 clt: dest:c len:8
 clt.un: dest:c len:8
-localloc: dest:i src1:i len:84
+localloc: dest:i src1:i len:96
 compare: src1:i src2:i len:3
 lcompare: src1:i src2:i len:3
 icompare: src1:i src2:i len:3
@@ -511,7 +511,7 @@ vcall2_membase: src1:b len:64 clob:c
 
 dyn_call: src1:i src2:i len:64 clob:c nacl:128
 
-localloc_imm: dest:i len:84
+localloc_imm: dest:i len:96
 
 load_mem: dest:i len:16
 loadi8_mem: dest:i len:16
index 7d9e40b22664406642de34d258df8576bec3941e..f45b72123aa931454a7c95a8cbee92bbc789791e 100644 (file)
@@ -321,9 +321,9 @@ icompare_imm: src1:i len:12
 
 long_conv_to_ovf_i4_2: dest:i src1:i src2:i len:36
 
-vcall2: len:32 clob:c
-vcall2_reg: src1:i len:32 clob:c
-vcall2_membase: src1:b len:32 clob:c
+vcall2: len:40 clob:c
+vcall2_reg: src1:i len:40 clob:c
+vcall2_membase: src1:b len:40 clob:c
 dyn_call: src1:i src2:i len:120 clob:c
 
 # This is different from the original JIT opcodes
index 5919430186944c79d1bc0037ae77e8d81457d584..58d66c88f482b9d8c0c2507ff42bda75250b288c 100644 (file)
@@ -2776,9 +2776,6 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
 #endif
 
        /* This is _not_ equivalent to ves_icall_System_Threading_Thread_Abort () */
-#ifdef HOST_WIN32
-       QueueUserAPC (notify_thread_apc, thread->handle, (ULONG_PTR)NULL);
-#else
        if (mono_thread_info_new_interrupt_enabled ()) {
                MonoThreadInfo *info;
                MonoJitInfo *ji;
@@ -2798,6 +2795,10 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
                        mono_thread_info_finish_suspend_and_resume (info);
                }
        } else {
+#ifdef HOST_WIN32
+               // FIXME: Remove this since new interrupt is used on win32 now
+               QueueUserAPC (notify_thread_apc, thread->handle, (ULONG_PTR)NULL);
+#else
                res = mono_thread_kill (thread, mono_thread_get_abort_signal ());
                if (res) {
                        DEBUG(1, fprintf (log_file, "[%p] mono_thread_kill () failed for %p: %d...\n", (gpointer)GetCurrentThreadId (), (gpointer)tid, res));
@@ -2806,8 +2807,8 @@ notify_thread (gpointer key, gpointer value, gpointer user_data)
                         */
                        tls->terminated = TRUE;
                }
-       }
 #endif
+       }
 }
 
 static void
index 12b4ef31dde102e27377b1ed2d0f4f65f740112e..592969a5256e9f538531bc822d46d975140a3f88 100644 (file)
@@ -45,7 +45,7 @@ LPTOP_LEVEL_EXCEPTION_FILTER mono_old_win_toplevel_exception_filter;
 void *mono_win_vectored_exception_handle;
 
 #define W32_SEH_HANDLE_EX(_ex) \
-       if (_ex##_handler) _ex##_handler(0, ep, sctx)
+       if (_ex##_handler) _ex##_handler(0, ep, ctx)
 
 static LONG CALLBACK seh_unhandled_exception_filter(EXCEPTION_POINTERS* ep)
 {
@@ -68,7 +68,6 @@ static LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
 {
        EXCEPTION_RECORD* er;
        CONTEXT* ctx;
-       MonoContext* sctx;
        LONG res;
        MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
 
@@ -81,22 +80,6 @@ static LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
 
        er = ep->ExceptionRecord;
        ctx = ep->ContextRecord;
-       sctx = g_malloc(sizeof(MonoContext));
-
-       /* Copy Win32 context to UNIX style context */
-       sctx->rax = ctx->Rax;
-       sctx->rbx = ctx->Rbx;
-       sctx->rcx = ctx->Rcx;
-       sctx->rdx = ctx->Rdx;
-       sctx->rbp = ctx->Rbp;
-       sctx->rsp = ctx->Rsp;
-       sctx->rsi = ctx->Rsi;
-       sctx->rdi = ctx->Rdi;
-       sctx->rip = ctx->Rip;
-       sctx->r12 = ctx->R12;
-       sctx->r13 = ctx->R13;
-       sctx->r14 = ctx->R14;
-       sctx->r15 = ctx->R15;
 
        switch (er->ExceptionCode) {
        case EXCEPTION_ACCESS_VIOLATION:
@@ -126,30 +109,8 @@ static LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
                * can correctly chain the exception.
                */
                res = EXCEPTION_CONTINUE_SEARCH;
-       } else {
-               /* Copy context back */
-               /* Nonvolatile */
-               ctx->Rsp = sctx->rsp;
-               ctx->Rdi = sctx->rdi;
-               ctx->Rsi = sctx->rsi;
-               ctx->Rbx = sctx->rbx;
-               ctx->Rbp = sctx->rbp;
-               ctx->R12 = sctx->r12;
-               ctx->R13 = sctx->r13;
-               ctx->R14 = sctx->r14;
-               ctx->R15 = sctx->r15;
-               ctx->Rip = sctx->rip;
-
-               /* Volatile But should not matter?*/
-               ctx->Rax = sctx->rax;
-               ctx->Rcx = sctx->rcx;
-               ctx->Rdx = sctx->rdx;
        }
 
-       /* TODO: Find right place to free this in stack overflow case */
-       if (er->ExceptionCode != EXCEPTION_STACK_OVERFLOW)
-               g_free (sctx);
-
        return res;
 }
 
@@ -841,6 +802,8 @@ mono_arch_ip_from_context (void *sigctx)
        ucontext_t *ctx = (ucontext_t*)sigctx;
 
        return (gpointer)UCONTEXT_REG_RIP (ctx);
+#elif defined(HOST_WIN32)
+       return ((CONTEXT*)sigctx)->Rip;
 #else
        MonoContext *ctx = sigctx;
        return (gpointer)ctx->rip;
index d7fd3318f3d1e45a5a27693114a4ab2dbbf551c6..e39248ceda12e75453048aa4d042450f7d4b20cd 100644 (file)
@@ -36,6 +36,7 @@
 #include "mini.h"
 #include "mini-arm.h"
 #include "mono/utils/mono-sigcontext.h"
+#include "mono/utils/mono-compiler.h"
 
 /*
  * arch_get_restore_context:
@@ -536,10 +537,7 @@ handle_signal_exception (gpointer obj)
  * This works around a gcc 4.5 bug:
  * https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/721531
  */
-#if defined(__GNUC__)
-__attribute__((noinline))
-#endif
-static gpointer
+static MONO_NEVER_INLINE gpointer
 get_handle_signal_exception_addr (void)
 {
        return handle_signal_exception;
old mode 100644 (file)
new mode 100755 (executable)
index d335d7e..841b458
@@ -49,7 +49,7 @@ extern int (*gUnhandledExceptionHandler)(EXCEPTION_POINTERS*);
 #endif
 
 #define W32_SEH_HANDLE_EX(_ex) \
-       if (_ex##_handler) _ex##_handler(0, ep, sctx)
+       if (_ex##_handler) _ex##_handler(0, ep, ctx)
 
 LONG CALLBACK seh_unhandled_exception_filter(EXCEPTION_POINTERS* ep)
 {
@@ -189,7 +189,6 @@ LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
 {
        EXCEPTION_RECORD* er;
        CONTEXT* ctx;
-       struct sigcontext* sctx;
        LONG res;
        MonoJitTlsData *jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
 
@@ -202,22 +201,10 @@ LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
 
        er = ep->ExceptionRecord;
        ctx = ep->ContextRecord;
-       sctx = g_malloc(sizeof(struct sigcontext));
-
-       /* Copy Win32 context to UNIX style context */
-       sctx->eax = ctx->Eax;
-       sctx->ebx = ctx->Ebx;
-       sctx->ecx = ctx->Ecx;
-       sctx->edx = ctx->Edx;
-       sctx->ebp = ctx->Ebp;
-       sctx->esp = ctx->Esp;
-       sctx->esi = ctx->Esi;
-       sctx->edi = ctx->Edi;
-       sctx->eip = ctx->Eip;
 
        switch (er->ExceptionCode) {
        case EXCEPTION_STACK_OVERFLOW:
-               win32_handle_stack_overflow (ep, sctx);
+               win32_handle_stack_overflow (ep, ctx);
                break;
        case EXCEPTION_ACCESS_VIOLATION:
                W32_SEH_HANDLE_EX(segv);
@@ -246,23 +233,8 @@ LONG CALLBACK seh_vectored_exception_handler(EXCEPTION_POINTERS* ep)
                * can correctly chain the exception.
                */
                res = EXCEPTION_CONTINUE_SEARCH;
-       } else {
-               /* Copy context back */
-               ctx->Eax = sctx->eax;
-               ctx->Ebx = sctx->ebx;
-               ctx->Ecx = sctx->ecx;
-               ctx->Edx = sctx->edx;
-               ctx->Ebp = sctx->ebp;
-               ctx->Esp = sctx->esp;
-               ctx->Esi = sctx->esi;
-               ctx->Edi = sctx->edi;
-               ctx->Eip = sctx->eip;
        }
 
-       /* TODO: Find right place to free this in stack overflow case */
-       if (er->ExceptionCode != EXCEPTION_STACK_OVERFLOW)
-               g_free (sctx);
-
        return res;
 }
 
@@ -278,8 +250,9 @@ void win32_seh_init()
 
 void win32_seh_cleanup()
 {
-       if (mono_old_win_toplevel_exception_filter) SetUnhandledExceptionFilter(mono_old_win_toplevel_exception_filter);
-       RemoveVectoredExceptionHandler (seh_unhandled_exception_filter);
+       if (mono_old_win_toplevel_exception_filter)
+               SetUnhandledExceptionFilter(mono_old_win_toplevel_exception_filter);
+       RemoveVectoredExceptionHandler (mono_win_vectored_exception_handle);
 }
 
 void win32_seh_set_handler(int type, MonoW32ExceptionHandler handler)
@@ -952,15 +925,15 @@ mono_arch_ip_from_context (void *sigctx)
 #if defined(__native_client__)
        printf("WARNING: mono_arch_ip_from_context() called!\n");
        return (NULL);
-#else
-#ifdef MONO_ARCH_USE_SIGACTION
+#elif defined(MONO_ARCH_USE_SIGACTION)
        ucontext_t *ctx = (ucontext_t*)sigctx;
        return (gpointer)UCONTEXT_REG_EIP (ctx);
+#elif defined(HOST_WIN32)
+       return ((CONTEXT*)sigctx)->Eip;
 #else
        struct sigcontext *ctx = sigctx;
        return (gpointer)ctx->SC_EIP;
 #endif
-#endif /* __native_client__ */
 }
 
 /*
old mode 100644 (file)
new mode 100755 (executable)
index 5dd518b..4db8126
@@ -8474,10 +8474,14 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        }
 
                        /* Generic sharing */
-                       /* FIXME: only do this for generic methods if
-                          they are not shared! */
+
+                       /*
+                        * Use this if the callee is gsharedvt sharable too, since
+                        * at runtime we might find an instantiation so the call cannot
+                        * be patched (the 'no_patch' code path in mini-trampolines.c).
+                        */
                        if (context_used && !imt_arg && !array_rank && !delegate_invoke &&
-                               (!mono_method_is_generic_sharable (cmethod, TRUE) ||
+                               (!mono_method_is_generic_sharable_full (cmethod, TRUE, FALSE, FALSE) ||
                                 !mono_class_generic_sharing_enabled (cmethod->klass)) &&
                                (!virtual || MONO_METHOD_IS_FINAL (cmethod) ||
                                 !(cmethod->flags & METHOD_ATTRIBUTE_VIRTUAL))) {
@@ -11604,7 +11608,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        }
                        case CEE_MONO_JIT_ATTACH: {
                                MonoInst *args [16], *domain_ins;
-                               MonoInst *ad_ins, *lmf_ins;
+                               MonoInst *ad_ins, *jit_tls_ins;
                                MonoBasicBlock *next_bb = NULL, *call_bb = NULL;
 
                                cfg->orig_domain_var = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
@@ -11612,15 +11616,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                EMIT_NEW_PCONST (cfg, ins, NULL);
                                MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, cfg->orig_domain_var->dreg, ins->dreg);
 
-#if TARGET_WIN32
-                               ad_ins = NULL;
-                               lmf_ins = NULL;
-#else
                                ad_ins = mono_get_domain_intrinsic (cfg);
-                               lmf_ins = mono_get_lmf_intrinsic (cfg);
-#endif
+                               jit_tls_ins = mono_get_jit_tls_intrinsic (cfg);
 
-                               if (MONO_ARCH_HAVE_TLS_GET && ad_ins && lmf_ins) {
+                               if (MONO_ARCH_HAVE_TLS_GET && ad_ins && jit_tls_ins) {
                                        NEW_BBLOCK (cfg, next_bb);
                                        NEW_BBLOCK (cfg, call_bb);
 
@@ -11634,8 +11633,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                        MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, -1, ad_ins->dreg, domain_ins->dreg);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBNE_UN, call_bb);
 
-                                       MONO_ADD_INS (cfg->cbb, lmf_ins);
-                                       MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, lmf_ins->dreg, 0);
+                                       MONO_ADD_INS (cfg->cbb, jit_tls_ins);
+                                       MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, jit_tls_ins->dreg, 0);
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBEQ, call_bb);
 
                                        MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, next_bb);
old mode 100644 (file)
new mode 100755 (executable)
index 3cefc22..8a69db7
@@ -85,12 +85,8 @@ static int breakpoint_fault_size;
 /* The size of the single step instruction causing the actual fault */
 static int single_step_fault_size;
 
-#ifdef HOST_WIN32
-/* On Win64 always reserve first 32 bytes for first four arguments */
-#define ARGS_OFFSET 48
-#else
+/* Offset between fp and the first argument in the callee */
 #define ARGS_OFFSET 16
-#endif
 #define GP_SCRATCH_REG AMD64_R11
 
 /*
@@ -940,6 +936,11 @@ get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSign
        gr = 0;
        fr = 0;
 
+#ifdef HOST_WIN32
+       /* Reserve space where the callee can save the argument registers */
+       stack_size = 4 * sizeof (mgreg_t);
+#endif
+
        /* return value */
        {
                ret_type = mini_type_get_underlying_type (gsctx, sig->ret);
@@ -1107,6 +1108,7 @@ get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSign
                        add_valuetype (gsctx, sig, ainfo, sig->params [i], FALSE, &gr, &fr, &stack_size);
                        break;
                case MONO_TYPE_U8:
+
                case MONO_TYPE_I8:
                        add_general (&gr, &stack_size, ainfo);
                        break;
@@ -1129,19 +1131,6 @@ get_call_info (MonoGenericSharingContext *gsctx, MonoMemPool *mp, MonoMethodSign
                add_general (&gr, &stack_size, &cinfo->sig_cookie);
        }
 
-#ifdef HOST_WIN32
-       // There always is 32 bytes reserved on the stack when calling on Winx64
-       stack_size += 0x20;
-#endif
-
-#ifndef MONO_AMD64_NO_PUSHES
-       if (stack_size & 0x8) {
-               /* The AMD64 ABI requires each stack frame to be 16 byte aligned */
-               cinfo->need_stack_align = TRUE;
-               stack_size += 8;
-       }
-#endif
-
        cinfo->stack_usage = stack_size;
        cinfo->reg_usage = gr;
        cinfo->freg_usage = fr;
@@ -1407,10 +1396,6 @@ mono_arch_compute_omit_fp (MonoCompile *cfg)
        cfg->arch.omit_fp = FALSE;
 #endif
 
-#ifdef HOST_WIN32
-       cfg->arch.omit_fp = FALSE;
-#endif
-
        if (cfg->disable_omit_fp)
                cfg->arch.omit_fp = FALSE;
 
@@ -1991,19 +1976,6 @@ mono_arch_create_vars (MonoCompile *cfg)
                cfg->arch.ss_trigger_page_var = ins;
        }
 
-#ifdef MONO_AMD64_NO_PUSHES
-       /*
-        * When this is set, we pass arguments on the stack by moves, and by allocating 
-        * a bigger stack frame, instead of pushes.
-        * Pushes complicate exception handling because the arguments on the stack have
-        * to be popped each time a frame is unwound. They also make fp elimination
-        * impossible.
-        * FIXME: This doesn't work inside filter/finally clauses, since those execute
-        * on a new frame which doesn't include a param area.
-        */
-       cfg->arch.no_pushes = TRUE;
-#endif
-
        if (cfg->method->save_lmf)
                cfg->create_lmf_var = TRUE;
 
@@ -2015,7 +1987,7 @@ mono_arch_create_vars (MonoCompile *cfg)
 #endif
        }
 
-#ifndef MONO_AMD64_NO_PUSHES
+#ifndef HOST_WIN32
        cfg->arch_eh_jit_info = 1;
 #endif
 }
@@ -2079,7 +2051,6 @@ arg_storage_to_load_membase (ArgStorage storage)
 static void
 emit_sig_cookie (MonoCompile *cfg, MonoCallInst *call, CallInfo *cinfo)
 {
-       MonoInst *arg;
        MonoMethodSignature *tmp_sig;
        int sig_reg;
 
@@ -2102,13 +2073,7 @@ emit_sig_cookie (MonoCompile *cfg, MonoCallInst *call, CallInfo *cinfo)
        sig_reg = mono_alloc_ireg (cfg);
        MONO_EMIT_NEW_SIGNATURECONST (cfg, sig_reg, tmp_sig);
 
-       if (cfg->arch.no_pushes) {
-               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, cinfo->sig_cookie.offset, sig_reg);
-       } else {
-               MONO_INST_NEW (cfg, arg, OP_X86_PUSH);
-               arg->sreg1 = sig_reg;
-               MONO_ADD_INS (cfg->cbb, arg);
-       }
+       MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, cinfo->sig_cookie.offset, sig_reg);
 }
 
 static inline LLVMArgStorage
@@ -2245,43 +2210,36 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                return;
        }
 
-       if (cinfo->need_stack_align) {
-               if (!cfg->arch.no_pushes)
-                       MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUB_IMM, X86_ESP, X86_ESP, 8);
-       }
-
        /* 
         * Emit all arguments which are passed on the stack to prevent register
         * allocation problems.
         */
-       if (cfg->arch.no_pushes) {
-               for (i = 0; i < n; ++i) {
-                       MonoType *t;
-                       ainfo = cinfo->args + i;
+       for (i = 0; i < n; ++i) {
+               MonoType *t;
+               ainfo = cinfo->args + i;
 
-                       in = call->args [i];
+               in = call->args [i];
 
-                       if (sig->hasthis && i == 0)
-                               t = &mono_defaults.object_class->byval_arg;
-                       else
-                               t = sig->params [i - sig->hasthis];
+               if (sig->hasthis && i == 0)
+                       t = &mono_defaults.object_class->byval_arg;
+               else
+                       t = sig->params [i - sig->hasthis];
 
-                       if (ainfo->storage == ArgOnStack && !MONO_TYPE_ISSTRUCT (t) && !call->tail_call) {
-                               if (!t->byref) {
-                                       if (t->type == MONO_TYPE_R4)
-                                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER4_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
-                                       else if (t->type == MONO_TYPE_R8)
-                                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER8_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
-                                       else
-                                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
-                               } else {
+               if (ainfo->storage == ArgOnStack && !MONO_TYPE_ISSTRUCT (t) && !call->tail_call) {
+                       if (!t->byref) {
+                               if (t->type == MONO_TYPE_R4)
+                                       MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER4_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
+                               else if (t->type == MONO_TYPE_R8)
+                                       MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORER8_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
+                               else
                                        MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
-                               }
-                               if (cfg->compute_gc_maps) {
-                                       MonoInst *def;
+                       } else {
+                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, ainfo->offset, in->dreg);
+                       }
+                       if (cfg->compute_gc_maps) {
+                               MonoInst *def;
 
-                                       EMIT_NEW_GC_PARAM_SLOT_LIVENESS_DEF (cfg, def, ainfo->offset, t);
-                               }
+                               EMIT_NEW_GC_PARAM_SLOT_LIVENESS_DEF (cfg, def, ainfo->offset, t);
                        }
                }
        }
@@ -2358,27 +2316,6 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                                        arg->inst_p1 = mono_mempool_alloc (cfg->mempool, sizeof (ArgInfo));
                                        memcpy (arg->inst_p1, ainfo, sizeof (ArgInfo));
 
-                                       MONO_ADD_INS (cfg->cbb, arg);
-                               }
-                       } else {
-                               if (cfg->arch.no_pushes) {
-                                       /* Already done */
-                               } else {
-                                       MONO_INST_NEW (cfg, arg, OP_X86_PUSH);
-                                       arg->sreg1 = in->dreg;
-                                       if (!sig->params [i - sig->hasthis]->byref) {
-                                               if (sig->params [i - sig->hasthis]->type == MONO_TYPE_R4) {
-                                                       MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUB_IMM, X86_ESP, X86_ESP, 8);
-                                                       arg->opcode = OP_STORER4_MEMBASE_REG;
-                                                       arg->inst_destbasereg = X86_ESP;
-                                                       arg->inst_offset = 0;
-                                               } else if (sig->params [i - sig->hasthis]->type == MONO_TYPE_R8) {
-                                                       MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUB_IMM, X86_ESP, X86_ESP, 8);
-                                                       arg->opcode = OP_STORER8_MEMBASE_REG;
-                                                       arg->inst_destbasereg = X86_ESP;
-                                                       arg->inst_offset = 0;
-                                               }
-                                       }
                                        MONO_ADD_INS (cfg->cbb, arg);
                                }
                        }
@@ -2441,12 +2378,6 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
                }
        }
 
-#ifdef HOST_WIN32
-       if (call->inst.opcode != OP_TAILCALL) {
-               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUB_IMM, X86_ESP, X86_ESP, 0x20);
-       }
-#endif
-
        if (cfg->method->save_lmf) {
                MONO_INST_NEW (cfg, arg, OP_AMD64_SAVE_SP_TO_LMF);
                MONO_ADD_INS (cfg->cbb, arg);
@@ -2494,8 +2425,6 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                MonoInst *vtaddr, *load;
                vtaddr = mono_compile_create_var (cfg, &ins->klass->byval_arg, OP_LOCAL);
                
-               g_assert (!cfg->arch.no_pushes);
-
                MONO_INST_NEW (cfg, load, OP_LDADDR);
                cfg->has_indirection = TRUE;
                load->inst_p0 = vtaddr;
@@ -2514,42 +2443,19 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                        MONO_ADD_INS (cfg->cbb, arg);
                        mono_call_inst_add_outarg_reg (cfg, call, arg->dreg, ainfo->pair_regs [0], FALSE);
                } else {
-                       MONO_INST_NEW (cfg, arg, OP_X86_PUSH);
-                       arg->sreg1 = load->dreg;
-                       MONO_ADD_INS (cfg->cbb, arg);
+                       MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, ainfo->offset, load->dreg);
                }
        } else {
                if (size == 8) {
-                       if (cfg->arch.no_pushes) {
-                               int dreg = mono_alloc_ireg (cfg);
+                       int dreg = mono_alloc_ireg (cfg);
 
-                               MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, 0);
-                               MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, ainfo->offset, dreg);
-                       } else {
-                               /* Can't use this for < 8 since it does an 8 byte memory load */
-                               MONO_INST_NEW (cfg, arg, OP_X86_PUSH_MEMBASE);
-                               arg->inst_basereg = src->dreg;
-                               arg->inst_offset = 0;
-                               MONO_ADD_INS (cfg->cbb, arg);
-                       }
+                       MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, src->dreg, 0);
+                       MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, ainfo->offset, dreg);
                } else if (size <= 40) {
-                       if (cfg->arch.no_pushes) {
-                               mini_emit_memcpy (cfg, AMD64_RSP, ainfo->offset, src->dreg, 0, size, 4);
-                       } else {
-                               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SUB_IMM, X86_ESP, X86_ESP, ALIGN_TO (size, 8));
-                               mini_emit_memcpy (cfg, X86_ESP, 0, src->dreg, 0, size, 4);
-                       }
+                       mini_emit_memcpy (cfg, AMD64_RSP, ainfo->offset, src->dreg, 0, size, 4);
                } else {
-                       if (cfg->arch.no_pushes) {
-                               // FIXME: Code growth
-                               mini_emit_memcpy (cfg, AMD64_RSP, ainfo->offset, src->dreg, 0, size, 4);
-                       } else {
-                               MONO_INST_NEW (cfg, arg, OP_X86_PUSH_OBJ);
-                               arg->inst_basereg = src->dreg;
-                               arg->inst_offset = 0;
-                               arg->inst_imm = size;
-                               MONO_ADD_INS (cfg->cbb, arg);
-                       }
+                       // FIXME: Code growth
+                       mini_emit_memcpy (cfg, AMD64_RSP, ainfo->offset, src->dreg, 0, size, 4);
                }
 
                if (cfg->compute_gc_maps) {
@@ -3461,7 +3367,7 @@ mono_emit_stack_alloc (MonoCompile *cfg, guchar *code, MonoInst* tree)
                amd64_alu_reg_reg (code, X86_XOR, AMD64_RAX, AMD64_RAX);
                                
                amd64_lea_membase (code, AMD64_RDI, AMD64_RSP, offset);
-               if (cfg->param_area && cfg->arch.no_pushes)
+               if (cfg->param_area)
                        amd64_alu_reg_imm (code, X86_ADD, AMD64_RDI, cfg->param_area);
                amd64_cld (code);
 #if defined(__default_codegen__)
@@ -4771,8 +4677,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                code = emit_call (cfg, code, MONO_PATCH_INFO_ABS, call->fptr, FALSE);
                        ins->flags |= MONO_INST_GC_CALLSITE;
                        ins->backend.pc_offset = code - cfg->native_code;
-                       if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature->call_convention) && !cfg->arch.no_pushes)
-                               amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, call->stack_usage);
                        code = emit_move_return_value (cfg, ins, code);
                        break;
                case OP_FCALL_REG:
@@ -4821,8 +4725,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        amd64_call_reg (code, ins->sreg1);
                        ins->flags |= MONO_INST_GC_CALLSITE;
                        ins->backend.pc_offset = code - cfg->native_code;
-                       if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature->call_convention) && !cfg->arch.no_pushes)
-                               amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, call->stack_usage);
                        code = emit_move_return_value (cfg, ins, code);
                        break;
                case OP_FCALL_MEMBASE:
@@ -4836,8 +4738,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        amd64_call_membase (code, ins->sreg1, ins->inst_offset);
                        ins->flags |= MONO_INST_GC_CALLSITE;
                        ins->backend.pc_offset = code - cfg->native_code;
-                       if (call->stack_usage && !CALLCONV_IS_STDCALL (call->signature->call_convention) && !cfg->arch.no_pushes)
-                               amd64_alu_reg_imm (code, X86_ADD, AMD64_RSP, call->stack_usage);
                        code = emit_move_return_value (cfg, ins, code);
                        break;
                case OP_DYN_CALL: {
@@ -4875,22 +4775,22 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        break;
                }
                case OP_X86_PUSH:
-                       g_assert (!cfg->arch.no_pushes);
+                       g_assert_not_reached ();
                        amd64_push_reg (code, ins->sreg1);
                        break;
                case OP_X86_PUSH_IMM:
-                       g_assert (!cfg->arch.no_pushes);
+                       g_assert_not_reached ();
                        g_assert (amd64_is_imm32 (ins->inst_imm));
                        amd64_push_imm (code, ins->inst_imm);
                        break;
                case OP_X86_PUSH_MEMBASE:
-                       g_assert (!cfg->arch.no_pushes);
+                       g_assert_not_reached ();
                        amd64_push_membase (code, ins->inst_basereg, ins->inst_offset);
                        break;
                case OP_X86_PUSH_OBJ: {
                        int size = ALIGN_TO (ins->inst_imm, 8);
 
-                       g_assert (!cfg->arch.no_pushes);
+                       g_assert_not_reached ();
 
                        amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, size);
                        amd64_push_reg (code, AMD64_RDI);
@@ -4925,7 +4825,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                        amd64_alu_reg_imm (code, X86_AND, ins->sreg1, ~(MONO_ARCH_FRAME_ALIGNMENT - 1));
                        code = mono_emit_stack_alloc (cfg, code, ins);
                        amd64_mov_reg_reg (code, ins->dreg, AMD64_RSP, 8);
-                       if (cfg->param_area && cfg->arch.no_pushes)
+                       if (cfg->param_area)
                                amd64_alu_reg_imm (code, X86_ADD, ins->dreg, cfg->param_area);
                        break;
                case OP_LOCALLOC_IMM: {
@@ -4953,7 +4853,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, size);
                                amd64_mov_reg_reg (code, ins->dreg, AMD64_RSP, 8);
                        }
-                       if (cfg->param_area && cfg->arch.no_pushes)
+                       if (cfg->param_area)
                                amd64_alu_reg_imm (code, X86_ADD, ins->dreg, cfg->param_area);
                        break;
                }
@@ -4991,7 +4891,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
                        if ((MONO_BBLOCK_IS_IN_REGION (bb, MONO_REGION_FINALLY) ||
                                 MONO_BBLOCK_IS_IN_REGION (bb, MONO_REGION_FINALLY)) &&
-                               cfg->param_area && cfg->arch.no_pushes) {
+                               cfg->param_area) {
                                amd64_alu_reg_imm (code, X86_SUB, AMD64_RSP, ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT));
                        }
                        break;
@@ -6593,7 +6493,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
 
        /* The param area is always at offset 0 from sp */
        /* This needs to be allocated here, since it has to come after the spill area */
-       if (cfg->arch.no_pushes && cfg->param_area) {
+       if (cfg->param_area) {
                if (cfg->arch.omit_fp)
                        // FIXME:
                        g_assert_not_reached ();
@@ -8425,8 +8325,11 @@ gboolean
 mono_arch_is_breakpoint_event (void *info, void *sigctx)
 {
 #ifdef HOST_WIN32
-       EXCEPTION_RECORD* einfo = (EXCEPTION_RECORD*)info;
-       return FALSE;
+       EXCEPTION_RECORD* einfo = ((EXCEPTION_POINTERS*)info)->ExceptionRecord;
+       if (einfo->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && (gpointer)einfo->ExceptionInformation [1] == bp_trigger_page)
+               return TRUE;
+       else
+               return FALSE;
 #else
        siginfo_t* sinfo = (siginfo_t*) info;
        /* Sometimes the address is off by 4 */
@@ -8486,8 +8389,11 @@ gboolean
 mono_arch_is_single_step_event (void *info, void *sigctx)
 {
 #ifdef HOST_WIN32
-       EXCEPTION_RECORD* einfo = (EXCEPTION_RECORD*)info;
-       return FALSE;
+       EXCEPTION_RECORD* einfo = ((EXCEPTION_POINTERS*)info)->ExceptionRecord;
+       if (einfo->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && (gpointer)einfo->ExceptionInformation [1] == ss_trigger_page)
+               return TRUE;
+       else
+               return FALSE;
 #else
        siginfo_t* sinfo = (siginfo_t*) info;
        /* Sometimes the address is off by 4 */
old mode 100644 (file)
new mode 100755 (executable)
index b7c974e..2a01714
@@ -33,7 +33,7 @@ void amd64_nacl_membase_handler (guint8** code, gint8 basereg, gint32 offset, gi
 #include <signal.h>
 #endif
 
-
+#if !defined(_MSC_VER)
 /* sigcontext surrogate */
 struct sigcontext {
        guint64 eax;
@@ -46,6 +46,7 @@ struct sigcontext {
        guint64 edi;
        guint64 eip;
 };
+#endif
 
 typedef void (* MonoW32ExceptionHandler) (int _dummy, EXCEPTION_POINTERS *info, void *context);
 void win32_seh_init(void);
@@ -191,7 +192,7 @@ typedef struct MonoCompileArch {
        gint32 stack_alloc_size;
        gint32 sp_fp_offset;
        guint32 saved_iregs;
-       gboolean omit_fp, omit_fp_computed, no_pushes;
+       gboolean omit_fp, omit_fp_computed;
        gpointer cinfo;
        gint32 async_point_count;
        gpointer vret_addr_loc;
@@ -340,9 +341,11 @@ typedef struct {
 #ifdef HOST_WIN32
 #define MONO_AMD64_ARG_REG1 AMD64_RCX
 #define MONO_AMD64_ARG_REG2 AMD64_RDX
+#define MONO_AMD64_ARG_REG3 AMD64_R8
 #else
 #define MONO_AMD64_ARG_REG1 AMD64_RDI
 #define MONO_AMD64_ARG_REG2 AMD64_RSI
+#define MONO_AMD64_ARG_REG3 AMD64_RDX
 #endif
 
 #define MONO_ARCH_NO_EMULATE_LONG_SHIFT_OPS
@@ -375,26 +378,18 @@ typedef struct {
 #define MONO_ARCH_HAVE_LIVERANGE_OPS 1
 #define MONO_ARCH_HAVE_XP_UNWIND 1
 #define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
-#if !defined(HOST_WIN32)
 #define MONO_ARCH_MONITOR_OBJECT_REG MONO_AMD64_ARG_REG1
-#endif
 #define MONO_ARCH_HAVE_GET_TRAMPOLINES 1
 
 #define MONO_ARCH_AOT_SUPPORTED 1
-#if !defined( HOST_WIN32 ) && !defined( __native_client__ )
+#if !defined( __native_client__ )
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
 #endif
 
-#if !defined(HOST_WIN32) || defined(__sun)
 #define MONO_ARCH_ENABLE_MONITOR_IL_FASTPATH 1
-#endif
 
 #define MONO_ARCH_SUPPORT_TASKLETS 1
 
-#ifndef HOST_WIN32
-#define MONO_AMD64_NO_PUSHES 1
-#endif
-
 #define MONO_ARCH_GSHARED_SUPPORTED 1
 #define MONO_ARCH_DYN_CALL_SUPPORTED 1
 #define MONO_ARCH_DYN_CALL_PARAM_AREA 0
index df6de20bab48786bcf4caed9ec1b139896289f9c..6551f78e021a1ed172043611b8f6a4dd9c11861b 100644 (file)
@@ -3156,7 +3156,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
                                index = LLVMConstInt (LLVMInt32Type (), ins->inst_offset / size, FALSE);                                
                                addr = LLVMBuildGEP (builder, convert (ctx, values [ins->inst_destbasereg], LLVMPointerType (t, 0)), &index, 1, "");
                        }
-                       emit_store (ctx, bb, &builder, size, convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t), addr, is_volatile);
+                       emit_store (ctx, bb, &builder, size, convert (ctx, LLVMConstInt (IntPtrType (), ins->inst_imm, FALSE), t), convert (ctx, addr, LLVMPointerType (t, 0)), is_volatile);
                        break;
                }
 
old mode 100644 (file)
new mode 100755 (executable)
index 3b95fd9..21c2b0c
@@ -4354,7 +4354,7 @@ mono_arch_tls_init (void)
 
        }
 
-       jit_tls = pthread_getspecific (mono_get_jit_tls_key ());
+       jit_tls = mono_get_jit_tls ();
 
 #ifdef MONO_SPARC_THR_TLS
        thr_setspecific (lmf_addr_key, &jit_tls->lmf);
index f65dab8c1e77f6220613e59111a84dd927597b90..4434564ee791c374fbce341e328e96b9e66842c3 100644 (file)
@@ -13,6 +13,7 @@
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-error-internals.h>
 #include <mono/utils/mono-membar.h>
+#include <mono/utils/mono-compiler.h>
 
 #include "mini.h"
 
@@ -140,18 +141,15 @@ mono_create_static_rgctx_trampoline (MonoMethod *m, gpointer addr)
 
 /*
  * Either IMPL_METHOD or AOT_ADDR will be set on return.
- */
-static gpointer*
-#ifdef __GNUC__
-/*
+ *
+ * MONO_NEVER_INLINE :
  * This works against problems when compiling with gcc 4.6 on arm. The 'then' part of
  * this line gets executed, even when the condition is false:
  *             if (impl && mono_method_needs_static_rgctx_invoke (impl, FALSE))
  *                     *need_rgctx_tramp = TRUE;
  */
-__attribute__ ((noinline))
-#endif
-       mono_convert_imt_slot_to_vtable_slot (gpointer* slot, mgreg_t *regs, guint8 *code, MonoMethod *method, gboolean lookup_aot, MonoMethod **impl_method, gboolean *need_rgctx_tramp, gboolean *variance_used, gpointer *aot_addr)
+static MONO_NEVER_INLINE gpointer*
+mono_convert_imt_slot_to_vtable_slot (gpointer* slot, mgreg_t *regs, guint8 *code, MonoMethod *method, gboolean lookup_aot, MonoMethod **impl_method, gboolean *need_rgctx_tramp, gboolean *variance_used, gpointer *aot_addr)
 {
        MonoObject *this_argument = mono_arch_get_this_arg_from_call (regs, code);
        MonoVTable *vt = this_argument->vtable;
index c43b1d0102f6d156e58b801e317e1c9bac36a8b5..614f7af6fedda0bcbd7e92055750731c6407eef9 100644 (file)
@@ -123,7 +123,7 @@ mono_runtime_setup_stat_profiler (void)
        if (timeBeginPeriod (1) != TIMERR_NOERROR)
                return;
 
-       if ((win32_timer = timeSetEvent (1, 0, win32_time_proc, 0, TIME_PERIODIC)) == 0) {
+       if ((win32_timer = timeSetEvent (1, 0, (LPTIMECALLBACK)win32_time_proc, (DWORD_PTR)NULL, TIME_PERIODIC)) == 0) {
                timeEndPeriod (1);
                return;
        }
@@ -137,7 +137,65 @@ mono_runtime_shutdown_stat_profiler (void)
 gboolean
 mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info)
 {
-       g_error ("Windows systems haven't been ported to support mono_thread_state_init_from_handle");
-       return FALSE;
+       DWORD id = mono_thread_info_get_tid (info);
+       HANDLE handle;
+       CONTEXT context;
+       DWORD result;
+       MonoContext *ctx;
+       MonoJitTlsData *jit_tls;
+       void *domain;
+       MonoLMF *lmf = NULL;
+       gpointer *addr;
+
+       tctx->valid = FALSE;
+       tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = NULL;
+       tctx->unwind_data [MONO_UNWIND_DATA_LMF] = NULL;
+       tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = NULL;
+
+       g_assert (id != GetCurrentThreadId ());
+
+       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+       g_assert (handle);
+
+       context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
+
+       if (!GetThreadContext (handle, &context)) {
+               CloseHandle (handle);
+               return FALSE;
+       }
+
+       g_assert (context.ContextFlags & CONTEXT_INTEGER);
+       g_assert (context.ContextFlags & CONTEXT_CONTROL);
+
+       ctx = &tctx->ctx;
+
+       memset (ctx, 0, sizeof (MonoContext));
+       mono_sigctx_to_monoctx (&context, ctx);
+
+       /* mono_set_jit_tls () sets this */
+       jit_tls = mono_thread_info_tls_get (info, TLS_KEY_JIT_TLS);
+       /* SET_APPDOMAIN () sets this */
+       domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
+
+       /*Thread already started to cleanup, can no longer capture unwind state*/
+       if (!jit_tls || !domain)
+               return FALSE;
+
+       /*
+        * The current LMF address is kept in a separate TLS variable, and its hard to read its value without
+        * arch-specific code. But the address of the TLS variable is stored in another TLS variable which
+        * can be accessed through MonoThreadInfo.
+        */
+       /* mono_set_lmf_addr () sets this */
+       addr = mono_thread_info_tls_get (info, TLS_KEY_LMF_ADDR);
+       if (addr)
+               lmf = *addr;
+
+       tctx->unwind_data [MONO_UNWIND_DATA_DOMAIN] = domain;
+       tctx->unwind_data [MONO_UNWIND_DATA_JIT_TLS] = jit_tls;
+       tctx->unwind_data [MONO_UNWIND_DATA_LMF] = lmf;
+       tctx->valid = TRUE;
+
+       return TRUE;
 }
 
old mode 100644 (file)
new mode 100755 (executable)
index a31e900..b489216
@@ -2629,17 +2629,20 @@ MONO_FAST_TLS_DECLARE(mono_lmf);
 #endif
 #endif
 
-MonoNativeTlsKey
-mono_get_jit_tls_key (void)
-{
-       return mono_jit_tls_id;
-}
-
 gint32
 mono_get_jit_tls_offset (void)
 {
        int offset;
+
+#ifdef HOST_WIN32
+       if (mono_jit_tls_id)
+               offset = mono_jit_tls_id;
+       else
+               /* FIXME: Happens during startup */
+               offset = -1;
+#else
        MONO_THREAD_VAR_OFFSET (mono_jit_tls, offset);
+#endif
        return offset;
 }
 
@@ -2952,11 +2955,7 @@ mini_get_tls_offset (MonoTlsKey key)
                offset = mono_thread_get_tls_offset ();
                break;
        case TLS_KEY_JIT_TLS:
-#ifdef HOST_WIN32
-               offset = mono_get_jit_tls_key ();
-#else
                offset = mono_get_jit_tls_offset ();
-#endif
                break;
        case TLS_KEY_DOMAIN:
                offset = mono_domain_get_tls_offset ();
@@ -4935,6 +4934,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        gboolean run_cctors = (flags & JIT_FLAG_RUN_CCTORS) ? 1 : 0;
        gboolean compile_aot = (flags & JIT_FLAG_AOT) ? 1 : 0;
        gboolean full_aot = (flags & JIT_FLAG_FULL_AOT) ? 1 : 0;
+       gboolean llvm = (flags & JIT_FLAG_LLVM) ? 1 : 0;
 
        InterlockedIncrement (&mono_jit_stats.methods_compiled);
        if (mono_profiler_get_events () & MONO_PROFILE_JIT_COMPILATION)
@@ -4976,7 +4976,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        }
 
 #ifdef ENABLE_LLVM
-       try_llvm = mono_use_llvm;
+       try_llvm = mono_use_llvm || llvm;
 #endif
 
  restart_compile:
old mode 100644 (file)
new mode 100755 (executable)
index 4bb5ad1..9200a64
@@ -1320,7 +1320,9 @@ typedef enum {
        /* Whenever this is an AOT compilation */
        JIT_FLAG_AOT = (1 << 1),
        /* Whenever this is a full AOT compilation */
-       JIT_FLAG_FULL_AOT = (1 << 2)
+       JIT_FLAG_FULL_AOT = (1 << 2),
+       /* Whenever to compile with LLVM */
+       JIT_FLAG_LLVM = (1 << 3),
 } JitFlags;
 
 /* Bit-fields in the MonoBasicBlock.region */
@@ -2052,7 +2054,6 @@ void      mono_set_lmf                      (MonoLMF *lmf) MONO_INTERNAL;
 MonoJitTlsData* mono_get_jit_tls            (void) MONO_INTERNAL;
 MONO_API MonoDomain *mono_jit_thread_attach          (MonoDomain *domain);
 MONO_API void      mono_jit_set_domain               (MonoDomain *domain);
-MonoNativeTlsKey mono_get_jit_tls_key       (void) MONO_INTERNAL;
 gint32    mono_get_jit_tls_offset           (void) MONO_INTERNAL;
 gint32    mono_get_lmf_tls_offset           (void) MONO_INTERNAL;
 gint32    mono_get_lmf_addr_tls_offset      (void) MONO_INTERNAL;
@@ -2822,6 +2823,7 @@ void mono_cross_helpers_run (void) MONO_INTERNAL;
 
 #ifndef GET_CONTEXT
 #ifdef HOST_WIN32
+/* seh_vectored_exception_handler () passes in a CONTEXT* */
 #define GET_CONTEXT \
     void *ctx = context;
 #else
old mode 100644 (file)
new mode 100755 (executable)
index 9ba8502..cfc14ee
@@ -522,7 +522,7 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
                amd64_mov_reg_imm (code, AMD64_R11, 0);
                amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, 8);
        } else {
-               amd64_mov_reg_imm (code, AMD64_RDI, tramp_type);
+               amd64_mov_reg_imm (code, MONO_AMD64_ARG_REG1, tramp_type);
                amd64_mov_reg_imm (code, AMD64_R11, stack_unaligned);
                amd64_call_reg (code, AMD64_R11);
        }
@@ -946,8 +946,6 @@ mono_arch_create_generic_class_init_trampoline (MonoTrampInfo **info, gboolean a
        return buf;
 }
 
-#ifdef MONO_ARCH_MONITOR_OBJECT_REG
-
 gpointer
 mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot)
 {
@@ -958,8 +956,11 @@ mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot)
        int owner_offset, nest_offset, dummy;
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
+       int obj_reg = MONO_AMD64_ARG_REG1;
+       int sync_reg = MONO_AMD64_ARG_REG2;
+       int tid_reg = MONO_AMD64_ARG_REG3;
 
-       g_assert (MONO_ARCH_MONITOR_OBJECT_REG == AMD64_RDI);
+       g_assert (MONO_ARCH_MONITOR_OBJECT_REG == obj_reg);
 
        mono_monitor_threads_sync_members_offset (&owner_offset, &nest_offset, &dummy);
        g_assert (MONO_THREADS_SYNC_MEMBER_SIZE (owner_offset) == sizeof (gpointer));
@@ -974,50 +975,51 @@ mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot)
        unwind_ops = mono_arch_get_cie_program ();
 
        if (!aot && mono_thread_get_tls_offset () != -1) {
-               /* MonoObject* obj is in RDI */
+               /* MonoObject* obj is in obj_reg */
                /* is obj null? */
-               amd64_test_reg_reg (code, AMD64_RDI, AMD64_RDI);
+               amd64_test_reg_reg (code, obj_reg, obj_reg);
                /* if yes, jump to actual trampoline */
                jump_obj_null = code;
                amd64_branch8 (code, X86_CC_Z, -1, 1);
 
-               /* load obj->synchronization to RCX */
-               amd64_mov_reg_membase (code, AMD64_RCX, AMD64_RDI, MONO_STRUCT_OFFSET (MonoObject, synchronisation), 8);
+               /* load obj->synchronization to sync_reg */
+               amd64_mov_reg_membase (code, sync_reg, obj_reg, MONO_STRUCT_OFFSET (MonoObject, synchronisation), 8);
 
                if (mono_gc_is_moving ()) {
                        /*if bit zero is set it's a thin hash*/
                        /*FIXME use testb encoding*/
-                       amd64_test_reg_imm (code, AMD64_RCX, 0x01);
+                       amd64_test_reg_imm (code, sync_reg, 0x01);
                        jump_sync_thin_hash = code;
                        amd64_branch8 (code, X86_CC_NE, -1, 1);
 
                        /*clear bits used by the gc*/
-                       amd64_alu_reg_imm (code, X86_AND, AMD64_RCX, ~0x3);
+                       amd64_alu_reg_imm (code, X86_AND, sync_reg, ~0x3);
                }
 
                /* is synchronization null? */
-               amd64_test_reg_reg (code, AMD64_RCX, AMD64_RCX);
+               amd64_test_reg_reg (code, sync_reg, sync_reg);
                /* if yes, jump to actual trampoline */
                jump_sync_null = code;
                amd64_branch8 (code, X86_CC_Z, -1, 1);
 
-               /* load MonoInternalThread* into RDX */
-               code = mono_amd64_emit_tls_get (code, AMD64_RDX, mono_thread_get_tls_offset ());
-               /* load TID into RDX */
-               amd64_mov_reg_membase (code, AMD64_RDX, AMD64_RDX, MONO_STRUCT_OFFSET (MonoInternalThread, tid), 8);
+               /* load MonoInternalThread* into tid_reg */
+               code = mono_amd64_emit_tls_get (code, tid_reg, mono_thread_get_tls_offset ());
+               /* load TID into tid_reg */
+               amd64_mov_reg_membase (code, tid_reg, tid_reg, MONO_STRUCT_OFFSET (MonoInternalThread, tid), 8);
 
                /* is synchronization->owner null? */
-               amd64_alu_membase_imm_size (code, X86_CMP, AMD64_RCX, owner_offset, 0, 8);
+               amd64_alu_membase_imm_size (code, X86_CMP, sync_reg, owner_offset, 0, 8);
                /* if not, jump to next case */
                jump_tid = code;
                amd64_branch8 (code, X86_CC_NZ, -1, 1);
 
                /* if yes, try a compare-exchange with the TID */
+               g_assert (tid_reg != X86_EAX);
                /* zero RAX */
                amd64_alu_reg_reg (code, X86_XOR, AMD64_RAX, AMD64_RAX);
                /* compare and exchange */
                amd64_prefix (code, X86_LOCK_PREFIX);
-               amd64_cmpxchg_membase_reg_size (code, AMD64_RCX, owner_offset, AMD64_RDX, 8);
+               amd64_cmpxchg_membase_reg_size (code, sync_reg, owner_offset, tid_reg, 8);
                /* if not successful, jump to actual trampoline */
                jump_cmpxchg_failed = code;
                amd64_branch8 (code, X86_CC_NZ, -1, 1);
@@ -1027,12 +1029,12 @@ mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot)
                /* next case: synchronization->owner is not null */
                x86_patch (jump_tid, code);
                /* is synchronization->owner == TID? */
-               amd64_alu_membase_reg_size (code, X86_CMP, AMD64_RCX, owner_offset, AMD64_RDX, 8);
+               amd64_alu_membase_reg_size (code, X86_CMP, sync_reg, owner_offset, tid_reg, 8);
                /* if not, jump to actual trampoline */
                jump_other_owner = code;
                amd64_branch8 (code, X86_CC_NZ, -1, 1);
                /* if yes, increment nest */
-               amd64_inc_membase_size (code, AMD64_RCX, nest_offset, 4);
+               amd64_inc_membase_size (code, sync_reg, nest_offset, 4);
                /* return */
                amd64_ret (code);
 
@@ -1045,9 +1047,8 @@ mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean aot)
        }
 
        /* jump to the actual trampoline */
-#if MONO_AMD64_ARG_REG1 != AMD64_RDI
-       amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, AMD64_RDI);
-#endif
+       if (MONO_AMD64_ARG_REG1 != obj_reg)
+               amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, obj_reg, sizeof (mgreg_t));
 
        if (aot) {
                code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "specific_trampoline_monitor_enter");
@@ -1081,8 +1082,10 @@ mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot)
        int owner_offset, nest_offset, entry_count_offset;
        MonoJumpInfo *ji = NULL;
        GSList *unwind_ops = NULL;
+       int obj_reg = MONO_AMD64_ARG_REG1;
+       int sync_reg = MONO_AMD64_ARG_REG2;
 
-       g_assert (MONO_ARCH_MONITOR_OBJECT_REG == AMD64_RDI);
+       g_assert (obj_reg == MONO_ARCH_MONITOR_OBJECT_REG);
 
        mono_monitor_threads_sync_members_offset (&owner_offset, &nest_offset, &entry_count_offset);
        g_assert (MONO_THREADS_SYNC_MEMBER_SIZE (owner_offset) == sizeof (gpointer));
@@ -1099,63 +1102,63 @@ mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot)
        unwind_ops = mono_arch_get_cie_program ();
 
        if (!aot && mono_thread_get_tls_offset () != -1) {
-               /* MonoObject* obj is in RDI */
+               /* MonoObject* obj is in obj_reg */
                /* is obj null? */
-               amd64_test_reg_reg (code, AMD64_RDI, AMD64_RDI);
+               amd64_test_reg_reg (code, obj_reg, obj_reg);
                /* if yes, jump to actual trampoline */
                jump_obj_null = code;
                amd64_branch8 (code, X86_CC_Z, -1, 1);
 
                /* load obj->synchronization to RCX */
-               amd64_mov_reg_membase (code, AMD64_RCX, AMD64_RDI, MONO_STRUCT_OFFSET (MonoObject, synchronisation), 8);
+               amd64_mov_reg_membase (code, sync_reg, obj_reg, MONO_STRUCT_OFFSET (MonoObject, synchronisation), 8);
 
                if (mono_gc_is_moving ()) {
                        /*if bit zero is set it's a thin hash*/
                        /*FIXME use testb encoding*/
-                       amd64_test_reg_imm (code, AMD64_RCX, 0x01);
+                       amd64_test_reg_imm (code, sync_reg, 0x01);
                        jump_sync_thin_hash = code;
                        amd64_branch8 (code, X86_CC_NE, -1, 1);
 
                        /*clear bits used by the gc*/
-                       amd64_alu_reg_imm (code, X86_AND, AMD64_RCX, ~0x3);
+                       amd64_alu_reg_imm (code, X86_AND, sync_reg, ~0x3);
                }
 
                /* is synchronization null? */
-               amd64_test_reg_reg (code, AMD64_RCX, AMD64_RCX);
+               amd64_test_reg_reg (code, sync_reg, sync_reg);
                /* if yes, jump to actual trampoline */
                jump_sync_null = code;
                amd64_branch8 (code, X86_CC_Z, -1, 1);
 
                /* next case: synchronization is not null */
-               /* load MonoInternalThread* into RDX */
-               code = mono_amd64_emit_tls_get (code, AMD64_RDX, mono_thread_get_tls_offset ());
-               /* load TID into RDX */
-               amd64_mov_reg_membase (code, AMD64_RDX, AMD64_RDX, MONO_STRUCT_OFFSET (MonoInternalThread, tid), 8);
+               /* load MonoInternalThread* into RAX */
+               code = mono_amd64_emit_tls_get (code, AMD64_RAX, mono_thread_get_tls_offset ());
+               /* load TID into RAX */
+               amd64_mov_reg_membase (code, AMD64_RAX, AMD64_RAX, MONO_STRUCT_OFFSET (MonoInternalThread, tid), 8);
                /* is synchronization->owner == TID */
-               amd64_alu_membase_reg_size (code, X86_CMP, AMD64_RCX, owner_offset, AMD64_RDX, 8);
+               amd64_alu_membase_reg_size (code, X86_CMP, sync_reg, owner_offset, AMD64_RAX, 8);
                /* if no, jump to actual trampoline */
                jump_not_owned = code;
                amd64_branch8 (code, X86_CC_NZ, -1, 1);
 
                /* next case: synchronization->owner == TID */
                /* is synchronization->nest == 1 */
-               amd64_alu_membase_imm_size (code, X86_CMP, AMD64_RCX, nest_offset, 1, 4);
+               amd64_alu_membase_imm_size (code, X86_CMP, sync_reg, nest_offset, 1, 4);
                /* if not, jump to next case */
                jump_next = code;
                amd64_branch8 (code, X86_CC_NZ, -1, 1);
                /* if yes, is synchronization->entry_count zero? */
-               amd64_alu_membase_imm_size (code, X86_CMP, AMD64_RCX, entry_count_offset, 0, 4);
+               amd64_alu_membase_imm_size (code, X86_CMP, sync_reg, entry_count_offset, 0, 4);
                /* if not, jump to actual trampoline */
                jump_have_waiters = code;
                amd64_branch8 (code, X86_CC_NZ, -1 , 1);
                /* if yes, set synchronization->owner to null and return */
-               amd64_mov_membase_imm (code, AMD64_RCX, owner_offset, 0, 8);
+               amd64_mov_membase_imm (code, sync_reg, owner_offset, 0, 8);
                amd64_ret (code);
 
                /* next case: synchronization->nest is not 1 */
                x86_patch (jump_next, code);
                /* decrease synchronization->nest and return */
-               amd64_dec_membase_size (code, AMD64_RCX, nest_offset, 4);
+               amd64_dec_membase_size (code, sync_reg, nest_offset, 4);
                amd64_ret (code);
 
                x86_patch (jump_obj_null, code);
@@ -1165,9 +1168,8 @@ mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot)
        }
 
        /* jump to the actual trampoline */
-#if MONO_AMD64_ARG_REG1 != AMD64_RDI
-       amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, AMD64_RDI);
-#endif
+       if (MONO_AMD64_ARG_REG1 != obj_reg)
+               amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, obj_reg, sizeof (mgreg_t));
 
        if (aot) {
                code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "specific_trampoline_monitor_exit");
@@ -1187,7 +1189,6 @@ mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot)
 
        return buf;
 }
-#endif
 
 void
 mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg)
@@ -1226,18 +1227,18 @@ mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
        /*
        This trampoline restore the call chain of the handler block then jumps into the code that deals with it.
        */
-
        if (mono_get_jit_tls_offset () != -1) {
-               code = mono_amd64_emit_tls_get (code, AMD64_RDI, mono_get_jit_tls_offset ());
-               amd64_mov_reg_membase (code, AMD64_RDI, AMD64_RDI, MONO_STRUCT_OFFSET (MonoJitTlsData, handler_block_return_address), 8);
+               code = mono_amd64_emit_tls_get (code, MONO_AMD64_ARG_REG1, mono_get_jit_tls_offset ());
+               amd64_mov_reg_membase (code, MONO_AMD64_ARG_REG1, MONO_AMD64_ARG_REG1, MONO_STRUCT_OFFSET (MonoJitTlsData, handler_block_return_address), 8);
                /* Simulate a call */
                amd64_push_reg (code, AMD64_RAX);
                amd64_jump_code (code, tramp);
        } else {
                /*Slow path uses a c helper*/
-               amd64_mov_reg_reg (code, AMD64_RDI, AMD64_RSP, 8);
+               amd64_mov_reg_reg (code, MONO_AMD64_ARG_REG1, AMD64_RSP, 8);
                amd64_mov_reg_imm (code, AMD64_RAX, tramp);
                amd64_push_reg (code, AMD64_RAX);
+               amd64_push_reg (code, AMD64_RAX);
                amd64_jump_code (code, handler_block_trampoline_helper);
        }
 
index 9e415ca339092ac0da6eb5ae8a14828f46e08217..167b2b9e2b74b4702849aa58139508437c3ccfc8 100644 (file)
@@ -51,6 +51,8 @@
 #include "image-writer.h"
 #include "dwarfwriter.h"
 
+#include "mono/utils/mono-compiler.h"
+
 #define USE_GDB_JIT_INTERFACE
 
 /* The recommended gdb macro is: */
@@ -95,15 +97,8 @@ struct jit_descriptor
   struct jit_code_entry *first_entry;
 };
 
-
-#ifdef _MSC_VER
-#define MONO_NOINLINE __declspec (noinline)
-#else
-#define MONO_NOINLINE __attribute__((noinline))
-#endif
-
 /* GDB puts a breakpoint in this function.  */
-void MONO_NOINLINE __jit_debug_register_code(void);
+void MONO_NEVER_INLINE __jit_debug_register_code(void);
 
 #if !defined(MONO_LLVM_LOADED) && defined(ENABLE_LLVM) && !defined(MONO_CROSS_COMPILE)
 
@@ -114,7 +109,7 @@ extern struct jit_descriptor __jit_debug_descriptor;
 #else
 
 /* gcc seems to inline/eliminate calls to noinline functions, thus the asm () */
-void MONO_NOINLINE __jit_debug_register_code(void) {
+void MONO_NEVER_INLINE __jit_debug_register_code(void) {
 #if defined(__GNUC__)
        asm ("");
 #endif
index 057bf22a8323463a6bd9279d6928d3fea7ed8eb8..3137aea79800778a1d143994854d253bdf7d1704 100644 (file)
@@ -18,6 +18,8 @@
 #include <linux/ioctl.h>
 #include <asm/byteorder.h>
 
+#include "mono/utils/mono-compiler.h"
+
 /*
  * User-space ABI bits:
  */
@@ -1004,7 +1006,7 @@ static inline void perf_fetch_caller_regs(struct pt_regs *regs)
        perf_arch_fetch_caller_regs(regs, CALLER_ADDR0);
 }
 
-static __always_inline void
+static MONO_ALWAYS_INLINE void
 perf_sw_event(u32 event_id, u64 nr, int nmi, struct pt_regs *regs, u64 addr)
 {
        struct pt_regs hot_regs;
index 9021a00b24d846c71e4545f589437adad174050e..520b3b228d50d00633dd7956ec89d22e602d432b 100644 (file)
@@ -831,10 +831,13 @@ walk_stack (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_b
  * event, hence the collect_bt/emit_bt split.
  */
 static void
-collect_bt (FrameData *data)
+collect_bt (FrameData *data, gboolean async_safe)
 {
        data->count = 0;
-       mono_stack_walk_no_il (walk_stack, data);
+       if (async_safe)
+               mono_stack_walk_async_safe (walk_stack, data);
+       else
+               mono_stack_walk_no_il (walk_stack, data);
 }
 
 static void
@@ -867,7 +870,7 @@ gc_alloc (MonoProfiler *prof, MonoObject *obj, MonoClass *klass)
        len += 7;
        len &= ~7;
        if (do_bt)
-               collect_bt (&data);
+               collect_bt (&data, FALSE);
        logbuffer = ensure_logbuf (32 + MAX_FRAMES * 8);
        now = current_time ();
        ENTER_LOG (logbuffer, "gcalloc");
@@ -1132,7 +1135,7 @@ throw_exc (MonoProfiler *prof, MonoObject *object)
        FrameData data;
        LogBuffer *logbuffer;
        if (do_bt)
-               collect_bt (&data);
+               collect_bt (&data, FALSE);
        logbuffer = ensure_logbuf (16 + MAX_FRAMES * 8);
        now = current_time ();
        ENTER_LOG (logbuffer, "throw");
@@ -1168,7 +1171,7 @@ monitor_event (MonoProfiler *profiler, MonoObject *object, MonoProfilerMonitorEv
        FrameData data;
        LogBuffer *logbuffer;
        if (do_bt)
-               collect_bt (&data);
+               collect_bt (&data, FALSE);
        logbuffer = ensure_logbuf (16 + MAX_FRAMES * 8);
        now = current_time ();
        ENTER_LOG (logbuffer, "monitor");
@@ -1230,7 +1233,7 @@ mono_sample_hit (MonoProfiler *profiler, unsigned char *ip, void *context)
        if (in_shutdown)
                return;
        now = current_time ();
-       collect_bt (&bt_data);
+       collect_bt (&bt_data, TRUE);
        elapsed = (now - profiler->startup_time) / 10000;
        if (do_debug) {
                int len;
index 7d448d374ad7308e8e7073ac6f7fd181e2f64e58..58392b04acda1cd231f9ad617c0684cfbaeaf289 100644 (file)
@@ -43,6 +43,7 @@ STRESS_TESTS_SRC=     \
        monitor-stress.cs       \
        thread-stress.cs        \
        gc-stress.cs            \
+       gc-copy-stress.cs       \
        gc-graystack-stress.cs          \
        exit-stress.cs          \
        process-stress.cs       \
@@ -435,7 +436,8 @@ endif
 if X86
 
 if HOST_WIN32
-PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe
+PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
+       bug-18026.exe monitor.exe threadpool-exceptions5.exe
 endif
 
 endif
diff --git a/mono/tests/gc-copy-stress.cs b/mono/tests/gc-copy-stress.cs
new file mode 100644 (file)
index 0000000..130f33f
--- /dev/null
@@ -0,0 +1,35 @@
+using System;
+
+class T {
+       
+       static int count = 1000000;
+       static int loops = 20;
+       static int persist_factor = 10;
+
+       static object obj;
+
+       static object[] persist;
+       static int persist_idx;
+
+       static void work () {
+               persist = new object[count / persist_factor + 1];
+               persist_idx = 0;
+               for (int i = 0; i < count; ++i) {
+                       obj = new object ();
+                       if (i % persist_factor == 0)
+                               persist[persist_idx++] = obj;
+               }
+       }
+
+       static void Main (string[] args) {
+               if (args.Length > 0)
+                       loops = int.Parse (args [0]);
+               if (args.Length > 1)
+                       count = int.Parse (args [1]);
+               if (args.Length > 2)
+                       persist_factor = int.Parse (args [2]);
+               for (int i = 0; i < loops; ++i) {
+                       work ();
+               }
+       }
+}
index 24d5b9db8d5e0f9f2962c77fae10992af87900e7..165b1d877a3314db00f712362517d54aa86209a8 100755 (executable)
@@ -72,6 +72,13 @@ my %tests = (
                'arg-knob' => 2, # loops
                'ratio' => 10,
        },
+       'gc-copy-stress' => {
+               'program' => 'gc-copy-stress.exe',
+               # loops, count, persist_factor
+               'args' => [250, 500000, 10],
+               'arg-knob' => 1, # count
+               'ratio' => 4,
+       },
        'thread-stress' => {
                'program' => 'thread-stress.exe',
                # loops
index 2b330b9bb9dfcc21decaf4a81e359a6241aaf5e1..e8a6a27cc7b635612bb4a38d69d13e448d273589 100644 (file)
@@ -247,5 +247,13 @@ typedef SSIZE_T ssize_t;
 #define MONO_ALWAYS_INLINE
 #endif
 
+#ifdef __GNUC__
+#define MONO_NEVER_INLINE __attribute__((noinline))
+#elif defined(_MSC_VER)
+#define MONO_NEVER_INLINE __declspec(noinline)
+#else
+#define MONO_NEVER_INLINE
+#endif
+
 #endif /* __UTILS_MONO_COMPILER_H__*/
 
index bc0286485fc008a9d5d7cdf3ba8e2dde36e92a80..c52d0442f465395e66d78eb019fff6c0e634fb0a 100644 (file)
 
 #include <mono/utils/mono-context.h>
 
+#ifdef HOST_WIN32
+#include <windows.h>
+#endif
+
 #ifdef __sun
 #define REG_EAX EAX
 #define REG_EBX EBX
@@ -53,6 +57,18 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
        mctx->esi = UCONTEXT_REG_ESI (ctx);
        mctx->edi = UCONTEXT_REG_EDI (ctx);
        mctx->eip = UCONTEXT_REG_EIP (ctx);
+#elif defined(HOST_WIN32)
+       CONTEXT *context = (CONTEXT*)sigctx;
+
+       mctx->eip = context->Eip;
+       mctx->edi = context->Edi;
+       mctx->esi = context->Esi;
+       mctx->ebx = context->Ebx;
+       mctx->edx = context->Edx;
+       mctx->ecx = context->Ecx;
+       mctx->eax = context->Eax;
+       mctx->ebp = context->Ebp;
+       mctx->esp = context->Esp;
 #else  
        struct sigcontext *ctx = (struct sigcontext *)sigctx;
 
@@ -85,6 +101,18 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
        UCONTEXT_REG_ESI (ctx) = mctx->esi;
        UCONTEXT_REG_EDI (ctx) = mctx->edi;
        UCONTEXT_REG_EIP (ctx) = mctx->eip;
+#elif defined(HOST_WIN32)
+       CONTEXT *context = (CONTEXT*)sigctx;
+
+       context->Eip = mctx->eip;
+       context->Edi = mctx->edi;
+       context->Esi = mctx->esi;
+       context->Ebx = mctx->ebx;
+       context->Edx = mctx->edx;
+       context->Ecx = mctx->ecx;
+       context->Eax = mctx->eax;
+       context->Ebp = mctx->ebp;
+       context->Esp = mctx->esp;
 #else
        struct sigcontext *ctx = (struct sigcontext *)sigctx;
 
@@ -104,6 +132,10 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
 
 #include <mono/utils/mono-context.h>
 
+#ifdef HOST_WIN32
+#include <windows.h>
+#endif
+
 void
 mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
 {
@@ -131,6 +163,26 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
        mctx->r14 = UCONTEXT_REG_R14 (ctx);
        mctx->r15 = UCONTEXT_REG_R15 (ctx);
        mctx->rip = UCONTEXT_REG_RIP (ctx);
+#elif defined(HOST_WIN32)
+       CONTEXT *context = (CONTEXT*)sigctx;
+
+       mctx->rip = context->Rip;
+       mctx->rax = context->Rax;
+       mctx->rcx = context->Rcx;
+       mctx->rdx = context->Rdx;
+       mctx->rbx = context->Rbx;
+       mctx->rsp = context->Rsp;
+       mctx->rbp = context->Rbp;
+       mctx->rsi = context->Rsi;
+       mctx->rdi = context->Rdi;
+       mctx->r8 = context->R8;
+       mctx->r9 = context->R9;
+       mctx->r10 = context->R10;
+       mctx->r11 = context->R11;
+       mctx->r12 = context->R12;
+       mctx->r13 = context->R13;
+       mctx->r14 = context->R14;
+       mctx->r15 = context->R15;
 #else
        MonoContext *ctx = (MonoContext *)sigctx;
 
@@ -181,6 +233,26 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
        UCONTEXT_REG_R14 (ctx) = mctx->r14;
        UCONTEXT_REG_R15 (ctx) = mctx->r15;
        UCONTEXT_REG_RIP (ctx) = mctx->rip;
+#elif defined(HOST_WIN32)
+       CONTEXT *context = (CONTEXT*)sigctx;
+
+       context->Rip = mctx->rip;
+       context->Rax = mctx->rax;
+       context->Rcx = mctx->rcx;
+       context->Rdx = mctx->rdx;
+       context->Rbx = mctx->rbx;
+       context->Rsp = mctx->rsp;
+       context->Rbp = mctx->rbp;
+       context->Rsi = mctx->rsi;
+       context->Rdi = mctx->rdi;
+       context->R8 = mctx->r8;
+       context->R9 = mctx->r9;
+       context->R10 = mctx->r10;
+       context->R11 = mctx->r11;
+       context->R12 = mctx->r12;
+       context->R13 = mctx->r13;
+       context->R14 = mctx->r14;
+       context->R15 = mctx->r15;
 #else
        MonoContext *ctx = (MonoContext *)sigctx;
 
index 11254802fc4606e16563ec5c8de6f2470f585a92..619e574e424c509728ba2d009543f18557cacea9 100755 (executable)
@@ -236,9 +236,7 @@ extern void mono_context_get_current (void *);
                : "rdx", "memory")
 #endif
 
-#if !defined(HOST_WIN32)
 #define MONO_ARCH_HAS_MONO_CONTEXT 1
-#endif
 
 #elif (defined(__arm__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_ARM)) /* defined(__x86_64__) */
 
@@ -281,6 +279,8 @@ typedef struct {
        ctx.pc = ctx.regs [15];                 \
 } while (0)
 
+#define MONO_ARCH_HAS_MONO_CONTEXT 1
+
 #elif (defined(__aarch64__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_ARM64))
 
 #include <mono/arch/arm64/arm64-codegen.h>
@@ -546,7 +546,18 @@ typedef struct ucontext MonoContext;
 
 #endif
 
+/*
+ * The naming is misleading, the SIGCTX argument should be the platform's context
+ * structure (ucontext_c on posix, CONTEXT on windows).
+ */
 void mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx) MONO_INTERNAL;
+
+/*
+ * This will not completely initialize SIGCTX since MonoContext contains less
+ * information that the system context. The caller should obtain a SIGCTX from
+ * the system, and use this function to override the parts of it which are
+ * also in MonoContext.
+ */
 void mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx) MONO_INTERNAL;
 
 #endif /* __MONO_MONO_CONTEXT_H__ */
index b59ab2d5aae0de5322e91c8f626010e934fad50e..04e9165b7c09a0dc363e605034ef6e4cd4fa730a 100644 (file)
@@ -124,7 +124,7 @@ w32_dlerror (void)
        wchar_t* buf = NULL;
        DWORD code = GetLastError ();
 
-       if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL,
+       if (FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
                code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR)&buf, 0, NULL))
        {
                ret = g_utf16_to_utf8 (buf, wcslen(buf), NULL, NULL, NULL);
index ce087bbc36bb4e5d7b9d5e12f1885d7a0a5dcd27..80f283f8878725d6fbb4635ce2b67f434a3d94a3 100644 (file)
@@ -236,6 +236,30 @@ mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
        return handle;
 }
 
+gpointer
+mono_threads_core_prepare_interrupt (HANDLE thread_handle)
+{
+       return wapi_prepare_interrupt_thread (thread_handle);
+}
+
+void
+mono_threads_core_finish_interrupt (gpointer wait_handle)
+{
+       wapi_finish_interrupt_thread (wait_handle);
+}
+
+void
+mono_threads_core_self_interrupt (void)
+{
+       wapi_self_interrupt ();
+}
+
+void
+mono_threads_core_clear_interruption (void)
+{
+       wapi_clear_interruption ();
+}
+
 #if !defined (__MACH__)
 
 #if !defined(__native_client__)
old mode 100644 (file)
new mode 100755 (executable)
index 2ab2e65..04430fb
@@ -12,6 +12,7 @@
 #if defined(HOST_WIN32)
 
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-compiler.h>
 #include <limits.h>
 
 
@@ -20,10 +21,23 @@ mono_threads_init_platform (void)
 {
 }
 
+static void CALLBACK
+interrupt_apc (ULONG_PTR param)
+{
+}
+
 void
 mono_threads_core_interrupt (MonoThreadInfo *info)
 {
-       g_assert (0);
+       DWORD id = mono_thread_info_get_tid (info);
+       HANDLE handle;
+
+       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+       g_assert (handle);
+
+       QueueUserAPC ((PAPCFUNC)interrupt_apc, handle, (ULONG_PTR)NULL);
+
+       CloseHandle (handle);
 }
 
 void
@@ -46,13 +60,73 @@ mono_threads_core_self_suspend (MonoThreadInfo *info)
 gboolean
 mono_threads_core_suspend (MonoThreadInfo *info)
 {
-       g_assert_not_reached ();
+       DWORD id = mono_thread_info_get_tid (info);
+       HANDLE handle;
+       DWORD result;
+       gboolean res;
+
+       g_assert (id != GetCurrentThreadId ());
+
+       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+       g_assert (handle);
+
+       result = SuspendThread (handle);
+       if (result == (DWORD)-1) {
+               fprintf (stderr, "could not suspend thread %x (handle %p): %d\n", id, handle, GetLastError ()); fflush (stderr);
+               CloseHandle (handle);
+               return FALSE;
+       }
+
+       CloseHandle (handle);
+
+       res = mono_threads_get_runtime_callbacks ()->thread_state_init_from_handle (&info->suspend_state, info);
+       g_assert (res);
+
+       return TRUE;
 }
 
 gboolean
 mono_threads_core_resume (MonoThreadInfo *info)
 {
-       g_assert_not_reached ();
+       DWORD id = mono_thread_info_get_tid (info);
+       HANDLE handle;
+       DWORD result;
+
+       handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
+       g_assert (handle);
+
+       if (info->async_target) {
+               MonoContext ctx;
+               CONTEXT context;
+               gboolean res;
+
+               ctx = info->suspend_state.ctx;
+               mono_threads_get_runtime_callbacks ()->setup_async_callback (&ctx, info->async_target, info->user_data);
+               info->async_target = info->user_data = NULL;
+
+               context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
+
+               if (!GetThreadContext (handle, &context)) {
+                       CloseHandle (handle);
+                       return FALSE;
+               }
+
+               g_assert (context.ContextFlags & CONTEXT_INTEGER);
+               g_assert (context.ContextFlags & CONTEXT_CONTROL);
+
+               mono_monoctx_to_sigctx (&ctx, &context);
+
+               context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
+               res = SetThreadContext (handle, &context);
+               g_assert (res);
+       }
+
+       result = ResumeThread (handle);
+       g_assert (result != (DWORD)-1);
+
+       CloseHandle (handle);
+
+       return result != (DWORD)-1;
 }
 
 void
@@ -175,8 +249,7 @@ mono_threads_core_resume_created (MonoThreadInfo *info, MonoNativeThreadId tid)
 }
 
 #if HAVE_DECL___READFSDWORD==0
-static __inline__ __attribute__((always_inline))
-unsigned long long
+static MONO_ALWAYS_INLINE unsigned long long
 __readfsdword (unsigned long offset)
 {
        unsigned long value;
@@ -263,9 +336,58 @@ mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid)
        return OpenThread (THREAD_ALL_ACCESS, TRUE, tid);
 }
 
+#if !defined(__GNUC__)
+const DWORD MS_VC_EXCEPTION=0x406D1388;
+#pragma pack(push,8)
+typedef struct tagTHREADNAME_INFO
+{
+   DWORD dwType; // Must be 0x1000.
+   LPCSTR szName; // Pointer to name (in user addr space).
+   DWORD dwThreadID; // Thread ID (-1=caller thread).
+  DWORD dwFlags; // Reserved for future use, must be zero.
+} THREADNAME_INFO;
+#pragma pack(pop)
+#endif
+
 void
 mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
 {
+#if !defined(__GNUC__)
+       /* http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx */
+       THREADNAME_INFO info;
+       info.dwType = 0x1000;
+       info.szName = name;
+       info.dwThreadID = tid;
+       info.dwFlags = 0;
+
+       __try {
+               RaiseException( MS_VC_EXCEPTION, 0, sizeof(info)/sizeof(ULONG_PTR),       (ULONG_PTR*)&info );
+       }
+       __except(EXCEPTION_EXECUTE_HANDLER) {
+       }
+#endif
+}
+
+
+gpointer
+mono_threads_core_prepare_interrupt (HANDLE thread_handle)
+{
+       return NULL;
+}
+
+void
+mono_threads_core_finish_interrupt (gpointer wait_handle)
+{
+}
+
+void
+mono_threads_core_self_interrupt (void)
+{
+}
+
+void
+mono_threads_core_clear_interruption (void)
+{
 }
 
 #endif
index cbb768aea8cc1b5a88a42878794704b4e1e2e73e..ce0e5be87ef8dd5d4e68572540d91cd5fe313eb4 100644 (file)
@@ -731,12 +731,14 @@ mono_thread_info_new_interrupt_enabled (void)
 #if defined (HAVE_BOEHM_GC) && !defined (USE_INCLUDED_LIBGC)
        return FALSE;
 #endif
-       /*port not done*/
 #if defined(HOST_WIN32)
-       return FALSE;
+       return !disable_new_interrupt;
 #endif
 #if defined (__i386__)
        return !disable_new_interrupt;
+#endif
+#if defined(__arm__) && !defined(__APPLE__)
+       return !disable_new_interrupt;
 #endif
        return FALSE;
 }
@@ -852,7 +854,7 @@ mono_thread_info_open_handle (void)
 }
 
 /*
- * mono_thread_info_open_handle:
+ * mono_threads_open_thread_handle:
  *
  *   Return a io-layer/win32 handle for the thread identified by HANDLE/TID.
  * The handle need to be closed by calling CloseHandle () when it is no
@@ -869,3 +871,41 @@ mono_thread_info_set_name (MonoNativeThreadId tid, const char *name)
 {
        mono_threads_core_set_name (tid, name);
 }
+
+/*
+ * mono_thread_info_prepare_interrupt:
+ *
+ *   See wapi_prepare_interrupt ().
+ */
+gpointer
+mono_thread_info_prepare_interrupt (HANDLE thread_handle)
+{
+       return mono_threads_core_prepare_interrupt (thread_handle);
+}
+
+void
+mono_thread_info_finish_interrupt (gpointer wait_handle)
+{
+       mono_threads_core_finish_interrupt (wait_handle);
+}
+
+void
+mono_thread_info_interrupt (HANDLE thread_handle)
+{
+       gpointer wait_handle;
+
+       wait_handle = mono_thread_info_prepare_interrupt (thread_handle);
+       mono_thread_info_finish_interrupt (wait_handle);
+}
+       
+void
+mono_thread_info_self_interrupt (void)
+{
+       mono_threads_core_self_interrupt ();
+}
+
+void
+mono_thread_info_clear_interruption (void)
+{
+       mono_threads_core_clear_interruption ();
+}
index d97543313c9d96454c60193c21920d36fc10c306..91a7df5f0fce44c055811181a1d3edc457401e71 100644 (file)
@@ -302,6 +302,21 @@ mono_thread_info_exit (void);
 HANDLE
 mono_thread_info_open_handle (void);
 
+gpointer
+mono_thread_info_prepare_interrupt (HANDLE thread_handle);
+
+void
+mono_thread_info_finish_interrupt (gpointer wait_handle);
+
+void
+mono_thread_info_interrupt (HANDLE thread_handle);
+
+void
+mono_thread_info_self_interrupt (void);
+
+void
+mono_thread_info_clear_interruption (void);
+
 HANDLE
 mono_threads_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, guint32 stack_size, guint32 creation_flags, MonoNativeThreadId *out_tid);
 
@@ -339,6 +354,10 @@ void mono_threads_core_unregister (THREAD_INFO_TYPE *info) MONO_INTERNAL;
 HANDLE mono_threads_core_open_handle (void) MONO_INTERNAL;
 HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid) MONO_INTERNAL;
 void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name) MONO_INTERNAL;
+gpointer mono_threads_core_prepare_interrupt (HANDLE thread_handle);
+void mono_threads_core_finish_interrupt (gpointer wait_handle);
+void mono_threads_core_self_interrupt (void);
+void mono_threads_core_clear_interruption (void);
 
 MonoNativeThreadId mono_native_thread_id_get (void) MONO_INTERNAL;
 
index ef26f9180d7e7b6c64ae677faa1c78da0152ca18..46b4dde2c8f73227ef4cffbf11bca5ce73434455 100644 (file)
@@ -10,6 +10,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       <PreprocessorDefinitions>__default_codegen__;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;HAVE_CONFIG_H;GC_NOT_DLL;WIN32_THREADS;WINVER=0x0500;_WIN32_WINNT=0x0500;_WIN32_IE=0x0501;_UNICODE;UNICODE;WIN32_THREADS;FD_SETSIZE=1024;$(PreprocessorDefinitions);_WINSOCKAPI_</PreprocessorDefinitions>
+         <DisableSpecificWarnings>4273;4005</DisableSpecificWarnings>
     </ClCompile>
     <Link>
       <AdditionalDependencies>Mswsock.lib;ws2_32.lib;ole32.lib;oleaut32.lib;psapi.lib;version.lib;advapi32.lib;winmm.lib;kernel32.lib;$(AdditionalDependencies)</AdditionalDependencies>
index 93adea143ed417dafe5ec142310c3a86b6ca9e54..ac0e3a9a95706952ae1719ba43a001794181e540 100644 (file)
@@ -76,6 +76,7 @@ scripts_4_0 = \
        prj2make$(SCRIPT_SUFFIX)                \
        soapsuds$(SCRIPT_SUFFIX)                \
        caspol$(SCRIPT_SUFFIX)                  \
+       cert-sync$(SCRIPT_SUFFIX)               \
        cert2spc$(SCRIPT_SUFFIX)                \
        certmgr$(SCRIPT_SUFFIX)                 \
        chktrust$(SCRIPT_SUFFIX)                \
index 1a44d5eb7e19ef4a4ba5fe1ef74cd343dc0595a0..f42f5cf90b4c0911d70d6ddf9f137fecd7e93592 100644 (file)
@@ -1073,10 +1073,14 @@ namespace Mono.Tools.LocaleBuilder
                                        // Apply global rule first <alias source="locale" path="../dayPeriodWidth[@type='wide']"/>
                                        el = node.SelectSingleNode ("dayPeriods/dayPeriodContext/dayPeriodWidth[@type='wide']/dayPeriod[@type='am']");
 
+                               // Manual edits for exact .net compatiblity
                                switch (ci.Name) {
                                case "en-AU":
                                        df.AMDesignator = "AM";
                                        break;
+                               case "en-NZ":
+                                       df.AMDesignator = "a.m.";
+                                       break;
                                default:
                                        if (el != null)
                                                df.AMDesignator = el.InnerText;
@@ -1092,6 +1096,9 @@ namespace Mono.Tools.LocaleBuilder
                                case "en-AU":
                                        df.PMDesignator = "PM";
                                        break;
+                               case "en-NZ":
+                                       df.PMDesignator = "p.m.";
+                                       break;
                                default:
                                        if (el != null)
                                                df.PMDesignator = el.InnerText;