Merge branch 'marek'
authorMarek Safar <marek.safar@gmail.com>
Tue, 14 Sep 2010 14:43:43 +0000 (15:43 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 14 Sep 2010 14:43:43 +0000 (15:43 +0100)
32 files changed:
mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
mcs/class/System.Data.Linq/Makefile
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ChannelEndpointElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/EndpointCollectionElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceEndpointElement.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceEndpointElementCollection.cs
mcs/class/System.ServiceModel/System.ServiceModel.Configuration/StandardEndpointCollectionElement.cs
mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
mcs/class/System/System.ComponentModel/TypeConverter.cs
mcs/class/System/System.ComponentModel/TypeDescriptionProvider.cs
mcs/class/System/System.ComponentModel/TypeDescriptor.cs
mcs/class/System/System/Uri.cs
mcs/class/System/System/UriTypeConverter.cs
mcs/class/System/System_test.dll.sources
mcs/class/System/Test/System.ComponentModel/TypeDescriptionProviderTest.cs [new file with mode: 0644]
mcs/class/System/Test/System.ComponentModel/TypeDescriptorTests.cs
mcs/class/System/Test/System/UriTest.cs
mcs/class/System/Test/System/UriTest2.cs
mcs/class/System/Test/System/UriTest3.cs
mcs/class/corlib/System.Reflection.Emit/MethodBuilder.cs
mcs/class/corlib/Test/System.Reflection.Emit/MethodBuilderTest.cs
mono/io-layer/shared.c
mono/metadata/domain.c
mono/metadata/profiler.h
mono/metadata/sgen-cardtable.c
mono/metadata/sgen-gc.c
mono/metadata/sgen-workers.c
mono/metadata/verify.c
mono/mini/debugger-agent.c
mono/tests/verifier/unverifiable_fallout_of_finally_block.il
mono/utils/mono-sigcontext.h

index c6c378fb865534a02cbdec0e4a86e57c40b42fd5..9c25270b287c9aa416f1c66dd3295c6e4e5551e8 100644 (file)
@@ -265,7 +265,7 @@ namespace Mono.Debugger.Soft
                 * with newer runtimes, and vice versa.
                 */
                public const int MAJOR_VERSION = 2;
-               public const int MINOR_VERSION = 1;
+               public const int MINOR_VERSION = 2;
 
                enum WPSuspendPolicy {
                        NONE = 0,
index b3e19b279f69fae91ce3b218fdfd095137b20aaa..aeb7c345c43eebf0091ba304e59ebd4c8fe5de14 100755 (executable)
@@ -9,6 +9,7 @@ LIB_MCS_FLAGS = \
                /r:System.Xml.dll \
                /r:System.Data.dll \
                /r:System.Runtime.Serialization.dll \
+               /resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd \
                /d:MONO_STRICT /d:MONO_DEPLOY
 
 ifeq (2.0, $(FRAMEWORK_VERSION))
@@ -18,7 +19,7 @@ endif
 
 TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
 
-EXTRA_DISTFILES =
+EXTRA_DISTFILES = src/DbLinq/Schema/Dbml/DbmlSchema.xsd
 
 # This is a .NET 3.5+ assembly
 VALID_PROFILE := $(filter net_2_0 net_4_0, $(PROFILE))
index 145a98168e739dcb77020458201c42013f9999a7..3ca509187b74517459651adcefc412f76ce12c44 100644 (file)
@@ -68,6 +68,10 @@ namespace System.ServiceModel.Configuration
                static ConfigurationProperty headers;
                static ConfigurationProperty identity;
                static ConfigurationProperty name;
+#if NET_4_0
+               static ConfigurationProperty endpoint_configuration;
+               static ConfigurationProperty kind;
+#endif
 
                static ChannelEndpointElement ()
                {
@@ -104,6 +108,11 @@ namespace System.ServiceModel.Configuration
                                typeof (string), "", new StringConverter (), null,
                                ConfigurationPropertyOptions.IsKey);
 
+#if NET_4_0
+                       endpoint_configuration = new ConfigurationProperty ("endpointConfiguration", typeof (string), "", null, new StringValidator (0), ConfigurationPropertyOptions.IsKey);
+                       kind = new ConfigurationProperty ("kind", typeof (string), "", null, new StringValidator (0), ConfigurationPropertyOptions.IsKey);
+#endif
+
                        properties.Add (address);
                        properties.Add (behavior_configuration);
                        properties.Add (binding);
@@ -112,6 +121,11 @@ namespace System.ServiceModel.Configuration
                        properties.Add (headers);
                        properties.Add (identity);
                        properties.Add (name);
+
+#if NET_4_0
+                       properties.Add (endpoint_configuration);
+                       properties.Add (kind);
+#endif
                }
 
                public ChannelEndpointElement ()
@@ -197,6 +211,22 @@ namespace System.ServiceModel.Configuration
                        set { base [name] = value; }
                }
 
+#if NET_4_0
+               [StringValidator (MinLength = 0)]
+               [ConfigurationProperty ("endpointConfiguration", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
+               public string EndpointConfiguration {
+                       get { return (string) base [endpoint_configuration]; }
+                       set { base [endpoint_configuration] = value; }
+               }
+
+               [ConfigurationProperty ("kind", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
+               [StringValidator (MinLength = 0)]
+               public string Kind {
+                       get { return (string) base [kind]; }
+                       set { base [kind] = value; }
+               }
+#endif
+
                protected override ConfigurationPropertyCollection Properties {
                        get { return properties; }
                }
index 1786a93db541642509c4dadc1be9256272fe8688..a69f9fbdf4db0647d9b60550b948224bdaad7d43 100644 (file)
@@ -69,6 +69,12 @@ namespace System.ServiceModel.Configuration
                        get { return (ExtensionsSection) GetSection ("system.serviceModel/extensions"); }
                }
 
+               public static StandardEndpointsSection StandardEndpointsSection {
+                       get {
+                               return (StandardEndpointsSection) GetSection ("system.serviceModel/standardEndpoints");
+                       }
+               }
+
                public static Binding CreateBinding (string binding, string bindingConfiguration)
                {
                        BindingCollectionElement section = ConfigUtil.BindingsSection [binding];
@@ -84,6 +90,30 @@ namespace System.ServiceModel.Configuration
                        return b;
                }
 
+               public static ServiceEndpoint ConfigureStandardEndpoint (ContractDescription cd, ServiceEndpointElement element)
+               {
+                       string kind = element.Kind;
+                       string endpointConfiguration = element.EndpointConfiguration;
+
+                       EndpointCollectionElement section = ConfigUtil.StandardEndpointsSection [kind];
+                       if (section == null)
+                               throw new ArgumentException (String.Format ("standard endpoint section for '{0}' was not found.", kind));
+
+                       StandardEndpointElement e = section.GetDefaultStandardEndpointElement ();
+
+                       ServiceEndpoint inst = e.CreateServiceEndpoint (cd);
+
+                       foreach (StandardEndpointElement el in section.ConfiguredEndpoints) {
+                               if (el.Name == endpointConfiguration) {
+                                       el.InitializeAndValidate (element);
+                                       el.ApplyConfiguration (inst, element);
+                                       break;
+                               }
+                       }
+                       
+                       return inst;
+               }
+
                public static KeyedByTypeCollection<IEndpointBehavior>  CreateEndpointBehaviors (string bindingConfiguration)
                {
                        var ec = BehaviorsSection.EndpointBehaviors [bindingConfiguration];
index 3bf01325480eb56dcfb6ed6353f7e0f9efb60eff..cea55b877cb33b7793f5fb174bd4cb7a688cca32 100644 (file)
@@ -62,7 +62,12 @@ namespace System.ServiceModel.Configuration
                public abstract ReadOnlyCollection<StandardEndpointElement> ConfiguredEndpoints { get; }
 
                public string EndpointName {
-                       get { throw new NotImplementedException (); }
+                       get {
+                               foreach (ExtensionElement el in ConfigUtil.StandardEndpointsSection.Properties)
+                                       if (EndpointType.FullName == el.Type)
+                                               return el.Name;
+                               throw new InvalidOperationException (String.Format ("This EndpointCollectionElement '{0}' is not found in the configuration", GetType ()));
+                       }
                }
 
                public abstract Type EndpointType { get; }
index 8ae3569aa2f08cc6a4941df0166c2af8df3e5009..b44abe84190f00b6494e27aa7433fec0a882e18e 100644 (file)
@@ -71,6 +71,11 @@ namespace System.ServiceModel.Configuration
                static ConfigurationProperty listen_uri;
                static ConfigurationProperty listen_uri_mode;
                static ConfigurationProperty name;
+#if NET_4_0
+               static ConfigurationProperty endpoint_configuration;
+               static ConfigurationProperty is_system_endpoint;
+               static ConfigurationProperty kind;
+#endif
 
                static ServiceEndpointElement ()
                {
@@ -123,6 +128,12 @@ namespace System.ServiceModel.Configuration
                                typeof (string), "", new StringConverter (), new StringValidator (0, int.MaxValue, null),
                                ConfigurationPropertyOptions.None);
 
+#if NET_4_0
+                       endpoint_configuration = new ConfigurationProperty ("endpointConfiguration", typeof (string), "", null, new StringValidator (0), ConfigurationPropertyOptions.IsKey);
+                       is_system_endpoint = new ConfigurationProperty ("isSystemEndpoint", typeof (bool), false, null, null, ConfigurationPropertyOptions.None);
+                       kind = new ConfigurationProperty ("kind", typeof (string), "", null, new StringValidator (0), ConfigurationPropertyOptions.IsKey);
+#endif
+
                        properties.Add (address);
                        properties.Add (behavior_configuration);
                        properties.Add (binding);
@@ -135,6 +146,12 @@ namespace System.ServiceModel.Configuration
                        properties.Add (listen_uri);
                        properties.Add (listen_uri_mode);
                        properties.Add (name);
+
+#if NET_4_0
+                       properties.Add (endpoint_configuration);
+                       properties.Add (is_system_endpoint);
+                       properties.Add (kind);
+#endif
                }
 
                public ServiceEndpointElement ()
@@ -236,6 +253,28 @@ namespace System.ServiceModel.Configuration
                        get { return (IdentityElement) base [identity]; }
                }
 
+#if NET_4_0
+               [StringValidator (MinLength = 0)]
+               [ConfigurationProperty ("endpointConfiguration", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
+               public string EndpointConfiguration {
+                       get { return (string) base [endpoint_configuration]; }
+                       set { base [endpoint_configuration] = value; }
+               }
+
+               [ConfigurationProperty ("isSystemEndpoint", DefaultValue = false)]
+               public bool IsSystemEndpoint {
+                       get { return (bool) base [is_system_endpoint]; }
+                       set { base [is_system_endpoint] = value; }
+               }
+
+               [ConfigurationProperty ("kind", DefaultValue = "", Options = ConfigurationPropertyOptions.IsKey)]
+               [StringValidator (MinLength = 0)]
+               public string Kind {
+                       get { return (string) base [kind]; }
+                       set { base [kind] = value; }
+               }
+#endif
+
                [ConfigurationProperty ("listenUri",
                         Options = ConfigurationPropertyOptions.None,
                         DefaultValue = null)]
index b5f5327c5ecb9c7209c4790d1883b76f63c5e639..3d8a380b37a8f76ba3b589a6bea6ef14aa55d610 100644 (file)
@@ -71,14 +71,22 @@ namespace System.ServiceModel.Configuration
                protected override object GetElementKey (ConfigurationElement element) {
                        ServiceEndpointElement el = (ServiceEndpointElement) element;
 
-                       return el.Address + ";" +
-                               el.Binding.GetHashCode () + ";" +
-                               el.BindingConfiguration.GetHashCode () + ";" +
-                               el.BindingName.GetHashCode () + ";" +
-                               el.BindingNamespace.GetHashCode () + ";" +
-                               el.Contract.GetHashCode ();
+                       return GetHashCode (el.Address) +
+                               GetHashCode (el.Binding) +
+                               GetHashCode (el.BindingConfiguration) +
+                               GetHashCode (el.BindingName) +
+                               GetHashCode (el.BindingNamespace) +
+#if NET_4_0
+                               GetHashCode (el.EndpointConfiguration) +
+                               GetHashCode (el.Kind) +
+#endif
+                               GetHashCode (el.Contract);
                }
 
+               static string GetHashCode (object obj)
+               {
+                       return (obj != null ? obj.GetHashCode () : 0) + ";";
+               }
        }
 
 }
index 52477445f2545a8edf9ee6a32684647962547b9d..71b983a58b086ce9e56f06ee9df22683a57d43d9 100644 (file)
@@ -62,7 +62,7 @@ namespace System.ServiceModel.Configuration
                where TEndpointConfiguration : StandardEndpointElement, new()
        {
                static ConfigurationPropertyCollection properties;
-               static ConfigurationProperty endpoints = new ConfigurationProperty ("endpoints",
+               static ConfigurationProperty endpoints = new ConfigurationProperty ("",
                                typeof (StandardEndpointElementCollection<TEndpointConfiguration>), null, null, null,
                                ConfigurationPropertyOptions.IsDefaultCollection);
 
@@ -74,11 +74,18 @@ namespace System.ServiceModel.Configuration
                void FillProperties (ConfigurationPropertyCollection baseProps)
                {
                        properties = new ConfigurationPropertyCollection ();
+                       foreach (ConfigurationProperty prop in baseProps)
+                               properties.Add (prop);
                        properties.Add (endpoints);
                }
                
                public override ReadOnlyCollection<StandardEndpointElement> ConfiguredEndpoints {
-                       get { throw new NotImplementedException (); }
+                       get {
+                               var l = new List<StandardEndpointElement> ();
+                               foreach (StandardEndpointElement e in Endpoints)
+                                       l.Add (e);
+                               return new ReadOnlyCollection<StandardEndpointElement> (l);
+                       }
                }
 
                [ConfigurationPropertyAttribute("", Options = ConfigurationPropertyOptions.IsDefaultCollection)]
@@ -102,12 +109,15 @@ namespace System.ServiceModel.Configuration
 
                public override bool ContainsKey (string name)
                {
-                       throw new NotImplementedException ();
+                       foreach (StandardEndpointElement e in Endpoints)
+                               if (e.Name == name)
+                                       return true;
+                       return false;
                }
                
                protected internal override StandardEndpointElement GetDefaultStandardEndpointElement ()
                {
-                       throw new NotImplementedException ();
+                       return (StandardEndpointElement) Activator.CreateInstance (typeof (TEndpointConfiguration));
                }
                
                protected internal override bool TryAdd (string name, ServiceEndpoint endpoint, ConfigurationType config)
index a7e66db731893f9c598c4bda1c7503e4d5da1df9..4f0ecbc4c6619fc2232885c902f294313417d48d 100644 (file)
@@ -319,40 +319,10 @@ namespace System.ServiceModel
                                throw new InvalidOperationException ("ApplyConfiguration requires that the Description property be initialized. Either provide a valid ServiceDescription in the CreateDescription method or override the ApplyConfiguration method to provide an alternative implementation");
 
                        ServiceElement service = GetServiceElement ();
-                       if (service != null) {
-                               
-                               //base addresses
-                               HostElement host = service.Host;
-                               foreach (BaseAddressElement baseAddress in host.BaseAddresses) {
-                                       AddBaseAddress (new Uri (baseAddress.BaseAddress));
-                               }
+                       
+                       if (service != null)
+                               ApplyServiceElement (service);
 
-                               // behaviors
-                               ServiceBehaviorElement behavior = ConfigUtil.BehaviorsSection.ServiceBehaviors [service.BehaviorConfiguration];
-                               if (behavior != null) {
-                                       foreach (var bxe in behavior) {
-                                               IServiceBehavior b = (IServiceBehavior) bxe.CreateBehavior ();
-                                               Description.Behaviors.Add (b);
-                                       }
-                               }
-                               else
-                                       throw new ArgumentException (String.Format ("Service behavior {0} is specified, but was not found", service.BehaviorConfiguration));
-
-                               // services
-                               foreach (ServiceEndpointElement endpoint in service.Endpoints) {
-                                       ServiceEndpoint se = AddServiceEndpoint (
-                                               endpoint.Contract,
-                                               ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration),
-                                               endpoint.Address);
-                                       // endpoint behaviors
-                                       EndpointBehaviorElement epbehavior = ConfigUtil.BehaviorsSection.EndpointBehaviors [endpoint.BehaviorConfiguration];
-                                       if (epbehavior != null)
-                                               foreach (var bxe in epbehavior) {
-                                                       IEndpointBehavior b = (IEndpointBehavior) bxe.CreateBehavior ();
-                                                       se.Behaviors.Add (b);
-                                       }
-                               }
-                       }
                        // TODO: consider commonBehaviors here
 
                        // ensure ServiceAuthorizationBehavior
@@ -369,6 +339,50 @@ namespace System.ServiceModel
                                Description.Behaviors.Add (debugBehavior);
                        }
                }
+               
+               void ApplyServiceElement (ServiceElement service)
+               {
+                       //base addresses
+                       HostElement host = service.Host;
+                       foreach (BaseAddressElement baseAddress in host.BaseAddresses) {
+                               AddBaseAddress (new Uri (baseAddress.BaseAddress));
+                       }
+
+                       // behaviors
+                       ServiceBehaviorElement behavior = ConfigUtil.BehaviorsSection.ServiceBehaviors [service.BehaviorConfiguration];
+                       if (behavior != null) {
+                               foreach (var bxe in behavior) {
+                                       IServiceBehavior b = (IServiceBehavior) bxe.CreateBehavior ();
+                                       Description.Behaviors.Add (b);
+                               }
+                       }
+                       else if (!String.IsNullOrEmpty (service.BehaviorConfiguration))
+                               throw new ArgumentException (String.Format ("Service behavior configuration '{0}' was not found", service.BehaviorConfiguration));
+
+                       // services
+                       foreach (ServiceEndpointElement endpoint in service.Endpoints) {
+                               var binding = endpoint.Kind != null ? null : ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration);
+
+                               ServiceEndpoint se;
+
+                               if (endpoint.Kind != null) {
+                                       var contract = GetContract (endpoint.Contract, false);
+                                       se = ConfigUtil.ConfigureStandardEndpoint (contract, endpoint);
+                                       if (se.Binding == null)
+                                               se.Binding = binding;
+                               }
+                               else
+                                       se = AddServiceEndpoint (endpoint.Contract, binding, endpoint.Address);
+
+                               // endpoint behaviors
+                               EndpointBehaviorElement epbehavior = ConfigUtil.BehaviorsSection.EndpointBehaviors [endpoint.BehaviorConfiguration];
+                               if (epbehavior != null)
+                                       foreach (var bxe in epbehavior) {
+                                               IEndpointBehavior b = (IEndpointBehavior) bxe.CreateBehavior ();
+                                               se.Behaviors.Add (b);
+                               }
+                       }
+               }
 
                private ServiceElement GetServiceElement() {
                        Type serviceType = Description.ServiceType;
index 419764a28e36a7c0b4f0368538da67b4b62c6af1..a9a6a039f755418bece3451e9edc30641640ee1d 100644 (file)
@@ -321,14 +321,24 @@ namespace System.ComponentModel
                        private Type componentType;
                        private Type propertyType;
 
-                       public SimplePropertyDescriptor (Type componentType,
+#if NET_4_0
+                       protected
+#else
+                       public
+#endif
+                       SimplePropertyDescriptor (Type componentType,
                                                         string name,
                                                         Type propertyType) :
                                this (componentType, name, propertyType, null)
                        {
                        }
 
-                       public SimplePropertyDescriptor (Type componentType,
+#if NET_4_0
+                       protected
+#else
+                       public
+#endif
+                       SimplePropertyDescriptor (Type componentType,
                                                         string name,
                                                         Type propertyType,
                                                         Attribute [] attributes) : base (name, attributes)
index 63e18d03de3bd532573c87b43e933cce14f1c7e3..dc572724dd59b41f9e347e70155a0ffd734bcb40 100644 (file)
@@ -27,7 +27,6 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
-#if NET_2_0
 
 using System;
 using System.Collections;
@@ -143,8 +142,42 @@ namespace System.ComponentModel
                        return _emptyCustomTypeDescriptor;
                }
 
+#if NET_4_0
+               public virtual bool IsSupportedType (Type type)
+               {
+                       if (type == null)
+                               throw new ArgumentNullException ("type");
+
+                       if (_parent != null)
+                               return _parent.IsSupportedType (type);
+
+                       return true;
+               }
+
+               public virtual Type GetRuntimeType (Type reflectionType)
+               {
+                       if (reflectionType == null)
+                               throw new ArgumentNullException ("reflectionType");
+
+                       if (_parent != null)
+                               return _parent.GetRuntimeType (reflectionType);
+
+                       return reflectionType;
+               }
+
+               protected internal virtual IExtenderProvider[] GetExtenderProviders (object instance)
+               {
+                       if (instance == null)
+                               throw new ArgumentNullException ("instance");
+
+                       if (_parent != null)
+                               return _parent.GetExtenderProviders (instance);
+
+                       return new IExtenderProvider [] { };
+               }
+#endif
+
        }
 
 }
 
