Compare commits

...
66 Commits
Author SHA1 Message Date
Zoltan Varga 6a0d1e6c2f Fix a regression introduced by d84a165c8e. Unbox casts were failing for enums. Fixes #14026. 2013-08-20 16:09:12 +02:00
Zoltan Varga 25c255e84e [sgen] Disable freeing of OS memory on win32, it causes asserts because VirtualFree () fails. 2013-08-16 19:35:17 +02:00
Zoltan Varga 287f8facef Avoid infinite logfiles if the test-process-exit test fails to terminate. 2013-08-16 19:34:58 +02:00
Zoltan Varga 59d09f31d4 Remove the usage of gcc-3 on mingw, the gcc-3 package no longer exists on cygwin. Mono can be built by configuring with --host=i686-pc-mingw32. Building without this will not work, since the libtool wrapper executables created by libtool will be unusable, i.e. they exit before the real runtime process exits. 2013-08-16 19:34:35 +02:00
Zoltan Varga 4dbfdc81d9 Fix mingw compilation problems. 2013-08-16 19:34:27 +02:00
Zoltan Varga 7d8e9c0dab Fix monodis compilation on mingw which is missing some fp classification functions. 2013-08-16 19:34:20 +02:00
Mark Probst a0fc6ba35b Fix race conditions in finalizer/weak link staging. 2013-08-15 12:46:42 -04:00
Atsushi Eno 297dd55e8f Fix build (giconv.c) 2013-08-15 18:34:25 +02:00
Marek Safar 71f3133533 Add more implicit generic array interfaces. Fixes #8934 2013-08-15 11:07:41 +02:00
Jeffrey Stedfast 8926d0d648 [eglib] Fixed g_utf8_to_utf16_general() to handle invalid utf8 2013-08-14 19:49:53 -04:00
Jeffrey Stedfast 0c0f9d2bb4 Fixed configure.in to fail the __thread check with clang 2013-08-14 19:49:24 -04:00
Jeffrey Stedfast 5720291db0 Fixed some compiler warnings in libgc 2013-08-14 19:49:00 -04:00
Jeffrey Stedfast aa05566b97 Replaced call to sscanf() with calls to strtoull(). Better. Faster. Stronger. 2013-08-14 19:48:28 -04:00
Jeffrey Stedfast 2f15aea45b Fixed eglib compiler warnings about g_string_truncate() and g_iconv() 2013-08-14 19:47:48 -04:00
Jeffrey Stedfast b5a82acc07 Fixed some compiler warnings 2013-08-14 19:45:17 -04:00
Jeffrey Stedfast ab6ff1f921 Fixed System.Text.Decoder.GetChars(byte*,int,char*,int,bool) to copy output into the char* buffer. 2013-08-14 19:44:42 -04:00
Zoltan Varga fe1fe75fbd [sgen] Add a workaround for #13951. Register the jit info for GC critical methods as soon as they are loaded, and avoid lookups in the AOT images when calling mono_jit_info_table_find () during STW. 2013-08-14 16:45:43 +02:00
Marek Safar 4d71db0672 Don't crash when reporting invalid case label value. Fixes #13952 2013-08-14 15:33:09 +02:00
Jonathan Pryor f7ad68bc13 [mscorlib] Support OID names in RSACryptoServiceProvider.SignData()
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=13953

MSDN documents that RSACryptoServiceProvider.SignData()'s provider
paramter may contain an OID name:

http://msdn.microsoft.com/en-us/library/y2wf1b6k.aspx
> The halg parameter can accept a String, a HashAlgorithm, or a Type.
> The string value can be one of the following:
> * The object identifier (OID) friendly name of the hash algorithm to use,
>   either a name registered in the crypto config file or one in the
>   Crypto API OID table.
> * The OID value. The OID must be one recognized by the Crypto API.
> For example, you could use SignData(new byte[5], "1.3.14.3.2.26") or
> SignData(new byte[5], "sha1"), or SignData(new byte[5], "SHA1").

Add support for this OID names as the provider.
2013-08-13 12:12:44 -04:00
Jonathan Pryor eb66a378dc [System.Core/Android] Android's libc.so doesn't export getpagesize()
Partially fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=12739

