Merge branch 'upstream'

Former-commit-id: e7bc2ce2160572963daa967ada44d8997bf83a6d
This commit is contained in:
Xamarin Public Jenkins 2015-12-18 19:43:16 -05:00
commit f05926f7ec
45 changed files with 399 additions and 122 deletions

View File

@ -1 +1 @@
1895650fb1b5a365ada5bcdf3fef86a448da51d2
08afe9df2791baac02e8201b01cce1aca3beb124

View File

@ -1 +1 @@
2317c4f2abf300ae9f452f4dbfd8b9d63c944e1c
4fa615ca8fe030cfede44041b86cf5bfc38aceaf

View File

@ -1 +1 @@
530bd396504a300e1f44e8bb369913299172f01f
3db9a4bafdb7398647430f25ef9f145d369259ca

View File

@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
public const string MonoVersion = "4.2.1.0";
public const string MonoVersion = "4.2.2.0";
public const string MonoCompany = "Mono development team";
public const string MonoProduct = "Mono Common Language Infrastructure";
public const string MonoCopyright = "(c) Various Mono authors";

View File

@ -1263,20 +1263,29 @@ namespace System.Data.SqlClient
throw new ArgumentNullException ("values");
int len = values.Length;
int bigDecimalIndex = command.Tds.ColumnValues.BigDecimalIndex;
var tds = command.Tds;
int columns = Math.Min (len, tds.Columns.Count);
// If a four-byte decimal is stored, then we can't convert to
// a native type. Throw an OverflowException.
if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
throw new OverflowException ();
try {
command.Tds.ColumnValues.CopyTo (0, values, 0,
len > command.Tds.ColumnValues.Count ? command.Tds.ColumnValues.Count : len);
} catch (TdsInternalException ex) {
command.Connection.Close ();
throw SqlException.FromTdsInternalException ((TdsInternalException) ex);
if ((command.CommandBehavior & CommandBehavior.SequentialAccess) != 0) {
for (int i = 0; i < columns; ++i) {
values [i] = tds.GetSequentialColumnValue (i);
}
} else {
int bigDecimalIndex = tds.ColumnValues.BigDecimalIndex;
// If a four-byte decimal is stored, then we can't convert to
// a native type. Throw an OverflowException.
if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
throw new OverflowException ();
try {
tds.ColumnValues.CopyTo (0, values, 0, columns);
} catch (TdsInternalException ex) {
command.Connection.Close ();
throw SqlException.FromTdsInternalException ((TdsInternalException)ex);
}
}
return (len < FieldCount ? len : FieldCount);
return columns;
}

View File

@ -36,7 +36,10 @@ namespace System
return false;
var from = Type.GetTypeCode (source);
switch (Type.GetTypeCode (target)) {
var to = Type.GetTypeCode (target);
if (from == to && source.IsPrimitive)
return true;
switch (to) {
case TypeCode.Char:
switch (from) {
case TypeCode.Byte:
@ -146,4 +149,4 @@ namespace System
return st == type || CanConvertPrimitive ((RuntimeType) st, type);
}
}
}
}

View File

@ -102,17 +102,7 @@ namespace System
public MethodInfo Method {
get {
if (method_info != null) {
return method_info;
} else {
if (method != IntPtr.Zero) {
if (!method_is_virtual)
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
else
method_info = GetVirtualMethod_internal ();
}
return method_info;
}
return GetMethodImpl ();
}
}
@ -511,7 +501,17 @@ namespace System
protected virtual MethodInfo GetMethodImpl ()
{
return Method;
if (method_info != null) {
return method_info;
} else {
if (method != IntPtr.Zero) {
if (!method_is_virtual)
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
else
method_info = GetVirtualMethod_internal ();
}
return method_info;
}
}
// This is from ISerializable

View File

@ -33,6 +33,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
@ -112,6 +113,14 @@ namespace System
return base.GetHashCode ();
}
protected override MethodInfo GetMethodImpl ()
{
if (delegates != null)
return delegates [delegates.Length - 1].Method;
return base.GetMethodImpl ();
}
// <summary>
// Return, in order of invocation, the invocation list
// of a MulticastDelegate

View File