-#endif
index 35df4f0410e2b3420fa350183039717c37bd10b0..2645d7ff79ed4991b5f075137cf05db6a0f2ff74 100644 (file)
@@ -39,9 +39,7 @@ using System.Globalization;
 using System.ComponentModel.Design;
 using System.Security.Permissions;
 
-#if NET_2_0
 using System.Collections.Generic;
-#endif
 
 namespace System.ComponentModel
 {
@@ -55,7 +53,6 @@ public sealed class TypeDescriptor
        private static Hashtable typeTable = new Hashtable ();
        private static Hashtable editors;
 
-#if NET_2_0
        static object typeDescriptionProvidersLock = new object ();
        static Dictionary <Type, LinkedList <TypeDescriptionProvider>> typeDescriptionProviders;
 
@@ -67,18 +64,26 @@ public sealed class TypeDescriptor
                typeDescriptionProviders = new Dictionary <Type, LinkedList <TypeDescriptionProvider>> ();
                componentDescriptionProviders = new Dictionary <WeakObjectWrapper, LinkedList <TypeDescriptionProvider>> (new WeakObjectWrapperComparer ());
        }
-#endif
+
        private TypeDescriptor ()
        {
        }
 
-#if NET_2_0
        [MonoNotSupported ("Mono does not support COM")]
        [EditorBrowsable (EditorBrowsableState.Advanced)]
        public static Type ComObjectType {
                get { throw new NotImplementedException (); }
        }
 
+#if NET_4_0
+       [EditorBrowsable (EditorBrowsableState.Advanced)]
+       public static Type InterfaceType {
+               get {
+                       return typeof (TypeDescriptorInterface);
+               }
+       }
+#endif
+
        [EditorBrowsable (EditorBrowsableState.Advanced)]
        public static TypeDescriptionProvider AddAttributes (object instance, params Attribute [] attributes)
        {
@@ -172,11 +177,8 @@ public sealed class TypeDescriptor
 
                return instance;
        }
-#endif
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
 #if !NET_2_1
        public
 #else