Android's libc.so doesn't export getpagesize(3), resulting in an
EntryPointNotFoundException:

	System.EntryPointNotFoundException: getpagesize
	  at (wrapper managed-to-native) System.IO.MemoryMappedFiles.MemoryMapImpl.getpagesize ()
	  at System.IO.MemoryMappedFiles.MemoryMapImpl.Map (int,long,long&,System.IO.MemoryMappedFiles.MemoryMappedFileAccess,intptr&,int&)
	  at System.IO.MemoryMappedFiles.MemoryMappedViewAccessor.Create (long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
	  at System.IO.MemoryMappedFiles.MemoryMappedViewAccessor..ctor (int,long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)
	  at System.IO.MemoryMappedFiles.MemoryMappedFile.CreateViewAccessor (long,long,System.IO.MemoryMappedFiles.MemoryMappedFileAccess)

Android does provide getpagesize(3); it's just an inline function.

The full fix will require two parts:

 1. Update MemoryMapImpl to P/Invoke
    libmonodroid.so!monodroid_getpagesize()
 2. Add a libmonodroid.so!monodroid_getpagesize() export.

This commit implements (1).
2013-08-12 17:05:37 -04:00
Mark Probst 9087958e24 Fix #13604 - STW handshake/thread shutdown race condition. 2013-08-09 13:55:22 -07:00
Zoltan Varga 314dfb37d5 [aot] Avoid passing partially shared instances to the JIT. Fixes #13191. 2013-08-09 02:34:21 +02:00
Jonathan Pryor 43cfbb97b3 [mdoc-validate] Allow <format/> to have ANY content.
The intent of the <format/> element is to assist encapsulating
arbitrary HTML content within an mdoc(5) container. This frequently
requires having more than _one_ element within the <format/> block.

(WTF was I thinking forgetting the maxOccurs attribute?!)
2013-08-08 16:36:55 -04:00
Jonathan Pryor 71858945c3 [System.Core/Android] Support Android v4.3's timezone DB format
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=13686

Android v4.3 changed the timezone DB format described in 8a263984 and
replaced it with a single file containing version, index, data, and a
"zoneTab" (which is parsed but unused).

Port/rewrite the Java libcore.util.ZoneInfoDB type into
System.AndroidTzData so that this new file format is supported.

(Another day, another file format...)
2013-08-06 14:31:16 -04:00
Zoltan Varga d98dfc7ff9 [llvm] Disable LLVM for async methods to work around #13734. 2013-08-06 09:30:14 +02:00
Zoltan Varga 092cd532d5 Fix enum->int unbox casts in gsharedvt code. Fixes desk #42463. 2013-08-05 12:45:00 +02:00
Zoltan Varga 4a1716693f Quote path arguments to opt/llc. Fixes #13603. 2013-07-31 12:25:09 +02:00
Marek Safar 8594ecdc47 Clone arguments array before modifying. 2013-07-29 16:30:20 +02:00
Marek Safar 601b9d8ff5 Correctly parse pragma headers. Fixes #13501 2013-07-29 14:36:39 +02:00
Marek Safar fe6ec850fb Show more info for missing indirect assembly references 2013-07-27 08:58:55 +02:00
Marek Safar 851563a2ee Add clone for error expression. Fixes #13443 2013-07-26 23:46:10 +02:00
Jonathan Pryor 0d5681b488 [System] Support FTP download where PWD starts with '\'.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=13343

There are some Industrial Automation Hardware devices which return a
'\'-prefixed path to the FTP PWD command, which would break:

	System.UriFormatException: Invalid URI: The hostname could not be parsed.
	  at System.Uri.Parse (UriKind kind, System.String uriString)
	  at System.Uri.ParseUri (UriKind kind)
	  at System.Uri..ctor (System.String uriString, Boolean dontEscape)
	  at System.Uri..ctor (System.String uriString) [0x0000
	  at System.Net.FtpWebRequest.GetRemoteFolderPath (System.Uri uri)
	  at System.Net.FtpWebRequest.CWDAndSetFileName (System.Uri uri)
	  at System.Net.FtpWebRequest.ProcessMethod ()
	  at System.Net.FtpWebRequest.ProcessRequest ()
	There was an error connecting to the FTP Server.

The problem was this statement:

	Uri initial = new Uri ("ftp://dummy-host" + initial_path);

Since the FTP server was returning "\" to the PWD command,
`initial_path` was "\", and the above was equivalent to:

	Uri initial = new Uri (@"ftp://dummy-host\");

This results in the UriFormatException.

The solution is to not assume that `initial_path` will start with '/',
and instead use UriBuilder.
2013-07-26 16:28:54 -04:00
Alex Rønne Petersen ab1ffd462c Revert the use of mono_binary_search () in support/supportw.c.
This code can't depend on mono/utils and doesn't need the 'fixed'
implementation of bsearch () anyway since keys are never null.
2013-07-26 16:27:29 -04:00
Alex Rønne Petersen 01d52f9de4 Add a mono_binary_search () function.
This is a replacement for bsearch () because some platforms
have bogus asserts in their implementations.

Conflicts:
	mono/utils/Makefile.am
	msvc/libmonoutils.vcxproj
2013-07-26 16:27:17 -04:00
Marek Safar fc4074b399 Remove CultureInfo.CurrentCulture dependency from ordinal based string::EndsWith. Fixes #13509 2013-07-26 19:56:28 +02:00
Marek Safar 06c3be2f7f Lift result of enum substraction when operation is lifted due to non-nullable enum type. Fixes #13454 2013-07-26 16:31:14 +02:00
Marek Safar f9e6a8d043 Check promoted value type binary equality operations against null too. Fixes #13497 2013-07-26 13:52:57 +02:00
Marek Safar 14b2c98a04 Ignore space separators in nowarn arguments. Fixes #13476 2013-07-26 11:05:19 +02:00
Zoltan Varga b8c6612c28 Avoid an assert on android where seq points are not generated for wrappers. 2013-07-26 00:39:42 +02:00
Duncan Mak ffefa2dd78 Bump version to 3.2.2 2013-07-25 17:56:23 -04:00
Marek Safar ac5cd0ecc8 Add *CachePolicy to mobile profile. Fixes #13466 2013-07-25 17:25:00 +02:00
Zoltan Varga 777c482461 Properly null terminate strings in mono_dwarf_escape_path (). Fixes #13050. 2013-07-24 11:28:21 +02:00
Marek Safar c29b148609 Fix default content buffer max size 2013-07-23 14:29:13 +02:00
Marek Safar 4ac15ac2b5 Adds async handling to binary:emitbranchable. Fixes #13362 2013-07-22 08:26:46 +02:00
Mark Probst 4cb023eb7f Weaken a race condition in object initialization.
It's still there in a different form, but it's not easy to fix.
2013-07-17 16:57:31 -07:00
Marek Safar 71af84713e Fixes scheduling of non-inlined sychronous continuations. 2013-07-16 10:20:02 +02:00
Zoltan Varga 331b2cdb1e Disable a failing System.Core test for mt (#12987). 2013-07-15 20:49:58 -04:00
Zoltan Varga 96f89ed2e5 Put the unbox_trampolines table into the .text segment instead of .rodata on mt since it contains code. 2013-07-15 20:55:41 +02:00
Rodrigo Kumpera 74639ebf72 [runtime] Add a fallback on the TLS probing code that does a range scan in the pthread structure. 2013-07-15 12:31:29 -04:00
Marek Safar 588d52e205 Implement webrequest cancellation. Fixes #13200 2013-07-15 14:19:37 +02:00
Marek Safar a2ba6c3973 Prefer user operators over predefined operators for binary enum operations too. Fixes #13202 2013-07-12 16:33:03 +02:00
Marek Safar 007e816592 Allow async for explicitly implemented interface methods. Fixes #13197 2013-07-12 16:32:51 +02:00
Sebastien Pouliot 5d38f94238 Escape the .file path name generated in the asembly code. clang does not mind, but gcc does 2013-07-11 15:40:41 -04:00
Duncan Mak c02b7ff194 Bump mono to 3.1.2 2013-07-10 20:16:43 -04:00
Marek Safar 5f877073e0 Add await support in to evaluator and REPL 2013-07-10 15:44:09 +02:00
Marek Safar 5219618357 Loading of nested type of missing type needs to create another missing type. Fixes #12989 2013-07-10 15:43:44 +02:00
Marek Safar 9f4d1dc49f Interface members are hidden by class members if a type parameter has an effective base other than object 2013-07-10 15:43:23 +02:00
Marek Safar fbfd2ab406 Emit additional sequence points for call entry when needed. Fixes #10782 and similars 2013-07-10 15:42:32 +02:00
Marek Safar 9601199486 Equality structural comparer needs to do recursive comparisons. Fixes #13110 2013-07-10 15:41:37 +02:00
Rodrigo Kumpera bed040e520 [runtime]Revert the fast tls check as we always need it on mach. Add another iOS 7 offset. 2013-07-09 18:06:11 -04:00
Rodrigo Kumpera 5804e12677 [runtime] On mach-arm don't probe for tls offsets if the runtime was not built with support for fast tls. 2013-07-09 15:51:17 -04:00
Rodrigo Kumpera c07cb682b7 [runtime]On install, symlink mono to the right binary. 2013-07-09 13:27:18 -04:00
Zoltan Varga 7c084530b0 Place the method_addresses symbol into the .text segment on mt, not rodata, since it is actually code. 2013-07-09 00:27:43 +02:00
Rodrigo Kumpera 8b3e6c0526 Bump mono to 3.1.1 2013-07-08 17:47:00 -04:00
Zoltan Varga 7fbce79900 Avoid passing class pointers to some marshal icalls since its not aot compatible. Fixes #12595. 2013-07-08 22:47:55 +02:00
Zoltan Varga 13e536a659 Update the Mono LLVM EH Frame reading code to match llvm 5f3329c6d97bb765dc54592367087d9ce8cd0040. 2013-07-08 22:47:30 +02:00
136 changed files with 3162 additions and 1153 deletions

No files matched your search

Regular → Executable
+12 -18
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [3.1.0],
AC_INIT(mono, [3.2.2],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README])
@@ -105,22 +105,6 @@ case "$host" in
if test "x$host" == "x$build" -a "x$host" == "x$target"; then
AC_DEFINE(TARGET_WIN32,1,[Target OS is Win32])
fi
#
# gcc-3/g++-3 are from the gcc-core/gcc-g++ cygwin packages.
# Other gcc packages will not work:
# - the gcc-4 packages no longer support -mno-cygwin
# - the mingw-gcc packages produce executables which depends on a libgcc<...>
# dll, which means we would have to distribute that file too.
#
if test "x$CC" != "x"; then
AC_ERROR(Don't set CC. mono can only be compiled with gcc-3 from the 'gcc-core' package)
fi
CC="gcc-3.exe -mno-cygwin -g"
CXX="g++-3.exe -mno-cygwin -g"
# So libgc configure gets -mno-cygwin
export CC
export CXX
CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -mno-cygwin"
else
target_win32=yes
AC_DEFINE(TARGET_WIN32,1,[Target OS is Win32/MinGW])
@@ -491,6 +475,12 @@ AC_TRY_LINK([#include <math.h>], [
# We'll have to use signals
AC_MSG_RESULT(no)
])
# mingw
AC_CHECK_FUNCS(_finite, , AC_MSG_CHECKING(for _finite in math.h)
AC_TRY_LINK([#include <math.h>],
[ _finite(0.0); ],
AC_DEFINE(HAVE__FINITE, 1, [Have _finite in -lm]) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)))
# for Linux statfs support
AC_CHECK_HEADERS(linux/magic.h)
@@ -1583,6 +1573,10 @@ if test x$target_win32 = xno; then
AC_MSG_RESULT(disabled)
else
AC_TRY_RUN([
#ifdef __clang__
#error "__thread does not currently work with clang"
#endif
#include <pthread.h>
__thread int i;
static int res1, res2;
@@ -2486,7 +2480,7 @@ case "$host" in
have_visibility_hidden=no
sgen_supported=true
;;
cygwin*)
mingw*|cygwin*)
sgen_supported=true
have_visibility_hidden=no
;;
+58 -28
View File
@@ -174,14 +174,34 @@ gsize
g_iconv (GIConv cd, gchar **inbytes, gsize *inbytesleft,
gchar **outbytes, gsize *outbytesleft)
{
size_t inleft, outleft;
gsize inleft, outleft;
char *inptr, *outptr;
gunichar c;
int rc = 0;
#ifdef HAVE_ICONV
if (cd->cd != (iconv_t) -1)
return iconv (cd->cd, inbytes, inbytesleft, outbytes, outbytesleft);
if (cd->cd != (iconv_t) -1) {
/* Note: gsize may have a different size than size_t, so we need to
remap inbytesleft and outbytesleft to size_t's. */
size_t *outleftptr, *inleftptr;
size_t n_outleft, n_inleft;
if (inbytesleft) {
n_inleft = *inbytesleft;
inleftptr = &n_inleft;
} else {
inleftptr = NULL;
}
if (outbytesleft) {
n_outleft = *outbytesleft;
outleftptr = &n_outleft;
} else {
outleftptr = NULL;
}
return iconv (cd->cd, inbytes, inleftptr, outbytes, outleftptr);
}
#endif
if (outbytes == NULL || outbytesleft == NULL) {
@@ -640,7 +660,7 @@ gchar *
g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *from_charset,
gsize *bytes_read, gsize *bytes_written, GError **err)
{
size_t outsize, outused, outleft, inleft, grow, rc;
gsize outsize, outused, outleft, inleft, grow, rc;
char *result, *outbuf, *inbuf;
gboolean flush = FALSE;
gboolean done = FALSE;
@@ -676,7 +696,7 @@ g_convert (const gchar *str, gssize len, const gchar *to_charset, const gchar *f
else
rc = g_iconv (cd, NULL, NULL, &outbuf, &outleft);
if (rc == (size_t) -1) {
if (rc == (gsize) -1) {
switch (errno) {
case E2BIG:
/* grow our result buffer */
@@ -901,7 +921,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
size_t inleft;
char *inptr;
gunichar c;
int n;
int u, n;
g_return_val_if_fail (str != NULL, NULL);
@@ -910,6 +930,7 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED, "Conversions with embedded nulls must pass the string length");
return NULL;
}
len = strlen (str);
}
@@ -917,29 +938,18 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
inleft = len;
while (inleft > 0) {
if ((n = decode_utf8 (inptr, inleft, &c)) < 0) {
if (errno == EILSEQ) {
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
"Illegal byte sequence encounted in the input.");
} else if (items_read) {
/* partial input is ok if we can let our caller know... */
break;
} else {
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
"Partial byte sequence encountered in the input.");
}
if (items_read)
*items_read = inptr - str;
if (items_written)
*items_written = 0;
return NULL;
} else if (c == 0 && !include_nuls)
if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
goto error;
if (c == 0 && !include_nuls)
break;
outlen += g_unichar_to_utf16 (c, NULL);
if ((u = g_unichar_to_utf16 (c, NULL)) < 0) {
errno = EILSEQ;
goto error;
}
outlen += u;
inleft -= n;
inptr += n;
}
@@ -957,7 +967,8 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
while (inleft > 0) {
if ((n = decode_utf8 (inptr, inleft, &c)) < 0)
break;
else if (c == 0 && !include_nuls)
if (c == 0 && !include_nuls)
break;
outptr += g_unichar_to_utf16 (c, outptr);
@@ -968,6 +979,25 @@ eg_utf8_to_utf16_general (const gchar *str, glong len, glong *items_read, glong
*outptr = '\0';
return outbuf;
error:
if (errno == EILSEQ) {
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_ILLEGAL_SEQUENCE,
"Illegal byte sequence encounted in the input.");
} else if (items_read) {
/* partial input is ok if we can let our caller know... */
} else {
g_set_error (err, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
"Partial byte sequence encountered in the input.");
}
if (items_read)
*items_read = inptr - str;
if (items_written)
*items_written = 0;
return NULL;
}
gunichar2 *
+1 -2
View File
@@ -235,9 +235,8 @@ g_string_truncate (GString *string, gsize len)
g_return_val_if_fail (string != NULL, string);
/* Silent return */
if (len < 0 || len >= string->len) {
if (len >= string->len)
return string;
}
string->len = len;
string->str[len] = 0;
+1 -1
View File
@@ -969,7 +969,7 @@ word n;
}
# endif
expansion_slop = WORDS_TO_BYTES(min_words_allocd()) + 4*MAXHINCR*HBLKSIZE;
if (GC_last_heap_addr == 0 && !((word)space & SIGNB)
if ((GC_last_heap_addr == 0 && !((word)space & SIGNB))
|| (GC_last_heap_addr != 0 && GC_last_heap_addr < (ptr_t)space)) {
/* Assume the heap is growing up */
GC_greatest_plausible_heap_addr =
+1 -1
View File
@@ -22,7 +22,7 @@
# include "private/gc_priv.h"
map_entry_type * GC_invalid_map = 0;
static max_valid_offset = 0;
static word max_valid_offset = 0;
/* Invalidate the object map associated with a block. Free blocks */
/* are identified by invalid maps. */
+1 -1
View File
@@ -165,7 +165,7 @@ void (*GC_is_valid_displacement_print_proc) GC_PROTO((GC_PTR)) =
pdispl = HBLKDISPL(p);
map_entry = MAP_ENTRY((hhdr -> hb_map), pdispl);
if (map_entry == OBJ_INVALID
|| sz > MAXOBJBYTES && (ptr_t)p >= (ptr_t)h + sz) {
|| (sz > MAXOBJBYTES && (ptr_t)p >= (ptr_t)h + sz)) {
goto fail;
}
return(p);
@@ -139,5 +139,16 @@ namespace MonoTests.EvaluatorTest
Evaluator.Run ("d.GetType ();");
}
#endif
#if NET_4_5
[Test]
public void AwaitExpression ()
{
Evaluator.WaitOnTask = true;
var res = Evaluator.Evaluate("var res = await System.Threading.Tasks.Task.FromResult (1) + await System.Threading.Tasks.Task.FromResult (2);");
res = Evaluator.Evaluate ("res;");
Assert.AreEqual (3, res, "#1");
}
#endif
}
}
@@ -236,8 +236,18 @@ namespace System.IO.MemoryMappedFiles
[DllImport ("libc", SetLastError=true)]
static extern int open (string path, int flags, int access);
#if MONODROID
[DllImport ("__Internal")]
static extern int monodroid_getpagesize ();
static int getpagesize ()
{
return monodroid_getpagesize ();
}
#else
[DllImport ("libc")]
static extern int getpagesize ();
#endif
[MethodImplAttribute (MethodImplOptions.InternalCall)]
static extern long mono_filesize_from_path (string str);
@@ -29,10 +29,231 @@ using System.Text;
namespace System {
interface IAndroidTimeZoneDB {
IEnumerable<string> GetAvailableIds ();
byte[] GetTimeZoneData (string id);
}
[StructLayout (LayoutKind.Sequential, Pack=1)]
unsafe struct AndroidTzDataHeader {
public fixed byte signature [12];
public int indexOffset;
public int dataOffset;
public int zoneTabOffset;
}
[StructLayout (LayoutKind.Sequential, Pack=1)]
unsafe struct AndroidTzDataEntry {
public fixed byte id [40];
public int byteOffset;
public int length;
public int rawUtcOffset;
}
/*
* Android v4.3 Timezone support infrastructure.
*
* This is a C# port of libcore.util.ZoneInfoDB:
*
* https://android.googlesource.com/platform/libcore/+/master/luni/src/main/java/libcore/util/ZoneInfoDB.java
*
* This is needed in order to read Android v4.3 tzdata files.
*/
sealed class AndroidTzData : IAndroidTimeZoneDB {
internal static readonly string[] Paths = new string[]{
Environment.GetEnvironmentVariable ("ANDROID_DATA") + "/misc/zoneinfo/tzdata",
Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/tzdata",
};
string tzdataPath;
Stream data;
string version;
string zoneTab;
string[] ids;
int[] byteOffsets;
int[] lengths;
public AndroidTzData (params string[] paths)
{
foreach (var path in paths)
if (LoadData (path)) {
tzdataPath = path;
return;
}
Console.Error.WriteLine ("Couldn't find any tzdata!");
tzdataPath = "/";
version = "missing";
zoneTab = "# Emergency fallback data.\n";
ids = new[]{ "GMT" };
}
public string Version {
get {return version;}
}
public string ZoneTab {
get {return zoneTab;}
}
bool LoadData (string path)
{
if (!File.Exists (path))
return false;
try {
data = File.OpenRead (path);
} catch (IOException) {
return false;
} catch (UnauthorizedAccessException) {
return false;
}
try {
ReadHeader ();
return true;
} catch (Exception e) {
Console.Error.WriteLine ("tzdata file \"{0}\" was present but invalid: {1}", path, e);
}
return false;
}
unsafe void ReadHeader ()
{
int size = System.Math.Max (Marshal.SizeOf (typeof (AndroidTzDataHeader)), Marshal.SizeOf (typeof (AndroidTzDataEntry)));
var buffer = new byte [size];
var header = ReadAt<AndroidTzDataHeader>(0, buffer);
header.indexOffset = NetworkToHostOrder (header.indexOffset);
header.dataOffset = NetworkToHostOrder (header.dataOffset);
header.zoneTabOffset = NetworkToHostOrder (header.zoneTabOffset);
sbyte* s = (sbyte*) header.signature;
string magic = new string (s, 0, 6, Encoding.ASCII);
if (magic != "tzdata" || header.signature [11] != 0) {
var b = new StringBuilder ();
b.Append ("bad tzdata magic:");
for (int i = 0; i < 12; ++i) {
b.Append (" ").Append (((byte) s [i]).ToString ("x2"));
}
throw new InvalidOperationException ("bad tzdata magic: " + b.ToString ());
}
version = new string (s, 6, 5, Encoding.ASCII);
ReadIndex (header.indexOffset, header.dataOffset, buffer);
ReadZoneTab (header.zoneTabOffset, checked ((int) data.Length) - header.zoneTabOffset);
}
unsafe T ReadAt<T> (long position, byte[] buffer)
where T : struct
{
int size = Marshal.SizeOf (typeof (T));
if (buffer.Length < size)
throw new InvalidOperationException ("Internal error: buffer too small");
data.Position = position;
int r;
if ((r = data.Read (buffer, 0, size)) < size)
throw new InvalidOperationException (
string.Format ("Error reading '{0}': read {1} bytes, expected {2}", tzdataPath, r, size));
fixed (byte* b = buffer)
return (T) Marshal.PtrToStructure ((IntPtr) b, typeof (T));
}
static int NetworkToHostOrder (int value)
{
if (!BitConverter.IsLittleEndian)
return value;
return
(((value >> 24) & 0xFF) |
((value >> 08) & 0xFF00) |
((value << 08) & 0xFF0000) |
((value << 24)));
}
unsafe void ReadIndex (int indexOffset, int dataOffset, byte[] buffer)
{
int indexSize = dataOffset - indexOffset;
int entryCount = indexSize / Marshal.SizeOf (typeof (AndroidTzDataEntry));
int entrySize = Marshal.SizeOf (typeof (AndroidTzDataEntry));
byteOffsets = new int [entryCount];
ids = new string [entryCount];
lengths = new int [entryCount];
for (int i = 0; i < entryCount; ++i) {
var entry = ReadAt<AndroidTzDataEntry>(indexOffset + (entrySize*i), buffer);
var p = (sbyte*) entry.id;
byteOffsets [i] = NetworkToHostOrder (entry.byteOffset) + dataOffset;
ids [i] = new string (p, 0, GetStringLength (p, 40), Encoding.ASCII);
lengths [i] = NetworkToHostOrder (entry.length);
if (lengths [i] < Marshal.SizeOf (typeof (AndroidTzDataHeader)))
throw new InvalidOperationException ("Length in index file < sizeof(tzhead)");
}
}
static unsafe int GetStringLength (sbyte* s, int maxLength)
{
int len;
for (len = 0; len < maxLength; len++, s++) {
if (*s == 0)
break;
}
return len;
}
unsafe void ReadZoneTab (int zoneTabOffset, int zoneTabSize)
{
byte[] zoneTab = new byte [zoneTabSize];
data.Position = zoneTabOffset;
int r;
if ((r = data.Read (zoneTab, 0, zoneTab.Length)) < zoneTab.Length)
throw new InvalidOperationException (
string.Format ("Error reading zonetab: read {0} bytes, expected {1}", r, zoneTabSize));
this.zoneTab = Encoding.ASCII.GetString (zoneTab, 0, zoneTab.Length);
}
public IEnumerable<string> GetAvailableIds ()
{
return ids;
}
public byte[] GetTimeZoneData (string id)
{
int i = Array.BinarySearch (ids, id, StringComparer.Ordinal);
if (i < 0)
return null;
int offset = byteOffsets [i];
int length = lengths [i];
var buffer = new byte [length];
lock (data) {
data.Position = offset;
int r;
if ((r = data.Read (buffer, 0, buffer.Length)) < buffer.Length)
throw new InvalidOperationException (
string.Format ("Unable to fully read from file '{0}' at offset {1} length {2}; read {3} bytes expected {4}.",
tzdataPath, offset, length, r, buffer.Length));
}
return buffer;
}
}
partial class TimeZoneInfo {
/*
* Android Timezone support infrastructure.
* Android < v4.3 Timezone support infrastructure.
*
* This is a C# port of org.apache.harmony.luni.internal.util.ZoneInfoDB:
*
@@ -48,34 +269,35 @@ namespace System {
* which succinctly describes why we can't just use the LIBC implementation in
* TimeZoneInfo.cs -- the "standard Unixy" directory structure is NOT used.
*/
static class ZoneInfoDB {
sealed class ZoneInfoDB : IAndroidTimeZoneDB {
const int TimeZoneNameLength = 40;
const int TimeZoneIntSize = 4;
static readonly string ZoneDirectoryName = Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/";
static readonly string ZoneFileName = ZoneDirectoryName + "zoneinfo.dat";
static readonly string IndexFileName = ZoneDirectoryName + "zoneinfo.idx";
const string DefaultVersion = "2007h";
static readonly string VersionFileName = ZoneDirectoryName + "zoneinfo.version";
internal static readonly string ZoneDirectoryName = Environment.GetEnvironmentVariable ("ANDROID_ROOT") + "/usr/share/zoneinfo/";
static readonly object _lock = new object ();
const string ZoneFileName = "zoneinfo.dat";
const string IndexFileName = "zoneinfo.idx";
const string DefaultVersion = "2007h";
const string VersionFileName = "zoneinfo.version";
static readonly string version;
static readonly string[] names;
static readonly int[] starts;
static readonly int[] lengths;
static readonly int[] offsets;
readonly string zoneRoot;
readonly string version;
readonly string[] names;
readonly int[] starts;
readonly int[] lengths;
readonly int[] offsets;
static ZoneInfoDB ()
public ZoneInfoDB (string zoneInfoDB = null)
{
zoneRoot = zoneInfoDB ?? ZoneDirectoryName;
try {
version = ReadVersion ();
version = ReadVersion (Path.Combine (zoneRoot, VersionFileName));
} catch {
version = DefaultVersion;
}
try {
ReadDatabase (out names, out starts, out lengths, out offsets);
ReadDatabase (Path.Combine (zoneRoot, IndexFileName), out names, out starts, out lengths, out offsets);
} catch {
names = new string [0];
starts = new int [0];
@@ -84,16 +306,16 @@ namespace System {
}
}
static string ReadVersion ()
static string ReadVersion (string path)
{
using (var file = new StreamReader (VersionFileName, Encoding.GetEncoding ("iso-8859-1"))) {
using (var file = new StreamReader (path, Encoding.GetEncoding ("iso-8859-1"))) {
return file.ReadToEnd ().Trim ();
}
}
static void ReadDatabase (out string[] names, out int[] starts, out int[] lengths, out int[] offsets)
void ReadDatabase (string path, out string[] names, out int[] starts, out int[] lengths, out int[] offsets)
{
using (var file = File.OpenRead (IndexFileName)) {
using (var file = File.OpenRead (path)) {
var nbuf = new byte [TimeZoneNameLength];
int numEntries = (int) (file.Length / (TimeZoneNameLength + 3*TimeZoneIntSize));
@@ -140,21 +362,21 @@ namespace System {
((nbuf [2] & 0xff) << 8) + (nbuf [3] & 0xff);
}
internal static string Version {
internal string Version {
get {return version;}
}
internal static IEnumerable<string> GetAvailableIds ()
public IEnumerable<string> GetAvailableIds ()
{
return GetAvailableIds (0, false);
}
internal static IEnumerable<string> GetAvailableIds (int rawOffset)
IEnumerable<string> GetAvailableIds (int rawOffset)
{
return GetAvailableIds (rawOffset, true);
}
static IEnumerable<string> GetAvailableIds (int rawOffset, bool checkOffset)
IEnumerable<string> GetAvailableIds (int rawOffset, bool checkOffset)
{
for (int i = 0; i < offsets.Length; ++i) {
if (!checkOffset || offsets [i] == rawOffset)
@@ -162,21 +384,21 @@ namespace System {
}
}
static TimeZoneInfo _GetTimeZone (string name)
public byte[] GetTimeZoneData (string id)
{
int start, length;
using (var stream = GetTimeZoneData (name, out start, out length)) {
using (var stream = GetTimeZoneData (id, out start, out length)) {
if (stream == null)
return null;
byte[] buf = new byte [length];
Fill (stream, buf, buf.Length);
return TimeZoneInfo.ParseTZBuffer (name, buf, length);
return buf;
}
}
static FileStream GetTimeZoneData (string name, out int start, out int length)
FileStream GetTimeZoneData (string name, out int start, out int length)
{
var f = new FileInfo (Path.Combine (ZoneDirectoryName, name));
var f = new FileInfo (Path.Combine (zoneRoot, name));
if (f.Exists) {
start = 0;
length = (int) f.Length;
@@ -192,11 +414,48 @@ namespace System {
start = starts [i];
length = lengths [i];
var stream = File.OpenRead (ZoneFileName);
var stream = File.OpenRead (Path.Combine (zoneRoot, ZoneFileName));
stream.Seek (start, SeekOrigin.Begin);
return stream;
}
}
static class AndroidTimeZones {
static IAndroidTimeZoneDB db;
static AndroidTimeZones ()
{
db = GetDefaultTimeZoneDB ();
}
static IAndroidTimeZoneDB GetDefaultTimeZoneDB ()
{
foreach (var p in AndroidTzData.Paths)
if (File.Exists (p))
return new AndroidTzData (AndroidTzData.Paths);
if (Directory.Exists (ZoneInfoDB.ZoneDirectoryName))
return new ZoneInfoDB ();
return null;
}
internal static IEnumerable<string> GetAvailableIds ()
{
return db == null
? new string [0]
: db.GetAvailableIds ();
}
static TimeZoneInfo _GetTimeZone (string name)
{
if (db == null)
return null;
byte[] buffer = db.GetTimeZoneData (name);
if (buffer == null)
return null;
return TimeZoneInfo.ParseTZBuffer (name, buffer, buffer.Length);
}
internal static TimeZoneInfo GetTimeZone (string id)
{
@@ -211,7 +470,7 @@ namespace System {
try {
return _GetTimeZone (id);
} catch (Exception e) {
} catch (Exception) {
return null;
}
}
@@ -265,6 +524,8 @@ namespace System {
return sign * (hour * 60) * 60;
}
static readonly object _lock = new object ();
static TimeZoneInfo defaultZone;
internal static TimeZoneInfo Default {
get {
@@ -295,7 +556,7 @@ namespace System {
#if SELF_TEST
/*
* Compile:
* mcs /out:tzi.exe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs
* mcs /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
* Prep:
* mkdir -p usr/share/zoneinfo
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
@@ -305,17 +566,31 @@ namespace System {
*/
static void Main (string[] args)
{
Console.WriteLine ("Version: {0}", version);
for (int i = 0; i < names.Length; ++i) {
Console.Write ("{0,3}\tname={1,-40} start={2,-10} length={3,-4} offset=0x{4,8}",
i, names [i], starts [i], lengths [i], offsets [i].ToString ("x8"));
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
Mono.Options.OptionSet p = null;
p = new Mono.Options.OptionSet () {
{ "T=", "Create AndroidTzData from {PATH}.", v => {
c = () => new AndroidTzData (v);
} },
{ "Z=", "Create ZoneInfoDB from {DIR}.", v => {
c = () => new ZoneInfoDB (v);
} },
{ "help", "Show this message and exit", v => {
p.WriteOptionDescriptions (Console.Out);
Environment.Exit (0);
} },
};
p.Parse (args);
AndroidTimeZones.db = c ();
Console.WriteLine ("DB type: {0}", AndroidTimeZones.db.GetType ().FullName);
foreach (var id in GetAvailableIds ()) {
Console.Write ("name={0,-40}", id);
try {
TimeZoneInfo zone = _GetTimeZone (names [i]);
TimeZoneInfo zone = _GetTimeZone (id);
if (zone != null)
Console.Write (" {0}", zone);
else {
Console.Write (" ERROR:null Index? {0}",
Array.BinarySearch (names, names [i], StringComparer.Ordinal));
Console.Write (" ERROR:null");
}
} catch (Exception e) {
Console.WriteLine ();
+4 -4
View File
@@ -86,7 +86,7 @@ namespace System
get {
if (local == null) {
#if MONODROID
local = ZoneInfoDB.Default;
local = AndroidTimeZones.Default;
#elif MONOTOUCH
using (Stream stream = GetMonoTouchData (null)) {
local = BuildFromStream ("Local", stream);
@@ -394,7 +394,7 @@ namespace System
}
#endif
#if MONODROID
var timeZoneInfo = ZoneInfoDB.GetTimeZone (id);
var timeZoneInfo = AndroidTimeZones.GetTimeZone (id);
if (timeZoneInfo == null)
throw new TimeZoneNotFoundException ();
return timeZoneInfo;
@@ -619,8 +619,8 @@ namespace System
}
#endif
#if MONODROID
foreach (string id in ZoneInfoDB.GetAvailableIds ()) {
var tz = ZoneInfoDB.GetTimeZone (id);
foreach (string id in AndroidTimeZones.GetAvailableIds ()) {
var tz = AndroidTimeZones.GetTimeZone (id);
if (tz != null)
systemTimeZones.Add (tz);
}
@@ -163,6 +163,8 @@ namespace MonoTests.System.Linq.Expressions
}
[Test]
// #12987
[Category ("MobileNotWorking")]
public void CoalesceNullableSlotIntoInteger ()
{
var s = Expression.Parameter (typeof (Slot?), "s");
@@ -394,7 +394,7 @@ namespace System.Net.Http.Headers
switch (t.Kind) {
case Token.Type.SeparatorSemicolon:
if (!NameValueHeaderValue.ParseParameters (lexer, out parameters))
if (!NameValueHeaderValue.TryParseParameters (lexer, out parameters))
return false;
break;
case Token.Type.End:
@@ -50,7 +50,12 @@ namespace System.Net.Http.Headers
Debug.Assert (AllowsMany);
var c = (HttpHeaderValueCollection<U>) collection;
c.Add ((U) value);
var list = value as List<U>;
if (list != null)
c.AddRange (list);
else
c.Add ((U) value);
}
protected override object CreateCollection (HttpHeaders headers, HeaderInfo headerInfo)
@@ -106,6 +111,13 @@ namespace System.Net.Http.Headers
};
}
public static HeaderInfo CreateMultiList<T> (string name, TryParseDelegate<List<T>> parser, HttpHeaderKind headerKind) where T : class
{
return new HeaderTypeInfo<List<T>, T> (name, parser, headerKind) {
AllowsMany = true,
};
}
public object CreateCollection (HttpHeaders headers)
{
return CreateCollection (headers, this);
@@ -61,6 +61,11 @@ namespace System.Net.Http.Headers
list.Add (item);
}
internal void AddRange (List<T> values)
{
list.AddRange (values);
}
public void Clear ()
{
list.Clear ();
@@ -117,7 +117,7 @@ namespace System.Net.Http.Headers
HeaderInfo.CreateSingle<DateTimeOffset> ("Last-Modified", Parser.DateTime.TryParse, HttpHeaderKind.Content),
HeaderInfo.CreateSingle<Uri> ("Location", Parser.Uri.TryParse, HttpHeaderKind.Response),
HeaderInfo.CreateSingle<int> ("Max-Forwards", Parser.Int.TryParse, HttpHeaderKind.Request),
HeaderInfo.CreateMulti<NameValueHeaderValue> ("Pragma", NameValueHeaderValue.TryParse, HttpHeaderKind.Request | HttpHeaderKind.Response),
HeaderInfo.CreateMultiList<NameValueHeaderValue> ("Pragma", NameValueHeaderValue.TryParsePragma, HttpHeaderKind.Request | HttpHeaderKind.Response),
HeaderInfo.CreateMulti<AuthenticationHeaderValue> ("Proxy-Authenticate", AuthenticationHeaderValue.TryParse, HttpHeaderKind.Response),
HeaderInfo.CreateSingle<AuthenticationHeaderValue> ("Proxy-Authorization", AuthenticationHeaderValue.TryParse, HttpHeaderKind.Request),
HeaderInfo.CreateSingle<RangeHeaderValue> ("Range", RangeHeaderValue.TryParse, HttpHeaderKind.Request),
@@ -150,7 +150,7 @@ namespace System.Net.Http.Headers
switch (token.Value.Kind) {
case Token.Type.SeparatorSemicolon:
if (!NameValueHeaderValue.ParseParameters (lexer, out parameters))
if (!NameValueHeaderValue.TryParseParameters (lexer, out parameters))
return false;
break;
case Token.Type.End:
@@ -181,7 +181,7 @@ namespace System.Net.Http.Headers
switch (token.Value.Kind) {
case Token.Type.SeparatorSemicolon:
if (!NameValueHeaderValue.ParseParameters (lexer, out parameters))
if (!NameValueHeaderValue.TryParseParameters (lexer, out parameters))
return false;
break;
case Token.Type.End:
@@ -121,8 +121,18 @@ namespace System.Net.Http.Headers
throw new FormatException (input);
}
internal static bool ParseParameters (Lexer lexer, out List<NameValueHeaderValue> result)
internal static bool TryParseParameters (Lexer lexer, out List<NameValueHeaderValue> result)
{
return TryParseCollection (lexer, out result, Token.Type.SeparatorSemicolon);
}
internal static bool TryParsePragma (string input, out List<NameValueHeaderValue> result)
{
return TryParseCollection (new Lexer (input), out result, Token.Type.SeparatorComma);
}
static bool TryParseCollection (Lexer lexer, out List<NameValueHeaderValue> result, Token.Type separator)
{
var list = new List<NameValueHeaderValue> ();
result = null;
@@ -146,7 +156,7 @@ namespace System.Net.Http.Headers
t = lexer.Scan ();
}
if (t == Token.Type.SeparatorSemicolon || t == Token.Type.End) {
if (t == separator|| t == Token.Type.End) {
list.Add (new NameValueHeaderValue () {
Name = lexer.GetStringValue (attr),
value = value
@@ -155,7 +165,7 @@ namespace System.Net.Http.Headers
return false;
}
} while (t == Token.Type.SeparatorSemicolon);
} while (t == separator);
result = list;
return true;
@@ -103,7 +103,7 @@ namespace System.Net.Http.Headers
public static bool TryParse (string input, out NameValueWithParametersHeaderValue parsedValue)
{
List<NameValueHeaderValue> values;
if (!ParseParameters (new Lexer (input), out values)) {
if (!TryParseParameters (new Lexer (input), out values)) {
parsedValue = null;
return false;
}
@@ -125,7 +125,7 @@ namespace System.Net.Http.Headers
// Parameters parsing
if (t == Token.Type.SeparatorSemicolon) {
if (!NameValueHeaderValue.ParseParameters (lexer, out result.parameters))
if (!NameValueHeaderValue.TryParseParameters (lexer, out result.parameters))
return false;
} else if (t != Token.Type.End) {
return false;
@@ -312,8 +312,22 @@ namespace System.Net.Http
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
}
// FIXME: GetResponseAsync does not accept cancellationToken
var wresponse = (HttpWebResponse) await wrequest.GetResponseAsync ().ConfigureAwait (false);
HttpWebResponse wresponse = null;
using (cancellationToken.Register (l => ((HttpWebRequest) l).Abort (), wrequest)) {
try {
wresponse = (HttpWebResponse) await wrequest.GetResponseAsync ().ConfigureAwait (false);
} catch (WebException we) {
if (we.Status != WebExceptionStatus.RequestCanceled)
throw;
}
if (cancellationToken.IsCancellationRequested) {
var cancelled = new TaskCompletionSource<HttpResponseMessage> ();
cancelled.SetCanceled ();
return await cancelled.Task;
}
}
return CreateResponseMessage (wresponse, request);
}
}
@@ -119,7 +119,7 @@ namespace System.Net.Http
public Task LoadIntoBufferAsync ()
{
return LoadIntoBufferAsync (65536);
return LoadIntoBufferAsync (int.MaxValue);
}
public async Task LoadIntoBufferAsync (long maxBufferSize)
@@ -219,6 +219,12 @@ namespace MonoTests.System.Net.Http
} catch (FormatException) {
}
try {
headers.Add ("pragma", "nocache,RequestID=1,g=");
Assert.Fail ("pragma");
} catch (FormatException) {
}
headers.Add ("accept", "audio/y");
headers.Add ("accept-charset", "achs");
headers.Add ("accept-encoding", "aenc");
@@ -226,7 +232,6 @@ namespace MonoTests.System.Net.Http
headers.Add ("expect", "exp");
headers.Add ("if-match", "\"v\"");
headers.Add ("if-none-match", "\"v2\"");
headers.Add ("pragma", "p");
headers.Add ("TE", "0.8");
headers.Add ("trailer", "value2");
headers.Add ("transfer-encoding", "ttt");
@@ -234,6 +239,7 @@ namespace MonoTests.System.Net.Http
headers.Add ("user-agent", "uaua");
headers.Add ("via", "prot v");
headers.Add ("warning", "4 ww \"t\"");
headers.Add ("pragma", "nocache,R=1,g");
Assert.IsTrue (headers.Accept.SequenceEqual (
new[] {
@@ -296,7 +302,6 @@ namespace MonoTests.System.Net.Http
Assert.IsTrue (headers.IfNoneMatch.SequenceEqual (new EntityTagHeaderValue[] { new EntityTagHeaderValue ("\"tag2\"", true), new EntityTagHeaderValue ("\"v2\"", false) }));
Assert.AreEqual (new DateTimeOffset (DateTime.Today), headers.IfRange.Date);
Assert.AreEqual (headers.MaxForwards, 0x15b3);
Assert.IsTrue (headers.Pragma.SequenceEqual (new NameValueHeaderValue[] { new NameValueHeaderValue ("name", "value"), new NameValueHeaderValue ("p", null) }));
Assert.AreEqual ("p", headers.ProxyAuthorization.Parameter);
Assert.AreEqual ("s", headers.ProxyAuthorization.Scheme);
Assert.AreEqual (5, headers.Range.Ranges.First ().From);
@@ -345,6 +350,14 @@ namespace MonoTests.System.Net.Http
}
));
Assert.IsTrue (headers.Pragma.SequenceEqual (
new[] {
new NameValueHeaderValue ("name", "value"),
new NameValueHeaderValue ("nocache", null),
new NameValueHeaderValue ("R", "1"),
new NameValueHeaderValue ("g", null)
}
));
}
[Test]
+6 -1
View File
@@ -549,7 +549,12 @@ namespace System.Net
if (local_path [0] == '/')
local_path = local_path.Substring (1);
Uri initial = new Uri ("ftp://dummy-host" + initial_path);
UriBuilder initialBuilder = new UriBuilder () {
Scheme = "ftp",
Host = "dummy-host",
Path = initial_path,
};
Uri initial = initialBuilder.Uri;
result = new Uri (initial, local_path).LocalPath;
}
+6 -14
View File
@@ -58,24 +58,17 @@ namespace System.Net
static HybridDictionary prefixes = new HybridDictionary ();
static bool isDefaultWebProxySet;
static IWebProxy defaultWebProxy;
#if !NET_2_1
static RequestCachePolicy defaultCachePolicy;
#endif
// Constructors
static WebRequest ()
{
#if NET_2_1
#if MOBILE
IWebRequestCreate http = new HttpRequestCreator ();
RegisterPrefix ("http", http);
RegisterPrefix ("https", http);
#if MOBILE
RegisterPrefix ("file", new FileWebRequestCreator ());
RegisterPrefix ("ftp", new FtpRequestCreator ());
#endif
#else
defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore);
#if CONFIGURATION_DEP
object cfg = ConfigurationManager.GetSection ("system.net/webRequestModules");
WebRequestModulesSection s = cfg as WebRequestModulesSection;
@@ -137,7 +130,6 @@ namespace System.Net
set { throw GetMustImplement (); }
}
#if !NET_2_1
[MonoTODO ("Implement the caching system. Currently always returns a policy with the NoCacheNoStore level")]
public virtual RequestCachePolicy CachePolicy
{
@@ -146,14 +138,14 @@ namespace System.Net
}
}
public static RequestCachePolicy DefaultCachePolicy
{
get { return defaultCachePolicy; }
public static RequestCachePolicy DefaultCachePolicy {
get {
return defaultCachePolicy ?? (defaultCachePolicy = new HttpRequestCachePolicy (HttpRequestCacheLevel.NoCacheNoStore));
}
set {
throw GetMustImplement ();
}
}
#endif
public virtual WebHeaderCollection Headers {
get { throw GetMustImplement (); }
@@ -203,7 +203,11 @@ namespace MonoTests.System.Net
[Test]
public void DownloadFile1 ()
{
ServerDownload sp = new ServerDownload ();
DownloadFile (new ServerDownload ());
}
void DownloadFile (ServerDownload sp)
{
sp.Start ();
string uri = String.Format ("ftp://{0}:{1}/file.txt", sp.IPAddress, sp.Port);
try {
@@ -228,6 +232,14 @@ namespace MonoTests.System.Net
}
}
[Test]
public void DownloadFile2 ()
{
// Some embedded FTP servers in Industrial Automation Hardware report
// the PWD using backslashes, but allow forward slashes for CWD.
DownloadFile (new ServerDownload (@"\Users\someuser", "/Users/someuser/"));
}
[Test]
public void DeleteFile1 ()
{
@@ -377,6 +389,20 @@ namespace MonoTests.System.Net
}
class ServerDownload : FtpServer {
string Pwd, Cwd;
public ServerDownload ()
: this (null, null)
{
}
public ServerDownload (string pwd, string cwd)
{
Pwd = pwd ?? "/home/someuser";
Cwd = cwd ?? "/home/someuser/";
}
protected override void Run ()
{
Socket client = control.Accept ();
@@ -388,7 +414,7 @@ namespace MonoTests.System.Net
return;
}
if (!DoInitialDialog (writer, reader, "/home/someuser", "/home/someuser/")) {
if (!DoInitialDialog (writer, reader, Pwd, Cwd)) {
client.Close ();
return;
}
@@ -45,7 +45,7 @@ namespace System.Collections
int IEqualityComparer.GetHashCode (object obj)
{
var comparer = obj as IEqualityComparer;
var comparer = obj as IStructuralEquatable;
if (comparer != null)
return comparer.GetHashCode (this);
@@ -54,7 +54,7 @@ namespace System.Collections
bool IEqualityComparer.Equals (object x, object y)
{
var comparer = x as IEqualityComparer;
var comparer = x as IStructuralEquatable;
if (comparer != null)
return comparer.Equals (y, this);
@@ -235,7 +235,7 @@ namespace System.Security.Cryptography {
HashAlgorithm hash = null;
if (halg is String)
hash = HashAlgorithm.Create ((String)halg);
hash = GetHashFromString ((string) halg);
else if (halg is HashAlgorithm)
hash = (HashAlgorithm) halg;
else if (halg is Type)
@@ -243,8 +243,25 @@ namespace System.Security.Cryptography {
else
throw new ArgumentException ("halg");
if (hash == null)
throw new ArgumentException (
"Could not find provider for halg='" + halg + "'.",
"halg");
return hash;
}
private HashAlgorithm GetHashFromString (string name)
{
HashAlgorithm hash = HashAlgorithm.Create (name);
if (hash != null)
return hash;
try {
return HashAlgorithm.Create (GetHashNameFromOID (name));
} catch (CryptographicException e) {
throw new ArgumentException (e.Message, "halg", e);
}
}
// NOTE: this method can work with ANY configured (OID in machine.config)
// HashAlgorithm descendant
+3 -2
View File
@@ -108,10 +108,11 @@ public abstract class Decoder
CheckArguments (chars, charCount, bytes, byteCount);
char [] carr = new char [charCount];
Marshal.Copy ((IntPtr) chars, carr, 0, charCount);
byte [] barr = new byte [byteCount];
Marshal.Copy ((IntPtr) bytes, barr, 0, byteCount);
return GetChars (barr, 0, byteCount, carr, 0, flush);
int charsUsed = GetChars (barr, 0, byteCount, carr, 0, flush);
Marshal.Copy (carr, 0, (IntPtr) chars, charsUsed);
return charsUsed;
}
[ComVisible (false)]
@@ -225,7 +225,7 @@ namespace System.Threading.Tasks
}
Status = saveStatus;
Start (scheduler);
Schedule ();
Wait ();
}
#endregion
+2 -2
View File
@@ -1694,9 +1694,9 @@ namespace System
case StringComparison.InvariantCultureIgnoreCase:
return CultureInfo.InvariantCulture.CompareInfo.IsSuffix (this, value, CompareOptions.IgnoreCase);
case StringComparison.Ordinal:
return CultureInfo.CurrentCulture.CompareInfo.IsSuffix (this, value, CompareOptions.Ordinal);
return CultureInfo.InvariantCulture.CompareInfo.IsSuffix (this, value, CompareOptions.Ordinal);
case StringComparison.OrdinalIgnoreCase:
return CultureInfo.CurrentCulture.CompareInfo.IsSuffix (this, value, CompareOptions.OrdinalIgnoreCase);
return CultureInfo.InvariantCulture.CompareInfo.IsSuffix (this, value, CompareOptions.OrdinalIgnoreCase);
default:
string msg = Locale.GetText ("Invalid value '{0}' for StringComparison", comparisonType);
throw new ArgumentException (msg, "comparisonType");
@@ -0,0 +1,55 @@
//
// StructuralComparisonsTest.cs
//
// Authors:
// Marek Safar <[email protected]>
//
// Copyright (C) 2013 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
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_4_0
using System.Collections;
using NUnit.Framework;
namespace MonoTests.System.Collections
{
[TestFixture]
public class StructuralComparisonsTest
{
[Test]
public void EqualsTest ()
{
int[] a1 = new[] { 9, 1, 3, 4 };
int[] a2 = new[] { 9, 1, 3, 4 };
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (a1, a2), "#1");
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (null, a2), "#2");
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (a1, null), "#3");
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (null, null), "#4");
Assert.IsTrue (StructuralComparisons.StructuralEqualityComparer.Equals (4, 4), "#5");
Assert.IsFalse (StructuralComparisons.StructuralEqualityComparer.Equals (4, 5), "#6");
}
}
}
#endif
@@ -262,6 +262,26 @@ public class RSACryptoServiceProviderTest {
rsa.SignData (data, MD5.Create ());
}
[Test]
[ExpectedException (typeof (ArgumentException))]
public void SignDataWithInvalidOid ()
{
byte[] data = new byte [5];
rsa = new RSACryptoServiceProvider (minKeySize);
rsa.SignData (data, "1.2.3");
}
[Test]
public void SignDataWithOid ()
{
string oid = CryptoConfig.MapNameToOID ("SHA256");
byte[] data = new byte [5];
rsa = new RSACryptoServiceProvider (minKeySize);
rsa.SignData (data, oid);
}
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void SignHashNullValue ()
@@ -67,6 +67,25 @@ namespace MonoTests.System.Threading.Tasks
}
}
class NonInlineableScheduler : TaskScheduler
{
protected override IEnumerable<Task> GetScheduledTasks ()
{
throw new NotImplementedException ();
}
protected override void QueueTask (Task task)
{
if (!base.TryExecuteTask (task))
throw new ApplicationException ();
}
protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
{
return false;
}
}
Task[] tasks;
const int max = 6;
@@ -1638,6 +1657,16 @@ namespace MonoTests.System.Threading.Tasks
Assert.AreEqual ('d', d.Result, "#3r");
}
[Test]
public void ContinueWith_CustomScheduleRejected ()
{
var scheduler = new NonInlineableScheduler ();
var t = Task.Factory.StartNew (delegate { }).
ContinueWith (r => {}, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, scheduler);
Assert.IsTrue (t.Wait (5000));
}
[Test]
public void FromResult ()
{
+1
View File
@@ -39,6 +39,7 @@ System.Collections/QueueTest.cs
System.Collections/ReadOnlyCollectionBaseTest.cs
System.Collections/SortedListTest.cs
System.Collections/StackTest.cs
System.Collections/StructuralComparisonsTest.cs
System.Collections.Generic/ComparerTest.cs
System.Collections.Generic/DictionaryTest.cs
System.Collections.Generic/EqualityComparerTest.cs
+31
View File
@@ -0,0 +1,31 @@
.assembly extern mscorlib
{
}
.assembly extern 'CS0012-lib-missing'
{
}
.assembly 'CS0012-21-lib'
{
.hash algorithm 0x00008004
.ver 0:0:0:0
}
.module 'CS0012-21-lib.dll'
.class public auto ansi beforefieldinit B
extends class ['CS0012-lib-missing']X`1/Y/Z/W<int32>
{
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 8
IL_0000: ldarg.0
IL_0001: call instance void class ['CS0012-lib-missing']X`1/Y/Z/W<int32>::.ctor()
IL_0006: ret
}
}
+1 -1
View File
@@ -21,7 +21,7 @@ DISTFILES = \
$(wildcard dlls/second/*.cs)
TEST_SUPPORT_FILES = \
CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0029-26-lib.dll \
CS0012-lib.dll CS0012-2-lib.dll CS0012-3-lib.dll CS0012-4-lib.dll CS0012-5-lib.dll CS0012-6-lib.dll CS0012-9-lib.dll CS0012-10-lib.dll CS0012-11-lib.dll CS0012-12-lib.dll CS0012-13-lib.dll CS0012-14-lib.dll CS0012-15-lib.dll CS0012-16-lib.dll CS0012-17-lib.dll CS0012-18-lib.dll CS0012-21-lib.dll CS0029-26-lib.dll \
CS0103-2-lib.dll CS0118-2-lib.dll CS0122-8-lib.dll CS0122-10-lib.dll CS0122-14-lib.dll CS0122-15-lib.dll CS0122-19-lib.dll CS0122-35-lib.dll CS0122-36-lib.dll CS0143-lib.dll CS0144-3-lib.dll CS0165-19-lib.dll \
CS0205-3-lib.dll CS0229-3-lib.dll CS0229-4-lib.dll CS0266-25-lib.dll \
CS0315-2-lib.dll \
+11
View File
@@ -0,0 +1,11 @@
// CS0012: The type `X`1.Y.Z.W' is defined in an assembly that is not referenced. Consider adding a reference to assembly `CS0012-lib-missing, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
// Line: 9
// Compiler options: -r:CS0012-21-lib.dll
public class C
{
public static void Main ()
{
new B ();
}
}
+18
View File
@@ -0,0 +1,18 @@
// CS0150: A constant value is expected
// Line : 14
using System;
public class Blah
{
static readonly string Test;
public static void Main ()
{
string s = null;
switch (s) {
case Blah.Test:
break;
}
}
}
+14
View File
@@ -0,0 +1,14 @@
// CS0472: The result of comparing value type `byte' with null is always `false'
// Line: 9
// Compiler options: -warnaserror -warn:2
class C
{
public static bool Test (byte value)
{
if (value == null)
return false;
return true;
}
}
+36 -28
View File
@@ -195,7 +195,9 @@ namespace Mono.CSharp
protected override void DoEmit (EmitContext ec)
{
GetResultExpression (ec).Emit (ec);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
GetResultExpression (ec).Emit (ec);
}
}
public Expression GetResultExpression (EmitContext ec)
@@ -224,34 +226,34 @@ namespace Mono.CSharp
var fe_awaiter = new FieldExpr (awaiter, loc);
fe_awaiter.InstanceExpression = new CompilerGeneratedThis (ec.CurrentType, loc);
//
// awaiter = expr.GetAwaiter ();
//
Label skip_continuation = ec.DefineLabel ();
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
//
// awaiter = expr.GetAwaiter ();
//
fe_awaiter.EmitAssign (ec, expr, false, false);
Expression completed_expr;
if (IsDynamic) {
var rc = new ResolveContext (ec.MemberContext);
Arguments dargs = new Arguments (1);
dargs.Add (new Argument (fe_awaiter));
completed_expr = new DynamicMemberBinder ("IsCompleted", dargs, loc).Resolve (rc);
dargs = new Arguments (1);
dargs.Add (new Argument (completed_expr));
completed_expr = new DynamicConversion (ec.Module.Compiler.BuiltinTypes.Bool, 0, dargs, loc).Resolve (rc);
} else {
var pe = PropertyExpr.CreatePredefined (awaiter_definition.IsCompleted, loc);
pe.InstanceExpression = fe_awaiter;
completed_expr = pe;
}
completed_expr.EmitBranchable (ec, skip_continuation, true);
}
Label skip_continuation = ec.DefineLabel ();
Expression completed_expr;
if (IsDynamic) {
var rc = new ResolveContext (ec.MemberContext);
Arguments dargs = new Arguments (1);
dargs.Add (new Argument (fe_awaiter));
completed_expr = new DynamicMemberBinder ("IsCompleted", dargs, loc).Resolve (rc);
dargs = new Arguments (1);
dargs.Add (new Argument (completed_expr));
completed_expr = new DynamicConversion (ec.Module.Compiler.BuiltinTypes.Bool, 0, dargs, loc).Resolve (rc);
} else {
var pe = PropertyExpr.CreatePredefined (awaiter_definition.IsCompleted, loc);
pe.InstanceExpression = fe_awaiter;
completed_expr = pe;
}
completed_expr.EmitBranchable (ec, skip_continuation, true);
base.DoEmit (ec);
//
@@ -741,7 +743,9 @@ namespace Mono.CSharp
var args = new Arguments (2);
args.Add (new Argument (awaiter, Argument.AType.Ref));
args.Add (new Argument (new CompilerGeneratedThis (CurrentType, Location), Argument.AType.Ref));
mg.EmitCall (ec, args);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
mg.EmitCall (ec, args);
}
}
public void EmitInitializer (EmitContext ec)
@@ -817,7 +821,9 @@ namespace Mono.CSharp
Arguments args = new Arguments (1);
args.Add (new Argument (exceptionVariable));
mg.EmitCall (ec, args);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
mg.EmitCall (ec, args);
}
}
public void EmitSetResult (EmitContext ec)
@@ -839,7 +845,9 @@ namespace Mono.CSharp
args.Add (new Argument (new LocalVariableReference (hoisted_return, Location)));
}
mg.EmitCall (ec, args);
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
mg.EmitCall (ec, args);
}
}
protected override TypeSpec[] ResolveBaseTypes (out FullNamedExpression base_class)
+5 -5
View File
@@ -356,7 +356,6 @@ namespace Mono.CSharp
public string GetSignatureForMetadata ()
{
#if STATIC
if (Parent is TypeDefinition) {
return Parent.GetSignatureForMetadata () + "+" + TypeNameParser.Escape (MemberName.Basename);
}
@@ -364,9 +363,6 @@ namespace Mono.CSharp
var sb = new StringBuilder ();
CreateMetadataName (sb);
return sb.ToString ();
#else
throw new NotImplementedException ();
#endif
}
public virtual void RemoveContainer (TypeContainer cont)
@@ -3334,7 +3330,11 @@ namespace Mono.CSharp
Parent.PartialContainer.VerifyImplements (this);
}
ModifiersExtensions.Check (Modifiers.AllowedExplicitImplFlags, explicit_mod_flags, 0, Location, Report);
Modifiers allowed_explicit = Modifiers.AllowedExplicitImplFlags;
if (this is Method)
allowed_explicit |= Modifiers.ASYNC;
ModifiersExtensions.Check (allowed_explicit, explicit_mod_flags, 0, Location, Report);
}
return base.Define ();
+16 -5
View File
@@ -248,6 +248,21 @@ namespace Mono.CSharp
return true;
}
public void MarkCallEntry (Location loc)
{
if (!EmitAccurateDebugInfo)
return;
//
// TODO: This should emit different kind of sequence point to make
// step-over work for statement over multiple lines
//
// Debugging experience for Foo (A () + B ()) where A and B are
// on separate lines is not great
//
Mark (loc);
}
public void DefineLocalVariable (string name, LocalBuilder builder)
{
if ((flags & Options.OmitDebugInfo) != 0)
@@ -1014,11 +1029,7 @@ namespace Mono.CSharp
// Emit explicit sequence point for expressions like Foo.Bar () to help debugger to
// break at right place when LHS expression can be stepped-into
//
// TODO: The list is probably not comprehensive, need to do more testing
//
if (InstanceExpression is PropertyExpr || InstanceExpression is Invocation || InstanceExpression is IndexerExpr ||
InstanceExpression is New || InstanceExpression is DelegateInvocation)
ec.Mark (loc.Value);
ec.MarkCallEntry (loc.Value);
}
//
+2 -2
View File
@@ -34,7 +34,7 @@ namespace Mono.CSharp {
//
static bool ArrayToIList (ArrayContainer array, TypeSpec list, bool isExplicit)
{
if (array.Rank != 1 || !list.IsGenericIterateInterface)
if (array.Rank != 1 || !list.IsArrayGenericInterface)
return false;
var arg_type = list.TypeArguments[0];
@@ -55,7 +55,7 @@ namespace Mono.CSharp {
static bool IList_To_Array(TypeSpec list, ArrayContainer array)
{
if (array.Rank != 1 || !list.IsGenericIterateInterface)
if (array.Rank != 1 || !list.IsArrayGenericInterface)
return false;
var arg_type = list.TypeArguments[0];
+16 -11
View File
@@ -116,6 +116,8 @@ namespace Mono.CSharp
// Keeps track of global data changes to undo on parser error
//
public Undo undo;
bool? interactive_async;
Stack<Linq.QueryBlock> linq_clause_blocks;
@@ -3926,6 +3928,9 @@ unary_expression
} else if (current_anonymous_method is AnonymousMethodExpression) {
report.Error (4035, GetLocation ($1),
"The `await' operator can only be used when its containing anonymous method is marked with the `async' modifier");
} else if (interactive_async != null) {
current_block.Explicit.RegisterAsyncAwait ();
interactive_async = true;
} else {
report.Error (4033, GetLocation ($1),
"The `await' operator can only be used when its containing method is marked with the `async' modifier");
@@ -5377,10 +5382,7 @@ interactive_statement_expression
: expression
{
Expression expr = (Expression) $1;
ExpressionStatement s;
s = new OptionalAssign (new SimpleName ("$retval", lexer.Location), expr, lexer.Location);
$$ = new StatementExpression (s);
$$ = new StatementExpression (new OptionalAssign (expr, lexer.Location));
}
| error
{
@@ -6653,27 +6655,30 @@ interactive_parsing
mods |= Modifiers.UNSAFE;
current_local_parameters = pars;
Method method = new Method (
var method = new InteractiveMethod (
current_type,
new TypeExpression (compiler.BuiltinTypes.Void, Location.Null),
mods,
new MemberName ("Host"),
pars,
null /* attributes */);
pars);
current_type.AddMember (method);
oob_stack.Push (method);
interactive_async = false;
++lexer.parsing_block;
start_block (lexer.Location);
}
interactive_statement_list opt_COMPLETE_COMPLETION
{
--lexer.parsing_block;
Method method = (Method) oob_stack.Pop ();
var method = (InteractiveMethod) oob_stack.Pop ();
method.Block = (ToplevelBlock) end_block(lexer.Location);
if (interactive_async == true) {
method.ChangeToAsync ();
}
InteractiveResult = (Class) pop_current_class ();
current_local_parameters = null;
}
+10 -5
View File
@@ -1085,7 +1085,12 @@ namespace Mono.CSharp {
// will contain types only but it can have numerous values for members
// like methods where both return type and all parameters are checked
//
public List<TypeSpec> GetMissingDependencies ()
public List<MissingTypeSpecReference> GetMissingDependencies ()
{
return GetMissingDependencies (this);
}
public List<MissingTypeSpecReference> GetMissingDependencies (MemberSpec caller)
{
if ((state & (StateFlags.MissingDependency | StateFlags.MissingDependency_Undetected)) == 0)
return null;
@@ -1093,11 +1098,11 @@ namespace Mono.CSharp {
state &= ~StateFlags.MissingDependency_Undetected;
var imported = definition as ImportedDefinition;
List<TypeSpec> missing;
List<MissingTypeSpecReference> missing;
if (imported != null) {
missing = ResolveMissingDependencies ();
missing = ResolveMissingDependencies (caller);
} else if (this is ElementTypeSpec) {
missing = ((ElementTypeSpec) this).Element.GetMissingDependencies ();
missing = ((ElementTypeSpec) this).Element.GetMissingDependencies (caller);
} else {
missing = null;
}
@@ -1109,7 +1114,7 @@ namespace Mono.CSharp {
return missing;
}
public abstract List<TypeSpec> ResolveMissingDependencies ();
public abstract List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller);
protected virtual bool IsNotCLSCompliant (out bool attrValue)
{
+1 -1
View File
@@ -857,7 +857,7 @@ namespace Mono.CSharp {
//
var call = new CallEmitter ();
call.InstanceExpression = InstanceExpr;
call.EmitPredefined (ec, method, arguments);
call.EmitPredefined (ec, method, arguments, loc);
}
public override void EmitStatement (EmitContext ec)
+66 -3
View File
@@ -519,8 +519,8 @@ namespace Mono.CSharp {
Constant c = expr as Constant;
if (c == null) {
if (c.type != InternalType.ErrorType)
rc.Report.Error (150, StartLocation, "A constant value is expected");
if (expr.type != InternalType.ErrorType)
rc.Report.Error (150, expr.StartLocation, "A constant value is expected");
return null;
}
@@ -778,8 +778,18 @@ namespace Mono.CSharp {
}
if ((restrictions & MemberLookupRestrictions.InvocableOnly) != 0) {
if (member is MethodSpec)
if (member is MethodSpec) {
//
// Interface members that are hidden by class members are removed from the set. This
// step only has an effect if T is a type parameter and T has both an effective base
// class other than object and a non-empty effective interface set
//
var tps = queried_type as TypeParameterSpec;
if (tps != null && tps.HasTypeConstraint)
members = RemoveHiddenTypeParameterMethods (members);
return new MethodGroupExpr (members, queried_type, loc);
}
if (!Invocation.IsMemberInvocable (member))
continue;
@@ -834,6 +844,54 @@ namespace Mono.CSharp {
return null;
}
static IList<MemberSpec> RemoveHiddenTypeParameterMethods (IList<MemberSpec> members)
{
if (members.Count < 2)
return members;
//
// If M is a method, then all non-method members declared in an interface declaration
// are removed from the set, and all methods with the same signature as M declared in
// an interface declaration are removed from the set
//
bool copied = false;
for (int i = 0; i < members.Count; ++i) {
var method = members[i] as MethodSpec;
if (method == null) {
if (!copied) {
copied = true;
members = new List<MemberSpec> (members);
}
members.RemoveAt (i--);
continue;
}
if (!method.DeclaringType.IsInterface)
continue;
for (int ii = 0; ii < members.Count; ++ii) {
var candidate = members[ii] as MethodSpec;
if (candidate == null || !candidate.DeclaringType.IsClass)
continue;
if (!TypeSpecComparer.Override.IsEqual (candidate.Parameters, method.Parameters))
continue;
if (!copied) {
copied = true;
members = new List<MemberSpec> (members);
}
members.RemoveAt (i--);
break;
}
}
return members;
}
protected virtual void Error_NegativeArrayIndex (ResolveContext ec, Location loc)
{
throw new NotImplementedException ();
@@ -4397,6 +4455,11 @@ namespace Mono.CSharp {
arg_moved = true;
}
if (arguments == orig_args) {
arguments = new Arguments (orig_args.Count);
arguments.AddRange (orig_args);
}
arguments[index] = arguments[i];
arguments[i] = temp;
+98 -8
View File
@@ -131,6 +131,12 @@ namespace Mono.CSharp
Location.Initialize (ctx.SourceFiles);
}
/// <summary>
/// When set evaluator will automatically wait on Task of async methods. When not
/// set it's called responsibility to handle Task execution
/// </summary>
public bool WaitOnTask { get; set; }
/// <summary>
/// If true, turns type expressions into valid expressions
/// and calls the describe method on it
@@ -429,7 +435,7 @@ namespace Mono.CSharp
throw new ArgumentException ("Syntax error on input: partial input");
if (result_set == false)
throw new ArgumentException ("The expression did not set a result");
throw new ArgumentException ("The expression failed to resolve");
return result;
}
@@ -657,11 +663,47 @@ namespace Mono.CSharp
host.SetBaseTypes (baseclass_list);
host.CreateContainer ();
host.DefineContainer ();
host.Define ();
expression_method = (Method) host.Members[0];
if ((expression_method.ModFlags & Modifiers.ASYNC) != 0) {
//
// Host method is async. When WaitOnTask is set we wrap it with wait
//
// void AsyncWait (ref object $retval) {
// $retval = Host();
// ((Task)$retval).Wait(); // When WaitOnTask is set
// }
//
var p = new ParametersCompiled (
new Parameter (new TypeExpression (module.Compiler.BuiltinTypes.Object, Location.Null), "$retval", Parameter.Modifier.REF, null, Location.Null)
);
var method = new Method(host, new TypeExpression(module.Compiler.BuiltinTypes.Void, Location.Null),
Modifiers.PUBLIC | Modifiers.STATIC, new MemberName("AsyncWait"), p, null);
method.Block = new ToplevelBlock(method.Compiler, p, Location.Null);
method.Block.AddStatement(new StatementExpression (new SimpleAssign(
new SimpleName(p [0].Name, Location.Null),
new Invocation(new SimpleName(expression_method.MemberName.Name, Location.Null), new Arguments(0)),
Location.Null), Location.Null));
if (WaitOnTask) {
var task = new Cast (expression_method.TypeExpression, new SimpleName (p [0].Name, Location.Null), Location.Null);
method.Block.AddStatement (new StatementExpression (new Invocation (
new MemberAccess (task, "Wait", Location.Null),
new Arguments (0)), Location.Null));
}
host.AddMember(method);
expression_method = method;
}
host.CreateContainer();
host.DefineContainer();
host.Define();
} else {
expression_method = null;
}
@@ -1056,6 +1098,27 @@ namespace Mono.CSharp
#endif
}
class InteractiveMethod : Method
{
public InteractiveMethod(TypeDefinition parent, FullNamedExpression returnType, Modifiers mod, ParametersCompiled parameters)
: base(parent, returnType, mod, new MemberName("Host"), parameters, null)
{
}
public void ChangeToAsync ()
{
ModFlags |= Modifiers.ASYNC;
ModFlags &= ~Modifiers.UNSAFE;
type_expr = new TypeExpression(Module.PredefinedTypes.Task.TypeSpec, Location);
parameters = ParametersCompiled.EmptyReadOnlyParameters;
}
public override string GetSignatureForError()
{
return "InteractiveHost";
}
}
class HoistedEvaluatorVariable : HoistedVariable
{
public HoistedEvaluatorVariable (Field field)
@@ -1076,11 +1139,17 @@ namespace Mono.CSharp
/// the return value for an invocation.
/// </summary>
class OptionalAssign : SimpleAssign {
public OptionalAssign (Expression t, Expression s, Location loc)
: base (t, s, loc)
public OptionalAssign (Expression s, Location loc)
: base (null, s, loc)
{
}
public override Location StartLocation {
get {
return Location.Null;
}
}
protected override Expression DoResolve (ResolveContext ec)
{
Expression clone = source.Clone (new CloneContext ());
@@ -1093,7 +1162,7 @@ namespace Mono.CSharp
// A useful feature for the REPL: if we can resolve the expression
// as a type, Describe the type;
//
if (ec.Module.Evaluator.DescribeTypeExpressions){
if (ec.Module.Evaluator.DescribeTypeExpressions && !(ec.CurrentAnonymousMethod is AsyncInitializer)) {
var old_printer = ec.Report.SetPrinter (new SessionReportPrinter ());
Expression tclone;
try {
@@ -1119,8 +1188,29 @@ namespace Mono.CSharp
}
source = clone;
var host = (Method) ec.MemberContext.CurrentMemberDefinition;
if (host.ParameterInfo.IsEmpty) {
eclass = ExprClass.Value;
type = InternalType.FakeInternalType;
return this;
}
target = new SimpleName (host.ParameterInfo[0].Name, Location);
return base.DoResolve (ec);
}
public override void EmitStatement(EmitContext ec)
{
if (target == null) {
source.Emit (ec);
return;
}
base.EmitStatement(ec);
}
}
public class Undo
+31 -14
View File
@@ -80,7 +80,7 @@ namespace Mono.CSharp
public override void Emit (EmitContext ec)
{
var call = new CallEmitter ();
call.EmitPredefined (ec, oper, arguments);
call.EmitPredefined (ec, oper, arguments, loc);
}
public override SLE.Expression MakeExpression (BuilderContext ctx)
@@ -1930,8 +1930,8 @@ namespace Mono.CSharp
if (right_expr.IsNull) {
if ((b.oper & Operator.EqualityMask) != 0) {
if (!left_expr.Type.IsNullableType && left_expr.Type == left_unwrap)
return b.CreateLiftedValueTypeResult (rc, left_unwrap);
if (!left_expr.Type.IsNullableType && BuiltinTypeSpec.IsPrimitiveType (left_expr.Type))
return b.CreateLiftedValueTypeResult (rc, left_expr.Type);
} else if ((b.oper & Operator.BitwiseMask) != 0) {
if (left_unwrap.BuiltinType != BuiltinTypeSpec.Type.Bool)
return Nullable.LiftedNull.CreateFromExpression (rc, b);
@@ -1946,8 +1946,8 @@ namespace Mono.CSharp
}
} else if (left_expr.IsNull) {
if ((b.oper & Operator.EqualityMask) != 0) {
if (!right_expr.Type.IsNullableType && right_expr.Type == right_unwrap)
return b.CreateLiftedValueTypeResult (rc, right_unwrap);
if (!right_expr.Type.IsNullableType && BuiltinTypeSpec.IsPrimitiveType (right_expr.Type))
return b.CreateLiftedValueTypeResult (rc, right_expr.Type);
} else if ((b.oper & Operator.BitwiseMask) != 0) {
if (right_unwrap.BuiltinType != BuiltinTypeSpec.Type.Bool)
return Nullable.LiftedNull.CreateFromExpression (rc, b);
@@ -2752,6 +2752,12 @@ namespace Mono.CSharp
if (l.IsPointer || r.IsPointer)
return ResolveOperatorPointer (rc, l, r);
// User operators
expr = ResolveUserOperator (rc, left, right);
if (expr != null)
return expr;
bool lenum = l.IsEnum;
bool renum = r.IsEnum;
if ((oper & (Operator.ComparisonMask | Operator.BitwiseMask)) != 0) {
@@ -2805,11 +2811,6 @@ namespace Mono.CSharp
return expr;
}
}
// User operators
expr = ResolveUserOperator (rc, left, right);
if (expr != null)
return expr;
}
//
@@ -3718,10 +3719,15 @@ namespace Mono.CSharp
Nullable.NullableInfo.GetEnumUnderlyingType (rc.Module, left.Type) :
EnumSpec.GetUnderlyingType (left.Type);
}
} else if (IsEnumOrNullableEnum (left.Type)) {
result_type = left.Type;
} else {
result_type = right.Type;
if (IsEnumOrNullableEnum (left.Type)) {
result_type = left.Type;
} else {
result_type = right.Type;
}
if (expr is Nullable.LiftedBinaryOperator && !result_type.IsNullableType)
result_type = rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { result_type });
}
return EmptyCast.Create (expr, result_type);
@@ -4330,6 +4336,14 @@ namespace Mono.CSharp
/// </remarks>
public override void EmitBranchable (EmitContext ec, Label target, bool on_true)
{
if (ec.HasSet (BuilderContext.Options.AsyncBody) && right.ContainsEmitWithAwait ()) {
left = left.EmitToField (ec);
if ((oper & Operator.LogicalMask) == 0) {
right = right.EmitToField (ec);
}
}
//
// This is more complicated than it looks, but its just to avoid
// duplicated tests: basically, we allow ==, !=, >, <, >= and <=
@@ -6533,14 +6547,16 @@ namespace Mono.CSharp
}
if (vr != null) {
ec.MarkCallEntry (loc);
ec.Emit (OpCodes.Call, method);
return false;
}
}
if (type is TypeParameterSpec)
return DoEmitTypeParameter (ec);
return DoEmitTypeParameter (ec);
ec.MarkCallEntry (loc);
ec.Emit (OpCodes.Newobj, method);
return true;
}
@@ -10037,6 +10053,7 @@ namespace Mono.CSharp
public override void Emit (EmitContext ec)
{
source.Emit (ec);
ec.MarkCallEntry (loc);
ec.Emit (OpCodes.Call, method);
}
+2 -2
View File
@@ -358,9 +358,9 @@ namespace Mono.CSharp
return fs;
}
public override List<TypeSpec> ResolveMissingDependencies ()
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
return memberType.ResolveMissingDependencies ();
return memberType.ResolveMissingDependencies (this);
}
}
+1 -1
View File
@@ -800,7 +800,7 @@ namespace Mono.CSharp
}
}
public class FlowBranchingAsync : FlowBranchingBlock
public class FlowBranchingAsync : FlowBranchingBlock
{
readonly AsyncInitializer async_init;
+2 -2
View File
@@ -1665,7 +1665,7 @@ namespace Mono.CSharp {
}
}
public override bool IsGenericIterateInterface {
public override bool IsArrayGenericInterface {
get {
return (open_type.state & StateFlags.GenericIterateInterface) != 0;
}
@@ -3349,7 +3349,7 @@ namespace Mono.CSharp {
return LowerBoundInference (u_ac.Element, v_ac.Element, inversed);
}
if (u_ac.Rank != 1 || !v.IsGenericIterateInterface)
if (u_ac.Rank != 1 || !v.IsArrayGenericInterface)
return 0;
var v_i = TypeManager.GetTypeArguments (v) [0];
+27 -13
View File
@@ -774,24 +774,34 @@ namespace Mono.CSharp
for (int i = nested_hierarchy.Count; i != 0; --i) {
var t = nested_hierarchy [i - 1];
spec = MemberCache.FindNestedType (spec, t.Name, t.Arity);
if (t.Kind == MemberKind.MissingType)
spec = t;
else
spec = MemberCache.FindNestedType (spec, t.Name, t.Arity);
if (t.Arity > 0) {
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).Take (spec.Arity).ToArray ());
targs_pos += t.Arity;
}
}
string name = type.Name;
int index = name.IndexOf ('`');
if (index > 0)
name = name.Substring (0, index);
if (spec.Kind == MemberKind.MissingType) {
spec = new TypeSpec (MemberKind.MissingType, spec, new ImportedTypeDefinition (type_def, this), type_def, Modifiers.PUBLIC);
spec.MemberCache = MemberCache.Empty;
} else {
if ((type_def.Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate && IgnorePrivateMembers)
return null;
spec = MemberCache.FindNestedType (spec, name, targs.Length - targs_pos);
if (spec == null)
return null;
string name = type.Name;
int index = name.IndexOf ('`');
if (index > 0)
name = name.Substring (0, index);
if (spec.Arity > 0) {
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).ToArray ());
spec = MemberCache.FindNestedType (spec, name, targs.Length - targs_pos);
if (spec.Arity > 0) {
spec = spec.MakeGenericType (module, targs.Skip (targs_pos).ToArray ());
}
}
}
@@ -1883,7 +1893,7 @@ namespace Mono.CSharp
}
public static void Error_MissingDependency (IMemberContext ctx, List<TypeSpec> types, Location loc)
public static void Error_MissingDependency (IMemberContext ctx, List<MissingTypeSpecReference> missing, Location loc)
{
//
// Report details about missing type and most likely cause of the problem.
@@ -1894,8 +1904,8 @@ namespace Mono.CSharp
var report = ctx.Module.Compiler.Report;
for (int i = 0; i < types.Count; ++i) {
var t = types [i];
for (int i = 0; i < missing.Count; ++i) {
var t = missing [i].Type;
//
// Report missing types only once
@@ -1905,6 +1915,10 @@ namespace Mono.CSharp
string name = t.GetSignatureForError ();
var caller = missing[i].Caller;
if (caller.Kind != MemberKind.MissingType)
report.SymbolRelatedToPreviousError (missing[i].Caller);
if (t.MemberDefinition.DeclaringAssembly == ctx.Module.DeclaringAssembly) {
report.Error (1683, loc,
"Reference to type `{0}' claims it is defined in this assembly, but it is not defined in source or any added modules",
+6 -6
View File
@@ -493,29 +493,29 @@ namespace Mono.CSharp {
return ms;
}
public override List<TypeSpec> ResolveMissingDependencies ()
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
var missing = returnType.ResolveMissingDependencies ();
var missing = returnType.ResolveMissingDependencies (this);
foreach (var pt in parameters.Types) {
var m = pt.GetMissingDependencies ();
var m = pt.GetMissingDependencies (this);
if (m == null)
continue;
if (missing == null)
missing = new List<TypeSpec> ();
missing = new List<MissingTypeSpecReference> ();
missing.AddRange (m);
}
if (Arity > 0) {
foreach (var tp in GenericDefinition.TypeParameters) {
var m = tp.GetMissingDependencies ();
var m = tp.GetMissingDependencies (this);
if (m == null)
continue;
if (missing == null)
missing = new List<TypeSpec> ();
missing = new List<MissingTypeSpecReference> ();
missing.AddRange (m);
}
+9 -8
View File
@@ -174,9 +174,9 @@ namespace Mono.CSharp
return ps;
}
public override List<TypeSpec> ResolveMissingDependencies ()
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
return memberType.ResolveMissingDependencies ();
return memberType.ResolveMissingDependencies (this);
}
}
@@ -1427,9 +1427,9 @@ namespace Mono.CSharp
return es;
}
public override List<TypeSpec> ResolveMissingDependencies ()
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
return MemberType.ResolveMissingDependencies ();
return MemberType.ResolveMissingDependencies (this);
}
}
@@ -1701,16 +1701,17 @@ namespace Mono.CSharp
return spec;
}
public override List<TypeSpec> ResolveMissingDependencies ()
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
var missing = base.ResolveMissingDependencies ();
var missing = base.ResolveMissingDependencies (caller);
foreach (var pt in parameters.Types) {
var m = pt.GetMissingDependencies ();
var m = pt.GetMissingDependencies (caller);
if (m == null)
continue;
if (missing == null)
missing = new List<TypeSpec> ();
missing = new List<MissingTypeSpecReference> ();
missing.AddRange (m);
}
+1 -1
View File
@@ -576,7 +576,7 @@ namespace Mono.CSharp {
public bool ProcessWarningsList (string text, Action<int> action)
{
bool valid = true;
foreach (string wid in text.Split (numeric_value_separator)) {
foreach (string wid in text.Split (numeric_value_separator, StringSplitOptions.RemoveEmptyEntries)) {
int id;
if (!int.TryParse (wid, NumberStyles.AllowLeadingWhite, CultureInfo.InvariantCulture, out id)) {
report.Error (1904, "`{0}' is not a valid warning number", wid);
+4 -2
View File
@@ -702,7 +702,7 @@ namespace Mono.CSharp {
public class StatementErrorExpression : Statement
{
readonly Expression expr;
Expression expr;
public StatementErrorExpression (Expression expr)
{
@@ -729,7 +729,9 @@ namespace Mono.CSharp {
protected override void CloneTo (CloneContext clonectx, Statement target)
{
throw new NotImplementedException ();
var t = (StatementErrorExpression) target;
t.expr = expr.Clone (clonectx);
}
public override object Accept (StructuralVisitor visitor)
+34
View File
@@ -322,4 +322,38 @@ namespace Mono.CSharp {
}
}
}
struct TypeNameParser
{
internal static string Escape(string name)
{
if (name == null) {
return null;
}
StringBuilder sb = null;
for (int pos = 0; pos < name.Length; pos++) {
char c = name[pos];
switch (c) {
case '\\':
case '+':
case ',':
case '[':
case ']':
case '*':
case '&':
if (sb == null) {
sb = new StringBuilder(name, 0, pos, name.Length + 3);
}
sb.Append("\\").Append(c);
break;
default:
if (sb != null) {
sb.Append(c);
}
break;
}
}
return sb != null ? sb.ToString() : name;
}
}
}
+13 -3
View File
@@ -186,7 +186,9 @@ namespace Mono.CSharp
public readonly PredefinedType IsVolatile;
public readonly PredefinedType IEnumeratorGeneric;
public readonly PredefinedType IListGeneric;
public readonly PredefinedType IReadOnlyListGeneric;
public readonly PredefinedType ICollectionGeneric;
public readonly PredefinedType IReadOnlyCollectionGeneric;
public readonly PredefinedType IEnumerableGeneric;
public readonly PredefinedType Nullable;
public readonly PredefinedType Activator;
@@ -246,7 +248,9 @@ namespace Mono.CSharp
IsVolatile = new PredefinedType (module, MemberKind.Class, "System.Runtime.CompilerServices", "IsVolatile");
IEnumeratorGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IEnumerator", 1);
IListGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IList", 1);
IReadOnlyListGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IReadOnlyList", 1);
ICollectionGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "ICollection", 1);
IReadOnlyCollectionGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IReadOnlyCollection", 1);
IEnumerableGeneric = new PredefinedType (module, MemberKind.Interface, "System.Collections.Generic", "IEnumerable", 1);
Nullable = new PredefinedType (module, MemberKind.Struct, "System", "Nullable", 1);
Activator = new PredefinedType (module, MemberKind.Class, "System", "Activator");
@@ -294,13 +298,19 @@ namespace Mono.CSharp
ArgIterator.TypeSpec.IsSpecialRuntimeType = true;
if (IEnumerableGeneric.Define ())
IEnumerableGeneric.TypeSpec.IsGenericIterateInterface = true;
IEnumerableGeneric.TypeSpec.IsArrayGenericInterface = true;
if (IListGeneric.Define ())
IListGeneric.TypeSpec.IsGenericIterateInterface = true;
IListGeneric.TypeSpec.IsArrayGenericInterface = true;
if (IReadOnlyListGeneric.Define ())
IReadOnlyListGeneric.TypeSpec.IsArrayGenericInterface = true;
if (ICollectionGeneric.Define ())
ICollectionGeneric.TypeSpec.IsGenericIterateInterface = true;
ICollectionGeneric.TypeSpec.IsArrayGenericInterface = true;
if (IReadOnlyCollectionGeneric.Define ())
IReadOnlyCollectionGeneric.TypeSpec.IsArrayGenericInterface = true;
if (Nullable.Define ())
Nullable.TypeSpec.IsNullableType = true;
+24 -12
View File
@@ -211,7 +211,7 @@ namespace Mono.CSharp
//
// Returns true for instances of IList<T>, IEnumerable<T>, ICollection<T>
//
public virtual bool IsGenericIterateInterface {
public virtual bool IsArrayGenericInterface {
get {
return false;
}
@@ -738,22 +738,22 @@ namespace Mono.CSharp
return this;
}
public override List<TypeSpec> ResolveMissingDependencies ()
public override List<MissingTypeSpecReference> ResolveMissingDependencies (MemberSpec caller)
{
List<TypeSpec> missing = null;
List<MissingTypeSpecReference> missing = null;
if (Kind == MemberKind.MissingType) {
missing = new List<TypeSpec> ();
missing.Add (this);
missing = new List<MissingTypeSpecReference> ();
missing.Add (new MissingTypeSpecReference (this, caller));
return missing;
}
foreach (var targ in TypeArguments) {
if (targ.Kind == MemberKind.MissingType) {
if (missing == null)
missing = new List<TypeSpec> ();
missing = new List<MissingTypeSpecReference> ();
missing.Add (targ);
missing.Add (new MissingTypeSpecReference (targ, caller));
}
}
@@ -761,19 +761,19 @@ namespace Mono.CSharp
foreach (var iface in Interfaces) {
if (iface.Kind == MemberKind.MissingType) {
if (missing == null)
missing = new List<TypeSpec> ();
missing = new List<MissingTypeSpecReference> ();
missing.Add (iface);
missing.Add (new MissingTypeSpecReference (iface, caller));
}
}
}
if (MemberDefinition.TypeParametersCount > 0) {
foreach (var tp in MemberDefinition.TypeParameters) {
var tp_missing = tp.GetMissingDependencies ();
var tp_missing = tp.GetMissingDependencies (this);
if (tp_missing != null) {
if (missing == null)
missing = new List<TypeSpec> ();
missing = new List<MissingTypeSpecReference> ();
missing.AddRange (tp_missing);
}
@@ -783,7 +783,7 @@ namespace Mono.CSharp
if (missing != null || BaseType == null)
return missing;
return BaseType.ResolveMissingDependencies ();
return BaseType.ResolveMissingDependencies (this);
}
public void SetMetaInfo (MetaType info)
@@ -1950,4 +1950,16 @@ namespace Mono.CSharp
return pc;
}
}
public class MissingTypeSpecReference
{
public MissingTypeSpecReference (TypeSpec type, MemberSpec caller)
{
Type = type;
Caller = caller;
}
public TypeSpec Type { get; private set; }
public MemberSpec Caller { get; private set; }
}
}
+40
View File
@@ -0,0 +1,40 @@
using System;
public class Z : IGenericInterface<Z>
{
public Z Start ()
{
return this;
}
Z IGenericInterface<Z>.Start ()
{
throw new ApplicationException ();
}
}
public interface IGenericInterface<T>
{
T Start ();
}
public class A<T> where T : Z, IGenericInterface<int>
{
public void SomeOperation (T t)
{
t.Start ();
}
}
public class C : Z, IGenericInterface<int>
{
int IGenericInterface<int>.Start ()
{
throw new NotImplementedException ();
}
public static void Main ()
{
new A<C> ().SomeOperation (new C ());
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
enum E
{
V
}
class C
{
public static void Main ()
{
byte? foo = 0;
E e = 0;
var res = foo - e;
Console.WriteLine (res);
var res2 = e - foo;
Console.WriteLine (res2);
res = null;
res2 = null;
}
}
+25
View File
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
public class Tests
{
static void A<T>(IReadOnlyCollection<T> otherList)
{
}
static void B<T>(IReadOnlyList<T> otherList)
{
}
public static void Main ()
{
var ifacers = typeof(int[]).GetInterfaces ();
var args = new string [0];
A (args);
B (args);
IReadOnlyList<int> e1 = new int[0];
IReadOnlyCollection<int> e2 = new int[0];
}
}
+39
View File
@@ -0,0 +1,39 @@
using System;
public class C
{
public static readonly C Token = new C ();
public static C operator & (C set, E value)
{
return Token;
}
public static implicit operator E (C c)
{
throw new ApplicationException ();
}
}
public enum E
{
Item = 2
}
class FooClass
{
public static int Main ()
{
C m = new C ();
var x = E.Item;
var res = m & x;
if (res != C.Token)
return 1;
res = m & E.Item;
if (res != C.Token)
return 2;
return 0;
}
}
+9
View File
@@ -353,6 +353,15 @@ class Tester : Base
return 0;
}
async Task<bool> BinaryTest_6 ()
{
var t = Task.Delay (1);
if (t == await Task.WhenAny(new [] { t }))
return true;
return false;
}
async Task<int> CallTest_1 ()
{
return Call (
+10 -2
View File
@@ -2,8 +2,7 @@ using System;
using System.Threading.Tasks;
// contextual async, parser tests
class A
class A : Iasync
{
async Task<int> async ()
{
@@ -21,6 +20,10 @@ class A
var res = (int) await async ();
var res2 = (Int32) await async ();
}
async void Iasync.async ()
{
}
public static int Main ()
{
@@ -28,6 +31,11 @@ class A
}
}
interface Iasync
{
void async ();
}
class B
{
class async
+1
View File
@@ -44,6 +44,7 @@
<sequencepoints>
<entry il="0x0" row="4" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="5" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="5" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="6" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+22 -2
View File
@@ -15,7 +15,7 @@
<method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="12" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="13" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="13" col="10" file_ref="1" hidden="false" />
<entry il="0x6" row="13" col="26" file_ref="1" hidden="false" />
<entry il="0x16" row="14" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -41,6 +41,7 @@
<entry il="0x1" row="25" col="10" file_ref="1" hidden="false" />
<entry il="0x9" row="26" col="3" file_ref="1" hidden="false" />
<entry il="0xa" row="27" col="3" file_ref="1" hidden="false" />
<entry il="0x18" row="25" col="14" file_ref="1" hidden="false" />
<entry il="0x1e" row="28" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -58,6 +59,8 @@
<entry il="0x9" row="32" col="26" file_ref="1" hidden="false" />
<entry il="0x11" row="33" col="3" file_ref="1" hidden="false" />
<entry il="0x12" row="34" col="3" file_ref="1" hidden="false" />
<entry il="0x20" row="32" col="26" file_ref="1" hidden="false" />
<entry il="0x33" row="32" col="12" file_ref="1" hidden="false" />
<entry il="0x39" row="35" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -75,6 +78,7 @@
<entry il="0x1" row="39" col="10" file_ref="1" hidden="false" />
<entry il="0x10" row="40" col="3" file_ref="1" hidden="false" />
<entry il="0x11" row="41" col="3" file_ref="1" hidden="false" />
<entry il="0x2e" row="39" col="13" file_ref="1" hidden="false" />
<entry il="0x34" row="42" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -88,10 +92,12 @@
<method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="45" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="46" col="10" file_ref="1" hidden="false" />
<entry il="0x1" row="46" col="19" file_ref="1" hidden="false" />
<entry il="0x7" row="47" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="48" col="4" file_ref="1" hidden="false" />
<entry il="0xd" row="48" col="12" file_ref="1" hidden="false" />
<entry il="0x12" row="49" col="3" file_ref="1" hidden="false" />
<entry il="0x1f" row="46" col="14" file_ref="1" hidden="false" />
<entry il="0x25" row="50" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -167,6 +173,7 @@
<sequencepoints>
<entry il="0x0" row="103" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="105" col="3" file_ref="1" hidden="false" />
<entry il="0x86" row="104" col="3" file_ref="1" hidden="false" />
<entry il="0xb3" row="107" col="5" file_ref="1" hidden="false" />
<entry il="0xb8" row="109" col="4" file_ref="1" hidden="false" />
<entry il="0xb9" row="110" col="5" file_ref="1" hidden="false" />
@@ -255,6 +262,7 @@
<entry il="0x1" row="175" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="176" col="3" file_ref="1" hidden="false" />
<entry il="0x3" row="177" col="4" file_ref="1" hidden="false" />
<entry il="0x8" row="177" col="12" file_ref="1" hidden="false" />
<entry il="0xd" row="178" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
@@ -266,6 +274,7 @@
<sequencepoints>
<entry il="0x0" row="182" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="183" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="183" col="7" file_ref="1" hidden="false" />
<entry il="0x11" row="184" col="3" file_ref="1" hidden="false" />
<entry il="0x12" row="185" col="3" file_ref="1" hidden="false" />
<entry il="0x18" row="187" col="3" file_ref="1" hidden="false" />
@@ -282,9 +291,11 @@
<sequencepoints>
<entry il="0x0" row="192" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="193" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="193" col="7" file_ref="1" hidden="false" />
<entry il="0x11" row="194" col="3" file_ref="1" hidden="false" />
<entry il="0x12" row="195" col="3" file_ref="1" hidden="false" />
<entry il="0x18" row="196" col="8" file_ref="1" hidden="false" />
<entry il="0x1e" row="196" col="12" file_ref="1" hidden="false" />
<entry il="0x28" row="197" col="3" file_ref="1" hidden="false" />
<entry il="0x29" row="198" col="3" file_ref="1" hidden="false" />
<entry il="0x2f" row="200" col="3" file_ref="1" hidden="false" />
@@ -375,9 +386,13 @@
<entry il="0x0" row="246" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="247" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x3" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0xe" row="248" col="4" file_ref="1" hidden="false" />
<entry il="0x10" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x16" row="251" col="3" file_ref="1" hidden="false" />
<entry il="0x17" row="252" col="3" file_ref="1" hidden="false" />
<entry il="0x1a" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x31" row="250" col="3" file_ref="1" hidden="false" />
<entry il="0x37" row="253" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -393,9 +408,12 @@
<entry il="0x0" row="256" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="257" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0x4" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0xf" row="258" col="4" file_ref="1" hidden="false" />
<entry il="0x10" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0x16" row="261" col="3" file_ref="1" hidden="false" />
<entry il="0x17" row="262" col="3" file_ref="1" hidden="false" />
<entry il="0x19" row="260" col="3" file_ref="1" hidden="false" />
<entry il="0x3c" row="263" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -411,6 +429,8 @@
<entry il="0x0" row="266" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="267" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="269" col="6" file_ref="1" hidden="false" />
<entry il="0x6" row="269" col="6" file_ref="1" hidden="false" />
<entry il="0xe" row="269" col="6" file_ref="1" hidden="false" />
<entry il="0x24" row="268" col="3" file_ref="1" hidden="false" />
<entry il="0x2f" row="270" col="3" file_ref="1" hidden="false" />
<entry il="0x30" row="271" col="3" file_ref="1" hidden="false" />
+4 -3
View File
@@ -52,6 +52,7 @@
</method>
<method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0xd" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0xe" row="35" col="3" file_ref="1" hidden="false" />
<entry il="0x1b" row="37" col="2" file_ref="1" hidden="false" />
@@ -63,7 +64,7 @@
</method>
<method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="13" col="3" file_ref="1" hidden="false" />
<entry il="0x0" row="13" col="11" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
@@ -71,7 +72,7 @@
<method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="20" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="4" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="12" file_ref="1" hidden="false" />
<entry il="0x6" row="22" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
@@ -80,7 +81,7 @@
<method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="28" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="29" col="4" file_ref="1" hidden="false" />
<entry il="0x1" row="29" col="12" file_ref="1" hidden="false" />
<entry il="0x6" row="30" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+2
View File
@@ -13,6 +13,8 @@
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
<entry il="0xb" row="7" col="21" file_ref="1" hidden="false" />
<entry il="0x16" row="5" col="6" file_ref="1" hidden="false" />
<entry il="0x1c" row="8" col="5" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+4 -2
View File
@@ -20,9 +20,11 @@
<method token="0x6000003">
<sequencepoints>
<entry il="0x0" row="14" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="11" file_ref="1" hidden="false" />
<entry il="0x7" row="17" col="4" file_ref="1" hidden="false" />
<entry il="0xe" row="17" col="4" file_ref="1" hidden="false" />
<entry il="0x13" row="20" col="4" file_ref="1" hidden="false" />
<entry il="0x1a" row="20" col="4" file_ref="1" hidden="false" />
<entry il="0x21" row="24" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
@@ -33,7 +35,7 @@
<method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="27" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="28" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="28" col="14" file_ref="1" hidden="false" />
<entry il="0x7" row="30" col="4" file_ref="1" hidden="false" />
<entry il="0x12" row="31" col="4" file_ref="1" hidden="false" />
<entry il="0x1b" row="33" col="2" file_ref="1" hidden="false" />
+7
View File
@@ -19,8 +19,12 @@
</method>
<method token="0x6000003">
<sequencepoints>
<entry il="0xf" row="13" col="5" file_ref="1" hidden="false" />
<entry il="0x24" row="13" col="8" file_ref="1" hidden="false" />
<entry il="0x2a" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x2b" row="12" col="3" file_ref="1" hidden="false" />
<entry il="0x2d" row="14" col="4" file_ref="1" hidden="false" />
<entry il="0x40" row="13" col="4" file_ref="1" hidden="false" />
<entry il="0x46" row="16" col="3" file_ref="1" hidden="false" />
<entry il="0x4b" row="17" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -33,6 +37,9 @@
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
<entry il="0x11" row="21" col="59" file_ref="1" hidden="false" />
<entry il="0x1c" row="21" col="53" file_ref="1" hidden="false" />
<entry il="0x2c" row="21" col="47" file_ref="1" hidden="false" />
<entry il="0x32" row="22" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
+2 -2
View File
@@ -67,7 +67,7 @@
<entry il="0x0" row="30" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="31" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="32" col="3" file_ref="1" hidden="false" />
<entry il="0xe" row="33" col="3" file_ref="1" hidden="false" />
<entry il="0xe" row="33" col="15" file_ref="1" hidden="false" />
<entry il="0x14" row="34" col="3" file_ref="1" hidden="false" />
<entry il="0x81" row="35" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -81,7 +81,7 @@
<method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="38" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="39" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="39" col="15" file_ref="1" hidden="false" />
<entry il="0x7" row="40" col="3" file_ref="1" hidden="false" />
<entry il="0x1e4" row="41" col="2" file_ref="1" hidden="false" />
</sequencepoints>
+3 -2
View File
@@ -25,7 +25,7 @@
<method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="16" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="17" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="17" col="15" file_ref="1" hidden="false" />
<entry il="0x23" row="17" col="23" file_ref="1" hidden="false" />
<entry il="0x2e" row="21" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -40,7 +40,7 @@
<method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="15" file_ref="1" hidden="false" />
<entry il="0x23" row="30" col="23" file_ref="1" hidden="false" />
<entry il="0x2e" row="31" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -99,6 +99,7 @@
<sequencepoints>
<entry il="0x21" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0x22" row="35" col="3" file_ref="1" hidden="false" />
<entry il="0x23" row="35" col="15" file_ref="1" hidden="false" />
<entry il="0x2d" row="36" col="3" file_ref="1" hidden="false" />
<entry il="0x8b" row="37" col="3" file_ref="1" hidden="false" />
<entry il="0x3ab" row="38" col="3" file_ref="1" hidden="false" />
+2
View File
@@ -41,6 +41,7 @@
<sequencepoints>
<entry il="0x27" row="7" col="2" file_ref="1" hidden="false" />
<entry il="0x28" row="8" col="3" file_ref="1" hidden="false" />
<entry il="0x2d" row="8" col="11" file_ref="1" hidden="false" />
<entry il="0x32" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x41" row="10" col="3" file_ref="1" hidden="false" />
<entry il="0x42" row="11" col="4" file_ref="1" hidden="false" />
@@ -77,6 +78,7 @@
<sequencepoints>
<entry il="0x0" row="14" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="15" col="4" file_ref="1" hidden="false" />
<entry il="0x6" row="15" col="12" file_ref="1" hidden="false" />
<entry il="0xb" row="16" col="3" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+2 -1
View File
@@ -31,7 +31,7 @@
<method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="9" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
@@ -68,6 +68,7 @@
<sequencepoints>
<entry il="0x21" row="15" col="2" file_ref="1" hidden="false" />
<entry il="0x22" row="16" col="3" file_ref="1" hidden="false" />
<entry il="0x29" row="16" col="21" file_ref="1" hidden="false" />
<entry il="0x47" row="17" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
+3
View File
@@ -22,6 +22,7 @@
<sequencepoints>
<entry il="0x0" row="8" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="9" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="9" col="8" file_ref="1" hidden="false" />
<entry il="0xd" row="10" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -32,6 +33,7 @@
<sequencepoints>
<entry il="0x0" row="13" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="14" col="3" file_ref="1" hidden="false" />
<entry il="0x2" row="14" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="14" col="11" file_ref="1" hidden="false" />
<entry il="0xd" row="15" col="2" file_ref="1" hidden="false" />
</sequencepoints>
@@ -53,6 +55,7 @@
<entry il="0x0" row="23" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="24" col="3" file_ref="1" hidden="false" />
<entry il="0x1f" row="25" col="3" file_ref="1" hidden="false" />
<entry il="0x20" row="25" col="3" file_ref="1" hidden="false" />
<entry il="0x25" row="25" col="8" file_ref="1" hidden="false" />
<entry il="0x2b" row="26" col="2" file_ref="1" hidden="false" />
</sequencepoints>
+2 -2
View File
@@ -12,8 +12,8 @@
<method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="3" file_ref="1" hidden="false" />
<entry il="0x7" row="7" col="30" file_ref="1" hidden="false" />
<entry il="0x1" row="7" col="14" file_ref="1" hidden="false" />
<entry il="0x7" row="7" col="34" file_ref="1" hidden="false" />
<entry il="0xd" row="8" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
+125
View File
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="utf-8"?>
<symbols>
<files>
<file id="1" name="test-debug-27.cs" checksum="a14fe1107e45236d0519cb2c2c65cd46" />
</files>
<methods>
<method token="0x6000001">
<sequencepoints>
<entry il="0x0" row="6" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="8" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000002">
<sequencepoints>
<entry il="0x0" row="11" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="12" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="13" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000003">
<sequencepoints />
<locals />
<scopes />
</method>
<method token="0x6000004">
<sequencepoints>
<entry il="0x0" row="19" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="20" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="21" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000005">
<sequencepoints>
<entry il="0x0" row="24" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="25" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="26" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000006">
<sequencepoints>
<entry il="0x0" row="29" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="30" col="10" file_ref="1" hidden="false" />
<entry il="0xc" row="31" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000007">
<sequencepoints>
<entry il="0x0" row="34" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="35" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="36" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x6000008">
<sequencepoints>
<entry il="0x0" row="39" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="40" col="3" file_ref="1" hidden="false" />
<entry il="0x1f" row="42" col="3" file_ref="1" hidden="false" />
<entry il="0x20" row="42" col="13" file_ref="1" hidden="false" />
<entry il="0x26" row="42" col="20" file_ref="1" hidden="false" />
<entry il="0x2d" row="43" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="f" il_index="0" scope_ref="0" />
<entry name="res" il_index="1" scope_ref="0" />
</locals>
<scopes />
</method>
<method token="0x6000009">
<sequencepoints>
<entry il="0x0" row="46" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="47" col="3" file_ref="1" hidden="false" />
<entry il="0x4" row="47" col="11" file_ref="1" hidden="false" />
<entry il="0x9" row="48" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="s" il_index="0" scope_ref="0" />
</locals>
<scopes />
</method>
<method token="0x600000a">
<sequencepoints>
<entry il="0x0" row="51" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="52" col="3" file_ref="1" hidden="false" />
<entry il="0xa" row="52" col="11" file_ref="1" hidden="false" />
<entry il="0x18" row="52" col="22" file_ref="1" hidden="false" />
<entry il="0x1f" row="53" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="i" il_index="0" scope_ref="0" />
</locals>
<scopes />
</method>
<method token="0x600000b">
<sequencepoints>
<entry il="0x0" row="56" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="57" col="3" file_ref="1" hidden="false" />
<entry il="0x6" row="57" col="11" file_ref="1" hidden="false" />
<entry il="0xc" row="58" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
<method token="0x600000c">
<sequencepoints>
<entry il="0x0" row="61" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="62" col="3" file_ref="1" hidden="false" />
<entry il="0x8" row="63" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals />
<scopes />
</method>
</methods>
</symbols>
+68
View File
@@ -0,0 +1,68 @@
using System;
// Tests for explicit call sequence point
struct S
{
public S (int i)
{
}
public static implicit operator int (S s)
{
return 1;
}
}
class C
{
public static int A ()
{
return 1;
}
public static int B (C c)
{
return 2;
}
public static C Test ()
{
return new C ();
}
public string Foo ()
{
return null;
}
void Test_1 ()
{
Func<int> f = A;
var res = f () + f ();
}
void Test_2 ()
{
var s = new S (0);
}
void Test_3 ()
{
int i = new S () + new S ();
}
void Test_4 ()
{
Test ().Foo ();
}
static int Main ()
{
return 0;
}
}
+28
View File
@@ -0,0 +1,28 @@
using System;
class C
{
static int Foo (string packageId, int version)
{
return Foo (packageId, version, ignoreDependencies: false, allowPrereleaseVersions: false);
}
static int Foo (string packageId, int version, bool ignoreDependencies, bool allowPrereleaseVersions)
{
return 1;
}
static int Foo (double package, bool ignoreDependencies, bool allowPrereleaseVersions, bool ignoreWalkInfo)
{
return 2;
}
public static int Main ()
{
if (Foo ("", 1) != 1)
return 1;
return 0;
}
}
File diff suppressed because it is too large. Load diff
+1
View File
@@ -68,6 +68,7 @@ namespace Mono {
eval.InteractiveBaseClass = typeof (InteractiveBaseShell);
eval.DescribeTypeExpressions = true;
eval.WaitOnTask = true;
CSharpShell shell;
#if !ON_DOTNET
+1 -1
View File
@@ -351,7 +351,7 @@ add masterdoc support?
<xs:element name="format">
<xs:complexType>
<xs:sequence>
<xs:any minOccurs="0" processContents="lax" />
<xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax" />
</xs:sequence>
<xs:attribute ref="type" />
</xs:complexType>
Regular → Executable
+4 -3
View File
@@ -17,6 +17,7 @@
#include "mono/utils/mono-compiler.h"
#include "declsec.h"
#include "util.h"
static char*
declsec_20_get_classname (const char* p, const char **rptr)
@@ -113,12 +114,12 @@ declsec_20_write_value (GString *str, char type, const char *value)
float val;
int inf;
readr4 (value, &val);
inf = isinf (val);
inf = dis_isinf (val);
if (inf == -1)
g_string_append_printf (str, "0xFF800000"); /* negative infinity */
else if (inf == 1)
g_string_append_printf (str, "0x7F800000"); /* positive infinity */
else if (isnan (val))
else if (dis_isnan (val))
g_string_append_printf (str, "0xFFC00000"); /* NaN */
else
g_string_append_printf (str, "%.8g", val);
@@ -128,7 +129,7 @@ declsec_20_write_value (GString *str, char type, const char *value)
double val;
int inf;
readr8 (value, &val);
inf = isinf (val);
inf = dis_isinf (val);
if (inf == -1)
g_string_append_printf (str, "0xFFF00000000000000"); /* negative infinity */
else if (inf == 1)
Regular → Executable
+5 -29
View File
@@ -17,35 +17,11 @@
#include "get.h"
#include "dump.h"
#include "dis-cil.h"
#include "util.h"
#include "mono/metadata/opcodes.h"
#include "mono/metadata/class-internals.h"
#include "mono/utils/mono-compiler.h"
#ifndef HAVE_ISINF
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
int isinf (double);
int
isinf (double num)
{
fpclass_t klass;
klass = fpclass (num);
if (klass == FP_NINF)
return -1;
if (klass == FP_PINF)
return 1;
return 0;
}
#else
#error "Don't know how to implement isinf for this platform."
#endif
#endif
#define CODE_INDENT g_assert (indent_level < 512); \
indent[indent_level*2] = ' '; \
indent[indent_level*2+1] = ' '; \
@@ -191,12 +167,12 @@ disassemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContainer *conta
double r;
int inf;
readr8 (ptr, &r);
inf = isinf (r);
inf = dis_isinf (r);
if (inf == -1)
fprintf (output, "(00 00 00 00 00 00 f0 ff)"); /* negative infinity */
else if (inf == 1)
fprintf (output, "(00 00 00 00 00 00 f0 7f)"); /* positive infinity */
else if (isnan (r))
else if (dis_isnan (r))
fprintf (output, "(00 00 00 00 00 00 f8 ff)"); /* NaN */
else {
char *str = stringify_double (r);
@@ -300,12 +276,12 @@ disassemble_cil (MonoImage *m, MonoMethodHeader *mh, MonoGenericContainer *conta
readr4 (ptr, &f);
inf = isinf (f);
inf = dis_isinf (f);
if (inf == -1)
fprintf (output, "(00 00 80 ff)"); /* negative infinity */
else if (inf == 1)
fprintf (output, "(00 00 80 7f)"); /* positive infinity */
else if (isnan (f))
else if (dis_isnan (f))
fprintf (output, "(00 00 c0 ff)"); /* NaN */
else {
char *str = stringify_double ((double) f);
Regular → Executable
+3 -11
View File
@@ -21,14 +21,6 @@
#include "mono/metadata/class-internals.h"
#include "mono/utils/mono-compiler.h"
#ifndef HAVE_ISINF
#ifdef HAVE_IEEEFP_H
extern int isinf (double);
#endif
#endif
#if defined(__native_client__) && defined(__GLIBC__)
volatile int __nacl_thread_suspension_needed = 0;
void __nacl_suspend_thread_if_needed() {}
@@ -870,12 +862,12 @@ handle_enum:
float val;
int inf;
readr4 (p, &val);
inf = isinf (val);
inf = dis_isinf (val);
if (inf == -1)
g_string_append_printf (res, "(00 00 80 ff)"); /* negative infinity */
else if (inf == 1)
g_string_append_printf (res, "(00 00 80 7f)"); /* positive infinity */
else if (isnan (val))
else if (dis_isnan (val))
g_string_append_printf (res, "(00 00 c0 ff)"); /* NaN */
else
g_string_append_printf (res, "%g", val);
@@ -887,7 +879,7 @@ handle_enum:
int inf;
readr8 (p, &val);
inf = isinf (val);
inf = dis_isinf (val);
if (inf == -1)
g_string_append_printf (res, "(00 00 00 00 00 00 f0 ff)"); /* negative infinity */
else if (inf == 1)
Regular → Executable
+1 -1
View File
@@ -2310,7 +2310,7 @@ get_constant (MonoImage *m, MonoTypeEnum t, guint32 blob_index)
#ifdef HAVE_ISFINITE
normal = isfinite (r);
#else
normal = isnormal (r);
normal = !dis_isinf (r) && !dis_isnan (r);
#endif
if (!normal) {
return g_strdup_printf ("float32(0x%08x)", read32 (ptr));
+3 -2
View File
@@ -30,6 +30,7 @@
#include <mono/metadata/loader.h>
#include <mono/metadata/assembly.h>
#include <mono/metadata/appdomain.h>
#include <mono/utils/bsearch.h>
static void setup_filter (MonoImage *image);
static gboolean should_include_type (int idx);
@@ -1109,7 +1110,7 @@ dis_interfaces (MonoImage *m, guint32 typedef_row, MonoGenericContainer *contain
loc.col_idx = MONO_INTERFACEIMPL_CLASS;
loc.idx = typedef_row;
if (!bsearch (&loc, table->base, table->rows, table->row_size, table_locator))
if (!mono_binary_search (&loc, table->base, table->rows, table->row_size, table_locator))
return;
start = loc.result;
@@ -1680,7 +1681,7 @@ table_includes (TableFilter *tf, int idx)
{
if (!tf->count)
return FALSE;
return bsearch (&idx, tf->elems, tf->count, sizeof (int), int_cmp) != NULL;
return mono_binary_search (&idx, tf->elems, tf->count, sizeof (int), int_cmp) != NULL;
}
static gboolean
Regular → Executable
+38
View File
@@ -10,8 +10,13 @@
#include <glib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "util.h"
#ifdef HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
/**
* map:
* @code: code to lookup in table
@@ -122,3 +127,36 @@ data_dump (const char *data, int len, const char* prefix) {
return g_string_free (str, FALSE);
}
int
dis_isinf (double num)
{
#ifdef HAVE_ISINF
return isinf (num);
#elif defined(HAVE_IEEEFP_H)
fpclass_t klass;
klass = fpclass (num);
if (klass == FP_NINF)
return -1;
if (klass == FP_PINF)
return 1;
return 0;
#elif defined(HAVE__FINITE)
return _finite (num) ? 0 : 1;
#else
#error "Don't know how to implement isinf for this platform."
#endif
}
int
dis_isnan (double num)
{
#ifdef __MINGW32_VERSION
return _isnan (num);
#else
return isnan (num);
#endif
}
Regular → Executable
+2
View File
@@ -8,3 +8,5 @@ const char *flags (guint32 code, dis_map_t *table);
void hex_dump (const char *buffer, int base, int count);
char* data_dump (const char *data, int len, const char* prefix);
extern int dis_isinf (double num);
extern int dis_isnan (double num);
Regular → Executable
+6
View File
@@ -24,7 +24,13 @@
#include <winsock2.h>
#include <windows.h>
#include <winbase.h>
/*
* The mingw version says:
* /usr/i686-pc-mingw32/sys-root/mingw/include/ws2tcpip.h:38:2: error: #error "ws2tcpip.h is not compatible with winsock.h. Include winsock2.h instead."
*/
#ifdef _MSC_VER
#include <ws2tcpip.h>
#endif
#include <psapi.h>
#include <shlobj.h>
#include <mswsock.h>
+3 -2
View File
@@ -17,12 +17,13 @@
#include <mono/io-layer/wapi-private.h>
#include <mono/io-layer/misc-private.h>
#include <mono/io-layer/messages.h>
#include <mono/utils/bsearch.h>
#undef DEBUG
typedef struct {
int id;
const char const *txt;
const char *txt;
} ErrorDesc;
static ErrorDesc common_messages [] = {
@@ -1830,7 +1831,7 @@ find_msg (guint32 id, ErrorDesc *base, int n)
ErrorDesc d, *result;
d.id = id;
result = bsearch (&d, base, n, sizeof (ErrorDesc), msg_compare);
result = mono_binary_search (&d, base, n, sizeof (ErrorDesc), msg_compare);
if (result == NULL)
return NULL;
return result->txt;
+50 -1
View File
@@ -42,6 +42,8 @@
#include <mono/utils/mono-logger-internal.h>
#include <mono/utils/mono-memory-model.h>
#include <mono/utils/atomic.h>
#include <mono/utils/bsearch.h>
MonoStats mono_stats;
gboolean mono_print_vtable = FALSE;
@@ -1426,6 +1428,52 @@ mono_class_setup_fields (MonoClass *class)
MonoGenericContainer *container = NULL;
MonoClass *gtd = class->generic_class ? mono_class_get_generic_type_definition (class) : NULL;
/*
* FIXME: We have a race condition here. It's possible that this function returns
* to its caller with `instance_size` set to `0` instead of the actual size. This
* is not a problem when the function is called recursively on the same class,
* because the size will be initialized by the outer invocation. What follows is a
* description of how it can occur in other cases, too. There it is a problem,
* because it can lead to the GC being asked to allocate an object of size `0`,
* which SGen chokes on. The race condition is triggered infrequently by
* `tests/sgen-suspend.cs`.
*
* This function is called for a class whenever one of its subclasses is inited.
* For example, it's called for every subclass of Object. What it does is this:
*
* if (class->setup_fields_called)
* return;
* ...
* class->instance_size = 0;
* ...
* class->setup_fields_called = 1;
* ... critical point
* class->instance_size = actual_instance_size;
*
* The last two steps are sometimes reversed, but that only changes the way in which
* the race condition works.
*
* Assume thread A goes through this function and makes it to the critical point.
* Now thread B runs the function and, since `setup_fields_called` is set, returns
* immediately, but `instance_size` is incorrect.
*
* The other case looks like this:
*
* if (class->setup_fields_called)
* return;
* ... critical point X
* class->instance_size = 0;
* ... critical point Y
* class->instance_size = actual_instance_size;
* ...
* class->setup_fields_called = 1;
*
* Assume thread A goes through the function and makes it to critical point X. Now
* thread B runs through the whole of the function, returning, assuming
* `instance_size` is set. At that point thread A gets to run and makes it to
* critical point Y, at which time `instance_size` is `0` again, invalidating thread
* B's assumption.
*/
if (class->setup_fields_called)
return;
@@ -1503,6 +1551,7 @@ mono_class_setup_fields (MonoClass *class)
mono_memory_barrier ();
class->size_inited = 1;
class->fields_inited = 1;
class->setup_fields_called = 1;
return;
}
@@ -2645,7 +2694,7 @@ compare_interface_ids (const void *p_key, const void *p_element) {
/*FIXME verify all callers if they should switch to mono_class_interface_offset_with_variance*/
int
mono_class_interface_offset (MonoClass *klass, MonoClass *itf) {
MonoClass **result = bsearch (
MonoClass **result = mono_binary_search (
itf,
klass->interfaces_packed,
klass->interface_offsets_count,
+2 -1
View File
@@ -30,6 +30,7 @@
#include <mono/metadata/metadata-internals.h>
#include <mono/metadata/class-internals.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/bsearch.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
@@ -731,7 +732,7 @@ mono_debug_symfile_lookup_method (MonoDebugHandle *handle, MonoMethod *method)
first_ie = (MonoSymbolFileMethodEntry *)
(symfile->raw_contents + read32(&(symfile->offset_table->_method_table_offset)));
ie = bsearch (GUINT_TO_POINTER (mono_method_get_token (method)), first_ie,
ie = mono_binary_search (GUINT_TO_POINTER (mono_method_get_token (method)), first_ie,
read32(&(symfile->offset_table->_method_count)),
sizeof (MonoSymbolFileMethodEntry), compare_method);
+3 -1
View File
@@ -625,6 +625,8 @@ int mono_framework_version (void) MONO_INTERNAL;
void mono_reflection_cleanup_domain (MonoDomain *domain) MONO_INTERNAL;
void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;;
void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;
MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot) MONO_INTERNAL;
#endif /* __MONO_METADATA_DOMAIN_INTERNALS_H__ */
+18 -4
View File
@@ -331,8 +331,14 @@ jit_info_table_chunk_index (MonoJitInfoTableChunk *chunk, MonoThreadHazardPointe
return left;
}
/*
* mono_jit_info_table_find_internal:
*
* If TRY_AOT is FALSE, avoid loading information for missing methods from AOT images, which is currently not async safe.
* In this case, only those AOT methods will be found whose jit info is already loaded.
*/
MonoJitInfo*
mono_jit_info_table_find (MonoDomain *domain, char *addr)
mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot)
{
MonoJitInfoTable *table;
MonoJitInfo *ji;
@@ -402,13 +408,21 @@ mono_jit_info_table_find (MonoDomain *domain, char *addr)
ji = NULL;
/* Maybe its an AOT module */
image = mono_jit_info_find_aot_module ((guint8*)addr);
if (image)
ji = jit_info_find_in_aot_func (domain, image, addr);
if (try_aot) {
image = mono_jit_info_find_aot_module ((guint8*)addr);
if (image)
ji = jit_info_find_in_aot_func (domain, image, addr);
}
return ji;
}
MonoJitInfo*
mono_jit_info_table_find (MonoDomain *domain, char *addr)
{
return mono_jit_info_table_find_internal (domain, addr, TRUE);
}
static G_GNUC_UNUSED void
jit_info_table_check (MonoJitInfoTable *table)
{
+6 -5
View File
@@ -84,6 +84,7 @@
#include <mono/utils/mono-mmap.h>
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/mono-digest.h>
#include <mono/utils/bsearch.h>
#if defined (HOST_WIN32)
#include <windows.h>
@@ -7947,7 +7948,7 @@ compare_method_imap (const void *key, const void *elem)
static gpointer
find_method_icall (const IcallTypeDesc *imap, const char *name)
{
const guint16 *nameslot = bsearch (name, icall_names_idx + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names_idx [0]), compare_method_imap);
const guint16 *nameslot = mono_binary_search (name, icall_names_idx + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names_idx [0]), compare_method_imap);
if (!nameslot)
return NULL;
return (gpointer)icall_functions [(nameslot - &icall_names_idx [0])];
@@ -7963,7 +7964,7 @@ compare_class_imap (const void *key, const void *elem)
static const IcallTypeDesc*
find_class_icalls (const char *name)
{
const guint16 *nameslot = bsearch (name, icall_type_names_idx, Icall_type_num, sizeof (icall_type_names_idx [0]), compare_class_imap);
const guint16 *nameslot = mono_binary_search (name, icall_type_names_idx, Icall_type_num, sizeof (icall_type_names_idx [0]), compare_class_imap);
if (!nameslot)
return NULL;
return &icall_type_descs [nameslot - &icall_type_names_idx [0]];
@@ -7981,7 +7982,7 @@ compare_method_imap (const void *key, const void *elem)
static gpointer
find_method_icall (const IcallTypeDesc *imap, const char *name)
{
const char **nameslot = bsearch (name, icall_names + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names [0]), compare_method_imap);
const char **nameslot = mono_binary_search (name, icall_names + imap->first_icall, icall_desc_num_icalls (imap), sizeof (icall_names [0]), compare_method_imap);
if (!nameslot)
return NULL;
return (gpointer)icall_functions [(nameslot - icall_names)];
@@ -7997,7 +7998,7 @@ compare_class_imap (const void *key, const void *elem)
static const IcallTypeDesc*
find_class_icalls (const char *name)
{
const char **nameslot = bsearch (name, icall_type_names, Icall_type_num, sizeof (icall_type_names [0]), compare_class_imap);
const char **nameslot = mono_binary_search (name, icall_type_names, Icall_type_num, sizeof (icall_type_names [0]), compare_class_imap);
if (!nameslot)
return NULL;
return &icall_type_descs [nameslot - icall_type_names];
@@ -8208,7 +8209,7 @@ mono_lookup_icall_symbol (MonoMethod *m)
func = mono_lookup_internal_call (m);
if (!func)
return NULL;
slot = bsearch (func, functions_sorted, G_N_ELEMENTS (icall_functions), sizeof (gpointer), func_cmp);
slot = mono_binary_search (func, functions_sorted, G_N_ELEMENTS (icall_functions), sizeof (gpointer), func_cmp);
if (!slot)
return NULL;
g_assert (slot);
+6 -5
View File
@@ -24,6 +24,7 @@
#include <mono/metadata/locales.h>
#include <mono/metadata/culture-info.h>
#include <mono/metadata/culture-info-tables.h>
#include <mono/utils/bsearch.h>
#ifndef DISABLE_NORMALIZATION
#include <mono/metadata/normalization-tables.h>
@@ -313,7 +314,7 @@ construct_culture_from_specific_name (MonoCultureInfo *ci, gchar *name)
MONO_ARCH_SAVE_REGS;
ne = bsearch (name, culture_name_entries, NUM_CULTURE_ENTRIES,
ne = mono_binary_search (name, culture_name_entries, NUM_CULTURE_ENTRIES,
sizeof (CultureInfoNameEntry), culture_name_locator);
if (ne == NULL)
@@ -332,7 +333,7 @@ culture_info_entry_from_lcid (int lcid)
{
const CultureInfoEntry *ci;
ci = bsearch (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
ci = mono_binary_search (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
return ci;
}
@@ -345,7 +346,7 @@ region_info_entry_from_lcid (int lcid)
MONO_ARCH_SAVE_REGS;
ne = bsearch (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
ne = mono_binary_search (&lcid, culture_entries, NUM_CULTURE_ENTRIES, sizeof (CultureInfoEntry), culture_lcid_locator);
if (ne == NULL)
return FALSE;
@@ -537,7 +538,7 @@ ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (
MONO_ARCH_SAVE_REGS;
n = mono_string_to_utf8 (name);
ne = bsearch (n, culture_name_entries, NUM_CULTURE_ENTRIES,
ne = mono_binary_search (n, culture_name_entries, NUM_CULTURE_ENTRIES,
sizeof (CultureInfoNameEntry), culture_name_locator);
if (ne == NULL) {
@@ -591,7 +592,7 @@ ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_name (M
MONO_ARCH_SAVE_REGS;
n = mono_string_to_utf8 (name);
ne = bsearch (n, region_name_entries, NUM_REGION_ENTRIES,
ne = mono_binary_search (n, region_name_entries, NUM_REGION_ENTRIES,
sizeof (RegionInfoNameEntry), region_name_locator);
if (ne == NULL) {
+21 -4
View File
@@ -122,9 +122,14 @@ mono_string_from_byvalwstr (gunichar2 *data, int len);
static void
mono_byvalarray_to_array (MonoArray *arr, gpointer native_arr, MonoClass *eltype, guint32 elnum);
static void
mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum);
static void
mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *eltype, guint32 elnum);
static void
mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum);
static MonoAsyncResult *
mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params);
@@ -239,7 +244,9 @@ mono_marshal_init (void)
register_icall (mono_array_to_lparray, "mono_array_to_lparray", "ptr object", FALSE);
register_icall (mono_free_lparray, "mono_free_lparray", "void object ptr", FALSE);
register_icall (mono_byvalarray_to_array, "mono_byvalarray_to_array", "void object ptr ptr int32", FALSE);
register_icall (mono_byvalarray_to_byte_array, "mono_byvalarray_to_byte_array", "void object ptr int32", FALSE);
register_icall (mono_array_to_byvalarray, "mono_array_to_byvalarray", "void ptr object ptr int32", FALSE);
register_icall (mono_array_to_byte_byvalarray, "mono_array_to_byte_byvalarray", "void ptr object int32", FALSE);
register_icall (mono_delegate_to_ftnptr, "mono_delegate_to_ftnptr", "ptr object", FALSE);
register_icall (mono_ftnptr_to_delegate, "mono_ftnptr_to_delegate", "object ptr ptr", FALSE);
register_icall (mono_marshal_asany, "mono_marshal_asany", "ptr object int32 int32", FALSE);
@@ -692,6 +699,12 @@ mono_byvalarray_to_array (MonoArray *arr, gpointer native_arr, MonoClass *elclas
g_assert_not_reached ();
}
static void
mono_byvalarray_to_byte_array (MonoArray *arr, gpointer native_arr, guint32 elnum)
{
mono_byvalarray_to_array (arr, native_arr, mono_defaults.byte_class, elnum);
}
static void
mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *elclass, guint32 elnum)
{
@@ -715,6 +728,12 @@ mono_array_to_byvalarray (gpointer native_arr, MonoArray *arr, MonoClass *elclas
}
}
static void
mono_array_to_byte_byvalarray (gpointer native_arr, MonoArray *arr, guint32 elnum)
{
mono_array_to_byvalarray (native_arr, arr, mono_defaults.byte_class, elnum);
}
void
mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text)
{
@@ -1346,9 +1365,8 @@ emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_byte (mb, CEE_LDIND_REF);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_ptr (mb, mono_defaults.byte_class);
mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
mono_mb_emit_icall (mb, mono_byvalarray_to_array);
mono_mb_emit_icall (mb, mono_byvalarray_to_byte_array);
break;
}
case MONO_MARSHAL_CONV_STR_BYVALSTR:
@@ -1721,9 +1739,8 @@ emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_REF);
mono_mb_emit_ptr (mb, mono_defaults.byte_class);
mono_mb_emit_icon (mb, mspec->data.array_data.num_elem);
mono_mb_emit_icall (mb, mono_array_to_byvalarray);
mono_mb_emit_icall (mb, mono_array_to_byte_byvalarray);
mono_mb_patch_short_branch (mb, pos);
break;
}
Loaded 100 of 136 files, more files were not shown because too many files have changed in this diff. Show more