Compare commits

..
38 Commits
Author SHA1 Message Date
Alex Corrado 350fcbd003 2.10.5 2011-08-22 19:58:07 -04:00
Jérémie Laval c6799b1f41 Throw when a non-finished task is started 2011-08-20 15:00:24 +02:00
Jérémie Laval f260ff4299 Make TaskCompletionSource methods thread-safe
Conflicts:

	mcs/class/corlib/System.Threading.Tasks/TaskCompletionSource.cs
2011-08-20 14:54:28 +02:00
Rodrigo Kumpera 7122b78d60 Fix sgen-arm-mach. It requires some #define juggling.
.
2011-08-19 20:36:39 -03:00
Rodrigo Kumpera 52971cce4c Fix variance test involving nullable types.
* class.c (mono_class_is_variant_compatible): Reject valuetypes
	if not the same straight away. This fixes testing IEnumerable<int?>
	with IEnumerable<int>.

	Fixes bxc #185
2011-08-19 19:32:48 -03:00
Rodrigo Kumpera 5dc77749e7 Correctly calculate the size of the freed array buffer.
* sgen-bridge.c (dyn_array_ensure_capacity): We must correctly
	calculate the size as our allocator asserts when we do it with
	very large allocs.
2011-08-19 02:06:24 -03:00
Rodrigo Kumpera 472b3e6fca Fix android's broken pthread_kill under sgen. 2011-08-18 14:02:26 -03:00
Alan McGovern 59b4c5bc3d [LinkedList] Optimise Clear slightly. 2011-08-18 16:06:27 +01:00
Alan McGovern f105c6d4e7 Merge pull request #161 from LogosBible/master
Fix bug #311: On LinkedList.Clear, detach each node instead of dropping them en masse.
2011-08-18 16:06:10 +01:00
Zoltan Varga 2e637c4cba Disable some failing LLVM passes. Should fix bxc #280. 2011-08-18 17:00:34 +02:00
Jérémie Laval 8d44e61042 Fix coding style 2011-08-17 20:02:02 +02:00
Sebastien Pouliot eac9866b2c Provide an error message if an instance method is decorated with [MonoPInvokeCallback]. Ease finding issues like bug #296 2011-08-17 10:49:30 -04:00
Alan McGovern 7ada4aec7b [System.IO.Packaging] Fix calling convention related issues
The P/Invokes should be Cdecl as the library is compiled with that
calling convention. The delegates passed to native code must also
be marshalled as Cdecl. Fixes BXC #223.
2011-08-17 12:50:23 +01:00
Miguel de Icaza dacb11a24c updated copyrights 2011-08-17 01:26:05 -04:00
Miguel de Icaza 5c44041365 More updates 2011-08-17 01:21:40 -04:00
Rodrigo Kumpera 56b901df8f Fix g_log redirection under android. 2011-08-16 16:30:06 -03:00
Jérémie Laval 582bd35450 Backport TaskCreationOptions check from master 2011-08-16 19:06:45 +02:00
Jeffrey Stedfast 6057352d91 Merge pull request #158 from nickers/mono-2-10
remove debug CWL's
2011-08-16 04:35:11 -07:00
Tomasz Wsuł 3b450189bb Remove writing statement on standard output 2011-08-16 12:56:08 +02:00
Jeffrey Stedfast 7878c22bbf Fixed a typo in zoltan's last commit 2011-08-15 18:05:13 -04:00
Jeffrey Stedfast 674372dd15 Fix for bug #445855
In this day and age of mobile personal computing devices,
we need to periodically check the underlying system
timezone because the device may have crossed a timezone
boundary.
2011-08-15 15:19:20 -04:00
Zoltan Varga af804a9305 Escape characters in LLVM symbol names 2011-08-15 17:47:56 +01:00
Zoltan Varga 7e2eff0be7 Don't pass MONO_UNWIND_ACTUAL_METHOD to the stack walker in a signal handler, its not signal safe. Fixes bxc #263. 2011-08-14 22:35:55 +02:00
Gonzalo Paniagua Javier 7de999655d [threadpool] Exit on unhandled exceptions only
Unhandled exceptions will only set the exitcode if there is no
	AppDomain unhandled exception handler. When the exitcode is set,
	the TP will exit for unhandled exceptions.

	Fixes bug #227.
2011-08-13 00:34:13 -04:00
Gonzalo Paniagua Javier 1b84abfcab [threadpool] Work around for a race-condition
Under some circumstances new_job was not signaled and the threadpool
	threads didn't realized there was a workitem in the queue.

	Fixes Xamarin bug #12 and Novell bug #690357.
2011-08-12 23:17:05 -04:00
Sebastien Pouliot 8286cbf198 Use 'as' for casting certificate extensions since we already deal with null and malformed extensions will throw, hard to debug, ICE when we just want to ignore them 2011-08-12 14:59:12 -04:00
Gonzalo Paniagua Javier db7d7c47cb Fix the range for rnd.Next() 2011-08-11 14:17:23 -04:00
Rodrigo Kumpera 9445d6e22c Add IObserver/IObservable to MOBILE profile. 2011-08-11 13:19:47 -03:00
Marek Habersack 209c253e3f Compilation fix for e449d41158 2011-08-11 02:29:07 +02:00
Marek Habersack e449d41158 [runtime] Fix for Xamarin bug #99. Don't fail to parse assembly names with spaces surrounding = in key=value pairs 2011-08-11 02:20:11 +02:00
Zoltan Varga 9b4a07a69e Fix the newly added test_0_llvm_regress_171 (). 2011-08-10 18:10:58 +02:00
Jérémie Laval 28766cfe96 Avoid creating a delegate instance in general case when setting up continuations
Conflicts:

	mcs/class/corlib/System.Threading.Tasks/Task.cs
2011-08-10 17:16:23 +02:00
Jonathan Pryor a95adaf53d [System,MOBILE] Add System.Text.RegularExpressions.RegexOptions.Compiled.
Add the RegexOptions.Compiled enumeration value to the MOBILE profile.

Fixes: http://bugzilla.xamarin.com/show_bug.cgi?id=149

MonoTouch and Mono for Android still use `PatternCompiler`, which is
interpreted. Thus RegexOptions.Compiled is ignored, and is present only for
compatibility with Windows Phone 7, which states [0]:

	Present only in Silverlight for Windows Phone, but not supported.

