Compare commits

...
29 Commits
Author SHA1 Message Date
Sebastien Pouliot 751e0fa359 Merge branch 'mono-4.0.0-branch-c5sr4' into xcode7-c5 2015-09-14 09:04:35 -04:00
Rolf Bjarne Kvinge 07e600d669 [mono-api-html] Adding members to an interface is a breaking change, so show it in red. 2015-09-09 11:04:52 -04:00
Rolf Bjarne Kvinge bcb86f00d6 [mono-api-info] Sort constructors using full signature.
So that info files can be compared textually to test for api equality.
2015-09-09 11:02:34 -04:00
Rolf Bjarne Kvinge 72ebbaf68c [mono-api-html] Fix printing of Obsolete attributes. 2015-09-08 20:43:20 -04:00
Rolf Bjarne Kvinge 71a247b91b [mono-api-info] Sort nested types.
So that info files can be compared textually to test for api equality.
2015-09-08 20:43:09 -04:00
Rolf Bjarne Kvinge 594e8fd07c [mono-api-info] Sort methods using full signature.
So that info files can be compared textually to test for api equality.
2015-09-08 20:43:01 -04:00
Rolf Bjarne Kvinge 616caad4e2 [mdbrebase] Make sure to use a unique temporary filename.
Otherwise parallel invocations might end up stomping on eachother
(these two files are processed in parallel):

    Processing /work/maccore/master/maccore/builds/install/mac/xammac/bcl/mscorlib.dll.mdb
    Processing /work/maccore/master/maccore/builds/install/mac/net_4_5/bcl/mscorlib.dll.mdb

    Unhandled Exception:
    System.IO.FileNotFoundException: /var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb does not exist
    File name: '/var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb'
      at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.MdbRebase.RewriteMdbFile (System.String inputFile) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
    [ERROR] FATAL UNHANDLED EXCEPTION: System.IO.FileNotFoundException: /var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb does not exist
    File name: '/var/folders/g9/k5kx4z211ld_lwlbfxv5rq040000gn/T/mscorlib.dll.mdb'
      at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.MdbRebase.RewriteMdbFile (System.String inputFile) [0x00000] in <filename unknown>:0
      at Mono.MdbRebase.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
