Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@@ -775,7 +775,7 @@ namespace Mono.Cecil {
}
}
sealed class CustomDebugInformationTable : MetadataTable<CustomDebugInformationRow> {
sealed class CustomDebugInformationTable : SortedTable<CustomDebugInformationRow> {
public override void Write (TableHeapBuffer buffer)
{
@@ -785,6 +785,11 @@ namespace Mono.Cecil {
buffer.WriteBlob (rows [i].Col3); // Value
}
}
public override int Compare (CustomDebugInformationRow x, CustomDebugInformationRow y)
{
return Compare(x.Col1, y.Col1);
}
}
sealed class MetadataBuilder {

View File

@@ -24,6 +24,7 @@ namespace Mono.Cecil {
}
public interface IMetadataImporter {
AssemblyNameReference ImportReference (AssemblyNameReference reference);
TypeReference ImportReference (TypeReference type, IGenericParameterProvider context);
FieldReference ImportReference (FieldReference field, IGenericParameterProvider context);
MethodReference ImportReference (MethodReference method, IGenericParameterProvider context);
@@ -34,6 +35,7 @@ namespace Mono.Cecil {
}
public interface IReflectionImporter {
AssemblyNameReference ImportReference (SR.AssemblyName reference);
TypeReference ImportReference (Type type, IGenericParameterProvider context);
FieldReference ImportReference (SR.FieldInfo field, IGenericParameterProvider context);
MethodReference ImportReference (SR.MethodBase method, IGenericParameterProvider context);
@@ -122,11 +124,11 @@ namespace Mono.Cecil {
}
}
public class ReflectionImporter : IReflectionImporter {
public class DefaultReflectionImporter : IReflectionImporter {
readonly ModuleDefinition module;
readonly protected ModuleDefinition module;
public ReflectionImporter (ModuleDefinition module)
public DefaultReflectionImporter (ModuleDefinition module)
{
Mixin.CheckModule (module);
@@ -294,14 +296,19 @@ namespace Mono.Cecil {
AssemblyNameReference ImportScope (SR.Assembly assembly)
{
AssemblyNameReference scope;
return ImportReference (assembly.GetName ());
}
var name = assembly.GetName ();
public virtual AssemblyNameReference ImportReference (SR.AssemblyName name)
{
Mixin.CheckName (name);
if (TryGetAssemblyNameReference (name, out scope))
return scope;
AssemblyNameReference reference;
if (TryGetAssemblyNameReference (name, out reference))
return reference;
scope = new AssemblyNameReference (name.Name, name.Version) {
reference = new AssemblyNameReference (name.Name, name.Version)
{
PublicKeyToken = name.GetPublicKeyToken (),
#if !NET_CORE
Culture = name.CultureInfo.Name,
@@ -309,9 +316,9 @@ namespace Mono.Cecil {
#endif
};
module.AssemblyReferences.Add (scope);
module.AssemblyReferences.Add (reference);
return scope;
return reference;
}
bool TryGetAssemblyNameReference (SR.AssemblyName name, out AssemblyNameReference assembly_reference)
@@ -477,11 +484,11 @@ namespace Mono.Cecil {
}
}
public class MetadataImporter : IMetadataImporter {
public class DefaultMetadataImporter : IMetadataImporter {
readonly ModuleDefinition module;
readonly protected ModuleDefinition module;
public MetadataImporter (ModuleDefinition module)
public DefaultMetadataImporter (ModuleDefinition module)
{
Mixin.CheckModule (module);
@@ -515,10 +522,10 @@ namespace Mono.Cecil {
{
switch (scope.MetadataScopeType) {
case MetadataScopeType.AssemblyNameReference:
return ImportAssemblyName ((AssemblyNameReference) scope);
return ImportReference ((AssemblyNameReference) scope);
case MetadataScopeType.ModuleDefinition:
if (scope == module) return scope;
return ImportAssemblyName (((ModuleDefinition) scope).Assembly.Name);
return ImportReference (((ModuleDefinition) scope).Assembly.Name);
case MetadataScopeType.ModuleReference:
throw new NotImplementedException ();
}
@@ -526,8 +533,10 @@ namespace Mono.Cecil {
throw new NotSupportedException ();
}
internal virtual AssemblyNameReference ImportAssemblyName (AssemblyNameReference name)
public virtual AssemblyNameReference ImportReference (AssemblyNameReference name)
{
Mixin.CheckName (name);
AssemblyNameReference reference;
if (module.TryGetAssemblyNameReference (name, out reference))
return reference;

View File

@@ -416,6 +416,11 @@ namespace Mono.Cecil {
set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.NoOptimization, value); }
}
public bool AggressiveInlining {
get { return impl_attributes.GetAttributes ((ushort) MethodImplAttributes.AggressiveInlining); }
set { impl_attributes = impl_attributes.SetAttributes ((ushort) MethodImplAttributes.AggressiveInlining, value); }
}
#endregion
#region MethodSemanticsAttributes

View File

@@ -31,5 +31,6 @@ namespace Mono.Cecil {
Synchronized = 0x0020, // Method is single threaded through the body
NoOptimization = 0x0040, // Method is not optimized by the JIT.
NoInlining = 0x0008, // Method may not be inlined
AggressiveInlining = 0x0100, // Method should be inlined, if possible.
}
}

View File

@@ -388,7 +388,7 @@ namespace Mono.Cecil {
internal IReflectionImporter ReflectionImporter {
get {
if (reflection_importer == null)
Interlocked.CompareExchange (ref reflection_importer, new ReflectionImporter (this), null);
Interlocked.CompareExchange (ref reflection_importer, new DefaultReflectionImporter (this), null);
return reflection_importer;
}
@@ -397,13 +397,13 @@ namespace Mono.Cecil {
internal IMetadataImporter MetadataImporter {
get {
if (metadata_importer == null)
Interlocked.CompareExchange (ref metadata_importer, new MetadataImporter (this), null);
Interlocked.CompareExchange (ref metadata_importer, new DefaultMetadataImporter (this), null);
return metadata_importer;
}
}
internal void SetMetadataImporter (MetadataImporter importer)
internal void SetMetadataImporter (IMetadataImporter importer)
{
if (this.metadata_importer != null)
throw new InvalidOperationException ();