@@ -258,9 +260,7 @@ public sealed class TypeDescriptor
                return GetAttributes (component, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static AttributeCollection GetAttributes (object component, bool noCustomTypeDesc)
        {
                if (component == null)
@@ -282,9 +282,7 @@ public sealed class TypeDescriptor
                return GetClassName (component, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static string GetClassName (object component, bool noCustomTypeDesc)
        {
                if (component == null)
@@ -307,9 +305,7 @@ public sealed class TypeDescriptor
                return GetComponentName (component, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static string GetComponentName (object component, bool noCustomTypeDesc)
        {
                if (component == null)
@@ -321,15 +317,10 @@ public sealed class TypeDescriptor
                        IComponent c = component as IComponent;
                        if (c != null && c.Site != null)
                                return c.Site.Name;
-#if NET_2_0
                        return null;
-#else
-                       return component.GetType().Name;
-#endif
                }
        }
 
-#if NET_2_0
        [MonoNotSupported("")]
        public static string GetFullComponentName (object component)
        {
@@ -341,16 +332,13 @@ public sealed class TypeDescriptor
        {
                throw new NotImplementedException ();
        }
-#endif
 
        public static TypeConverter GetConverter (object component)
        {
                return GetConverter (component, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static TypeConverter GetConverter (object component, bool noCustomTypeDesc)
        {
                if (component == null)
@@ -442,10 +430,8 @@ public sealed class TypeDescriptor
        {
                Type converterType = null;
                if (type != null) {
-#if NET_2_0
                        if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))
                                return typeof(NullableConverter);
-#endif
                        // Is there a default converter
                        foreach (DictionaryEntry entry in DefaultConverters) {
                                if ((Type)entry.Key == type)
@@ -486,9 +472,7 @@ public sealed class TypeDescriptor
                return GetDefaultEvent (component, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static EventDescriptor GetDefaultEvent (object component, bool noCustomTypeDesc)
        {
                if (!noCustomTypeDesc && (component is ICustomTypeDescriptor))
@@ -512,9 +496,7 @@ public sealed class TypeDescriptor
                return GetDefaultProperty (component, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static PropertyDescriptor GetDefaultProperty (object component, bool noCustomTypeDesc)
        {
                if (!noCustomTypeDesc && (component is ICustomTypeDescriptor))
@@ -620,9 +602,7 @@ public sealed class TypeDescriptor
                return GetEditor (component, editorBaseType, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static object GetEditor (object component, Type editorBaseType, bool noCustomTypeDesc)
        {
                if (component == null)
@@ -663,9 +643,7 @@ public sealed class TypeDescriptor
                return GetEvents (component, attributes, false);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static EventDescriptorCollection GetEvents (object component, bool noCustomTypeDesc)
        {
                if (!noCustomTypeDesc && (component is ICustomTypeDescriptor))
@@ -684,9 +662,7 @@ public sealed class TypeDescriptor
                return GetTypeInfo (componentType).GetEvents (attributes);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static EventDescriptorCollection GetEvents (object component, Attribute [] attributes, bool noCustomTypeDesc)
        {
                if (!noCustomTypeDesc && (component is ICustomTypeDescriptor))
@@ -731,9 +707,7 @@ public sealed class TypeDescriptor
                }
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
        public static PropertyDescriptorCollection GetProperties (object component, bool noCustomTypeDesc)
        {
                if (component == null)
@@ -755,7 +729,6 @@ public sealed class TypeDescriptor
                return GetTypeInfo (componentType).GetProperties (attributes);
        }
 
-#if NET_2_0
        [EditorBrowsable (EditorBrowsableState.Advanced)]
        public static TypeDescriptionProvider GetProvider (object instance)
        {
@@ -921,7 +894,6 @@ public sealed class TypeDescriptor
                                        
                } while (true);
        }
-#endif
 
        public static void SortDescriptorArray (IList infos)
        {
@@ -937,10 +909,8 @@ public sealed class TypeDescriptor
                        infos.Add (ob);
        }
 
-#if NET_2_0
        // well, ComObjectType is not implemented, but we don't support COM anyways ...
        [Obsolete ("Use ComObjectType")]
-#endif
        public static IComNativeDescriptorHandler ComNativeDescriptorHandler {
                [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
                get { return descriptorHandler; }
@@ -1032,7 +1002,6 @@ public sealed class TypeDescriptor
                return type;
        }
 
-#if NET_2_0
        sealed class AttributeProvider : TypeDescriptionProvider
        {
                Attribute[] attributes;
@@ -1226,7 +1195,6 @@ public sealed class TypeDescriptor
                        return new DefaultTypeDescriptor (this, objectType, instance);
                }
        }
-#endif
 }
 
        internal abstract class Info
@@ -1491,4 +1459,13 @@ public sealed class TypeDescriptor
                        return _properties;
                }
        }
+
+#if NET_4_0
+       // In .net this class seems to be a dummy and empty class
+       // used to represent internally any extender provider associated with
+       // all the interfaces.
+       sealed class TypeDescriptorInterface
+       {
+       }
+#endif
 }
index d950223ff29382a65528f675a127d82a4fdb40d2..101f6c94d813e7cfa3eac7e08cdc95ad062276b3 100644 (file)
@@ -285,13 +285,13 @@ namespace System {
                        this.isUnixFilePath = baseUri.isUnixFilePath;
                        this.isOpaquePart = baseUri.isOpaquePart;
 
-                       if (relativeUri == String.Empty) {
+                       if (relativeUri.Length == 0) {
                                this.path = baseUri.path;
                                this.query = baseUri.query;
                                this.fragment = baseUri.fragment;
                                return;
                        }
-                       
+
                        // 8 fragment
                        // Note that in relative constructor, file URI cannot handle '#' as a filename character, but just regarded as a fragment identifier.
                        pos = relativeUri.IndexOf ('#');
@@ -300,16 +300,24 @@ namespace System {
                                        fragment = relativeUri.Substring (pos);
                                else
                                        fragment = "#" + EscapeString (relativeUri.Substring (pos+1));
-                               relativeUri = relativeUri.Substring (0, pos);
+                               relativeUri = pos == 0 ? String.Empty : relativeUri.Substring (0, pos);
                        }
 
+                       bool consider_query = false;
+
                        // 6 query
                        pos = relativeUri.IndexOf ('?');
                        if (pos != -1) {
                                query = relativeUri.Substring (pos);
                                if (!userEscaped)
                                        query = EscapeString (query);
-                               relativeUri = relativeUri.Substring (0, pos);
+#if !NET_4_0 && !MOONLIGHT
+                               consider_query = query.Length > 0;
+#endif
+                               relativeUri = pos == 0 ? String.Empty : relativeUri.Substring (0, pos);
+                       } else if (relativeUri.Length == 0) {
+                               // if there is no relative path then we keep the Query and Fragment from the absolute
+                               query = baseUri.query;
                        }
 
                        if (relativeUri.Length > 0 && relativeUri [0] == '/') {
@@ -327,11 +335,7 @@ namespace System {
                        
                        // par 5.2 step 6 a)
                        path = baseUri.path;
-#if NET_4_0
-                       if (relativeUri.Length > 0) {
-#else
-                       if (relativeUri.Length > 0 || query.Length > 0) {
-#endif
+                       if ((relativeUri.Length > 0) || consider_query) {
                                pos = path.LastIndexOf ('/');
                                if (pos >= 0) 
                                        path = path.Substring (0, pos + 1);
@@ -1019,7 +1023,7 @@ namespace System {
                void AppendQueryAndFragment (ref string result)
                {
                        if (query.Length > 0) {
-                               string q = query [0] == '?' ? '?' + Unescape (query.Substring (1), false) : Unescape (query, false);
+                               string q = query [0] == '?' ? '?' + Unescape (query.Substring (1), true) : Unescape (query, false);
                                result += q;
                        }
                        if (fragment.Length > 0)
@@ -1878,6 +1882,10 @@ namespace System {
 
                public bool IsBaseOf (Uri uri)
                {
+#if NET_4_0
+                       if (uri == null)
+                               throw new ArgumentNullException ("uri");
+#endif
                        return Parser.IsBaseOf (this, uri);
                }
 
@@ -2033,6 +2041,12 @@ namespace System {
                //[MonoTODO ("rework code to avoid exception catching")]
                public static bool TryCreate (Uri baseUri, Uri relativeUri, out Uri result)
                {
+#if NET_4_0
+                       if (relativeUri == null) {
+                               result = null;
+                               return false;
+                       }
+#endif
                        try {
                                // FIXME: this should call UriParser.Resolve
                                result = new Uri (baseUri, relativeUri.OriginalString);
index 355f015ba19723e16ae6e88d236aa03edaff9fc5..6d8b74e424d8d581642218ba04333cfca2c68f3c 100644 (file)
@@ -87,7 +87,6 @@ namespace System {
 #endif
                        }
 
-                       Console.WriteLine ("Converting: '{0}' of type '{1}'", value, value.GetType ().Name);
                        if (!CanConvertFrom (context, value.GetType ()))
                                throw new NotSupportedException (Locale.GetText ("Cannot convert from value."));
 
index 884420704b6b27abf33c29d8d05ecec31423b473..532586cba7ce7f8dd709d04047cda8333050ff67 100644 (file)
@@ -152,6 +152,7 @@ System.ComponentModel/SByteConverterTests.cs
 System.ComponentModel/SingleConverterTests.cs
 System.ComponentModel/ToolboxItemAttributeTests.cs
 System.ComponentModel/TypeConverterTests.cs
+System.ComponentModel/TypeDescriptionProviderTest.cs
 System.ComponentModel/TypeDescriptorTests.cs
 System.ComponentModel/UInt16ConverterTests.cs
 System.ComponentModel/UInt32ConverterTests.cs
diff --git a/mcs/class/System/Test/System.ComponentModel/TypeDescriptionProviderTest.cs b/mcs/class/System/Test/System.ComponentModel/TypeDescriptionProviderTest.cs
new file mode 100644 (file)
index 0000000..1c2a1e5
--- /dev/null
@@ -0,0 +1,77 @@
+//
+// TypeDescriptionProviderTest.cs
+//
+// Author:
+//     Carlos Alberto Cortez (calberto.cortez@gmail.com)
+//
+// Copyright (C) 2010 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design.Serialization;
+using System.Globalization;
+using NUnit.Framework;
+
+namespace MonoTests.System.ComponentModel
+{
+       [TestFixture]
+       public class TypeDescriptionProviderTest
+       {
+#if NET_4_0
+               [Test]
+               public void IsSupportedType ()
+               {
+                       CustomDescriptionProvider provider = new CustomDescriptionProvider ();
+                       Assert.IsTrue (provider.IsSupportedType (typeof (string)), "#A1");
+                       Assert.IsTrue (provider.IsSupportedType (typeof (object)), "#A2");
+                       Assert.IsTrue (provider.IsSupportedType (typeof (CustomDescriptionProvider)), "#A3");
+               }
+
+               [Test]
+               public void GetRuntimeType ()
+               {
+                       CustomDescriptionProvider provider = new CustomDescriptionProvider ();
+                       Assert.AreEqual (typeof (CustomDescriptionProvider), provider.GetRuntimeType (typeof (CustomDescriptionProvider)), "#A0");
+                       Assert.AreEqual (typeof (object), provider.GetRuntimeType (typeof (object)), "#A1");
+               }
+
+               [Test]
+               public void GetExtenderProviders ()
+               {
+                       CustomDescriptionProvider provider = new CustomDescriptionProvider ();
+                       IExtenderProvider [] providers = provider.GetExtenderProviders (typeof (object));
+                       Assert.IsNotNull (providers, "#A0");
+                       Assert.AreEqual (0, providers.Length, "#A1");
+               }
+
+               class CustomDescriptionProvider : TypeDescriptionProvider
+               {
+                       public new IExtenderProvider [] GetExtenderProviders (object instance)
+                       {
+                               return base.GetExtenderProviders (instance);
+                       }
+               }
+#endif
+       }
+}
+
index 82ef9917936de2e510b7fb8d27caafe3b9c348a0..7ae9130a028256f3356c79889433e327c05f6a5d 100644 (file)
@@ -14,11 +14,10 @@ using DescriptionAttribute = System.ComponentModel.DescriptionAttribute;
 using System.ComponentModel.Design;
 using System.Globalization;
 
-#if NET_2_0
 using System.Collections.Generic;
-#endif
 
 using NUnit.Framework;
+using System.Reflection;
 
 namespace MonoTests.System.ComponentModel
 {
@@ -460,7 +459,6 @@ namespace MonoTests.System.ComponentModel
                }
        }
 
-#if NET_2_0
        class MyCustomTypeDescriptor : CustomTypeDescriptor
        {
                public MyTypeDescriptionProvider Provider { get; private set; }
@@ -502,7 +500,6 @@ namespace MonoTests.System.ComponentModel
                        return base.CreateInstance (provider, objectType, argTypes, args);
                }
        }
-#endif
 
        [TestFixture]
        public class TypeDescriptorTests
@@ -512,7 +509,6 @@ namespace MonoTests.System.ComponentModel
                MyComponent nfscom = new MyComponent (new NoFilterSite (new MyContainer ()));
                AnotherComponent anothercom = new AnotherComponent ();
                
-#if NET_2_0
                [Test]
                [ExpectedException (typeof (ArgumentNullException))]
                public void TestAddAttributes_Type_Attributes_1 ()
@@ -1054,7 +1050,6 @@ namespace MonoTests.System.ComponentModel
                        Assert.IsNotNull (type, "#F1");
                        Assert.AreEqual (typeof (int), type, "#F1-1");
                }
-#endif
 
                [Test]
                public void TestICustomTypeDescriptor ()
@@ -1185,7 +1180,6 @@ namespace MonoTests.System.ComponentModel
                [Test]
                public void TestGetComponentName ()
                {
-#if NET_2_0
                        // in MS.NET 2.0, GetComponentName no longer returns
                        // the type name if there's no custom typedescriptor
                        // and no site
@@ -1195,14 +1189,6 @@ namespace MonoTests.System.ComponentModel
                        Assert.IsNull (TypeDescriptor.GetComponentName (new Exception (), false), "#4");
                        Assert.IsNull (TypeDescriptor.GetComponentName (typeof (Exception)), "#4");
                        Assert.IsNull (TypeDescriptor.GetComponentName (typeof (Exception), false), "#6");
-#else
-                       Assert.AreEqual ("MyComponent", TypeDescriptor.GetComponentName (com), "#1");
-                       Assert.AreEqual ("MyComponent", TypeDescriptor.GetComponentName (com, false), "#2");
-                       Assert.AreEqual ("Exception", TypeDescriptor.GetComponentName (new Exception ()), "#3");
-                       Assert.AreEqual ("Exception", TypeDescriptor.GetComponentName (new Exception (), false), "#4");
-                       Assert.IsNotNull (TypeDescriptor.GetComponentName (typeof (Exception)), "#5");
-                       Assert.IsNotNull (TypeDescriptor.GetComponentName (typeof (Exception), false), "#6");
-#endif
                        Assert.AreEqual ("TestName", TypeDescriptor.GetComponentName (sitedcom), "#7");
                        Assert.AreEqual ("TestName", TypeDescriptor.GetComponentName (sitedcom), "#8");
                }
@@ -1248,16 +1234,12 @@ namespace MonoTests.System.ComponentModel
                        Assert.AreEqual (typeof (TypeConverter), TypeDescriptor.GetConverter (new TestStruct ()).GetType (), "#26");
                        Assert.AreEqual (typeof (CollectionConverter), TypeDescriptor.GetConverter (new Hashtable ()).GetType (), "#27");
 
-#if NET_2_0
                        // Test from bug #76686
                        Assert.AreEqual  (typeof (Int32Converter), TypeDescriptor.GetConverter ((int?) 1).GetType (), "#28");
-#endif
                        Assert.IsTrue (TypeDescriptor.GetConverter (typeof (Component)) is ComponentConverter, "#29");
                        Assert.IsTrue (TypeDescriptor.GetConverter (new Component()) is ComponentConverter, "#30");
 
-#if NET_2_0
                        Assert.AreEqual (typeof (NullableConverter), TypeDescriptor.GetConverter (typeof (int?)).GetType (), "#31");
-#endif
                }
                
                [Test]
@@ -1278,12 +1260,7 @@ namespace MonoTests.System.ComponentModel
                        Assert.AreEqual ("AnotherEvent", des.Name, "#D2");
 
                        des = TypeDescriptor.GetDefaultEvent (sitedcom);
-#if NET_2_0
                        Assert.IsNull (des, "#E1");
-#else
-                       Assert.IsNotNull (des, "#E1");
-                       Assert.AreEqual ("AnotherEvent", des.Name, "#E2");
-#endif
 
                        des = TypeDescriptor.GetDefaultEvent (new MyComponent(new AnotherSite ()));
                        Assert.IsNotNull (des, "#F1");
@@ -1313,11 +1290,6 @@ namespace MonoTests.System.ComponentModel
                }
                
                [Test]
-#if ONLY_1_1
-               // throws NullReferenceException on MS.NET 1.x due to bug
-               // which is fixed in MS.NET 2.0
-               [NUnit.Framework.Category("NotDotNet")]
-#endif
                public void TestGetDefaultProperty2 ()
                {
                        PropertyDescriptor des = TypeDescriptor.GetDefaultProperty (sitedcom);
@@ -1474,11 +1446,6 @@ namespace MonoTests.System.ComponentModel
                }
 
                [Test]
-#if ONLY_1_1
-               // throws NullReferenceException on MS.NET 1.x due to bug
-               // which is fixed in MS.NET 2.0
-               [NUnit.Framework.Category("NotDotNet")]
-#endif
                public void TestGetProperties2 ()
                {
                        PropertyDescriptorCollection col = TypeDescriptor.GetProperties (sitedcom);
@@ -1492,9 +1459,6 @@ namespace MonoTests.System.ComponentModel
                }
 
                [Test]
-#if ONLY_1_1
-               [NUnit.Framework.Category ("NotDotNet")] // .NET 1.x (or csc 1.x) does not retain the original order
-#endif
                public void GetProperties_Order ()
                {
                        MyComponent com = new MyComponent (new MyContainer ());
@@ -1548,5 +1512,19 @@ namespace MonoTests.System.ComponentModel
                        Assert.AreEqual (1, pc.Count, "#1");
                        Assert.AreEqual ("Length", pc [0].Name, "#2");
                }
+
+#if NET_4_0
+               [Test]
+               public void InterfaceType ()
+               {
+                       Type interface_type = TypeDescriptor.InterfaceType;
+                       Assert.AreEqual ("TypeDescriptorInterface", interface_type.Name, "#A0");
+                       Assert.IsTrue (interface_type.IsClass, "#A1");
+                       Assert.IsTrue (interface_type.IsSealed, "#A2");
+                       Assert.AreEqual (typeof (object), interface_type.BaseType, "#A3");
+                       Assert.IsFalse (interface_type.IsInterface, "#A4");
+                       Assert.IsFalse (interface_type.IsPublic, "#A5");
+               }
+#endif
        }
 }
index 2c9d43cd32a7f3dd2fef231efc678a7c0897aadc..bb243a9268cbc74cc515b127d0d615a47180c489 100644 (file)
@@ -716,8 +716,12 @@ namespace MonoTests.System
                        Uri u1 = new Uri("http://localhost:8080/test.aspx?ReturnUrl=%2fSearchDoc%2fSearcher.aspx");
                        Uri u2 = new Uri("http://localhost:8080/test.aspx?ReturnUrl=%252fSearchDoc%252fSearcher.aspx");
 
-                       Assert.AreEqual (u1.ToString (), "http://localhost:8080/test.aspx?ReturnUrl=/SearchDoc/Searcher.aspx", "QE1");
-                       Assert.AreEqual (u2.ToString (), "http://localhost:8080/test.aspx?ReturnUrl=%2fSearchDoc%2fSearcher.aspx", "QE2");
+                       Assert.AreEqual ("http://localhost:8080/test.aspx?ReturnUrl=/SearchDoc/Searcher.aspx", u1.ToString (), "QE1");
+#if NET_2_0
+                       Assert.AreEqual ("http://localhost:8080/test.aspx?ReturnUrl=%252fSearchDoc%252fSearcher.aspx", u2.ToString (), "QE2");
+#else
+                       Assert.AreEqual ("http://localhost:8080/test.aspx?ReturnUrl=%2fSearchDoc%2fSearcher.aspx", u2.ToString (), "QE2");
+#endif
                }
 
                [Test]
@@ -1786,7 +1790,7 @@ namespace MonoTests.System
                        Assert.IsFalse (fileUri.IsUnc, "LocalPath_FileNameWithAtSign IsUnc");
 
                        Assert.AreEqual (fullpath, fileUri.OriginalString, "LocalPath_FileNameWithAtSign OriginalString");
-                       Assert.AreEqual (path, new DerivedUri (fullpath).TestUnescape(path), "LocalPath_FileNameWithAtSign ProtectedUnescape");
+                       Assert.AreEqual (path, new DerivedUri (fullpath).TestUnescape (path), "LocalPath_FileNameWithAtSign ProtectedUnescape");
                        Assert.AreEqual (path, fileUri.AbsolutePath, "LocalPath_FileNameWithAtSign AbsPath");
                        Assert.AreEqual (path, fileUri.LocalPath, "LocalPath_FileNameWithAtSign LocalPath");
                }
@@ -1833,6 +1837,7 @@ namespace MonoTests.System
                }
 
                [Test]
+               [Category ("NotDotNet")]
                public void UnixAbsoluteFilePath_WithSpecialChars1 ()
                {
                        Uri unixuri = new Uri ("/home/user/a@b");
@@ -1840,6 +1845,7 @@ namespace MonoTests.System
                }
 
                [Test]
+               [Category ("NotDotNet")]
                public void UnixAbsoluteFilePath_WithSpecialChars2 ()
                {
                        Uri unixuri = new Uri ("/home/user/a:b");
@@ -1862,9 +1868,9 @@ namespace MonoTests.System
                        Assert.AreEqual ("http://media.libsyn.com/bounce/http://cdn4.libsyn.com/nerdist/somestuff.txt", uri.ToString ());
                }
 
-               public class DerivedUri : Uri
-               {
-                       public DerivedUri (string uriString) : base (uriString)
+               public class DerivedUri : Uri {
+                       public DerivedUri (string uriString)
+                               : base (uriString)
                        {
                        }
 
index f1d6ed3068cfff1b40d6f304c44a60c1d49650fa..1aa479b2fcfd477c563ee0577a0b4f4c5b2e8b27 100644 (file)
@@ -548,6 +548,111 @@ TextWriter sw = Console.Out;
                        Assert.AreEqual (uri.Port.ToString (), uri.GetComponents (UriComponents.StrongPort, UriFormat.Unescaped), "StrongPort");\r
                        Assert.AreEqual (uri.UserInfo, uri.GetComponents (UriComponents.UserInfo, UriFormat.Unescaped), "UserInfo");\r
                }\r
-#endif\r
+#endif
+
+               [Test]
+               public void Merge_Query_Fragment ()
+               {
+                       Uri absolute = new Uri ("http://host/dir/subdir/weird;name?moonlight");
+                       Assert.AreEqual ("?moonlight", absolute.Query, "absolute.Query");
+
+                       Uri merged = new Uri (absolute, "#mono");
+                       Assert.AreEqual ("#mono", merged.Fragment, "merged.Fragment");
+                       Assert.AreEqual ("?moonlight", merged.Query, "merged.Query");
+                       Assert.AreEqual ("http://host/dir/subdir/weird;name?moonlight#mono", merged.ToString (), "merged.ToString");
+               }
+
+               [Test]
+               public void Merge_Query_Query ()
+               {
+                       Uri absolute = new Uri ("http://host/dir/subdir/weird;name?moonlight");
+                       Assert.AreEqual ("?moonlight", absolute.Query, "absolute.Query");
+
+                       Uri merged = new Uri (absolute, "?moon");
+                       Assert.AreEqual ("?moon", merged.Query, "merged.Query");
+#if NET_4_0
+                       Assert.AreEqual ("http://host/dir/subdir/weird;name?moon", merged.ToString (), "merged.ToString");
+#else
+                       Assert.AreEqual ("http://host/dir/subdir/?moon", merged.ToString (), "merged.ToString");
+#endif
+               }
+
+               [Test]
+               public void Merge_Query_RelativePath ()
+               {
+                       Uri absolute = new Uri ("http://host/dir/subdir/weird;name?moonlight");
+                       Assert.AreEqual ("?moonlight", absolute.Query, "absolute.Query");
+
+                       Uri merged = new Uri (absolute, "../");
+                       Assert.AreEqual (String.Empty, merged.Query, "../Query");
+                       Assert.AreEqual ("http://host/dir/", merged.ToString (), "../ToString");
+
+                       merged = new Uri (absolute, "..");
+                       Assert.AreEqual (String.Empty, merged.Query, "..Query");
+                       Assert.AreEqual ("http://host/dir/", merged.ToString (), "..ToString");
+
+                       merged = new Uri (absolute, "./");
+                       Assert.AreEqual (String.Empty, merged.Query, "./Query");
+                       Assert.AreEqual ("http://host/dir/subdir/", merged.ToString (), "./ToString");
+
+                       merged = new Uri (absolute, ".");
+                       Assert.AreEqual (String.Empty, merged.Query, ".Query");
+                       Assert.AreEqual ("http://host/dir/subdir/", merged.ToString (), ".ToString");
+
+                       merged = new Uri (absolute, "/");
+                       Assert.AreEqual (String.Empty, merged.Query, "/Query");
+                       Assert.AreEqual ("http://host/", merged.ToString (), "/ToString");
+
+                       merged = new Uri (absolute, "index.html");
+                       Assert.AreEqual (String.Empty, merged.Query, "index.html Query");
+                       Assert.AreEqual ("http://host/dir/subdir/index.html", merged.ToString (), "index.html ToString");
+
+                       merged = new Uri (absolute, "i");
+                       Assert.AreEqual (String.Empty, merged.Query, "i Query");
+                       Assert.AreEqual ("http://host/dir/subdir/i", merged.ToString (), "i ToString");
+
+                       merged = new Uri (absolute, String.Empty);
+                       Assert.AreEqual ("?moonlight", merged.Query, "Query");
+                       Assert.AreEqual ("http://host/dir/subdir/weird;name?moonlight", merged.ToString (), "ToString");
+               }
+
+               [Test]
+               public void Merge_Fragment_RelativePath ()
+               {
+                       Uri absolute = new Uri ("http://host/dir/subdir/weird;name#mono");
+                       Assert.AreEqual ("#mono", absolute.Fragment, "absolute.Fragment");
+
+                       Uri merged = new Uri (absolute, "../");
+                       Assert.AreEqual (String.Empty, merged.Fragment, "../Fragment");
+                       Assert.AreEqual ("http://host/dir/", merged.ToString (), "../ToString");
+
+                       merged = new Uri (absolute, "..");
+                       Assert.AreEqual (String.Empty, merged.Fragment, "..Fragment");
+                       Assert.AreEqual ("http://host/dir/", merged.ToString (), "..ToString");
+
+                       merged = new Uri (absolute, "./");
+                       Assert.AreEqual (String.Empty, merged.Fragment, "./Fragment");
+                       Assert.AreEqual ("http://host/dir/subdir/", merged.ToString (), "./ToString");
+
+                       merged = new Uri (absolute, ".");
+                       Assert.AreEqual (String.Empty, merged.Fragment, ".Fragment");
+                       Assert.AreEqual ("http://host/dir/subdir/", merged.ToString (), ".ToString");
+
+                       merged = new Uri (absolute, "/");
+                       Assert.AreEqual (String.Empty, merged.Fragment, "/Fragment");
+                       Assert.AreEqual ("http://host/", merged.ToString (), "/ToString");
+
+                       merged = new Uri (absolute, "index.html");
+                       Assert.AreEqual (String.Empty, merged.Fragment, "index.html Fragment");
+                       Assert.AreEqual ("http://host/dir/subdir/index.html", merged.ToString (), "index.html ToString");
+
+                       merged = new Uri (absolute, "i");
+                       Assert.AreEqual (String.Empty, merged.Fragment, "i Fragment");
+                       Assert.AreEqual ("http://host/dir/subdir/i", merged.ToString (), "i ToString");
+
+                       merged = new Uri (absolute, String.Empty);
+                       Assert.AreEqual ("#mono", merged.Fragment, "Fragment");
+                       Assert.AreEqual ("http://host/dir/subdir/weird;name#mono", merged.ToString (), "ToString");
+               }
        }\r
 }\r
index 98cf9ec63e6fa739aa09b90cf988f8db393538b2..fbde811ac667dd97c11f1a12503ce1d0546f07ee 100644 (file)
@@ -292,8 +292,16 @@ namespace MonoTests.System
                        Uri baseUri = new Uri (absolute);
                        try {
                                Uri.TryCreate (baseUri, (Uri) null, out uri);
-                               Assert.Fail ();
-                       } catch (NullReferenceException) {
+#if NET_4_0
+                               Assert.IsNull (uri);
+#else
+                               Assert.Fail ("throw NRE under FX 2.0");
+#endif
+                       }
+                       catch (NullReferenceException) {
+#if NET_4_0
+                               Assert.Fail ("does not throw NRE under FX 4.0");
+#endif
                        }
                }
 
@@ -410,8 +418,14 @@ namespace MonoTests.System
                        try {
                                http.IsBaseOf (null);
                                Assert.Fail ();
-                       } catch (NullReferenceException) {
                        }
+#if NET_4_0
+                       catch (ArgumentNullException) {
+                       }
+#else
+                       catch (NullReferenceException) {
+                       }
+#endif
                }
 
                [Test] 
@@ -487,8 +501,14 @@ namespace MonoTests.System
                        try {
                                uri.MakeRelativeUri ((Uri) null);
                                Assert.Fail ("#1");
-                       } catch (NullReferenceException) {
                        }
+#if NET_4_0
+                       catch (ArgumentNullException) {
+                       }
+#else
+                       catch (NullReferenceException) {
+                       }
+#endif
                }
 
                [Test] // LAMESPEC: see bug #321113
index 99de11c8e1aa3174e5e6bacc2c884c734b495382..71eb132dbcd9d8c71c1a898e33a8732e28accf10 100644 (file)
@@ -572,7 +572,7 @@ namespace System.Reflection.Emit
                public override Type[] GetGenericArguments ()
                {
                        if (generic_params == null)
-                               return Type.EmptyTypes;
+                               return null;
 
                        Type[] result = new Type [generic_params.Length];
                        for (int i = 0; i < generic_params.Length; i++)
index 3e27b8a56d827204e799e19127fd0859c8f89d51..402631f21e4dbc66f1a8408a6d1fc6a5d55fe854 100644 (file)
@@ -1116,5 +1116,17 @@ namespace MonoTests.System.Reflection.Emit
                        Assert.AreEqual (1, body.LocalVariables.Count);
                        Assert.AreEqual (typeof (object), body.LocalVariables [0].LocalType);
                }
+
+
+               [Test] //#384127
+               public void GetGenericArgumentsReturnsNullForNonGenericMethod ()
+               {
+                       var tb = module.DefineType ("Base");
+       
+                       var mb = tb.DefineMethod ("foo", MethodAttributes.Public, typeof (void), Type.EmptyTypes);
+       
+                       Assert.IsNull (mb.GetGenericArguments ());
+
+               }
        }
 }
index 2bd47b2059b498b83af4d67b84ebaba256d62104..9e70e8c5aec0da235fd4fd3bfa61a499e0eeabeb 100644 (file)
@@ -151,6 +151,12 @@ _wapi_shm_detach (_wapi_shm_t type)
        g_free (wapi_storage [type]);
 }
 
+gboolean
+_wapi_shm_enabled (void)
+{
+       return FALSE;
+}
+
 #else
 /*
  * Use POSIX shared memory if possible, it is simpler, and it has the advantage that 
index f791cb1a9eabd9be7ec6bb84518467e16f157f4a..255f442eeafa995a5d0d5fc73b48d5e179e5aa90 100644 (file)
@@ -130,6 +130,7 @@ static MonoAotModuleInfoTable *aot_modules = NULL;
 static const MonoRuntimeInfo supported_runtimes[] = {
        {"v2.0.50215","2.0", { {2,0,0,0},    {8,0,0,0}, { 3, 5, 0, 0 } }        },
        {"v2.0.50727","2.0", { {2,0,0,0},    {8,0,0,0}, { 3, 5, 0, 0 } }        },
+       {"v4.0.20506","4.0", { {4,0,0,0},    {10,0,0,0}, { 4, 0, 0, 0 } }   },
        {"v4.0.30128","4.0", { {4,0,0,0},    {10,0,0,0}, { 4, 0, 0, 0 } }   },
        {"v4.0.30319","4.0", { {4,0,0,0},    {10,0,0,0}, { 4, 0, 0, 0 } }   },
        {"moonlight", "2.1", { {2,0,5,0},    {9,0,0,0}, { 3, 5, 0, 0 } }    },
index 8999ea43453329996d1a5ccb4c4cf45f13299a74..3408b88879a8451244441a8bb60d12dff0b30bea 100644 (file)
@@ -108,7 +108,7 @@ typedef void (*MonoProfileAssemblyResult) (MonoProfiler *prof, MonoAssembly *ass
 
 typedef void (*MonoProfileMethodInline)   (MonoProfiler *prof, MonoMethod   *parent, MonoMethod *child, int *ok);
 
-typedef void (*MonoProfileThreadFunc)     (MonoProfiler *prof, intptr_t tid);
+typedef void (*MonoProfileThreadFunc)     (MonoProfiler *prof, uintptr_t tid);
 typedef void (*MonoProfileAllocFunc)      (MonoProfiler *prof, MonoObject *obj, MonoClass *klass);
 typedef void (*MonoProfileStatFunc)       (MonoProfiler *prof, mono_byte *ip, void *context);
 typedef void (*MonoProfileStatCallChainFunc) (MonoProfiler *prof, int call_chain_depth, mono_byte **ip, void *context);
index c553f5931a97c87b57cccb84c4a4a7740e2ac59a..8f44be37ab6eb096fab214c0392b6fbcf56d41e7 100644 (file)
@@ -186,7 +186,7 @@ card_table_clear (void)
 {
        /*XXX we could do this in 2 ways. using mincore or iterating over all sections/los objects */
        if (use_cardtable) {
-               major.iterate_live_block_ranges (clear_cards);
+               major_collector.iterate_live_block_ranges (clear_cards);
                los_iterate_live_block_ranges (clear_cards);
        }
 }
@@ -196,13 +196,13 @@ scan_from_card_tables (void *start_nursery, void *end_nursery, GrayQueue *queue)
        if (use_cardtable) {
 #ifdef SGEN_HAVE_OVERLAPPING_CARDS
        /*First we copy*/
-       major.iterate_live_block_ranges (move_cards_to_shadow_table);
+       major_collector.iterate_live_block_ranges (move_cards_to_shadow_table);
        los_iterate_live_block_ranges (move_cards_to_shadow_table);
 
        /*Then we clear*/
        card_table_clear ();
 #endif
-               major.scan_card_table (queue);
+               major_collector.scan_card_table (queue);
                los_scan_card_table (queue);
        }
 }
@@ -288,14 +288,14 @@ sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards, SgenGrayQu
                        elem = (char*)mono_array_addr_with_size ((MonoArray*)obj, size, index);
                        if (klass->element_class->valuetype) {
                                while (elem < card_end) {
-                                       major.minor_scan_vtype (elem, desc, nursery_start, nursery_next, queue);
+                                       major_collector.minor_scan_vtype (elem, desc, nursery_start, nursery_next, queue);
                                        elem += size;
                                }
                        } else {
                                while (elem < card_end) {
                                        gpointer new, old = *(gpointer*)elem;
                                        if (old) {
-                                               major.copy_object ((void**)elem, queue);
+                                               major_collector.copy_object ((void**)elem, queue);
                                                new = *(gpointer*)elem;
                                                if (G_UNLIKELY (ptr_in_nursery (new)))
                                                        mono_sgen_add_to_global_remset (elem);
@@ -307,9 +307,9 @@ sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards, SgenGrayQu
        } else {
                if (cards) {
                        if (sgen_card_table_is_range_marked (cards, obj_size))
-                               major.minor_scan_object (obj, queue);
+                               major_collector.minor_scan_object (obj, queue);
                } else if (sgen_card_table_region_begin_scanning ((mword)obj, obj_size)) {
-                       major.minor_scan_object (obj, queue);
+                       major_collector.minor_scan_object (obj, queue);
                }
        }
 }
@@ -349,10 +349,10 @@ card_tables_collect_starts (gboolean begin)
 #ifdef CARDTABLE_STATS
        if (begin) {
                total_cards = marked_cards = remarked_cards = 0;
-               major.iterate_live_block_ranges (count_marked_cards);
+               major_collector.iterate_live_block_ranges (count_marked_cards);
                los_iterate_live_block_ranges (count_marked_cards);
        } else {
-               major.iterate_live_block_ranges (count_marked_cards);
+               major_collector.iterate_live_block_ranges (count_marked_cards);
                los_iterate_live_block_ranges (count_remarked_cards);
                printf ("cards total %d marked %d remarked %d\n", total_cards, marked_cards, remarked_cards);
        }
index 2fa56062fce467f8eab216cfde07bca4a8b16cc1..51a5d5e53fef9808dfbf19d0f9dda1698cedb7f3 100644 (file)
@@ -776,7 +776,7 @@ static int mark_ephemerons_in_range (CopyOrMarkObjectFunc copy_func, char *start
 static void clear_unreachable_ephemerons (CopyOrMarkObjectFunc copy_func, char *start, char *end, GrayQueue *queue);
 static void null_ephemerons_for_domain (MonoDomain *domain);
 
-SgenMajorCollector major;
+SgenMajorCollector major_collector;
 
 #include "sgen-protocol.c"
 #include "sgen-pinning.c"
@@ -1223,7 +1223,7 @@ mono_gc_scan_for_specific_ref (MonoObject *key)
        mono_sgen_scan_area_with_callback (nursery_section->data, nursery_section->end_data,
                        (IterateObjectCallbackFunc)scan_object_for_specific_ref_callback, key);
 
-       major.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)scan_object_for_specific_ref_callback, key);
+       major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)scan_object_for_specific_ref_callback, key);
 
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next)
                scan_object_for_specific_ref (bigobj->data, key);
@@ -1366,7 +1366,7 @@ check_for_xdomain_refs (void)
        mono_sgen_scan_area_with_callback (nursery_section->data, nursery_section->end_data,
                        (IterateObjectCallbackFunc)scan_object_for_xdomain_refs, NULL);
 
-       major.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)scan_object_for_xdomain_refs, NULL);
+       major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)scan_object_for_xdomain_refs, NULL);
 
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next)
                scan_object_for_xdomain_refs (bigobj->data, bigobj->size, NULL);