[0] http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regexoptions(VS.96).aspx
2011-08-09 21:33:56 -04:00
Zoltan Varga 7ae2112edc LLVM requires two PHI entries if a previous bblock branches to the current bblock using a conditional branch whose two targets are the same. Fixes #171. 2011-08-09 21:41:54 +02:00
Zoltan Varga 79b99d358b Add support for reference instances of Interlocked.Exchange<T> to full-aot, similarly to Interlocked.CompareExchange<T>. 2011-08-09 19:16:15 +02:00
Zoltan Varga 12fedc8ee6 Merge pull request #154 from mdsol/fix-mono-tarball-tests
Fix mono tarball tests
2011-08-09 10:03:00 -07:00
Jeffrey Stedfast 27589a4031 If #CONFIGURATION_DEP isn't defined, we still want to get a default proxy 2011-08-09 12:30:32 -04:00
Harry Wilkinson 049efb2da8 Include mono/tests/delegate2.exe.config to the source tarball so that the tests pass 2011-08-08 18:16:03 +01:00
77 changed files with 969 additions and 105 deletions

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(mono,2.10.4)
AM_INIT_AUTOMAKE(mono,2.10.5)
AM_MAINTAINER_MODE
API_VER=2.0
+1
View File
@@ -58,6 +58,7 @@ case $host in
;;
*-*-linux-android*)
platform_android=yes
AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
+1
View File
@@ -24,6 +24,7 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
@@ -263,15 +263,10 @@ namespace System.Data.OracleClient.Oci {
rsize = rsizep.ToUInt64 ();
//rsize = Encoding.UTF8.GetMaxByteCount (commandText.Length+1);
Console.WriteLine ("OCIStatementHandle:Prepare: CmdText:{0}, rsize:{1} ",
commandText, rsize);
// Fill buffer
buffer = new byte[rsize];
Console.WriteLine ("OCIStatementHandle:Prepare: buffer.Length:{0}, this.columnCount:{1}",
buffer.Length, this.ColumnCount);
OciCalls.OCIUnicodeToCharSet (Parent, buffer, commandText, ref rsizep);
// Execute statement
@@ -182,9 +182,8 @@ namespace System.Collections.Generic
public void Clear ()
{
count = 0;
first = null;
version++;
while (first != null)
Remove (first);
}
public bool Contains (T value)
@@ -5,6 +5,7 @@
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2003 Ximian, Inc (http://www.ximian.com)
// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
//
//
@@ -160,7 +161,7 @@ namespace System.Net
if (rnd == null)
rnd = new Random ();
int idx = (count > 1) ? rnd.Next (0, count - 1) : 0;
int idx = (count > 1) ? rnd.Next (0, count) : 0;
cncRef = (WeakReference) connections [idx];
cnc = cncRef.Target as WebConnection;
if (cnc == null) {
+6 -3
View File
@@ -246,10 +246,10 @@ namespace System.Net
[MonoTODO("Needs to respect Module, Proxy.AutoDetect, and Proxy.ScriptLocation config settings")]
static IWebProxy GetDefaultWebProxy ()
{
WebProxy p = null;
#if CONFIGURATION_DEP
DefaultProxySection sec = ConfigurationManager.GetSection ("system.net/defaultProxy") as DefaultProxySection;
WebProxy p;
if (sec == null)
return GetSystemWebProxy ();
@@ -265,8 +265,11 @@ namespace System.Net
if (pe.BypassOnLocal != ProxyElement.BypassOnLocalValues.Unspecified)
p.BypassProxyOnLocal = (pe.BypassOnLocal == ProxyElement.BypassOnLocalValues.True);
#endif
return p;
#else
return GetSystemWebProxy ();
#endif
}
#endif
@@ -6,6 +6,7 @@
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2006 Novell Inc. (http://www.novell.com)
// Copyright (C) 2011 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -601,7 +602,7 @@ namespace System.Security.Cryptography.X509Certificates {
// TODO 6.1.4.g-j
// 6.1.4.k - Verify that the certificate is a CA certificate
X509BasicConstraintsExtension bce = (X509BasicConstraintsExtension) certificate.Extensions["2.5.29.19"];
X509BasicConstraintsExtension bce = (certificate.Extensions["2.5.29.19"] as X509BasicConstraintsExtension);
if (bce != null) {
if (!bce.CertificateAuthority) {
element.StatusFlags |= X509ChainStatusFlags.InvalidBasicConstraints;
@@ -636,7 +637,7 @@ namespace System.Security.Cryptography.X509Certificates {
}
// 6.1.4.n - if key usage extension is present...
X509KeyUsageExtension kue = (X509KeyUsageExtension) certificate.Extensions["2.5.29.15"];
X509KeyUsageExtension kue = (certificate.Extensions["2.5.29.15"] as X509KeyUsageExtension);
if (kue != null) {
// ... verify keyCertSign is set
X509KeyUsageFlags success = X509KeyUsageFlags.KeyCertSign;
@@ -703,7 +704,7 @@ namespace System.Security.Cryptography.X509Certificates {
private string GetSubjectKeyIdentifier (X509Certificate2 certificate)
{
X509SubjectKeyIdentifierExtension ski = (X509SubjectKeyIdentifierExtension) certificate.Extensions["2.5.29.14"];
X509SubjectKeyIdentifierExtension ski = (certificate.Extensions["2.5.29.14"] as X509SubjectKeyIdentifierExtension);
return (ski == null) ? String.Empty : ski.SubjectKeyIdentifier;
}
@@ -816,7 +817,7 @@ namespace System.Security.Cryptography.X509Certificates {
private X509ChainStatusFlags CheckRevocation (X509Certificate2 certificate, X509Certificate2 ca_cert, bool online)
{
// change this if/when we support OCSP
X509KeyUsageExtension kue = (X509KeyUsageExtension) ca_cert.Extensions["2.5.29.15"];
X509KeyUsageExtension kue = (ca_cert.Extensions["2.5.29.15"] as X509KeyUsageExtension);
if (kue != null) {
// ... verify CrlSign is set
X509KeyUsageFlags success = X509KeyUsageFlags.CrlSign;
@@ -834,7 +835,7 @@ namespace System.Security.Cryptography.X509Certificates {
// crl = FindCrl (ca_cert, ref valid, ref out_of_date);
// We need to get the subjectAltName and an URI from there (or use OCSP)
// X509KeyUsageExtension subjectAltName = (X509KeyUsageExtension) ca_cert.Extensions["2.5.29.17"];
// X509KeyUsageExtension subjectAltName = (ca_cert.Extensions["2.5.29.17"] as X509KeyUsageExtension);
}
if (crl != null) {
@@ -224,7 +224,7 @@ namespace System.Text.RegularExpressions {
RegexOptions.IgnoreCase |
RegexOptions.Multiline |
RegexOptions.ExplicitCapture |
#if !NET_2_1
#if MOBILE || !NET_2_1
RegexOptions.Compiled |
#endif
RegexOptions.Singleline |
@@ -236,7 +236,7 @@ namespace System.Text.RegularExpressions {
const RegexOptions ecmaopts =
RegexOptions.IgnoreCase |
RegexOptions.Multiline |
#if !NET_2_1
#if MOBILE || !NET_2_1
RegexOptions.Compiled |
#endif
RegexOptions.ECMAScript;
@@ -35,7 +35,7 @@ namespace System.Text.RegularExpressions {
IgnoreCase = 0x001,
Multiline = 0x002,
ExplicitCapture = 0x004,
#if !NET_2_1
#if MOBILE || !NET_2_1
Compiled = 0x008,
#endif
Singleline = 0x010,
@@ -84,8 +84,13 @@ namespace MonoTests.System.Collections.Generic
[Test]
public void ClearTest ()
{
LinkedListNode <int> node = intlist.First;
intlist.Clear ();
Assert.AreEqual (0, intlist.Count);
Assert.AreEqual (2, node.Value);
Assert.IsNull (node.Next);
Assert.IsNull (node.Previous);
}
[Test]
+11 -1
View File
@@ -17,15 +17,25 @@ namespace zipsharp
AddInZip = 2
}
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate IntPtr OpenFileFunc (IntPtr opaque, string filename, int mode);
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate /* ulong */ IntPtr ReadFileFunc (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size);
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate /* ulong */ IntPtr WriteFileFunc (IntPtr opaque, IntPtr stream, IntPtr buffer, /* ulong */ IntPtr size);
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate /* long */ IntPtr TellFileFunc (IntPtr opaque, IntPtr stream);
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate /* long */ IntPtr SeekFileFunc (IntPtr opaque, IntPtr stream, /* ulong */ IntPtr offset, int origin);
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate int CloseFileFunc (IntPtr opaque, IntPtr stream);
[UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
internal delegate int TestErrorFileFunc (IntPtr opaque, IntPtr stream);
[StructLayout (LayoutKind.Sequential)]
@@ -38,6 +48,6 @@ namespace zipsharp
[MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc zseek_file;
[MarshalAs (UnmanagedType.FunctionPtr)] public CloseFileFunc zclose_file;
[MarshalAs (UnmanagedType.FunctionPtr)] public TestErrorFileFunc zerror_file;
[MarshalAs (UnmanagedType.FunctionPtr)] public IntPtr opaque;
public IntPtr opaque;
}
}
+11 -11
View File
@@ -147,34 +147,34 @@ namespace zipsharp
return unzReadCurrentFile (handle, b, (uint)count);
}
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzCloseCurrentFile (UnzipHandle handle);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr unztell (UnzipHandle handle);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzGoToFirstFile (UnzipHandle handle);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern UnzipHandle unzOpen2 (string path,
ref ZlibFileFuncDef pzlib_filefunc_def);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzGoToNextFile (UnzipHandle handle);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzLocateFile (UnzipHandle handle,
string szFileName,
int iCaseSensitivity);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzOpenCurrentFile2 (UnzipHandle handle,
out int method,
out int level,
int raw);
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzGetCurrentFileInfo (UnzipHandle handle,
out UnzipFileInfo pfile_info,
StringBuilder szFileName,
@@ -184,15 +184,15 @@ namespace zipsharp
StringBuilder szComment,
IntPtr commentBufferSize); // uLong
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static unsafe extern int unzReadCurrentFile (UnzipHandle handle,
byte* buf, // voidp
uint len);
//[DllImport ("MonoPosixHelper")]
//[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
//static extern int unzSetOffset (UnzipHandle handle, IntPtr pos); // uLong
[DllImport ("MonoPosixHelper")]
[DllImport ("MonoPosixHelper", CallingConvention=CallingConvention.Cdecl)]
static extern int unzClose (UnzipHandle handle);
}
}
@@ -68,6 +68,9 @@ namespace System.Threading.Tasks
CancellationToken token;
const TaskCreationOptions MaxTaskCreationOptions =
TaskCreationOptions.PreferFairness | TaskCreationOptions.LongRunning | TaskCreationOptions.AttachedToParent;
public Task (Action action) : this (action, TaskCreationOptions.None)
{
@@ -104,6 +107,9 @@ namespace System.Threading.Tasks
public Task (Action<object> action, object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
{
if (creationOptions > MaxTaskCreationOptions || creationOptions < TaskCreationOptions.None)
throw new ArgumentOutOfRangeException ("creationOptions");
this.taskCreationOptions = creationOptions;
this.action = action == null ? EmptyFunc : action;
this.state = state;
@@ -236,7 +242,7 @@ namespace System.Threading.Tasks
internal void ContinueWithCore (Task continuation, TaskContinuationOptions continuationOptions, TaskScheduler scheduler)
{
ContinueWithCore (continuation, continuationOptions, scheduler, () => true);
ContinueWithCore (continuation, continuationOptions, scheduler, null);
}
internal void ContinueWithCore (Task continuation, TaskContinuationOptions kind,
@@ -249,8 +255,8 @@ namespace System.Threading.Tasks
AtomicBoolean launched = new AtomicBoolean ();
EventHandler action = delegate (object sender, EventArgs e) {
if (!launched.Value && launched.TrySet ()) {
if (!predicate ())
if (launched.TryRelaxedSet ()) {
if (predicate != null && !predicate ())
return;
if (!ContinuationStatusCheck (kind)) {
@@ -729,6 +735,9 @@ namespace System.Threading.Tasks
protected virtual void Dispose (bool disposing)
{
if (!IsCompleted)
throw new InvalidOperationException ("A task may only be disposed if it is in a completion state");
// Set action to null so that the GC can collect the delegate and thus
// any big object references that the user might have captured in a anonymous method
if (disposing) {
@@ -32,7 +32,8 @@ namespace System.Threading.Tasks
{
public class TaskCompletionSource<TResult>
{
Task<TResult> source;
readonly Task<TResult> source;
SpinLock opLock = new SpinLock (false);
public TaskCompletionSource ()
{
@@ -108,17 +109,24 @@ namespace System.Threading.Tasks
bool ApplyOperation (Action action)
{
if (CheckInvalidState ())
return false;
bool taken = false;
try {
opLock.Enter (ref taken);
if (CheckInvalidState ())
return false;
source.Status = TaskStatus.Running;
source.Status = TaskStatus.Running;
if (action != null)
action ();
if (action != null)
action ();
source.Finish ();
source.Finish ();
return true;
return true;
} finally {
if (taken)
opLock.Exit ();
}
}
bool CheckInvalidState ()
+1 -1
View File
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
#if NET_4_0 || MOBILE
namespace System
{
+1 -1
View File
@@ -26,7 +26,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
#if NET_4_0 || MOBILE
namespace System
{
+11 -2
View File
@@ -8,6 +8,7 @@
//
// (C) Ximian, Inc.
// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
// Copyright 2011 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
@@ -54,6 +55,9 @@ namespace System
// Fields
static TimeZone currentTimeZone;
[NonSerialized]
static long timezone_check;
// Constructor
protected TimeZone ()
{
@@ -62,8 +66,13 @@ namespace System
// Properties
public static TimeZone CurrentTimeZone {
get {
if (currentTimeZone == null)
currentTimeZone = new CurrentSystemTimeZone (DateTime.GetNow ());
long now = DateTime.GetNow ();
if (currentTimeZone == null || (now - timezone_check) > TimeSpan.TicksPerMinute) {
currentTimeZone = new CurrentSystemTimeZone (now);
timezone_check = now;
}
return currentTimeZone;
}
}
@@ -1992,6 +1992,16 @@ public class AssemblyNameTest {
Assert.IsNotNull (ex.Message, "#4");
}
}
[Test (Description="Xamarin bug #99 - whitespaces in key=value")]
public void WhiteSpaceInKeyValue ()
{
string nameWithSpaces = String.Format ("MySql.Data.Tests, PublicKey = \t {0}, Culture =\tneutral, Version=\t1.2.3.4", GetTokenString (publicKey1));
string fullName = "MySql.Data.Tests, Version=1.2.3.4, Culture=neutral, PublicKeyToken=ce5276d8687ec6dc";
var an = new AssemblyName (nameWithSpaces);
Assert.AreEqual (fullName, an.FullName);
}
#endif
}
@@ -312,6 +312,13 @@ namespace MonoTests.System.Threading.Tasks
t.Start ();
}
[Test, ExpectedException (typeof (InvalidOperationException))]
public void DisposeUnstartedTest ()
{
var t = new Task (() => { });
t.Dispose ();
}
}
}
#endif
+4
View File
@@ -3894,6 +3894,10 @@ PublicKeyToken=b77a5c561934e089"));
MustTLE (string.Format ("{0}ZZZZ,{1}", typeof (MyRealEnum).FullName, aqn));
}
[Test] //bug #124
public void IsAssignableFromWithNullable () {
Console.WriteLine(typeof(IEnumerable<int?>).IsAssignableFrom(typeof(IEnumerable<int>)));
}
#endif
public abstract class Stream : IDisposable
+1
View File
@@ -7,6 +7,7 @@
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2004-2009 Novell, Inc.
// Copyright 2011 Xamarin Inc.
//
using System;
+1
View File
@@ -8,6 +8,7 @@
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
//
using System;
+4 -3
View File
@@ -2,14 +2,15 @@
//
// cs-parser.jay: The Parser for the C# compiler
//
// Authors: Miguel de Icaza (miguel@gnu.org)
// Authors: Miguel de Icaza (miguel@gnome.org)
// Ravi Pratap ([email protected])
// Marek Safar ([email protected])
// Marek Safar ([email protected])
//
// Dual Licensed under the terms of the GNU GPL and the MIT X11 license
//
// (C) 2001 Ximian, Inc (http://www.ximian.com)
// (C) 2004 Novell, Inc
// (C) 2004-2011 Novell, Inc
// Copyright 2011 Xamarin Inc.
//
// TODO:
// (1) Figure out why error productions dont work. `type-declaration' is a
+1
View File
@@ -6,6 +6,7 @@
// Dual licensed under the terms of the MIT X11 or GNU GPL
//
// Copyright 2009 Novell, Inc
// Copyright 2011 Xamarin Inc.
//
using System;
+1
View File
@@ -7,6 +7,7 @@
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
// Copyright 2011 Xamarin Inc.
//
//
+1
View File
@@ -7,6 +7,7 @@
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
// Copyright 2011 Xamarin Inc.
//
using System;
+1
View File
@@ -7,6 +7,7 @@
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
// Copyright 2011 Xamarin, Inc.
//
using System;
+2 -1
View File
@@ -5,7 +5,8 @@
//
// Dual licensed under the terms of the MIT X11 or GNU GPL
//
// Copyright 2009, 2010 Novell, Inc
// Copyright 2009-2011 Novell, Inc
// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
//
using System;
+1
View File
@@ -8,6 +8,7 @@
// Dual licensed under the terms of the MIT X11 or GNU GPL
// Copyright 2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
// Copyright 2011 Xamarin Inc.
//
// TODO:
+1
View File
@@ -8,6 +8,7 @@
//
// Copyright 2001, 2002, 2003 Ximian, Inc.
// Copyright 2003, 2004 Novell, Inc.
// Copyright 2011 Xamarin Inc.
//
using System;
+2
View File
@@ -5,6 +5,8 @@
* Dick Porter (dick@ximian.com)
*
* (C) 2002-2006 Ximian, Inc.
* Copyright 2003-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+41 -19
View File
@@ -6,6 +6,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
#include <stdio.h>
@@ -1847,6 +1848,25 @@ parse_assembly_directory_name (const char *name, const char *dirname, MonoAssemb
return res;
}
static gboolean
split_key_value (const gchar *pair, gchar **key, guint32 *keylen, gchar **value)
{
char *eqsign = strchr (pair, '=');
if (!eqsign) {
*key = NULL;
*keylen = 0;
*value = NULL;
return FALSE;
}
*key = (gchar*)pair;
*keylen = eqsign - *key;
while (*keylen > 0 && g_ascii_isspace ((*key) [*keylen - 1]))
(*keylen)--;
*value = g_strstrip (eqsign + 1);
return TRUE;
}
gboolean
mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboolean save_public_key, gboolean *is_version_defined, gboolean *is_token_defined)
{
@@ -1857,7 +1877,8 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
gchar *key = NULL;
gchar *retargetable = NULL;
gboolean res;
gchar *value;
gchar *value, *part_name;
guint32 part_name_len;
gchar **parts;
gchar **tmp;
gboolean version_defined;
@@ -1883,10 +1904,12 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
tmp++;
while (*tmp) {
value = g_strstrip (*tmp);
if (!g_ascii_strncasecmp (value, "Version=", 8)) {
if (!split_key_value (g_strstrip (*tmp), &part_name, &part_name_len, &value))
goto cleanup_and_fail;
if (part_name_len == 7 && !g_ascii_strncasecmp (part_name, "Version", part_name_len)) {
*is_version_defined = TRUE;
version = g_strstrip (value + 8);
version = value;
if (strlen (version) == 0) {
goto cleanup_and_fail;
}
@@ -1894,8 +1917,8 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
continue;
}
if (!g_ascii_strncasecmp (value, "Culture=", 8)) {
culture = g_strstrip (value + 8);
if (part_name_len == 7 && !g_ascii_strncasecmp (part_name, "Culture", part_name_len)) {
culture = value;
if (strlen (culture) == 0) {
goto cleanup_and_fail;
}
@@ -1903,9 +1926,9 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
continue;
}
if (!g_ascii_strncasecmp (value, "PublicKeyToken=", 15)) {
if (part_name_len == 14 && !g_ascii_strncasecmp (part_name, "PublicKeyToken", part_name_len)) {
*is_token_defined = TRUE;
token = g_strstrip (value + 15);
token = value;
if (strlen (token) == 0) {
goto cleanup_and_fail;
}
@@ -1913,8 +1936,8 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
continue;
}
if (!g_ascii_strncasecmp (value, "PublicKey=", 10)) {
key = g_strstrip (value + 10);
if (part_name_len == 9 && !g_ascii_strncasecmp (part_name, "PublicKey", part_name_len)) {
key = value;
if (strlen (key) == 0) {
goto cleanup_and_fail;
}
@@ -1922,8 +1945,8 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
continue;
}
if (!g_ascii_strncasecmp (value, "Retargetable=", 13)) {
retargetable = g_strstrip (value + 13);
if (part_name_len == 12 && !g_ascii_strncasecmp (part_name, "Retargetable", part_name_len)) {
retargetable = value;
if (strlen (retargetable) == 0) {
goto cleanup_and_fail;
}
@@ -1936,17 +1959,16 @@ mono_assembly_name_parse_full (const char *name, MonoAssemblyName *aname, gboole
continue;
}
if (!g_ascii_strncasecmp (value, "ProcessorArchitecture=", 22)) {
char *s = g_strstrip (value + 22);
if (!g_ascii_strcasecmp (s, "None"))
if (part_name_len == 21 && !g_ascii_strncasecmp (part_name, "ProcessorArchitecture", part_name_len)) {
if (!g_ascii_strcasecmp (value, "None"))
arch = PROCESSOR_ARCHITECTURE_NONE;
else if (!g_ascii_strcasecmp (s, "MSIL"))
else if (!g_ascii_strcasecmp (value, "MSIL"))
arch = PROCESSOR_ARCHITECTURE_MSIL;
else if (!g_ascii_strcasecmp (s, "X86"))
else if (!g_ascii_strcasecmp (value, "X86"))
arch = PROCESSOR_ARCHITECTURE_X86;
else if (!g_ascii_strcasecmp (s, "IA64"))
else if (!g_ascii_strcasecmp (value, "IA64"))
arch = PROCESSOR_ARCHITECTURE_IA64;
else if (!g_ascii_strcasecmp (s, "AMD64"))
else if (!g_ascii_strcasecmp (value, "AMD64"))
arch = PROCESSOR_ARCHITECTURE_AMD64;
else
goto cleanup_and_fail;
+2 -1
View File
@@ -2,7 +2,8 @@
* boehm-gc.c: GC implementation using either the installed or included Boehm GC.
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2004-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "config.h"
+1 -1
View File
@@ -7262,7 +7262,7 @@ mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass)
MonoClass *param1_class = mono_class_from_mono_type (klass_argv [j]);
MonoClass *param2_class = mono_class_from_mono_type (oklass_argv [j]);
if (param1_class->valuetype != param2_class->valuetype)
if (param1_class->valuetype != param2_class->valuetype || (param1_class->valuetype && param1_class != param2_class))
return FALSE;
/*
+1
View File
@@ -7,6 +7,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+1
View File
@@ -8,6 +8,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*
* This file is used by the interpreter and the JIT engine to locate
* assemblies. Used to load AssemblyRef and later to resolve various
+1
View File
@@ -6,6 +6,7 @@
*
* Copyright 2002-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*
*/
+1
View File
@@ -9,6 +9,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc. (http://www.xamarin.com)
*/
#include <config.h>
+1
View File
@@ -6,6 +6,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+1
View File
@@ -5,6 +5,7 @@
* Gonzalo Paniagua Javier (gonzalo@novell.com)
*
* Copyright (c) 2010 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <string.h>
+2 -1
View File
@@ -2,7 +2,8 @@
* null-gc.c: GC implementation using malloc: will leak everything, just for testing.
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2004-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "config.h"
+4 -3
View File
@@ -6,7 +6,8 @@
* Paolo Molaro (lupus@ximian.com)
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2004-2011 Novell, Inc (http://www.novell.com)
* Copyright 2001 Xamarin Inc (http://www.xamarin.com)
*/
#include <config.h>
#ifdef HAVE_ALLOCA_H
@@ -3824,9 +3825,9 @@ mono_unhandled_exception (MonoObject *exc)
}
/* set exitcode only if we will abort the process */
if (abort_process)
mono_environment_exitcode_set (1);
if ((current_appdomain_delegate == NULL) && (root_appdomain_delegate == NULL)) {
if (abort_process)
mono_environment_exitcode_set (1);
mono_print_unhandled_exception (exc);
} else {
if (root_appdomain_delegate) {
+3 -2
View File
@@ -88,9 +88,10 @@ dyn_array_uninit (DynArray *da)
static void
dyn_array_ensure_capacity (DynArray *da, int capacity)
{
int old_capacity = da->capacity;
char *new_data;
if (capacity <= da->capacity)
if (capacity <= old_capacity)
return;
if (da->capacity == 0)
@@ -100,7 +101,7 @@ dyn_array_ensure_capacity (DynArray *da, int capacity)
new_data = mono_sgen_alloc_internal_dynamic (da->elem_size * da->capacity, INTERNAL_MEM_BRIDGE_DATA);
memcpy (new_data, da->data, da->elem_size * da->size);
mono_sgen_free_internal_dynamic (da->data, da->elem_size * da->size, INTERNAL_MEM_BRIDGE_DATA);
mono_sgen_free_internal_dynamic (da->data, da->elem_size * old_capacity, INTERNAL_MEM_BRIDGE_DATA);
da->data = new_data;
}
+624
View File
@@ -0,0 +1,624 @@
/*
* The finalizable hash has the object as the key, the
* disappearing_link hash, has the link address as key.
*
* Copyright 2011 Xamarin Inc.
*/
static FinalizeEntryHashTable minor_finalizable_hash;
static FinalizeEntryHashTable major_finalizable_hash;
static FinalizeEntryHashTable*
get_finalize_entry_hash_table (int generation)
{
switch (generation) {
case GENERATION_NURSERY: return &minor_finalizable_hash;
case GENERATION_OLD: return &major_finalizable_hash;
default: g_assert_not_reached ();
}
}
/* LOCKING: requires that the GC lock is held */
static void
rehash_fin_table (FinalizeEntryHashTable *hash_table)
{
FinalizeEntry **finalizable_hash = hash_table->table;
mword finalizable_hash_size = hash_table->size;
int i;
unsigned int hash;
FinalizeEntry **new_hash;
FinalizeEntry *entry, *next;
int new_size = g_spaced_primes_closest (hash_table->num_registered);
new_hash = mono_sgen_alloc_internal_dynamic (new_size * sizeof (FinalizeEntry*), INTERNAL_MEM_FIN_TABLE);
for (i = 0; i < finalizable_hash_size; ++i) {
for (entry = finalizable_hash [i]; entry; entry = next) {
hash = mono_object_hash (entry->object) % new_size;
next = entry->next;
entry->next = new_hash [hash];
new_hash [hash] = entry;
}
}
mono_sgen_free_internal_dynamic (finalizable_hash, finalizable_hash_size * sizeof (FinalizeEntry*), INTERNAL_MEM_FIN_TABLE);
hash_table->table = new_hash;
hash_table->size = new_size;
}
/* LOCKING: requires that the GC lock is held */
static void
rehash_fin_table_if_necessary (FinalizeEntryHashTable *hash_table)
{
if (hash_table->num_registered >= hash_table->size * 2)
rehash_fin_table (hash_table);
}
/* LOCKING: requires that the GC lock is held */
static void
finalize_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, GrayQueue *queue)
{
FinalizeEntryHashTable *hash_table = get_finalize_entry_hash_table (generation);
FinalizeEntry *entry, *prev;
int i;
FinalizeEntry **finalizable_hash = hash_table->table;
mword finalizable_hash_size = hash_table->size;
if (no_finalize)
return;
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_collector.is_object_live (entry->object)) {
gboolean is_fin_ready = object_is_fin_ready (entry->object);
char *copy = entry->object;
copy_func ((void**)&copy, queue);
if (is_fin_ready) {
char *from;
FinalizeEntry *next;
/* Make it survive */
from = entry->object;
entry->object = copy;
/* remove and put in fin_ready_list */
if (prev)
prev->next = entry->next;
else
finalizable_hash [i] = entry->next;
next = entry->next;
num_ready_finalizers++;
hash_table->num_registered--;
queue_finalization_entry (entry);
bridge_register_finalized_object ((MonoObject*)copy);
DEBUG (5, fprintf (gc_debug_file, "Queueing object for finalization: %p (%s) (was at %p) (%d/%d)\n", entry->object, safe_name (entry->object), from, num_ready_finalizers, hash_table->num_registered));
entry = next;
continue;
} else {
char *from = entry->object;
if (hash_table == &minor_finalizable_hash && !ptr_in_nursery (copy)) {
FinalizeEntry *next = entry->next;
unsigned int major_hash;
/* remove from the list */
if (prev)
prev->next = entry->next;
else
finalizable_hash [i] = entry->next;
hash_table->num_registered--;
entry->object = copy;
/* insert it into the major hash */
rehash_fin_table_if_necessary (&major_finalizable_hash);
major_hash = mono_object_hash ((MonoObject*) copy) %
major_finalizable_hash.size;
entry->next = major_finalizable_hash.table [major_hash];
major_finalizable_hash.table [major_hash] = entry;
major_finalizable_hash.num_registered++;
DEBUG (5, fprintf (gc_debug_file, "Promoting finalization of object %p (%s) (was at %p) to major table\n", copy, safe_name (copy), from));
entry = next;
continue;
} else {
/* update pointer */
DEBUG (5, fprintf (gc_debug_file, "Updating object for finalization: %p (%s) (was at %p)\n", entry->object, safe_name (entry->object), from));
entry->object = copy;
}
}
}
prev = entry;
entry = entry->next;
}
}
}
/* LOCKING: requires that the GC lock is held */
static void
register_for_finalization (MonoObject *obj, void *user_data, int generation)
{
FinalizeEntryHashTable *hash_table = get_finalize_entry_hash_table (generation);
FinalizeEntry **finalizable_hash;
mword finalizable_hash_size;
FinalizeEntry *entry, *prev;
unsigned int hash;
if (no_finalize)
return;
g_assert (user_data == NULL || user_data == mono_gc_run_finalize);
hash = mono_object_hash (obj);
rehash_fin_table_if_necessary (hash_table);
finalizable_hash = hash_table->table;
finalizable_hash_size = hash_table->size;
hash %= finalizable_hash_size;
prev = NULL;
for (entry = finalizable_hash [hash]; entry; entry = entry->next) {
if (entry->object == obj) {
if (!user_data) {
/* remove from the list */
if (prev)
prev->next = entry->next;
else
finalizable_hash [hash] = entry->next;
hash_table->num_registered--;
DEBUG (5, fprintf (gc_debug_file, "Removed finalizer %p for object: %p (%s) (%d)\n", entry, obj, obj->vtable->klass->name, hash_table->num_registered));
mono_sgen_free_internal (entry, INTERNAL_MEM_FINALIZE_ENTRY);
}
return;
}
prev = entry;
}
if (!user_data) {
/* request to deregister, but already out of the list */
return;
}
entry = mono_sgen_alloc_internal (INTERNAL_MEM_FINALIZE_ENTRY);
entry->object = obj;
entry->next = finalizable_hash [hash];
finalizable_hash [hash] = entry;
hash_table->num_registered++;
DEBUG (5, fprintf (gc_debug_file, "Added finalizer %p for object: %p (%s) (%d) to %s table\n", entry, obj, obj->vtable->klass->name, hash_table->num_registered, generation_name (generation)));
}
#define STAGE_ENTRY_FREE 0
#define STAGE_ENTRY_BUSY 1
#define STAGE_ENTRY_USED 2
typedef struct {
gint32 state;
MonoObject *obj;
void *user_data;
} StageEntry;
#define NUM_FIN_STAGE_ENTRIES 1024
static volatile gint32 next_fin_stage_entry = 0;
static StageEntry fin_stage_entries [NUM_FIN_STAGE_ENTRIES];
/* LOCKING: requires that the GC lock is held */
static void
process_stage_entries (int num_entries, volatile gint32 *next_entry, StageEntry *entries, void (*process_func) (MonoObject*, void*))
{
int i;
int num_registered = 0;
int num_busy = 0;
for (i = 0; i < num_entries; ++i) {
gint32 state = entries [i].state;
if (state == STAGE_ENTRY_BUSY)
++num_busy;
if (state != STAGE_ENTRY_USED ||
InterlockedCompareExchange (&entries [i].state, STAGE_ENTRY_BUSY, STAGE_ENTRY_USED) != STAGE_ENTRY_USED) {
continue;
}
process_func (entries [i].obj, entries [i].user_data);
entries [i].obj = NULL;
entries [i].user_data = NULL;
mono_memory_write_barrier ();
entries [i].state = STAGE_ENTRY_FREE;
++num_registered;
}
*next_entry = 0;
/* g_print ("stage busy %d reg %d\n", num_busy, num_registered); */
}
static gboolean
add_stage_entry (int num_entries, volatile gint32 *next_entry, StageEntry *entries, MonoObject *obj, void *user_data)
{
gint32 index;
do {
do {
index = *next_entry;
if (index >= num_entries)
return FALSE;
} while (InterlockedCompareExchange (next_entry, index + 1, index) != index);
/*
* We don't need a write barrier here. *next_entry is just a
* help for finding an index, its value is irrelevant for
* correctness.
*/
} while (entries [index].state != STAGE_ENTRY_FREE ||
InterlockedCompareExchange (&entries [index].state, STAGE_ENTRY_BUSY, STAGE_ENTRY_FREE) != STAGE_ENTRY_FREE);
entries [index].obj = obj;
entries [index].user_data = user_data;
mono_memory_write_barrier ();
entries [index].state = STAGE_ENTRY_USED;
return TRUE;
}
/* LOCKING: requires that the GC lock is held */
static void
process_fin_stage_entry (MonoObject *obj, void *user_data)
{
if (ptr_in_nursery (obj))
register_for_finalization (obj, user_data, GENERATION_NURSERY);
else
register_for_finalization (obj, user_data, GENERATION_OLD);
}
/* LOCKING: requires that the GC lock is held */
static void
process_fin_stage_entries (void)
{
process_stage_entries (NUM_FIN_STAGE_ENTRIES, &next_fin_stage_entry, fin_stage_entries, process_fin_stage_entry);
}
void
mono_gc_register_for_finalization (MonoObject *obj, void *user_data)
{
while (!add_stage_entry (NUM_FIN_STAGE_ENTRIES, &next_fin_stage_entry, fin_stage_entries, obj, user_data)) {
LOCK_GC;
process_fin_stage_entries ();
UNLOCK_GC;
}
}
/* LOCKING: requires that the GC lock is held */
static int
finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size,
FinalizeEntryHashTable *hash_table)
{
FinalizeEntry **finalizable_hash = hash_table->table;
mword finalizable_hash_size = hash_table->size;
FinalizeEntry *entry, *prev;
int i, count;
if (no_finalize || !out_size || !out_array)
return 0;
count = 0;
for (i = 0; i < finalizable_hash_size; ++i) {
prev = NULL;
for (entry = finalizable_hash [i]; entry;) {
if (mono_object_domain (entry->object) == domain) {
FinalizeEntry *next;
/* remove and put in out_array */
if (prev)
prev->next = entry->next;
else
finalizable_hash [i] = entry->next;
next = entry->next;
hash_table->num_registered--;
out_array [count ++] = entry->object;
DEBUG (5, fprintf (gc_debug_file, "Collecting object for finalization: %p (%s) (%d/%d)\n", entry->object, safe_name (entry->object), num_ready_finalizers, hash_table->num_registered));
entry = next;
if (count == out_size)
return count;
continue;
}
prev = entry;
entry = entry->next;
}
}
return count;
}
/**
* mono_gc_finalizers_for_domain:
* @domain: the unloading appdomain
* @out_array: output array
* @out_size: size of output array
*
* Store inside @out_array up to @out_size objects that belong to the unloading
* appdomain @domain. Returns the number of stored items. Can be called repeteadly
* until it returns 0.
* The items are removed from the finalizer data structure, so the caller is supposed
* to finalize them.
* @out_array should be on the stack to allow the GC to know the objects are still alive.
*/
int
mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size)
{
int result;
LOCK_GC;
process_fin_stage_entries ();
result = finalizers_for_domain (domain, out_array, out_size, &minor_finalizable_hash);
if (result < out_size) {
result += finalizers_for_domain (domain, out_array + result, out_size - result,
&major_finalizable_hash);
}
UNLOCK_GC;
return result;
}
static DisappearingLinkHashTable minor_disappearing_link_hash;
static DisappearingLinkHashTable major_disappearing_link_hash;
static DisappearingLinkHashTable*
get_dislink_hash_table (int generation)
{
switch (generation) {
case GENERATION_NURSERY: return &minor_disappearing_link_hash;
case GENERATION_OLD: return &major_disappearing_link_hash;
default: g_assert_not_reached ();
}
}
/* LOCKING: assumes the GC lock is held */
static void
rehash_dislink (DisappearingLinkHashTable *hash_table)
{
DisappearingLink **disappearing_link_hash = hash_table->table;
int disappearing_link_hash_size = hash_table->size;
int i;
unsigned int hash;
DisappearingLink **new_hash;
DisappearingLink *entry, *next;
int new_size = g_spaced_primes_closest (hash_table->num_links);
new_hash = mono_sgen_alloc_internal_dynamic (new_size * sizeof (DisappearingLink*), INTERNAL_MEM_DISLINK_TABLE);
for (i = 0; i < disappearing_link_hash_size; ++i) {
for (entry = disappearing_link_hash [i]; entry; entry = next) {
hash = mono_aligned_addr_hash (entry->link) % new_size;
next = entry->next;
entry->next = new_hash [hash];
new_hash [hash] = entry;
}
}
mono_sgen_free_internal_dynamic (disappearing_link_hash,
disappearing_link_hash_size * sizeof (DisappearingLink*), INTERNAL_MEM_DISLINK_TABLE);
hash_table->table = new_hash;
hash_table->size = new_size;
}
/* LOCKING: assumes the GC lock is held */
static void
add_or_remove_disappearing_link (MonoObject *obj, void **link, int generation)
{
DisappearingLinkHashTable *hash_table = get_dislink_hash_table (generation);
DisappearingLink *entry, *prev;
unsigned int hash;
DisappearingLink **disappearing_link_hash = hash_table->table;
int disappearing_link_hash_size = hash_table->size;
if (hash_table->num_links >= disappearing_link_hash_size * 2) {
rehash_dislink (hash_table);
disappearing_link_hash = hash_table->table;
disappearing_link_hash_size = hash_table->size;
}
/* FIXME: add check that link is not in the heap */
hash = mono_aligned_addr_hash (link) % disappearing_link_hash_size;
entry = disappearing_link_hash [hash];
prev = NULL;
for (; entry; entry = entry->next) {
/* link already added */
if (link == entry->link) {
/* NULL obj means remove */
if (obj == NULL) {
if (prev)
prev->next = entry->next;
else
disappearing_link_hash [hash] = entry->next;
hash_table->num_links--;
DEBUG (5, fprintf (gc_debug_file, "Removed dislink %p (%d) from %s table\n", entry, hash_table->num_links, generation_name (generation)));
mono_sgen_free_internal (entry, INTERNAL_MEM_DISLINK);
}
return;
}
prev = entry;
}
if (obj == NULL)
return;
entry = mono_sgen_alloc_internal (INTERNAL_MEM_DISLINK);
entry->link = link;
entry->next = disappearing_link_hash [hash];
disappearing_link_hash [hash] = entry;
hash_table->num_links++;
DEBUG (5, fprintf (gc_debug_file, "Added dislink %p for object: %p (%s) at %p to %s table\n", entry, obj, obj->vtable->klass->name, link, generation_name (generation)));
}
/* LOCKING: requires that the GC lock is held */
static void
null_link_in_range (CopyOrMarkObjectFunc copy_func, char *start, char *end, int generation, gboolean before_finalization, GrayQueue *queue)
{
DisappearingLinkHashTable *hash = get_dislink_hash_table (generation);
DisappearingLink **disappearing_link_hash = hash->table;
int disappearing_link_hash_size = hash->size;
DisappearingLink *entry, *prev;
int i;
if (!hash->num_links)
return;
for (i = 0; i < disappearing_link_hash_size; ++i) {
prev = NULL;
for (entry = disappearing_link_hash [i]; entry;) {
char *object;
gboolean track = DISLINK_TRACK (entry);
/*
* Tracked references are processed after
* finalization handling whereas standard weak
* references are processed before. If an
* object is still not marked after finalization
* handling it means that it either doesn't have
* a finalizer or the finalizer has already run,
* so we must null a tracking reference.
*/
if (track == before_finalization) {
prev = entry;
entry = entry->next;
continue;
}
object = DISLINK_OBJECT (entry);
if (object >= start && object < end && !major_collector.is_object_live (object)) {
if (object_is_fin_ready (object)) {
void **p = entry->link;
DisappearingLink *old;
*p = NULL;
/* remove from list */
if (prev)
prev->next = entry->next;
else
disappearing_link_hash [i] = entry->next;
DEBUG (5, fprintf (gc_debug_file, "Dislink nullified at %p to GCed object %p\n", p, object));
old = entry->next;
mono_sgen_free_internal (entry, INTERNAL_MEM_DISLINK);
entry = old;
hash->num_links--;
continue;
} else {
char *copy = object;
copy_func ((void**)&copy, queue);
/* Update pointer if it's moved. If the object
* has been moved out of the nursery, we need to
* remove the link from the minor hash table to
* the major one.
*
* FIXME: what if an object is moved earlier?
*/
if (hash == &minor_disappearing_link_hash && !ptr_in_nursery (copy)) {
void **link = entry->link;
DisappearingLink *old;
/* remove from list */
if (prev)
prev->next = entry->next;
else
disappearing_link_hash [i] = entry->next;
old = entry->next;
mono_sgen_free_internal (entry, INTERNAL_MEM_DISLINK);
entry = old;
hash->num_links--;
g_assert (copy);
*link = HIDE_POINTER (copy, track);
add_or_remove_disappearing_link ((MonoObject*)copy, link, GENERATION_OLD);
DEBUG (5, fprintf (gc_debug_file, "Upgraded dislink at %p to major because object %p moved to %p\n", link, object, copy));
continue;
} else {
*entry->link = HIDE_POINTER (copy, track);
DEBUG (5, fprintf (gc_debug_file, "Updated dislink at %p to %p\n", entry->link, DISLINK_OBJECT (entry)));
}
}
}
prev = entry;
entry = entry->next;
}
}
}
/* LOCKING: requires that the GC lock is held */
static void
null_links_for_domain (MonoDomain *domain, int generation)
{
DisappearingLinkHashTable *hash = get_dislink_hash_table (generation);
DisappearingLink **disappearing_link_hash = hash->table;
int disappearing_link_hash_size = hash->size;
DisappearingLink *entry, *prev;
int i;
for (i = 0; i < disappearing_link_hash_size; ++i) {
prev = NULL;
for (entry = disappearing_link_hash [i]; entry; ) {
char *object = DISLINK_OBJECT (entry);
if (object && !((MonoObject*)object)->vtable) {
DisappearingLink *next = entry->next;
if (prev)
prev->next = next;
else
disappearing_link_hash [i] = next;
if (*(entry->link)) {
*(entry->link) = NULL;
g_warning ("Disappearing link %p not freed", entry->link);
} else {
mono_sgen_free_internal (entry, INTERNAL_MEM_DISLINK);
}
entry = next;
continue;
}
prev = entry;
entry = entry->next;
}
}
}
/* LOCKING: requires that the GC lock is held */
static void
process_dislink_stage_entry (MonoObject *obj, void *_link)
{
void **link = _link;
add_or_remove_disappearing_link (NULL, link, GENERATION_NURSERY);
add_or_remove_disappearing_link (NULL, link, GENERATION_OLD);
if (obj) {
if (ptr_in_nursery (obj))
add_or_remove_disappearing_link (obj, link, GENERATION_NURSERY);
else
add_or_remove_disappearing_link (obj, link, GENERATION_OLD);
}
}
#define NUM_DISLINK_STAGE_ENTRIES 1024
static volatile gint32 next_dislink_stage_entry = 0;
static StageEntry dislink_stage_entries [NUM_DISLINK_STAGE_ENTRIES];
/* LOCKING: requires that the GC lock is held */
static void
process_dislink_stage_entries (void)
{
process_stage_entries (NUM_DISLINK_STAGE_ENTRIES, &next_dislink_stage_entry, dislink_stage_entries, process_dislink_stage_entry);
}
static void
mono_gc_register_disappearing_link (MonoObject *obj, void **link, gboolean track, gboolean in_gc)
{
if (obj)
*link = HIDE_POINTER (obj, track);
else
*link = NULL;
#if 1
if (in_gc) {
process_dislink_stage_entry (obj, link);
} else {
while (!add_stage_entry (NUM_DISLINK_STAGE_ENTRIES, &next_dislink_stage_entry, dislink_stage_entries, obj, link)) {
LOCK_GC;
process_dislink_stage_entries ();
UNLOCK_GC;
}
}
#else
if (!in_gc)
LOCK_GC;
process_dislink_stage_entry (obj, link);
if (!in_gc)
UNLOCK_GC;
#endif
}
+8 -3
View File
@@ -4,7 +4,8 @@
* Author:
* Paolo Molaro (lupus@ximian.com)
*
* Copyright 2005-2010 Novell, Inc (http://www.novell.com)
* Copyright 2005-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*
* Thread start/stop adapted from Boehm's GC:
* Copyright (c) 1994 by Xerox Corporation. All rights reserved.
@@ -5022,7 +5023,7 @@ restart_threads_until_none_in_managed_allocator (void)
#if defined(__MACH__) && MONO_MACH_ARCH_SUPPORTED
result = thread_resume (pthread_mach_thread_np (info->id)) == KERN_SUCCESS;
#else
result = pthread_kill (info->id, restart_signal_num) == 0;
result = mono_sgen_pthread_kill (info, restart_signal_num) == 0;
#endif
if (result) {
++restart_count;
@@ -5068,7 +5069,7 @@ restart_threads_until_none_in_managed_allocator (void)
#if defined(__MACH__) && MONO_MACH_ARCH_SUPPORTED
result = mono_sgen_suspend_thread (info);
#else
result = pthread_kill (info->id, suspend_signal_num) == 0;
result = mono_sgen_pthread_kill (info, suspend_signal_num) == 0;
#endif
if (result) {
++restarted_count;
@@ -5742,6 +5743,10 @@ gc_register_current_thread (void *addr)
info->mach_port = mach_thread_self ();
#endif
#if defined(PLATFORM_ANDROID)
info->android_tid = (gpointer) gettid ();
#endif
/* try to get it with attributes first */
#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK)
{
+5
View File
@@ -96,6 +96,10 @@ struct _SgenThreadInfo {
thread_port_t mach_port;
#endif
#if defined(PLATFORM_ANDROID)
void *android_tid;
#endif
unsigned int stop_count; /* to catch duplicate signals */
int signal;
int skip;
@@ -593,6 +597,7 @@ int mono_sgen_thread_handshake (int signum) MONO_INTERNAL;
SgenThreadInfo* mono_sgen_thread_info_lookup (ARCH_THREAD_TYPE id) MONO_INTERNAL;
SgenThreadInfo** mono_sgen_get_thread_table (void) MONO_INTERNAL;
gboolean mono_sgen_suspend_thread (SgenThreadInfo *info) MONO_INTERNAL;
int mono_sgen_pthread_kill (SgenThreadInfo *info, int signum) MONO_INTERNAL;
void mono_sgen_wait_for_suspend_ack (int count) MONO_INTERNAL;
+31 -2
View File
@@ -36,7 +36,36 @@
#include "metadata/sgen-archdep.h"
#include "metadata/object-internals.h"
#if !defined(__MACH__) && !MONO_MACH_ARCH_SUPPORTED
#if defined(__MACH__)
#include "utils/mach-support.h"
#endif
#if defined(PLATFORM_ANDROID)
#include <errno.h>
extern int tkill (pid_t tid, int signal);
#endif
#if !(defined(__MACH__) && defined (MONO_MACH_ARCH_SUPPORTED))
int
mono_sgen_pthread_kill (SgenThreadInfo *info, int signum)
{
#if defined(PLATFORM_ANDROID)
int ret;
int old_errno = errno;
ret = tkill ((pid_t) info->android_tid, signum);
if (ret < 0) {
ret = errno;
errno = old_errno;
}
return ret;
#else
return pthread_kill (info->id, signum);
#endif
}
int
mono_sgen_thread_handshake (int signum)
{
@@ -54,7 +83,7 @@ mono_sgen_thread_handshake (int signum)
}
/*if (signum == suspend_signal_num && info->stop_count == global_stop_count)
continue;*/
result = pthread_kill (info->id, signum);
result = mono_sgen_pthread_kill (info, signum);
if (result == 0) {
count++;
} else {
+6 -3
View File
@@ -7,6 +7,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2010 Novell, Inc (http://www.novell.com)
* Copyright 2001 Xamarin Inc (http://www.xamarin.com)
*/
#include <config.h>
@@ -17,6 +18,7 @@
#include <mono/metadata/threads-types.h>
#include <mono/metadata/threadpool-internals.h>
#include <mono/metadata/exception.h>
#include <mono/metadata/environment.h>
#include <mono/metadata/mono-mlist.h>
#include <mono/metadata/mono-perfcounters.h>
#include <mono/metadata/socket-io.h>
@@ -1431,7 +1433,8 @@ async_invoke_thread (gpointer data)
unloaded = is_appdomainunloaded_exception (exc->vtable->domain, klass);
if (!unloaded && klass != mono_defaults.threadabortexception_class) {
mono_unhandled_exception (exc);
exit (255);
if (mono_environment_exitcode_get () == 1)
exit (255);
}
if (klass == mono_defaults.threadabortexception_class)
mono_thread_internal_reset_abort (thread);
@@ -1469,9 +1472,9 @@ async_invoke_thread (gpointer data)
InterlockedIncrement (&tp->waiting);
#if defined(__OpenBSD__)
while ((res = mono_sem_wait (&tp->new_job, TRUE)) == -1) {// && errno == EINTR) {
while (mono_cq_count (tp->queue) == 0 && (res = mono_sem_wait (&tp->new_job, TRUE)) == -1) {// && errno == EINTR) {
#else
while ((res = mono_sem_timedwait (&tp->new_job, 2000, TRUE)) == -1) {// && errno == EINTR) {
while (mono_cq_count (tp->queue) == 0 && (res = mono_sem_timedwait (&tp->new_job, 2000, TRUE)) == -1) {// && errno == EINTR) {
#endif
if (mono_runtime_is_shutting_down ())
break;
+1
View File
@@ -8,6 +8,7 @@
*
* Copyright 2001-2003 Ximian, Inc (http://www.ximian.com)
* Copyright 2004-2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+25 -8
View File
@@ -6,6 +6,8 @@
* Zoltan Varga (vargaz@gmail.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2003-2011 Novell, Inc
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
*/
/* Remaining AOT-only work:
@@ -185,6 +187,7 @@ typedef struct MonoAotCompile {
MonoClass **typespec_classes;
GString *llc_args;
GString *as_args;
char *assembly_name_sym;
gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
} MonoAotCompile;
@@ -2730,7 +2733,12 @@ add_wrappers (MonoAotCompile *acfg)
MonoType *t;
MonoClass *klass;
g_assert (method->flags & METHOD_ATTRIBUTE_STATIC);
/* this cannot be enforced by the C# compiler so we must give the user some warning before aborting */
if (!(method->flags & METHOD_ATTRIBUTE_STATIC)) {
g_warning ("AOT restriction: Method '%s' must be static since it is decorated with [MonoPInvokeCallback]. See http://ios.xamarin.com/Documentation/Limitations#Reverse_Callbacks",
mono_method_full_name (method, TRUE));
exit (1);
}
g_assert (sig->param_count == 1);
g_assert (sig->params [0]->type == MONO_TYPE_CLASS && !strcmp (mono_class_from_mono_type (sig->params [0])->name, "Type"));
@@ -3226,20 +3234,20 @@ add_generic_instances (MonoAotCompile *acfg)
}
}
/* Same for CompareExchange<T> */
/* Same for CompareExchange<T>/Exchange<T> */
{
MonoGenericContext ctx;
MonoType *args [16];
MonoMethod *cas_method;
MonoMethod *m;
MonoClass *interlocked_klass = mono_class_from_name (mono_defaults.corlib, "System.Threading", "Interlocked");
gpointer iter = NULL;
while ((cas_method = mono_class_get_methods (interlocked_klass, &iter))) {
if (!strcmp (cas_method->name, "CompareExchange") && cas_method->is_generic) {
while ((m = mono_class_get_methods (interlocked_klass, &iter))) {
if ((!strcmp (m->name, "CompareExchange") || !strcmp (m->name, "Exchange")) && m->is_generic) {
memset (&ctx, 0, sizeof (ctx));
args [0] = &mono_defaults.object_class->byval_arg;
ctx.method_inst = mono_metadata_get_generic_inst (1, args);
add_extra_method (acfg, mono_marshal_get_native_wrapper (mono_class_inflate_generic_method (cas_method, &ctx), TRUE, TRUE));
add_extra_method (acfg, mono_marshal_get_native_wrapper (mono_class_inflate_generic_method (m, &ctx), TRUE, TRUE));
}
}
}
@@ -5129,7 +5137,7 @@ mono_aot_get_method_name (MonoCompile *cfg)
{
if (llvm_acfg->aot_opts.static_link)
/* Include the assembly name too to avoid duplicate symbol errors */
return g_strdup_printf ("%s_%s", llvm_acfg->image->assembly->aname.name, get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash));
return g_strdup_printf ("%s_%s", llvm_acfg->assembly_name_sym, get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash));
else
return get_debug_sym (cfg->orig_method, "", llvm_acfg->method_label_hash);
}
@@ -5229,12 +5237,16 @@ emit_llvm_file (MonoAotCompile *acfg)
* The following optimizations cannot be enabled:
* - 'tailcallelim'
* - 'jump-threading' changes our blockaddress references to int constants.
* - 'basiccg' fails because it contains:
* if (CS && !isa<IntrinsicInst>(II)) {
* and isa<IntrinsicInst> is false for invokes to intrinsics (iltests.exe).
* - 'prune-eh' and 'functionattrs' depend on 'basiccg'.
* The opt list below was produced by taking the output of:
* llvm-as < /dev/null | opt -O2 -disable-output -debug-pass=Arguments
* then removing tailcallelim + the global opts, and adding a second gvn.
*/
opts = g_strdup ("-instcombine -simplifycfg");
opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -basiccg -prune-eh -inline -functionattrs -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loopsimplify -domfrontier -loopsimplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loopsimplify -lcssa -iv-users -indvars -loop-deletion -loopsimplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -preverify -domtree -verify");
opts = g_strdup ("-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loopsimplify -domfrontier -loopsimplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loopsimplify -lcssa -iv-users -indvars -loop-deletion -loopsimplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -simplifycfg -preverify -domtree -verify");
#if 1
command = g_strdup_printf ("%sopt -f %s -o temp.opt.bc temp.bc", acfg->aot_opts.llvm_path, opts);
printf ("Executing opt: %s\n", command);
@@ -6842,6 +6854,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
acfg->got_symbol_base = g_strdup_printf ("mono_aot_%s_got", acfg->image->assembly->aname.name);
acfg->plt_symbol = g_strdup_printf ("%smono_aot_%s_plt", acfg->llvm_label_prefix, acfg->image->assembly->aname.name);
acfg->assembly_name_sym = g_strdup (acfg->image->assembly->aname.name);
/* Get rid of characters which cannot occur in symbols */
for (p = acfg->got_symbol_base; *p; ++p) {
@@ -6852,6 +6865,10 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
if (!(isalnum (*p) || *p == '_'))
*p = '_';
}
for (p = acfg->assembly_name_sym; *p; ++p) {
if (!(isalnum (*p) || *p == '_'))
*p = '_';
}
acfg->method_index = 1;
+5 -3
View File
@@ -6,6 +6,8 @@
* Zoltan Varga (vargaz@gmail.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2003-2011 Novell, Inc.
* Copyright 2011 Xamarin, Inc.
*/
#include "config.h"
@@ -2922,15 +2924,15 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
return code;
}
/* Same for CompareExchange<T> */
if (method_index == 0xffffff && method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE && method->klass->image == mono_defaults.corlib && !strcmp (method->klass->name_space, "System.Threading") && !strcmp (method->klass->name, "Interlocked") && !strcmp (method->name, "CompareExchange") && MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->params [1])) {
/* Same for CompareExchange<T> and Exchange<T> */
if (method_index == 0xffffff && method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE && method->klass->image == mono_defaults.corlib && !strcmp (method->klass->name_space, "System.Threading") && !strcmp (method->klass->name, "Interlocked") && (!strcmp (method->name, "CompareExchange") || !strcmp (method->name, "Exchange")) && MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->params [1])) {
MonoMethod *m;
MonoGenericContext ctx;
MonoType *args [16];
gpointer iter = NULL;
while ((m = mono_class_get_methods (method->klass, &iter))) {
if (mono_method_signature (m)->generic_param_count && !strcmp (m->name, "CompareExchange"))
if (mono_method_signature (m)->generic_param_count && !strcmp (m->name, method->name))
break;
}
g_assert (m);
+2
View File
@@ -1,3 +1,5 @@
# Copyright 2003-2011 Novell, Inc (http://www.novell.com)
# Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
# arm cpu description file
# this file is read by genmdesc to pruduce a table with all the relevant information
# about the cpu instructions that may be used by the regsiter allocator, the scheduler
+7 -1
View File
@@ -5,6 +5,7 @@
* Zoltan Varga (vargaz@gmail.com)
*
* Copyright 2009-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc.
*/
#include <config.h>
@@ -2064,7 +2065,12 @@ mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji)
data.last_frame_set = FALSE;
if (sigctx) {
mono_arch_sigctx_to_monoctx (sigctx, &ctx);
mono_walk_stack (get_last_frame, mono_domain_get (), &ctx, MONO_UNWIND_DEFAULT, tls->thread, mono_get_lmf (), &data);
/*
* Don't pass MONO_UNWIND_ACTUAL_METHOD, its not signal safe, and
* get_last_frame () doesn't need it, the last frame cannot be a ginst
* since we are not in a JITted method.
*/
mono_walk_stack (get_last_frame, mono_domain_get (), &ctx, MONO_UNWIND_NONE, tls->thread, mono_get_lmf (), &data);
}
if (data.last_frame_set) {
memcpy (&tls->async_last_frame, &data.last_frame, sizeof (StackFrameInfo));
+1
View File
@@ -5,6 +5,7 @@
* Zoltan Varga (vargaz@gmail.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "mini.h"
+1
View File
@@ -6,6 +6,7 @@
* Paolo Molaro (lupus@ximian.com)
*
* (C) 2003 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <string.h>
#include <mono/metadata/debug-helpers.h>
+1
View File
@@ -5,6 +5,7 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2001 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+20
View File
@@ -2654,4 +2654,24 @@ END:
call int32 class Tests::regress_693905_inner(int32, int32)
ret
}
.method public static
default int32 test_0_llvm_regress_171 () cil managed
{
.locals init (
int32 i
)
call int32 Tests::return_1_noinline ()
ldc.i4.1
beq L1
ldc.i4.1
stloc.s 0
call int32 Tests::return_1_noinline ()
ldc.i4.0
beq L1
L1:
ldloc.s 0
ret
}
}
+2
View File
@@ -6,6 +6,8 @@
* Paolo Molaro (lupus@ximian.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2003-2011 Novell Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
*/
#include <config.h>
#include <math.h>
+1
View File
@@ -5,6 +5,7 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "mini.h"
+1
View File
@@ -9,6 +9,7 @@
* Massimiliano Mantione (massi@ximian.com)
*
* (C) 2006 Novell, Inc. http://www.novell.com
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
+2
View File
@@ -6,6 +6,8 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2003-2010 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+2
View File
@@ -10,6 +10,8 @@
* Zoltan Varga (vargaz@gmail.com)
*
* (C) 2003 Ximian, Inc.
* Copyright 2003-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "mini.h"
#include <string.h>
+2
View File
@@ -6,6 +6,8 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2003 Ximian, Inc.
* Copyright 2003-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "mini.h"
#include <string.h>
+1
View File
@@ -5,6 +5,7 @@
* Zoltan Varga (vargaz@gmail.com)
*
* Copyright 2009 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include "config.h"
+2 -1
View File
@@ -4,7 +4,8 @@
* Author:
* Mark Probst (mark.probst@gmail.com)
*
* (C) 2007 Novell, Inc.
* Copyright 2007-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+2 -1
View File
@@ -1,7 +1,8 @@
//
// mini-llvm-cpp.cpp: C++ support classes for the mono LLVM integration
//
// (C) 2009 Novell, Inc.
// (C) 2009-2011 Novell, Inc.
// Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
//
//
+12 -2
View File
@@ -1,7 +1,8 @@
/*
* mini-llvm.c: llvm "Backend" for the mono JIT
*
* (C) 2009 Novell, Inc.
* Copyright 2009-2011 Novell Inc (http://www.novell.com)
* Copyright 2011 Xamarin Inc (http://www.xamarin.com)
*/
#include "mini.h"
@@ -2467,7 +2468,16 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
cmp = LLVMBuildICmp (builder, cond_to_llvm_cond [rel], lhs, rhs, "");
if (MONO_IS_COND_BRANCH_OP (ins->next)) {
LLVMBuildCondBr (builder, cmp, get_bb (ctx, ins->next->inst_true_bb), get_bb (ctx, ins->next->inst_false_bb));
if (ins->next->inst_true_bb == ins->next->inst_false_bb) {
/*
* If the target bb contains PHI instructions, LLVM requires
* two PHI entries for this bblock, while we only generate one.
* So convert this to an unconditional bblock. (bxc #171).
*/
LLVMBuildBr (builder, get_bb (ctx, ins->next->inst_true_bb));
} else {
LLVMBuildCondBr (builder, cmp, get_bb (ctx, ins->next->inst_true_bb), get_bb (ctx, ins->next->inst_false_bb));
}
has_terminator = TRUE;
} else if (MONO_IS_SETCC (ins->next)) {
sprintf (dname_buf, "t%d", ins->next->dreg);
+1
View File
@@ -6,6 +6,7 @@
*
* Copyright 2001-2003 Ximian, Inc.
* Copyright 2003-2008 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*
* See LICENSE for licensing information.
*/
+5 -1
View File
@@ -1,4 +1,8 @@
/*
* (C) 2003 Ximian, Inc.
* (C) 2003-2011 Novell, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
#include <glib.h>
+3 -1
View File
@@ -6,7 +6,9 @@
* Dietmar Maurer (dietmar@ximian.com)
* Patrik Torstensson
*
* (C) 2003 Ximian, Inc.
* Copyright 2003 Ximian, Inc.
* Copyright 2003-2011 Novell Inc.
* Copyright 2011 Xamarin Inc.
*/
#include "mini.h"
#include <string.h>
+1
View File
@@ -7,6 +7,7 @@
*
* Copyright 2002-2003 Ximian, Inc.
* Copyright 2003-2010 Novell, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#define MONO_LLVM_IN_MINI 1
+1
View File
@@ -5,6 +5,7 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2003 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
#include <string.h>
+1
View File
@@ -6,6 +6,7 @@
* Dietmar Maurer (dietmar@ximian.com)
*
* (C) 2002 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+1
View File
@@ -6,6 +6,7 @@
* Zoltan Varga (vargaz@gmail.com)
*
* (C) 2001 Ximian, Inc.
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#include <config.h>
+2
View File
@@ -864,6 +864,8 @@ test-generic-sharing-managed: test-runner.exe $(GSHARED_TESTS)
test-generic-sharing:
@if test x$(M) != x; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
EXTRA_DIST += delegate2.exe.config
EXTRA_DIST += async-exceptions.cs
async-exceptions.exe : async-exceptions.cs
$(MCS) -out:async-exceptions.exe $(srcdir)/async-exceptions.cs
+4
View File
@@ -1,3 +1,7 @@
/*
* Copyright 2004-2011 Novell, Inc (http://www.novell.com)
* Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
*/
#ifndef __MONO_OS_GC_WRAPPER_H__
#define __MONO_OS_GC_WRAPPER_H__