Compare commits

...
Author SHA1 Message Date
Zoltan Varga e451fb2813 [jit] Always pass the imt arg to interface calls in gsharedvt methods. Fixes #22624. 2014-09-17 17:31:35 -04:00
Marek Safar db71bc145b [mcs] Don't use `1 naming for compiler generated second level and deeper nested types. Fixes #22893 2014-09-12 16:44:42 +02:00
Rolf Bjarne Kvinge 1c3c901f86 Don't throw TimeZoneNotFoundExceptions when iOS gives us invalid data.
iOS 8 GM lists "Asia/Chita" among its time zones, but when requesting
the time zone data for that time zone, no data is returned.

With this change we ignore time zones without any data when fetching
all the timezones on the system.
2014-09-11 18:55:49 +02:00
Zoltan Varga 0806328b04 [gsharedvt] Allow the SIZEOF opcode in gsharedvt code if it doesn't reference a gsharedvt type. Fixes #22711. 2014-09-08 16:37:29 -04:00
Marek Safar 356dbc5361 [corlib] Task never is CompletedSynchronously 2014-08-20 15:55:49 +02:00
Zoltan Varga 45d0ba1bc0 [runtime] Fix the leaking of mach ports introduced by 98bbf8512a. Fixes #22068. 2014-08-15 10:19:13 -04:00
Alexander Köplinger 69104ca6c7 [System] Use xamarin.com instead of mono-project.com for DNS tests
The latter is now hosted on a different IP behind a CDN and the IP may change depending on location.
Using xamarin.com instead fixes the tests for now.
2014-08-14 20:24:29 -04:00
Rodrigo Kumpera 62a857ec77 Revert "[mcs] Use closed delegate over static generated methods from anonymous methods"
This reverts commit 7edcd42a15.

Conflicts:
	mcs/tests/ver-il-net_4_5.xml
2014-08-12 19:40:17 -04:00
Zoltan Varga 2e5f57cc6c Revert "[mcs] Use closed delegate over static generated methods from anonymous methods"
This reverts commit 7edcd42a15.