@@ -1406,14 +1406,14 @@ static void
 clear_domain_free_major_non_pinned_object_callback (char *obj, size_t size, MonoDomain *domain)
 {
        if (need_remove_object_for_domain (obj, domain))
-               major.free_non_pinned_object (obj, size);
+               major_collector.free_non_pinned_object (obj, size);
 }
 
 static void
 clear_domain_free_major_pinned_object_callback (char *obj, size_t size, MonoDomain *domain)
 {
        if (need_remove_object_for_domain (obj, domain))
-               major.free_pinned_object (obj, size);
+               major_collector.free_pinned_object (obj, size);
 }
 
 /*
@@ -1458,7 +1458,7 @@ mono_gc_clear_domain (MonoDomain * domain)
           objects with major-mark&sweep), but we might need to
           dereference a pointer from an object to another object if
           the first object is a proxy. */
-       major.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)clear_domain_process_major_object_callback, domain);
+       major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)clear_domain_process_major_object_callback, domain);
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next)
                clear_domain_process_object (bigobj->data, domain);
 
@@ -1479,8 +1479,8 @@ mono_gc_clear_domain (MonoDomain * domain)
                prev = bigobj;
                bigobj = bigobj->next;
        }
-       major.iterate_objects (TRUE, FALSE, (IterateObjectCallbackFunc)clear_domain_free_major_non_pinned_object_callback, domain);
-       major.iterate_objects (FALSE, TRUE, (IterateObjectCallbackFunc)clear_domain_free_major_pinned_object_callback, domain);
+       major_collector.iterate_objects (TRUE, FALSE, (IterateObjectCallbackFunc)clear_domain_free_major_non_pinned_object_callback, domain);
+       major_collector.iterate_objects (FALSE, TRUE, (IterateObjectCallbackFunc)clear_domain_free_major_pinned_object_callback, domain);
 
        UNLOCK_GC;
 }