2015-08-24 19:43:10 -04:00
Rolf Bjarne Kvinge e36b27c948 [mdbrebase] Add a quiet mode. 2015-08-24 19:42:56 -04:00
Rolf Bjarne Kvinge 31a1ccaab9 [mdbrebase] Indent properly. 2015-08-24 19:42:43 -04:00
Sebastien Pouliot 08f9819131 [tests] iOS9 (beta) have fixed bug #27864, adjust test 2015-08-24 19:12:09 -04:00
Sebastien Pouliot 2bb3416919 [linker] Fix comparison of methods wrt generic parameters [#30488]
The check from [1] is fine when it's done once _or_ with an identical
target. However there's nothing to ensure (if done more than once) that
it's being used to represent the same thing every time.

That makes the code from [1] match methods like:

> System.IObservable`1<TResult> System.Reactive.Linq.IQueryLanguage::Repeat(TResult)

and

> System.IObservable`1<TSource> System.Reactive.Linq.QueryLanguage::Repeat(System.IObservable`1<TSource>)

where `TResult` is different in both checks.

This patch tracks what is used as the generic parameter (on first check)
and make sure it's identical if it's used again in the same signature.

Note: this is a very old bug (i.e. it's always been that way) but recent
changes to mono started to report such issues (a good thing) and, for AOT
compilation on XI, that resulted in MT3001 errors.

[1] https://github.com/mono/mono/blob/mono-3.10.0/mcs/tools/linker/Mono.Linker.Steps/TypeMapStep.cs#L250
2015-08-24 19:11:44 -04:00
Sebastien Pouliot 721a8021ef [linker] Add Mono.Cecil.*.Has* checks when comparing methods/types
* It reduce memory allocations by avoiding the creation of empty
  collections (only used to tell us there's a Count of 0);

* It also speed up execution, less object creation/GC time;

* Patch also remove some double-casts (is + as/cast)
2015-08-24 19:11:40 -04:00
Sebastien Pouliot d2d6def464 [linker] Fix scope resolution of custom attributes (generic/array) argument types that refers to PCL facades [#28823] 2015-08-24 16:25:48 -04:00
Rolf Bjarne Kvinge 46f86234a8 Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build.
We have Facade assemblies that depend on System.Net.Http.dll to exist, so
we can't delay building it (at least one version of it).
2015-08-21 16:30:54 -04:00
Sebastien Pouliot 6d2840038b Revert "Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build."
This reverts commit 6a4a74c828.
2015-08-21 16:26:15 -04:00
Rolf Bjarne Kvinge 6a4a74c828 Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build.
We have Facade assemblies that depend on System.Net.Http.dll to exist, so
we can't delay building it (at least one version of it).
2015-08-21 15:25:38 -04:00
Jo Shields 5ab4c0d099 Bump version for Windows too 2015-08-13 15:59:52 +01:00
Jo Shields 2d1186bac2 Bump version to 4.0.4 2015-08-13 15:41:23 +01:00
Rodrigo Kumpera 30ce4c9549 [utils] Add fallback TLS offset scanning to X86 and AMD64. 2015-08-11 15:12:44 -04:00
Craig S. Bosma 5290633d55 Add TLS offset for pre-release OS X 10.11 x86, as in #1919 for x64 2015-08-11 15:12:29 -04:00
Craig S. Bosma 9253c5aff0 Add TLS offset for pre-release OS X 10.11 on amd64 2015-08-11 15:12:17 -04:00
Marek Safar a3082c6844 [system.net.http] Add special handling for authentication with content (requires content resend) and disabled buffering. Fixes #30869
This is not supported by public HttpWebRequest but HttpClient is running in this mode.
2015-08-03 20:47:16 +02:00
Rodrigo Kumpera 4e06778b2a [mini] Fix locking order violation in mono_get_seq_points.
mono_get_seq_points takes the domain lock then calls mini_get_shared_method.

mini_get_shared_method then calls into general metadata code that eventually take
the loader lock.

The loader lock has precedence over the domain lock.
2015-07-29 15:08:54 -04:00
Rodrigo Kumpera 1f1307e64a [runtime] Fix locking in mono_image_file_for_image. 2015-07-29 15:08:34 -04:00
Zoltan Varga 59c8e3d932 [runtime] Handle generic methods in mono_method_get_vtable_slot (). Fixes #30276. 2015-07-28 17:30:17 -04:00
Zoltan Varga f1f9bc4dd0 [arm] Increase the number of stack args to 10 in the dyn call code. Fixes #31060. 2015-07-28 17:26:56 -04:00
Alexander Köplinger e36169af68 [runtime] Fix "make distcheck"
Use $(srcdir) instead of ./ for commands so the path is correct.
Also added missing files to EXTRA_DIST.
2015-07-20 01:15:11 -04:00
Alexis Christoforides dc9e75e0c6 [System.IO.KeventWatcher] Disable the watcher when the root directory is deleted. Fixes #30043
This matches MS.NET behavior.
2015-07-20 00:34:51 -04:00
Gabriel Garcia 4eac076f94 [System] Fix DeflateStream throw on empty flush, double flush. Fixes #28777.
Back ported from https://github.com/mono/mono/commit/2dcdfe76d02fed91b71e5b49b6028c6c82e10d4c and https://github.com/mono/mono/commit/8c3f126e70c1b005d513e428c5acf6512ce1dfd9.
2015-07-10 13:45:48 +01:00
17 changed files with 309 additions and 220 deletions

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [4.0.3],
AC_INIT(mono, [4.0.4],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
+1 -1
View File
@@ -44,6 +44,7 @@ mobile_common_dirs := \
System.ComponentModel.DataAnnotations \
System.ComponentModel.Composition.4.5 \
System.Net \
System.Net.Http \
System.Windows \
System.Xml.Serialization \
Mono.CSharp \
@@ -57,7 +58,6 @@ mobile_static_dirs := \
mobile_dynamic_dirs := \
$(mobile_common_dirs) \
Mono.CompilerServices.SymbolWriter \
System.Net.Http
xammac_dirs := \
$(mobile_dynamic_dirs)
+3 -5
View File
@@ -92,14 +92,12 @@ namespace MonoTests.Mono.Data.Sqlite {
Assert.AreEqual(dr["Company.Name"], "Test CO");
i += 2;
}
Assert.IsTrue(dr.FieldCount>0);
Assert.IsTrue(dr.FieldCount>0, i.ToString ());
}
if (BCL.Tests.TestRuntime.CheckSystemVersion (8, 2))
Assert.IsTrue (false, "Apple fixed bug 27864, this check can now be removed");
}
} catch (SqliteException ex) {
if (BCL.Tests.TestRuntime.CheckSystemVersion (8, 2)) // Expected Exception on iOS 8.2+, if this does not happen anymore it means apple fixed it
// Expected Exception from iOS 8.2 (broken) to 9.0 (fixed)
if (BCL.Tests.TestRuntime.CheckSystemVersion (8,2) && !BCL.Tests.TestRuntime.CheckSystemVersion (9,0))
Assert.That (ex.Message.Contains ("no such column: com.Name"));
else
throw new AssertionException ("Unexpected Sqlite Error", ex); // This should not happen
@@ -340,6 +340,8 @@ namespace System.Net.Http
wrequest.ContentLength = content.Headers.ContentLength.Value;
}
wrequest.ResendContentFactory = content.CopyTo;
var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false);
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
} else if (HttpMethod.Post.Equals (request.Method) || HttpMethod.Put.Equals (request.Method) || HttpMethod.Delete.Equals (request.Method)) {
@@ -81,6 +81,12 @@ namespace System.Net.Http
}
}
// Only used by HttpWebRequest internals which is not async friendly
internal void CopyTo (Stream stream)
{
CopyToAsync (stream).Wait ();
}
public Task CopyToAsync (Stream stream)
{
return CopyToAsync (stream, null);
@@ -1,54 +0,0 @@
../../build/common/Consts.cs
Assembly/AssemblyInfo.cs
System.Net.Http/ByteArrayContent.cs
System.Net.Http/ClientCertificateOption.cs
System.Net.Http/DelegatingHandler.cs
System.Net.Http/FormUrlEncodedContent.cs
System.Net.Http/HttpClient.cs
System.Net.Http/HttpClientHandler.cs
System.Net.Http/HttpCompletionOption.cs
System.Net.Http/HttpContent.cs
System.Net.Http/HttpMessageHandler.cs
System.Net.Http/HttpMessageInvoker.cs
System.Net.Http/HttpMethod.cs
System.Net.Http/HttpRequestException.cs
System.Net.Http/HttpRequestMessage.cs
System.Net.Http/HttpResponseMessage.cs
System.Net.Http/MessageProcessingHandler.cs
System.Net.Http/MultipartContent.cs
System.Net.Http/MultipartFormDataContent.cs
System.Net.Http/StreamContent.cs
System.Net.Http/StringContent.cs
System.Net.Http.Headers/AuthenticationHeaderValue.cs
System.Net.Http.Headers/CacheControlHeaderValue.cs
System.Net.Http.Headers/CollectionExtensions.cs
System.Net.Http.Headers/CollectionParser.cs
System.Net.Http.Headers/ContentDispositionHeaderValue.cs
System.Net.Http.Headers/ContentRangeHeaderValue.cs
System.Net.Http.Headers/EntityTagHeaderValue.cs
System.Net.Http.Headers/HashCodeCalculator.cs
System.Net.Http.Headers/HeaderInfo.cs
System.Net.Http.Headers/HttpContentHeaders.cs
System.Net.Http.Headers/HttpHeaderKind.cs
System.Net.Http.Headers/HttpHeaders.cs
System.Net.Http.Headers/HttpHeaderValueCollection.cs
System.Net.Http.Headers/HttpRequestHeaders.cs
System.Net.Http.Headers/HttpResponseHeaders.cs
System.Net.Http.Headers/Lexer.cs
System.Net.Http.Headers/MediaTypeHeaderValue.cs
System.Net.Http.Headers/MediaTypeWithQualityHeaderValue.cs
System.Net.Http.Headers/NameValueHeaderValue.cs
System.Net.Http.Headers/NameValueWithParametersHeaderValue.cs
System.Net.Http.Headers/Parser.cs
System.Net.Http.Headers/ProductHeaderValue.cs
System.Net.Http.Headers/ProductInfoHeaderValue.cs
System.Net.Http.Headers/QualityValue.cs
System.Net.Http.Headers/RangeConditionHeaderValue.cs
System.Net.Http.Headers/RangeHeaderValue.cs
System.Net.Http.Headers/RangeItemHeaderValue.cs
System.Net.Http.Headers/RetryConditionHeaderValue.cs
System.Net.Http.Headers/StringWithQualityHeaderValue.cs
System.Net.Http.Headers/TransferCodingHeaderValue.cs
System.Net.Http.Headers/TransferCodingWithQualityHeaderValue.cs
System.Net.Http.Headers/ViaHeaderValue.cs
System.Net.Http.Headers/WarningHeaderValue.cs
+34 -10
View File
@@ -110,6 +110,9 @@ namespace System.Net
AuthorizationState auth_state, proxy_auth_state;
string host;
[NonSerialized]
internal Action<Stream> ResendContentFactory;
// Constructors
static HttpWebRequest ()
{
@@ -226,9 +229,15 @@ namespace System.Net
internal bool InternalAllowBuffering {
get {
return (allowBuffering && (method != "HEAD" && method != "GET" &&
method != "MKCOL" && method != "CONNECT" &&
method != "TRACE"));
return allowBuffering && MethodWithBuffer;
}
}
bool MethodWithBuffer {
get {
return method != "HEAD" && method != "GET" &&
method != "MKCOL" && method != "CONNECT" &&
method != "TRACE";
}
}
@@ -1306,8 +1315,7 @@ namespace System.Net
bodyBuffer = null;
writeStream.Close ();
}
} else if (method != "HEAD" && method != "GET" && method != "MKCOL" && method != "CONNECT" &&
method != "TRACE") {
} else if (MethodWithBuffer) {
if (getResponseCalled && !writeStream.RequestWritten)
return writeStream.WriteRequestAsync (result);
}
@@ -1606,12 +1614,28 @@ namespace System.Net
(ProxyQuery && !proxy_auth_state.IsCompleted && code == HttpStatusCode.ProxyAuthenticationRequired)) {
if (!usedPreAuth && CheckAuthorization (webResponse, code)) {
// Keep the written body, so it can be rewritten in the retry
if (InternalAllowBuffering) {
if (writeStream.WriteBufferLength > 0) {
bodyBuffer = writeStream.WriteBuffer;
bodyBufferLength = writeStream.WriteBufferLength;
if (MethodWithBuffer) {
if (AllowWriteStreamBuffering) {
if (writeStream.WriteBufferLength > 0) {
bodyBuffer = writeStream.WriteBuffer;
bodyBufferLength = writeStream.WriteBufferLength;
}
return true;
}
//
// Buffering is not allowed but we have alternative way to get same content (we
// need to resent it due to NTLM Authentication).
//
if (ResendContentFactory != null) {
using (var ms = new MemoryStream ()) {
ResendContentFactory (ms);
bodyBuffer = ms.ToArray ();
bodyBufferLength = bodyBuffer.Length;
}
return true;
}
return true;
} else if (method != "PUT" && method != "POST") {
bodyBuffer = null;
return true;
@@ -362,6 +362,41 @@ namespace MonoTests.System.IO.Compression
backing.Close();
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
public void CheckBufferOverrun ()
{
byte[] data = new byte [20];
MemoryStream backing = new MemoryStream ();
DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
compressing.Write (data, 0, data.Length + 1);
compressing.Close ();
backing.Close ();
}
[Test]
public void Bug28777_EmptyFlush ()
{
MemoryStream backing = new MemoryStream ();
DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
compressing.Flush ();
compressing.Close ();
backing.Close ();
}
[Test]
public void Bug28777_DoubleFlush ()
{
byte[] buffer = new byte [4096];
MemoryStream backing = new MemoryStream ();
DeflateStream compressing = new DeflateStream (backing, CompressionLevel.Fastest, true);
compressing.Write (buffer, 0, buffer.Length);
compressing.Flush ();
compressing.Flush ();
compressing.Close ();
backing.Close ();
}
}
}
@@ -61,6 +61,16 @@ namespace Xamarin.ApiDiff {
{
}
string GetContainingType (XElement el)
{
return el.Ancestors ("class").First ().Attribute ("type").Value;
}
bool IsInInterface (XElement el)
{
return GetContainingType (el) == "interface";
}
public XElement Source { get; set; }
public virtual bool Find (XElement e)
@@ -182,9 +192,10 @@ namespace Xamarin.ApiDiff {
public virtual void BeforeAdding (IEnumerable<XElement> list)
{
first = true;
Output.WriteLine ("<p>Added {0}:</p><pre>", list.Count () > 1 ? GroupName : ElementName);
if (State.Colorize)
Output.Write ("<font color='green'>");
Output.WriteLine ("<p>Added {0}:</p>", list.Count () > 1 ? GroupName : ElementName);
bool isInterface = list.Count () > 0 && IsInInterface (list.First ());
Output.WriteLine (State.Colorize ? string.Format ("<pre style='color: {0}'>", isInterface ? "red" : "green") : "<pre>");
}
public override void Added (XElement target)
@@ -546,7 +557,7 @@ namespace Xamarin.ApiDiff {
change.Append ("[Obsolete (");
if (tgtObsolete != string.Empty)
change.Append ("\"").Append (tgtObsolete).Append ("\"");
change.Append ("]\n");
change.Append (")]\n");
change.Append (GetDescription (target));
if (State.Colorize)
change.Append ("</font>");
+7 -5
View File
@@ -228,7 +228,7 @@ namespace CorCompare
var typesCollection = ass.MainModule.Types;
if (typesCollection == null || typesCollection.Count == 0)
return;
object [] typesArray = new object [typesCollection.Count];
var typesArray = new TypeDefinition [typesCollection.Count];
for (int i = 0; i < typesCollection.Count; i++) {
typesArray [i] = typesCollection [i];
}
@@ -454,7 +454,7 @@ namespace CorCompare
MethodDefinition [] ctors = GetConstructors (type);
if (ctors.Length > 0) {
Array.Sort (ctors, MemberReferenceComparer.Default);
Array.Sort (ctors, MethodDefinitionComparer.Default);
members.Add (new ConstructorData (document, nclass, ctors));
}
@@ -472,7 +472,7 @@ namespace CorCompare
MethodDefinition [] methods = GetMethods (type);
if (methods.Length > 0) {
Array.Sort (methods, MemberReferenceComparer.Default);
Array.Sort (methods, MethodDefinitionComparer.Default);
members.Add (new MethodData (document, nclass, methods));
}
}
@@ -495,11 +495,13 @@ namespace CorCompare
nested.RemoveAt (i);
}
if (nested.Count > 0) {
var nestedArray = nested.ToArray ();
Array.Sort (nestedArray, TypeReferenceComparer.Default);
XmlNode classes = document.CreateElement ("classes", null);
nclass.AppendChild (classes);
foreach (TypeDefinition t in nested) {
foreach (TypeDefinition t in nestedArray) {
TypeData td = new TypeData (document, classes, t);
td.DoOutput ();
}
+18 -2
View File
@@ -346,9 +346,25 @@ namespace Mono.Linker.Steps {
// even if we (just before saving) will resolve all type references (bug #26752)
void MarkWithResolvedScope (TypeReference type)
{
// we cannot set the Scope of a TypeSpecification so there's no point in resolving it
if ((type == null) || (type is TypeSpecification))
if (type == null)
return;
// a GenericInstanceType can could contains generic arguments with scope that
// needs to be updated out of the PCL facade (bug #28823)
var git = (type as GenericInstanceType);
if ((git != null) && git.HasGenericArguments) {
foreach (var ga in git.GenericArguments)
MarkWithResolvedScope (ga);
return;
}
// we cannot set the Scope of a TypeSpecification but it's element type can be set
// e.g. System.String[] -> System.String
var ts = (type as TypeSpecification);
if (ts != null) {
MarkWithResolvedScope (ts.GetElementType ());
return;
}
var td = type.Resolve ();
if (td != null)
type.Scope = td.Scope;
@@ -179,81 +179,118 @@ namespace Mono.Linker.Steps {
if (!type.HasMethods)
return null;
foreach (MethodDefinition candidate in type.Methods)
if (MethodMatch (candidate, method))
Dictionary<string,string> gp = null;
foreach (MethodDefinition candidate in type.Methods) {
if (MethodMatch (candidate, method, ref gp))
return candidate;
if (gp != null)
gp.Clear ();
}
return null;
}
static bool MethodMatch (MethodDefinition candidate, MethodDefinition method)
static bool MethodMatch (MethodDefinition candidate, MethodDefinition method, ref Dictionary<string,string> genericParameters)
{
if (!candidate.IsVirtual)
return false;
if (candidate.HasParameters != method.HasParameters)
return false;
if (candidate.Name != method.Name)
return false;
if (!TypeMatch (candidate.ReturnType, method.ReturnType))
if (candidate.HasGenericParameters != method.HasGenericParameters)
return false;
if (candidate.Parameters.Count != method.Parameters.Count)
// we need to track what the generic parameter represent - as we cannot allow it to
// differ between the return type or any parameter
if (!TypeMatch (candidate.ReturnType, method.ReturnType, ref genericParameters))
return false;
for (int i = 0; i < candidate.Parameters.Count; i++)
if (!TypeMatch (candidate.Parameters [i].ParameterType, method.Parameters [i].ParameterType))
if (!candidate.HasParameters)
return true;
var cp = candidate.Parameters;
var mp = method.Parameters;
if (cp.Count != mp.Count)
return false;
for (int i = 0; i < cp.Count; i++) {
if (!TypeMatch (cp [i].ParameterType, mp [i].ParameterType, ref genericParameters))
return false;
}
return true;
}
static bool TypeMatch (IModifierType a, IModifierType b)
static bool TypeMatch (IModifierType a, IModifierType b, ref Dictionary<string,string> gp)
{
if (!TypeMatch (a.ModifierType, b.ModifierType))
if (!TypeMatch (a.ModifierType, b.ModifierType, ref gp))
return false;
return TypeMatch (a.ElementType, b.ElementType);
return TypeMatch (a.ElementType, b.ElementType, ref gp);
}
static bool TypeMatch (TypeSpecification a, TypeSpecification b)
static bool TypeMatch (TypeSpecification a, TypeSpecification b, ref Dictionary<string,string> gp)
{
if (a is GenericInstanceType)
return TypeMatch ((GenericInstanceType) a, (GenericInstanceType) b);
var gita = a as GenericInstanceType;
if (gita != null)
return TypeMatch (gita, (GenericInstanceType) b, ref gp);
if (a is IModifierType)
return TypeMatch ((IModifierType) a, (IModifierType) b);
var mta = a as IModifierType;
if (mta != null)
return TypeMatch (mta, (IModifierType) b, ref gp);
return TypeMatch (a.ElementType, b.ElementType);
return TypeMatch (a.ElementType, b.ElementType, ref gp);
}
static bool TypeMatch (GenericInstanceType a, GenericInstanceType b)
static bool TypeMatch (GenericInstanceType a, GenericInstanceType b, ref Dictionary<string,string> gp)
{
if (!TypeMatch (a.ElementType, b.ElementType))
if (!TypeMatch (a.ElementType, b.ElementType, ref gp))
return false;
if (a.GenericArguments.Count != b.GenericArguments.Count)
if (a.HasGenericArguments != b.HasGenericArguments)
return false;
if (a.GenericArguments.Count == 0)
if (!a.HasGenericArguments)
return true;
for (int i = 0; i < a.GenericArguments.Count; i++)
if (!TypeMatch (a.GenericArguments [i], b.GenericArguments [i]))
var gaa = a.GenericArguments;
var gab = b.GenericArguments;
if (gaa.Count != gab.Count)
return false;
for (int i = 0; i < gaa.Count; i++) {
if (!TypeMatch (gaa [i], gab [i], ref gp))
return false;
}
return true;
}
static bool TypeMatch (TypeReference a, TypeReference b)
static bool TypeMatch (TypeReference a, TypeReference b, ref Dictionary<string,string> gp)
{
if (a is GenericParameter)
return true;
var gpa = a as GenericParameter;
if (gpa != null) {
if (gp == null)
gp = new Dictionary<string, string> ();
string match;
if (!gp.TryGetValue (gpa.FullName, out match)) {
// first use, we assume it will always be used this way
gp.Add (gpa.FullName, b.ToString ());
return true;
}
// re-use, it should match the previous usage
return match == b.ToString ();
}
if (a is TypeSpecification || b is TypeSpecification) {
if (a.GetType () != b.GetType ())
return false;
return TypeMatch ((TypeSpecification) a, (TypeSpecification) b);
return TypeMatch ((TypeSpecification) a, (TypeSpecification) b, ref gp);
}
return a.FullName == b.FullName;
+109 -106
View File
@@ -11,130 +11,133 @@ using Mono.Options;
namespace Mono.MdbRebase
{
class Settings
{
public string OutputDirectory { get; set; }
public string InputPattern { get; set; }
public string OutputPattern { get; set; }
public bool InputPatternIsRegex { get; set; }
public bool FileNamesOnly { get; set; }
public bool Verbose { get; set; }
Regex inputPatternRegex;
public bool Validate ()
class Settings
{
return InputPattern != null && OutputPattern != null;
public string OutputDirectory { get; set; }
public string InputPattern { get; set; }
public string OutputPattern { get; set; }
public bool InputPatternIsRegex { get; set; }
public bool FileNamesOnly { get; set; }
public bool Verbose { get; set; }
public bool Quiet { get; set; }
Regex inputPatternRegex;
public bool Validate ()
{
return InputPattern != null && OutputPattern != null;
}
public string Replace (string input)
{
if (InputPatternIsRegex) {
if (inputPatternRegex == null)
inputPatternRegex = new Regex (InputPattern);
return inputPatternRegex.Replace (input, OutputPattern);
} else {
if (input.StartsWith (InputPattern))
return OutputPattern + input.Substring (InputPattern.Length);
}
return input;
}
}
public string Replace (string input)
class MdbRebase
{
if (InputPatternIsRegex) {
if (inputPatternRegex == null)
inputPatternRegex = new Regex (InputPattern);
return inputPatternRegex.Replace (input, OutputPattern);
} else {
if (input.StartsWith (InputPattern))
return OutputPattern + input.Substring (InputPattern.Length);
Settings settings;
public MdbRebase (Settings settings)
{
this.settings = settings;
}
return input;
}
}
public void RewriteMdbFile (string inputFile)
{
if (!settings.Quiet)
Console.WriteLine ("Processing {0}", inputFile);
var input = MonoSymbolFile.ReadSymbolFile (inputFile);
class MdbRebase
{
Settings settings;
var output = new MonoSymbolFile ();
public MdbRebase (Settings settings)
{
this.settings = settings;
}
foreach (var s in input.Sources) {
var newFileName = settings.FileNamesOnly
? Path.Combine (Path.GetDirectoryName (s.FileName), settings.Replace (Path.GetFileName (s.FileName)))
: settings.Replace (s.FileName);
public void RewriteMdbFile (string inputFile)
{
Console.WriteLine ("Processing {0}", inputFile);
var input = MonoSymbolFile.ReadSymbolFile (inputFile);
if (settings.Verbose)
Console.WriteLine ("{0} -> {1}", s.FileName, newFileName);
var output = new MonoSymbolFile ();
s.FileName = newFileName;
output.AddSource (s);
}
foreach (var s in input.Sources) {
var newFileName = settings.FileNamesOnly
? Path.Combine (Path.GetDirectoryName (s.FileName), settings.Replace (Path.GetFileName (s.FileName)))
: settings.Replace (s.FileName);
if (settings.Verbose)
Console.WriteLine ("{0} -> {1}", s.FileName, newFileName);
s.FileName = newFileName;
output.AddSource (s);
}
foreach (var cu in input.CompileUnits) {
cu.ReadAll ();
output.AddCompileUnit (cu);
}
foreach (var m in input.Methods) {
m.ReadAll ();
output.AddMethod (m);
}
var mdbName = new FileInfo (inputFile).Name;
var tmpMdb = Path.Combine (Path.GetTempPath (), mdbName);
var finalMdb = inputFile;
if (settings.OutputDirectory != null)
finalMdb = Path.Combine (settings.OutputDirectory, mdbName);
using (var stream = new FileStream (tmpMdb, FileMode.Create)) {
output.CreateSymbolFile (input.Guid, stream);
}
input.Dispose ();
File.Delete (finalMdb);
File.Move (tmpMdb, finalMdb);
}
}
class Driver {
static void Usage (OptionSet options)
{
Console.WriteLine (@"Usage: mdbrebase [options] <ASSEMBLY_TO_FIX>");
if (options != null) {
Console.WriteLine ();
Console.WriteLine ("Available options:");
options.WriteOptionDescriptions (Console.Out);
}
Console.WriteLine ();
foreach (var cu in input.CompileUnits) {
cu.ReadAll ();
output.AddCompileUnit (cu);
}
Environment.Exit (-1);
foreach (var m in input.Methods) {
m.ReadAll ();
output.AddMethod (m);
}
var mdbName = new FileInfo (inputFile).Name;
var tmpMdb = Path.GetTempFileName ();
var finalMdb = inputFile;
if (settings.OutputDirectory != null)
finalMdb = Path.Combine (settings.OutputDirectory, mdbName);
using (var stream = new FileStream (tmpMdb, FileMode.Create)) {
output.CreateSymbolFile (input.Guid, stream);
}
input.Dispose ();
File.Delete (finalMdb);
File.Move (tmpMdb, finalMdb);
}
}
static int Main (string[] args) {
var s = new Settings ();
bool showHelp = false;
class Driver {
static void Usage (OptionSet options)
{
Console.WriteLine (@"Usage: mdbrebase [options] <ASSEMBLY_TO_FIX>");
if (options != null) {
Console.WriteLine ();
Console.WriteLine ("Available options:");
options.WriteOptionDescriptions (Console.Out);
}
Console.WriteLine ();
Environment.Exit (-1);
}
var p = new OptionSet () {
{ "d=|output=", "Output directory to the mdb file, replace existing one if ommited", v => s.OutputDirectory = v },
{ "v|verbose", "Be verbose with output (show individual path rewrites)", v => s.Verbose = true },
{ "f|filenames", "Only operate on file names, not full absolute paths", v => s.FileNamesOnly = true },
{ "r|regex", "Input pattern is a regular expression", v => s.InputPatternIsRegex = true },
{ "i=|input-pattern=", "Input pattern to replace (must not be a prefix to output-pattern)(required)", v => s.InputPattern = v },
{ "o=|output-pattern=", "Output pattern to replace (required)", v => s.OutputPattern = v },
{ "h|?|help", v => showHelp = true },
};
static int Main (string[] args) {
var s = new Settings ();
bool showHelp = false;
List <string> extra = p.Parse (args);
var p = new OptionSet () {
{ "d=|output=", "Output directory to the mdb file, replace existing one if ommited", v => s.OutputDirectory = v },
{ "v|verbose", "Be verbose with output (show individual path rewrites)", v => s.Verbose = true },
{ "f|filenames", "Only operate on file names, not full absolute paths", v => s.FileNamesOnly = true },
{ "r|regex", "Input pattern is a regular expression", v => s.InputPatternIsRegex = true },
{ "i=|input-pattern=", "Input pattern to replace (must not be a prefix to output-pattern)(required)", v => s.InputPattern = v },
{ "o=|output-pattern=", "Output pattern to replace (required)", v => s.OutputPattern = v },
{ "q|quiet", "Be quiet with output (not show anything but errors)", v => s.Quiet = true },
{ "h|?|help", v => showHelp = true },
};
if (showHelp || extra.Count < 1 || !s.Validate ())
Usage (p);
List <string> extra = p.Parse (args);
var m = new MdbRebase (s);
foreach (var a in extra)
m.RewriteMdbFile (a);
return 0;
if (showHelp || extra.Count < 1 || !s.Validate ())
Usage (p);
var m = new MdbRebase (s);
foreach (var a in extra)
m.RewriteMdbFile (a);
return 0;
}
}
}
}
+3 -2
View File
@@ -2007,6 +2007,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
mono_image_unlock (image);
return image->files [fileidx - 1];
}
mono_image_unlock (image);
fname_id = mono_metadata_decode_row_col (t, fileidx - 1, MONO_FILE_NAME);
fname = mono_metadata_string_heap (image, fname_id);
@@ -2020,7 +2021,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
if (image->files && image->files [fileidx - 1]) {
MonoImage *old = res;
res = image->files [fileidx - 1];
mono_loader_unlock ();
mono_image_unlock (image);
mono_image_close (old);
} else {
int i;
@@ -2034,7 +2035,7 @@ mono_image_load_file_for_image (MonoImage *image, int fileidx)
if (!image->files)
image->files = g_new0 (MonoImage*, t->rows);
image->files [fileidx - 1] = res;
mono_loader_unlock ();
mono_image_unlock (image);
/* vtable fixup can't happen with the image lock held */
#ifdef HOST_WIN32
if (res->is_module_handle)
+8 -2
View File
@@ -398,14 +398,20 @@ MonoSeqPointInfo*
get_seq_points (MonoDomain *domain, MonoMethod *method)
{
MonoSeqPointInfo *seq_points;
MonoMethod *declaring_generic_method = NULL, *shared_method = NULL;
if (method->is_inflated) {
declaring_generic_method = mono_method_get_declaring_generic_method (method);
shared_method = mini_get_shared_method (method);
}
mono_domain_lock (domain);
seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, method);
if (!seq_points && method->is_inflated) {
/* generic sharing + aot */
seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, mono_method_get_declaring_generic_method (method));
seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, declaring_generic_method);
if (!seq_points)
seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, mini_get_shared_method (method));
seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, shared_method);
}
mono_domain_unlock (domain);
+3 -1
View File
@@ -90,6 +90,8 @@ CreateZStream (gint compress, guchar gzip, read_write_func func, void *gchandle)
result->gchandle = gchandle;
result->compress = compress;
result->buffer = g_new (guchar, BUFFER_SIZE);
result->stream->next_out = result->buffer;
result->stream->avail_out = BUFFER_SIZE;
return result;
}
@@ -148,7 +150,7 @@ flush_internal (ZStream *stream, gboolean is_final)
if (!stream->compress)
return 0;
if (!is_final) {
if (!is_final && stream->stream->avail_in != 0) {
status = deflate (stream->stream, Z_PARTIAL_FLUSH);
if (status != Z_OK && status != Z_STREAM_END)
return status;
+1 -1
View File
@@ -642,5 +642,5 @@
/* #undef USE_MONO_MUTEX */
/* Version number of package */
#define VERSION "4.0.3"
#define VERSION "4.0.4"
#endif