@ -855,6 +855,32 @@ namespace MonoTests.System.Threading
Assert.AreSame (Thread.GetNamedDataSlot ("te#st"), Thread.GetNamedDataSlot ("te#st"), "#2");
}
class DomainClass : MarshalByRefObject {
Thread m_thread;
bool success;
public bool Run () {
m_thread = new Thread(ThreadProc);
m_thread.Start(Thread.CurrentThread);
m_thread.Join();
return success;
}
public void ThreadProc (object arg) {
success = m_thread == Thread.CurrentThread;
}
}
[Test]
public void CurrentThread_Domains ()
{
AppDomain ad = AppDomain.CreateDomain ("foo");
ad.Load (typeof (DomainClass).Assembly.GetName ());
var o = (DomainClass)ad.CreateInstanceAndUnwrap (typeof (DomainClass).Assembly.FullName, typeof (DomainClass).FullName);
Assert.IsTrue (o.Run ());
AppDomain.Unload (ad);
}
void CheckIsRunning (string s, Thread t)
{
int c = counter;

View File

@ -1 +1 @@
9f87bcd74d19a29f1b4e41b2d7171f2c1af2835c
bc4d15d32cfe0aba953847153e27ae46f18e35c1

View File

@ -1 +1 @@
06f7fdab7429fe3c9ed22771dfe9380d208f037d
b937698af090202f18c31201001eb77a3e464dc5

View File

@ -1 +1 @@
f41bbb4a396f59eec461720dfc065f676523d1c1
3fa77ec9258a44fd81c7433c3534093f2984d1cf

View File

@ -1 +1 @@
ff03cd74a2624bd0a4a51658bb41e7d90f3144c9
b656909fcd7c7447aa1b8639357c6c089a918a74

View File

@ -1 +1 @@
d8009a94148589526c8dc39f0e1c0ca9e77217e8
ec8668e105a38b35bf91110fe79e06e0dca1ead6

View File

@ -1 +1 @@
22fc25a9bdf68807d3d57dc73d711bbd3bc8bc79
47b95db8a26f7b940063993c07b77a5ee36746fe

View File

@ -1 +1 @@
f815830cd5626bb85f053420b1d6fcf19e0aeb2a
3c2d3fbe2cac6adc7835cf53aa766fffd4381e86

View File

@ -0,0 +1,13 @@
class M
{
public static void Main ()
{
string s = null;
s?.CompareTo ("xx").CompareTo(s?.EndsWith ("x")).GetHashCode ();
string s1 = "abcd";
string s2 = null;
var idx = s1.Substring(1)[s2?.GetHashCode () ?? 0].GetHashCode ();
}
}

View File

@ -1 +1 @@
08b0ee8ce9da391ffa51e1cc3eb0a3611adf5b5e
7e6d08d8664395f0f877e388bd40276cefe0c2e9

View File

@ -2339,6 +2339,8 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
FOREACH_THREAD (info) {
int skip_reason = 0;
void *aligned_stack_start = (void*)(mword) ALIGN_TO ((mword)info->client_info.stack_start, SIZEOF_VOID_P);
if (info->client_info.skip) {
SGEN_LOG (3, "Skipping dead thread %p, range: %p-%p, size: %zd", info, info->client_info.stack_start, info->client_info.stack_end, (char*)info->client_info.stack_end - (char*)info->client_info.stack_start);
skip_reason = 1;
@ -2358,13 +2360,13 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p
g_assert (info->client_info.suspend_done);
SGEN_LOG (3, "Scanning thread %p, range: %p-%p, size: %zd, pinned=%zd", info, info->client_info.stack_start, info->client_info.stack_end, (char*)info->client_info.stack_end - (char*)info->client_info.stack_start, sgen_get_pinned_count ());
if (mono_gc_get_gc_callbacks ()->thread_mark_func && !conservative_stack_mark) {
mono_gc_get_gc_callbacks ()->thread_mark_func (info->client_info.runtime_data, info->client_info.stack_start, info->client_info.stack_end, precise, &ctx);
mono_gc_get_gc_callbacks ()->thread_mark_func (info->client_info.runtime_data, aligned_stack_start, info->client_info.stack_end, precise, &ctx);
} else if (!precise) {
if (!conservative_stack_mark) {
fprintf (stderr, "Precise stack mark not supported - disabling.\n");
conservative_stack_mark = TRUE;
}
sgen_conservatively_pin_objects_from (info->client_info.stack_start, info->client_info.stack_end, start_nursery, end_nursery, PIN_TYPE_STACK);
sgen_conservatively_pin_objects_from (aligned_stack_start, info->client_info.stack_end, start_nursery, end_nursery, PIN_TYPE_STACK);
}
if (!precise) {

View File

@ -480,11 +480,13 @@ domain_get_next (ThreadPoolDomain *current)
return tpdomain;
}
static void
/* return TRUE if timeout, FALSE otherwise (worker unpark or interrupt) */
static gboolean
worker_park (void)
{
mono_cond_t cond;
MonoInternalThread *thread = mono_thread_internal_current ();
gboolean timeout = FALSE;
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] current worker parking", GetCurrentThreadId ());
@ -495,10 +497,17 @@ worker_park (void)
mono_mutex_lock (&threadpool->active_threads_lock);
if (!mono_runtime_is_shutting_down ()) {
static gpointer rand_handle = NULL;
if (!rand_handle)
rand_handle = rand_create ();
g_assert (rand_handle);
g_ptr_array_add (threadpool->parked_threads, &cond);
g_ptr_array_remove_fast (threadpool->working_threads, thread);
mono_cond_wait (&cond, &threadpool->active_threads_lock);
if (mono_cond_timedwait_ms (&cond, &threadpool->active_threads_lock, rand_next (rand_handle, 5 * 1000, 60 * 1000)) != 0)
timeout = TRUE;
g_ptr_array_add (threadpool->working_threads, thread);
g_ptr_array_remove (threadpool->parked_threads, &cond);
@ -511,6 +520,8 @@ worker_park (void)
mono_cond_destroy (&cond);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] current worker unparking", GetCurrentThreadId ());
return timeout;
}
static gboolean
@ -585,13 +596,15 @@ worker_thread (gpointer data)
}
if (retire || !(tpdomain = domain_get_next (previous_tpdomain))) {
gboolean timeout;
COUNTER_ATOMIC (counter, {
counter._.working --;
counter._.parked ++;
});
mono_mutex_unlock (&threadpool->domains_lock);
worker_park ();
timeout = worker_park ();
mono_mutex_lock (&threadpool->domains_lock);
COUNTER_ATOMIC (counter, {
@ -599,6 +612,9 @@ worker_thread (gpointer data)
counter._.parked --;
});
if (timeout)
break;
if (retire)
retire = FALSE;

Some files were not shown because too many files have changed in this diff Show More