@@ -1549,7 +1549,7 @@ mono_sgen_add_to_global_remset (gpointer ptr)
 
        g_assert (!ptr_in_nursery (ptr) && ptr_in_nursery (*(gpointer*)ptr));
 
-       lock = (current_collection_generation == GENERATION_OLD && major.is_parallel);
+       lock = (current_collection_generation == GENERATION_OLD && major_collector.is_parallel);
        if (lock)
                LOCK_GLOBAL_REMSET;
 
@@ -1606,10 +1606,10 @@ drain_gray_stack (GrayQueue *queue)
                        if (!obj)
                                break;
                        DEBUG (9, fprintf (gc_debug_file, "Precise gray object scan %p (%s)\n", obj, safe_name (obj)));
-                       major.minor_scan_object (obj, queue);
+                       major_collector.minor_scan_object (obj, queue);
                }
        } else {
-               if (major.is_parallel && queue == &workers_distribute_gray_queue)
+               if (major_collector.is_parallel && queue == &workers_distribute_gray_queue)
                        return;
 
                for (;;) {
@@ -1617,7 +1617,7 @@ drain_gray_stack (GrayQueue *queue)
                        if (!obj)
                                break;
                        DEBUG (9, fprintf (gc_debug_file, "Precise gray object scan %p (%s)\n", obj, safe_name (obj)));
-                       major.major_scan_object (obj, queue);
+                       major_collector.major_scan_object (obj, queue);
                }
        }
 }
@@ -2053,9 +2053,9 @@ alloc_nursery (void)
        g_assert (nursery_size == DEFAULT_NURSERY_SIZE);
        alloc_size = nursery_size;
 #ifdef SGEN_ALIGN_NURSERY