Revert this as it causes blocker https://bugzilla.xamarin.com/show_bug.cgi?id=21651.
2014-08-12 19:23:41 -04:00
Marek Safar 992e9ff54b [System.Net.Http] Handle quoted filename value. Fixes #21960 2014-08-12 10:35:52 +02:00
Zoltan Varga 1a2c7216c1 [runtime] Fix Process.PrivateMemorySize64 etc. on ios. Fixes #21882. 2014-08-07 15:51:34 +02:00
Zoltan Varga 7348882b0b [jit] Fix enum->int casts in gsharedvt code. Fixes #21893. 2014-08-07 15:48:28 +02:00
Zoltan Varga 9ffca33e57 [jit] Avoid making generic calls from gsharedvt methods normally, go through the rgctx infrastructure instead. Fixes #21677. 2014-07-31 22:16:56 +02:00
Marek Safar 3b5a8e7214 [mcs] Update codegen for boolean loads. Fixes #21685 2014-07-31 18:41:09 +02:00
Alexis Christoforides 44ae3e4969 Bump Mono version -> 3.8.0 2014-07-30 14:50:28 -04:00
21 changed files with 1065 additions and 866 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, [3.6.1],
AC_INIT(mono, [3.8.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -64,12 +64,15 @@ namespace System {
[DllImport ("__Internal")]
extern static IntPtr monotouch_timezone_get_data (string name, ref int size);
static Stream GetMonoTouchData (string name)
static Stream GetMonoTouchData (string name, bool throw_on_error = true)
{
int size = 0;
IntPtr data = monotouch_timezone_get_data (name, ref size);
if (size <= 0)
throw new TimeZoneNotFoundException ();
if (size <= 0) {
if (throw_on_error)
throw new TimeZoneNotFoundException ();
return null;
}
unsafe {
var s = new UnmanagedMemoryStream ((byte*) data, size);
+3 -1
View File
@@ -656,7 +656,9 @@ namespace System
#elif MONOTOUCH
if (systemTimeZones.Count == 0) {
foreach (string name in GetMonoTouchNames ()) {
using (Stream stream = GetMonoTouchData (name)) {
using (Stream stream = GetMonoTouchData (name, false)) {
if (stream == null)
continue;
systemTimeZones.Add (BuildFromStream (name, stream));
}
}
@@ -211,6 +211,10 @@ namespace System.Net.Http.Headers
static string EncodeBase64Value (string value)
{
bool quoted = value.Length > 1 && value [0] == '"' && value [value.Length - 1] == '"';
if (quoted)
value = value.Substring (1, value.Length - 2);
for (int i = 0; i < value.Length; ++i) {
var ch = value[i];
if (ch > 127) {
@@ -220,7 +224,7 @@ namespace System.Net.Http.Headers
}
}
if (!Lexer.IsValidToken (value))
if (quoted || !Lexer.IsValidToken (value))
return "\"" + value + "\"";
return value;
@@ -215,6 +215,14 @@ namespace MonoTests.System.Net.Http.Headers
value.FileName = "(@)";
Assert.AreEqual ("\"(@)\"", value.FileName, "#21");
Assert.AreEqual (new NameValueHeaderValue ("filename", "\"(@)\""), value.Parameters.First (), "#22");
value.FileName = "\"č\"";
Assert.AreEqual ("č", value.FileName, "#31");
Assert.AreEqual (new NameValueHeaderValue ("filename", "\"=?utf-8?B?xI0=?=\""), value.Parameters.First (), "#32");
value.FileName = "\"quoted\"";
Assert.AreEqual ("\"quoted\"", value.FileName, "#41");
Assert.AreEqual (new NameValueHeaderValue ("filename", "\"quoted\""), value.Parameters.First (), "#42");
}
[Test]
+4 -4
View File
@@ -28,8 +28,8 @@ namespace MonoTests.System.Net
[TestFixture]
public class DnsTest
{
private String site1Name = "mono-project.com",
site1Dot = "96.126.105.110",
private String site1Name = "xamarin.com",
site1Dot = "50.19.126.231",
site2Name = "info.diku.dk",
site2Dot = "130.225.96.4",
noneExistingSite = "unlikely.xamarin.com";
@@ -44,7 +44,7 @@ namespace MonoTests.System.Net
IAsyncResult async = Dns.BeginGetHostByName (site1Name, null, null);
IPHostEntry entry = Dns.EndGetHostByName (async);
SubTestValidIPHostEntry (entry);
Assert.IsTrue (entry.HostName == "www.mono-project.com" || entry.HostName == "mono-project.com");
Assert.IsTrue (entry.HostName == "www.xamarin.com" || entry.HostName == "xamarin.com");
}
void GetHostByNameCallback (IAsyncResult ar)
@@ -191,7 +191,7 @@ namespace MonoTests.System.Net
[Test]
public void GetHostByName ()
{
SubTestGetHostByName ("www.mono-project.com", site1Dot);
SubTestGetHostByName ("www.xamarin.com", site1Dot);
SubTestGetHostByName (site2Name, site2Dot);
try {
var entry = Dns.GetHostByName (noneExistingSite);
@@ -1364,7 +1364,7 @@ namespace System.Threading.Tasks
bool IAsyncResult.CompletedSynchronously {
get {
return true;
return false;
}
}
@@ -1106,7 +1106,8 @@ namespace MonoTests.System.Threading.Tasks
{
var task = new TaskFactory ().StartNew (() => { });
var ar = (IAsyncResult)task;
ar.AsyncWaitHandle.WaitOne ();
Assert.IsFalse (ar.CompletedSynchronously, "#1");
Assert.IsTrue (ar.AsyncWaitHandle.WaitOne (5000), "#2");
}
[Test]
+6 -2
View File
@@ -1792,8 +1792,12 @@ namespace Mono.CSharp {
// this argument is generated during compilation which speeds up dispatch
// by about 25%
//
method_parameters = ParametersCompiled.Prefix (method_parameters,
new Parameter (null, null, 0, null, loc), ec.Module.Compiler.BuiltinTypes.Object);
//
// Disabled for now due to JIT bug
//
//method_parameters = ParametersCompiled.Prefix (method_parameters,
// new Parameter (null, null, 0, null, loc), ec.Module.Compiler.BuiltinTypes.Object);
}
if (storey == null && hoisted_tparams == null)
+5 -9
View File
@@ -44,7 +44,6 @@ namespace Mono.CSharp
public abstract class TypeContainer : MemberCore
{
public readonly MemberKind Kind;
public readonly string Basename;
protected List<TypeContainer> containers;
@@ -62,9 +61,6 @@ namespace Mono.CSharp
: base (parent, name, attrs)
{
this.Kind = kind;
if (name != null)
this.Basename = name.Basename;
defined_names = new Dictionary<string, MemberCore> ();
}
@@ -111,7 +107,7 @@ namespace Mono.CSharp
public virtual void AddPartial (TypeDefinition next_part)
{
MemberCore mc;
(PartialContainer ?? this).defined_names.TryGetValue (next_part.Basename, out mc);
(PartialContainer ?? this).defined_names.TryGetValue (next_part.MemberName.Basename, out mc);
AddPartial (next_part, mc as TypeDefinition);
}
@@ -380,7 +376,7 @@ namespace Mono.CSharp
containers.Remove (cont);
var tc = Parent == Module ? Module : this;
tc.defined_names.Remove (cont.Basename);
tc.defined_names.Remove (cont.MemberName.Basename);
}
public virtual void VerifyMembers ()
@@ -772,7 +768,7 @@ namespace Mono.CSharp
public override void AddTypeContainer (TypeContainer tc)
{
AddNameToContainer (tc, tc.Basename);
AddNameToContainer (tc, tc.MemberName.Basename);
base.AddTypeContainer (tc);
}
@@ -1295,7 +1291,7 @@ namespace Mono.CSharp
CreateMetadataName (sb);
TypeBuilder = Module.CreateBuilder (sb.ToString (), TypeAttr, type_size);
} else {
TypeBuilder = parent_def.TypeBuilder.DefineNestedType (Basename, TypeAttr, null, type_size);
TypeBuilder = parent_def.TypeBuilder.DefineNestedType (MemberName.Basename, TypeAttr, null, type_size);
}
if (DeclaringAssembly.Importer != null)
@@ -1795,7 +1791,7 @@ namespace Mono.CSharp
{
base.RemoveContainer (cont);
Members.Remove (cont);
Cache.Remove (cont.Basename);
Cache.Remove (cont.MemberName.Basename);
}
protected virtual bool DoResolveTypeParameters ()
+4 -4
View File
@@ -540,8 +540,8 @@ namespace Mono.CSharp
// bool array can actually store any byte value
//
ig.Emit (OpCodes.Ldelem_U1);
ig.Emit (OpCodes.Ldc_I4_1);
ig.Emit (OpCodes.And);
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Cgt_Un);
break;
case BuiltinTypeSpec.Type.Byte:
ig.Emit (OpCodes.Ldelem_U1);
@@ -762,8 +762,8 @@ namespace Mono.CSharp
break;
case BuiltinTypeSpec.Type.Bool:
ig.Emit (OpCodes.Ldind_I1);
ig.Emit (OpCodes.Ldc_I4_1);
ig.Emit (OpCodes.And);
ig.Emit (OpCodes.Ldc_I4_0);
ig.Emit (OpCodes.Cgt_Un);
break;
case BuiltinTypeSpec.Type.ULong:
case BuiltinTypeSpec.Type.Long:
-5
View File
@@ -195,11 +195,6 @@ namespace Mono.CSharp {
return name + "`" + args.Count;
}
public static string MakeName (string name, int count)
{
return name + "`" + count;
}
}
public class SimpleMemberName
+1 -1
View File
@@ -1277,7 +1277,7 @@ namespace Mono.CSharp
if (current_container.Containers != null)
{
var existing = current_container.Containers.FirstOrDefault (l => l.Basename == tc.Basename);
var existing = current_container.Containers.FirstOrDefault (l => l.MemberName.Basename == tc.MemberName.Basename);
if (existing != null) {
current_container.RemoveContainer (existing);
undo_actions.Add (() => current_container.AddTypeContainer (existing));
+3 -4
View File
@@ -482,8 +482,8 @@ namespace Mono.CSharp {
public void RemoveContainer (TypeContainer tc)
{
types.Remove (tc.Basename);
cached_types.Remove (tc.Basename);
types.Remove (tc.MemberName.Basename);
cached_types.Remove (tc.MemberName.Basename);
}
public void SetBuiltinType (BuiltinTypeSpec pts)
@@ -784,9 +784,8 @@ namespace Mono.CSharp {
public override void AddTypeContainer (TypeContainer tc)
{
string name = tc.Basename;
var mn = tc.MemberName;
var name = mn.Basename;
while (mn.Left != null) {
mn = mn.Left;
name = mn.Name;
+25
View File
@@ -1,3 +1,5 @@
// Compiler options: -unsafe
using System;
class BoolArrayWithByteValues
@@ -18,6 +20,26 @@ class BoolArrayWithByteValues
return 0;
}
static unsafe bool Ptr ()
{
bool rv;
var arr = new byte [256];
for (int i = 0; i < arr.Length; i++)
arr [i] = (byte) i;
fixed (byte* bptr = arr) {
rv = true;
for (int i = 0; i < arr.Length; i++) {
bool* boptr = (bool*)(bptr + i);
if (arr[i] > 0 && !*boptr)
rv = false;
System.Console.WriteLine ("#{0} = {1}", i, *boptr);
}
}
return rv;
}
static int Main()
{
var a = new bool[1];
@@ -49,6 +71,9 @@ class BoolArrayWithByteValues
if (res != 0)
return res;
if (!Ptr ())
return 6;
return 0;
}
}
+26
View File
@@ -0,0 +1,26 @@
using System;
using System.Threading.Tasks;
using System.Runtime.CompilerServices;
using System.Reflection;
class CorrectEncodingOfNestedTypes
{
static async Task<T> GetAsync<T>(string s) where T : new()
{
return await Task.Factory.StartNew(async () => {
var response = await Task.FromResult (s);
return (T)new object();
}).Unwrap();
}
public static int Main ()
{
var t = typeof (CorrectEncodingOfNestedTypes).GetNestedTypes (BindingFlags.NonPublic) [0].GetNestedTypes (BindingFlags.NonPublic) [0];
var m = t.GetMethods (BindingFlags.NonPublic | BindingFlags.Instance) [0];
var ca = (AsyncStateMachineAttribute) m.GetCustomAttributes (true) [0];
if (ca.StateMachineType.GetGenericArguments ().Length != 1)
return 1;
return 0;
}
}
File diff suppressed because it is too large. Load diff
+87
View File
@@ -40,6 +40,12 @@ class GFoo3<T> {
// The tests use arrays to pass/receive values to keep the calling convention of the methods stable, which is a current limitation of the runtime support for gsharedvt.
//
//
// Interfaces are used to prevent the AOT compiler from discovering instantiations, thus forcing the usage of the gsharedvt
// versions of methods. Unused vtype type arguments are used to test gsharedvt methods with ref type arguments, i.e.
// when calling foo<T,T2> as foo<object,bool>, the gsharedvt version is used, but with a ref type argument.
//
// FIXME: Add mixed ref/noref tests, i.e. Dictionary<string, int>
#if MOBILE
@@ -221,6 +227,9 @@ public class Tests
res = iface.Unbox<AnEnum, int> (AnEnum.One, 0, AnEnum.Two);
if (res != AnEnum.Two)
return 2;
int res2 = iface.Unbox<int, AnEnum> (0, AnEnum.One, AnEnum.Two);
if (res2 != 1)
return 3;
return 0;
}
@@ -935,6 +944,47 @@ public class Tests
return 0;
}
public interface IFace1<T> {
void m1 ();
void m2 ();
void m3 ();
void m4 ();
void m5 ();
}
public class ClassIFace<T> : IFace1<T> {
public void m1 () {
}
public void m2 () {
}
public void m3 () {
}
public void m4 () {
}
public void m5 () {
}
}
interface IFaceIFaceCall {
void call<T, T2> (IFace1<object> iface);
}
class MakeIFaceCall : IFaceIFaceCall {
public void call<T, T2> (IFace1<object> iface) {
iface.m1 ();
}
}
// Check normal interface calls from gsharedvt call to fully instantiated methods
public static int test_0_instatiated_iface_call () {
ClassIFace<object> c1 = new ClassIFace<object> ();
IFaceIFaceCall c = new MakeIFaceCall ();
c.call<object, int> (c1);
return 0;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static string to_string<T, T2>(T t, T2 t2) {
return t.ToString ();
@@ -1019,6 +1069,7 @@ public class Tests
return action(null, state);
}
[Category ("!FULLAOT")]
public static int test_0_delegate_wrappers () {
Func<object, Pair<int, int>, Pair<int, int>> del1 = delegate (object o, Pair<int, int> p) { return p; };
Func<object, Pair<int, int>, Pair<int, int>> del2 = delegate (object o, Pair<int, int> p) { return p; };
@@ -1459,6 +1510,42 @@ public class Tests
var c = new ReadOnlyCollection<AnEnum> (arr);
return c.Contains (AnEnum.Two) == false ? 0 : 1;
}
interface IFaceCallPatching {
bool caller<T, T2> ();
}
class CallPatching2<T> {
T t;
public object o;
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public bool callee () {
return (string)o == "ABC";
}
}
class CallPatching : IFaceCallPatching {
public bool caller<T, T2> () {
var c = new CallPatching2<T> ();
c.o = "ABC";
return c.callee ();
}
}
//
// This tests that generic calls made from gsharedvt methods are not patched normally.
// If they are, the first call to 'caller' would patch in the gshared version of
// 'callee', causing the second call to fail because the gshared version of callee
// wouldn't work with CallPatching2<bool> since it has a different object layout.
//
public static int test_0_call_patching () {
IFaceCallPatching c = new CallPatching ();
c.caller<object, bool> ();
if (!c.caller<bool, bool> ())
return 1;
return 0;
}
}
// #13191
+4 -2
View File
@@ -1061,6 +1061,7 @@ MonoObject*
mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass)
{
MonoJitTlsData *jit_tls = NULL;
MonoClass *oklass;
if (mini_get_debug_options ()->better_cast_details) {
jit_tls = mono_native_tls_get_value (mono_jit_tls_id);
@@ -1070,13 +1071,14 @@ mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass)
if (!obj)
return NULL;
if (klass->enumtype && obj->vtable->klass == klass->element_class)
oklass = obj->vtable->klass;
if ((klass->enumtype && oklass == klass->element_class) || (oklass->enumtype && klass == oklass->element_class))
return obj;
if (mono_object_isinst (obj, klass))
return obj;
if (mini_get_debug_options ()->better_cast_details) {
jit_tls->class_cast_from = obj->vtable->klass;
jit_tls->class_cast_from = oklass;
jit_tls->class_cast_to = klass;
}
+11 -3
View File
@@ -8390,8 +8390,10 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
/*
* Making generic calls out of gsharedvt methods.
* This needs to be used for all generic calls, not just ones with a gsharedvt signature, to avoid
* patching gshared method addresses into a gsharedvt method.
*/
if (cmethod && cfg->gsharedvt && mini_is_gsharedvt_signature (cfg, fsig)) {
if (cmethod && cfg->gsharedvt && (mini_is_gsharedvt_signature (cfg, fsig) || cmethod->is_inflated || cmethod->klass->generic_class)) {
MonoRgctxInfoType info_type;
if (virtual) {
@@ -8409,6 +8411,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
cmethod, MONO_RGCTX_INFO_METHOD);
/* This is not needed, as the trampoline code will pass one, and it might be passed in the same reg as the imt arg */
vtable_arg = NULL;
} else if ((cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) && !imt_arg) {
/* This can happen when we call a fully instantiated iface method */
imt_arg = emit_get_rgctx_method (cfg, context_used,
cmethod, MONO_RGCTX_INFO_METHOD);
vtable_arg = NULL;
}
}
@@ -12081,8 +12088,6 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
guint32 val;
int ialign;
GSHAREDVT_FAILURE (*ip);
CHECK_STACK_OVF (1);
CHECK_OPSIZE (6);
token = read32 (ip + 2);
@@ -12094,6 +12099,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
CHECK_TYPELOAD (klass);
mono_class_init (klass);
val = mono_type_size (&klass->byval_arg, &ialign);
if (mini_is_gsharedvt_klass (cfg, klass))
GSHAREDVT_FAILURE (*ip);
}
EMIT_NEW_ICONST (cfg, ins, val);
*sp++= ins;
+11 -4
View File
@@ -408,11 +408,17 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul
struct task_basic_info t_info;
mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT;
if (task_for_pid (mach_task_self (), pid, &task) != KERN_SUCCESS)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
if (pid == getpid ()) {
/* task_for_pid () doesn't work on ios, even for the current process */
task = mach_task_self ();
} else {
if (task_for_pid (mach_task_self (), pid, &task) != KERN_SUCCESS)
RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
}
if (task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count) != KERN_SUCCESS) {
mach_port_deallocate (mach_task_self (), task);
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
RET_ERROR (MONO_PROCESS_ERROR_OTHER);
}
@@ -425,7 +431,8 @@ get_pid_status_item (int pid, const char *item, MonoProcessError *error, int mul
else
ret = 0;
mach_port_deallocate (mach_task_self (), task);
if (pid != getpid ())
mach_port_deallocate (mach_task_self (), task);
return ret;
#else