Compare commits

..
10 Commits
Author SHA1 Message Date
Zoltan Varga e66d9abbb2 [llvm] Fix the returning of vtypes using a hidden argument in bitcode, in some cases, we forgot to generate the code to return the value, causing random data to be returned. Fixes #59956. (#5786) 2017-10-25 10:35:58 -04:00
Aleksey Kliger (λgeek) 1f4613aa1a [sre] Register a canonical reflected method for a methodspec token. (Fixes #60233) (#5814)
* [sre] mono_dynamic_image_register_token: Change asserts to warnings

This partly relaxes the changes in 792b5367cd
which added the assertions.

In practice the assertions introduced a crash in heavy uses of
System.Reflection.Emit such as unit testing frameworks and dynamic languages.
We still want to know if there are surprising uses of
mono_dynamic_image_register_token, but we don't need a crash.  SRE used to work
before 792b5367cd, so no need to break it.

* [test] ILGenerator test for duplicate methodspec tokens

Regression test for [Bugzilla #60233](https://bugzilla.xamarin.com/show_bug.cgi?id=60233)

* [sre] Register a canonical reflected method for a methodspec token (Fixes #60233)

This is like the fix for [bugzilla
59364](https://bugzilla.xamarin.com/show_bug.cgi?id=59364) but this time it's a
methodspec token, not a memberref token.
2017-10-18 08:09:39 -04:00
Zoltan Varga d092ad186f [llvm] Map byref types to the same type as the this argument so they are called using the same signature if the this argument is passed explicitly. Fixes #59436. (#5572) 2017-10-17 09:21:39 +02:00
Alexis Christoforides c6605763a3 Merge pull request #5783 from marek-safar/2017-06-fixes
[corlib]: Fix race condition in ExceptionDispatchInfo. (#5279)
2017-10-13 14:07:22 -04:00
Martin Baulig 0fb4040ef1 [corlib]: Fix race condition in ExceptionDispatchInfo. (#5279) 2017-10-13 16:03:37 +02:00
Luis Aguilera fea2566b12 Merge pull request #5772 from marek-safar/2017-06-fixes
Brings CoreFX update which contains a fix for #59302
2017-10-12 11:34:26 -04:00
Marek Safar f3c9015ec4 Brings CoreFX update which contains a fix for #59302 2017-10-12 09:44:55 +02:00
Jo Shields 0429840e5b Bump branch to 5.4.1, in anticipation of next release (#5760) 2017-10-12 02:36:03 +02:00
Alexander Köplinger 28d71e9727 [msvc] Fix MONO_CORLIB_VERSION to match configure.ac (#5770)
When I simplified MONO_CORLIB_VERSION to only include major.minor
instead of major.minor.build in https://github.com/mono/mono/pull/5449
I forgot to apply the same change to the msvc copy of that logic.

(cherry picked from commit 43757d67ef)
2017-10-12 02:35:44 +02:00
Alexis Christoforides f1bca3dc5b Fix typo 2017-10-11 16:51:03 -04:00
10 changed files with 88 additions and 76 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, [5.4.0],
AC_INIT(mono, [5.4.1],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -226,7 +226,7 @@ namespace Mono.Net.Security
if (Interlocked.Exchange (ref WriteRequested, 0) != 0) {
// Flush the write queue.
await Parent.InnerWrite (RunSynchronously, cancellationToken).ConfigureAwait (false);
await Parent.InnerWrite (RunSynchronously, cancellationToken);
}
Debug ("ProcessOperation done: {0} -> {1}", status, newStatus);
+28 -51
View File
@@ -901,33 +901,6 @@ namespace System.Net
internal int EndRead (HttpWebRequest request, IAsyncResult result)
{
Stream s = null;
Exception exception = null;
lock (this) {
s = nstream;
}
int nbytes = 0;
bool done = false;
WebAsyncResult wr = null;
IAsyncResult nsAsync = ((WebAsyncResult) result).InnerAsyncResult;
try {
if (chunkedRead && (nsAsync is WebAsyncResult)) {
wr = (WebAsyncResult) nsAsync;
IAsyncResult inner = wr.InnerAsyncResult;
if (inner != null && !(inner is WebAsyncResult)) {
nbytes = s.EndRead (inner);
done = nbytes == 0;
}
} else if (!(nsAsync is WebAsyncResult)) {
nbytes = s.EndRead (nsAsync);
wr = (WebAsyncResult) result;
done = nbytes == 0;
}
} catch (Exception exc) {
exception = exc;
}
lock (this) {
if (request.Aborted)
throw new WebException ("Request aborted", WebExceptionStatus.RequestCanceled);
@@ -935,10 +908,25 @@ namespace System.Net
throw new ObjectDisposedException (typeof (NetworkStream).FullName);
if (nstream == null)
throw new ObjectDisposedException (typeof (NetworkStream).FullName);
s = nstream;
}
if (exception != null)
throw exception;
int nbytes = 0;
bool done = false;
WebAsyncResult wr = null;
IAsyncResult nsAsync = ((WebAsyncResult) result).InnerAsyncResult;
if (chunkedRead && (nsAsync is WebAsyncResult)) {
wr = (WebAsyncResult) nsAsync;
IAsyncResult inner = wr.InnerAsyncResult;
if (inner != null && !(inner is WebAsyncResult)) {
nbytes = s.EndRead (inner);
done = nbytes == 0;
}
} else if (!(nsAsync is WebAsyncResult)) {
nbytes = s.EndRead (nsAsync);
wr = (WebAsyncResult) result;
done = nbytes == 0;
}
if (chunkedRead) {
try {
@@ -1041,24 +1029,6 @@ namespace System.Net
internal bool EndWrite (HttpWebRequest request, bool throwOnError, IAsyncResult result)
{
Stream s = null;
WebExceptionStatus newStatus = status;
bool complete;
Exception exception = null;
lock (this) {
s = nstream;
}
try {
s.EndWrite (result);
complete = true;
} catch (Exception exc) {
newStatus = WebExceptionStatus.SendFailure;
if (throwOnError && exc.InnerException != null)
exception = exc.InnerException;
complete = false;
}
lock (this) {
if (status == WebExceptionStatus.RequestCanceled)
return true;
@@ -1066,12 +1036,18 @@ namespace System.Net
throw new ObjectDisposedException (typeof (NetworkStream).FullName);
if (nstream == null)
throw new ObjectDisposedException (typeof (NetworkStream).FullName);
s = nstream;
}
status = newStatus;
if (exception != null)
throw exception;
return complete;
try {
s.EndWrite (result);
return true;
} catch (Exception exc) {
status = WebExceptionStatus.SendFailure;
if (throwOnError && exc.InnerException != null)
throw exc.InnerException;
return false;
}
}
internal int Read (HttpWebRequest request, byte [] buffer, int offset, int size)
@@ -1156,6 +1132,7 @@ namespace System.Net
try {
nstream.Close ();
} catch {}
nstream = null;
}
if (socket != null) {
@@ -524,11 +524,13 @@ namespace MonoTests.System.Reflection.Emit
}
public class Base {
public class Base<T> {
public int x;
public void M () { }
}
public class Derived : Base {
public class Derived : Base<string> {
}
[Test]
@@ -540,7 +542,7 @@ namespace MonoTests.System.Reflection.Emit
//
// Regression test for bugzilla #59364
var f1 = typeof (Base).GetField ("x");
var f1 = typeof (Base<string>).GetField ("x");
var f2 = typeof (Derived).GetField ("x");
var value_getter = typeof (RuntimeFieldHandle).GetProperty("Value").GetMethod;
@@ -572,5 +574,42 @@ namespace MonoTests.System.Reflection.Emit
Assert.AreEqual ("1", s);
}
[Test]
public void MethodSpecTokenSame () {
DefineBasicMethod ();
// Get the same method from a base generic instance and
// a type derived from it so that the
// MemberInfo:DeclaredType differs but the tokens are
// the same.
//
// Regression test for bugzilla #60233
var m1 = typeof (Base<string>).GetMethod ("M");
var m2 = typeof (Derived).GetMethod ("M");
var il = il_gen;
var loc = il.DeclareLocal (typeof (Derived));
il.Emit (OpCodes.Newobj, typeof (Derived).GetConstructor(new Type[]{}));
il.Emit (OpCodes.Stloc, loc);
il.Emit (OpCodes.Ldloc, loc);
il.Emit (OpCodes.Call, m1);
il.Emit (OpCodes.Ldloc, loc);
il.Emit (OpCodes.Call, m2);
il.Emit (OpCodes.Ldstr, "1");
il.Emit (OpCodes.Ret);
var baked = tb.CreateType ();
var x = Activator.CreateInstance (baked);
var m = baked.GetMethod ("F");
var s = m.Invoke (x, null);
Assert.AreEqual ("1", s);
}
}
}
+5 -2
View File
@@ -204,9 +204,12 @@ mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, Mo
if (prev) {
switch (how_collide) {
case MONO_DYN_IMAGE_TOK_NEW:
g_assert_not_reached ();
g_warning ("%s: Unexpected previous object when called with MONO_DYN_IMAGE_TOK_NEW", __func__);
break;
case MONO_DYN_IMAGE_TOK_SAME_OK:
g_assert (prev == MONO_HANDLE_RAW (obj));
if (prev != MONO_HANDLE_RAW (obj)) {
g_warning ("%s: condition `prev == MONO_HANDLE_RAW (obj)' not met", __func__);
}
break;
case MONO_DYN_IMAGE_TOK_REPLACE:
break;
+9 -3
View File
@@ -1149,9 +1149,15 @@ mono_image_create_token (MonoDynamicImage *assembly, MonoObjectHandle obj,
MonoReflectionMethodHandle m = MONO_HANDLE_CAST (MonoReflectionMethod, obj);
MonoMethod *method = MONO_HANDLE_GETVAL (m, method);
if (method->is_inflated) {
if (create_open_instance)
token = mono_image_get_methodspec_token (assembly, method);
else
if (create_open_instance) {
guint32 methodspec_token = mono_image_get_methodspec_token (assembly, method);
MonoReflectionMethodHandle canonical_obj =
mono_method_get_object_handle (MONO_HANDLE_DOMAIN (obj), method, NULL, error);
if (!is_ok (error))
goto leave;
MONO_HANDLE_ASSIGN (register_obj, canonical_obj);
token = methodspec_token;
} else
token = mono_image_get_inflated_method_token (assembly, method);
} else if ((method->klass->image == &assembly->image) &&
!mono_class_is_ginst (method->klass)) {
-12
View File
@@ -2917,16 +2917,4 @@ END:
valuetype [mscorlib]System.Decimal)
IL_0028: ret
}
.method public hidebysig static int32 test_104_conv_u_and_string() cil managed
{
.maxstack 8
ldstr "hello"
conv.u
call int32 [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::get_OffsetToStringData()
add
ldind.u2
ret
}
}
-1
View File
@@ -1070,7 +1070,6 @@ type_from_op (MonoCompile *cfg, MonoInst *ins, MonoInst *src1, MonoInst *src2)
break;
case STACK_PTR:
case STACK_MP:
case STACK_OBJ:
#if SIZEOF_VOID_P == 8
ins->opcode = OP_LCONV_TO_U;
#else
+1 -1
View File
@@ -841,7 +841,7 @@ PROFILE_DISABLED_TESTS += \
constant-division.exe \
dynamic-method-resurrection.exe \
assembly_append_ordering.exe \
assemblyresolve_event5.cs
assemblyresolve_event5.exe
# Test which needs System.Web support
PROFILE_DISABLED_TESTS += \
+1 -1
View File
@@ -22,7 +22,7 @@ IF NOT %ERRORLEVEL% == 0 (
ECHO copy %WIN_CONFIG_H% %CONFIG_H%
copy %WIN_CONFIG_H% %CONFIG_H%
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "(Get-Content %CONFIG_H%) -replace '#MONO_VERSION#', (Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value | Set-Content %CONFIG_H%" 2>&1
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "$mono_version=[int[]](Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value.Split('.'); $corlib_counter=[int](Select-String -path %CONFIGURE_AC% -pattern 'MONO_CORLIB_COUNTER=(.*)').Matches[0].Groups[1].Value; (Get-Content %CONFIG_H%) -replace '#MONO_CORLIB_VERSION#',('1{0:00}{1:00}{2:00}{3:000}' -f $mono_version[0],$mono_version[1],$mono_version[2],$corlib_counter) | Set-Content %CONFIG_H%" 2>&1
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -Command "$mono_version=[int[]](Select-String -path %CONFIGURE_AC% -pattern 'AC_INIT\(mono, \[(.*)\]').Matches[0].Groups[1].Value.Split('.'); $corlib_counter=[int](Select-String -path %CONFIGURE_AC% -pattern 'MONO_CORLIB_COUNTER=(.*)').Matches[0].Groups[1].Value; (Get-Content %CONFIG_H%) -replace '#MONO_CORLIB_VERSION#',('1{0:00}{1:00}{2:00}{3:000}' -f $mono_version[0],$mono_version[1],0,$corlib_counter) | Set-Content %CONFIG_H%" 2>&1
)
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -NonInteractive -File compare-config-files.ps1 %EGLIB_WIN_CONFIG_H% %EGLIB_CONFIG_H% 2>&1