-       data = major.alloc_heap (alloc_size, alloc_size, DEFAULT_NURSERY_BITS);
+       data = major_collector.alloc_heap (alloc_size, alloc_size, DEFAULT_NURSERY_BITS);
 #else
-       data = major.alloc_heap (alloc_size, 0, DEFAULT_NURSERY_BITS);
+       data = major_collector.alloc_heap (alloc_size, 0, DEFAULT_NURSERY_BITS);
 #endif
        nursery_start = data;
        nursery_real_end = nursery_start + nursery_size;
@@ -2176,7 +2176,7 @@ finish_gray_stack (char *start_addr, char *end_addr, int generation, GrayQueue *
        TV_DECLARE (btv);
        int fin_ready;
        int ephemeron_rounds = 0;
-       CopyOrMarkObjectFunc copy_func = current_collection_generation == GENERATION_NURSERY ? major.copy_object : major.copy_or_mark_object;
+       CopyOrMarkObjectFunc copy_func = current_collection_generation == GENERATION_NURSERY ? major_collector.copy_object : major_collector.copy_or_mark_object;
 
        /*
         * We copied all the reachable objects. Now it's the time to copy
@@ -2274,7 +2274,7 @@ check_scan_starts (void)
        if (!do_scan_starts_check)
                return;
        mono_sgen_check_section_scan_starts (nursery_section);
-       major.check_scan_starts ();
+       major_collector.check_scan_starts ();
 }
 
 static int last_num_pinned = 0;
@@ -2454,7 +2454,7 @@ dump_heap (const char *type, int num, const char *reason)
 
        mono_sgen_dump_section (nursery_section, "nursery");
 
-       major.dump_heap (heap_dump_file);
+       major_collector.dump_heap (heap_dump_file);
 
        fprintf (heap_dump_file, "<los>\n");
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next)
@@ -2470,7 +2470,7 @@ mono_sgen_register_moved_object (void *obj, void *destination)
        g_assert (mono_profiler_events & MONO_PROFILE_GC_MOVES);
 
        /* FIXME: handle this for parallel collector */
-       g_assert (!major.is_parallel);
+       g_assert (!major_collector.is_parallel);
 
        if (moved_objects_idx == MOVED_OBJECTS_NUM) {
                mono_profiler_gc_moves (moved_objects, moved_objects_idx);
@@ -2562,7 +2562,7 @@ static gboolean
 need_major_collection (void)
 {
        mword los_alloced = los_memory_usage - MIN (last_los_memory_usage, los_memory_usage);
-       return minor_collection_sections_alloced * major.section_size + los_alloced > minor_collection_allowance;
+       return minor_collection_sections_alloced * major_collector.section_size + los_alloced > minor_collection_allowance;
 }
 
 /*
@@ -2609,7 +2609,7 @@ collect_nursery (size_t requested_size)
 
        nursery_section->next_data = nursery_next;
 
-       major.start_nursery_collection ();
+       major_collector.start_nursery_collection ();
 
        gray_object_queue_init (&gray_queue, mono_sgen_get_unmanaged_allocator ());
 
@@ -2658,8 +2658,8 @@ collect_nursery (size_t requested_size)
        TV_GETTIME (atv);
        time_minor_scan_pinned += TV_ELAPSED_MS (btv, atv);
        /* registered roots, this includes static fields */
-       scan_from_registered_roots (major.copy_object, nursery_start, nursery_next, ROOT_TYPE_NORMAL, &gray_queue);
-       scan_from_registered_roots (major.copy_object, nursery_start, nursery_next, ROOT_TYPE_WBARRIER, &gray_queue);
+       scan_from_registered_roots (major_collector.copy_object, nursery_start, nursery_next, ROOT_TYPE_NORMAL, &gray_queue);
+       scan_from_registered_roots (major_collector.copy_object, nursery_start, nursery_next, ROOT_TYPE_WBARRIER, &gray_queue);
        TV_GETTIME (btv);
        time_minor_scan_registered_roots += TV_ELAPSED_MS (atv, btv);
        /* thread data */
@@ -2684,7 +2684,7 @@ collect_nursery (size_t requested_size)
        if (consistency_check_at_minor_collection)
                check_major_refs ();
 
-       major.finish_nursery_collection ();
+       major_collector.finish_nursery_collection ();
 
        TV_GETTIME (all_btv);
        mono_stats.minor_gc_time_usecs += TV_ELAPSED (all_atv, all_btv);
@@ -2728,7 +2728,7 @@ major_do_collection (const char *reason)
         */
        char *heap_start = NULL;
        char *heap_end = (char*)-1;
-       int old_num_major_sections = major.get_num_major_sections ();
+       int old_num_major_sections = major_collector.get_num_major_sections ();
        int num_major_sections, num_major_sections_saved, save_target, allowance_target;
        mword los_memory_saved, los_memory_alloced, old_los_memory_usage;
 
@@ -2745,7 +2745,7 @@ major_do_collection (const char *reason)
        binary_protocol_collection (GENERATION_OLD);
        check_scan_starts ();
        gray_object_queue_init (&gray_queue, mono_sgen_get_unmanaged_allocator ());
-       if (major.is_parallel)
+       if (major_collector.is_parallel)
                gray_object_queue_init (&workers_distribute_gray_queue, mono_sgen_get_unmanaged_allocator ());
 
        degraded_mode = 0;
@@ -2797,7 +2797,7 @@ major_do_collection (const char *reason)
        DEBUG (6, fprintf (gc_debug_file, "Pinning from sections\n"));
        /* first pass for the sections */
        mono_sgen_find_section_pin_queue_start_end (nursery_section);
-       major.find_pin_queue_start_ends (WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       major_collector.find_pin_queue_start_ends (WORKERS_DISTRIBUTE_GRAY_QUEUE);
        /* identify possible pointers to the insize of large objects */
        DEBUG (6, fprintf (gc_debug_file, "Pinning from large objects\n"));
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next) {
@@ -2813,14 +2813,14 @@ major_do_collection (const char *reason)
        }
        /* second pass for the sections */
        mono_sgen_pin_objects_in_section (nursery_section, WORKERS_DISTRIBUTE_GRAY_QUEUE);
-       major.pin_objects (WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       major_collector.pin_objects (WORKERS_DISTRIBUTE_GRAY_QUEUE);
 
        TV_GETTIME (btv);
        time_major_pinning += TV_ELAPSED_MS (atv, btv);
        DEBUG (2, fprintf (gc_debug_file, "Finding pinned pointers: %d in %d usecs\n", next_pin_slot, TV_ELAPSED (atv, btv)));
        DEBUG (4, fprintf (gc_debug_file, "Start scan with %d pinned objects\n", next_pin_slot));
 
-       major.init_to_space ();
+       major_collector.init_to_space ();
 
        workers_start_all_workers (1);
 
@@ -2828,8 +2828,8 @@ major_do_collection (const char *reason)
        time_major_scan_pinned += TV_ELAPSED_MS (btv, atv);
 
        /* registered roots, this includes static fields */
-       scan_from_registered_roots (major.copy_or_mark_object, heap_start, heap_end, ROOT_TYPE_NORMAL, WORKERS_DISTRIBUTE_GRAY_QUEUE);
-       scan_from_registered_roots (major.copy_or_mark_object, heap_start, heap_end, ROOT_TYPE_WBARRIER, WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       scan_from_registered_roots (major_collector.copy_or_mark_object, heap_start, heap_end, ROOT_TYPE_NORMAL, WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       scan_from_registered_roots (major_collector.copy_or_mark_object, heap_start, heap_end, ROOT_TYPE_WBARRIER, WORKERS_DISTRIBUTE_GRAY_QUEUE);
        TV_GETTIME (btv);
        time_major_scan_registered_roots += TV_ELAPSED_MS (atv, btv);
 
@@ -2844,8 +2844,8 @@ major_do_collection (const char *reason)
        time_major_scan_alloc_pinned += TV_ELAPSED_MS (atv, btv);
 
        /* scan the list of objects ready for finalization */
-       scan_finalizer_entries (major.copy_or_mark_object, fin_ready_list, WORKERS_DISTRIBUTE_GRAY_QUEUE);
-       scan_finalizer_entries (major.copy_or_mark_object, critical_fin_list, WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       scan_finalizer_entries (major_collector.copy_or_mark_object, fin_ready_list, WORKERS_DISTRIBUTE_GRAY_QUEUE);
+       scan_finalizer_entries (major_collector.copy_or_mark_object, critical_fin_list, WORKERS_DISTRIBUTE_GRAY_QUEUE);
        TV_GETTIME (atv);
        time_major_scan_finalized += TV_ELAPSED_MS (btv, atv);
        DEBUG (2, fprintf (gc_debug_file, "Root scan: %d usecs\n", TV_ELAPSED (btv, atv)));
@@ -2853,7 +2853,7 @@ major_do_collection (const char *reason)
        TV_GETTIME (btv);
        time_major_scan_big_objects += TV_ELAPSED_MS (atv, btv);
 
-       if (major.is_parallel) {
+       if (major_collector.is_parallel) {
                while (!gray_object_queue_is_empty (WORKERS_DISTRIBUTE_GRAY_QUEUE)) {
                        workers_distribute_gray_queue_sections ();
                        usleep (2000);
@@ -2862,7 +2862,7 @@ major_do_collection (const char *reason)
        workers_change_num_working (-1);
        workers_join ();
 
-       if (major.is_parallel)
+       if (major_collector.is_parallel)
                g_assert (gray_object_queue_is_empty (&gray_queue));
 
        /* all the objects in the heap */
@@ -2899,7 +2899,7 @@ major_do_collection (const char *reason)
        TV_GETTIME (atv);
        time_major_los_sweep += TV_ELAPSED_MS (btv, atv);
 
-       major.sweep ();
+       major_collector.sweep ();
 
        TV_GETTIME (btv);
        time_major_sweep += TV_ELAPSED_MS (atv, btv);
@@ -2929,12 +2929,12 @@ major_do_collection (const char *reason)
 
        g_assert (gray_object_queue_is_empty (&gray_queue));
 
-       num_major_sections = major.get_num_major_sections ();
+       num_major_sections = major_collector.get_num_major_sections ();
 
        num_major_sections_saved = MAX (old_num_major_sections - num_major_sections, 0);
        los_memory_saved = MAX (old_los_memory_usage - los_memory_usage, 1);
 
-       save_target = ((num_major_sections * major.section_size) + los_memory_saved) / 2;
+       save_target = ((num_major_sections * major_collector.section_size) + los_memory_saved) / 2;
        /*
         * We aim to allow the allocation of as many sections as is
         * necessary to reclaim save_target sections in the next
@@ -2950,14 +2950,14 @@ major_do_collection (const char *reason)
         *
         * hence:
         */
-       allowance_target = (mword)((double)save_target * (double)(minor_collection_sections_alloced * major.section_size + los_memory_alloced) / (double)(num_major_sections_saved * major.section_size + los_memory_saved));
+       allowance_target = (mword)((double)save_target * (double)(minor_collection_sections_alloced * major_collector.section_size + los_memory_alloced) / (double)(num_major_sections_saved * major_collector.section_size + los_memory_saved));
 
-       minor_collection_allowance = MAX (MIN (allowance_target, num_major_sections * major.section_size + los_memory_usage), MIN_MINOR_COLLECTION_ALLOWANCE);
+       minor_collection_allowance = MAX (MIN (allowance_target, num_major_sections * major_collector.section_size + los_memory_usage), MIN_MINOR_COLLECTION_ALLOWANCE);
 
        minor_collection_sections_alloced = 0;
        last_los_memory_usage = los_memory_usage;
 
-       major.finish_major_collection ();
+       major_collector.finish_major_collection ();
 
        check_scan_starts ();
 
@@ -3029,7 +3029,7 @@ report_internal_mem_usage (void)
        printf ("Internal memory usage:\n");
        mono_sgen_report_internal_mem_usage ();
        printf ("Pinned memory usage:\n");
-       major.report_pinned_memory_usage ();
+       major_collector.report_pinned_memory_usage ();
 }
 
 /*
@@ -3175,7 +3175,7 @@ alloc_degraded (MonoVTable *vtable, size_t size)
        }
 
        degraded_mode += size;
-       return major.alloc_degraded (vtable, size);
+       return major_collector.alloc_degraded (vtable, size);
 }
 
 /*
@@ -3515,7 +3515,7 @@ mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size)
                p = alloc_large_inner (vtable, size);
        } else {
                DEBUG (9, g_assert (vtable->klass->inited));
-               p = major.alloc_small_pinned_obj (size, vtable->klass->has_references);
+               p = major_collector.alloc_small_pinned_obj (size, vtable->klass->has_references);
        }
        DEBUG (6, fprintf (gc_debug_file, "Allocated pinned object %p, vtable: %p (%s), size: %zd\n", p, vtable, vtable->klass->name, size));
        binary_protocol_alloc_pinned (p, vtable, size);
@@ -3612,7 +3612,7 @@ finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int g
        for (i = 0; i < finalizable_hash_size; ++i) {
                prev = NULL;
                for (entry = finalizable_hash [i]; entry;) {
-                       if ((char*)entry->object >= start && (char*)entry->object < end && !major.is_object_live (entry->object)) {
+                       if ((char*)entry->object >= start && (char*)entry->object < end && !major_collector.is_object_live (entry->object)) {
                                gboolean is_fin_ready = object_is_fin_ready (entry->object);
                                char *copy = entry->object;
                                copy_func ((void**)&copy, queue);
@@ -3679,7 +3679,7 @@ object_is_reachable (char *object, char *start, char *end)
        /*This happens for non nursery objects during minor collections. We just treat all objects as alive.*/
        if (object < start || object >= end)
                return TRUE;
-       return !object_is_fin_ready (object) || major.is_object_live (object);
+       return !object_is_fin_ready (object) || major_collector.is_object_live (object);
 }
 
 /* LOCKING: requires that the GC lock is held */
@@ -3856,7 +3856,7 @@ null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int
                prev = NULL;
                for (entry = disappearing_link_hash [i]; entry;) {
                        char *object = DISLINK_OBJECT (entry);
-                       if (object >= start && object < end && !major.is_object_live (object)) {
+                       if (object >= start && object < end && !major_collector.is_object_live (object)) {
                                gboolean track = DISLINK_TRACK (entry);
                                if (!track && object_is_fin_ready (object)) {
                                        void **p = entry->link;
@@ -4589,12 +4589,11 @@ suspend_handler (int sig, siginfo_t *siginfo, void *context)
        int old_errno = errno;
        gpointer regs [ARCH_NUM_REGS];
        gpointer stack_start;
-       ucontext_t *ctx = (ucontext_t*)context;
 
        id = pthread_self ();
        info = mono_sgen_thread_info_lookup (id);
        info->stopped_domain = mono_domain_get ();
-       info->stopped_ip = (gpointer) ARCH_SIGCTX_IP (ctx);
+       info->stopped_ip = (gpointer) ARCH_SIGCTX_IP (context);
        stop_count = global_stop_count;
        /* duplicate signal */
        if (0 && info->stop_count == stop_count) {
@@ -4605,13 +4604,13 @@ suspend_handler (int sig, siginfo_t *siginfo, void *context)
        /* update the remset info in the thread data structure */
        info->remset = remembered_set;
 #endif
-       stack_start = (char*) ARCH_SIGCTX_SP (ctx) - REDZONE_SIZE;
+       stack_start = (char*) ARCH_SIGCTX_SP (context) - REDZONE_SIZE;
        /* If stack_start is not within the limits, then don't set it
           in info and we will be restarted. */
        if (stack_start >= info->stack_start_limit && info->stack_start <= info->stack_end) {
                info->stack_start = stack_start;
 
-               ARCH_COPY_SIGCTX_REGS (regs, ctx);
+               ARCH_COPY_SIGCTX_REGS (regs, context);
                info->stopped_regs = regs;
        } else {
                g_assert (!info->stack_start);
@@ -4619,7 +4618,7 @@ suspend_handler (int sig, siginfo_t *siginfo, void *context)
 
        /* Notify the JIT */
        if (gc_callbacks.thread_suspend_func)
-               gc_callbacks.thread_suspend_func (info->runtime_data, ctx);
+               gc_callbacks.thread_suspend_func (info->runtime_data, context);
 
        DEBUG (4, fprintf (gc_debug_file, "Posting suspend_ack_semaphore for suspend from %p %p\n", info, (gpointer)ARCH_GET_THREAD ()));
        /* notify the waiting thread */
@@ -4748,9 +4747,9 @@ mono_gc_scan_object (void *obj)
 {
        g_assert_not_reached ();
        if (current_collection_generation == GENERATION_NURSERY)
-               major.copy_object (&obj, &gray_queue);
+               major_collector.copy_object (&obj, &gray_queue);
        else
-               major.copy_or_mark_object (&obj, &gray_queue);
+               major_collector.copy_or_mark_object (&obj, &gray_queue);
        return obj;
 }
 
@@ -4839,7 +4838,7 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                //__builtin_prefetch (ptr);
                if (((void*)ptr < start_nursery || (void*)ptr >= end_nursery)) {
                        gpointer old = *ptr;
-                       major.copy_object (ptr, queue);
+                       major_collector.copy_object (ptr, queue);
                        DEBUG (9, fprintf (gc_debug_file, "Overwrote remset at %p with %p\n", ptr, *ptr));
                        if (old)
                                binary_protocol_ptr_update (ptr, old, *ptr, (gpointer)LOAD_VTABLE (*ptr), safe_object_get_size (*ptr));
@@ -4861,7 +4860,7 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                        return p + 2;
                count = p [1];
                while (count-- > 0) {
-                       major.copy_object (ptr, queue);
+                       major_collector.copy_object (ptr, queue);
                        DEBUG (9, fprintf (gc_debug_file, "Overwrote remset at %p with %p (count: %d)\n", ptr, *ptr, (int)count));
                        if (!global && *ptr >= start_nursery && *ptr < end_nursery)
                                mono_sgen_add_to_global_remset (ptr);
@@ -4872,7 +4871,7 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                ptr = (void**)(*p & ~REMSET_TYPE_MASK);
                if (((void*)ptr >= start_nursery && (void*)ptr < end_nursery))
                        return p + 1;
-               major.minor_scan_object ((char*)ptr, queue);
+               major_collector.minor_scan_object ((char*)ptr, queue);
                return p + 1;
        case REMSET_VTYPE: {
                ptr = (void**)(*p & ~REMSET_TYPE_MASK);
@@ -4881,7 +4880,7 @@ handle_remset (mword *p, void *start_nursery, void *end_nursery, gboolean global
                desc = p [1];
                count = p [2];
                while (count-- > 0)
-                       ptr = (void**) major.minor_scan_vtype ((char*)ptr, desc, start_nursery, end_nursery, queue);
+                       ptr = (void**) major_collector.minor_scan_vtype ((char*)ptr, desc, start_nursery, end_nursery, queue);
                return p + 3;
        }
        default:
@@ -5617,7 +5616,7 @@ find_object_for_ptr (char *ptr)
         * be called from gdb, so we don't care.
         */
        found_obj = NULL;
-       major.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)find_object_for_ptr_callback, ptr);
+       major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)find_object_for_ptr_callback, ptr);
        return found_obj;
 }
 
@@ -5837,9 +5836,9 @@ describe_ptr (char *ptr)
        if (ptr_in_nursery (ptr)) {
                printf ("Pointer inside nursery.\n");
        } else {
-               if (major.ptr_is_in_non_pinned_space (ptr)) {
+               if (major_collector.ptr_is_in_non_pinned_space (ptr)) {
                        printf ("Pointer inside oldspace.\n");
-               } else if (major.obj_is_from_pinned_alloc (ptr)) {
+               } else if (major_collector.obj_is_from_pinned_alloc (ptr)) {
                        printf ("Pointer is inside a pinned chunk.\n");
                } else {
                        printf ("Pointer unknown.\n");
@@ -6044,7 +6043,7 @@ check_consistency (void)
        DEBUG (1, fprintf (gc_debug_file, "Begin heap consistency check...\n"));
 
        // Check that oldspace->newspace pointers are registered with the collector
-       major.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_consistency_callback, NULL);
+       major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_consistency_callback, NULL);
 
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next)
                check_consistency_callback (bigobj->data, bigobj->size, NULL);
@@ -6076,7 +6075,7 @@ check_major_refs (void)
 {
        LOSObject *bigobj;
 
-       major.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_major_refs_callback, NULL);
+       major_collector.iterate_objects (TRUE, TRUE, (IterateObjectCallbackFunc)check_major_refs_callback, NULL);
 
        for (bigobj = los_object_list; bigobj; bigobj = bigobj->next)
                check_major_refs_callback (bigobj->data, bigobj->size, NULL);
@@ -6146,7 +6145,7 @@ mono_gc_get_used_size (void)
        LOCK_GC;
        tot = los_memory_usage;
        tot += nursery_section->next_data - nursery_section->data;
-       tot += major.get_used_size ();
+       tot += major_collector.get_used_size ();
        /* FIXME: account for pinned objects */
        UNLOCK_GC;
        return tot;
@@ -6357,7 +6356,7 @@ mono_gc_base_init (void)
 {
        char *env;
        char **opts, **ptr;
-       char *major_collector = NULL;
+       char *major_collector_opt = NULL;
        struct sigaction sinfo;
 
        /* the gc_initialized guard seems to imply this method is
@@ -6382,7 +6381,7 @@ mono_gc_base_init (void)
                        char *opt = *ptr;
                        if (g_str_has_prefix (opt, "major=")) {
                                opt = strchr (opt, '=') + 1;
-                               major_collector = g_strdup (opt);
+                               major_collector_opt = g_strdup (opt);
                        }
                }
        } else {
@@ -6402,25 +6401,25 @@ mono_gc_base_init (void)
        mono_sgen_register_fixed_internal_mem_type (INTERNAL_MEM_STORE_REMSET, sizeof (GenericStoreRememberedSet));
        mono_sgen_register_fixed_internal_mem_type (INTERNAL_MEM_EPHEMERON_LINK, sizeof (EphemeronLinkNode));
 
-       if (!major_collector || !strcmp (major_collector, "marksweep")) {
-               mono_sgen_marksweep_init (&major);
-       } else if (!major_collector || !strcmp (major_collector, "marksweep-fixed")) {
-               mono_sgen_marksweep_fixed_init (&major);
-       } else if (!major_collector || !strcmp (major_collector, "marksweep-par")) {
-               mono_sgen_marksweep_par_init (&major);
+       if (!major_collector_opt || !strcmp (major_collector_opt, "marksweep")) {
+               mono_sgen_marksweep_init (&major_collector);
+       } else if (!major_collector_opt || !strcmp (major_collector_opt, "marksweep-fixed")) {
+               mono_sgen_marksweep_fixed_init (&major_collector);
+       } else if (!major_collector_opt || !strcmp (major_collector_opt, "marksweep-par")) {
+               mono_sgen_marksweep_par_init (&major_collector);
                workers_init (mono_cpu_count ());
-       } else if (!major_collector || !strcmp (major_collector, "marksweep-fixed-par")) {
-               mono_sgen_marksweep_fixed_par_init (&major);
+       } else if (!major_collector_opt || !strcmp (major_collector_opt, "marksweep-fixed-par")) {
+               mono_sgen_marksweep_fixed_par_init (&major_collector);
                workers_init (mono_cpu_count ());
-       } else if (!strcmp (major_collector, "copying")) {
-               mono_sgen_copying_init (&major);
+       } else if (!strcmp (major_collector_opt, "copying")) {
+               mono_sgen_copying_init (&major_collector);
        } else {
-               fprintf (stderr, "Unknown major collector `%s'.\n", major_collector);
+               fprintf (stderr, "Unknown major collector `%s'.\n", major_collector_opt);
                exit (1);
        }
 
 #ifdef SGEN_HAVE_CARDTABLE
-       use_cardtable = major.supports_cardtable;
+       use_cardtable = major_collector.supports_cardtable;
 #else
        use_cardtable = FALSE;
 #endif
@@ -6436,7 +6435,7 @@ mono_gc_base_init (void)
                                        use_cardtable = FALSE;
                                } else if (strcmp (opt, "cardtable") == 0) {
                                        if (!use_cardtable) {
-                                               if (major.supports_cardtable)
+                                               if (major_collector.supports_cardtable)
                                                        fprintf (stderr, "The cardtable write barrier is not supported on this platform.\n");
                                                else
                                                        fprintf (stderr, "The major collector does not support the cardtable write barrier.\n");
@@ -6468,21 +6467,21 @@ mono_gc_base_init (void)
                                continue;
                        }
 #endif
-                       if (!(major.handle_gc_param && major.handle_gc_param (opt))) {
+                       if (!(major_collector.handle_gc_param && major_collector.handle_gc_param (opt))) {
                                fprintf (stderr, "MONO_GC_PARAMS must be a comma-delimited list of one or more of the following:\n");
                                fprintf (stderr, "  nursery-size=N (where N is an integer, possibly with a k, m or a g suffix)\n");
                                fprintf (stderr, "  major=COLLECTOR (where COLLECTOR is `marksweep', `marksweep-par' or `copying')\n");
                                fprintf (stderr, "  wbarrier=WBARRIER (where WBARRIER is `remset' or `cardtable')\n");
-                               if (major.print_gc_param_usage)
-                                       major.print_gc_param_usage ();
+                               if (major_collector.print_gc_param_usage)
+                                       major_collector.print_gc_param_usage ();
                                exit (1);
                        }
                }
                g_strfreev (opts);
        }
 
-       if (major_collector)
-               g_free (major_collector);
+       if (major_collector_opt)
+               g_free (major_collector_opt);
 
        nursery_size = DEFAULT_NURSERY_SIZE;
        minor_collection_allowance = MIN_MINOR_COLLECTION_ALLOWANCE;
index 1c56fbaa4f3c27d0361447efb73d59b094c43151..bdc6242ca75bd271a29cc31e3e400943f8ba73ea 100644 (file)
@@ -40,7 +40,7 @@ static int workers_num_working;
 
 static GrayQueue workers_distribute_gray_queue;
 
-#define WORKERS_DISTRIBUTE_GRAY_QUEUE (major.is_parallel ? &workers_distribute_gray_queue : &gray_queue)
+#define WORKERS_DISTRIBUTE_GRAY_QUEUE (major_collector.is_parallel ? &workers_distribute_gray_queue : &gray_queue)
 
 /*
  * Must be a power of 2.  It seems that larger values don't help much.
@@ -148,7 +148,7 @@ workers_change_num_working (int delta)
 {
        int old, new;
 
-       if (!major.is_parallel)
+       if (!major_collector.is_parallel)
                return -1;
 
        do {
@@ -209,7 +209,7 @@ workers_thread_func (void *data_untyped)
 static void
 workers_distribute_gray_queue_sections (void)
 {
-       if (!major.is_parallel)
+       if (!major_collector.is_parallel)
                return;
 
        workers_gray_queue_share_redirect (&workers_distribute_gray_queue);
@@ -220,7 +220,7 @@ workers_init (int num_workers)
 {
        int i;
 
-       if (!major.is_parallel)
+       if (!major_collector.is_parallel)
                return;
 
        //g_print ("initing %d workers\n", num_workers);
@@ -274,7 +274,7 @@ workers_start_all_workers (int num_additional_workers)
 {
        int i;
 
-       if (!major.is_parallel)
+       if (!major_collector.is_parallel)
                return;
 
        g_assert (workers_num_working == 0);
@@ -289,7 +289,7 @@ workers_join (void)
 {
        int i;
 
-       if (!major.is_parallel)
+       if (!major_collector.is_parallel)
                return;
 
        //g_print ("joining\n");
@@ -313,7 +313,7 @@ mono_sgen_is_worker_thread (pthread_t thread)
 {
        int i;
 
-       if (!major.is_parallel)
+       if (!major_collector.is_parallel)
                return FALSE;
 
        for (i = 0; i < workers_num; ++i) {
index e344637b2cde3e759d37fc603f045623496a4634..fab21288a592e4d00dfb6d4ab314fe1a2f637081 100644 (file)
@@ -4663,10 +4663,11 @@ mono_method_verify (MonoMethod *method, int level)
        g_assert (bb);
 
        while (ip < end && ctx.valid) {
+               int op_size;
                ip_offset = ip - code_start;
                {
                        const unsigned char *ip_copy = ip;
-                       int size, op;
+                       int op;
 
                        if (ip_offset > bb->end) {
                                ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Branch or EH block at [0x%04x] targets middle instruction at 0x%04x", bb->end, ip_offset));
@@ -4676,29 +4677,22 @@ mono_method_verify (MonoMethod *method, int level)
                        if (ip_offset == bb->end)
                                bb = bb->next;
        
-                       size = mono_opcode_value_and_size (&ip_copy, end, &op);
-                       if (size == -1) {
+                       op_size = mono_opcode_value_and_size (&ip_copy, end, &op);
+                       if (op_size == -1) {
                                ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Invalid instruction %x at 0x%04x", *ip, ip_offset));
                                goto cleanup;
                        }
 
-                       if (ADD_IS_GREATER_OR_OVF (ip_offset, size, bb->end)) {
+                       if (ADD_IS_GREATER_OR_OVF (ip_offset, op_size, bb->end)) {
                                ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Branch or EH block targets middle of instruction at 0x%04x", ip_offset));
                                goto cleanup;
                        }
 
                        /*Last Instruction*/
-                       if (ip_offset + size == bb->end && mono_opcode_is_prefix (op)) {
+                       if (ip_offset + op_size == bb->end && mono_opcode_is_prefix (op)) {
                                ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Branch or EH block targets between prefix '%s' and instruction at 0x%04x", mono_opcode_name (op), ip_offset));
                                goto cleanup;
                        }
-
-                       if (bb->dead) {
-                               /*FIXME remove this once we move all bad branch checking code to use BB only*/
-                               ctx.code [ip_offset].flags |= IL_CODE_FLAG_SEEN;
-                               ip += size;
-                               continue;
-                       }
                }
 
                ctx.ip_offset = ip_offset = ip - code_start;
@@ -4740,6 +4734,14 @@ mono_method_verify (MonoMethod *method, int level)
                        }
                }
 
+               /*This must be done after fallthru detection otherwise it won't happen.*/
+               if (bb->dead) {
+                       /*FIXME remove this once we move all bad branch checking code to use BB only*/
+                       ctx.code [ip_offset].flags |= IL_CODE_FLAG_SEEN;
+                       ip += op_size;
+                       continue;
+               }
+
                if (!ctx.valid)
                        break;
 
index 89bba205cb3c7cbbe358427873433a53b46bdc26..e9b1078bc3810f1d8c58ae2956455abde696a132 100644 (file)
@@ -585,9 +585,9 @@ static void runtime_initialized (MonoProfiler *prof);
 
 static void runtime_shutdown (MonoProfiler *prof);
 
-static void thread_startup (MonoProfiler *prof, intptr_t tid);
+static void thread_startup (MonoProfiler *prof, uintptr_t tid);
 
-static void thread_end (MonoProfiler *prof, intptr_t tid);
+static void thread_end (MonoProfiler *prof, uintptr_t tid);
 
 static void appdomain_load (MonoProfiler *prof, MonoDomain *domain, int result);
 
@@ -2840,7 +2840,7 @@ runtime_shutdown (MonoProfiler *prof)
 }
 
 static void
-thread_startup (MonoProfiler *prof, intptr_t tid)
+thread_startup (MonoProfiler *prof, uintptr_t tid)
 {
        MonoInternalThread *thread = mono_thread_internal_current ();
        MonoInternalThread *old_thread;
@@ -2902,7 +2902,7 @@ thread_startup (MonoProfiler *prof, intptr_t tid)
 }
 
 static void
-thread_end (MonoProfiler *prof, intptr_t tid)
+thread_end (MonoProfiler *prof, uintptr_t tid)
 {
        MonoInternalThread *thread;
        DebuggerTlsData *tls = NULL;
index f359d4ad65399f57ac6089982ed9503139b722ef..cffa3ccfb77fede63b29c3da9879624a5708626f 100644 (file)
@@ -1,31 +1,59 @@
-.assembly 'invalid_fallout_of_finally_block'
+.assembly extern mscorlib
 {
+  .ver 2:0:0:0
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'bug'
+{
+  .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() =  (
+               01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
+               63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01       ) // ceptionThrows.
+
   .hash algorithm 0x00008004
   .ver  0:0:0:0
 }
+.module bug.exe // GUID = {7CDDF4B6-7581-4902-9709-6155199DC325}
 
-.method public static int32 Main() cil managed
+
+.class private auto ansi beforefieldinit Program extends [mscorlib]System.Object
 {
-       .entrypoint
-       .maxstack 8
-       .locals init (int32 V0)
+       .method public static hidebysig default void __Main ()  cil managed 
+    {
+       //.entrypoint
+       .maxstack 2
+       ret
+       }
 
-BB_00:
-               newobj instance void class [mscorlib]System.Exception::.ctor()
-               throw
-               leave END
-BB_01:
 
-BB_02:
+       .method public static default void Main ()  cil managed 
+    {
+               .entrypoint
+               .maxstack 2
+               .locals init (int32 loc0)
+        
                nop
                nop
-BB_03:
-
+               ldc.i4.0
+               stloc.0
+               
+               .try {
+                       nop
+                       ldc.i4.0
+                       brfalse ELSE
+                       leave END
+ELSE:
+                       nop
+                       leave END
+               } finally {\r
+                       nop
+                       //endfinally
+               }
+END0:
+               endfinally
+               nop
 END:
-       ldc.i4.0
-       ret
-
-.try BB_00 to BB_01 finally handler BB_02 to BB_03
-
+               ret 
+    }
 
 }
+
index 5c8a57a450a18a26fabc1fa62ad82fd927b5388c..8a0d52c50a1af02a4100fadbf8b693ecc23c91b9 100644 (file)
        #define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->uc_mcontext.__gregs [_REG_EDI])
        #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.__gregs [_REG_EIP])
 #elif defined(__OpenBSD__)
-       #define UCONTEXT_REG_EAX(ctx) ((ctx)->sc_eax)
-       #define UCONTEXT_REG_EBX(ctx) ((ctx)->sc_ebx)
-       #define UCONTEXT_REG_ECX(ctx) ((ctx)->sc_ecx)
-       #define UCONTEXT_REG_EDX(ctx) ((ctx)->sc_edx)
-       #define UCONTEXT_REG_EBP(ctx) ((ctx)->sc_ebp)
-       #define UCONTEXT_REG_ESP(ctx) ((ctx)->sc_esp)
-       #define UCONTEXT_REG_ESI(ctx) ((ctx)->sc_esi)
-       #define UCONTEXT_REG_EDI(ctx) ((ctx)->sc_edi)
-       #define UCONTEXT_REG_EIP(ctx) ((ctx)->sc_eip)
+    #define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->sc_eax)
+       #define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->sc_ebx)
+       #define UCONTEXT_REG_ECX(ctx) (((ucontext_t*)(ctx))->sc_ecx)
+       #define UCONTEXT_REG_EDX(ctx) (((ucontext_t*)(ctx))->sc_edx)
+       #define UCONTEXT_REG_EBP(ctx) (((ucontext_t*)(ctx))->sc_ebp)
+       #define UCONTEXT_REG_ESP(ctx) (((ucontext_t*)(ctx))->sc_esp)
+       #define UCONTEXT_REG_ESI(ctx) (((ucontext_t*)(ctx))->sc_esi)
+       #define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->sc_edi)
+       #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->sc_eip)
 #else
        #define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EAX])
        #define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EBX])
 #define UCONTEXT_GREGS(ctx)    ((guint64*)&(((ucontext_t*)(ctx))->uc_mcontext))
 #elif defined(__OpenBSD__)
     /* OpenBSD/amd64 has no gregs array, ucontext_t == sigcontext */
-       #define UCONTEXT_REG_RAX(ctx) ((ctx)->sc_rax)
-       #define UCONTEXT_REG_RBX(ctx) ((ctx)->sc_rbx)
-       #define UCONTEXT_REG_RCX(ctx) ((ctx)->sc_rcx)
-       #define UCONTEXT_REG_RDX(ctx) ((ctx)->sc_rdx)
-       #define UCONTEXT_REG_RBP(ctx) ((ctx)->sc_rbp)
-       #define UCONTEXT_REG_RSP(ctx) ((ctx)->sc_rsp)
-       #define UCONTEXT_REG_RSI(ctx) ((ctx)->sc_rsi)
-       #define UCONTEXT_REG_RDI(ctx) ((ctx)->sc_rdi)
-       #define UCONTEXT_REG_RIP(ctx) ((ctx)->sc_rip)
-       #define UCONTEXT_REG_R8(ctx) ((ctx)->sc_r8)
-       #define UCONTEXT_REG_R9(ctx) ((ctx)->sc_r9)
-       #define UCONTEXT_REG_R10(ctx) ((ctx)->sc_r10)
-       #define UCONTEXT_REG_R11(ctx) ((ctx)->sc_r11)
-       #define UCONTEXT_REG_R12(ctx) ((ctx)->sc_r12)
-       #define UCONTEXT_REG_R13(ctx) ((ctx)->sc_r13)
-       #define UCONTEXT_REG_R14(ctx) ((ctx)->sc_r14)
-       #define UCONTEXT_REG_R15(ctx) ((ctx)->sc_r15)
+       #define UCONTEXT_REG_RAX(ctx) (((ucontext_t*)(ctx))->sc_rax)
+       #define UCONTEXT_REG_RCX(ctx) (((ucontext_t*)(ctx))->sc_rcx)
+       #define UCONTEXT_REG_RCX(ctx) (((ucontext_t*)(ctx))->sc_rcx)
+       #define UCONTEXT_REG_RDX(ctx) (((ucontext_t*)(ctx))->sc_rdx)
+       #define UCONTEXT_REG_RBP(ctx) (((ucontext_t*)(ctx))->sc_rbp)
+       #define UCONTEXT_REG_RSP(ctx) (((ucontext_t*)(ctx))->sc_rsp)
+       #define UCONTEXT_REG_RSI(ctx) (((ucontext_t*)(ctx))->sc_rsi)
+       #define UCONTEXT_REG_RDI(ctx) (((ucontext_t*)(ctx))->sc_rdi)
+       #define UCONTEXT_REG_RIP(ctx) (((ucontext_t*)(ctx))->sc_rip)
+       #define UCONTEXT_REG_R8(ctx) (((ucontext_t*)(ctx))->sc_r8)
+       #define UCONTEXT_REG_R9(ctx) (((ucontext_t*)(ctx))->sc_r9)
+       #define UCONTEXT_REG_R10(ctx) (((ucontext_t*)(ctx))->sc_r10)
+       #define UCONTEXT_REG_R11(ctx) (((ucontext_t*)(ctx))->sc_r11)
+       #define UCONTEXT_REG_R12(ctx) (((ucontext_t*)(ctx))->sc_r12)
+       #define UCONTEXT_REG_R13(ctx) (((ucontext_t*)(ctx))->sc_r13)
+       #define UCONTEXT_REG_R14(ctx) (((ucontext_t*)(ctx))->sc_r14)
+       #define UCONTEXT_REG_R15(ctx) (((ucontext_t*)(ctx))->sc_r15)
 #else
 #define UCONTEXT_GREGS(ctx)    ((guint64*)&(((ucontext_t*)(ctx))->uc_mcontext.gregs))
 #endif