* 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,
/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))
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))
static ConfigurationProperty headers;
static ConfigurationProperty identity;
static ConfigurationProperty name;
+#if NET_4_0
+ static ConfigurationProperty endpoint_configuration;
+ static ConfigurationProperty kind;
+#endif
static ChannelEndpointElement ()
{
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);
properties.Add (headers);
properties.Add (identity);
properties.Add (name);
+
+#if NET_4_0
+ properties.Add (endpoint_configuration);
+ properties.Add (kind);
+#endif
}
public ChannelEndpointElement ()
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; }
}
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];
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];
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; }
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 ()
{
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);
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 ()
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)]
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) + ";";
+ }
}
}
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);
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)]
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)
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
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;
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)
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System;
using System.Collections;
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
using System.ComponentModel.Design;
using System.Security.Permissions;
-#if NET_2_0
using System.Collections.Generic;
-#endif
namespace System.ComponentModel
{
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;
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)
{
return instance;
}
-#endif
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
#if !NET_2_1
public
#else
return GetAttributes (component, false);
}
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
public static AttributeCollection GetAttributes (object component, bool noCustomTypeDesc)
{
if (component == null)
return GetClassName (component, false);
}
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
public static string GetClassName (object component, bool noCustomTypeDesc)
{
if (component == null)
return GetComponentName (component, false);
}
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
public static string GetComponentName (object component, bool noCustomTypeDesc)
{
if (component == null)
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)
{
{
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)
{
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)
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))
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))
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)
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))
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))
}
}
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
-#endif
public static PropertyDescriptorCollection GetProperties (object component, bool noCustomTypeDesc)
{
if (component == null)
return GetTypeInfo (componentType).GetProperties (attributes);
}
-#if NET_2_0
[EditorBrowsable (EditorBrowsableState.Advanced)]
public static TypeDescriptionProvider GetProvider (object instance)
{
} while (true);
}
-#endif
public static void SortDescriptorArray (IList infos)
{
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; }
return type;
}
-#if NET_2_0
sealed class AttributeProvider : TypeDescriptionProvider
{
Attribute[] attributes;
return new DefaultTypeDescriptor (this, objectType, instance);
}
}
-#endif
}
internal abstract class Info
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
}
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 ('#');
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] == '/') {
// 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);
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)
public bool IsBaseOf (Uri uri)
{
+#if NET_4_0
+ if (uri == null)
+ throw new ArgumentNullException ("uri");
+#endif
return Parser.IsBaseOf (this, uri);
}
//[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);
#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."));
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
--- /dev/null
+//
+// 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
+ }
+}
+
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
{
}
}
-#if NET_2_0
class MyCustomTypeDescriptor : CustomTypeDescriptor
{
public MyTypeDescriptionProvider Provider { get; private set; }
return base.CreateInstance (provider, objectType, argTypes, args);
}
}
-#endif
[TestFixture]
public class TypeDescriptorTests
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 ()
Assert.IsNotNull (type, "#F1");
Assert.AreEqual (typeof (int), type, "#F1-1");
}
-#endif
[Test]
public void TestICustomTypeDescriptor ()
[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
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");
}
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]
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");
}
[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);
}
[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);
}
[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 ());
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
}
}
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]
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");
}
}
[Test]
+ [Category ("NotDotNet")]
public void UnixAbsoluteFilePath_WithSpecialChars1 ()
{
Uri unixuri = new Uri ("/home/user/a@b");
}
[Test]
+ [Category ("NotDotNet")]
public void UnixAbsoluteFilePath_WithSpecialChars2 ()
{
Uri unixuri = new Uri ("/home/user/a:b");
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)
{
}
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
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
}
}
try {
http.IsBaseOf (null);
Assert.Fail ();
- } catch (NullReferenceException) {
}
+#if NET_4_0
+ catch (ArgumentNullException) {
+ }
+#else
+ catch (NullReferenceException) {
+ }
+#endif
}
[Test]
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
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++)
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 ());
+
+ }
}
}
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
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 } } },
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);
{
/*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);
}
}
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);
}
}
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);
} 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);
}
}
}
#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);
}
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"
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);
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);
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);
}
/*
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);
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;
}
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;
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 (;;) {
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);
}
}
}
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;
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
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;
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)
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);
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;
}
/*
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 ());
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 */
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);
*/
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;
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;
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) {
}
/* 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);
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);
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)));
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);
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 */
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);
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
*
* 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 ();
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 ();
}
/*
}
degraded_mode += size;
- return major.alloc_degraded (vtable, size);
+ return major_collector.alloc_degraded (vtable, 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);
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**)©, queue);
/*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 */
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;
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) {
/* 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);
/* 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 */
{
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;
}
//__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));
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);
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);
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:
* 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;
}
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");
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);
{
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);
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;
{
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
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 {
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
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");
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;
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.
{
int old, new;
- if (!major.is_parallel)
+ if (!major_collector.is_parallel)
return -1;
do {
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);
{
int i;
- if (!major.is_parallel)
+ if (!major_collector.is_parallel)
return;
//g_print ("initing %d workers\n", num_workers);
{
int i;
- if (!major.is_parallel)
+ if (!major_collector.is_parallel)
return;
g_assert (workers_num_working == 0);
{
int i;
- if (!major.is_parallel)
+ if (!major_collector.is_parallel)
return;
//g_print ("joining\n");
{
int i;
- if (!major.is_parallel)
+ if (!major_collector.is_parallel)
return FALSE;
for (i = 0; i < workers_num; ++i) {
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));
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;
}
}
+ /*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;
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);
}
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;
}
static void
-thread_end (MonoProfiler *prof, intptr_t tid)
+thread_end (MonoProfiler *prof, uintptr_t tid)
{
MonoInternalThread *thread;
DebuggerTlsData *tls = NULL;
-.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
+ }
}
+
#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