Merge pull request #4967 from kumpera/profiler-arg-cleanup
authorRodrigo Kumpera <kumpera@users.noreply.github.com>
Mon, 12 Jun 2017 17:07:24 +0000 (10:07 -0700)
committerGitHub <noreply@github.com>
Mon, 12 Jun 2017 17:07:24 +0000 (10:07 -0700)
Rework profiler argument handling.

272 files changed:
.gitmodules
configure.ac
eglib/src/eglib-config.h.in
eglib/src/gfile-posix.c
external/api-snapshot
external/bockbuild
external/buildtools [deleted submodule]
external/corefx
external/corert
external/ikdasm
external/xunit-binaries
man/mono.1
mcs/build/tests.make
mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs
mcs/class/Mono.Debugger.Soft/Test/dtest.cs
mcs/class/Mono.Options/Test/Mono.Options/CommandSetTest.cs
mcs/class/Mono.Options/Test/Mono.Options/OptionContextTest.cs
mcs/class/Mono.Options/Test/Mono.Options/OptionSetTest.cs
mcs/class/Mono.Options/Test/Mono.Options/OptionTest.cs
mcs/class/Mono.Posix/Mono.Unix/UnixEncoding.cs
mcs/class/Mono.Posix/Mono.Unix/UnixMarshal.cs
mcs/class/Mono.Security/Mono.Security.Interface/IMonoSslStream.cs
mcs/class/Mono.Security/Mono.Security_test.dll.sources
mcs/class/Mono.Security/Test/Mono.Security.Interface/TestProvider.cs [new file with mode: 0644]
mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/IToolboxItemProvider.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCollection.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/PrintAction.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs [deleted file]
mcs/class/System.Drawing/System.Drawing.dll.sources
mcs/class/System.Drawing/System.Drawing/BitmapSuffixInSameAssemblyAttribute.cs [deleted file]
mcs/class/System.Drawing/System.Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs [deleted file]
mcs/class/System.Drawing/System.Drawing/IDeviceContext.cs [deleted file]
mcs/class/System.Drawing/System.Drawing/Image.cs
mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs [deleted file]
mcs/class/System.Numerics/System.Numerics_xtest.dll.sources
mcs/class/System.Web/System.Web.Configuration_2.0/WebConfigurationHost.cs
mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs
mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
mcs/class/System/Mono.AppleTls/AppleTlsStream.cs
mcs/class/System/Mono.AppleTls/ImportExport.cs
mcs/class/System/Mono.Btls/MonoBtlsContext.cs
mcs/class/System/Mono.Btls/MonoBtlsObject.cs
mcs/class/System/Mono.Btls/MonoBtlsSsl.cs
mcs/class/System/Mono.Btls/MonoBtlsStream.cs
mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs
mcs/class/System/Mono.Net.Security/LegacySslStream.cs
mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs
mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.cs
mcs/class/System/ReferenceSources/SR2.cs
mcs/class/System/System.Net.Security/SslStream.cs
mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs
mcs/class/System/System.Net.Sockets/Socket.cs
mcs/class/System/common.sources
mcs/class/System/net_4_x_System.dll.sources
mcs/class/Xunit.NetCore.Extensions/Makefile [deleted file]
mcs/class/Xunit.NetCore.Extensions/Microsoft.Xunit.Performance/BenchmarkAttribute.cs [deleted file]
mcs/class/Xunit.NetCore.Extensions/Microsoft.Xunit.Performance/BenchmarkDiscover.cs [deleted file]
mcs/class/Xunit.NetCore.Extensions/Xunit.NetCore.Extensions.dll.sources [deleted file]
mcs/class/corlib/System.Diagnostics.Tracing/EventListener.cs
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs
mcs/class/corlib/System.Runtime.InteropServices/CALLCONV.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/ELEMDESC.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/FUNCDESC.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/FUNCFLAGS.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/FUNCKIND.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/IDLDESC.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/IDLFLAG.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/IMPLTYPEFLAGS.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/PARAMDESC.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/PARAMFLAG.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/TYPEATTR.cs [deleted file]
mcs/class/corlib/System.Runtime.InteropServices/TYPEDESC.cs [deleted file]
mcs/class/corlib/System.Runtime.Remoting.Messaging/CADMessages.cs
mcs/class/corlib/System.Security.AccessControl/AceType.cs
mcs/class/corlib/System.Security.Policy/PolicyException.cs
mcs/class/corlib/Test/System.Reflection.Emit/TypeBuilderTest.cs
mcs/class/corlib/Test/System.Threading/WaitHandleTest.cs
mcs/class/corlib/corlib.dll.sources
mcs/class/referencesource/mscorlib/system/runtime/interopservices/ucomitypeinfo.cs
mcs/errors/cs0019-72.cs [new file with mode: 0644]
mcs/errors/cs0128-3.cs [new file with mode: 0644]
mcs/errors/cs0128-4.cs [new file with mode: 0644]
mcs/errors/cs0136-20.cs [new file with mode: 0644]
mcs/errors/cs0155-5.cs [new file with mode: 0644]
mcs/errors/cs0162-21.cs [new file with mode: 0644]
mcs/errors/cs0165-56.cs [new file with mode: 0644]
mcs/errors/cs0173-6.cs [new file with mode: 0644]
mcs/errors/cs0411-25.cs [new file with mode: 0644]
mcs/errors/cs0815-7.cs [deleted file]
mcs/errors/cs1061-15.cs
mcs/errors/cs1503-17.cs [deleted file]
mcs/errors/cs1617.cs
mcs/errors/cs1644-47.cs
mcs/errors/cs1644-51.cs [new file with mode: 0644]
mcs/errors/cs1644-52.cs [new file with mode: 0644]
mcs/errors/cs8046.cs [deleted file]
mcs/errors/cs8047.cs [deleted file]
mcs/errors/cs8116.cs [new file with mode: 0644]
mcs/errors/cs8117.cs [new file with mode: 0644]
mcs/errors/cs8122.cs [new file with mode: 0644]
mcs/errors/cs8188.cs [new file with mode: 0644]
mcs/errors/cs8196-2.cs [new file with mode: 0644]
mcs/errors/cs8196.cs [new file with mode: 0644]
mcs/errors/cs8197.cs [new file with mode: 0644]
mcs/errors/cs8198.cs [new file with mode: 0644]
mcs/errors/cs8200-2.cs [new file with mode: 0644]
mcs/errors/cs8200-3.cs [new file with mode: 0644]
mcs/errors/cs8200-4.cs [new file with mode: 0644]
mcs/errors/cs8200-5.cs [new file with mode: 0644]
mcs/errors/cs8200-6.cs [new file with mode: 0644]
mcs/errors/cs8200.cs [new file with mode: 0644]
mcs/errors/cs8201.cs [new file with mode: 0644]
mcs/errors/cs8208.cs [new file with mode: 0644]
mcs/mcs/anonymous.cs
mcs/mcs/argument.cs
mcs/mcs/assign.cs
mcs/mcs/async.cs
mcs/mcs/cfold.cs
mcs/mcs/context.cs
mcs/mcs/convert.cs
mcs/mcs/cs-parser.jay
mcs/mcs/cs-tokenizer.cs
mcs/mcs/dynamic.cs
mcs/mcs/ecore.cs
mcs/mcs/expression.cs
mcs/mcs/generic.cs
mcs/mcs/linq.cs
mcs/mcs/namespace.cs
mcs/mcs/nullable.cs
mcs/mcs/report.cs
mcs/mcs/settings.cs
mcs/mcs/statement.cs
mcs/mcs/typespec.cs
mcs/tests/gtest-409.cs
mcs/tests/known-issues-net_4_x
mcs/tests/test-946.cs [new file with mode: 0644]
mcs/tests/test-99.cs
mcs/tests/test-decl-expr-01.cs
mcs/tests/test-decl-expr-02.cs
mcs/tests/test-decl-expr-03.cs [new file with mode: 0644]
mcs/tests/test-decl-expr-04.cs [new file with mode: 0644]
mcs/tests/test-pattern-01.cs
mcs/tests/test-pattern-02.cs
mcs/tests/test-static-using-13.cs [new file with mode: 0644]
mcs/tests/test-throw-expr-01.cs [new file with mode: 0644]
mcs/tests/test-throw-expr-02.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/mkbundle/mkbundle.cs
mono/btls/btls-bio.c
mono/btls/btls-ssl.c
mono/btls/btls-ssl.h
mono/dis/dump.c
mono/dis/get.c
mono/dis/main.c
mono/dis/monodis.1
mono/metadata/Makefile.am
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/boehm-gc.c
mono/metadata/console-unix.c
mono/metadata/gc.c
mono/metadata/handle.h
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/marshal.c
mono/metadata/method-builder.c
mono/metadata/method-builder.h
mono/metadata/mono-config.c
mono/metadata/nacl-stub.c [deleted file]
mono/metadata/object-internals.h
mono/metadata/object-offsets.h
mono/metadata/sgen-mono.c
mono/metadata/threads.c
mono/metadata/w32event-unix.c
mono/metadata/w32file-unix.c
mono/metadata/w32handle.c
mono/metadata/w32handle.h
mono/metadata/w32mutex-unix.c
mono/metadata/w32semaphore-unix.c
mono/metadata/w32socket-unix.c
mono/metadata/w32socket-win32.c
mono/metadata/w32socket.c
mono/metadata/w32socket.h
mono/mini/Makefile.am.in
mono/mini/aot-compiler.c
mono/mini/aot-runtime.c
mono/mini/branch-opts.c
mono/mini/debugger-agent.c
mono/mini/driver.c
mono/mini/exceptions.cs
mono/mini/genmdesc.c
mono/mini/helpers.c
mono/mini/image-writer.c
mono/mini/interp/interp-internals.h
mono/mini/interp/interp.c
mono/mini/interp/transform.c
mono/mini/jit-icalls.c
mono/mini/jit-icalls.h
mono/mini/jit.h
mono/mini/method-to-ir.c
mono/mini/mini-amd64.c
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-cross-helpers.c
mono/mini/mini-mips.h
mono/mini/mini-posix.c
mono/mini/mini-ppc.h
mono/mini/mini-runtime.c
mono/mini/mini-x86.h
mono/mini/mini.c
mono/mini/mini.h
mono/mini/regalloc.h
mono/mini/tramp-arm.c
mono/mini/tramp-arm64.c
mono/mini/tramp-ppc.c
mono/mini/tramp-x86.c
mono/profiler/Makefile.am
mono/profiler/mprof-report.c
mono/sgen/sgen-workers.c
mono/tests/Makefile.am
mono/tests/bug-45841-fpstack-exceptions.il
mono/utils/dlmalloc.c
mono/utils/mono-context.c
mono/utils/mono-context.h
mono/utils/mono-dl.h
mono/utils/mono-mmap.c
mono/utils/mono-rand.c
mono/utils/mono-threads-posix-signals.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
mono/utils/monobitset.c
msvc/libmonoruntime.vcxproj
msvc/libmonoruntime.vcxproj.filters
nacl/README [deleted file]
nacl/common.sh [deleted file]
nacl/config-nacl-runtime.cache [deleted file]
nacl/config-nacl-runtime64.cache [deleted file]
nacl/nacl-runtime-mono.sh [deleted file]
nacl/nacl_interp_loader_sdk.sh [deleted file]
packaging/MacSDK/libgdiplus.py
packaging/MacSDK/msbuild.py
packaging/MacSDKRelease/mono-extensions.py
runtime/Makefile.am
runtime/mono-wrapper.in
scripts/ci/run-test-default.sh
tools/offsets-tool/MonoAotOffsetsDumper.cs
winconfig.h

index 73d55a0a9b903a2f261f9a60b0dfee03b66f0a3c..4e968d7a066307ccc1089bbbfdf715a8fc923e2c 100644 (file)
@@ -26,9 +26,6 @@
 [submodule "external/nuget-buildtasks"]
        path = external/nuget-buildtasks
        url = git://github.com/mono/NuGet.BuildTasks
-[submodule "external/buildtools"]
-       path = external/buildtools
-       url = git://github.com/mono/buildtools.git
 [submodule "external/cecil-legacy"]
        path = external/cecil-legacy
        url = git://github.com/mono/cecil.git
index c5c7ba58b9e3cfbd99ec0da64a13c1f3872cee0f..6ee80da49b6c8eeab839abbda70da17c51212eb0 100644 (file)
@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 #AC_PREREQ([2.62])
 
-AC_INIT(mono, [5.3.0],
+AC_INIT(mono, [5.5.0],
         [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
 
 AC_CONFIG_SRCDIR([README.md])
@@ -264,17 +264,8 @@ case "$host" in
                with_sgen_default_concurrent=yes
                ;;
        *-*-nacl*)
-               CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
-               if test "x$disable_munmap" != "xyes"; then
-                       CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
-               fi
-               libmono_cflags="-D_REENTRANT"
-               libdl=
-               libgc_threads=pthreads
-               use_sigposix=yes
-               ikvm_native=no
-               AC_DEFINE(DISABLE_SOCKETS,1,[Disable sockets support])
-               AC_DEFINE(DISABLE_ATTACH, 1, [Disable agent attach support])
+               echo "nacl no longer supported."
+               exit 1
                ;;
        *-*-hpux*)
                CPPFLAGS="$CPPFLAGS -DGC_HPUX_THREADS -D_HPUX_SOURCE -D_XOPEN_SOURCE_EXTENDED -D_REENTRANT"
@@ -743,10 +734,6 @@ fi
 
 AM_CONDITIONAL(DISABLE_LIBRARIES, test x$enable_libraries = xno)
 
-case $host in
-*nacl* ) with_shared_mono=yes;;
-esac
-
 if test "x$host_win32" = "xyes"; then
    # Boehm GC requires the runtime to be in its own dll
    with_static_mono=no
@@ -1371,8 +1358,6 @@ AC_TRY_COMPILE([
        AC_DEFINE_UNQUOTED(MONO_ZERO_LEN_ARRAY, 1, [Length of zero length arrays])
 ])
 
-AC_CHECK_HEADERS(nacl/nacl_dyncode.h)
-
 dnl ***********************************
 dnl *** Checks for signals
 dnl ***********************************
@@ -2220,13 +2205,11 @@ if test x$host_win32 = xno; then
        dnl **********************************
        dnl *** epoll                      ***
        dnl **********************************
-       if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xno"; then
-               AC_CHECK_HEADERS(sys/epoll.h)
-               haveepoll=no
-               AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
-               if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
-                       AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
-               fi
+       AC_CHECK_HEADERS(sys/epoll.h)
+       haveepoll=no
+       AC_CHECK_FUNCS(epoll_ctl, [haveepoll=yes], )
+       if test "x$haveepoll" = "xyes" -a "x$ac_cv_header_sys_epoll_h" = "xyes"; then
+               AC_DEFINE(HAVE_EPOLL, 1, [epoll supported])
        fi
 
        havekqueue=no
@@ -2859,40 +2842,6 @@ fi
 AM_CONDITIONAL(ENABLE_DTRACE, [test x$enable_dtrace = xyes])
 AM_CONDITIONAL(DTRACE_G_REQUIRED, [test x$dtrace_g = xyes])
 
-dnl **************
-dnl ***  NaCl  ***
-dnl **************
-
-AC_ARG_ENABLE(nacl_codegen, [  --enable-nacl-codegen      Enable Native Client code generation], enable_nacl_codegen=$enableval, enable_nacl_codegen=no)
-AC_ARG_ENABLE(nacl_gc, [  --enable-nacl-gc           Enable Native Client garbage collection], enable_nacl_gc=$enableval, enable_nacl_gc=no)
-
-AM_CONDITIONAL(NACL_CODEGEN, test x$enable_nacl_codegen != xno)
-
-dnl
-dnl Hack to use system mono for operations in build/install not allowed in NaCl.
-dnl
-nacl_self_host=""
-if test "x$ac_cv_header_nacl_nacl_dyncode_h" = "xyes"; then
-   nacl_self_host="nacl_self_host"
-fi
-AC_SUBST(nacl_self_host)
-
-if test "x$enable_nacl_codegen" = "xyes"; then
-   MONO_NACL_ALIGN_MASK_OFF=1
-   AC_DEFINE(TARGET_NACL, 1, [...])
-   AC_DEFINE(__native_client_codegen__, 1, [...])
-fi
-if test "x$enable_nacl_gc" = "xyes"; then
-   if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
-      INSTRUMENT_CFLAG="-finstrument-for-thread-suspension"
-   else
-      # Not yet implemented
-      INSTRUMENT_CFLAG=""
-   fi
-   CPPFLAGS="$CPPFLAGS $INSTRUMENT_CFLAG -D__native_client_gc__"
-fi
-AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
-
 dnl **************************
 dnl *** AOT cross offsets  ***
 dnl **************************
@@ -3155,12 +3104,6 @@ case "$host" in
                  mingw*)
                        ;;
                esac
-               case "$host" in
-                       x86_64-*-nacl*)
-                               AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
-                               sizeof_register=8
-                               ;;
-               esac
                ;;
        sparc*-*-*)
                if test "x$ac_cv_sizeof_void_p" = "x8"; then
@@ -3241,13 +3184,6 @@ case "$host" in
                ACCESS_UNALIGNED="no"
                CPPFLAGS="$CPPFLAGS -D__ARM_EABI__"
                ;;
-# TODO: make proper support for NaCl host.
-#        arm*-*nacl)
-#              TARGET=ARM;
-#              arch_target=arm;
-#              ACCESS_UNALIGNED="no"
-#              AOT_SUPPORTED="no"
-#              ;;
        aarch64-*)
                # https://lkml.org/lkml/2012/7/15/133
                TARGET=ARM64
@@ -3308,38 +3244,6 @@ if test "x$host" != "x$target"; then
                sizeof_register=8
                target_byte_order=G_BIG_ENDIAN
                ;;
-   x86_64-*-nacl)
-               TARGET=AMD64
-               arch_target=amd64
-               AC_DEFINE(TARGET_AMD64, 1, [...])
-               AC_DEFINE(__mono_ilp32__, 1, [64 bit mode with 4 byte longs and pointers])
-               sizeof_register=8
-               ;;
-# TODO: make proper support for NaCl target.
-#   arm*-*nacl)
-#              TARGET=ARM
-#              arch_target=arm
-#              AC_DEFINE(TARGET_ARM, 1, [...])
-#              ACCESS_UNALIGNED="no"
-#              sizeof_register=4
-#               CPPFLAGS="$CPPFLAGS \
-#                    -D__ARM_EABI__ \
-#                    -D__arm__ \
-#                    -D__portable_native_client__ \
-#                    -Dtimezone=_timezone \
-#                    -DDISABLE_SOCKETS \
-#                    -DDISABLE_ATTACH \
-#                    -DUSE_NEWLIB"
-               # Can't use tls, since it depends on the runtime detection of tls offsets
-               # in mono-compiler.h
-#              with_tls=pthread
-#              ;;
-   i686-*-nacl)
-               TARGET=X86
-               arch_target=x86
-               AC_DEFINE(TARGET_X86, 1, [...])
-               sizeof_register=4
-               ;;
    arm*-linux-*)
                TARGET=ARM;
                arch_target=arm;
@@ -3630,6 +3534,11 @@ fi
 
 AM_CONDITIONAL(ENABLE_INTERPRETER, [test x$enable_interpreter = xyes])
 
+if test "x$enable_interpreter" = "xyes" || test "x$mono_feature_disable_jit" != "xyes"; then
+       AC_DEFINE(HAVE_ONLINE_VES, 1, [Some VES is available at runtime])
+fi
+
+AM_CONDITIONAL(HAVE_ONLINE_VES, [test x$enable_interpreter = xyes] || [test x$mono_feature_disable_jit != xyes])
 
 dnl 
 dnl Simple Generational checks (sgen)
index ae7b6d45337183fb48d52b2593f26b7d0c0de28f..71797575e685c1107665e4eb14481f1fcb3a796f 100644 (file)
@@ -32,7 +32,7 @@ typedef signed   @GSIZE@ gssize;
 #define G_HAVE_ISO_VARARGS
 #endif
 
-#if defined (__native_client__) || defined (HOST_WATCHOS)
+#if defined (HOST_WATCHOS)
 #undef G_BREAKPOINT
 #define G_BREAKPOINT()
 #endif
index 49ee58a142fdee1c3e723bcac104c9a8174e4450..48a9192ab69fad8ea0d2ce2d195549af6442982e 100644 (file)
@@ -154,15 +154,6 @@ g_file_open_tmp (const gchar *tmpl, gchar **name_used, GError **error)
 gchar *
 g_get_current_dir (void)
 {
-#ifdef __native_client__
-       char *buffer;
-       if ((buffer = g_getenv("NACL_PWD"))) {
-               buffer = g_strdup(buffer);
-       } else {
-               buffer = g_strdup(".");
-       }
-       return buffer;
-#else
        int s = 32;
        char *buffer = NULL, *r;
        gboolean fail;
@@ -181,5 +172,4 @@ g_get_current_dir (void)
         * so we return the buffer here since it has a pointer to the valid string
         */
        return buffer;
-#endif
 }
index bb16afac3deaa1cd8f798668b04b5510cfcd53ba..1563f6ea5ba2f4c6f3e9c6e625ee8b16e3a1d39e 160000 (submodule)
@@ -1 +1 @@
-Subproject commit bb16afac3deaa1cd8f798668b04b5510cfcd53ba
+Subproject commit 1563f6ea5ba2f4c6f3e9c6e625ee8b16e3a1d39e
index 4f39b930ed66009c54f2326451644ca9d06e4d30..fe467c0593d199e5d4d29be9c69c5d487449dd8b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 4f39b930ed66009c54f2326451644ca9d06e4d30
+Subproject commit fe467c0593d199e5d4d29be9c69c5d487449dd8b
diff --git a/external/buildtools b/external/buildtools
deleted file mode 160000 (submodule)
index b5cc6e6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit b5cc6e6ab5f71f6c0be7b730058b426e92528479
index e49886bd091487abfbf5de934a451c5a8fe7f4c5..bc22b1f08545261b7dc18f312dcd5b4f04768ecb 160000 (submodule)
@@ -1 +1 @@
-Subproject commit e49886bd091487abfbf5de934a451c5a8fe7f4c5
+Subproject commit bc22b1f08545261b7dc18f312dcd5b4f04768ecb
index 814f76de6a972c5c3dd3ec6b10dc900fd73d08d2..48dba73801e804e89f00311da99d873f9c550278 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 814f76de6a972c5c3dd3ec6b10dc900fd73d08d2
+Subproject commit 48dba73801e804e89f00311da99d873f9c550278
index 88b67c42ca8b7d58141c176b46749819bfcef166..1d7d43603791e0236b56d076578657bee44fef6b 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 88b67c42ca8b7d58141c176b46749819bfcef166
+Subproject commit 1d7d43603791e0236b56d076578657bee44fef6b
index b8e20d265b368dd6252703d5afd038d0b028e388..d4433b0972f40cb3efaa3fbba52869bde5df8fa8 160000 (submodule)
@@ -1 +1 @@
-Subproject commit b8e20d265b368dd6252703d5afd038d0b028e388
+Subproject commit d4433b0972f40cb3efaa3fbba52869bde5df8fa8
index b23581535c583425416b8a9dc3fdf8ae78451a89..e822ff94c89b2aa98b745633ab4fcff87fbdb2ba 100644 (file)
@@ -181,6 +181,16 @@ Gives the path for the temporary LLVM bitcode file created during AOT.
 .I info
 Print the architecture the AOT in this copy of Mono targets and quit.
 .TP
+.I interp
+Generates all required wrappers, so that it is possible to run --interpreter without
+any code generation at runtime.  This option only makes sense with \fBmscorlib.dll\fR.
+Embedders can set
+
+.nf
+mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP);
+.fi
+.ne
+.TP
 .I ld-flags
 Additional flags to pass to the C linker (if the current AOT mode calls for invoking it).
 .TP
@@ -1091,11 +1101,6 @@ code generation backend.   For example \fBLLVM_COUNT=10\fR would only
 compile 10 methods with LLVM and then switch to the Mono JIT engine.
 \fBLLVM_COUNT=0\fR would disable the LLVM engine altogether.
 .TP
-\fBMONO_AOT_CACHE\fR
-If set, this variable will instruct Mono to ahead-of-time compile new
-assemblies on demand and store the result into a cache in
-~/.mono/aot-cache. 
-.TP
 \fBMONO_ASPNET_INHIBIT_SETTINGSMAP\fR
 Mono contains a feature which allows modifying settings in the .config files shipped
 with Mono by using config section mappers. The mappers and the mapping rules are
index 0d01b5429ce4239f7bdfa0f5d4573c674fa73acc..8874b32326aa3f87550a5ff3a863a1e5d5fd6b04 100644 (file)
@@ -20,9 +20,10 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
 ifndef NO_TEST
 
 test_nunit_lib = nunitlite.dll
-xunit_core := xunit.core xunit.abstractions xunit.assert
+xunit_core := xunit.core xunit.abstractions xunit.assert Xunit.NetCore.Extensions
 xunit_deps := System.Runtime
-xunit_class_deps := Xunit.NetCore.Extensions
+xunit_src  := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs)
+xunit_class_deps := 
 
 xunit_libs_ref = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(xunit_core))
 xunit_libs_ref += $(patsubst %,-r:$(topdir)/class/lib/$(PROFILE)/Facades/%.dll,$(xunit_deps))
@@ -89,9 +90,6 @@ endif
 
 tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
 
-$(topdir)/class/lib/$(PROFILE)/$(PARENT_PROFILE)Xunit.NetCore.Extensions.dll:
-       $(MAKE) -C $(topdir)/class/Xunit.NetCore.Extensions
-
 endif
 
 test_assemblies :=
@@ -222,8 +220,8 @@ run-xunit-test-lib: xunit-test-local
        $$ok
        @rm -f xunit.execution.desktop.dll
 
-$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep)
-       $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response)
+$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src)
+       $(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
 
 xtest_response_preprocessed = $(xtest_response)_preprocessed
 
index 400b43ce34f599f808362bdbeaaac26778451e68..d2b408a68eddb940fcbbcb85275ba88d2336bb1e 100644 (file)
@@ -1165,10 +1165,18 @@ public class Tests : TestsBase, ITest2
                return 42;
        }
 
+       public int invoke_pass_nullable (int? i) {
+               return (int)i;
+       }
+
        public int? invoke_return_nullable_null () {
                return null;
        }
 
+       public int invoke_pass_nullable_null (int? i) {
+               return i.HasValue ? 1 : 2;
+       }
+
        public void invoke_type_load () {
                new Class3 ();
        }
index 631b5985db1ff7129d11b1443984be1b7c2fabcb..5f80228fe2fb2c43dc7d2a131888664db4574174 100644 (file)
@@ -2617,6 +2617,11 @@ public class DebuggerTests
                m = s.Type.GetMethod ("ToString");
                v = s.InvokeMethod (e.Thread, m, null);
 
+               // pass nullable as argument
+               m = t.GetMethod ("invoke_pass_nullable");
+               v = this_obj.InvokeMethod (e.Thread, m, new Value [] { s });
+               AssertValue (42, v);
+
                // return nullable null
                m = t.GetMethod ("invoke_return_nullable_null");
                v = this_obj.InvokeMethod (e.Thread, m, null);
@@ -2630,6 +2635,13 @@ public class DebuggerTests
                m = s.Type.GetMethod ("ToString");
                v = s.InvokeMethod (e.Thread, m, null);
 
+               // pass nullable null as argument
+               m = t.GetMethod ("invoke_pass_nullable_null");
+               v = this_obj.InvokeMethod (e.Thread, m, new Value [] { s });
+               AssertValue (2, v);
+
+               return;
+
                // pass primitive
                m = t.GetMethod ("invoke_pass_primitive");
                Value[] args = new Value [] {
index a195e43a80fece366f07955f14f5d4df52af17a4..d5a86615513a363f3e5a8ab6fe3f7f8f91401831 100644 (file)
@@ -228,7 +228,7 @@ namespace MonoTests.Mono.Options
                        e.Run = (args) => e.CommandSet.Out.WriteLine (string.Join (" ", args));
 
                        var o = new StringWriter ();
-                       var c = new CommandSet ("set", output:o) {
+                       var c = new CommandSet ("set", output:o, error: Console.Error) {
                                e,
                        };
                        Assert.AreEqual (0, c.Run (new [] { "help", "echo" }));
index 09ffecbc1e9452af353bced8dd640e144be987cb..362d3ea61a1742e9b08d8654829d0b6b228fb248 100644 (file)
@@ -56,7 +56,7 @@ namespace MonoTests.Mono.Options
                                        c, v => { string ignore = v.OptionValues [0]; });
                        c.Option = p [0];
                        Utils.AssertException (typeof(ArgumentOutOfRangeException),
-                                       "Specified argument was out of the range of valid values.\nParameter name: index",
+                                       $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: index",
                                        c, v => { string ignore = v.OptionValues [2]; });
                        c.OptionName = "-a";
                        Utils.AssertException (typeof(OptionException),
index 572223ebd667110f30f7aa6dd013693c351b4180..790d55dea2d44fe103ff237b95e6e8bbf9c46568 100644 (file)
@@ -374,10 +374,10 @@ namespace MonoTests.Mono.Options
                                        p, v => { v.Parse (_("-a", "-b")); });
                        Assert.AreEqual (a, "-b");
                        Utils.AssertException (typeof(ArgumentNullException),
-                                       "Value cannot be null.\nParameter name: option",
+                                       $"Value cannot be null.{Environment.NewLine}Parameter name: option",
                                        p, v => { v.Add ((Option) null); });
                        Utils.AssertException (typeof(ArgumentNullException),
-                                       "Value cannot be null.\nParameter name: header",
+                                       $"Value cannot be null.{Environment.NewLine}Parameter name: header",
                                        p, v => { v.Add ((string) null); });
 
                        // bad type
@@ -394,10 +394,10 @@ namespace MonoTests.Mono.Options
                                        p, v => { v.Parse (_("-cz", "extra")); });
 
                        Utils.AssertException (typeof(ArgumentNullException), 
-                                       "Value cannot be null.\nParameter name: action",
+                                       $"Value cannot be null.{Environment.NewLine}Parameter name: action",
                                        p, v => { v.Add ("foo", (Action<string>) null); });
                        Utils.AssertException (typeof(ArgumentException), 
-                                       "Cannot provide maxValueCount of 2 for OptionValueType.None.\nParameter name: maxValueCount",
+                                       $"Cannot provide maxValueCount of 2 for OptionValueType.None.{Environment.NewLine}Parameter name: maxValueCount",
                                        p, v => { v.Add ("foo", (k, val) => {/* ignore */}); });
                }
 
@@ -772,7 +772,7 @@ namespace MonoTests.Mono.Options
                        Utils.AssertException (typeof(ArgumentException), "prototypes must be null!",
                                        p, v => { v.Add ("N|NUM=", (int n) => {}); });
                        Utils.AssertException (typeof(ArgumentNullException),
-                                       "Value cannot be null.\nParameter name: option",
+                                       $"Value cannot be null.{Environment.NewLine}Parameter name: option",
                                        p, v => { v.GetOptionForName (null); });
                }
 
index 999e6f45b61241e66b737c7561a0ecb6482683f0..42a998ea55cdbe33193a8d0c4cd3d9b918da0045 100644 (file)
@@ -66,60 +66,60 @@ namespace MonoTests.Mono.Options
                {
                        object p = null;
                        Utils.AssertException (typeof(ArgumentNullException), 
-                                       "Value cannot be null.\nParameter name: prototype", 
+                                       $"Value cannot be null.{Environment.NewLine}Parameter name: prototype", 
                                        p, v => { new DefaultOption (null, null); });
                        Utils.AssertException (typeof(ArgumentException), 
-                                       "Cannot be the empty string.\nParameter name: prototype",
+                                       $"Cannot be the empty string.{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Empty option names are not supported.\nParameter name: prototype",
+                                       $"Empty option names are not supported.{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("a|b||c=", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Conflicting option types: '=' vs. ':'.\nParameter name: prototype",
+                                       $"Conflicting option types: '=' vs. ':'.{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("a=|b:", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "The default option handler '<>' cannot require values.\nParameter name: prototype",
+                                       $"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("<>=", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "The default option handler '<>' cannot require values.\nParameter name: prototype",
+                                       $"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("<>:", null); });
                        Utils.AssertException (null, null,
                                        p, v => { new DefaultOption ("t|<>=", null, 1); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "The default option handler '<>' cannot require values.\nParameter name: prototype",
+                                       $"The default option handler '<>' cannot require values.{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("t|<>=", null, 2); });
                        Utils.AssertException (null, null,
                                        p, v => { new DefaultOption ("a|b=", null, 2); });
                        Utils.AssertException (typeof(ArgumentOutOfRangeException),
-                                       "Specified argument was out of the range of valid values.\nParameter name: maxValueCount",
+                                       $"Specified argument was out of the range of valid values.{Environment.NewLine}Parameter name: maxValueCount",
                                        p, v => { new DefaultOption ("a", null, -1); });
                        Utils.AssertException (typeof(ArgumentException),
                                        "Cannot provide maxValueCount of 0 for OptionValueType.Required or " +
-                                               "OptionValueType.Optional.\nParameter name: maxValueCount",
+                                               $"OptionValueType.Optional.{Environment.NewLine}Parameter name: maxValueCount",
                                        p, v => { new DefaultOption ("a=", null, 0); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Ill-formed name/value separator found in \"a={\".\nParameter name: prototype",
+                                       "Ill-formed name/value separator found in \"a={\"." + Environment.NewLine + "Parameter name: prototype",
                                        p, v => { new DefaultOption ("a={", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Ill-formed name/value separator found in \"a=}\".\nParameter name: prototype",
+                                       "Ill-formed name/value separator found in \"a=}\"." + Environment.NewLine + "Parameter name: prototype",
                                        p, v => { new DefaultOption ("a=}", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Ill-formed name/value separator found in \"a={{}}\".\nParameter name: prototype",
+                                       "Ill-formed name/value separator found in \"a={{}}\"." + Environment.NewLine + "Parameter name: prototype",
                                        p, v => { new DefaultOption ("a={{}}", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Ill-formed name/value separator found in \"a={}}\".\nParameter name: prototype",
+                                       "Ill-formed name/value separator found in \"a={}}\"." + Environment.NewLine + "Parameter name: prototype",
                                        p, v => { new DefaultOption ("a={}}", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Ill-formed name/value separator found in \"a={}{\".\nParameter name: prototype",
+                                       "Ill-formed name/value separator found in \"a={}{\"." + Environment.NewLine + "Parameter name: prototype",
                                        p, v => { new DefaultOption ("a={}{", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
+                                       $"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("a==", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
+                                       $"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("a={}", null); });
                        Utils.AssertException (typeof(ArgumentException),
-                                       "Cannot provide key/value separators for Options taking 1 value(s).\nParameter name: prototype",
+                                       $"Cannot provide key/value separators for Options taking 1 value(s).{Environment.NewLine}Parameter name: prototype",
                                        p, v => { new DefaultOption ("a=+-*/", null); });
                        Utils.AssertException (null, null,
                                        p, v => { new DefaultOption ("a", null, 0); });
index 1d8e40ca45cf5ac5e4fcec6e97eaa6f754790c51..d869b1b90c68bb7d8a4dc47142c597d70c0f5835 100644 (file)
@@ -300,17 +300,35 @@ public class UnixEncoding : Encoding
                        throw new ArgumentOutOfRangeException ("byteIndex", _("ArgRange_Array"));
                }
 
+               unsafe {
+                       fixed (char* p = s) {
+                               fixed (byte* b = bytes) {
+                                       return GetBytes (p + charIndex, charCount, b + byteIndex, bytes.Length - byteIndex);
+                               }
+                       }
+               }
+       }
+
+       public unsafe override int GetBytes(char* chars, int charCount, byte* bytes, int byteCount)
+       {
+               if (bytes == null || chars == null)
+                       throw new ArgumentNullException (bytes == null ? "bytes" : "chars");
+
+               if (charCount < 0 || byteCount < 0)
+                       throw new ArgumentOutOfRangeException (charCount < 0 ? "charCount" : "byteCount");
+                       
                // Convert the characters into bytes.
                char ch;
-               int length = bytes.Length;
+               int length = byteCount;
                uint pair;
-               int posn = byteIndex;
+               int posn = 0;
+               int charIndex = 0;
                while (charCount > 0) {
                        // Fetch the next UTF-16 character pair value.
-                       ch = s[charIndex++];
+                       ch = chars [charIndex++];
                        if (ch >= '\uD800' && ch <= '\uDBFF' && charCount > 1) {
                                // This may be the start of a surrogate pair.
-                               pair = (uint)(s[charIndex]);
+                               pair = (uint)(chars[charIndex]);
                                if (pair >= (uint)0xDC00 && pair <= (uint)0xDFFF) {
                                        pair = (pair - (uint)0xDC00) +
                                                   ((((uint)ch) - (uint)0xD800) << 10) +
@@ -326,7 +344,7 @@ public class UnixEncoding : Encoding
                                }
                                charCount -= 2;
                                if (charCount >= 0) {
-                                       bytes[posn++] = (byte) s [charIndex++];
+                                       bytes[posn++] = (byte)chars [charIndex++];
                                }
                                continue;
                        } else {
@@ -365,7 +383,7 @@ public class UnixEncoding : Encoding
                }
 
                // Return the final count to the caller.
-               return posn - byteIndex;
+               return posn;
        }
 
        // Internal version of "GetCharCount" which can handle a rolling
@@ -394,7 +412,7 @@ public class UnixEncoding : Encoding
                uint leftSoFar = (leftOverCount & (uint)0x0F);
                uint leftSize = ((leftOverCount >> 4) & (uint)0x0F);
                while (count > 0) {
-                       ch = (uint)(bytes[index++]);
+                       ch = (uint)(bytes [index++]);
                        ++next_raw;
                        --count;
                        if (leftSize == 0) {
index 334b6f2a49b42c089ea2b1492109021cbc75628a..0b01eb19ad40fc1592cd78c2ed3aa74f6a1c6a7e 100644 (file)
@@ -325,27 +325,42 @@ namespace Mono.Unix {
                        if (encoding == null)
                                throw new ArgumentNullException ("encoding");
 
-                       int min_byte_count = encoding.GetMaxByteCount(1);
-                       char[] copy = s.ToCharArray (index, count);
-                       byte[] marshal = new byte [encoding.GetByteCount (copy) + min_byte_count];
+                       if (index < 0 || count < 0)
+                               throw new ArgumentOutOfRangeException ((index < 0 ? "index" : "count"),
+                                        "Non - negative number required.");
 
-                       int bytes_copied = encoding.GetBytes (copy, 0, copy.Length, marshal, 0);
+                       if (s.Length - index < count)
+                               throw new ArgumentOutOfRangeException ("s", "Index and count must refer to a location within the string.");
 
-                       if (bytes_copied != (marshal.Length-min_byte_count))
-                               throw new NotSupportedException ("encoding.GetBytes() doesn't equal encoding.GetByteCount()!");
+                       int null_terminator_count = encoding.GetMaxByteCount (1);
+                       int length_without_null = encoding.GetByteCount (s);
+                       int marshalLength = checked (length_without_null + null_terminator_count);
 
-                       IntPtr mem = AllocHeap (marshal.Length);
+                       IntPtr mem = AllocHeap (marshalLength);
                        if (mem == IntPtr.Zero)
                                throw new UnixIOException (Native.Errno.ENOMEM);
 
-                       bool copied = false;
-                       try {
-                               Marshal.Copy (marshal, 0, mem, marshal.Length);
-                               copied = true;
-                       }
-                       finally {
-                               if (!copied)
-                                       FreeHeap (mem);
+                       unsafe {
+                               fixed (char* p = s) {
+                                       byte* marshal = (byte*)mem;
+                                       int bytes_copied;
+
+                                       try {
+                                               bytes_copied = encoding.GetBytes (p + index, count, marshal, marshalLength);
+                                       } catch {
+                                               FreeHeap (mem);
+                                               throw;
+                                       }
+
+                                       if (bytes_copied != length_without_null) {
+                                               FreeHeap (mem);
+                                               throw new NotSupportedException ("encoding.GetBytes() doesn't equal encoding.GetByteCount()!");
+                                       }
+
+                                       marshal += length_without_null;
+                                       for (int i = 0; i < null_terminator_count; ++i)
+                                               marshal[i] = 0;
+                               }
                        }
 
                        return mem;
index 4982e8044770054d00257db4ad577db6263b326a..00556863db9c5c4397e41d6ee370cc827979d4f8 100644 (file)
@@ -86,6 +86,8 @@ namespace Mono.Security.Interface
 
                void EndWrite (IAsyncResult asyncResult);
 
+               Task ShutdownAsync ();
+
                TransportContext TransportContext {
                        get;
                }
index 9d5ac35f66a98d80bdbb38d92bb63566bca9a5a1..c9e33efc77003eb666e15a8a88f87631bfb371b6 100644 (file)
@@ -27,6 +27,7 @@ Mono.Security.Cryptography/PKCS8Test.cs
 Mono.Security.Cryptography/RSAManagedTest.cs
 Mono.Security.Cryptography/SHA224ManagedTest.cs
 Mono.Security.Cryptography/SHA224Test.cs
+Mono.Security.Interface/TestProvider.cs
 Mono.Security.Protocol.Ntlm/ChallengeResponseTest.cs
 Mono.Security.Protocol.Ntlm/MessageBaseTest.cs
 Mono.Security.Protocol.Ntlm/Type1MessageTest.cs
diff --git a/mcs/class/Mono.Security/Test/Mono.Security.Interface/TestProvider.cs b/mcs/class/Mono.Security/Test/Mono.Security.Interface/TestProvider.cs
new file mode 100644 (file)
index 0000000..4a2b34a
--- /dev/null
@@ -0,0 +1,47 @@
+//
+// TestProvider.cs
+//
+// Author:
+//       Martin Baulig <mabaul@microsoft.com>
+//
+// Copyright (c) 2017 Xamarin, Inc.
+//
+// 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.
+using System;
+using System.IO;
+using System.Security.Cryptography;
+using System.Text;
+
+using Mono.Security;
+using Mono.Security.Interface;
+using NUnit.Framework;
+
+namespace MonoTests.Mono.Security
+{
+       [TestFixture]
+       public class TestProvider
+       {
+               [Test]
+               public void GetProvider ()
+               {
+                       var provider = MonoTlsProviderFactory.GetProvider ();
+                       Assert.IsNotNull (provider, "TLS Provider");
+               }
+       }
+}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs b/mcs/class/System.Drawing/System.Drawing.Design/CategoryNameCollection.cs
deleted file mode 100644 (file)
index 7a0abfa..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-//
-// System.Drawing.Design.CategoryNameCollection.cs
-//
-// Authors:
-//     Alejandro Sánchez Acosta
-//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-// 
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.
-//
-
-using System.Collections;
-
-namespace System.Drawing.Design
-{
-       public sealed class CategoryNameCollection : ReadOnlyCollectionBase
-       {
-               
-               public CategoryNameCollection (CategoryNameCollection value)
-               {
-                       if (value == null)
-                               throw new ArgumentNullException ("value");
-                       InnerList.AddRange (value);
-               }
-
-               public CategoryNameCollection (string[] value)
-               {
-                       if (value == null)
-                               throw new ArgumentNullException ("value");
-                       InnerList.AddRange (value);
-               }
-
-               public string this[int index] {
-                       get {
-                               return (string) InnerList[index];
-                       }
-               }
-
-               public bool Contains (string value)
-               {
-                       return InnerList.Contains (value);
-               }
-               
-               public void CopyTo (string[] array, int index)
-               {
-                       InnerList.CopyTo (array, index);
-               }
-               
-               public int IndexOf (string value)
-               {
-                       return InnerList.IndexOf (value);
-               }
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs b/mcs/class/System.Drawing/System.Drawing.Design/IPropertyValueUIService.cs
deleted file mode 100644 (file)
index dc3ba64..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-// System.Drawing.Design.IPropertyValueUIService.cs
-//
-// Author:
-//     Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-//     
-// (C) Alejandro Sánchez Acosta
-// 
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-using System.Drawing;
-using System.ComponentModel;
-
-namespace System.Drawing.Design
-{
-       public interface IPropertyValueUIService
-       {
-               
-               #region Methods         
-               void AddPropertyValueUIHandler (PropertyValueUIHandler newHandler);
-               PropertyValueUIItem[] GetPropertyUIValueItems (ITypeDescriptorContext context, PropertyDescriptor propDesc);
-
-               void NotifyPropertyValueUIItemsChanged ();
-
-               void RemovePropertyValueUIHandler (PropertyValueUIHandler newHandler);
-               #endregion Methods
-
-               #region Events
-               event EventHandler PropertyUIValueItemsChanged;
-               #endregion Events
-       }
-}
-
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IToolboxItemProvider.cs b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxItemProvider.cs
deleted file mode 100644 (file)
index c057880..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-// Authors:
-//
-//   Jordi Mas i Hernandez <jordimash@gmail.com>
-//
-//
-
-
-namespace System.Drawing.Design
-{
-       public interface IToolboxItemProvider
-       {
-               ToolboxItemCollection Items { get; }
-       }
-}
-
-
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxService.cs
deleted file mode 100644 (file)
index 532119a..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-//
-// System.Drawing.Design.IToolboxService.cs
-//
-// Authors:
-//     Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.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.
-//
-
-using System.Collections;
-using System.ComponentModel.Design;
-using System.Runtime.InteropServices;
-
-namespace System.Drawing.Design {
-
-       [ComImport]
-       [Guid("4BACD258-DE64-4048-BC4E-FEDBEF9ACB76"),
-       InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-       public interface IToolboxService
-       {
-               CategoryNameCollection CategoryNames {get;}
-
-               string SelectedCategory {get; set;}
-
-               void AddCreator (ToolboxItemCreatorCallback creator, string format);
-
-               void AddCreator (ToolboxItemCreatorCallback creator, string format, IDesignerHost host);
-
-               void AddLinkedToolboxItem (ToolboxItem toolboxItem, IDesignerHost host);
-
-               void AddLinkedToolboxItem (ToolboxItem toolboxItem, string category, IDesignerHost host);
-
-               void AddToolboxItem (ToolboxItem toolboxItem, String category);
-
-               void AddToolboxItem (ToolboxItem toolboxItem);
-
-               ToolboxItem DeserializeToolboxItem (object serializedObject);
-
-               ToolboxItem DeserializeToolboxItem (object serializedObject, IDesignerHost host);
-
-               ToolboxItem GetSelectedToolboxItem ();
-
-               ToolboxItem GetSelectedToolboxItem (IDesignerHost host);
-
-               ToolboxItemCollection GetToolboxItems ();
-
-               ToolboxItemCollection GetToolboxItems (IDesignerHost host);
-
-               ToolboxItemCollection GetToolboxItems (String category);
-
-               ToolboxItemCollection GetToolboxItems (String category, IDesignerHost host);
-
-               bool IsSupported (object serializedObject, ICollection filterAttributes);
-
-               bool IsSupported (object serializedObject, IDesignerHost host);
-
-               bool IsToolboxItem (object serializedObject);
-
-               bool IsToolboxItem (object serializedObject, IDesignerHost host);
-
-               void Refresh();
-
-               void RemoveCreator (string format);
-
-               void RemoveCreator (string format, IDesignerHost host);
-
-               void RemoveToolboxItem (ToolboxItem toolboxItem);
-
-               void RemoveToolboxItem (ToolboxItem toolboxItem, string category);
-
-               void SelectedToolboxItemUsed ();
-
-               object SerializeToolboxItem (ToolboxItem toolboxItem);
-
-               bool SetCursor ();
-
-               void SetSelectedToolboxItem (ToolboxItem toolboxItem);
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs b/mcs/class/System.Drawing/System.Drawing.Design/IToolboxUser.cs
deleted file mode 100644 (file)
index 20362f8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// System.Drawing.Design.IToolboxUser.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// 
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing.Design
-{
-       public interface IToolboxUser
-       {
-               bool GetToolSupported (ToolboxItem tool);
-
-               void ToolPicked (ToolboxItem tool);
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Design/PaintValueEventArgs.cs
deleted file mode 100644 (file)
index 837f39b..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-// System.Drawing.Design.PaintvalueEventArgs.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// 
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.
-//
-
-using System.ComponentModel;
-
-namespace System.Drawing.Design
-{
-       public class PaintValueEventArgs : EventArgs
-       {
-               private ITypeDescriptorContext context;
-               private object value;
-               private Graphics graphics;
-               private Rectangle bounds;
-               
-               public PaintValueEventArgs(ITypeDescriptorContext context, object value, Graphics graphics, Rectangle bounds) 
-               {
-                       if (graphics == null)
-                               throw new ArgumentNullException ("graphics");
-                       this.context = context;
-                       this.value = value;
-                       this.graphics = graphics;
-                       this.bounds = bounds;
-               }
-
-               public Rectangle Bounds 
-               {
-                       get {
-                               return bounds;
-                       }
-               }
-
-               public ITypeDescriptorContext Context 
-               {
-                       get {
-                               return context;
-                       }
-               }
-
-               public Graphics Graphics 
-               {
-                       get {
-                               return graphics;
-                       }                               
-               }
-
-               public object Value 
-               {
-                       get {
-                               return value;
-                       }
-               }
-       }
-}
-
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueItem.cs
deleted file mode 100644 (file)
index 422728a..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-//
-// System.Drawing.Design.PropertyValueItem.cs
-// 
-// Authors:
-//  Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-// 
-// (C) Alejandro Sánchez Acosta
-// (C) 2003 Andreas Nahr
-// 
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing.Design
-{
-       public class PropertyValueUIItem
-       {
-
-               private Image uiItemImage;
-               private PropertyValueUIItemInvokeHandler handler;
-               private string tooltip;
-
-               public PropertyValueUIItem (Image uiItemImage,
-                       PropertyValueUIItemInvokeHandler handler, string tooltip)
-               {
-                       if (uiItemImage == null)
-                               throw new ArgumentNullException ("uiItemImage");
-                       if (handler == null)
-                               throw new ArgumentNullException ("handler");
-                       this.uiItemImage = uiItemImage;
-                       this.handler = handler;
-                       this.tooltip = tooltip;
-               }
-
-               public virtual Image Image 
-               {
-                       get
-                       {
-                               return uiItemImage;
-                       }
-               }
-
-               public virtual PropertyValueUIItemInvokeHandler InvokeHandler
-               {
-                       get
-                       {
-                               return handler;
-                       }
-               }
-
-               public virtual string ToolTip 
-               {
-                       get
-                       {
-                               return tooltip;
-                       }
-               }
-
-               public virtual void Reset()
-               {
-                       // To be overriden in child classes
-               }
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIHandler.cs
deleted file mode 100644 (file)
index 28fba43..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// System.Drawing.Design.PropertyValueUIHandler.cs
-//
-// Author:
-//     Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-//
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.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.
-//
-
-using System.Collections;
-using System.ComponentModel;
-
-namespace System.Drawing.Design {
-
-       public delegate void PropertyValueUIHandler (ITypeDescriptorContext context, PropertyDescriptor propDesc, ArrayList valueUIItemList);
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs
deleted file mode 100644 (file)
index ff0293b..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// System.Drawing.Design.PropertyValueUIItemInvokeHandler.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.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.
-//
-
-using System.ComponentModel;
-
-namespace System.Drawing.Design {
-
-       public delegate void PropertyValueUIItemInvokeHandler (
-                                  ITypeDescriptorContext context,
-                                  PropertyDescriptor descriptor,
-                                  PropertyValueUIItem invokedItem);
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
deleted file mode 100644 (file)
index f7969b9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-// System.Drawing.Design.ToolboxComponentsCreatedEventArgs.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// 
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.
-//
-
-using System.ComponentModel;
-
-namespace System.Drawing.Design
-{
-       public class ToolboxComponentsCreatedEventArgs : EventArgs
-       {
-               private IComponent[] components;
-               
-               public ToolboxComponentsCreatedEventArgs (IComponent[] components) {
-                       this.components = components;
-               }
-
-               public IComponent[] Components {
-                       get {
-                               return components;
-                       }
-               }       
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs
deleted file mode 100644 (file)
index 52a35ad..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// System.Drawing.Design.IDesignerHost.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing.Design {
-
-       public delegate void ToolboxComponentsCreatedEventHandler (object sender, ToolboxComponentsCreatedEventArgs e);
-}
-
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
deleted file mode 100644 (file)
index fde3cb3..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// System.Drawing.Design.ToolboxComponentsCreatingEventArgs.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// 
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.
-//
-
-using System.ComponentModel.Design;
-using System.Security.Permissions;
-
-namespace System.Drawing.Design
-{
-       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
-       [PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
-       public class ToolboxComponentsCreatingEventArgs : EventArgs
-       {
-               private IDesignerHost host;
-               
-               public ToolboxComponentsCreatingEventArgs (IDesignerHost host)
-               {
-                       this.host = host;
-               }
-
-               public IDesignerHost DesignerHost {
-                       get {
-                               return host;                            
-                       }
-               }
-       }       
-}
-
-
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs
deleted file mode 100644 (file)
index 7cab3df..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// System.Drawing.Design.ToolboxComponentsCreatingEventHandler.cs
-// 
-// Author:
-//     Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing.Design {
-
-       public delegate void ToolboxComponentsCreatingEventHandler (object sender, ToolboxComponentsCreatingEventArgs e);
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCollection.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCollection.cs
deleted file mode 100644 (file)
index dc76d7a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-// System.Drawing.Design.ToolboxItemCollection.cs
-//
-// Authors:
-//  Martin Willemoes Hansen (mwh@sysrq.dk)
-//  Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-// (C) 2003 Martin Willemoes Hansen
-// (C) 2003 Andreas Nahr
-//
-
-//
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.
-//
-
-using System.Collections;
-using System.Security.Permissions;
-
-namespace System.Drawing.Design
-{
-       [PermissionSet (SecurityAction.LinkDemand, Unrestricted = true)]
-       public sealed class ToolboxItemCollection : ReadOnlyCollectionBase
-       {
-
-               public ToolboxItemCollection (ToolboxItem[] value) : base()
-               {
-                       InnerList.AddRange (value);
-               }
-
-               public ToolboxItemCollection (ToolboxItemCollection value) : base()
-               {
-                       InnerList.AddRange (value);
-               }
-
-               public ToolboxItem this [int index] {
-                       get { return (ToolboxItem) InnerList[index]; }
-               }
-
-               public bool Contains (ToolboxItem value)
-               {
-                       return InnerList.Contains (value);
-               }
-
-               public void CopyTo (ToolboxItem[] array, int index)
-               {
-                       InnerList.CopyTo (array, index);
-               }
-
-               public int IndexOf (ToolboxItem value)
-               {
-                       return InnerList.IndexOf (value);
-               }
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs b/mcs/class/System.Drawing/System.Drawing.Design/ToolboxItemCreatorCallback.cs
deleted file mode 100644 (file)
index 4df4cd6..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// System.Drawing.Design.ToolboxItemCreatorCallback.cs
-// 
-// Author:
-//      Alejandro Sánchez Acosta  <raciel@es.gnu.org>
-// 
-// (C) Alejandro Sánchez Acosta
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing.Design {
-
-       public delegate ToolboxItem ToolboxItemCreatorCallback(
-                                  object serializedObject,
-                                  string format);
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs b/mcs/class/System.Drawing/System.Drawing.Design/UITypeEditorEditStyle.cs
deleted file mode 100644 (file)
index 97c4807..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-//
-// System.Drawing.Design.UITypeEditorEditStyle.cs
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-// Author: Dennis Hayes (dennish@raytek.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;
-namespace System.Drawing.Design
-{
-       public enum  UITypeEditorEditStyle{
-                       DropDown=3,
-                       Modal=2,
-                       None=1
-       }
-}
\ No newline at end of file
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PreviewPageInfo.cs
deleted file mode 100644 (file)
index 4242b05..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//
-// System.Drawing.PreviewPageInfo.cs
-//
-// Author:
-//   Dennis Hayes (dennish@Raytek.com)
-//
-// (C) 2002 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;
-
-namespace System.Drawing.Printing
-{
-       /// <summary>
-       /// Summary description for PreviewPageInfo.
-       /// </summary>
-       public sealed class PreviewPageInfo {
-               Image image;
-               Size physicalSize;
-               public PreviewPageInfo(Image image, Size physicalSize) {
-                       this.image = image;
-                       this.physicalSize = physicalSize;
-               }
-               public Image Image {
-                       get{
-                               return image;
-                       }
-               }
-               public Size PhysicalSize{
-                       get{
-                               return physicalSize;
-                       }
-               }
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintAction.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintAction.cs
deleted file mode 100644 (file)
index f401dda..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-// Authors:
-//
-//   Jordi Mas i Hernandez <jordimash@gmail.com>
-//
-//
-
-
-using System;
-
-namespace System.Drawing.Printing
-{
-       public enum PrintAction
-       {
-               PrintToFile     = 0,
-               PrintToPreview  = 1,
-               PrintToPrinter  = 2
-       }
-
-}
-
-
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintEventHandler.cs
deleted file mode 100644 (file)
index 2cff92b..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Drawing.PrintEventHandler.cs
-//
-// Author:
-//   Dennis Hayes (dennish@Raytek.com)
-//
-// (C) 2002 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;
-
-namespace System.Drawing.Printing
-{
-       /// <summary>
-       /// Summary description for PrintEventHandler.
-       /// </summary>
-       public delegate void PrintEventHandler(object sender, PrintEventArgs e);
-}
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintPageEventHandler.cs
deleted file mode 100644 (file)
index e60998d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//\r
-// System.Drawing.PrintPageEventHandler.cs\r
-//\r
-// Author:\r
-//   Dennis Hayes (dennish@Raytek.com)\r
-//\r
-// (C) 2002 Ximian, Inc\r
-//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;\r
-\r
-namespace System.Drawing.Printing\r
-{\r
-       /// <summary>\r
-       /// Summary description for PrintPageEventHandler.\r
-       /// </summary>\r
-       public delegate void PrintPageEventHandler(object sender, PrintPageEventArgs e);\r
-}\r
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrinterUnit.cs
deleted file mode 100644 (file)
index ff9264c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-//\r
-// System.Drawing.PrinterUnit.cs\r
-//\r
-// (C) 2002 Ximian, Inc.  http://www.ximian.com\r
-// Author: Dennis Hayes (dennish@raytek.com)\r
-//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;\r
-namespace System.Drawing.Printing \r
-{\r
-       public enum PrinterUnit {\r
-               Display = 0,\r
-               HundredthsOfAMillimeter = 2,\r
-               TenthsOfAMillimeter = 3,\r
-               ThousandthsOfAnInch = 1\r
-       }\r
-}\r
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingPermissionLevel.cs
deleted file mode 100644 (file)
index 6e663d4..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-//\r
-// System.Drawing.PrintingPermissionLevel.cs\r
-//\r
-// Author:
-//     Dennis Hayes (dennish@raytek.com)\r
-//
-// (C) 2002 Ximian, Inc.  http://www.ximian.com\r
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing.Printing {
-
-       [Serializable]
-       public enum PrintingPermissionLevel {\r
-               AllPrinting = 3,\r
-               DefaultPrinting = 2,\r
-               NoPrinting = 0,\r
-               SafePrinting = 1\r
-       }\r
-}\r
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs b/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventArgs.cs
deleted file mode 100644 (file)
index 2e92150..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-//\r
-// System.Drawing.QueryPageSettingsEventArgs.cs\r
-//\r
-// Author:\r
-//   Dennis Hayes (dennish@Raytek.com)\r
-//\r
-// (C) 2002 Ximian, Inc\r
-//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;\r
-\r
-namespace System.Drawing.Printing\r
-{\r
-       /// <summary>\r
-       /// Summary description for QueryPageSettingEventArgs.\r
-       /// </summary>\r
-       public class QueryPageSettingsEventArgs : PrintEventArgs\r
-       {\r
-               private PageSettings pageSettings;\r
-\r
-               public QueryPageSettingsEventArgs(PageSettings pageSettings)\r
-               {\r
-                       this.pageSettings = pageSettings;\r
-               }\r
-               public PageSettings PageSettings {\r
-                       get{\r
-                       return pageSettings;\r
-               }\r
-                       set{\r
-                               pageSettings = value;\r
-                       }\r
-               }\r
-\r
-       }\r
-}\r
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs b/mcs/class/System.Drawing/System.Drawing.Printing/QueryPageSettingsEventHandler.cs
deleted file mode 100644 (file)
index 373eeb8..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Drawing.QueryPageSettingsEventHandler.cs
-//
-// Author:
-//   Dennis Hayes (dennish@Raytek.com)
-//
-// (C) 2002 Ximian, Inc
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-using System;
-
-namespace System.Drawing.Printing
-{
-       /// <summary>
-       /// Summary description for QueryPageSettingsEventHandler.
-       /// </summary>
-       public delegate void QueryPageSettingsEventHandler(object sender, QueryPageSettingsEventArgs e);
-}
index 4ead07ffd3361ca799fdc9f5b2562223b6c35b4d..4a10fca499eedd7e153e9d3a9ef84a30c89b18bb 100755 (executable)
@@ -2,8 +2,8 @@ Assembly/AssemblyInfo.cs
 ../../build/common/Consts.cs
 ../../build/common/Locale.cs
 System.Drawing/Bitmap.cs
-System.Drawing/BitmapSuffixInSameAssemblyAttribute.cs
-System.Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
 System.Drawing/Brush.cs
 System.Drawing/Brushes.cs
 System.Drawing/BufferedGraphics.cs
@@ -31,7 +31,7 @@ System.Drawing/KnownColor.cs
 System.Drawing/KnownColors.cs
 System.Drawing/IconConverter.cs
 System.Drawing/Icon.cs
-System.Drawing/IDeviceContext.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/IDeviceContext.cs
 System.Drawing/ImageAnimator.cs
 System.Drawing/ImageConverter.cs
 System.Drawing/Image.cs
@@ -45,7 +45,7 @@ System.Drawing/RectangleConverter.cs
 System.Drawing/Rectangle.cs
 System.Drawing/RectangleF.cs
 System.Drawing/Region.cs
-System.Drawing/RotateFlipType.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/RotateFlipType.cs
 System.Drawing/SizeConverter.cs
 System.Drawing/Size.cs
 System.Drawing/SizeF.cs
@@ -65,24 +65,24 @@ System.Drawing/SystemIcons.cs
 System.Drawing/SystemPens.cs
 System.Drawing/TextureBrush.cs
 System.Drawing/ToolboxBitmapAttribute.cs
-System.Drawing.Design/UITypeEditorEditStyle.cs
-System.Drawing.Design/IPropertyValueUIService.cs
-System.Drawing.Design/IToolboxItemProvider.cs
-System.Drawing.Design/PropertyValueItem.cs
-System.Drawing.Design/PropertyValueUIHandler.cs
-System.Drawing.Design/PropertyValueUIItemInvokeHandler.cs
-System.Drawing.Design/CategoryNameCollection.cs
-System.Drawing.Design/IToolboxService.cs
-System.Drawing.Design/IToolboxUser.cs 
-System.Drawing.Design/PaintValueEventArgs.cs
-System.Drawing.Design/ToolboxComponentsCreatedEventArgs.cs
-System.Drawing.Design/ToolboxComponentsCreatedEventHandler.cs
-System.Drawing.Design/ToolboxComponentsCreatingEventArgs.cs
-System.Drawing.Design/ToolboxComponentsCreatingEventHandler.cs
-System.Drawing.Design/ToolboxItemCreatorCallback.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxItemProvider.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItem.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PropertyValueUIItemInvokeHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/CategoryNameCollection.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxService.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IToolboxUser.cs 
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/PaintValueEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatedEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs
 System.Drawing.Design/ToolboxItem.cs
 System.Drawing.Design/UITypeEditor.cs
-System.Drawing.Design/ToolboxItemCollection.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs
 System.Drawing.Drawing2D/AdjustableArrowCap.cs
 System.Drawing.Drawing2D/Blend.cs
 System.Drawing.Drawing2D/ColorBlend.cs
@@ -165,26 +165,26 @@ System.Drawing.Printing/PaperKind.cs
 System.Drawing.Printing/PaperSize.cs
 System.Drawing.Printing/PaperSource.cs
 System.Drawing.Printing/PaperSourceKind.cs
-System.Drawing.Printing/PreviewPageInfo.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PreviewPageInfo.cs
 System.Drawing.Printing/PreviewPrintController.cs
 System.Drawing.Printing/PrintController.cs
 System.Drawing.Printing/PrintDocument.cs
 System.Drawing.Printing/PrinterResolution.cs
 System.Drawing.Printing/PrinterResolutionKind.cs
 System.Drawing.Printing/PrinterSettings.cs
-System.Drawing.Printing/PrinterUnit.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrinterUnit.cs
 System.Drawing.Printing/PrinterUnitConvert.cs
 System.Drawing.Printing/PrintEventArgs.cs
-System.Drawing.Printing/PrintEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintEventHandler.cs
 System.Drawing.Printing/PrintingPermissionAttribute.cs
 System.Drawing.Printing/PrintingPermission.cs
-System.Drawing.Printing/PrintingPermissionLevel.cs
-System.Drawing.Printing/PrintAction.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintingPermissionLevel.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintAction.cs
 System.Drawing.Printing/PrintPageEventArgs.cs
-System.Drawing.Printing/PrintPageEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/PrintPageEventHandler.cs
 System.Drawing.Printing/PrintRange.cs
-System.Drawing.Printing/QueryPageSettingsEventArgs.cs
-System.Drawing.Printing/QueryPageSettingsEventHandler.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventArgs.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Printing/QueryPageSettingsEventHandler.cs
 System.Drawing.Printing/StandardPrintController.cs
 System.Drawing.Text/FontCollection.cs
 System.Drawing.Text/PrivateFontCollection.cs
diff --git a/mcs/class/System.Drawing/System.Drawing/BitmapSuffixInSameAssemblyAttribute.cs b/mcs/class/System.Drawing/System.Drawing/BitmapSuffixInSameAssemblyAttribute.cs
deleted file mode 100644 (file)
index a76f9d7..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// System.Drawing.BitmapSuffixInSameAssemblyAttribute.cs
-//
-// Authors:
-//   Andrés G. Aragoneses (knocte@gmail.com)
-//
-// Copyright (C) 2016 Andrés G. Aragoneses
-//
-// 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.
-//
-
-using System;
-using System.ComponentModel;
-
-namespace System.Drawing
-{
-       [AttributeUsage (AttributeTargets.Assembly)]
-       public class BitmapSuffixInSameAssemblyAttribute : Attribute {
-
-               public BitmapSuffixInSameAssemblyAttribute ()
-                       : base ()
-               {
-               }
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs b/mcs/class/System.Drawing/System.Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs
deleted file mode 100644 (file)
index 3c18cb1..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-//
-// System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute.cs
-//
-// Authors:
-//   Andrés G. Aragoneses (knocte@gmail.com)
-//
-// Copyright (C) 2016 Andrés G. Aragoneses
-//
-// 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.
-//
-
-using System;
-using System.ComponentModel;
-
-namespace System.Drawing
-{
-       [AttributeUsage (AttributeTargets.Assembly)]
-       public class BitmapSuffixInSatelliteAssemblyAttribute : Attribute {
-
-               public BitmapSuffixInSatelliteAssemblyAttribute ()
-                       : base ()
-               {
-               }
-       }
-}
diff --git a/mcs/class/System.Drawing/System.Drawing/IDeviceContext.cs b/mcs/class/System.Drawing/System.Drawing/IDeviceContext.cs
deleted file mode 100644 (file)
index 795d703..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.
-//
-// Authors:
-//
-//   Jordi Mas i Hernandez <jordimash@gmail.com>
-//
-//
-
-
-using System.ComponentModel;
-
-namespace System.Drawing
-{
-       public interface IDeviceContext : IDisposable
-       {
-               IntPtr GetHdc ();
-               void ReleaseHdc ();             
-       }
-}
-
-
index 6bd89918dd66815ca07baedfa7a8a3762c54c53f..528d91004faa7372446cc5bc9081f77be8a04a28 100644 (file)
@@ -10,6 +10,7 @@
 //
 // Copyright (C) 2002 Ximian, Inc.  http://www.ximian.com
 // Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2013 Kristof Ralovich, changes are available under the terms of the MIT X11 license
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -529,16 +530,30 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer
 
        public void SetPropertyItem(PropertyItem propitem)
        {
-               throw new NotImplementedException ();
-/*
-               GdipPropertyItem pi = new GdipPropertyItem ();
-               GdipPropertyItem.MarshalTo (pi, propitem);
-               unsafe {
-                       Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
+               if (propitem == null)
+                       throw new ArgumentNullException ("propitem");
+
+               int nItemSize =  Marshal.SizeOf (propitem.Value[0]);
+               int size = nItemSize * propitem.Value.Length;
+               IntPtr dest = Marshal.AllocHGlobal (size);
+               try {
+                       GdipPropertyItem pi = new GdipPropertyItem ();
+                       pi.id    = propitem.Id;
+                       pi.len   = propitem.Len;
+                       pi.type  = propitem.Type;
+
+                       Marshal.Copy (propitem.Value, 0, dest, size);
+                       pi.value = dest;
+
+                       unsafe {
+                               Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
                        
-                       GDIPlus.CheckStatus (status);
+                               GDIPlus.CheckStatus (status);
+                       }
+               }
+               finally {
+                       Marshal.FreeHGlobal (dest);
                }
-*/
        }
 
        // properties   
diff --git a/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs b/mcs/class/System.Drawing/System.Drawing/RotateFlipType.cs
deleted file mode 100644 (file)
index e0afb64..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// System.Drawing.RotateFlipType .cs
-//
-// Author: Dennis Hayes (dennish@raytek.com)
-//
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Drawing {
-
-       public enum RotateFlipType {
-               RotateNoneFlipNone = 0,
-               Rotate180FlipXY    = 0,
-               Rotate90FlipNone   = 1,
-               Rotate270FlipXY    = 1,
-               Rotate180FlipNone  = 2,
-               RotateNoneFlipXY   = 2,
-               Rotate270FlipNone  = 3,
-               Rotate90FlipXY     = 3,
-               RotateNoneFlipX    = 4,
-               Rotate180FlipY     = 4,
-               Rotate90FlipX      = 5,
-               Rotate270FlipY     = 5,
-               Rotate180FlipX     = 6,
-               RotateNoneFlipY    = 6,
-               Rotate270FlipX     = 7,
-               Rotate90FlipY      = 7,
-       }
-}
index a012a0c1a8eff95274c3f6bbce9d4003fd3b2804..2ef111be9161a9cece92a570ca6f2de20145f72f 100644 (file)
@@ -1,3 +1,4 @@
+../../../external/corefx/src/Common/tests/System/AssertExtensions.cs
 ../../../external/corefx/src/Common/tests/System/PlatformDetection.cs
 
 # ../../../external/corefx/src/System.Runtime.Numerics/tests/*.cs
index 8f9aff4d0fd2e580e76bead3e6496dc6434d17e6..85942d311a41401ea76c73d6ac30d9fde70dd1c4 100644 (file)
@@ -174,7 +174,11 @@ namespace System.Web.Configuration
                {
                        string fullPath = (string) hostInitConfigurationParams [1];
                        map = (WebConfigurationFileMap) hostInitConfigurationParams [0];
-                       bool inAnotherApp = (bool) hostInitConfigurationParams [7];
+                       bool inAnotherApp = false;
+
+                       if ((hostInitConfigurationParams.Length > 7)
+                               && (hostInitConfigurationParams[7] is bool))
+                               inAnotherApp = (bool) hostInitConfigurationParams[7];
 
                        if (inAnotherApp)
                                appVirtualPath = fullPath;
index 3c8cb8372cda57b61f33069a5bb648ab17250b04..d3b29fa2721179ad4337eff51a0b33239b3a3801 100644 (file)
@@ -36,7 +36,11 @@ namespace Mono.AppleTls
                         */
                        var certificate2 = certificate as X509Certificate2;
                        if (certificate2 != null)
+#if MONOTOUCH
+                               return SecIdentity.Import (certificate2);
+#else
                                return SecImportExport.ItemImport (certificate2);
+#endif
 
                        /*
                         * Reading Certificates from the Mac Keychain
index 6a57babab4e274b994407f3426bc31c2c4796fbb..4fa1730df2a10ffc33fc7d9a5a792259737b8db6 100644 (file)
@@ -848,12 +848,12 @@ namespace Mono.AppleTls
                [DllImport (SecurityLibrary)]
                extern static /* OSStatus */ SslStatus SSLClose (/* SSLContextRef */ IntPtr context);
 
-               public override void Close ()
+               public override void Shutdown ()
                {
                        if (Interlocked.Exchange (ref pendingIO, 1) == 1)
                                throw new InvalidOperationException ();
 
-                       Debug ("Close");
+                       Debug ("Shutdown");
 
                        lastException = null;
 
@@ -862,7 +862,7 @@ namespace Mono.AppleTls
                                        return;
 
                                var status = SSLClose (Handle);
-                               Debug ("Close done: {0}", status);
+                               Debug ("Shutdown done: {0}", status);
                                CheckStatusAndThrow (status);
                        } finally {
                                closed = true;
index e3b9fa85933912d704580bbb9374cf43d822c188..412b4da1f105b7d9f158bdb7e52c1fa490b34f32 100644 (file)
@@ -38,12 +38,12 @@ namespace Mono.AppleTls
                }
 
                protected override MNS.MobileTlsContext CreateContext (
-                       MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
-                       SslProtocols enabledProtocols, X509Certificate serverCertificate,
-                       X509CertificateCollection clientCertificates, bool askForClientCert)
+                       bool serverMode, string targetHost, SslProtocols enabledProtocols,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
+                       bool askForClientCert)
                {
                        return new AppleTlsContext (
-                               parent, serverMode, targetHost,
+                               this, serverMode, targetHost,
                                enabledProtocols, serverCertificate,
                                clientCertificates, askForClientCert);
                }
index 0e41e14d0d435b026bc824ec1bb64ecff1faf647..dae101bc6b478f42a1631e4dd0620e680cbcbefc 100644 (file)
@@ -67,6 +67,7 @@ namespace Mono.AppleTls {
                        return code;
                }
 
+#if !MONOTOUCH
                [DllImport (AppleTlsContext.SecurityLibrary)]
                extern static SecStatusCode SecItemImport (
                        /* CFDataRef */ IntPtr importedData,
@@ -217,6 +218,7 @@ namespace Mono.AppleTls {
                        IntPtr keyUsage;
                        IntPtr keyAttributes;
                }
+#endif
        }
 }
 #endif
index 841daa270fa12ac1cd20b9f959a73c47c14f1dbb..08c2678a2276f6554da8f4b50d6127550b7b84bc 100644 (file)
@@ -316,6 +316,9 @@ namespace Mono.Btls
                                if (status == MonoBtlsSslError.WantRead) {
                                        wantMore = true;
                                        return 0;
+                               } else if (status == MonoBtlsSslError.ZeroReturn) {
+                                       wantMore = false;
+                                       return size;
                                } else if (status != MonoBtlsSslError.None) {
                                        throw GetException (status);
                                }
@@ -358,26 +361,11 @@ namespace Mono.Btls
                        }
                }
 
-               public override void Close ()
+               public override void Shutdown ()
                {
-                       Debug ("Close!");
-
-                       if (ssl != null) {
-                               ssl.Dispose ();
-                               ssl = null;
-                       }
-                       if (ctx != null) {
-                               ctx.Dispose ();
-                               ctx = null;
-                       }
-                       if (bio != null) {
-                               bio.Dispose ();
-                               bio = null;
-                       }
-                       if (errbio != null) {
-                               errbio.Dispose ();
-                               errbio = null;
-                       }
+                       Debug ("Shutdown!");
+//                     ssl.SetQuietShutdown ();
+                       ssl.Shutdown ();
                }
 
                void Dispose<T> (ref T disposable)
@@ -397,12 +385,12 @@ namespace Mono.Btls
                {
                        try {
                                if (disposing) {
+                                       Dispose (ref ssl);
+                                       Dispose (ref ctx);
                                        Dispose (ref remoteCertificate);
                                        Dispose (ref nativeServerCertificate);
                                        Dispose (ref nativeClientCertificate);
                                        Dispose (ref clientCertificate);
-                                       Dispose (ref ctx);
-                                       Dispose (ref ssl);
                                        Dispose (ref bio);
                                        Dispose (ref errbio);
                                }
index 4264411bd90fea0fce98dc86ea7d681c02d7b992..19e72cbda640bea62ad6a05aac647e17fc6432b0 100644 (file)
@@ -102,6 +102,20 @@ namespace Mono.Btls
                        CheckError (ret == 1, callerName);
                }
 
+               protected internal void CheckLastError ([CallerMemberName] string callerName = null)
+               {
+                       var error = Interlocked.Exchange (ref lastError, null);
+                       if (error == null)
+                               return;
+
+                       string message;
+                       if (callerName != null)
+                               message = string.Format ("Caught unhandled exception in {0}.{1}.", GetType ().Name, callerName);
+                       else
+                               message = string.Format ("Caught unhandled exception.");
+                       throw new MonoBtlsException (message, error);
+               }
+
                [DllImport (BTLS_DYLIB)]
                extern static void mono_btls_free (IntPtr data);
 
index 09e171485f6ca659199d70ab9f0f07a4f8d48bd3..e5fac698c0e18c35c32040e2d4d2679a4ed6c130 100644 (file)
@@ -47,6 +47,7 @@ namespace Mono.Btls
                        protected override bool ReleaseHandle ()
                        {
                                mono_btls_ssl_destroy (handle);
+                               handle = IntPtr.Zero;
                                return true;
                        }
                }
@@ -78,6 +79,12 @@ namespace Mono.Btls
                [DllImport (BTLS_DYLIB)]
                extern static void mono_btls_ssl_close (IntPtr handle);
 
+               [DllImport (BTLS_DYLIB)]
+               extern static int mono_btls_ssl_shutdown (IntPtr handle);
+
+               [DllImport (BTLS_DYLIB)]
+               extern static void mono_btls_ssl_set_quiet_shutdown (IntPtr handle, int mode);
+
                [DllImport (BTLS_DYLIB)]
                extern static void mono_btls_ssl_set_bio (IntPtr handle, IntPtr bio);
 
@@ -131,6 +138,7 @@ namespace Mono.Btls
                        return new BoringSslHandle (handle);
                }
 
+               MonoBtlsBio bio;
                PrintErrorsCallbackFunc printErrorsFunc;
                IntPtr printErrorsFuncPtr;
 
@@ -148,6 +156,7 @@ namespace Mono.Btls
                public void SetBio (MonoBtlsBio bio)
                {
                        CheckThrow ();
+                       this.bio = bio;
                        mono_btls_ssl_set_bio (
                                Handle.DangerousGetHandle (),
                                bio.Handle.DangerousGetHandle ());
@@ -164,18 +173,17 @@ namespace Mono.Btls
                                errors = null;
                        }
 
-                       if (errors != null) {
-                               Console.Error.WriteLine ("ERROR: {0} failed: {1}", callerName, errors);
+                       if (errors != null)
                                throw new MonoBtlsException ("{0} failed: {1}.", callerName, errors);
-                       } else {
-                               Console.Error.WriteLine ("ERROR: {0} failed.", callerName);
+                       else
                                throw new MonoBtlsException ("{0} failed.", callerName);
-                       }
                }
 
                MonoBtlsSslError GetError (int ret_code)
                {
                        CheckThrow ();
+                       bio.CheckLastError ();
+
                        var error = mono_btls_ssl_get_error (
                                Handle.DangerousGetHandle (), ret_code);
                        return (MonoBtlsSslError)error;
@@ -287,15 +295,20 @@ namespace Mono.Btls
                        var ret = mono_btls_ssl_read (
                                Handle.DangerousGetHandle (), data, dataSize);
 
-                       if (ret >= 0) {
+                       if (ret > 0) {
                                dataSize = ret;
                                return MonoBtlsSslError.None;
                        }
 
-                       var error = mono_btls_ssl_get_error (
-                               Handle.DangerousGetHandle (), ret);
+                       var error = GetError (ret);
+                       if (ret == 0 && error == MonoBtlsSslError.Syscall) {
+                               // End-of-stream
+                               dataSize = 0;
+                               return MonoBtlsSslError.None;
+                       }
+
                        dataSize = 0;
-                       return (MonoBtlsSslError)error;
+                       return error;
                }
 
                public MonoBtlsSslError Write (IntPtr data, ref int dataSize)
@@ -416,9 +429,24 @@ namespace Mono.Btls
                        return Marshal.PtrToStringAnsi (namePtr);
                }
 
+               public void Shutdown ()
+               {
+                       CheckThrow ();
+                       var ret = mono_btls_ssl_shutdown (Handle.DangerousGetHandle ());
+                       if (ret < 0)
+                               throw ThrowError ();
+               }
+
+               public void SetQuietShutdown ()
+               {
+                       CheckThrow ();
+                       mono_btls_ssl_set_quiet_shutdown (Handle.DangerousGetHandle (), 1);
+               }
+
                protected override void Close ()
                {
-                       mono_btls_ssl_close (Handle.DangerousGetHandle ());
+                       if (!Handle.IsInvalid)
+                               mono_btls_ssl_close (Handle.DangerousGetHandle ());
                }
        }
 }
index e941fcd1c0c132674b6fa6d2f61871b4bfadf9bb..b3bb65f9b8eb8023265be0ce8bdf5a47d1301bc4 100644 (file)
@@ -53,12 +53,12 @@ namespace Mono.Btls
                }
 
                protected override MNS.MobileTlsContext CreateContext (
-                       MNS.MobileAuthenticatedStream parent, bool serverMode, string targetHost,
-                       SslProtocols enabledProtocols, X509Certificate serverCertificate,
-                       X509CertificateCollection clientCertificates, bool askForClientCert)
+                       bool serverMode, string targetHost, SslProtocols enabledProtocols,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
+                       bool askForClientCert)
                {
                        return new MonoBtlsContext (
-                               parent, serverMode, targetHost,
+                               this, serverMode, targetHost,
                                enabledProtocols, serverCertificate,
                                clientCertificates, askForClientCert);
                }
index 5f90ffe2b82241f4390b9c112c0c36c0e0abaeb9..3c537a7e42798b46ee80b02477db30759666c7fa 100644 (file)
@@ -11,14 +11,14 @@ using System;
 using System.IO;
 using System.Net;
 using System.Net.Security;
+using System.Security.Authentication;
 using SD = System.Diagnostics;
 using System.Threading;
 using System.Threading.Tasks;
+using System.Runtime.ExceptionServices;
 
 namespace Mono.Net.Security
 {
-       delegate AsyncOperationStatus AsyncOperation (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status);
-
        class BufferOffsetSize
        {
                public byte[] Buffer;
@@ -37,6 +37,13 @@ namespace Mono.Net.Security
 
                public BufferOffsetSize (byte[] buffer, int offset, int size)
                {
+                       if (buffer == null)
+                               throw new ArgumentNullException (nameof (buffer));
+                       if (offset < 0)
+                               throw new ArgumentOutOfRangeException (nameof (offset));
+                       if (size < 0 || offset + size > buffer.Length)
+                               throw new ArgumentOutOfRangeException (nameof (size));
+
                        Buffer = buffer;
                        Offset = offset;
                        Size = size;
@@ -54,7 +61,7 @@ namespace Mono.Net.Security
                public readonly int InitialSize;
 
                public BufferOffsetSize2 (int size)
-                       : base (new byte [size], 0, 0)
+                       : base (new byte[size], 0, 0)
                {
                        InitialSize = size;
                }
@@ -63,7 +70,7 @@ namespace Mono.Net.Security
                {
                        Offset = Size = 0;
                        TotalBytes = 0;
-                       Buffer = new byte [InitialSize];
+                       Buffer = new byte[InitialSize];
                        Complete = false;
                }
 
@@ -74,11 +81,11 @@ namespace Mono.Net.Security
 
                        int missing = size - Remaining;
                        if (Offset == 0 && Size == 0) {
-                               Buffer = new byte [size];
+                               Buffer = new byte[size];
                                return;
                        }
 
-                       var buffer = new byte [Buffer.Length + missing];
+                       var buffer = new byte[Buffer.Length + missing];
                        Buffer.CopyTo (buffer, 0);
                        Buffer = buffer;
                }
@@ -91,201 +98,296 @@ namespace Mono.Net.Security
                }
        }
 
-       enum AsyncOperationStatus {
-               NotStarted,
+       enum AsyncOperationStatus
+       {
                Initialize,
                Continue,
-               Running,
-               Complete,
-               WantRead,
-               WantWrite,
                ReadDone,
-               FinishWrite
+               Complete
        }
 
-       class AsyncProtocolRequest
+       class AsyncProtocolResult
        {
-               public readonly MobileAuthenticatedStream Parent;
-               public readonly BufferOffsetSize UserBuffer;
+               public int UserResult {
+                       get;
+               }
+               public ExceptionDispatchInfo Error {
+                       get;
+               }
 
-               int RequestedSize;
-               public int CurrentSize;
-               public int UserResult;
+               public AsyncProtocolResult (int result)
+               {
+                       UserResult = result;
+               }
 
-               AsyncOperation Operation;
-               int Status;
+               public AsyncProtocolResult (ExceptionDispatchInfo error)
+               {
+                       Error = error;
+               }
+       }
 
-               public readonly int ID = ++next_id;
-               static int next_id;
+       abstract class AsyncProtocolRequest
+       {
+               public MobileAuthenticatedStream Parent {
+                       get;
+               }
 
-               public readonly LazyAsyncResult UserAsyncResult;
+               public bool RunSynchronously {
+                       get;
+               }
 
-               public AsyncProtocolRequest (MobileAuthenticatedStream parent, LazyAsyncResult lazyResult, BufferOffsetSize userBuffer = null)
-               {
-                       Parent = parent;
-                       UserAsyncResult = lazyResult;
-                       UserBuffer = userBuffer;
+               public int ID => ++next_id;
+
+               public string Name => GetType ().Name;
+
+               public int UserResult {
+                       get;
+                       protected set;
                }
 
-               public bool CompleteWithError (Exception ex)
+               int Started;
+               int RequestedSize;
+               int WriteRequested;
+               readonly object locker = new object ();
+
+               static int next_id;
+
+               public AsyncProtocolRequest (MobileAuthenticatedStream parent, bool sync)
                {
-                       Status = (int)AsyncOperationStatus.Complete;
-                       if (UserAsyncResult == null)
-                               return true;
-                       if (!UserAsyncResult.InternalPeekCompleted)
-                               UserAsyncResult.InvokeCallback (ex);
-                       return false;
+                       Parent = parent;
+                       RunSynchronously = sync;
                }
 
                [SD.Conditional ("MARTIN_DEBUG")]
                protected void Debug (string message, params object[] args)
                {
-                       Parent.Debug ("AsyncProtocolRequest({0}:{1}): {2}", Parent.ID, ID, string.Format (message, args));
+                       Parent.Debug ("{0}({1}:{2}): {3}", Name, Parent.ID, ID, string.Format (message, args));
                }
 
                internal void RequestRead (int size)
                {
-                       var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantRead, (int)AsyncOperationStatus.Running);
-                       Debug ("RequestRead: {0} {1}", oldStatus, size);
-                       if (oldStatus == AsyncOperationStatus.Running)
-                               RequestedSize = size;
-                       else if (oldStatus == AsyncOperationStatus.WantRead)
+                       lock (locker) {
                                RequestedSize += size;
-                       else if (oldStatus != AsyncOperationStatus.WantWrite)
-                               throw new InvalidOperationException ();
+                               Debug ("RequestRead: {0}", size);
+                       }
                }
 
-               internal void ResetRead ()
+               internal void RequestWrite ()
                {
-                       var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantRead);
-                       Debug ("ResetRead: {0} {1}", oldStatus, Status);
+                       WriteRequested = 1;
                }
 
-               internal void ResetWrite ()
+               internal async Task<AsyncProtocolResult> StartOperation (CancellationToken cancellationToken)
                {
-                       var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Complete, (int)AsyncOperationStatus.WantWrite);
-                       Debug ("ResetWrite: {0} {1}", oldStatus, Status);
+                       Debug ("Start Operation: {0}", this);
+                       if (Interlocked.CompareExchange (ref Started, 1, 0) != 0)
+                               throw new InvalidOperationException ();
+
+                       try {
+                               await ProcessOperation (cancellationToken).ConfigureAwait (false);
+                               return new AsyncProtocolResult (UserResult);
+                       } catch (Exception ex) {
+                               var info = Parent.SetException (MobileAuthenticatedStream.GetSSPIException (ex));
+                               return new AsyncProtocolResult (info);
+                       }
                }
 
-               internal void RequestWrite ()
+               async Task ProcessOperation (CancellationToken cancellationToken)
                {
-                       var oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.WantWrite, (int)AsyncOperationStatus.Running);
-                       Debug ("RequestWrite: {0} {1}", oldStatus, Status);
-                       if (oldStatus == AsyncOperationStatus.Running)
-                               return;
-                       else if (oldStatus != AsyncOperationStatus.WantRead && oldStatus != AsyncOperationStatus.WantWrite)
-                               throw new InvalidOperationException ();
+                       var status = AsyncOperationStatus.Initialize;
+                       while (status != AsyncOperationStatus.Complete) {
+                               cancellationToken.ThrowIfCancellationRequested ();
+                               Debug ("ProcessOperation: {0}", status);
+
+                               var ret = await InnerRead (cancellationToken).ConfigureAwait (false);
+                               if (ret != null) {
+                                       if (ret == 0) {
+                                               // End-of-stream
+                                               Debug ("END OF STREAM!");
+                                               status = AsyncOperationStatus.ReadDone;
+                                       } else if (ret < 0) {
+                                               // remote prematurely closed connection.
+                                               throw new IOException ("Remote prematurely closed connection.");
+                                       }
+                               }
+
+                               Debug ("ProcessOperation run: {0}", status);
+
+                               AsyncOperationStatus newStatus;
+                               switch (status) {
+                               case AsyncOperationStatus.Initialize:
+                               case AsyncOperationStatus.Continue:
+                               case AsyncOperationStatus.ReadDone:
+                                       newStatus = Run (status);
+                                       break;
+                               default:
+                                       throw new InvalidOperationException ();
+                               }
+
+                               if (Interlocked.Exchange (ref WriteRequested, 0) != 0) {
+                                       // Flush the write queue.
+                                       await Parent.InnerWrite (RunSynchronously, cancellationToken);
+                               }
+
+                               Debug ("ProcessOperation done: {0} -> {1}", status, newStatus);
+
+                               status = newStatus;
+                       }
                }
 
-               internal void StartOperation (AsyncOperation operation)
+               async Task<int?> InnerRead (CancellationToken cancellationToken)
                {
-                       Debug ("Start Operation: {0} {1}", Status, operation);
-                       if (Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.Initialize, (int)AsyncOperationStatus.NotStarted) != (int)AsyncOperationStatus.NotStarted)
-                               throw new InvalidOperationException ();
+                       int? totalRead = null;
+                       var requestedSize = Interlocked.Exchange (ref RequestedSize, 0);
+                       while (requestedSize > 0) {
+                               Debug ("ProcessOperation - read inner: {0}", requestedSize);
 
-                       Operation = operation;
+                               var ret = await Parent.InnerRead (RunSynchronously, requestedSize, cancellationToken).ConfigureAwait (false);
+                               Debug ("ProcessOperation - read inner done: {0} - {1}", requestedSize, ret);
 
-                       if (UserAsyncResult == null) {
-                               StartOperation ();
-                               return;
+                               if (ret <= 0)
+                                       return ret;
+                               if (ret > requestedSize)
+                                       throw new InvalidOperationException ();
+
+                               totalRead += ret;
+                               requestedSize -= ret;
+                               var newRequestedSize = Interlocked.Exchange (ref RequestedSize, 0);
+                               requestedSize += newRequestedSize;
                        }
 
-                       ThreadPool.QueueUserWorkItem (_ => StartOperation ());
+                       return totalRead;
                }
 
-               void StartOperation ()
+               /*
+                * This will operate on the internal buffers and never block.
+                */
+               protected abstract AsyncOperationStatus Run (AsyncOperationStatus status);
+
+               public override string ToString ()
                {
-                       try {
-                               ProcessOperation ();
-                               if (UserAsyncResult != null && !UserAsyncResult.InternalPeekCompleted)
-                                       UserAsyncResult.InvokeCallback (UserResult);
-                       } catch (Exception ex) {
-                               if (UserAsyncResult == null)
-                                       throw;
-                               if (!UserAsyncResult.InternalPeekCompleted)
-                                       UserAsyncResult.InvokeCallback (ex);
-                       }
+                       return string.Format ("[{0}]", Name);
                }
+       }
 
-               void ProcessOperation ()
+       class AsyncHandshakeRequest : AsyncProtocolRequest
+       {
+               public AsyncHandshakeRequest (MobileAuthenticatedStream parent, bool sync)
+                       : base (parent, sync)
                {
-                       AsyncOperationStatus status;
-                       do {
-                               status = (AsyncOperationStatus)Interlocked.Exchange (ref Status, (int)AsyncOperationStatus.Running);
+               }
 
-                               Debug ("ProcessOperation: {0}", status);
+               protected override AsyncOperationStatus Run (AsyncOperationStatus status)
+               {
+                       return Parent.ProcessHandshake (status);
+               }
+       }
 
-                               status = ProcessOperation (status);
+       abstract class AsyncReadOrWriteRequest : AsyncProtocolRequest
+       {
+               protected BufferOffsetSize UserBuffer {
+                       get;
+               }
 
-                               Debug ("ProcessOperation done: {0}", status);
+               protected int CurrentSize {
+                       get; set;
+               }
 
-                               AsyncOperationStatus oldStatus;
-                               if (status == AsyncOperationStatus.Complete) {
-                                       oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)AsyncOperationStatus.FinishWrite, (int)AsyncOperationStatus.WantWrite);
-                                       if (oldStatus == AsyncOperationStatus.WantWrite) {
-                                               // We are done, but still need to flush the write queue.
-                                               status = AsyncOperationStatus.FinishWrite;
-                                               continue;
-                                       }
-                               }
+               public AsyncReadOrWriteRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
+                       : base (parent, sync)
+               {
+                       UserBuffer = new BufferOffsetSize (buffer, offset, size);
+               }
 
-                               oldStatus = (AsyncOperationStatus)Interlocked.CompareExchange (ref Status, (int)status, (int)AsyncOperationStatus.Running);
-                               Debug ("ProcessOperation done: {0} -> {1}", oldStatus, status);
+               public override string ToString ()
+               {
+                       return string.Format ("[{0}: {1}]", Name, UserBuffer);
+               }
+       }
 
-                               if (oldStatus != AsyncOperationStatus.Running) {
-                                       if (status == oldStatus || status == AsyncOperationStatus.Continue || status == AsyncOperationStatus.Complete)
-                                               status = oldStatus;
-                                       else
-                                               throw new InvalidOperationException ();
-                               }
-                       } while (status != AsyncOperationStatus.Complete);
+       class AsyncReadRequest : AsyncReadOrWriteRequest
+       {
+               public AsyncReadRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
+                       : base (parent, sync, buffer, offset, size)
+               {
                }
 
-               AsyncOperationStatus ProcessOperation (AsyncOperationStatus status)
+               protected override AsyncOperationStatus Run (AsyncOperationStatus status)
                {
-                       if (status == AsyncOperationStatus.WantRead) {
-                               if (RequestedSize < 0)
-                                       throw new InvalidOperationException ();
-                               else if (RequestedSize == 0)
-                                       return AsyncOperationStatus.Continue;
-
-                               Debug ("ProcessOperation - read inner: {0}", RequestedSize);
-                               var ret = Parent.InnerRead (RequestedSize);
-                               Debug ("ProcessOperation - read inner done: {0} - {1}", RequestedSize, ret);
-
-                               if (ret < 0)
-                                       return AsyncOperationStatus.ReadDone;
-
-                               RequestedSize -= ret;
-
-                               if (ret == 0 || RequestedSize == 0)
-                                       return AsyncOperationStatus.Continue;
-                               else
-                                       return AsyncOperationStatus.WantRead;
-                       } else if (status == AsyncOperationStatus.WantWrite) {
-                               Debug ("ProcessOperation - want write");
-                               Parent.InnerWrite ();
-                               Debug ("ProcessOperation - want write done");
+                       Debug ("ProcessRead - read user: {0} {1}", this, status);
+
+                       var (ret, wantMore) = Parent.ProcessRead (UserBuffer);
+
+                       Debug ("ProcessRead - read user done: {0} - {1} {2}", this, ret, wantMore);
+
+                       if (ret < 0) {
+                               UserResult = -1;
+                               return AsyncOperationStatus.Complete;
+                       }
+
+                       CurrentSize += ret;
+                       UserBuffer.Offset += ret;
+                       UserBuffer.Size -= ret;
+
+                       Debug ("Process Read - read user done #1: {0} - {1} {2}", this, CurrentSize, wantMore);
+
+                       if (wantMore && CurrentSize == 0)
                                return AsyncOperationStatus.Continue;
-                       } else if (status == AsyncOperationStatus.Initialize || status == AsyncOperationStatus.Continue) {
-                               Debug ("ProcessOperation - continue");
-                               status = Operation (this, status);
-                               Debug ("ProcessOperation - continue done: {0}", status);
-                               return status;
-                       } else if (status == AsyncOperationStatus.ReadDone) {
-                               Debug ("ProcessOperation - read done");
-                               status = Operation (this, status);
-                               Debug ("ProcessOperation - read done: {0}", status);
-                               return status;
-                       } else if (status == AsyncOperationStatus.FinishWrite) {
-                               Debug ("ProcessOperation - finish write");
-                               Parent.InnerWrite ();
-                               Debug ("ProcessOperation - finish write done");
+
+                       UserResult = CurrentSize;
+                       return AsyncOperationStatus.Complete;
+               }
+       }
+
+       class AsyncWriteRequest : AsyncReadOrWriteRequest
+       {
+               public AsyncWriteRequest (MobileAuthenticatedStream parent, bool sync, byte[] buffer, int offset, int size)
+                       : base (parent, sync, buffer, offset, size)
+               {
+               }
+
+               protected override AsyncOperationStatus Run (AsyncOperationStatus status)
+               {
+                       Debug ("ProcessWrite - write user: {0} {1}", this, status);
+
+                       if (UserBuffer.Size == 0) {
+                               UserResult = CurrentSize;
+                               return AsyncOperationStatus.Complete;
+                       }
+
+                       var (ret, wantMore) = Parent.ProcessWrite (UserBuffer);
+
+                       Debug ("ProcessWrite - write user done: {0} - {1} {2}", this, ret, wantMore);
+
+                       if (ret < 0) {
+                               UserResult = -1;
                                return AsyncOperationStatus.Complete;
                        }
 
-                       throw new InvalidOperationException ();
+                       CurrentSize += ret;
+                       UserBuffer.Offset += ret;
+                       UserBuffer.Size -= ret;
+
+                       if (wantMore)
+                               return AsyncOperationStatus.Continue;
+
+                       UserResult = CurrentSize;
+                       return AsyncOperationStatus.Complete;
+               }
+       }
+
+       class AsyncShutdownRequest : AsyncProtocolRequest
+       {
+               public AsyncShutdownRequest (MobileAuthenticatedStream parent)
+                       : base (parent, false)
+               {
+               }
+
+               protected override AsyncOperationStatus Run (AsyncOperationStatus status)
+               {
+                       return Parent.ProcessShutdown (status);
                }
        }
+
 }
 #endif
index a5572addc13c4583642104a84fd321feadbd07d9..e4032496da167517db3ff54076a60e184a6ba167 100644 (file)
@@ -575,6 +575,11 @@ namespace Mono.Net.Security.Private
 
                #region IMonoSslStream
 
+               Task IMonoSslStream.ShutdownAsync ()
+               {
+                       return Task.CompletedTask;
+               }
+
                AuthenticatedStream IMonoSslStream.AuthenticatedStream {
                        get { return this; }
                }
index 1e57c67341597cd191bf27b21a245ee276972b7d..2b380a1ae6c2ca3f9d5ffb5f94d4cf2de72cac19 100644 (file)
@@ -23,6 +23,7 @@ using System.IO;
 using System.Net;
 using System.Net.Security;
 using System.Globalization;
+using System.Security.Authentication;
 using System.Runtime.ExceptionServices;
 using System.Threading;
 using System.Threading.Tasks;
@@ -36,8 +37,13 @@ namespace Mono.Net.Security
 {
        abstract class MobileAuthenticatedStream : AuthenticatedStream, MSI.IMonoSslStream
        {
+               /*
+                * This is intentionally called `xobileTlsContext'.  It is a "dangerous" object
+                * that must not be touched outside the `ioLock' and we need to be very careful
+                * where we access it.
+                */
                MobileTlsContext xobileTlsContext;
-               Exception lastException;
+               ExceptionDispatchInfo lastException;
 
                AsyncProtocolRequest asyncHandshakeRequest;
                AsyncProtocolRequest asyncReadRequest;
@@ -47,11 +53,12 @@ namespace Mono.Net.Security
 
                object ioLock = new object ();
                int closeRequested;
+               bool shutdown;
 
                static int uniqueNameInteger = 123;
 
                public MobileAuthenticatedStream (Stream innerStream, bool leaveInnerStreamOpen, SslStream owner,
-                                                 MSI.MonoTlsSettings settings, MSI.MonoTlsProvider provider)
+                                                 MSI.MonoTlsSettings settings, MSI.MonoTlsProvider provider)
                        : base (innerStream, leaveInnerStreamOpen)
                {
                        SslStream = owner;
@@ -78,42 +85,47 @@ namespace Mono.Net.Security
                        get { return xobileTlsContext != null; }
                }
 
-               internal MobileTlsContext Context {
-                       get {
-                               CheckThrow (true);
-                               return xobileTlsContext;
-                       }
-               }
-
-               internal void CheckThrow (bool authSuccessCheck)
+               internal void CheckThrow (bool authSuccessCheck, bool shutdownCheck = false)
                {
-                       if (closeRequested != 0)
-                               throw new InvalidOperationException ("Stream is closed.");
                        if (lastException != null)
-                               throw lastException;
+                               lastException.Throw ();
                        if (authSuccessCheck && !IsAuthenticated)
-                               throw new InvalidOperationException ("Must be authenticated.");
+                               throw new InvalidOperationException (SR.net_auth_noauth);
+                       if (shutdownCheck && shutdown)
+                               throw new InvalidOperationException (SR.net_ssl_io_already_shutdown);
                }
 
-               Exception SetException (Exception e)
+               internal static Exception GetSSPIException (Exception e)
                {
-                       e = SetException_internal (e);
-                       if (e != null && xobileTlsContext != null)
-                               xobileTlsContext.Dispose ();
-                       return e;
+                       if (e is OperationCanceledException || e is IOException || e is ObjectDisposedException || e is AuthenticationException)
+                               return e;
+                       return new AuthenticationException (SR.net_auth_SSPI, e);
                }
 
-               Exception SetException_internal (Exception e)
+               internal static Exception GetIOException (Exception e, string message)
                {
-                       if (lastException == null)
-                               lastException = e;
-                       return lastException;
+                       if (e is OperationCanceledException || e is IOException || e is ObjectDisposedException || e is AuthenticationException)
+                               return e;
+                       return new IOException (message, e);
+               }
+
+               internal ExceptionDispatchInfo SetException (Exception e)
+               {
+                       var info = ExceptionDispatchInfo.Capture (e);
+                       var old = Interlocked.CompareExchange (ref lastException, info, null);
+                       return old ?? info;
                }
 
                SslProtocols DefaultProtocols {
                        get { return SslProtocols.Tls12 | SslProtocols.Tls11 | SslProtocols.Tls; }
                }
 
+               enum OperationType {
+                       Read,
+                       Write,
+                       Shutdown
+               }
+
                public void AuthenticateAsClient (string targetHost)
                {
                        AuthenticateAsClient (targetHost, new X509CertificateCollection (), DefaultProtocols, false);
@@ -121,8 +133,8 @@ namespace Mono.Net.Security
 
                public void AuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       ValidateCreateContext (false, targetHost, enabledSslProtocols, null, clientCertificates, false);
-                       ProcessAuthentication (null);
+                       var task = ProcessAuthentication (true, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
+                       task.Wait ();
                }
 
                public IAsyncResult BeginAuthenticateAsClient (string targetHost, AsyncCallback asyncCallback, object asyncState)
@@ -132,15 +144,13 @@ namespace Mono.Net.Security
 
                public IAsyncResult BeginAuthenticateAsClient (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       ValidateCreateContext (false, targetHost, enabledSslProtocols, null, clientCertificates, false);
-                       var result = new LazyAsyncResult (this, asyncState, asyncCallback);
-                       ProcessAuthentication (result);
-                       return result;
+                       var task = ProcessAuthentication (false, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
+                       return TaskToApm.Begin (task, asyncCallback, asyncState);
                }
 
                public void EndAuthenticateAsClient (IAsyncResult asyncResult)
                {
-                       EndProcessAuthentication (asyncResult);
+                       TaskToApm.End (asyncResult);
                }
 
                public void AuthenticateAsServer (X509Certificate serverCertificate)
@@ -150,8 +160,8 @@ namespace Mono.Net.Security
 
                public void AuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       ValidateCreateContext (true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
-                       ProcessAuthentication (null);
+                       var task = ProcessAuthentication (true, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
+                       task.Wait ();
                }
 
                public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, AsyncCallback asyncCallback, object asyncState)
@@ -161,218 +171,214 @@ namespace Mono.Net.Security
 
                public IAsyncResult BeginAuthenticateAsServer (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation, AsyncCallback asyncCallback, object asyncState)
                {
-                       ValidateCreateContext (true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
-                       var result = new LazyAsyncResult (this, asyncState, asyncCallback);
-                       ProcessAuthentication (result);
-                       return result;
+                       var task = ProcessAuthentication (false, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
+                       return TaskToApm.Begin (task, asyncCallback, asyncState);
                }
 
                public void EndAuthenticateAsServer (IAsyncResult asyncResult)
                {
-                       EndProcessAuthentication (asyncResult);
+                       TaskToApm.End (asyncResult);
                }
 
                public Task AuthenticateAsClientAsync (string targetHost)
                {
-                       return Task.Factory.FromAsync (BeginAuthenticateAsClient, EndAuthenticateAsClient, targetHost, null);
+                       return ProcessAuthentication (false, false, targetHost, DefaultProtocols, null, null, false);
                }
 
                public Task AuthenticateAsClientAsync (string targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Task.Factory.FromAsync ((callback, state) => BeginAuthenticateAsClient (targetHost, clientCertificates, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsClient, null);
+                       return ProcessAuthentication (false, false, targetHost, enabledSslProtocols, null, clientCertificates, false);
                }
 
                public Task AuthenticateAsServerAsync (X509Certificate serverCertificate)
                {
-                       return Task.Factory.FromAsync (BeginAuthenticateAsServer, EndAuthenticateAsServer, serverCertificate, null);
+                       return AuthenticateAsServerAsync (serverCertificate, false, DefaultProtocols, false);
                }
 
                public Task AuthenticateAsServerAsync (X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
                {
-                       return Task.Factory.FromAsync ((callback, state) => BeginAuthenticateAsServer (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation, callback, state), EndAuthenticateAsServer, null);
+                       return ProcessAuthentication (false, true, string.Empty, enabledSslProtocols, serverCertificate, null, clientCertificateRequired);
+               }
+
+               public Task ShutdownAsync ()
+               {
+                       Debug ("ShutdownAsync");
+
+                       /*
+                        * SSLClose() is a little bit tricky as it might attempt to send a close_notify alert
+                        * and thus call our write callback.
+                        *
+                        * It is also not thread-safe with SSLRead() or SSLWrite(), so we need to take the I/O lock here.
+                        */
+                       var asyncRequest = new AsyncShutdownRequest (this);
+                       var task = StartOperation (OperationType.Shutdown, asyncRequest, CancellationToken.None);
+                       return task;
                }
 
                public AuthenticatedStream AuthenticatedStream {
                        get { return this; }
                }
 
-               internal void ProcessAuthentication (LazyAsyncResult lazyResult)
+               async Task ProcessAuthentication (
+                       bool runSynchronously, bool serverMode, string targetHost, SslProtocols enabledProtocols,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
                {
-                       var asyncRequest = new AsyncProtocolRequest (this, lazyResult);
+                       if (serverMode) {
+                               if (serverCertificate == null)
+                                       throw new ArgumentException (nameof (serverCertificate));
+                       } else {
+                               if (targetHost == null)
+                                       throw new ArgumentException (nameof (targetHost));
+                               if (targetHost.Length == 0)
+                                       targetHost = "?" + Interlocked.Increment (ref uniqueNameInteger).ToString (NumberFormatInfo.InvariantInfo);
+                       }
+
+                       if (lastException != null)
+                               lastException.Throw ();
+
+                       var asyncRequest = new AsyncHandshakeRequest (this, runSynchronously);
                        if (Interlocked.CompareExchange (ref asyncHandshakeRequest, asyncRequest, null) != null)
                                throw new InvalidOperationException ("Invalid nested call.");
+                       // Make sure no other async requests can be started during the handshake.
+                       if (Interlocked.CompareExchange (ref asyncReadRequest, asyncRequest, null) != null)
+                               throw new InvalidOperationException ("Invalid nested call.");
+                       if (Interlocked.CompareExchange (ref asyncWriteRequest, asyncRequest, null) != null)
+                               throw new InvalidOperationException ("Invalid nested call.");
+
+                       AsyncProtocolResult result;
 
                        try {
-                               if (lastException != null)
-                                       throw lastException;
-                               if (xobileTlsContext == null)
-                                       throw new InvalidOperationException ();
+                               lock (ioLock) {
+                                       if (xobileTlsContext != null)
+                                               throw new InvalidOperationException ();
+                                       readBuffer.Reset ();
+                                       writeBuffer.Reset ();
 
-                               readBuffer.Reset ();
-                               writeBuffer.Reset ();
+                                       xobileTlsContext = CreateContext (
+                                               serverMode, targetHost, enabledProtocols, serverCertificate,
+                                               clientCertificates, clientCertRequired);
+                               }
 
                                try {
-                                       asyncRequest.StartOperation (ProcessHandshake);
+                                       result = await asyncRequest.StartOperation (CancellationToken.None).ConfigureAwait (false);
                                } catch (Exception ex) {
-                                       ExceptionDispatchInfo.Capture (SetException (ex)).Throw ();
+                                       result = new AsyncProtocolResult (SetException (GetSSPIException (ex)));
                                }
                        } finally {
-                               if (lazyResult == null || lastException != null) {
+                               lock (ioLock) {
                                        readBuffer.Reset ();
                                        writeBuffer.Reset ();
+                                       asyncWriteRequest = null;
+                                       asyncReadRequest = null;
                                        asyncHandshakeRequest = null;
                                }
                        }
-               }
-
-               internal void EndProcessAuthentication (IAsyncResult result)
-               {
-                       if (result == null)
-                               throw new ArgumentNullException ("asyncResult");
-
-                       var lazyResult = (LazyAsyncResult)result;
-                       if (Interlocked.Exchange (ref asyncHandshakeRequest, null) == null)
-                               throw new InvalidOperationException ("Invalid end call.");
-
-                       lazyResult.InternalWaitForCompletion ();
-
-                       readBuffer.Reset ();
-                       writeBuffer.Reset ();
-
-                       var e = lazyResult.Result as Exception;
-                       if (e != null)
-                               ExceptionDispatchInfo.Capture (SetException (e)).Throw ();
-               }
-
-               internal void ValidateCreateContext (bool serverMode, string targetHost, SslProtocols enabledProtocols, X509Certificate serverCertificate, X509CertificateCollection clientCertificates, bool clientCertRequired)
-               {
-                       if (xobileTlsContext != null)
-                               throw new InvalidOperationException ();
-
-                       if (serverMode) {
-                               if (serverCertificate == null)
-                                       throw new ArgumentException ("serverCertificate");
-                       } else {                                
-                               if (targetHost == null)
-                                       throw new ArgumentException ("targetHost");
-                               if (targetHost.Length == 0)
-                                       targetHost = "?" + Interlocked.Increment (ref uniqueNameInteger).ToString (NumberFormatInfo.InvariantInfo);
-                       }
 
-                       xobileTlsContext = CreateContext (this, serverMode, targetHost, enabledProtocols, serverCertificate, clientCertificates, clientCertRequired);
+                       if (result.Error != null)
+                               result.Error.Throw ();
                }
 
                protected abstract MobileTlsContext CreateContext (
-                       MobileAuthenticatedStream parent, bool serverMode, string targetHost,
-                       SSA.SslProtocols enabledProtocols, X509Certificate serverCertificate,
-                       X509CertificateCollection clientCertificates, bool askForClientCert);
+                       bool serverMode, string targetHost, SSA.SslProtocols enabledProtocols,
+                       X509Certificate serverCertificate, X509CertificateCollection clientCertificates,
+                       bool askForClientCert);
 
                public override IAsyncResult BeginRead (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
                {
-                       return BeginReadOrWrite (ref asyncReadRequest, ref readBuffer, ProcessRead, new BufferOffsetSize (buffer, offset, count), asyncCallback, asyncState);
+                       var asyncRequest = new AsyncReadRequest (this, false, buffer, offset, count);
+                       var task = StartOperation (OperationType.Read, asyncRequest, CancellationToken.None);
+                       return TaskToApm.Begin (task, asyncCallback, asyncState);
                }
 
                public override int EndRead (IAsyncResult asyncResult)
                {
-                       return (int)EndReadOrWrite (asyncResult, ref asyncReadRequest);
+                       return TaskToApm.End<int> (asyncResult);
                }
 
                public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback asyncCallback, object asyncState)
                {
-                       return BeginReadOrWrite (ref asyncWriteRequest, ref writeBuffer, ProcessWrite, new BufferOffsetSize (buffer, offset, count), asyncCallback, asyncState);
+                       var asyncRequest = new AsyncWriteRequest (this, false, buffer, offset, count);
+                       var task = StartOperation (OperationType.Write, asyncRequest, CancellationToken.None);
+                       return TaskToApm.Begin (task, asyncCallback, asyncState);
                }
 
                public override void EndWrite (IAsyncResult asyncResult)
                {
-                       EndReadOrWrite (asyncResult, ref asyncWriteRequest);
+                       TaskToApm.End (asyncResult);
                }
 
                public override int Read (byte[] buffer, int offset, int count)
                {
-                       return ProcessReadOrWrite (ref asyncReadRequest, ref readBuffer, ProcessRead, new BufferOffsetSize (buffer, offset, count), null);
+                       var asyncRequest = new AsyncReadRequest (this, true, buffer, offset, count);
+                       var task = StartOperation (OperationType.Read, asyncRequest, CancellationToken.None);
+                       return task.Result;
                }
 
                public void Write (byte[] buffer)
                {
                        Write (buffer, 0, buffer.Length);
                }
+
                public override void Write (byte[] buffer, int offset, int count)
                {
-                       ProcessReadOrWrite (ref asyncWriteRequest, ref writeBuffer, ProcessWrite, new BufferOffsetSize (buffer, offset, count), null);
+                       var asyncRequest = new AsyncWriteRequest (this, true, buffer, offset, count);
+                       var task = StartOperation (OperationType.Write, asyncRequest, CancellationToken.None);
+                       task.Wait ();
                }
 
-               IAsyncResult BeginReadOrWrite (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, BufferOffsetSize userBuffer, AsyncCallback asyncCallback, object asyncState)
+               public override Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
                {
-                       LazyAsyncResult lazyResult = new LazyAsyncResult (this, asyncState, asyncCallback);
-                       ProcessReadOrWrite (ref nestedRequest, ref internalBuffer, operation, userBuffer, lazyResult);
-                       return lazyResult;
+                       var asyncRequest = new AsyncReadRequest (this, false, buffer, offset, count);
+                       return StartOperation (OperationType.Read, asyncRequest, cancellationToken);
                }
 
-               object EndReadOrWrite (IAsyncResult asyncResult, ref AsyncProtocolRequest nestedRequest)
+               public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
                {
-                       if (asyncResult == null)
-                               throw new ArgumentNullException("asyncResult");
-
-                       var lazyResult = (LazyAsyncResult)asyncResult;
-
-                       if (Interlocked.Exchange (ref nestedRequest, null) == null)
-                               throw new InvalidOperationException ("Invalid end call.");
-
-                       // No "artificial" timeouts implemented so far, InnerStream controls timeout.
-                       lazyResult.InternalWaitForCompletion ();
-
-                       Debug ("EndReadOrWrite");
-
-                       var e = lazyResult.Result as Exception;
-                       if (e != null) {
-                               var ioEx = e as IOException;
-                               if (ioEx != null)
-                                       throw ioEx;
-                               throw new IOException ("read failed", e);
-                       }
-
-                       return lazyResult.Result;
+                       var asyncRequest = new AsyncWriteRequest (this, false, buffer, offset, count);
+                       return StartOperation (OperationType.Write, asyncRequest, cancellationToken);
                }
 
-               int ProcessReadOrWrite (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, BufferOffsetSize userBuffer, LazyAsyncResult lazyResult)
+               async Task<int> StartOperation (OperationType type, AsyncProtocolRequest asyncRequest, CancellationToken cancellationToken)
                {
-                       if (userBuffer == null || userBuffer.Buffer == null)
-                               throw new ArgumentNullException ("buffer");
-                       if (userBuffer.Offset < 0)
-                               throw new ArgumentOutOfRangeException ("offset");
-                       if (userBuffer.Size < 0 || userBuffer.Offset + userBuffer.Size > userBuffer.Buffer.Length)
-                               throw new ArgumentOutOfRangeException ("count");
-
-                       CheckThrow (true);
+                       CheckThrow (true, type != OperationType.Read);
+                       Debug ("StartOperationAsync: {0} {1}", asyncRequest, type);
 
-                       var name = internalBuffer == readBuffer ? "read" : "write";
-                       Debug ("ProcessReadOrWrite: {0} {1}", name, userBuffer);
+                       if (type == OperationType.Read) {
+                               if (Interlocked.CompareExchange (ref asyncReadRequest, asyncRequest, null) != null)
+                                       throw new InvalidOperationException ("Invalid nested call.");
+                       } else {
+                               if (Interlocked.CompareExchange (ref asyncWriteRequest, asyncRequest, null) != null)
+                                       throw new InvalidOperationException ("Invalid nested call.");
+                       }
 
-                       var asyncRequest = new AsyncProtocolRequest (this, lazyResult, userBuffer);
-                       return StartOperation (ref nestedRequest, ref internalBuffer, operation, asyncRequest, name);
-               }
+                       AsyncProtocolResult result;
 
-               int StartOperation (ref AsyncProtocolRequest nestedRequest, ref BufferOffsetSize2 internalBuffer, AsyncOperation operation, AsyncProtocolRequest asyncRequest, string name)
-               {
-                       if (Interlocked.CompareExchange (ref nestedRequest, asyncRequest, null) != null)
-                               throw new InvalidOperationException ("Invalid nested call.");
-
-                       bool failed = false;
                        try {
-                               internalBuffer.Reset ();
-                               asyncRequest.StartOperation (operation);
-                               return asyncRequest.UserResult;
+                               lock (ioLock) {
+                                       if (type == OperationType.Read)
+                                               readBuffer.Reset ();
+                                       else
+                                               writeBuffer.Reset ();
+                               }
+                               result = await asyncRequest.StartOperation (cancellationToken).ConfigureAwait (false);
                        } catch (Exception e) {
-                               failed = true;
-                               if (e is IOException)
-                                       throw;
-                               throw new IOException (name + " failed", e);
+                               var info = SetException (GetIOException (e, asyncRequest.Name + " failed"));
+                               result = new AsyncProtocolResult (info);
                        } finally {
-                               if (asyncRequest.UserAsyncResult == null || failed) {
-                                       internalBuffer.Reset ();
-                                       nestedRequest = null;
+                               lock (ioLock) {
+                                       if (type == OperationType.Read) {
+                                               readBuffer.Reset ();
+                                               asyncReadRequest = null;
+                                       } else {
+                                               writeBuffer.Reset ();
+                                               asyncWriteRequest = null;
+                                       }
                                }
                        }
+
+                       if (result.Error != null)
+                               result.Error.Throw ();
+                       return result.UserResult;
                }
 
                static int nextId;
@@ -384,26 +390,31 @@ namespace Mono.Net.Security
                        Console.Error.WriteLine ("MobileAuthenticatedStream({0}): {1}", ID, string.Format (message, args));
                }
 
-               #region Called back from native code via SslConnection
+#region Called back from native code via SslConnection
 
                /*
                 * Called from within SSLRead() and SSLHandshake().  We only access tha managed byte[] here.
                 */
-               internal int InternalRead (byte[] buffer, int offset, int size, out bool wantMore)
+               internal int InternalRead (byte[] buffer, int offset, int size, out bool outWantMore)
                {
                        try {
-                               Debug ("InternalRead: {0} {1} {2} {3}", offset, size, asyncReadRequest != null, readBuffer != null);
+                               Debug ("InternalRead: {0} {1} {2} {3} {4}", offset, size,
+                                      asyncHandshakeRequest != null ? "handshake" : "",
+                                      asyncReadRequest != null ? "async" : "",
+                                      readBuffer != null ? readBuffer.ToString () : "");
                                var asyncRequest = asyncHandshakeRequest ?? asyncReadRequest;
-                               return InternalRead (asyncRequest, readBuffer, buffer, offset, size, out wantMore);
+                               var (ret, wantMore) = InternalRead (asyncRequest, readBuffer, buffer, offset, size);
+                               outWantMore = wantMore;
+                               return ret;
                        } catch (Exception ex) {
                                Debug ("InternalRead failed: {0}", ex);
-                               SetException_internal (ex);
-                               wantMore = false;
+                               SetException (GetIOException (ex, "InternalRead() failed"));
+                               outWantMore = false;
                                return -1;
                        }
                }
 
-               int InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size, out bool wantMore)
+               (int, bool) InternalRead (AsyncProtocolRequest asyncRequest, BufferOffsetSize internalBuffer, byte[] buffer, int offset, int size)
                {
                        if (asyncRequest == null)
                                throw new InvalidOperationException ();
@@ -422,11 +433,10 @@ namespace Mono.Net.Security
                         * native function again.
                         */
                        if (internalBuffer.Size == 0 && !internalBuffer.Complete) {
-                               Debug ("InternalRead #1: {0} {1}", internalBuffer.Offset, internalBuffer.TotalBytes);
+                               Debug ("InternalRead #1: {0} {1} {2}", internalBuffer.Offset, internalBuffer.TotalBytes, size);
                                internalBuffer.Offset = internalBuffer.Size = 0;
                                asyncRequest.RequestRead (size);
-                               wantMore = true;
-                               return 0;
+                               return (0, true);
                        }
 
                        /*
@@ -441,8 +451,7 @@ namespace Mono.Net.Security
                        Buffer.BlockCopy (internalBuffer.Buffer, internalBuffer.Offset, buffer, offset, len);
                        internalBuffer.Offset += len;
                        internalBuffer.Size -= len;
-                       wantMore = !internalBuffer.Complete && len < size;
-                       return len;
+                       return (len, !internalBuffer.Complete && len < size);
                }
 
                /*
@@ -456,7 +465,7 @@ namespace Mono.Net.Security
                                return InternalWrite (asyncRequest, writeBuffer, buffer, offset, size);
                        } catch (Exception ex) {
                                Debug ("InternalWrite failed: {0}", ex);
-                               SetException_internal (ex);
+                               SetException (GetIOException (ex, "InternalWrite() failed"));
                                return false;
                        }
                }
@@ -511,22 +520,30 @@ namespace Mono.Net.Security
                        return true;
                }
 
-               #endregion
+#endregion
 
-               #region Inner Stream
+#region Inner Stream
 
                /*
                 * Read / write data from the inner stream; we're only called from managed code and only manipulate
                 * the internal buffers.
                 */
-               internal int InnerRead (int requestedSize)
+               internal async Task<int> InnerRead (bool sync, int requestedSize, CancellationToken cancellationToken)
                {
+                       cancellationToken.ThrowIfCancellationRequested ();
                        Debug ("InnerRead: {0} {1} {2} {3}", readBuffer.Offset, readBuffer.Size, readBuffer.Remaining, requestedSize);
 
                        var len = System.Math.Min (readBuffer.Remaining, requestedSize);
                        if (len == 0)
                                throw new InvalidOperationException ();
-                       var ret = InnerStream.Read (readBuffer.Buffer, readBuffer.EndOffset, len);
+
+                       Task<int> task;
+                       if (sync)
+                               task = Task.Run (() => InnerStream.Read (readBuffer.Buffer, readBuffer.EndOffset, len));
+                       else
+                               task = InnerStream.ReadAsync (readBuffer.Buffer, readBuffer.EndOffset, len, cancellationToken);
+
+                       var ret = await task.ConfigureAwait (false);
                        Debug ("InnerRead done: {0} {1} - {2}", readBuffer.Remaining, len, ret);
 
                        if (ret >= 0) {
@@ -549,165 +566,126 @@ namespace Mono.Net.Security
                        return ret;
                }
 
-               internal void InnerWrite ()
+               internal async Task InnerWrite (bool sync, CancellationToken cancellationToken)
                {
+                       cancellationToken.ThrowIfCancellationRequested ();
                        Debug ("InnerWrite: {0} {1}", writeBuffer.Offset, writeBuffer.Size);
-                       InnerFlush ();
-               }
 
-               internal void InnerFlush ()
-               {
-                       if (writeBuffer.Size > 0) {
-                               InnerStream.Write (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size);
-                               writeBuffer.TotalBytes += writeBuffer.Size;
-                               writeBuffer.Offset = writeBuffer.Size = 0;
-                       }
+                       if (writeBuffer.Size == 0)
+                               return;
+
+                       Task task;
+                       if (sync)
+                               task = Task.Run (() => InnerStream.Write (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size));
+                       else
+                               task = InnerStream.WriteAsync (writeBuffer.Buffer, writeBuffer.Offset, writeBuffer.Size);
+
+                       await task.ConfigureAwait (false);
+
+                       writeBuffer.TotalBytes += writeBuffer.Size;
+                       writeBuffer.Offset = writeBuffer.Size = 0;
                }
 
-               #endregion
+#endregion
 
-               #region Main async I/O loop
+#region Main async I/O loop
 
-               AsyncOperationStatus ProcessHandshake (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+               internal AsyncOperationStatus ProcessHandshake (AsyncOperationStatus status)
                {
                        Debug ("ProcessHandshake: {0}", status);
 
-                       /*
-                        * The first time we're called (AsyncOperationStatus.Initialize), we need to setup the SslContext and
-                        * start the handshake.
-                       */
-                       if (status == AsyncOperationStatus.Initialize) {
-                               xobileTlsContext.StartHandshake ();
-                               return AsyncOperationStatus.Continue;
-                       } else if (status == AsyncOperationStatus.ReadDone) {
-                               // remote prematurely closed connection.
-                               throw new IOException ("Remote prematurely closed connection.");
-                       } else if (status != AsyncOperationStatus.Continue) {
-                               throw new InvalidOperationException ();
-                       }
+                       lock (ioLock) {
+                               /*
+                                * The first time we're called (AsyncOperationStatus.Initialize), we need to setup the SslContext and
+                                * start the handshake.
+                               */
+                               if (status == AsyncOperationStatus.Initialize) {
+                                       xobileTlsContext.StartHandshake ();
+                                       return AsyncOperationStatus.Continue;
+                               } else if (status == AsyncOperationStatus.ReadDone) {
+                                       throw new IOException (SR.net_auth_eof);
+                               } else if (status != AsyncOperationStatus.Continue) {
+                                       throw new InvalidOperationException ();
+                               }
 
-                       /*
-                        * SSLHandshake() will return repeatedly with 'SslStatus.WouldBlock', we then need
-                        * to take care of I/O and call it again.
-                       */
-                       if (!xobileTlsContext.ProcessHandshake ()) {
                                /*
-                                * Flush the internal write buffer.
-                                */
-                               InnerFlush ();
+                                * SSLHandshake() will return repeatedly with 'SslStatus.WouldBlock', we then need
+                                * to take care of I/O and call it again.
+                               */
+                               if (xobileTlsContext.ProcessHandshake ()) {
+                                       xobileTlsContext.FinishHandshake ();
+                                       return AsyncOperationStatus.Complete;
+                               }
                                return AsyncOperationStatus.Continue;
                        }
-
-                       xobileTlsContext.FinishHandshake ();
-                       return AsyncOperationStatus.Complete;
                }
 
-               AsyncOperationStatus ProcessRead (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+               internal (int, bool) ProcessRead (BufferOffsetSize userBuffer)
                {
-                       Debug ("ProcessRead - read user: {0} {1}", status, asyncRequest.UserBuffer);
-
-                       int ret;
-                       bool wantMore;
                        lock (ioLock) {
-                               ret = Context.Read (asyncRequest.UserBuffer.Buffer, asyncRequest.UserBuffer.Offset, asyncRequest.UserBuffer.Size, out wantMore);
+                               // This operates on the internal buffer and will never block.
+                               var ret = xobileTlsContext.Read (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
+                               return (ret, wantMore);
                        }
-                       Debug ("ProcessRead - read user done: {0} - {1} {2}", asyncRequest.UserBuffer, ret, wantMore);
-
-                       if (ret < 0) {
-                               asyncRequest.UserResult = -1;
-                               return AsyncOperationStatus.Complete;
-                       }
-
-                       asyncRequest.CurrentSize += ret;
-                       asyncRequest.UserBuffer.Offset += ret;
-                       asyncRequest.UserBuffer.Size -= ret;
-
-                       Debug ("Process Read - read user done #1: {0} - {1} {2}", asyncRequest.UserBuffer, asyncRequest.CurrentSize, wantMore);
-
-                       if (wantMore && asyncRequest.CurrentSize == 0)
-                               return AsyncOperationStatus.WantRead;
-
-                       asyncRequest.ResetRead ();
-                       asyncRequest.UserResult = asyncRequest.CurrentSize;
-                       return AsyncOperationStatus.Complete;
                }
 
-               AsyncOperationStatus ProcessWrite (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+               internal (int, bool) ProcessWrite (BufferOffsetSize userBuffer)
                {
-                       Debug ("ProcessWrite - write user: {0} {1}", status, asyncRequest.UserBuffer);
-
-                       if (asyncRequest.UserBuffer.Size == 0) {
-                               asyncRequest.UserResult = asyncRequest.CurrentSize;
-                               return AsyncOperationStatus.Complete;
-                       }
-
-                       int ret;
-                       bool wantMore;
                        lock (ioLock) {
-                               ret = Context.Write (asyncRequest.UserBuffer.Buffer, asyncRequest.UserBuffer.Offset, asyncRequest.UserBuffer.Size, out wantMore);
-                       }
-                       Debug ("ProcessWrite - write user done: {0} - {1} {2}", asyncRequest.UserBuffer, ret, wantMore);
-
-                       if (ret < 0) {
-                               asyncRequest.UserResult = -1;
-                               return AsyncOperationStatus.Complete;
+                               // This operates on the internal buffer and will never block.
+                               var ret = xobileTlsContext.Write (userBuffer.Buffer, userBuffer.Offset, userBuffer.Size, out bool wantMore);
+                               return (ret, wantMore);
                        }
-
-                       asyncRequest.CurrentSize += ret;
-                       asyncRequest.UserBuffer.Offset += ret;
-                       asyncRequest.UserBuffer.Size -= ret;
-
-                       if (wantMore || writeBuffer.Size > 0)
-                               return AsyncOperationStatus.WantWrite;
-
-                       asyncRequest.ResetWrite ();
-                       asyncRequest.UserResult = asyncRequest.CurrentSize;
-                       return AsyncOperationStatus.Complete;
                }
 
-               AsyncOperationStatus ProcessClose (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
+               internal AsyncOperationStatus ProcessShutdown (AsyncOperationStatus status)
                {
-                       Debug ("ProcessClose: {0}", status);
+                       Debug ("ProcessShutdown: {0}", status);
 
                        lock (ioLock) {
-                               if (xobileTlsContext == null)
-                                       return AsyncOperationStatus.Complete;
-
-                               xobileTlsContext.Close ();
-                               xobileTlsContext = null;
-                               return AsyncOperationStatus.Continue;
+                               xobileTlsContext.Shutdown ();
+                               shutdown = true;
+                               return AsyncOperationStatus.Complete;
                        }
                }
 
-               AsyncOperationStatus ProcessFlush (AsyncProtocolRequest asyncRequest, AsyncOperationStatus status)
-               {
-                       Debug ("ProcessFlush: {0}", status);
-                       return AsyncOperationStatus.Complete;
-               }
-
-               #endregion
+#endregion
 
                public override bool IsServer {
-                       get { return xobileTlsContext != null && xobileTlsContext.IsServer; }
+                       get {
+                               CheckThrow (false);
+                               return xobileTlsContext != null && xobileTlsContext.IsServer;
+                       }
                }
 
                public override bool IsAuthenticated {
-                       get { return xobileTlsContext != null && lastException == null && xobileTlsContext.IsAuthenticated; }
+                       get {
+                               lock (ioLock) {
+                                       // Don't use CheckThrow(), we want to return false if we're not authenticated.
+                                       return xobileTlsContext != null && lastException == null && xobileTlsContext.IsAuthenticated;
+                               }
+                       }
                }
 
                public override bool IsMutuallyAuthenticated {
                        get {
-                               return IsAuthenticated &&
-                                       (Context.IsServer? Context.LocalServerCertificate: Context.LocalClientCertificate) != null &&
-                                       Context.IsRemoteCertificateAvailable;
+                               lock (ioLock) {
+                                       // Don't use CheckThrow() here.
+                                       if (!IsAuthenticated)
+                                               return false;
+                                       if ((xobileTlsContext.IsServer ? xobileTlsContext.LocalServerCertificate : xobileTlsContext.LocalClientCertificate) == null)
+                                               return false;
+                                       return xobileTlsContext.IsRemoteCertificateAvailable;
+                               }
                        }
                }
 
                protected override void Dispose (bool disposing)
                {
                        try {
-                               lastException = new ObjectDisposedException ("MobileAuthenticatedStream");
                                lock (ioLock) {
+                                       Debug ("Dispose: {0}", xobileTlsContext != null);
+                                       lastException = ExceptionDispatchInfo.Capture (new ObjectDisposedException ("MobileAuthenticatedStream"));
                                        if (xobileTlsContext != null) {
                                                xobileTlsContext.Dispose ();
                                                xobileTlsContext = null;
@@ -720,26 +698,53 @@ namespace Mono.Net.Security
 
                public override void Flush ()
                {
-                       CheckThrow (true);
-                       var asyncRequest = new AsyncProtocolRequest (this, null);
-                       StartOperation (ref asyncWriteRequest, ref writeBuffer, ProcessFlush, asyncRequest, "flush");
+                       // Write() automatically flushes the underlying stream.
                }
 
-               public override void Close ()
-               {
-                       /*
-                        * SSLClose() is a little bit tricky as it might attempt to send a close_notify alert
-                        * and thus call our write callback.
-                        *
-                        * It is also not thread-safe with SSLRead() or SSLWrite(), so we need to take the I/O lock here.
-                        */
-                       if (Interlocked.Exchange (ref closeRequested, 1) == 1)
-                               return;
-                       if (xobileTlsContext == null)
-                               return;
+               public SslProtocols SslProtocol {
+                       get {
+                               lock (ioLock) {
+                                       CheckThrow (true);
+                                       return (SslProtocols)xobileTlsContext.NegotiatedProtocol;
+                               }
+                       }
+               }
+
+               public X509Certificate RemoteCertificate {
+                       get {
+                               lock (ioLock) {
+                                       CheckThrow (true);
+                                       return xobileTlsContext.RemoteCertificate;
+                               }
+                       }
+               }
+
+               public X509Certificate LocalCertificate {
+                       get {
+                               lock (ioLock) {
+                                       CheckThrow (true);
+                                       return InternalLocalCertificate;
+                               }
+                       }
+               }
+
+               public X509Certificate InternalLocalCertificate {
+                       get {
+                               lock (ioLock) {
+                                       CheckThrow (false);
+                                       if (xobileTlsContext == null)
+                                               return null;
+                                       return xobileTlsContext.IsServer ? xobileTlsContext.LocalServerCertificate : xobileTlsContext.LocalClientCertificate;
+                               }
+                       }
+               }
 
-                       var asyncRequest = new AsyncProtocolRequest (this, null);
-                       StartOperation (ref asyncWriteRequest, ref writeBuffer, ProcessClose, asyncRequest, "close");
+               public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
+               {
+                       lock (ioLock) {
+                               CheckThrow (true);
+                               return xobileTlsContext.ConnectionInfo;
+                       }
                }
 
                //
@@ -769,7 +774,7 @@ namespace Mono.Net.Security
                }
 
                public override bool CanWrite {
-                       get { return IsAuthenticated & InnerStream.CanWrite; }
+                       get { return IsAuthenticated & InnerStream.CanWrite && !shutdown; }
                }
 
                public override bool CanSeek {
@@ -803,46 +808,10 @@ namespace Mono.Net.Security
                        set { InnerStream.WriteTimeout = value; }
                }
 
-               public SslProtocols SslProtocol {
-                       get {
-                               CheckThrow (true);
-                               return (SslProtocols)Context.NegotiatedProtocol;
-                       }
-               }
-
-               public X509Certificate RemoteCertificate {
-                       get {
-                               CheckThrow (true);
-                               return Context.RemoteCertificate;
-                       }
-               }
-
-               public X509Certificate LocalCertificate {
-                       get {
-                               CheckThrow (true);
-                               return InternalLocalCertificate;
-                       }
-               }
-
-               public X509Certificate InternalLocalCertificate {
-                       get {
-                               CheckThrow (false);
-                               if (!HasContext)
-                                       return null;
-                               return Context.IsServer ? Context.LocalServerCertificate : Context.LocalClientCertificate;
-                       }
-               }
-
-               public MSI.MonoTlsConnectionInfo GetConnectionInfo ()
-               {
-                       CheckThrow (true);
-                       return Context.ConnectionInfo;
-               }
-
                public SSA.CipherAlgorithmType CipherAlgorithm {
                        get {
                                CheckThrow (true);
-                               var info = Context.ConnectionInfo;
+                               var info = GetConnectionInfo ();
                                if (info == null)
                                        return SSA.CipherAlgorithmType.None;
                                switch (info.CipherAlgorithmType) {
@@ -861,7 +830,7 @@ namespace Mono.Net.Security
                public SSA.HashAlgorithmType HashAlgorithm {
                        get {
                                CheckThrow (true);
-                               var info = Context.ConnectionInfo;
+                               var info = GetConnectionInfo ();
                                if (info == null)
                                        return SSA.HashAlgorithmType.None;
                                switch (info.HashAlgorithmType) {
@@ -883,7 +852,7 @@ namespace Mono.Net.Security
                public SSA.ExchangeAlgorithmType KeyExchangeAlgorithm {
                        get {
                                CheckThrow (true);
-                               var info = Context.ConnectionInfo;
+                               var info = GetConnectionInfo ();
                                if (info == null)
                                        return SSA.ExchangeAlgorithmType.None;
                                switch (info.ExchangeAlgorithmType) {
@@ -898,7 +867,7 @@ namespace Mono.Net.Security
                        }
                }
 
-               #region Need to Implement
+#region Need to Implement
                public int CipherStrength {
                        get {
                                throw new NotImplementedException ();
@@ -920,7 +889,7 @@ namespace Mono.Net.Security
                        }
                }
 
-               #endregion
+#endregion
        }
 }
 #endif
index 79f0468d4619aee415b238d9171366fe801abb8e..b4ba1c014cabf7cb5e47d7410d46d19e5aa10106 100644 (file)
@@ -169,7 +169,7 @@ namespace Mono.Net.Security
 
                public abstract int Write (byte[] buffer, int offset, int count, out bool wantMore);
 
-               public abstract void Close ();
+               public abstract void Shutdown ();
 
                protected bool ValidateCertificate (X509Certificate leaf, X509Chain chain)
                {
index 96d81315139bdede6a05c6d2a4b36aeb5701b453..660e3b41bb6b5e5ca366a52dfbba32ad5810830e 100644 (file)
@@ -83,6 +83,8 @@ namespace Mono.Net.Security
                                if (initialized)
                                        return;
 
+                               InitializeProviderRegistration ();
+
                                MSI.MonoTlsProvider provider;
                                try {
                                        provider = CreateDefaultProviderImpl ();
index cfcd038e9b54b2ee876d4b8b5d5010f9275ecacd..896362d98a4b14de35203b4f70c0a0f812c7de14 100644 (file)
@@ -9,6 +9,8 @@ partial class SR
 {
        public const string mono_net_io_shutdown = "mono_net_io_shutdown";
        public const string mono_net_io_renegotiate = "mono_net_io_renegotiate";
+       
+       public const string net_ssl_io_already_shutdown = "Write operations are not allowed after the channel was shutdown.";
 
        public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
        public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
index 6d61e08dfb1bf659161ca1869175ffa3e70cdb16..c0b702fde1b2f92798271fdf943402e1460eb27a 100644 (file)
@@ -223,6 +223,11 @@ namespace System.Net.Security
                        return Impl.AuthenticateAsServerAsync (serverCertificate, clientCertificateRequired, enabledSslProtocols, checkCertificateRevocation);
                }
 
+               public virtual Task ShutdownAsync ()
+               {
+                       return Impl.ShutdownAsync ();
+               }
+
                public override bool IsAuthenticated {
                        get { return Impl.IsAuthenticated; }
                }
index 06fefad105ac81e87e83fa25a76f8b3dc74e8343..1c2a4167301b6df077b7ef1467aa4fd626571d22 100644 (file)
@@ -152,6 +152,11 @@ namespace System.Net.Security
                        throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
                }
 
+               public virtual Task ShutdownAsync ()
+               {
+                       throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
+               }
+
                public override bool IsAuthenticated {
                        get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
                }
index 89911c426b4420c4cc944c0dea38db8850a40204..d19756b6c30013be319b87d94a0747081fc47394 100644 (file)
@@ -976,60 +976,7 @@ namespace System.Net.Sockets
                                EndPoint = remoteEP,
                        };
 
-                       // Bug #75154: Connect() should not succeed for .Any addresses.
-                       if (remoteEP is IPEndPoint) {
-                               IPEndPoint ep = (IPEndPoint) remoteEP;
-                               if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) {
-                                       sockares.Complete (new SocketException ((int) SocketError.AddressNotAvailable), true);
-                                       return sockares;
-                               }
-
-                               sockares.EndPoint = remoteEP = RemapIPEndPoint (ep);
-                       }
-
-                       int error = 0;
-
-                       if (connect_in_progress) {
-                               // This could happen when multiple IPs are used
-                               // Calling connect() again will reset the connection attempt and cause
-                               // an error. Better to just close the socket and move on.
-                               connect_in_progress = false;
-                               m_Handle.Dispose ();
-                               m_Handle = new SafeSocketHandle (Socket_internal (addressFamily, socketType, protocolType, out error), true);
-                               if (error != 0)
-                                       throw new SocketException (error);
-                       }
-
-                       bool blk = is_blocking;
-                       if (blk)
-                               Blocking = false;
-                       Connect_internal (m_Handle, remoteEP.Serialize (), out error, false);
-                       if (blk)
-                               Blocking = true;
-
-                       if (error == 0) {
-                               // succeeded synch
-                               is_connected = true;
-                               is_bound = true;
-                               sockares.Complete (true);
-                               return sockares;
-                       }
-
-                       if (error != (int) SocketError.InProgress && error != (int) SocketError.WouldBlock) {
-                               // error synch
-                               is_connected = false;
-                               is_bound = false;
-                               sockares.Complete (new SocketException (error), true);
-                               return sockares;
-                       }
-
-                       // continue asynch
-                       is_connected = false;
-                       is_bound = false;
-                       connect_in_progress = true;
-
-                       IOSelector.Add (sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginConnectCallback, sockares));
-
+                       BeginSConnect (sockares);
                        return sockares;
                }
 
@@ -1055,39 +1002,85 @@ namespace System.Net.Sockets
 
                        is_connected = false;
 
-                       return BeginMConnect (sockares);
+                       BeginMConnect (sockares);
+                       return sockares;
                }
 
-               internal IAsyncResult BeginMConnect (SocketAsyncResult sockares)
+               static void BeginMConnect (SocketAsyncResult sockares)
                {
-                       SocketAsyncResult ares = null;
                        Exception exc = null;
-                       AsyncCallback callback;
 
                        for (int i = sockares.CurrentAddress; i < sockares.Addresses.Length; i++) {
                                try {
                                        sockares.CurrentAddress++;
+                                       sockares.EndPoint = new IPEndPoint (sockares.Addresses [i], sockares.Port);
 
-                                       ares = (SocketAsyncResult) BeginConnect (new IPEndPoint (sockares.Addresses [i], sockares.Port), null, sockares);
-                                       if (ares.IsCompleted && ares.CompletedSynchronously) {
-                                               ares.CheckIfThrowDelayedException ();
-
-                                               callback = ares.AsyncCallback;
-                                               if (callback != null)
-                                                       ThreadPool.UnsafeQueueUserWorkItem (_ => callback (ares), null);
-                                       }
-
-                                       break;
+                                       BeginSConnect (sockares);
+                                       return;
                                } catch (Exception e) {
                                        exc = e;
-                                       ares = null;
                                }
                        }
 
-                       if (ares == null)
-                               throw exc;
+                       throw exc;
+               }
 
-                       return sockares;
+               static void BeginSConnect (SocketAsyncResult sockares)
+               {
+                       EndPoint remoteEP = sockares.EndPoint;
+                       // Bug #75154: Connect() should not succeed for .Any addresses.
+                       if (remoteEP is IPEndPoint) {
+                               IPEndPoint ep = (IPEndPoint) remoteEP;
+                               if (ep.Address.Equals (IPAddress.Any) || ep.Address.Equals (IPAddress.IPv6Any)) {
+                                       sockares.Complete (new SocketException ((int) SocketError.AddressNotAvailable), true);
+                                       return;
+                               }
+
+                               sockares.EndPoint = remoteEP = sockares.socket.RemapIPEndPoint (ep);
+                       }
+
+                       int error = 0;
+
+                       if (sockares.socket.connect_in_progress) {
+                               // This could happen when multiple IPs are used
+                               // Calling connect() again will reset the connection attempt and cause
+                               // an error. Better to just close the socket and move on.
+                               sockares.socket.connect_in_progress = false;
+                               sockares.socket.m_Handle.Dispose ();
+                               sockares.socket.m_Handle = new SafeSocketHandle (sockares.socket.Socket_internal (sockares.socket.addressFamily, sockares.socket.socketType, sockares.socket.protocolType, out error), true);
+                               if (error != 0)
+                                       throw new SocketException (error);
+                       }
+
+                       bool blk = sockares.socket.is_blocking;
+                       if (blk)
+                               sockares.socket.Blocking = false;
+                       Connect_internal (sockares.socket.m_Handle, remoteEP.Serialize (), out error, false);
+                       if (blk)
+                               sockares.socket.Blocking = true;
+
+                       if (error == 0) {
+                               // succeeded synch
+                               sockares.socket.is_connected = true;
+                               sockares.socket.is_bound = true;
+                               sockares.Complete (true);
+                               return;
+                       }
+
+                       if (error != (int) SocketError.InProgress && error != (int) SocketError.WouldBlock) {
+                               // error synch
+                               sockares.socket.is_connected = false;
+                               sockares.socket.is_bound = false;
+                               sockares.Complete (new SocketException (error), true);
+                               return;
+                       }
+
+                       // continue asynch
+                       sockares.socket.is_connected = false;
+                       sockares.socket.is_bound = false;
+                       sockares.socket.connect_in_progress = true;
+
+                       IOSelector.Add (sockares.Handle, new IOSelectorJob (IOOperation.Write, BeginConnectCallback, sockares));
                }
 
                static IOAsyncCallback BeginConnectCallback = new IOAsyncCallback (ares => {
@@ -1098,18 +1091,11 @@ namespace System.Net.Sockets
                                return;
                        }
 
-                       SocketAsyncResult mconnect = sockares.AsyncState as SocketAsyncResult;
-                       bool is_mconnect = mconnect != null && mconnect.Addresses != null;
-
                        try {
-                               EndPoint ep = sockares.EndPoint;
-                               int error_code = (int) sockares.socket.GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
-
-                               if (error_code == 0) {
-                                       if (is_mconnect)
-                                               sockares = mconnect;
+                               int error = (int) sockares.socket.GetSocketOption (SocketOptionLevel.Socket, SocketOptionName.Error);
 
-                                       sockares.socket.seed_endpoint = ep;
+                               if (error == 0) {
+                                       sockares.socket.seed_endpoint = sockares.EndPoint;
                                        sockares.socket.is_connected = true;
                                        sockares.socket.is_bound = true;
                                        sockares.socket.connect_in_progress = false;
@@ -1118,26 +1104,21 @@ namespace System.Net.Sockets
                                        return;
                                }
 
-                               if (!is_mconnect) {
+                               if (sockares.Addresses == null) {
                                        sockares.socket.connect_in_progress = false;
-                                       sockares.Complete (new SocketException (error_code));
+                                       sockares.Complete (new SocketException (error));
                                        return;
                                }
 
-                               if (mconnect.CurrentAddress >= mconnect.Addresses.Length) {
-                                       mconnect.Complete (new SocketException (error_code));
+                               if (sockares.CurrentAddress >= sockares.Addresses.Length) {
+                                       sockares.Complete (new SocketException (error));
                                        return;
                                }
 
-                               mconnect.socket.BeginMConnect (mconnect);
+                               BeginMConnect (sockares);
                        } catch (Exception e) {
                                sockares.socket.connect_in_progress = false;
-
-                               if (is_mconnect)
-                                       sockares = mconnect;
-
                                sockares.Complete (e);
-                               return;
                        }
                });
 
index f20e501c6878d4a4eb5487887e2de1265b12d68b..a38c2ff9c486fded93b9ba91633e543ae750671d 100644 (file)
@@ -276,6 +276,7 @@ ReferenceSources/SettingsSectionInternal.cs
 ReferenceSources/SecureStringHelper.cs
 ReferenceSources/Socket.cs
 ReferenceSources/SR.cs
+ReferenceSources/SR2.cs
 ReferenceSources/SRCategoryAttribute.cs
 ReferenceSources/Win32Exception.cs
 
index 46b53b430521e615b5766bb2d9fd720efbd9d4ed..110199b4bcd9869ae5ed238045261358ed207c23 100644 (file)
@@ -245,7 +245,6 @@ Mono.Net.Dns/ResolverError.cs
 Mono.Net.Dns/SimpleResolverEventArgs.cs
 ReferenceSources/BinaryCompatibility.cs
 ReferenceSources/ConfigurationManagerInternalFactory.cs
-ReferenceSources/SR2.cs
 
 ../referencesource/System/misc/PrivilegedConfigurationManager.cs
 
diff --git a/mcs/class/Xunit.NetCore.Extensions/Makefile b/mcs/class/Xunit.NetCore.Extensions/Makefile
deleted file mode 100644 (file)
index 7ea0857..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-thisdir = class/Xunit.NetCore.Extensions
-SUBDIRS = 
-include ../../build/rules.make
-
-XUNIT_LIBS := xunit.core xunit.abstractions xunit.execution.desktop xunit.assert
-
-LIBRARY = Xunit.NetCore.Extensions.dll
-LIB_REFS = System System.Core Facades/System.Runtime.InteropServices.RuntimeInformation Facades/System.Runtime Facades/System.Threading.Tasks
-LIB_MCS_FLAGS = $(patsubst %,-r:$(topdir)/../external/xunit-binaries/%.dll,$(XUNIT_LIBS))
-
-EXTRA_DISTFILES =
-
-NO_TEST = yes
-NO_INSTALL = yes
-NO_SIGN_ASSEMBLY = yes
-
-include ../../build/library.make
diff --git a/mcs/class/Xunit.NetCore.Extensions/Microsoft.Xunit.Performance/BenchmarkAttribute.cs b/mcs/class/Xunit.NetCore.Extensions/Microsoft.Xunit.Performance/BenchmarkAttribute.cs
deleted file mode 100644 (file)
index 5697d10..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-using System;
-using Xunit;
-using Xunit.Sdk;
-
-namespace Microsoft.Xunit.Performance
-{
-       [TraitDiscoverer("Microsoft.Xunit.Performance.BenchmarkDiscoverer", "Xunit.NetCore.Extensions")]
-       [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
-       public class BenchmarkAttribute : Attribute, ITraitAttribute
-       {
-               public long InnerIterationCount { get; set; }
-       }
-}
diff --git a/mcs/class/Xunit.NetCore.Extensions/Microsoft.Xunit.Performance/BenchmarkDiscover.cs b/mcs/class/Xunit.NetCore.Extensions/Microsoft.Xunit.Performance/BenchmarkDiscover.cs
deleted file mode 100644 (file)
index 40d2d8a..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-using System.Collections.Generic;
-using Xunit.Sdk;
-using Xunit.Abstractions;
-
-namespace Xunit.NetCore.Extensions
-{
-    public class BenchmarkDiscoverer : ITraitDiscoverer
-    {
-        public IEnumerable<KeyValuePair<string, string>> GetTraits(IAttributeInfo traitAttribute)
-        {
-            yield return new KeyValuePair<string, string>("Benchmark", "True");
-        }
-    }
-}
diff --git a/mcs/class/Xunit.NetCore.Extensions/Xunit.NetCore.Extensions.dll.sources b/mcs/class/Xunit.NetCore.Extensions/Xunit.NetCore.Extensions.dll.sources
deleted file mode 100644 (file)
index 145dae4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-../../../external/buildtools/src/xunit.netcore.extensions/*.cs
-../../../external/buildtools/src/xunit.netcore.extensions/Attributes/*.cs
-../../../external/buildtools/src/xunit.netcore.extensions/Discoverers/*.cs
-
-Microsoft.Xunit.Performance/BenchmarkAttribute.cs
-Microsoft.Xunit.Performance/BenchmarkDiscover.cs
index bc944350b304c4f9ca677606b59f43cab3c3041d..f643b072359e20a89be3a4d6de9eea8a6f4afe15 100644 (file)
@@ -30,12 +30,15 @@ using System.Collections.Generic;
 
 namespace System.Diagnostics.Tracing
 {
-       public abstract class EventListener : IDisposable
+       public class EventListener : IDisposable
        {
-               protected EventListener ()
+               public EventListener ()
                {
                }
 
+               //public event System.EventHandler<EventSourceCreatedEventArgs> EventSourceCreated;
+               //public event System.EventHandler<EventWrittenEventArgs> EventWritten;
+
                public static int EventSourceIndex(EventSource eventSource)
                {
                        return 0;
@@ -61,7 +64,9 @@ namespace System.Diagnostics.Tracing
                {
                }
 
-               protected internal abstract void OnEventWritten (EventWrittenEventArgs eventData);
+               protected internal virtual void OnEventWritten (EventWrittenEventArgs eventData)
+               {
+               }
 
                public virtual void Dispose()
                {
index f8522ebe862a6dee35fac7668cf2d959260eb50d..cd6a5a76487627767fbeea600afe85292bf43d6d 100644 (file)
@@ -229,7 +229,9 @@ namespace System.Reflection.Emit {
                }
 
                internal FieldInfo RuntimeResolve () {
-                       return typeb.CreateType ().GetField (this);
+                       // typeb.CreateType() populates this.handle
+                       var type_handle = new RuntimeTypeHandle (typeb.CreateType () as RuntimeType);
+                       return FieldInfo.GetFieldFromHandle (handle, type_handle);
                }
 
                public override Module Module {
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/CALLCONV.cs b/mcs/class/corlib/System.Runtime.InteropServices/CALLCONV.cs
deleted file mode 100644 (file)
index d956b45..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-//
-// System.Runtime.InteropServices.CALLCONV.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Serializable]
-       public enum CALLCONV
-       {
-               CC_CDECL = 1,
-               CC_PASCAL = 2,
-               CC_MSCPASCAL = 2,
-               CC_MACPASCAL = 3,
-               CC_STDCALL = 4,
-               CC_RESERVED = 5,
-               CC_SYSCALL = 6,
-               CC_MPWCDECL = 7,
-               CC_MPWPASCAL = 8,
-               CC_MAX = 9
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs b/mcs/class/corlib/System.Runtime.InteropServices/DISPPARAMS.cs
deleted file mode 100644 (file)
index b038963..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-// System.Runtime.InteropServices/DISPPARAMS.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct DISPPARAMS {
-               public IntPtr rgvarg;
-               public IntPtr rgdispidNamedArgs;
-               public int cArgs;
-               public int cNamedArgs;
-       }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/ELEMDESC.cs b/mcs/class/corlib/System.Runtime.InteropServices/ELEMDESC.cs
deleted file mode 100644 (file)
index be58742..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// System.Runtime.InteropServices.ELEMDESC.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct ELEMDESC
-       {
-               public TYPEDESC tdesc;
-               public DESCUNION desc;
-
-               [ComVisible (false)]
-               [StructLayout (LayoutKind.Explicit, CharSet = CharSet.Unicode)]
-               public struct DESCUNION
-               {
-                       [FieldOffset (0)]
-                       public IDLDESC idldesc;
-                       [FieldOffset (0)]
-                       public PARAMDESC paramdesc;
-               }
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs b/mcs/class/corlib/System.Runtime.InteropServices/EXCEPINFO.cs
deleted file mode 100644 (file)
index 0e61c36..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-// System.Runtime.InteropServices/EXCEPINFO.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-using System;
-
-#if !FULL_AOT_RUNTIME
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct EXCEPINFO {
-               public short wCode;
-               public short wReserved;
-               [MarshalAs (UnmanagedType.BStr)]
-               public string bstrSource;
-               [MarshalAs (UnmanagedType.BStr)]
-               public string bstrDescription;
-               [MarshalAs (UnmanagedType.BStr)]
-               public string bstrHelpFile;
-               public int dwHelpContext;
-               public IntPtr pvReserved;
-               public IntPtr pfnDeferredFillIn;
-       }
-}
-
-#endif
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/FUNCDESC.cs b/mcs/class/corlib/System.Runtime.InteropServices/FUNCDESC.cs
deleted file mode 100644 (file)
index 30d251a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-//
-// System.Runtime.InteropServices.FUNCDESC.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential)]
-       public struct FUNCDESC
-       {
-               public int memid;
-               public IntPtr lprgscode;
-               public IntPtr lprgelemdescParam;
-               public FUNCKIND funckind;
-               public INVOKEKIND invkind;
-               public CALLCONV callconv;
-               public short cParams;
-               public short cParamsOpt;
-               public short oVft;
-               public short cScodes;
-               public ELEMDESC elemdescFunc;
-               public short wFuncFlags;
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/FUNCFLAGS.cs b/mcs/class/corlib/System.Runtime.InteropServices/FUNCFLAGS.cs
deleted file mode 100644 (file)
index 13d5da8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// System.Runtime.InteropServices.FUNCFLAGS.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Flags, Serializable]
-       public enum FUNCFLAGS
-       {
-               FUNCFLAG_FRESTRICTED = 1,
-               FUNCFLAG_FSOURCE = 2,
-               FUNCFLAG_FBINDABLE = 4,
-               FUNCFLAG_FREQUESTEDIT = 8,
-               FUNCFLAG_FDISPLAYBIND = 16,
-               FUNCFLAG_FDEFAULTBIND = 32,
-               FUNCFLAG_FHIDDEN = 64,
-               FUNCFLAG_FUSESGETLASTERROR = 128,
-               FUNCFLAG_FDEFAULTCOLLELEM = 256,
-               FUNCFLAG_FUIDEFAULT = 512,
-               FUNCFLAG_FNONBROWSABLE = 1024,
-               FUNCFLAG_FREPLACEABLE = 2048,
-               FUNCFLAG_FIMMEDIATEBIND = 4096
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/FUNCKIND.cs b/mcs/class/corlib/System.Runtime.InteropServices/FUNCKIND.cs
deleted file mode 100644 (file)
index eee7d3f..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-//
-// System.Runtime.InteropServices.FUNCKIND.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Serializable]
-       public enum FUNCKIND
-       {
-               FUNC_VIRTUAL = 0,
-               FUNC_PUREVIRTUAL = 1,
-               FUNC_NONVIRTUAL = 2,
-               FUNC_STATIC = 3,
-               FUNC_DISPATCH = 4
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/IDLDESC.cs b/mcs/class/corlib/System.Runtime.InteropServices/IDLDESC.cs
deleted file mode 100644 (file)
index dfa5518..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Runtime.InteropServices.IDLDESC.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct IDLDESC
-       {
-               public int dwReserved;
-               public IDLFLAG wIDLFlags;
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/IDLFLAG.cs b/mcs/class/corlib/System.Runtime.InteropServices/IDLFLAG.cs
deleted file mode 100644 (file)
index e29a1a8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-//
-// System.Runtime.InteropServices.IDLFLAG.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Flags, Serializable]
-       public enum IDLFLAG
-       {
-               IDLFLAG_NONE = 0,
-               IDLFLAG_FIN = 1,
-               IDLFLAG_FOUT = 2,
-               IDLFLAG_FLCID = 4,
-               IDLFLAG_FRETVAL = 8
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/IMPLTYPEFLAGS.cs b/mcs/class/corlib/System.Runtime.InteropServices/IMPLTYPEFLAGS.cs
deleted file mode 100644 (file)
index 7da65a8..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-//
-// System.Runtime.InteropServices.IMPLTYPEFLAGS.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Flags, Serializable]
-       public enum IMPLTYPEFLAGS
-       {
-               IMPLTYPEFLAG_FDEFAULT = 1,
-               IMPLTYPEFLAG_FSOURCE = 2,
-               IMPLTYPEFLAG_FRESTRICTED = 4,
-               IMPLTYPEFLAG_FDEFAULTVTABLE = 8
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs b/mcs/class/corlib/System.Runtime.InteropServices/INVOKEKIND.cs
deleted file mode 100644 (file)
index 72c2edb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-// System.Runtime.InteropServices/INVOKEKIND.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Serializable]
-       public enum INVOKEKIND {
-               INVOKE_FUNC = 1,
-               INVOKE_PROPERTYGET = 2,
-               INVOKE_PROPERTYPUT = 4,
-               INVOKE_PROPERTYPUTREF = 8
-       }
-}
-
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PARAMDESC.cs b/mcs/class/corlib/System.Runtime.InteropServices/PARAMDESC.cs
deleted file mode 100644 (file)
index 8241204..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Runtime.InteropServices.PARAMDESC.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct PARAMDESC
-       {
-               public IntPtr lpVarValue;
-               public PARAMFLAG wParamFlags;
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/PARAMFLAG.cs b/mcs/class/corlib/System.Runtime.InteropServices/PARAMFLAG.cs
deleted file mode 100644 (file)
index 5715c8f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-//
-// System.Runtime.InteropServices.PARAMFLAG.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-using System;
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [Serializable]
-       [Flags]
-       public enum PARAMFLAG
-       {
-               PARAMFLAG_NONE = 0,
-               PARAMFLAG_FIN = 1,
-               PARAMFLAG_FOUT = 2,
-               PARAMFLAG_FLCID = 4,
-               PARAMFLAG_FRETVAL = 8,
-               PARAMFLAG_FOPT = 16,
-               PARAMFLAG_FHASDEFAULT = 32,
-               PARAMFLAG_FHASCUSTDATA = 64
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TYPEATTR.cs b/mcs/class/corlib/System.Runtime.InteropServices/TYPEATTR.cs
deleted file mode 100644 (file)
index 9b7bdd1..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-//
-// System.Runtime.InteropServices.TYPEATTR.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct TYPEATTR
-       {
-               public const int MEMBER_ID_NIL = -1;
-
-               public Guid guid;
-               public int lcid;
-               public int dwReserved;
-               public int memidConstructor;
-               public int memidDestructor;
-               public IntPtr lpstrSchema;
-               public int cbSizeInstance;
-               public TYPEKIND typekind;
-               public short cFuncs;
-               public short cVars;
-               public short cImplTypes;
-               public short cbSizeVft;
-               public short cbAlignment;
-               public TYPEFLAGS wTypeFlags;
-               public short wMajorVerNum;
-               public short wMinorVerNum;
-               public TYPEDESC tdescAlias;
-               public IDLDESC idldescType;
-       }
-}
diff --git a/mcs/class/corlib/System.Runtime.InteropServices/TYPEDESC.cs b/mcs/class/corlib/System.Runtime.InteropServices/TYPEDESC.cs
deleted file mode 100644 (file)
index 5dcf95c..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-//
-// System.Runtime.InteropServices.TYPEDESC.cs
-//
-// Author:
-//   Andreas Nahr (ClassDevelopment@A-SoftTech.com)
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
-//
-
-namespace System.Runtime.InteropServices
-{
-       [Obsolete]
-       [StructLayout (LayoutKind.Sequential, CharSet = CharSet.Unicode)]
-       public struct TYPEDESC
-       {
-               public IntPtr lpValue;
-               public short vt;
-       }
-}
index b0eef4e4c0e4a72bd38995c925c2c1baf9038df2..4d20d6a67879155c1e8b32c91548f97ef55cede0 100644 (file)
@@ -73,19 +73,59 @@ namespace System.Runtime.Remoting.Messaging {
        [Serializable]
        internal class CADMethodRef
        {
-               internal string FullTypeName;
-               internal IntPtr MethodHandlePtr;
+               Type[] GetTypes (string[] typeArray)
+               {
+                       Type[] res = new Type [typeArray.Length];
+                       for (int i = 0; i < typeArray.Length; ++i)
+                               res [i] = Type.GetType (typeArray [i], true);
+                       return res;
+               }
 
-               public RuntimeMethodHandle MethodHandle {
-                       get {
-                               return new RuntimeMethodHandle (MethodHandlePtr);
-                       }
+               bool ctor;
+               string typeName;
+               string methodName;
+               string[] param_names;
+               string[] generic_arg_names;
+
+               public MethodBase Resolve ()
+               {
+                       Type type = Type.GetType (typeName, true);
+                       MethodBase sig_cand = null;
+                       Type[] param_types = GetTypes (param_names);
+                       if (ctor)
+                               sig_cand = type.GetConstructor (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, param_types, null);
+                       else
+                               sig_cand = type.GetMethod (methodName, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, param_types, null);
+
+                       if (sig_cand != null && generic_arg_names != null)
+                               sig_cand = ((MethodInfo)sig_cand).MakeGenericMethod (GetTypes (generic_arg_names));
+
+                       if (sig_cand == null)
+                               throw new RemotingException ($"Method '{methodName}' not found in type '{typeName}'");
+
+                       return sig_cand;
                }
 
                public CADMethodRef (IMethodMessage msg)
                {
-                       MethodHandlePtr = msg.MethodBase.MethodHandle.Value;
-                       FullTypeName = msg.MethodBase.DeclaringType.AssemblyQualifiedName;
+                       MethodBase method = msg.MethodBase;
+                       typeName = method.DeclaringType.AssemblyQualifiedName;
+                       ctor = method.IsConstructor;
+                       methodName = method.Name;
+
+                       if (!ctor && method.IsGenericMethod) {
+                               var ga = method.GetGenericArguments ();
+                               generic_arg_names = new string [ga.Length];
+                               for (int i = 0; i < ga.Length; ++i)
+                                       generic_arg_names [i] = ga [i].AssemblyQualifiedName;
+
+                               method = ((MethodInfo)method).GetGenericMethodDefinition ();
+                       }
+
+                       var param_types = method.GetParameters ();
+                       param_names = new string [param_types.Length];
+                       for (int i = 0; i < param_types.Length; ++i)
+                               param_names [i] = param_types [i].ParameterType.AssemblyQualifiedName;
                }
        }
 
@@ -102,62 +142,11 @@ namespace System.Runtime.Remoting.Messaging {
                        serializedMethod = CADSerializer.SerializeObject (methodRef).GetBuffer ();
                }
 
-               internal MethodBase method {
-                       get { return GetMethod (); }
-               }
-
                internal MethodBase GetMethod ()
                {
                        CADMethodRef methRef = (CADMethodRef)CADSerializer.DeserializeObjectSafe (serializedMethod);
 
-                       MethodBase _method;
-
-                       Type tt = Type.GetType (methRef.FullTypeName, true);
-                       if (tt.IsGenericType || tt.IsGenericTypeDefinition) {
-                               _method = MethodBase.GetMethodFromHandleNoGenericCheck (methRef.MethodHandle);
-                       } else {
-                               _method = MethodBase.GetMethodFromHandle (methRef.MethodHandle);
-                       }
-
-                       if (tt != _method.DeclaringType) {
-                               // The target domain has loaded the type from a different assembly.
-                               // We need to locate the correct type and get the method from it
-                               Type [] signature = GetSignature (_method, true);
-                               if (_method.IsGenericMethod) {
-                                       MethodBase [] methods = tt.GetMethods (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance);
-                                       Type [] base_args = _method.GetGenericArguments ();
-                                       foreach (MethodBase method in methods) {
-                                               if (!method.IsGenericMethod || method.Name != _method.Name)
-                                                       continue;
-                                               Type [] method_args = method.GetGenericArguments ();
-                                               if (base_args.Length != method_args.Length)
-                                                       continue;
-
-                                               MethodInfo method_instance = ((MethodInfo) method).MakeGenericMethod (base_args);
-                                               Type [] base_sig = GetSignature (method_instance, false);
-                                               if (base_sig.Length != signature.Length) {
-                                                       continue;
-                                               }
-                                               bool dont = false;
-                                               for (int i = base_sig.Length - 1; i >= 0; i--) {
-                                                       if (base_sig [i] != signature [i]) {
-                                                               dont = true;
-                                                               break;
-                                                       }
-                                               }
-                                               if (dont)
-                                                       continue;
-                                               return method_instance;
-                                       }
-                                       return _method;
-                               }
-
-                               MethodBase mb = tt.GetMethod (_method.Name, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, signature, null);
-                               if (mb == null)
-                                       throw new RemotingException ("Method '" + _method.Name + "' not found in type '" + tt + "'");
-                               return mb;
-                       }
-                       return _method;
+                       return methRef.Resolve ();
                }
 
                static protected Type [] GetSignature (MethodBase methodBase, bool load)
@@ -174,6 +163,7 @@ namespace System.Runtime.Remoting.Messaging {
                        }
                        return signature;
                }
+
                // Helper to marshal properties
                internal static int MarshalProperties (IDictionary dict, ref ArrayList args) {
                        IDictionary serDict = dict;
@@ -457,7 +447,7 @@ namespace System.Runtime.Remoting.Messaging {
                        _returnValue = MarshalArgument ( retMsg.ReturnValue, ref serializeList);
                        _args = MarshalArguments ( retMsg.Args, ref serializeList);
 
-                       _sig = GetSignature (method, true);
+                       _sig = GetSignature (GetMethod (), true);
 
                        if (null != retMsg.Exception) {
                                if (null == serializeList)
index 32796ff7337766b2eaa9674e0fa45bc509df293d..82d242a8e01fa956e77690592a701bd4b39a1f96 100644 (file)
@@ -27,7 +27,7 @@
 //
 
 namespace System.Security.AccessControl {
-       public enum AceType {
+       public enum AceType : byte {
                AccessAllowed = 0,
                AccessDenied = 1,
                SystemAudit = 2,
index 022774c804980764437a752403c4ee03cfc61867..1cbc404d2dbd253447ffda41e0a732cffa1d6e8d 100644 (file)
@@ -35,7 +35,7 @@ namespace System.Security.Policy {
 
        [Serializable]
        [ComVisible (true)]
-       public class PolicyException : SystemException, _Exception {
+       public class PolicyException : SystemException {
                // Constructors
                public PolicyException ()
                        : base (Locale.GetText ("Cannot run because of policy."))
index f66c6c1ee4bc5ca557a046389594609be2c324fd..86f87defcf7b78bf32dc068e20857b9351e79c19 100644 (file)
@@ -11306,5 +11306,91 @@ namespace MonoTests.System.Reflection.Emit
 
                        Assert.AreSame (buildX, defX);
                }
+
+               [Test]
+               public void FieldsWithSameName () {
+                       // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=57222
+                       string fileName = CreateTempAssembly ();
+
+                       var assemblyName = new AssemblyName { Name = "test" };
+                       var dynamicAssembly = AssemblyBuilder.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.RunAndSave);
+                       var dynamicModule = dynamicAssembly.DefineDynamicModule (assemblyName.Name, fileName);
+                       var typeBuilder = dynamicModule.DefineType ("type1", TypeAttributes.Public | TypeAttributes.Class);
+
+                       var mainMethod = typeBuilder.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (int), new Type[0]);
+                       var mainMethodIl = mainMethod.GetILGenerator ();
+
+                       var f1 = typeBuilder.DefineField ("x", typeof (byte), FieldAttributes.Private | FieldAttributes.Static);
+                       var f2 = typeBuilder.DefineField ("x", typeof (sbyte), FieldAttributes.Private | FieldAttributes.Static);
+
+                       mainMethodIl.Emit (OpCodes.Ldsflda, f1);
+                       mainMethodIl.Emit (OpCodes.Ldsflda, f2);
+                       mainMethodIl.Emit (OpCodes.Pop);
+                       mainMethodIl.Emit (OpCodes.Pop);
+                       mainMethodIl.Emit (OpCodes.Ldc_I4_0);
+                       mainMethodIl.Emit (OpCodes.Ret);
+
+                       typeBuilder.CreateType ();
+                       dynamicAssembly.SetEntryPoint (mainMethod);
+
+                       dynamicAssembly.Save (fileName);
+               }
+               [Test]
+               public void FieldsWithSameNameAndType () {
+                       // https://bugzilla.xamarin.com/show_bug.cgi?id=57222
+                       string fileName = CreateTempAssembly ();
+
+                       var assemblyName = new AssemblyName { Name = "test" };
+                       var dynamicAssembly = AssemblyBuilder.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.RunAndSave);
+                       var dynamicModule = dynamicAssembly.DefineDynamicModule (assemblyName.Name, fileName);
+                       var typeBuilder = dynamicModule.DefineType ("type1", TypeAttributes.Public | TypeAttributes.Class);
+
+                       var mainMethod = typeBuilder.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (int), new Type[0]);
+                       var mainMethodIl = mainMethod.GetILGenerator ();
+
+                       var f1 = typeBuilder.DefineField ("x", typeof (sbyte), FieldAttributes.Private | FieldAttributes.Static);
+                       var f2 = typeBuilder.DefineField ("x", typeof (sbyte), FieldAttributes.Private | FieldAttributes.Static);
+
+                       mainMethodIl.Emit (OpCodes.Ldsflda, f1);
+                       mainMethodIl.Emit (OpCodes.Ldsflda, f2);
+                       mainMethodIl.Emit (OpCodes.Pop);
+                       mainMethodIl.Emit (OpCodes.Pop);
+                       mainMethodIl.Emit (OpCodes.Ldc_I4_0);
+                       mainMethodIl.Emit (OpCodes.Ret);
+
+                       typeBuilder.CreateType ();
+                       dynamicAssembly.SetEntryPoint (mainMethod);
+
+                       dynamicAssembly.Save (fileName);
+               }
+
+               [Test]
+               public void MethodsWithSameNameAndSig () {
+                       // https://bugzilla.xamarin.com/show_bug.cgi?id=57222
+                       string fileName = CreateTempAssembly ();
+
+                       var assemblyName = new AssemblyName { Name = "test" };
+                       var dynamicAssembly = AssemblyBuilder.DefineDynamicAssembly (assemblyName, AssemblyBuilderAccess.RunAndSave);
+                       var dynamicModule = dynamicAssembly.DefineDynamicModule (assemblyName.Name, fileName);
+                       var typeBuilder = dynamicModule.DefineType ("type1", TypeAttributes.Public | TypeAttributes.Class);
+
+                       var mainMethod = typeBuilder.DefineMethod ("Main", MethodAttributes.Public | MethodAttributes.Static, typeof (int), new Type[0]);
+                       var mainMethodIl = mainMethod.GetILGenerator ();
+
+                       var m1 = typeBuilder.DefineMethod ("X", MethodAttributes.Private | MethodAttributes.Static, typeof (void), new Type [0]);
+                       var m2 = typeBuilder.DefineMethod ("X", MethodAttributes.Private | MethodAttributes.Static, typeof (void), new Type [0]);
+                       m1.GetILGenerator ().Emit (OpCodes.Ret);
+                       m2.GetILGenerator ().Emit (OpCodes.Ret);
+
+                       mainMethodIl.Emit (OpCodes.Call, m1);
+                       mainMethodIl.Emit (OpCodes.Call, m2);
+                       mainMethodIl.Emit (OpCodes.Ldc_I4_0);
+                       mainMethodIl.Emit (OpCodes.Ret);
+
+                       typeBuilder.CreateType ();
+                       dynamicAssembly.SetEntryPoint (mainMethod);
+
+                       dynamicAssembly.Save (fileName);
+               }
        }
 }
index 593edcf65c69780f331dae72e4e353651dbf87a2..7ceec51affc0b047af1602c85b591cd4a386e0aa 100644 (file)
@@ -628,6 +628,19 @@ namespace MonoTests.System.Threading {
                        }
                }
 #endif // MONO_FEATURE_THREAD_SUSPEND_RESUME
+
+               [Test]
+               public static void SignalAndWait()
+               {
+                       using (var eventToSignal = new AutoResetEvent (false))
+                       using (var eventToWait = new AutoResetEvent (false))
+                       {
+                               eventToWait.Set ();
+
+                               Assert.IsTrue (WaitHandle.SignalAndWait (eventToSignal, eventToWait), "#1");
+                               Assert.IsTrue (eventToSignal.WaitOne (), "#2");
+                       }
+               }
        }
 }
 
index c4af3f5b553037fedd3d8c19a405c27763e5145e..9b245081069acf75ec49ec7942b32ac00137b1f1 100644 (file)
@@ -257,7 +257,6 @@ System.Reflection/MonoProperty.cs
 System.Reflection/ParameterInfo.cs
 System.Reflection/PortableExecutableKinds.cs
 System.Reflection/PropertyInfo.cs
-System.Reflection/ReflectionTypeLoadException.cs
 System.Reflection/StrongNameKeyPair.cs
 System.Reflection.Emit/AssemblyBuilder.cs
 System.Reflection.Emit/AssemblyBuilderAccess.cs
@@ -362,24 +361,13 @@ System.Runtime.InteropServices/_Type.cs
 System.Runtime.InteropServices/_TypeBuilder.cs
 System.Runtime.InteropServices/BIND_OPTS.cs
 System.Runtime.InteropServices/BINDPTR.cs
-System.Runtime.InteropServices/CALLCONV.cs
 System.Runtime.InteropServices/DESCKIND.cs
-System.Runtime.InteropServices/DISPPARAMS.cs
-System.Runtime.InteropServices/ELEMDESC.cs
-System.Runtime.InteropServices/EXCEPINFO.cs
 System.Runtime.InteropServices/ExporterEventKind.cs
 System.Runtime.InteropServices/ExtensibleClassFactory.cs
 System.Runtime.InteropServices/FILETIME.cs
-System.Runtime.InteropServices/FUNCDESC.cs
-System.Runtime.InteropServices/FUNCFLAGS.cs
-System.Runtime.InteropServices/FUNCKIND.cs
 System.Runtime.InteropServices/GCHandle.cs
 System.Runtime.InteropServices/GCHandleType.cs
-System.Runtime.InteropServices/IDLDESC.cs
-System.Runtime.InteropServices/IDLFLAG.cs
 System.Runtime.InteropServices/IErrorInfo.cs
-System.Runtime.InteropServices/IMPLTYPEFLAGS.cs
-System.Runtime.InteropServices/INVOKEKIND.cs
 System.Runtime.InteropServices/ITypeLibConverter.cs
 System.Runtime.InteropServices/ITypeLibExporterNameProvider.cs
 System.Runtime.InteropServices/ITypeLibExporterNotifySink.cs
@@ -389,8 +377,6 @@ System.Runtime.InteropServices/LIBFLAGS.cs
 System.Runtime.InteropServices/ManagedErrorInfo.cs
 System.Runtime.InteropServices/Marshal.cs
 System.Runtime.InteropServices/MarshalAsAttribute.cs
-System.Runtime.InteropServices/PARAMDESC.cs
-System.Runtime.InteropServices/PARAMFLAG.cs
 System.Runtime.InteropServices/RegistrationClassContext.cs
 System.Runtime.InteropServices/RegistrationConnectionType.cs
 System.Runtime.InteropServices/STATSTG.cs
@@ -398,10 +384,6 @@ System.Runtime.InteropServices/RegistrationServices.cs
 System.Runtime.InteropServices/SafeBuffer.cs
 System.Runtime.InteropServices/SafeHandle.cs
 System.Runtime.InteropServices/SYSKIND.cs
-System.Runtime.InteropServices/TYPEATTR.cs
-System.Runtime.InteropServices/TYPEDESC.cs
-System.Runtime.InteropServices/TYPEFLAGS.cs
-System.Runtime.InteropServices/TYPEKIND.cs
 System.Runtime.InteropServices/TYPELIBATTR.cs
 System.Runtime.InteropServices/TypeLibConverter.cs
 System.Runtime.InteropServices/TypeLibExporterFlags.cs
@@ -418,10 +400,7 @@ System.Runtime.InteropServices/UCOMIPersistFile.cs
 System.Runtime.InteropServices/UCOMIRunningObjectTable.cs
 System.Runtime.InteropServices/UCOMIStream.cs
 System.Runtime.InteropServices/UCOMITypeComp.cs
-System.Runtime.InteropServices/UCOMITypeInfo.cs
 System.Runtime.InteropServices/UCOMITypeLib.cs
-System.Runtime.InteropServices/VARDESC.cs
-System.Runtime.InteropServices/VARFLAGS.cs
 System.Runtime.InteropServices/CustomQueryInterfaceMode.cs
 System.Runtime.InteropServices/ComEventsHelper.cs
 
@@ -1233,6 +1212,7 @@ ReferenceSources/AppContextDefaultValues.cs
 ../referencesource/mscorlib/system/reflection/pointer.cs
 ../referencesource/mscorlib/system/reflection/propertyattributes.cs
 ../referencesource/mscorlib/system/reflection/reflectioncontext.cs
+../referencesource/mscorlib/system/reflection/reflectiontypeloadexception.cs
 ../referencesource/mscorlib/system/reflection/resourceattributes.cs
 ../referencesource/mscorlib/system/reflection/RuntimeReflectionExtensions.cs
 ../referencesource/mscorlib/system/reflection/targetexception.cs
@@ -1301,6 +1281,7 @@ ReferenceSources/AppContextDefaultValues.cs
 ../referencesource/mscorlib/system/runtime/interopservices/safearraytypemismatchexception.cs
 ../referencesource/mscorlib/system/runtime/interopservices/safehandle.cs
 ../referencesource/mscorlib/system/runtime/interopservices/sehexception.cs
+../referencesource/mscorlib/system/runtime/interopservices/ucomitypeinfo.cs
 ../referencesource/mscorlib/system/runtime/interopservices/ucomienumconnections.cs
 ../referencesource/mscorlib/system/runtime/interopservices/unknownwrapper.cs
 ../referencesource/mscorlib/system/runtime/interopservices/variantWrapper.cs
@@ -1658,6 +1639,7 @@ corert/ThreadPoolBoundHandle.cs
 ../../../external/corert/src/System.Private.CoreLib/shared/System/Diagnostics/Debug.cs
 
 ../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/IsReadOnlyAttribute.cs
+../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/IsByRefLikeAttribute.cs
 ../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/ITuple.cs
 ../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/RuntimeFeature.cs
 ../../../external/corert/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/TupleElementNamesAttribute.cs
@@ -1678,6 +1660,8 @@ corert/ThreadPoolBoundHandle.cs
 
 corefx/SR.cs
 
+../../../external/corefx/src/System.Collections/src/System/Collections/Generic/CollectionExtensions.cs
+
 ../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs
 ../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentDictionary.cs
 ../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/ConcurrentQueue.cs
index 04a7b62e56dc4a77dc596f41f4e8edb6b94b1ea1..2871edb13f463cd2abe387498ab4a46ca5a27fb6 100644 (file)
@@ -303,6 +303,7 @@ namespace System.Runtime.InteropServices
         VARFLAG_FIMMEDIATEBIND    =0x1000
     }
 
+#if !FULL_AOT_RUNTIME
     [Obsolete("Use System.Runtime.InteropServices.ComTypes.ITypeInfo instead. http://go.microsoft.com/fwlink/?linkid=14202", false)]
     [Guid("00020401-0000-0000-C000-000000000046")]
     [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)]
@@ -329,4 +330,5 @@ namespace System.Runtime.InteropServices
         void ReleaseFuncDesc(IntPtr pFuncDesc);
         void ReleaseVarDesc(IntPtr pVarDesc);
     }
+#endif
 }
diff --git a/mcs/errors/cs0019-72.cs b/mcs/errors/cs0019-72.cs
new file mode 100644 (file)
index 0000000..90cbae7
--- /dev/null
@@ -0,0 +1,10 @@
+// CS0019: Operator `??' cannot be applied to operands of type `void' and `throw expression'
+// Line: 20
+
+class C
+{
+       public static void Main ()
+       {
+               var s = Main () ?? throw null;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0128-3.cs b/mcs/errors/cs0128-3.cs
new file mode 100644 (file)
index 0000000..380616c
--- /dev/null
@@ -0,0 +1,16 @@
+// CS0128: A local variable named `x' is already defined in this scope
+// Line: 9
+
+class X
+{
+       public static void Main ()
+       {
+               Foo (out int x);
+               Foo (out int x);
+       }
+
+       static void Foo (out int arg)
+       {
+               arg = 2;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0128-4.cs b/mcs/errors/cs0128-4.cs
new file mode 100644 (file)
index 0000000..4a38920
--- /dev/null
@@ -0,0 +1,13 @@
+// CS0128: A local variable named `s' is already defined in this scope
+// Line: 12
+
+class C
+{
+       public static void Main ()
+       {
+               object o = null;
+
+               var x1 = o is string s;
+               var x2 = o is string s;
+       }
+}
diff --git a/mcs/errors/cs0136-20.cs b/mcs/errors/cs0136-20.cs
new file mode 100644 (file)
index 0000000..0a7e680
--- /dev/null
@@ -0,0 +1,13 @@
+// CS0136: A local variable named `s' cannot be declared in this scope because it would give a different meaning to `s', which is already used in a `parent or current' scope to denote something else
+// Line: 10
+
+internal class Program
+{
+       public static void Main ()
+       {
+               object o = null;
+               if (o is string s) {
+                       int s = 1;
+               }
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0155-5.cs b/mcs/errors/cs0155-5.cs
new file mode 100644 (file)
index 0000000..774700a
--- /dev/null
@@ -0,0 +1,7 @@
+// CS0155: The type caught or thrown must be derived from System.Exception
+// Line: 9
+
+class X
+{
+    public int Test () => throw "";
+}
diff --git a/mcs/errors/cs0162-21.cs b/mcs/errors/cs0162-21.cs
new file mode 100644 (file)
index 0000000..e8bd4b2
--- /dev/null
@@ -0,0 +1,19 @@
+// CS0162: Unreachable code detected
+// Line: 12
+// Compiler options: -warnaserror -warn:2
+
+using System;
+
+class X
+{
+    void Test ()
+    {
+        var x = true ? throw new NullReferenceException () : 1;
+        x = 2;
+        return;
+    }
+
+       static void Main () 
+       {
+       }
+}
diff --git a/mcs/errors/cs0165-56.cs b/mcs/errors/cs0165-56.cs
new file mode 100644 (file)
index 0000000..06eb6cc
--- /dev/null
@@ -0,0 +1,14 @@
+// CS0165: Use of unassigned local variable `s'
+// Line: 12
+
+class X
+{
+    static string Foo (object arg)
+    {
+        if (arg is string s) {
+
+        }
+
+        return s;
+    }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0173-6.cs b/mcs/errors/cs0173-6.cs
new file mode 100644 (file)
index 0000000..6c2dab2
--- /dev/null
@@ -0,0 +1,10 @@
+// CS0173: Type of conditional expression cannot be determined because there is no implicit conversion between `throw expression' and `throw expression'
+// Line: 8
+
+class C
+{
+       public static void Test (bool b)
+       {
+               var s = b ? throw null : throw null;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0411-25.cs b/mcs/errors/cs0411-25.cs
new file mode 100644 (file)
index 0000000..c7f92fb
--- /dev/null
@@ -0,0 +1,16 @@
+// CS0411: The type arguments for method `C.Foo<T>(System.Func<T>)' cannot be inferred from the usage. Try specifying the type arguments explicitly
+// Line: 10
+
+using System;
+
+public class C
+{
+    public static void Main ()
+    {
+        Foo (() => throw null);
+    }
+
+    static void Foo<T> (Func<T> arg)
+    {
+    }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs0815-7.cs b/mcs/errors/cs0815-7.cs
deleted file mode 100644 (file)
index af3d10f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// CS0815: An implicitly typed local variable declaration cannot be initialized with `void'
-// Line: 8
-// Compiler options: -langversion:experimental
-
-class X
-{
-       public static void Main ()
-       {
-               Foo (out var x = Main ());
-       }
-
-       static void Foo (out int i)
-       {
-               i = 0;
-       }
-}
\ No newline at end of file
index 15b3864f8220444d594db3189a336adfd6134bce..489488192a5136ed6c0e20320e4e50f8c695eb8d 100644 (file)
@@ -1,4 +1,4 @@
-// CS1061: Type `int' does not contain a definition for `GetValueOrDefault' and no extension method `GetValueOrDefault' of type `int' could be found. Are you missing an assembly reference?
+// CS1061: Type `int' does not contain a definition for `GetValueOrDefault' and no extension method `GetValueOrDefault' of type `int' could be found. Are you missing `System.Collections.Generic' using directive?
 // Line: 9
 
 class C
diff --git a/mcs/errors/cs1503-17.cs b/mcs/errors/cs1503-17.cs
deleted file mode 100644 (file)
index 07da09d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// CS1501: Argument `#1' cannot convert `ref string' expression to type `ref int'
-// Line: 8
-// Compiler options: -langversion:experimental
-
-class C
-{
-       public static void Main ()
-       {
-               Foo (ref var x = "");
-       }
-
-       static void Foo (ref int i)
-       {
-       }
-}
\ No newline at end of file
index 88f9c12deca51b8d214bd2e87c42b18b4efa6746..cfa63a7d8355e7be6928a4cfa58b370cb57d8743 100644 (file)
@@ -1,3 +1,3 @@
-// CS1617: Invalid -langversion option `ISO'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 6
+// CS1617: Invalid -langversion option `ISO'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 7
 // Line: 0
 // Compiler options: -langversion:ISO
index b756cd7b60cee7ebe1215c599ca437d97f70e439..498b627ead59742e13a96d60107a8d969673ebee 100644 (file)
@@ -1,5 +1,5 @@
-// CS1644: Feature `declaration expression' cannot be used because it is not part of the C# 5.0 language specification
-// Line: 12
+// CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 5.0 language specification
+// Line: 9
 // Compiler options: -langversion:5
 
 class C
diff --git a/mcs/errors/cs1644-51.cs b/mcs/errors/cs1644-51.cs
new file mode 100644 (file)
index 0000000..0cc6150
--- /dev/null
@@ -0,0 +1,8 @@
+// CS1644: Feature `throw expression' cannot be used because it is not part of the C# 6.0 language specification
+// Line: 5
+// Compiler options: -langversion:6
+
+static class Class
+{
+       int Prop => throw null;
+}
diff --git a/mcs/errors/cs1644-52.cs b/mcs/errors/cs1644-52.cs
new file mode 100644 (file)
index 0000000..039ad7d
--- /dev/null
@@ -0,0 +1,13 @@
+// CS1644: Feature `pattern matching' cannot be used because it is not part of the C# 6.0 language specification
+// Line: 9
+// Compiler options: -langversion:6
+
+class Class
+{
+       static void Foo (object arg)
+       {
+               if (arg is Type v) {
+                       return;
+               }
+       }       
+}
diff --git a/mcs/errors/cs8046.cs b/mcs/errors/cs8046.cs
deleted file mode 100644 (file)
index 3335e29..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// CS8046: An expression tree cannot contain a declaration expression
-// Line: 11
-// Compiler options: -langversion:experimental
-
-using System;
-using System.Linq.Expressions;
-
-class C
-{
-       static void Main()
-       {
-               Expression<Func<bool>> e = () => Out (out int x);
-       }
-
-       static bool Out (out int value)
-       {
-               value = 3;
-               return true;
-       }
-}
\ No newline at end of file
diff --git a/mcs/errors/cs8047.cs b/mcs/errors/cs8047.cs
deleted file mode 100644 (file)
index cd91a4f..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-// CS8047: Declaration expression cannot be used in this context
-// Line: 8
-// Compiler options: -langversion:experimental
-
-public class C
-{
-       public static void Main ()
-       {
-               dynamic target = 3;
-               var x = new Test (target, out var y);
-       }
-}
-
-class Test
-{
-       public Test (int x, out int y)
-       {
-               y = 0;
-       }
-}
\ No newline at end of file
diff --git a/mcs/errors/cs8116.cs b/mcs/errors/cs8116.cs
new file mode 100644 (file)
index 0000000..02fa062
--- /dev/null
@@ -0,0 +1,13 @@
+// CS8116: The nullable type `byte?' pattern matching is not allowed. Consider using underlying type `byte'
+// Line: 11
+
+using System;
+
+class C
+{
+       public static void Main ()
+       {
+               object o2 = null;
+               bool r2 = o2 is Nullable<byte> t3;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8117.cs b/mcs/errors/cs8117.cs
new file mode 100644 (file)
index 0000000..de26499
--- /dev/null
@@ -0,0 +1,10 @@
+// CS8117: Cannot use null as pattern matching operand
+// Line: 8
+
+class C
+{
+       static object Test ()
+       {
+               return null is object res;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8122.cs b/mcs/errors/cs8122.cs
new file mode 100644 (file)
index 0000000..3f31be0
--- /dev/null
@@ -0,0 +1,14 @@
+// CS8122: An expression tree cannot contain a pattern matching operator
+// Line: 12
+
+using System;
+using System.Linq.Expressions;
+
+class X
+{
+       public static void Main ()
+       {
+               object o = 1;
+               Expression<Func<bool>> e = () => o is int y;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8188.cs b/mcs/errors/cs8188.cs
new file mode 100644 (file)
index 0000000..d2f225f
--- /dev/null
@@ -0,0 +1,13 @@
+// CS8188: An expression tree cannot not contain a throw expression
+// Line: 11
+
+using System;
+using System.Linq.Expressions;
+
+class C
+{
+       public static void Main ()
+       {
+               Expression<Func<object>> l = () => throw null;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8196-2.cs b/mcs/errors/cs8196-2.cs
new file mode 100644 (file)
index 0000000..cf58de3
--- /dev/null
@@ -0,0 +1,16 @@
+// CS8196: Reference to an implicitly typed out variable `x1' is not permitted in the same argument list
+// Line: 8
+
+public class C
+{
+       public static void Main ()
+       {
+               Test (out var x1, out x1);
+       }
+
+       static void Test (out int x, out int x2)
+       {
+               x = 1;
+               x2 = 2;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8196.cs b/mcs/errors/cs8196.cs
new file mode 100644 (file)
index 0000000..cf58de3
--- /dev/null
@@ -0,0 +1,16 @@
+// CS8196: Reference to an implicitly typed out variable `x1' is not permitted in the same argument list
+// Line: 8
+
+public class C
+{
+       public static void Main ()
+       {
+               Test (out var x1, out x1);
+       }
+
+       static void Test (out int x, out int x2)
+       {
+               x = 1;
+               x2 = 2;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8197.cs b/mcs/errors/cs8197.cs
new file mode 100644 (file)
index 0000000..f8538a1
--- /dev/null
@@ -0,0 +1,19 @@
+// CS8197: Cannot infer the type of implicitly-typed out variable `y'
+// Line: 9
+
+public class C
+{
+       public static void Main ()
+       {
+               dynamic target = 3;
+               var x = new Test (target, out var y);
+       }
+}
+
+class Test
+{
+       public Test (int x, out int y)
+       {
+               y = 0;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8198.cs b/mcs/errors/cs8198.cs
new file mode 100644 (file)
index 0000000..267c57e
--- /dev/null
@@ -0,0 +1,19 @@
+// CS8198: An expression tree cannot contain out variable declaration
+// Line: 11
+
+using System;
+using System.Linq.Expressions;
+
+class C
+{
+       static void Main()
+       {
+               Expression<Func<bool>> e = () => Out (out int x);
+       }
+
+       static bool Out (out int value)
+       {
+               value = 3;
+               return true;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8200-2.cs b/mcs/errors/cs8200-2.cs
new file mode 100644 (file)
index 0000000..d5ad763
--- /dev/null
@@ -0,0 +1,13 @@
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 6
+
+public class C
+{
+       bool res = Foo (out int arg);
+
+       static bool Foo (out int arg)
+       {
+               arg = 2;
+               return false;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8200-3.cs b/mcs/errors/cs8200-3.cs
new file mode 100644 (file)
index 0000000..52c87bf
--- /dev/null
@@ -0,0 +1,13 @@
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 11
+
+public class C
+{
+       bool Prop { get; } = Foo (out int arg);
+
+       static bool Foo (out int arg)
+       {
+               arg = 2;
+               return false;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8200-4.cs b/mcs/errors/cs8200-4.cs
new file mode 100644 (file)
index 0000000..fbba19f
--- /dev/null
@@ -0,0 +1,15 @@
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 8
+
+using System;
+
+public class C
+{
+       event Action H = Foo (out var res);
+
+       static Action Foo (out int arg)
+       {
+               arg = 2;
+               return null;
+       }
+}
diff --git a/mcs/errors/cs8200-5.cs b/mcs/errors/cs8200-5.cs
new file mode 100644 (file)
index 0000000..ce4e647
--- /dev/null
@@ -0,0 +1,12 @@
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 6
+
+public class C
+{
+       bool res = Foo () is string s;
+
+       static object Foo ()
+       {
+               return null;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8200-6.cs b/mcs/errors/cs8200-6.cs
new file mode 100644 (file)
index 0000000..b93764c
--- /dev/null
@@ -0,0 +1,12 @@
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 6
+
+class X
+{
+    public static bool Test { get; } = Foo () is bool x;
+
+    static object Foo ()
+    {
+        return false;
+    }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8200.cs b/mcs/errors/cs8200.cs
new file mode 100644 (file)
index 0000000..e7565e4
--- /dev/null
@@ -0,0 +1,20 @@
+// CS8200: Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers
+// Line: 11
+
+public class C
+{
+       public C (bool value)
+       {               
+       }
+
+       public C ()
+               : this (Foo (out int arg))
+       {       
+       }
+
+       static bool Foo (out int arg)
+       {
+               arg = 2;
+               return false;
+       }
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8201.cs b/mcs/errors/cs8201.cs
new file mode 100644 (file)
index 0000000..7a11417
--- /dev/null
@@ -0,0 +1,15 @@
+// CS8201: Out variable and pattern variable declarations are not allowed within a query clause
+// Line: 11
+
+using System.Linq;
+
+class Program
+{
+       public static void Main ()
+       {
+               var a = "abcdef";
+               var res = from x in a from y in M (a, out var z) select x;
+       }
+
+       public static T M<T>(T x, out T z) => z = x;
+}
\ No newline at end of file
diff --git a/mcs/errors/cs8208.cs b/mcs/errors/cs8208.cs
new file mode 100644 (file)
index 0000000..ca6cd1d
--- /dev/null
@@ -0,0 +1,12 @@
+// CS8208: The type `dynamic' pattern matching is not allowed
+// Line: 9
+
+static class Program
+{
+       public static void Main ()
+       {
+               object o = null;            
+               if (o is dynamic res) {
+               }
+       }
+}
index d27fe806048797af33538b202c262e0e040dff4e..6cec0e1da6dc57513c0af368e3ec08a8f5ac6848 100644 (file)
@@ -1652,9 +1652,10 @@ namespace Mono.CSharp {
                        fc.TryFinally = prev_tf;
                }
 
-               public override void MarkReachable (Reachability rc)
+               public override Reachability MarkReachable (Reachability rc)
                {
                        block.MarkReachable (rc);
+                       return rc;
                }
 
                public void SetHasThisAccess ()
index a5edeb53cf68b8e77b94dcf7a5363131038c423a..702ace629c3f3e4fb23802345b31a97428eca232 100644 (file)
@@ -651,13 +651,35 @@ namespace Mono.CSharp
                //
                // Returns dynamic when at least one argument is of dynamic type
                //
-               public void Resolve (ResolveContext ec, out bool dynamic)
+               public void Resolve (ResolveContext rc, out bool dynamic)
                {
                        dynamic = false;
+
+                       List<LocalVariable> var_locals = null;
                        foreach (Argument a in args) {
-                               a.Resolve (ec);
-                               if (a.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && !a.IsByRef)
+                               a.Resolve (rc);
+
+                               if (a.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic && !a.IsByRef) {
                                        dynamic = true;
+                                       continue;
+                               }
+
+                               if (a.Type == InternalType.VarOutType) {
+                                       var de = a.Expr as DeclarationExpression;
+                                       if (de != null) {
+                                               if (var_locals == null)
+                                                       var_locals = new List<LocalVariable> ();
+
+                                               var_locals.Add (de.Variable);
+                                               continue;
+                                       }
+
+                                       var lvr = a.Expr as LocalVariableReference;
+                                       if (lvr != null && var_locals != null && var_locals.Contains (lvr.local_info)) {
+                                               rc.Report.Error (8196, lvr.Location, "Reference to an implicitly typed out variable `{0}' is not permitted in the same argument list", lvr.Name);
+                                               lvr.Type = InternalType.ErrorType;
+                                       }
+                               }
                        }
                }
 
index 7200501984e2230825ba7f8dfdaf06f3cec5fba6..43399ffc3ae105be93bdbe212052714c7f7cde95 100644 (file)
@@ -503,11 +503,9 @@ namespace Mono.CSharp {
                        }
                }
 
-               public override void MarkReachable (Reachability rc)
+               public override Reachability MarkReachable (Reachability rc)
                {
-                       var es = source as ExpressionStatement;
-                       if (es != null)
-                               es.MarkReachable (rc);
+                       return source.MarkReachable (rc);
                }
        }
 
index 39d114fd451cb516dca4d5a8e9679e07ecf6a2ff..fd6499346e88b08abfc56ff85071cc9997c83af1 100644 (file)
@@ -127,10 +127,9 @@ namespace Mono.CSharp
                        stmt.EmitStatement (ec);
                }
 
-               public override void MarkReachable (Reachability rc)
+               public override Reachability MarkReachable (Reachability rc)
                {
-                       base.MarkReachable (rc);
-                       stmt.MarkReachable (rc);
+                       return stmt.MarkReachable (rc);
                }
 
                public override object Accept (StructuralVisitor visitor)
@@ -514,11 +513,12 @@ namespace Mono.CSharp
                        ec.Emit (OpCodes.Ret);
                }
 
-               public override void MarkReachable (Reachability rc)
+               public override Reachability MarkReachable (Reachability rc)
                {
                        //
                        // Reachability has been done in AsyncInitializerStatement
                        //
+                       return rc;
                }
        }
 
index da85bf386b21c306f44105af857dec6196e43509..f19c1a400e33d6e0f676f93f4cdf15f3af415129 100644 (file)
@@ -469,27 +469,37 @@ namespace Mono.CSharp {
                                //
                                lc = left as EnumConstant;
                                rc = right as EnumConstant;
-                               if (lc != null || rc != null){
+                               if (lc != null || rc != null) {
+                                       TypeSpec res_type;
                                        if (lc == null) {
-                                               lc = rc;
-                                               lt = lc.Type;
-                                               right = left;
-                                       }
+                                               res_type = right.Type;
 
-                                       // U has to be implicitly convetible to E.base
-                                       right = right.ConvertImplicitly (lc.Child.Type);
-                                       if (right == null)
-                                               return null;
+                                               // Y has to be implicitly convertible to E.base
+                                               left = left.ConvertImplicitly (rc.Child.Type);
+                                               if (left == null)
+                                                       return null;
 
-                                       result = BinaryFold (ec, oper, lc.Child, right, loc);
+                                               right = rc.Child;
+                                       } else {
+                                               res_type = left.Type;
+
+                                               // U has to be implicitly convertible to E.base
+                                               right = right.ConvertImplicitly (lc.Child.Type);
+                                               if (right == null)
+                                                       return null;
+
+                                               left = lc.Child;
+                                       }
+
+                                       result = BinaryFold (ec, oper, left, right, loc);
                                        if (result == null)
                                                return null;
 
-                                       result = result.Reduce (ec, lt);
+                                       result = result.Reduce (ec, res_type);
                                        if (result == null)
                                                return null;
 
-                                       return new EnumConstant (result, lt);
+                                       return new EnumConstant (result, res_type);
                                }
 
                                if (left is NullLiteral && right is NullLiteral) {
index ddcb149f942a7c818e78b848558ae693882132d1..b7e773cffed98e88eb596dd77d51a3d06149de2a 100644 (file)
@@ -22,7 +22,8 @@ namespace Mono.CSharp
        {
                Normal = 0,
                Probing = 1,
-               IgnoreAccessibility = 2
+               IgnoreAccessibility = 2,
+               IgnoreStaticUsing = 1 << 10
        }
 
        //
@@ -112,6 +113,9 @@ namespace Mono.CSharp
 
                        if (rc.HasSet (ResolveContext.Options.BaseInitializer))
                                flags |= ResolveContext.Options.BaseInitializer;
+
+                       if (rc.HasSet (ResolveContext.Options.QueryClauseScope))
+                               flags |= ResolveContext.Options.QueryClauseScope;
                }
 
                public ExceptionStatement CurrentTryBlock { get; set; }
@@ -195,6 +199,8 @@ namespace Mono.CSharp
 
                        NameOfScope = 1 << 17,
 
+                       QueryClauseScope = 1 << 18,
+
                        ///
                        /// Indicates the current context is in probing mode, no errors are reported. 
                        ///
@@ -559,6 +565,11 @@ namespace Mono.CSharp
                        variable.SetAssigned (DefiniteAssignment, generatedAssignment);
                }
 
+               public void SetVariableAssigned (VariableInfo variable, DefiniteAssignmentBitSet da)
+               {
+                       variable.SetAssigned (da, false);
+               }
+
                public void SetStructFieldAssigned (VariableInfo variable, string name)
                {
                        variable.SetStructFieldAssigned (DefiniteAssignment, name);
index 36c5626bcc32dd190a10ff102953fb65f56ea8e3..3adb909e6f5afc782964f929c325165b6694813d 100644 (file)
@@ -744,6 +744,9 @@ namespace Mono.CSharp {
                        if (expr_type == target_type)
                                return true;
 
+                       if (expr_type == InternalType.ThrowExpr)
+                               return target_type.Kind != MemberKind.InternalCompilerType;
+
                        if (target_type.IsNullableType)
                                return ImplicitNulableConversion (null, expr, target_type) != null;
 
@@ -1370,7 +1373,7 @@ namespace Mono.CSharp {
                        Expression e;
 
                        if (expr_type == target_type) {
-                               if (expr_type != InternalType.NullLiteral && expr_type != InternalType.AnonymousMethod)
+                               if (expr_type != InternalType.NullLiteral && expr_type != InternalType.AnonymousMethod && expr_type != InternalType.ThrowExpr)
                                        return expr;
                                return null;
                        }
@@ -1396,6 +1399,10 @@ namespace Mono.CSharp {
                                return null;
                        }
 
+                       if (expr_type == InternalType.ThrowExpr) {
+                               return target_type.Kind == MemberKind.InternalCompilerType ? null : EmptyCast.Create (expr, target_type);
+                       }
+
                        if (target_type.IsNullableType)
                                return ImplicitNulableConversion (ec, expr, target_type);
 
index 91e6a23b1406f17bcc0ff188c1161ba949f1a98d..2df53e916640209092711ab75dee2489d0e8f64d 100644 (file)
@@ -219,7 +219,7 @@ namespace Mono.CSharp
 %token STRUCT  
 %token SWITCH  
 %token THIS    
-%token THROW   
+%token THROW
 %token TRUE    
 %token TRY     
 %token TYPEOF  
@@ -261,6 +261,7 @@ namespace Mono.CSharp
 %token WHEN
 %token INTERPOLATED_STRING
 %token INTERPOLATED_STRING_END
+%token THROW_EXPR
 
 /* C# keywords which are not really keywords */
 %token GET
@@ -917,11 +918,25 @@ named_argument
                $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, arg_mod);
                lbag.AddLocation ($$, GetLocation($2));
          }
+       | identifier_inside_body COLON OUT named_argument_expr_or_out_variable_declaration
+         {
+               if (lang_version <= LanguageVersion.V_3)
+                       FeatureIsNotAvailable (GetLocation ($1), "named argument");
+
+               var lt = (LocatedToken) $1;
+               $$ = new NamedArgument (lt.Value, lt.Location, (Expression) $4, Argument.AType.Out);
+               lbag.AddLocation ($$, GetLocation($2));
+         }
+
        ;
 
 named_argument_expr
        : expression_or_error
-//     | declaration_expression
+       ;
+
+named_argument_expr_or_out_variable_declaration
+       : expression_or_error
+       | out_variable_declaration
        ;
        
 opt_named_modifier
@@ -930,10 +945,6 @@ opt_named_modifier
          { 
                $$ = Argument.AType.Ref;
          }
-       | OUT
-         { 
-               $$ = Argument.AType.Out;
-         }
        ;
                  
 opt_class_member_declarations
@@ -2631,15 +2642,10 @@ event_declarator
                $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), null);
                lbag.AddLocation ($$, GetLocation ($1));
          }
-       | COMMA IDENTIFIER ASSIGN
-         {
-               ++lexer.parsing_block;
-         }
-         event_variable_initializer
+       | COMMA IDENTIFIER ASSIGN event_variable_initializer
          {
-               --lexer.parsing_block;
                var lt = (LocatedToken) $2;       
-               $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $5);
+               $$ = new FieldDeclarator (new SimpleMemberName (lt.Value, lt.Location), (Expression) $4);
                lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
          }
        ;
@@ -2654,11 +2660,19 @@ event_variable_initializer
                if ((current_event_field.ModFlags & Modifiers.ABSTRACT) != 0) {
                        report.Error (74, lexer.Location, "`{0}': abstract event cannot have an initializer",
                                current_event_field.GetSignatureForError ());
-               }               
+               }
+
+               ++lexer.parsing_block;
+               current_local_parameters = ParametersCompiled.EmptyReadOnlyParameters;
+               start_block (lexer.Location);
          }
          variable_initializer
          {
                $$ = $2;
+
+               --lexer.parsing_block;
+               end_block (lexer.Location);
+               current_local_parameters = null;
          }
        ;
        
@@ -3721,16 +3735,12 @@ non_simple_argument
                $$ = new Argument ((Expression) $2, Argument.AType.Ref);
                lbag.AddLocation ($$, GetLocation ($1));
          }
-       | REF declaration_expression
-         {
-               $$ = new Argument ((Expression) $2, Argument.AType.Ref);
-         }
        | OUT variable_reference 
          { 
                $$ = new Argument ((Expression) $2, Argument.AType.Out);
                lbag.AddLocation ($$, GetLocation ($1));
          }
-       | OUT declaration_expression
+       | OUT out_variable_declaration
          {
                $$ = new Argument ((Expression) $2, Argument.AType.Out);
          }
@@ -3746,46 +3756,17 @@ non_simple_argument
          }       
        ;
 
-declaration_expression
-       : OPEN_PARENS declaration_expression CLOSE_PARENS
-         {
-               $$ = new ParenthesizedExpression ((Expression) $2, GetLocation ($1));
-               lbag.AddLocation ($$, GetLocation ($1), GetLocation ($3));
-         }
-/*
-       | CHECKED open_parens_any declaration_expression CLOSE_PARENS
-         {
-               $$ = new CheckedExpr ((Expression) $3, GetLocation ($1));
-               lbag.AddLocation ($$, GetLocation ($2), GetLocation ($4));
-         }
-       | UNCHECKED open_parens_any declaration_expression CLOSE_PARENS
-         {
-               $$ = new UnCheckedExpr ((Expression) $3, GetLocation ($1));
-               lbag.AddLocation ($$, GetLocation ($2), GetLocation ($4));
-         }
-*/
-       | variable_type identifier_inside_body
+out_variable_declaration
+       : variable_type identifier_inside_body
          {
-               if (lang_version != LanguageVersion.Experimental)
-                       FeatureIsNotAvailable (GetLocation ($1), "declaration expression");
+               if (lang_version < LanguageVersion.V_7)
+                       FeatureIsNotAvailable (GetLocation ($1), "out variable declaration");
 
                var lt = (LocatedToken) $2;
                var lv = new LocalVariable (current_block, lt.Value, lt.Location);
                current_block.AddLocalName (lv);
                $$ = new DeclarationExpression ((FullNamedExpression) $1, lv);
          }
-       | variable_type identifier_inside_body ASSIGN expression
-         {
-               if (lang_version != LanguageVersion.Experimental)
-                       FeatureIsNotAvailable (GetLocation ($1), "declaration expression");
-
-               var lt = (LocatedToken) $2;
-               var lv = new LocalVariable (current_block, lt.Value, lt.Location);
-               current_block.AddLocalName (lv);
-               $$ = new DeclarationExpression ((FullNamedExpression) $1, lv) {
-                       Initializer = (Expression) $4
-               };
-         }
        ;
 
 variable_reference
@@ -4310,6 +4291,13 @@ unary_expression
                
                $$ = new Await ((Expression) $2, GetLocation ($1));
          }
+       | THROW_EXPR prefixed_unary_expression
+         {
+               if (lang_version < LanguageVersion.V_7)
+                       FeatureIsNotAvailable (lexer.Location, "throw expression");
+
+               $$ = new ThrowExpression ((Expression) $2, GetLocation ($1));
+         }
        | BANG error
          {
                Error_SyntaxError (yyToken);
@@ -4479,12 +4467,13 @@ additive_expression
          {
                var is_expr = new Is ((Expression) $1, (Expression) $3, GetLocation ($2));
                if ($4 != null) {
-                       if (lang_version != LanguageVersion.Experimental)
-                               FeatureIsNotAvailable (GetLocation ($4), "type pattern matching");
+                       if (lang_version < LanguageVersion.V_7)
+                               FeatureIsNotAvailable (GetLocation ($4), "pattern matching");
 
                        var lt = (LocatedToken) $4;
-                       is_expr.Variable = new LocalVariable (current_block, lt.Value, lt.Location);
-                       current_block.AddLocalName (is_expr.Variable);
+                       var lv = new LocalVariable (current_block, lt.Value, lt.Location);
+                       is_expr.Variable = lv;
+                       current_block.AddLocalName (lv);
                }
 
                $$ = is_expr;
@@ -4844,6 +4833,15 @@ conditional_expression
                $$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, (Expression) $5, GetLocation ($2));
                lbag.AddLocation ($$, GetLocation ($4));
          }
+       | null_coalescing_expression INTERR expression COLON THROW prefixed_unary_expression
+         {
+               if (lang_version < LanguageVersion.V_7)
+                       FeatureIsNotAvailable (lexer.Location, "throw expression");
+
+               var expr = new ThrowExpression ((Expression) $6, GetLocation ($5));
+               $$ = new Conditional (new BooleanExpression ((Expression) $1), (Expression) $3, expr, GetLocation ($2));
+               lbag.AddLocation ($$, GetLocation ($4));
+         }
        | null_coalescing_expression INTERR expression error
          {
                Error_SyntaxError (yyToken);
@@ -6366,11 +6364,16 @@ return_statement
        ;
 
 throw_statement
-       : THROW opt_expression SEMICOLON
+       : THROW expression SEMICOLON
          {
                $$ = new Throw ((Expression) $2, GetLocation ($1));
                lbag.AddStatement ($$, GetLocation ($3));
          }
+       | THROW SEMICOLON
+         {
+               $$ = new Throw (null, GetLocation ($1));
+               lbag.AddStatement ($$, GetLocation ($2));
+         }
        | THROW expression error
          {
                Error_SyntaxError (yyToken);
@@ -7703,8 +7706,7 @@ void start_block (Location loc)
        }
 }
 
-Block
-end_block (Location loc)
+Block end_block (Location loc)
 {
        Block retval = current_block.Explicit;
        retval.SetEndLocation (loc);
@@ -8081,6 +8083,7 @@ static string GetTokenName (int token)
        case Token.THIS:
                return "this";
        case Token.THROW:
+       case Token.THROW_EXPR:
                return "throw";
        case Token.TRUE:
                return "true";
index d6314ff005a3222079d9eb1eb746b258780da2f8..1be3309b1bfdd611d404408e743e0414f81f2860 100644 (file)
@@ -893,6 +893,16 @@ namespace Mono.CSharp
                                if (parsing_block == 0)
                                        res = -1;
 
+                               break;
+                       case Token.THROW:
+                               switch (current_token) {
+                               case Token.ARROW:
+                               case Token.OP_COALESCING:
+                               case Token.INTERR:
+                                       res = Token.THROW_EXPR;
+                                       break;
+                               }
+
                                break;
                        }
 
@@ -1315,7 +1325,8 @@ namespace Mono.CSharp
                        }
 
                        if (d == '.') {
-                               return Token.INTERR_OPERATOR;
+                               d = reader.Peek ();
+                               return d >= '0' && d <= '9' ? Token.INTERR : Token.INTERR_OPERATOR;
                        }
 
                        if (d != ' ') {
@@ -1345,6 +1356,7 @@ namespace Mono.CSharp
                        case Token.THIS:
                        case Token.NEW:
                        case Token.INTERPOLATED_STRING:
+                       case Token.THROW:
                                next_token = Token.INTERR;
                                break;
                                
index 09d78302854915f3eb5108a6698c2dfb8d50da1c..fd4662b2fed315fd7c7aa36aa5ec8e7803bf3f19 100644 (file)
@@ -282,7 +282,7 @@ namespace Mono.CSharp
                        foreach (var arg in arguments) {
                                if (arg.Type == InternalType.VarOutType) {
                                        // Should be special error message about dynamic dispatch
-                                       rc.Report.Error (8047, arg.Expr.Location, "Declaration expression cannot be used in this context");
+                                       rc.Report.Error (8197, arg.Expr.Location, "Cannot infer the type of implicitly-typed out variable `{0}'", ((DeclarationExpression) arg.Expr).Variable.Name);
                                }
                        }
 
index 99ba10dcb9dce06e5e15819cc5bbd6345131bc92..73e50c4068f62902fd8f04dd4062e324366dd717 100644 (file)
@@ -239,6 +239,15 @@ namespace Mono.CSharp {
                        return null;
                }
 
+               protected void CheckExpressionVariable (ResolveContext rc)
+               {
+                       if (rc.HasAny (ResolveContext.Options.BaseInitializer | ResolveContext.Options.FieldInitializerScope)) {
+                               rc.Report.Error (8200, loc, "Out variable and pattern variable declarations are not allowed within constructor initializers, field initializers, or property initializers");
+                       } else if (rc.HasSet (ResolveContext.Options.QueryClauseScope)) {
+                               rc.Report.Error (8201, loc, "Out variable and pattern variable declarations are not allowed within a query clause");
+                       }
+               }
+
                public static void ErrorIsInaccesible (IMemberContext rc, string member, Location loc)
                {
                        rc.Module.Compiler.Report.Error (122, loc, "`{0}' is inaccessible due to its protection level", member);
@@ -638,6 +647,10 @@ namespace Mono.CSharp {
                        ec.Emit (OpCodes.Pop);
                }
 
+               public virtual void EmitPrepare (EmitContext ec)
+               {
+               }
+
                //
                // Emits the expression into temporary field variable. The method
                // should be used for await expressions only
@@ -995,6 +1008,11 @@ namespace Mono.CSharp {
                {
                }
 
+               public virtual Reachability MarkReachable (Reachability rc)
+               {
+                       return rc;
+               }
+
                //
                // Special version of flow analysis for expressions which can return different
                // on-true and on-false result. Used by &&, ||, ?: expressions
@@ -1295,10 +1313,6 @@ namespace Mono.CSharp {
        /// </summary>
        public abstract class ExpressionStatement : Expression
        {
-               public virtual void MarkReachable (Reachability rc)
-               {
-               }
-
                public virtual ExpressionStatement ResolveStatement (BlockContext ec)
                {
                        Expression e = Resolve (ec);
@@ -1460,6 +1474,11 @@ namespace Mono.CSharp {
 #endif
                }
 
+               public override Reachability MarkReachable (Reachability rc)
+               {
+                       return child.MarkReachable (rc);
+               }
+
                protected override void CloneTo (CloneContext clonectx, Expression t)
                {
                        // Nothing to clone
@@ -2408,6 +2427,11 @@ namespace Mono.CSharp {
                {
                        return orig_expr.MakeExpression (ctx);
                }
+
+               public override Reachability MarkReachable (Reachability rc)
+               {
+                       return expr.MarkReachable (rc);
+               }
        }
 
        //
@@ -2762,9 +2786,13 @@ namespace Mono.CSharp {
                        return null;
                }
 
-               public bool IsPossibleTypeOrNamespace (IMemberContext mc)
+               bool IsPossibleTypeOrNamespace (IMemberContext mc)
                {
-                       return mc.LookupNamespaceOrType (Name, Arity, LookupMode.Probing, loc) != null;
+                       //
+                       // Has to ignore static usings because we are looking for any member not just type
+                       // in this context
+                       //
+                       return mc.LookupNamespaceOrType (Name, Arity, LookupMode.Probing | LookupMode.IgnoreStaticUsing, loc) != null;
                }
 
                public bool IsPossibleType (IMemberContext mc)
@@ -2886,6 +2914,15 @@ namespace Mono.CSharp {
                                        return me;
                                }
 
+                               //
+                               // Stage 3: Lookup nested types, namespaces and type parameters in the context
+                               //
+                               if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
+                                       if (IsPossibleTypeOrNamespace (rc)) {
+                                               return ResolveAsTypeOrNamespace (rc, false);
+                                       }
+                               }
+
                                var expr = NamespaceContainer.LookupStaticUsings (rc, Name, Arity, loc);
                                if (expr != null) {
                                        if (Arity > 0) {
@@ -2898,15 +2935,6 @@ namespace Mono.CSharp {
                                        return expr;
                                }
 
-                               //
-                               // Stage 3: Lookup nested types, namespaces and type parameters in the context
-                               //
-                               if ((restrictions & MemberLookupRestrictions.InvocableOnly) == 0 && !variable_found) {
-                                       if (IsPossibleTypeOrNamespace (rc)) {
-                                               return ResolveAsTypeOrNamespace (rc, false);
-                                       }
-                               }
-
                                if ((restrictions & MemberLookupRestrictions.NameOfExcluded) == 0 && Name == "nameof")
                                        return new NameOf (this);
 
index 9042dcdabad8e5405cbbbc086953ade32d7dfc81..da37657867ed0e59f43a1d9eefdd010e977e9ae8 100644 (file)
@@ -1490,6 +1490,11 @@ namespace Mono.CSharp
                        expr.EmitSideEffect (ec);
                }
 
+               public override void EmitPrepare (EmitContext ec)
+               {
+                       expr.EmitPrepare (ec);
+               }
+
                public override void FlowAnalysis (FlowAnalysisContext fc)
                {
                        expr.FlowAnalysis (fc);
@@ -1535,7 +1540,7 @@ namespace Mono.CSharp
                public override Expression CreateExpressionTree (ResolveContext ec)
                {
                        if (Variable != null)
-                               throw new NotSupportedException ();
+                               ec.Report.Error (8122, loc, "An expression tree cannot contain a pattern matching operator");
 
                        Arguments args = Arguments.CreateForExpressionTree (ec, null,
                                expr.CreateExpressionTree (ec),
@@ -1590,6 +1595,14 @@ namespace Mono.CSharp
                        ec.Emit (on_true ? OpCodes.Brtrue : OpCodes.Brfalse, target);
                }
 
+               public override void EmitPrepare (EmitContext ec)
+               {
+                       base.EmitPrepare (ec);
+
+                       if (Variable != null)
+                               Variable.CreateBuilder (ec);
+               }
+
                void EmitPatternMatch (EmitContext ec)
                {
                        var no_match = ec.DefineLabel ();
@@ -1695,7 +1708,13 @@ namespace Mono.CSharp
                                        value_on_stack = false;
                                }
 
-                               Variable.CreateBuilder (ec);
+                               //
+                               // It's ok to have variable builder create out of order. It simplified emit
+                               // of statements like while (condition) { }
+                               //
+                               if (!Variable.Created)
+                                       Variable.CreateBuilder (ec);
+                               
                                Variable.EmitAssign (ec);
 
                                if (expr_unwrap != null) {
@@ -1739,6 +1758,21 @@ namespace Mono.CSharp
                                fc.SetVariableAssigned (Variable.VariableInfo, true);
                }
 
+               public override void FlowAnalysisConditional (FlowAnalysisContext fc)
+               {
+                       if (Variable == null) {
+                               base.FlowAnalysisConditional (fc);
+                               return;
+                       }
+
+                       expr.FlowAnalysis (fc);
+
+                       fc.DefiniteAssignmentOnTrue = fc.BranchDefiniteAssignment ();
+                       fc.DefiniteAssignmentOnFalse = fc.DefiniteAssignment;
+
+                       fc.SetVariableAssigned (Variable.VariableInfo, fc.DefiniteAssignmentOnTrue);
+               }
+
                protected override void ResolveProbeType (ResolveContext rc)
                {
                        if (!(ProbeType is TypeExpr) && rc.Module.Compiler.Settings.Version == LanguageVersion.Experimental) {
@@ -1849,6 +1883,15 @@ namespace Mono.CSharp
 
                Expression ResolveResultExpression (ResolveContext ec)
                {
+                       if (Variable != null) {
+                               if (expr is NullLiteral) {
+                                       ec.Report.Error (8117, loc, "Cannot use null as pattern matching operand");
+                                       return this;
+                               }
+
+                               CheckExpressionVariable (ec);
+                       }
+
                        TypeSpec d = expr.Type;
                        bool d_is_nullable = false;
 
@@ -1856,7 +1899,7 @@ namespace Mono.CSharp
                        // If E is a method group or the null literal, or if the type of E is a reference
                        // type or a nullable type and the value of E is null, the result is false
                        //
-                       if (expr.IsNull || expr.eclass == ExprClass.MethodGroup)
+                       if (expr.IsNull)
                                return CreateConstantResult (ec, false);
 
                        if (d.IsNullableType) {
@@ -1870,6 +1913,11 @@ namespace Mono.CSharp
                        TypeSpec t = probe_type_expr;
                        bool t_is_nullable = false;
                        if (t.IsNullableType) {
+                               if (Variable != null) {
+                                       ec.Report.Error (8116, loc, "The nullable type `{0}' pattern matching is not allowed. Consider using underlying type `{1}'",
+                                                                        t.GetSignatureForError (), Nullable.NullableInfo.GetUnderlyingType (t).GetSignatureForError ());
+                               }
+
                                var ut = Nullable.NullableInfo.GetUnderlyingType (t);
                                if (!ut.IsGenericParameter) {
                                        t = ut;
@@ -1914,9 +1962,13 @@ namespace Mono.CSharp
                                        return ResolveGenericParameter (ec, d, tps);
 
                                if (t.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
-                                       ec.Report.Warning (1981, 3, loc,
-                                               "Using `{0}' to test compatibility with `{1}' is identical to testing compatibility with `object'",
-                                               OperatorName, t.GetSignatureForError ());
+                                       if (Variable != null) {
+                                               ec.Report.Error (8208, loc, "The type `{0}' pattern matching is not allowed", t.GetSignatureForError ());
+                                       } else {
+                                               ec.Report.Warning (1981, 3, loc,
+                                                       "Using `{0}' to test compatibility with `{1}' is identical to testing compatibility with `object'",
+                                                       OperatorName, t.GetSignatureForError ());
+                                       }
                                }
 
                                if (TypeManager.IsGenericParameter (d))
@@ -2562,12 +2614,14 @@ namespace Mono.CSharp
 
                public override Expression CreateExpressionTree (ResolveContext rc)
                {
-                       rc.Report.Error (8046, loc, "An expression tree cannot contain a declaration expression");
+                       rc.Report.Error (8198, loc, "An expression tree cannot contain out variable declaration");
                        return null;
                }
 
                bool DoResolveCommon (ResolveContext rc)
                {
+                       CheckExpressionVariable (rc);
+
                        var var_expr = VariableType as VarExpr;
                        if (var_expr != null) {
                                type = InternalType.VarOutType;
@@ -12735,4 +12789,68 @@ namespace Mono.CSharp
                        return value;
                }
        }
+
+       class ThrowExpression : ExpressionStatement
+       {
+               Expression expr;
+
+               public ThrowExpression (Expression expr, Location loc)
+               {
+                       this.expr = expr;
+                       this.loc = loc;
+               }
+
+               protected override void CloneTo (CloneContext clonectx, Expression t)
+               {
+                       var target = (ThrowExpression)t;
+                       target.expr = expr.Clone (clonectx);
+               }
+
+               public override bool ContainsEmitWithAwait ()
+               {
+                       return expr.ContainsEmitWithAwait ();
+               }
+
+               public override Expression CreateExpressionTree (ResolveContext rc)
+               {
+                       rc.Report.Error (8188, loc, "An expression tree cannot not contain a throw expression");
+                       return expr;
+               }
+
+               protected override Expression DoResolve (ResolveContext rc)
+               {
+                       expr = expr.Resolve (rc, ResolveFlags.Type | ResolveFlags.VariableOrValue);
+
+                       if (expr == null)
+                               return null;
+
+                       expr = Throw.ConvertType (rc, expr);
+
+                       eclass = ExprClass.Value;
+                       type = InternalType.ThrowExpr;
+                       return this;
+               }
+
+               public override void Emit (EmitContext ec)
+               {
+                       EmitStatement (ec);
+               }
+
+               public override void EmitStatement (EmitContext ec)
+               {
+                       expr.Emit (ec);
+
+                       ec.Emit (OpCodes.Throw);
+               }
+
+               public override void FlowAnalysis (FlowAnalysisContext fc)
+               {
+                       expr.FlowAnalysis (fc);
+               }
+
+               public override Reachability MarkReachable (Reachability rc)
+               {
+                       return Reachability.CreateUnreachable ();
+               }
+       }
 }
index 8ddef4f36947b630ee655efd11adbe80fa385b5c..6b35de9846c6ba3d0be116b321af98c721297926 100644 (file)
@@ -3091,7 +3091,8 @@ namespace Mono.CSharp {
                        // Some types cannot be used as type arguments
                        //
                        if ((bound.Type.Kind == MemberKind.Void && !voidAllowed) || bound.Type.IsPointer || bound.Type.IsSpecialRuntimeType ||
-                               bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType)
+                           bound.Type == InternalType.MethodGroup || bound.Type == InternalType.AnonymousMethod || bound.Type == InternalType.VarOutType ||
+                           bound.Type == InternalType.ThrowExpr)
                                return;
 
                        var a = bounds [index];
index 40c500d365ef131b253ca9fa3ae78b7c10b47a68..68f4b6ff30bfabd31d6a2597e5a18a06d002550f 100644 (file)
@@ -79,10 +79,11 @@ namespace Mono.CSharp.Linq
                        {
                        }
 
-                       protected override MethodGroupExpr DoResolveOverload (ResolveContext ec)
+                       protected override MethodGroupExpr DoResolveOverload (ResolveContext rc)
                        {
-                               MethodGroupExpr rmg = mg.OverloadResolve (ec, ref arguments, this, OverloadResolver.Restrictions.None);
-                               return rmg;
+                               using (rc.Set (ResolveContext.Options.QueryClauseScope)) {
+                                       return mg.OverloadResolve (rc, ref arguments, this, OverloadResolver.Restrictions.None);
+                               }
                        }
 
                        protected override Expression DoResolveDynamic (ResolveContext ec, Expression memberExpr)
index 5384ee1368607a30ea61290b5f19610aa15349e0..3314ca2d48c24d8341e6c44faf7523343d0fc182 100644 (file)
@@ -1157,7 +1157,7 @@ namespace Mono.CSharp {
                                        match = texpr_fne;
                        }
 
-                       if (types_using_table != null) {
+                       if (types_using_table != null && (mode & LookupMode.IgnoreStaticUsing) == 0) {
                                foreach (var using_type in types_using_table) {
                                        var type = MemberCache.FindNestedType (using_type, name, arity, true);
                                        if (type == null)
index 754c888e8b1158711b9f4200666e7a22e6ff273f..a679bdbf60c737334209c239a97dcb6f416adbc3 100644 (file)
@@ -1234,6 +1234,11 @@ namespace Mono.CSharp.Nullable
                                        type = ltype;
                                        return this;
                                }
+                       } else if (ltype == InternalType.ThrowExpr) {
+                               //
+                               // LAMESPEC: I am not really sure what's point of allowing throw on left side
+                               //
+                               return ReducedExpression.Create (right, this, false).Resolve (ec);
                        } else {
                                return null;
                        }
index afa4f75bd84865f72666678e53685c0c31df5462..f73bed2b0b0d6b342ceb69dcc362bc54e06adf8e 100644 (file)
@@ -104,6 +104,9 @@ namespace Mono.CSharp {
                        case LanguageVersion.V_6:
                                version = "6.0";
                                break;
+                       case LanguageVersion.V_7:
+                               version = "7.0";
+                               break;
                        default:
                                throw new InternalErrorException ("Invalid feature version", compiler.Settings.Version);
                        }
index a823cd25ea37f0d29feb36d9e3a8de142202f2ab..f3a7bb79b07a9c0edff9f97614d4b57f4b039f45 100644 (file)
@@ -29,9 +29,10 @@ namespace Mono.CSharp {
                V_4 = 4,
                V_5 = 5,
                V_6 = 6,
+               V_7 = 7,
                Experimental = 100,
 
-               Default = LanguageVersion.V_6,
+               Default = V_7,
        }
 
        public enum RuntimeVersion
@@ -1163,15 +1164,15 @@ namespace Mono.CSharp {
                                case "6":
                                        settings.Version = LanguageVersion.V_6;
                                        return ParseResult.Success;
+                               case "7":
+                                       settings.Version = LanguageVersion.V_7;
+                                       return ParseResult.Success;
                                case "experimental":
                                        settings.Version = LanguageVersion.Experimental;
                                        return ParseResult.Success;
-                               case "future":
-                                       report.Warning (8000, 1, "Language version `future' is no longer supported");
-                                       goto case "6";
                                }
 
-                               report.Error (1617, "Invalid -langversion option `{0}'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 6", value);
+                               report.Error (1617, "Invalid -langversion option `{0}'. It must be `ISO-1', `ISO-2', Default or value in range 1 to 7", value);
                                return ParseResult.Error;
 
                        case "/codepage":
index d500eea093d32debf0b5c50349e69d810d8ccd0d..dd7f737139ea372f64af929377608936fd582120 100644 (file)
@@ -558,6 +558,8 @@ namespace Mono.CSharp {
                                ec.Emit (OpCodes.Br, ec.LoopBegin);
                                ec.MarkLabel (while_loop);
 
+                               expr.EmitPrepare (ec);
+
                                Statement.Emit (ec);
                        
                                ec.MarkLabel (ec.LoopBegin);
@@ -1114,6 +1116,7 @@ namespace Mono.CSharp {
        public class Return : ExitStatement
        {
                Expression expr;
+               bool expr_returns;
 
                public Return (Expression expr, Location l)
                {
@@ -1339,7 +1342,9 @@ namespace Mono.CSharp {
                        if (expr != null)
                                expr.FlowAnalysis (fc);
 
-                       base.DoFlowAnalysis (fc);
+                       if (!expr_returns)
+                               base.DoFlowAnalysis (fc);
+                       
                        return true;
                }
 
@@ -1352,6 +1357,12 @@ namespace Mono.CSharp {
                public override Reachability MarkReachable (Reachability rc)
                {
                        base.MarkReachable (rc);
+
+                       if (Expr != null) {
+                               rc = Expr.MarkReachable (rc);
+                               expr_returns = rc.IsUnreachable;
+                       }
+
                        return Reachability.CreateUnreachable ();
                }
 
@@ -1767,6 +1778,19 @@ namespace Mono.CSharp {
                        }
                }
 
+               public static Expression ConvertType (ResolveContext rc, Expression expr)
+               {
+                       var et = rc.BuiltinTypes.Exception;
+                       if (Convert.ImplicitConversionExists (rc, expr, et))
+                               expr = Convert.ImplicitConversion (rc, expr, et, expr.Location);
+                       else {
+                               rc.Report.Error (155, expr.Location, "The type caught or thrown must be derived from System.Exception");
+                               expr = EmptyCast.Create (expr, et);
+                       }
+
+                       return expr;
+               }
+
                public override bool Resolve (BlockContext ec)
                {
                        if (expr == null) {
@@ -1790,11 +1814,7 @@ namespace Mono.CSharp {
                        if (expr == null)
                                return false;
 
-                       var et = ec.BuiltinTypes.Exception;
-                       if (Convert.ImplicitConversionExists (ec, expr, et))
-                               expr = Convert.ImplicitConversion (ec, expr, et, loc);
-                       else
-                               ec.Report.Error (155, expr.Location, "The type caught or thrown must be derived from System.Exception");
+                       expr = ConvertType (ec, expr);
 
                        return true;
                }
@@ -2251,11 +2271,8 @@ namespace Mono.CSharp {
 
                public override Reachability MarkReachable (Reachability rc)
                {
-                       var init = initializer as ExpressionStatement;
-                       if (init != null)
-                               init.MarkReachable (rc);
-
-                       return base.MarkReachable (rc);
+                       base.MarkReachable (rc);
+                       return initializer == null ? rc : initializer.MarkReachable (rc);
                }
 
                protected override void CloneTo (CloneContext clonectx, Statement target)
@@ -2418,6 +2435,12 @@ namespace Mono.CSharp {
                        }
                }
 
+               public bool Created {
+                       get {
+                               return builder != null;
+                       }
+               }
+
                public bool IsDeclared {
                        get {
                                return type != null;
index 696bde556c820ad00f9d206bac897e80c10ee470..53402940dc2dda5959bc5d925cefe29d0701d40c 100644 (file)
@@ -1432,6 +1432,7 @@ namespace Mono.CSharp
                public static readonly InternalType Namespace = new InternalType ("<namespace>");
                public static readonly InternalType ErrorType = new InternalType ("<error>");
                public static readonly InternalType VarOutType = new InternalType ("var out");
+               public static readonly InternalType ThrowExpr = new InternalType ("throw expression");
 
                readonly string name;
 
index d8fee033830cf1a65ea14b44a462ef8c0dc6eb77..8db59d7e48d63650f38af54129943c59971b9e47 100644 (file)
@@ -170,6 +170,11 @@ public class ConditionalParsing
                var t = (Int32)sbyte.MaxValue;
        }
 
+       void Test_22 (bool args)
+       {
+               var x = args ?.2f : -.2f;
+       }
+
        static void Helper<T> (T arg)
        {
        }
index 51d0b2086fda73f48a672f0c03f5224f8d26104f..eac11ac15f91607127af3ecdd47cab1e7ce9215f 100644 (file)
@@ -5,3 +5,4 @@
 # csXXXX.cs IGNORE     : adds test to ignore list
 
 gtest-230.cs
+test-pattern-02.cs
diff --git a/mcs/tests/test-946.cs b/mcs/tests/test-946.cs
new file mode 100644 (file)
index 0000000..8841f1b
--- /dev/null
@@ -0,0 +1,19 @@
+using System;
+
+class X
+{
+       public static void Main ()
+       {
+
+       }
+
+       int ImportScope (int scope)
+       {
+               switch (scope) {
+               case 200:
+                       throw new NotImplementedException ();
+               }
+
+               throw new NotSupportedException ();
+       }       
+}
\ No newline at end of file
index 2f2b7ab2c9ecf6efbb09b6de7a858a561f65258f..036850e34bbd396b89818a143a148ddff87b2ffd 100644 (file)
@@ -41,6 +41,10 @@ class X {
                        return 3;
                if (Test.A == Test.B)
                        return 4;
+
+               const A e2 = 3 - A.b;
+               if (e2 != A.a)
+                       return 5;
                
                return 0;
        }
index 9078ff7caaa4814263d2c234eba8ba3ec388bb1a..880d3344585a87c342b090cb2fef7e07f4497fd4 100644 (file)
@@ -1,4 +1,3 @@
-// Compiler options: -langversion:experimental
 using System;
 
 class DeclarationExpression
@@ -14,29 +13,13 @@ class DeclarationExpression
                                return 2;
                }
 
-               Out (out int o2 = 2);
-               if (o2 != 3)
-                       return 3;
-
                Out (out var o3);
                if (o3 != 3)
                        return 4;
 
-               Ref (ref int r = 2);
-               if (r != 7)
-                       return 5;
-
-               Ref (ref ((var r2 = 3)));
-               if (r2 != 8)
-                       return 6;
-
-//             Out2 (str: "b", v: out var o5);
-//             if (o5 != 9)
-//                     return 7;
-
-               Out3 (out var o6 = 9m);
-               if (o6.GetType () != typeof (decimal))
-                       return 8;
+               Out2 (str: "b", v: out var o5);
+               if (o5 != 9)
+                       return 7;
 
                Console.WriteLine ("ok");
                return 0;
@@ -53,14 +36,4 @@ class DeclarationExpression
                v = 9;
                return true;
        }
-
-       static void Out3<T> (out T t)
-       {
-               t = default (T);
-       }
-
-       static void Ref (ref int arg)
-       {
-               arg += 5;
-       }
 }
\ No newline at end of file
index 1c2ce76072838cb2c7adef53527300ca28707907..1d1c355e1a7046dbca07d194c785d44598cb3918 100644 (file)
@@ -1,27 +1,11 @@
-// Compiler options: -langversion:experimental
+using System;
 
-using static System.Console;
-
-public class DeclarationExpressions
+public class C
 {
-       public static void Main()
-       {
-               // TODO:
-               //Test (int value = 5);
-               //WriteLine (value);
-       }
-
-       void M2 ()
+       public static void Main ()
        {
-//             for (int i = 0; int v = 2; ++i) {
-
-//             }
-
        }
 
-       static int Test (int x)
-       {
-               WriteLine (x);
-               return x;
-       }
+       bool Test1 => int.TryParse ("1", out int x);
+       int Test2 => int.TryParse ("2", out int x) ? x : 0;
 }
\ No newline at end of file
diff --git a/mcs/tests/test-decl-expr-03.cs b/mcs/tests/test-decl-expr-03.cs
new file mode 100644 (file)
index 0000000..bc0f01c
--- /dev/null
@@ -0,0 +1,15 @@
+using System;
+using System.Linq;
+
+public class C
+{
+       public static void Main ()
+       {
+               var a = "abcdef";
+
+               var t1 = from x in Foo (a, out var q1) select x;
+               var t2 = from x in a join y in Foo (a, out var q2) on x equals y select x;
+       }
+
+       public static T Foo<T> (T x, out T z) => z = x;
+}
\ No newline at end of file
diff --git a/mcs/tests/test-decl-expr-04.cs b/mcs/tests/test-decl-expr-04.cs
new file mode 100644 (file)
index 0000000..f30c4fe
--- /dev/null
@@ -0,0 +1,18 @@
+public class C
+{
+       public static void Main ()
+       {
+               Test2 (Test (out var x1), x1);
+       }
+
+       static int Test (out int x)
+       {
+               x = 1;
+               return 2;
+       }
+
+       static int Test2 (int x, int y)
+       {
+               return 2;
+       }
+}
\ No newline at end of file
index 6db67fb16726fcc16c64a92e004451554f8ff008..84517a6a57431956468f3a253352f44a53de5e93 100644 (file)
@@ -1,5 +1,3 @@
-// Compiler options: -langversion:experimental
-
 using System;
 
 class TypePattern
@@ -8,31 +6,14 @@ class TypePattern
        {
                object o = 3;
                bool r = o is System.String t1;
-               if (t1 != null)
-                       return 1;
-
                if (r)
                        return 2;
 
                if (o is string t2)
                        return 3;
 
-               if (t2 != null)
-                       return 4;
-
-               object o2 = (int?) 4;
-               bool r2 = o2 is byte? t3;
-
-               if (t3 != null)
-                       return 5;
-
-               if (r2)
-                       return 6;
-
                long? l = 5;
                bool r3 = l is long t4;
-               if (t4 != 5)
-                       return 7;
 
                if (!r3)
                        return 8;
@@ -40,4 +21,22 @@ class TypePattern
                Console.WriteLine ("ok");
                return 0;
        }
+
+       static void Test1 (object arg)
+       {
+               while (arg is int b) {
+                       b = 2;
+               }
+       }
+
+       static string Test2 (object arg)
+       {
+               if (arg is string s) {
+                       return s;
+               } else {
+                       s = "";
+               }
+               
+               return s;
+       }
 }
\ No newline at end of file
index 695775ec17939daa00e130e0fa5aeced6da913d1..2858457b2dfffaa352829ba7594b962d4f15fb5f 100644 (file)
@@ -48,14 +48,14 @@ class ConstantPattern
 
                object o4 = (byte?)255;
                var ggg = o4 is 255;
-               if (!ggg)
+               if (ggg)
                        return 8;
 
                if (o4 is null)
                        return 9;
 
                object o5 = (double)-255;
-               if (!(o5 is -byte.MaxValue))
+               if (o5 is -byte.MaxValue)
                        return 10;
 
                object o6 = MyEnum.V_4;
diff --git a/mcs/tests/test-static-using-13.cs b/mcs/tests/test-static-using-13.cs
new file mode 100644 (file)
index 0000000..6760539
--- /dev/null
@@ -0,0 +1,21 @@
+using System;
+using static TestClass;
+
+internal class Program
+{
+       public static void Main (string[] args)
+       {
+               var res = Directions.Up;
+       }
+}
+
+public enum Directions
+{
+       Up,
+       NotUp,
+}
+
+public static class TestClass
+{
+       public static int Directions;
+}
diff --git a/mcs/tests/test-throw-expr-01.cs b/mcs/tests/test-throw-expr-01.cs
new file mode 100644 (file)
index 0000000..e17fa42
--- /dev/null
@@ -0,0 +1,61 @@
+using System;
+
+class X
+{
+       public static void Main ()
+       {
+               Func<object> f = () => throw null;
+       }
+
+       public int Test () => throw null;
+
+       object Foo ()
+       {
+               return null;
+       }
+
+       public object Test2 () => Foo () ?? throw null;
+
+       static void Test3 (out int z) => throw null;
+
+       int this [int x] {
+               get => throw null;
+       }    
+
+       public event Action Event {
+               add => throw null; 
+               remove => throw null;
+       }
+
+       void TestExpr_1 (bool b)
+       {
+               int x = b ? throw new NullReferenceException () : 1;        
+       }
+
+       void TestExpr_2 (bool b)
+       {
+               int x = b ? 2 : throw new NullReferenceException ();
+       }
+
+       void TestExpr_3 (string s)
+       {
+               s = s ?? throw new NullReferenceException ();
+       }
+
+       void TestExpr_4 ()
+       {
+               throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
+       }
+
+       void TestExpr_5 ()
+       {
+               Action a = () => throw new ApplicationException () ?? throw new NullReferenceException() ?? throw null;
+       }
+
+       static int TestExpr_6 (out int z) => throw null;
+
+       int TestExpr_7 (out int z)
+       {
+               return true ? throw new NullReferenceException () : 1;
+       }
+}
\ No newline at end of file
diff --git a/mcs/tests/test-throw-expr-02.cs b/mcs/tests/test-throw-expr-02.cs
new file mode 100644 (file)
index 0000000..515d687
--- /dev/null
@@ -0,0 +1,22 @@
+using System;
+
+class Program
+{
+    public static int Main ()
+    {
+        Console.WriteLine (M (1));
+        try {
+            Console.WriteLine (M (null));
+        } catch (Exception) {
+            Console.WriteLine ("thrown");
+            return 0;
+        }
+
+        return 1;
+    }
+
+    static string M (object data)
+    {
+        return data?.ToString () ?? throw null;
+    }
+}
\ No newline at end of file
index ba198950ecb0d34e6f3ae94feaf94a94fdd5f11a..5b1f686ddd765817d716aebf3bdc031df02dba1f 100644 (file)
       <method name="Void Test_21()" attrs="129">
         <size>5</size>
       </method>
+      <method name="Void Test_22(Boolean)" attrs="129">
+        <size>24</size>
+      </method>
     </type>
   </test>
   <test name="gtest-410.cs">
       </method>
     </type>
   </test>
+  <test name="test-946.cs">
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>2</size>
+      </method>
+      <method name="Int32 ImportScope(Int32)" attrs="129">
+        <size>29</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-95.cs">
     <type name="X">
       <method name="Int32 Main()" attrs="150">
   <test name="test-decl-expr-01.cs">
     <type name="DeclarationExpression">
       <method name="Int32 Main()" attrs="150">
-        <size>223</size>
+        <size>121</size>
       </method>
       <method name="Boolean Out(Int32 ByRef)" attrs="145">
         <size>13</size>
       <method name="Boolean Out2(Int32 ByRef, System.String)" attrs="145">
         <size>14</size>
       </method>
-      <method name="Void Out3[T](T ByRef)" attrs="145">
-        <size>17</size>
-      </method>
-      <method name="Void Ref(Int32 ByRef)" attrs="145">
-        <size>8</size>
-      </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
     </type>
   </test>
   <test name="test-decl-expr-02.cs">
-    <type name="DeclarationExpressions">
+    <type name="C">
       <method name="Void Main()" attrs="150">
         <size>2</size>
       </method>
-      <method name="Void M2()" attrs="129">
-        <size>2</size>
+      <method name="Boolean get_Test1()" attrs="2177">
+        <size>20</size>
       </method>
-      <method name="Int32 Test(Int32)" attrs="145">
+      <method name="Int32 get_Test2()" attrs="2177">
+        <size>32</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-decl-expr-03.cs">
+    <type name="C">
+      <method name="Void Main()" attrs="150">
+        <size>153</size>
+      </method>
+      <method name="T Foo[T](T, T ByRef)" attrs="150">
+        <size>18</size>
+      </method>
+      <method name="Char &lt;Main&gt;m__0(Char)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Char &lt;Main&gt;m__1(Char)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Char &lt;Main&gt;m__2(Char)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Char &lt;Main&gt;m__3(Char, Char)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-decl-expr-04.cs">
+    <type name="C">
+      <method name="Void Main()" attrs="150">
         <size>16</size>
       </method>
+      <method name="Int32 Test(Int32 ByRef)" attrs="145">
+        <size>13</size>
+      </method>
+      <method name="Int32 Test2(Int32, Int32)" attrs="145">
+        <size>10</size>
+      </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
   <test name="test-pattern-01.cs">
     <type name="TypePattern">
       <method name="Int32 Main()" attrs="150">
-        <size>227</size>
-      </method>
-      <method name="Void .ctor()" attrs="6278">
-        <size>7</size>
-      </method>
-    </type>
-  </test>
-  <test name="test-pattern-02.cs">
-    <type name="ConstantPattern">
-      <method name="Int32 Main()" attrs="150">
-        <size>609</size>
+        <size>118</size>
       </method>
       <method name="Void .ctor()" attrs="6278">
         <size>7</size>
       </method>
-    </type>
-    <type name="&lt;PatternMatchingHelper&gt;">
-      <method name="Boolean NumberMatcher(System.Object, System.Object, Boolean)" attrs="150">
-        <size>69</size>
+      <method name="Void Test1(System.Object)" attrs="145">
+        <size>24</size>
       </method>
-    </type>
-    <type name="ConstantPattern">
-      <method name="Boolean Generic[T](T)" attrs="145">
-        <size>28</size>
+      <method name="System.String Test2(System.Object)" attrs="145">
+        <size>39</size>
       </method>
     </type>
   </test>
       </method>
     </type>
   </test>
+  <test name="test-static-using-13.cs">
+    <type name="Program">
+      <method name="Void Main(System.String[])" attrs="150">
+        <size>4</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-throw-expr-01.cs">
+    <type name="X">
+      <method name="Void Main()" attrs="150">
+        <size>32</size>
+      </method>
+      <method name="Int32 Test()" attrs="134">
+        <size>10</size>
+      </method>
+      <method name="System.Object Foo()" attrs="129">
+        <size>10</size>
+      </method>
+      <method name="System.Object Test2()" attrs="134">
+        <size>23</size>
+      </method>
+      <method name="Void Test3(Int32 ByRef)" attrs="145">
+        <size>3</size>
+      </method>
+      <method name="Int32 get_Item(Int32)" attrs="2177">
+        <size>10</size>
+      </method>
+      <method name="Void add_Event(System.Action)" attrs="2182">
+        <size>3</size>
+      </method>
+      <method name="Void remove_Event(System.Action)" attrs="2182">
+        <size>3</size>
+      </method>
+      <method name="Void TestExpr_1(Boolean)" attrs="129">
+        <size>21</size>
+      </method>
+      <method name="Void TestExpr_2(Boolean)" attrs="129">
+        <size>21</size>
+      </method>
+      <method name="Void TestExpr_3(System.String)" attrs="129">
+        <size>18</size>
+      </method>
+      <method name="Void TestExpr_4()" attrs="129">
+        <size>16</size>
+      </method>
+      <method name="Void TestExpr_5()" attrs="129">
+        <size>32</size>
+      </method>
+      <method name="System.Object &lt;Main&gt;m__0()" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Void &lt;TestExpr_5&gt;m__1()" attrs="145">
+        <size>3</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+      <method name="Int32 TestExpr_6(Int32 ByRef)" attrs="145">
+        <size>10</size>
+      </method>
+      <method name="Int32 TestExpr_7(Int32 ByRef)" attrs="129">
+        <size>15</size>
+      </method>
+    </type>
+  </test>
+  <test name="test-throw-expr-02.cs">
+    <type name="Program">
+      <method name="Int32 Main()" attrs="150">
+        <size>63</size>
+      </method>
+      <method name="System.String M(System.Object)" attrs="145">
+        <size>33</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-var-01.cs">
     <type name="Test">
       <method name="Int32 Main()" attrs="150">
index ab13accc034c54695fba45e8b4deecf3854a0f30..4febb86c32014b1ea38858496f77a55cf301bbe2 100755 (executable)
@@ -1126,10 +1126,10 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
        
        static readonly Universe universe = new Universe ();
        static readonly Dictionary<string, string> loaded_assemblies = new Dictionary<string, string> ();
-       static readonly string resourcePathSeparator = (Path.DirectorySeparatorChar == '\\') ? $"\\{Path.DirectorySeparatorChar}" : $"{Path.DirectorySeparatorChar}";
 
        public static string GetAssemblyName (string path)
        {
+               string resourcePathSeparator = style == "windows" ? "\\\\" : "/";
                string name = Path.GetFileName (path);
 
                // A bit of a hack to support satellite assemblies. They all share the same name but
index ea8fda67dc35096689e0e580561e7e4b68b38577..016175bea3b4c56f370f7ff512f47093c7e0e70b 100644 (file)
@@ -39,8 +39,10 @@ mono_read (BIO *bio, char *out, int outl)
 
        ret = mono->read_func (mono->instance, out, outl, &wantMore);
 
-       if (ret < 0)
+       if (ret < 0) {
+               errno = EIO;
                return -1;
+       }
        if (ret > 0)
                return ret;
 
index eca323ce2ae27a194018f0180f89131d3a34443d..17291b5c585e18cd0f11e2c2b4f8bb8c01766776 100644 (file)
@@ -60,6 +60,18 @@ mono_btls_ssl_close (MonoBtlsSsl *ptr)
        ;
 }
 
+MONO_API int
+mono_btls_ssl_shutdown (MonoBtlsSsl *ptr)
+{
+    return SSL_shutdown (ptr->ssl);
+}
+
+MONO_API void
+mono_btls_ssl_set_quiet_shutdown (MonoBtlsSsl *ptr, int mode)
+{
+    SSL_set_quiet_shutdown (ptr->ssl, mode);
+}
+
 MONO_API void
 mono_btls_ssl_set_bio (MonoBtlsSsl *ptr, BIO *bio)
 {
index 98b017340e1b1a956da2bafdaf056e5bd3c0b33b..ac93c114995fee4bdf6f24f6c838158ca34aee4c 100644 (file)
@@ -68,6 +68,12 @@ mono_btls_ssl_get_peer_certificate (MonoBtlsSsl *ptr);
 void
 mono_btls_ssl_close (MonoBtlsSsl *ptr);
 
+int
+mono_btls_ssl_shutdown (MonoBtlsSsl *ptr);
+
+MONO_API void
+mono_btls_ssl_set_quiet_shutdown (MonoBtlsSsl *ptr, int mode);
+
 int
 mono_btls_ssl_get_error (MonoBtlsSsl *ptr, int ret_code);
 
index 9242e8639fe4fc147608b82d559b3a6d7e62b28f..c13675e8233525e0fd63f80f51b45f6677b19d94 100755 (executable)
 #include "mono/metadata/class-internals.h"
 #include "mono/utils/mono-compiler.h"
 
-#if defined(__native_client__) && defined(__GLIBC__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
 void
 dump_table_assembly (MonoImage *m)
 {
index ca9c92e0ae60cdb0a808a654ade306a8d2565c70..a994e4603d30214cbfb5d5a40e7fd9d17459d023 100755 (executable)
@@ -25,6 +25,9 @@
 
 extern gboolean substitute_with_mscorlib_p;
 
+static char *
+get_token_comment (const char *prefix, guint32 token);
+
 static MonoGenericContainer *
 get_memberref_container (MonoImage *m, guint32 mrp_token, MonoGenericContainer *container);
 
@@ -59,7 +62,7 @@ get_typedef (MonoImage *m, int idx)
         /* Check if this is a nested type */
         token = MONO_TOKEN_TYPE_DEF | (idx);
         token = mono_metadata_nested_in_typedef (m, token);
-       tstring = show_tokens ? g_strdup_printf ("/*%08x*/", token) : NULL;
+       tstring = get_token_comment (NULL, token);
         if (token) {
                 char *outer;
                 
@@ -258,11 +261,12 @@ get_typespec (MonoImage *m, guint32 idx, gboolean is_def, MonoGenericContainer *
 
        if (show_tokens) {
                int token = mono_metadata_make_token (MONO_TABLE_TYPESPEC, idx);
-               result = g_strdup_printf ("%s/*%08x*/", res->str, token);
-       } else
+               result = get_token_comment (res->str, token);
+               g_string_free (res, TRUE);
+       } else {
                result = res->str;
-
-       g_string_free (res, FALSE);
+               g_string_free (res, FALSE);
+       }
 
        return result;
 }
@@ -316,7 +320,7 @@ get_typeref (MonoImage *m, int idx)
 
        if (show_tokens) {
                int token = mono_metadata_make_token (MONO_TABLE_TYPEREF, idx);
-               char *temp = g_strdup_printf ("%s/*%08x*/", ret, token);
+               char *temp = get_token_comment (ret, token);
                g_free (ret);
                ret = temp;
        }
@@ -1294,7 +1298,7 @@ get_type (MonoImage *m, const char *ptr, char **result, gboolean is_def, MonoGen
                }
 
                if (show_tokens) {
-                       *result = g_strdup_printf ("%s/*%08x*/", temp, token);
+                       *result = get_token_comment (temp, token);
                        g_free (temp);
                } else
                        *result = temp;
@@ -1769,6 +1773,25 @@ get_fieldref_signature (MonoImage *m, int idx, MonoGenericContainer *container)
         return full_sig;
 }
 
+/**
+ * get_token_comment:
+ *
+ * If show_tokens is TRUE, return "prefix""token(table)".
+ * If show_tokens is FALSE, return "prefix" or NULL if prefix is NULL.
+ * Caller is responsible for freeing.
+ */
+char *
+get_token_comment (const char *prefix, guint32 token)
+{
+       if (!show_tokens)
+               return prefix ? g_strdup_printf ("%s", prefix) : NULL;
+       gint32 tableidx = mono_metadata_token_table (token);
+       if ((tableidx < 0) || (tableidx > MONO_TABLE_LAST))
+               return g_strdup_printf ("%s/*%08x*/", prefix ? prefix : "", token);
+       else
+               return g_strdup_printf ("%s/*%08x(%s)*/", prefix ? prefix : "", token, mono_meta_table_name (tableidx));
+}
+
 /**
  * get_field:
  * @m: metadata context
@@ -1783,7 +1806,7 @@ get_field (MonoImage *m, guint32 token, MonoGenericContainer *container)
 {
        int idx = mono_metadata_token_index (token);
        guint32 cols [MONO_FIELD_SIZE];
-       char *sig, *res, *type, *estype, *esname;
+       char *sig, *res, *type, *estype, *esname, *token_comment;
        guint32 type_idx;
 
        /*
@@ -1812,16 +1835,20 @@ get_field (MonoImage *m, guint32 token, MonoGenericContainer *container)
        type = get_typedef (m, type_idx);
        estype = get_escaped_name (type);
        esname = get_escaped_name (mono_metadata_string_heap (m, cols [MONO_FIELD_NAME]));
-       res = g_strdup_printf ("%s %s%s%s",
+       token_comment = get_token_comment (NULL, token);
+       res = g_strdup_printf ("%s %s%s%s%s",
                        sig, 
                        estype ? estype : "",
                        estype ? "::" : "",
-                       esname);
+                       esname,
+                       token_comment ? token_comment : ""
+               );
 
        g_free (type);
        g_free (sig);
        g_free (estype);
        g_free (esname);
+       g_free (token_comment);
 
        return res;
 }
@@ -1909,12 +1936,11 @@ get_method_core (MonoImage *m, guint32 token, gboolean fullsig, MonoGenericConta
                        container = mono_method_get_generic_container (((MonoMethodInflated *) mh)->declaring);
                esname = get_escaped_name (mh->name);
                sig = dis_stringify_type (m, &mh->klass->byval_arg, TRUE);
-               if (show_tokens)
-                       name = g_strdup_printf ("%s/*%08x*/%s%s", sig ? sig : "", token, sig ? "::" : "", esname);
-               else
-                       name = g_strdup_printf ("%s%s%s", sig ? sig : "", sig ? "::" : "", esname);
+               char *token_comment = get_token_comment (NULL, token);
+               name = g_strdup_printf ("%s%s%s%s", sig ? sig : "", token_comment ? token_comment : "", sig ? "::" : "", esname);
                g_free (sig);
                g_free (esname);
+               g_free (token_comment);
        } else {
                name = NULL;
                mono_error_cleanup (&error);
@@ -1979,7 +2005,7 @@ get_method_core (MonoImage *m, guint32 token, gboolean fullsig, MonoGenericConta
        }
        
        if (show_tokens) {
-               char *retval = g_strdup_printf ("%s /* %08x */", sig, token);
+               char *retval = get_token_comment (sig, token);
                g_free (sig);
                return retval;
        } else
index 4c29af97bc9773c514f7a3886fd6ceff755ec6d5..a149edb2608abf6a1e85f517cf465e2c30168ee8 100644 (file)
@@ -1951,8 +1951,10 @@ monodis_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data)
 static void
 usage (void)
 {
-       GString *args = g_string_new ("[--output=filename] [--filter=filename] [--help] [--mscorlib]\n");
+       GString *args = g_string_new ("[--output=filename] [--filter=filename]\n");
        int i;
+
+       g_string_append (args, "[--help] [--mscorlib] [--show-tokens] [--show-method-tokens]\n");
        
        for (i = 0; table_list [i].name != NULL; i++){
                g_string_append (args, "[");
index 182d117308c9b9254b93762a78e15f127c9e33a3..5783a12fd81f1ec8c241238750f680bc520dea3b 100644 (file)
@@ -77,6 +77,9 @@ is useful for round-tripping the IL with ilasm.
 .TP
 .I "--show-method-tokens"
 Display tokens for disassembled methods.
+.TP
+.I "--show-tokens"
+Display tokens for strings, types, methods, fields, etc.
 .SH OPTIONS TO DISPLAY METADATA TABLES
 The following options are used to display metadata tables instead of
 disassembling the CIL image.
index ef9df2a5cb295d6828d0b2bd6aa613e2eee93fed..a9f976f8c207799107f48d02bb367fc5019a6efb 100644 (file)
@@ -203,7 +203,6 @@ common_sources = \
        mono-route.c            \
        mono-route.h            \
        monitor.h               \
-       nacl-stub.c             \
        normalization-tables.h  \
        number-formatter.h      \
        number-ms.c             \
index 7bcd8fa7a752ca25f81c4f58b7d898492a6e7961..02ca3bbf949dcfa99b1b35c56eccea187d7bfbb3 100644 (file)
@@ -2266,10 +2266,6 @@ ves_icall_System_AppDomain_InternalUnload (gint32 domain_id, MonoError *error)
        if (g_hasenv ("MONO_NO_UNLOAD"))
                return;
 
-#ifdef __native_client__
-       return;
-#endif
-
        MonoException *exc = NULL;
        mono_domain_try_unload (domain, (MonoObject**)&exc);
        if (exc)
index 5bc9486f897e85703bbf689875c78867e671f786..16c22c8fd10e8923ba813eea59aece7e0507bb22 100644 (file)
@@ -332,27 +332,6 @@ static const AssemblyVersionMap framework_assemblies [] = {
 static GList *loaded_assemblies = NULL;
 static MonoAssembly *corlib;
 
-#if defined(__native_client__)
-
-/* On Native Client, allow mscorlib to be loaded from memory  */
-/* instead of loaded off disk.  If these are not set, default */
-/* mscorlib loading will take place                           */
-
-/* NOTE: If mscorlib data is passed to mono in this way then */
-/* it needs to remain allocated during the use of mono.      */
-
-static void *corlibData = NULL;
-static size_t corlibSize = 0;
-
-void
-mono_set_corlib_data (void *data, size_t size)
-{
-  corlibData = data;
-  corlibSize = size;
-}
-
-#endif
-
 static char* unquote (const char *str);
 
 /* This protects loaded_assemblies and image->references */
@@ -462,12 +441,6 @@ mono_set_assemblies_path (const char* path)
        }
 }
 
-/* Native Client can't get this info from an environment variable so */
-/* it's passed in to the runtime, or set manually by embedding code. */
-#ifdef __native_client__
-char* nacl_mono_path = NULL;
-#endif
-
 static void
 check_path_env (void)
 {
@@ -475,10 +448,6 @@ check_path_env (void)
                return;
 
        char* path = g_getenv ("MONO_PATH");
-#ifdef __native_client__
-       if (!path)
-               path = strdup (nacl_mono_path);
-#endif
        if (!path)
                return;
 
@@ -3492,23 +3461,6 @@ mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *
                return corlib;
        }
 
-       // In native client, Corlib is embedded in the executable as static variable corlibData
-#if defined(__native_client__)
-       if (corlibData != NULL && corlibSize != 0) {
-               int status = 0;
-               /* First "FALSE" instructs mono not to make a copy. */
-               /* Second "FALSE" says this is not just a ref.      */
-               MonoImage* image = mono_image_open_from_data_full (corlibData, corlibSize, FALSE, &status, FALSE);
-               if (image == NULL || status != 0)
-                       g_print("mono_image_open_from_data_full failed: %d\n", status);
-               corlib = mono_assembly_load_from_full (image, "mscorlib", &status, FALSE);
-               if (corlib == NULL || status != 0)
-                       g_print ("mono_assembly_load_from_full failed: %d\n", status);
-               if (corlib)
-                       return corlib;
-       }
-#endif
-
        // A nonstandard preload hook may provide a special mscorlib assembly
        aname = mono_assembly_name_new ("mscorlib.dll");
        corlib = invoke_assembly_preload_hook (aname, assemblies_path);
index 99704f7c428bfe69fac794b09e43e8515c62573b..edc1210587834cd3c50ae1e0b8c5ad92d8517f34 100644 (file)
@@ -129,7 +129,7 @@ mono_gc_base_init (void)
         * we used to do this only when running on valgrind,
         * but it happens also in other setups.
         */
-#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK) && !defined(__native_client__)
+#if defined(HAVE_PTHREAD_GETATTR_NP) && defined(HAVE_PTHREAD_ATTR_GETSTACK)
        {
                size_t size;
                void *sstart;
@@ -164,8 +164,6 @@ mono_gc_base_init (void)
 
                GC_stackbottom = (char*)ss.ss_sp;
        }
-#elif defined(__native_client__)
-       /* Do nothing, GC_stackbottom is set correctly in libgc */
 #else
        {
                int dummy;
index 98b3ba551cb005a3af4cbadc884cb576a81e4984..fe71923dbbadbdb97378b047a0f822f80a977749 100644 (file)
@@ -8,10 +8,6 @@
  * Copyright (C) 2005-2009 Novell, Inc. (http://www.novell.com)
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
-#if defined(__native_client__)
-#include "console-null.c"
-#else
-
 #include <config.h>
 #include <glib.h>
 #include <stdio.h>
@@ -525,5 +521,3 @@ ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardow
 
        return TRUE;
 }
-#endif /* #if defined(__native_client__) */
-
index 111ed39e6ba610289e1faf69a43f336f05e0a4da..f561dc15b4cb01fd6956f23df5c277339b0fdd08 100644 (file)
@@ -416,10 +416,6 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
        gboolean ret;
        gint64 start;
 
-#if defined(__native_client__)
-       return FALSE;
-#endif
-
        if (mono_thread_internal_current () == gc_thread)
                /* We are called from inside a finalizer, not much we can do here */
                return FALSE;
index 398f7d57cbab7771d4d278d00bf099d67728e8ce..eb3175a4f9aca0d9a7b0ddaa88a78775784f057d 100644 (file)
@@ -409,6 +409,19 @@ This is why we evaluate index and value before any call to MONO_HANDLE_RAW or ot
 
 #define MONO_HANDLE_DOMAIN(HANDLE) (mono_object_domain (MONO_HANDLE_RAW (MONO_HANDLE_CAST (MonoObject, HANDLE))))
 
+/* Given an object and a MonoClassField, return the value (must be non-object)
+ * of the field.  It's the caller's responsibility to check that the object is
+ * of the correct class. */
+#define MONO_HANDLE_GET_FIELD_VAL(HANDLE,TYPE,FIELD) *(TYPE *)(mono_handle_unsafe_field_addr (MONO_HANDLE_CAST (MonoObject, (HANDLE)), (FIELD)))
+
+#define MONO_HANDLE_NEW_GET_FIELD(HANDLE,TYPE,FIELD) MONO_HANDLE_NEW (TYPE, *(TYPE**)(mono_handle_unsafe_field_addr (MONO_HANDLE_CAST (MonoObject, (HANDLE)), (FIELD))))
+
+#define MONO_HANDLE_SET_FIELD_VAL(HANDLE,TYPE,FIELD,VAL) do {          \
+               MonoObjectHandle __obj = (HANDLE);                      \
+               MonoClassField *__field = (FIELD);                      \
+               TYPE __value = (VAL);                                   \
+               *(TYPE*)(mono_handle_unsafe_field_addr (__obj, __field)) = __value; \
+       } while (0)
 
 /* Baked typed handles we all want */
 TYPED_HANDLE_DECL (MonoString);
@@ -417,6 +430,12 @@ TYPED_HANDLE_DECL (MonoObject);
 TYPED_HANDLE_DECL (MonoException);
 TYPED_HANDLE_DECL (MonoAppContext);
 
+/* Unfortunately MonoThreadHandle is already a typedef used for something unrelated.  So
+ * the coop handle for MonoThread* is MonoThreadObjectHandle.
+ */
+typedef MonoThread MonoThreadObject;
+TYPED_HANDLE_DECL (MonoThreadObject);
+
 #define NULL_HANDLE_STRING MONO_HANDLE_CAST(MonoString, NULL_HANDLE)
 
 /*
@@ -431,6 +450,13 @@ mono_handle_assign (MonoObjectHandleOut dest, MonoObjectHandle src)
        mono_gc_wbarrier_generic_store (&dest->__raw, src ? MONO_HANDLE_RAW(src) : NULL);
 }
 
+/* It is unsafe to call this function directly - it does not pin the handle!  Use MONO_HANDLE_GET_FIELD_VAL(). */
+static inline gchar*
+mono_handle_unsafe_field_addr (MonoObjectHandle h, MonoClassField *field)
+{
+       return ((gchar *)MONO_HANDLE_RAW (h)) + field->offset;
+}
+
 //FIXME this should go somewhere else
 MonoStringHandle mono_string_new_handle (MonoDomain *domain, const char *data, MonoError *error);
 MonoArrayHandle mono_array_new_handle (MonoDomain *domain, MonoClass *eclass, uintptr_t n, MonoError *error);
@@ -480,7 +506,6 @@ mono_context_get_handle (void);
 void
 mono_context_set_handle (MonoAppContextHandle new_context);
 
-
 G_END_DECLS
 
 #endif /* __MONO_HANDLE_H__ */
index 59bc73305a91f3920fb365b5b126a5f4ded734aa..a77e1a7c00ed6589fb4456c37da2838fd4595154 100644 (file)
@@ -453,33 +453,33 @@ ICALL(MAC_IFACE_PROPS_1, "ParseRouteInfo_internal", ves_icall_System_Net_Network
 #endif
 
 ICALL_TYPE(SOCK, "System.Net.Sockets.Socket", SOCK_1)
-ICALL(SOCK_1, "Accept_internal(intptr,int&,bool)", ves_icall_System_Net_Sockets_Socket_Accept_internal)
-ICALL(SOCK_2, "Available_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Available_internal)
-ICALL(SOCK_3, "Bind_internal(intptr,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_Bind_internal)
-ICALL(SOCK_4, "Blocking_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Blocking_internal)
-ICALL(SOCK_5, "Close_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Close_internal)
-ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_Connect_internal)
-ICALL (SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal)
-ICALL(SOCK_7, "GetSocketOption_arr_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,byte[]&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal)
-ICALL(SOCK_8, "GetSocketOption_obj_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal)
-ICALL(SOCK_21, "IOControl_internal(intptr,int,byte[],byte[],int&)", ves_icall_System_Net_Sockets_Socket_IOControl_internal)
-ICALL(SOCK_9, "Listen_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_Listen_internal)
-ICALL(SOCK_10, "LocalEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal)
-ICALL(SOCK_11, "Poll_internal", ves_icall_System_Net_Sockets_Socket_Poll_internal)
-ICALL(SOCK_13, "ReceiveFrom_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&,int&,bool)", ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal)
-ICALL(SOCK_11a, "Receive_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_array_internal)
-ICALL(SOCK_12, "Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_internal)
-ICALL(SOCK_14, "RemoteEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal)
-ICALL(SOCK_15, "Select_internal(System.Net.Sockets.Socket[]&,int,int&)", ves_icall_System_Net_Sockets_Socket_Select_internal)
-ICALL(SOCK_15a, "SendFile_internal(intptr,string,byte[],byte[],System.Net.Sockets.TransmitFileOptions,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendFile_internal)
-ICALL(SOCK_16, "SendTo_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendTo_internal)
-ICALL(SOCK_16a, "Send_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_array_internal)
-ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_internal)
-ICALL(SOCK_18, "SetSocketOption_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object,byte[],int,int&)", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal)
-ICALL(SOCK_19, "Shutdown_internal(intptr,System.Net.Sockets.SocketShutdown,int&)", ves_icall_System_Net_Sockets_Socket_Shutdown_internal)
-ICALL(SOCK_20, "Socket_internal(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType,int&)", ves_icall_System_Net_Sockets_Socket_Socket_internal)
-ICALL(SOCK_20a, "SupportsPortReuse", ves_icall_System_Net_Sockets_Socket_SupportPortReuse)
-ICALL(SOCK_21a, "cancel_blocking_socket_operation", icall_cancel_blocking_socket_operation)
+HANDLES(ICALL(SOCK_1, "Accept_internal(intptr,int&,bool)", ves_icall_System_Net_Sockets_Socket_Accept_internal))
+HANDLES(ICALL(SOCK_2, "Available_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Available_internal))
+HANDLES(ICALL(SOCK_3, "Bind_internal(intptr,System.Net.SocketAddress,int&)", ves_icall_System_Net_Sockets_Socket_Bind_internal))
+HANDLES(ICALL(SOCK_4, "Blocking_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Blocking_internal))
+HANDLES(ICALL(SOCK_5, "Close_internal(intptr,int&)", ves_icall_System_Net_Sockets_Socket_Close_internal))
+HANDLES(ICALL(SOCK_6, "Connect_internal(intptr,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_Connect_internal))
+HANDLES(ICALL (SOCK_6a, "Disconnect_internal(intptr,bool,int&)", ves_icall_System_Net_Sockets_Socket_Disconnect_internal))
+HANDLES(ICALL(SOCK_7, "GetSocketOption_arr_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,byte[]&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal))
+HANDLES(ICALL(SOCK_8, "GetSocketOption_obj_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object&,int&)", ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal))
+HANDLES(ICALL(SOCK_21, "IOControl_internal(intptr,int,byte[],byte[],int&)", ves_icall_System_Net_Sockets_Socket_IOControl_internal))
+HANDLES(ICALL(SOCK_9, "Listen_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_Listen_internal))
+HANDLES(ICALL(SOCK_10, "LocalEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal))
+HANDLES(ICALL(SOCK_11, "Poll_internal", ves_icall_System_Net_Sockets_Socket_Poll_internal))
+HANDLES(ICALL(SOCK_13, "ReceiveFrom_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress&,int&,bool)", ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal))
+HANDLES(ICALL(SOCK_11a, "Receive_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_array_internal))
+HANDLES(ICALL(SOCK_12, "Receive_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Receive_internal))
+HANDLES(ICALL(SOCK_14, "RemoteEndPoint_internal(intptr,int,int&)", ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal))
+HANDLES(ICALL(SOCK_15, "Select_internal(System.Net.Sockets.Socket[]&,int,int&)", ves_icall_System_Net_Sockets_Socket_Select_internal))
+HANDLES(ICALL(SOCK_15a, "SendFile_internal(intptr,string,byte[],byte[],System.Net.Sockets.TransmitFileOptions,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendFile_internal))
+HANDLES(ICALL(SOCK_16, "SendTo_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,System.Net.SocketAddress,int&,bool)", ves_icall_System_Net_Sockets_Socket_SendTo_internal))
+HANDLES(ICALL(SOCK_16a, "Send_internal(intptr,System.Net.Sockets.Socket/WSABUF[],System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_array_internal))
+HANDLES(ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFlags,int&,bool)", ves_icall_System_Net_Sockets_Socket_Send_internal))
+HANDLES(ICALL(SOCK_18, "SetSocketOption_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object,byte[],int,int&)", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal))
+HANDLES(ICALL(SOCK_19, "Shutdown_internal(intptr,System.Net.Sockets.SocketShutdown,int&)", ves_icall_System_Net_Sockets_Socket_Shutdown_internal))
+HANDLES(ICALL(SOCK_20, "Socket_internal(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType,int&)", ves_icall_System_Net_Sockets_Socket_Socket_internal))
+HANDLES(ICALL(SOCK_20a, "SupportsPortReuse", ves_icall_System_Net_Sockets_Socket_SupportPortReuse))
+HANDLES(ICALL(SOCK_21a, "cancel_blocking_socket_operation", icall_cancel_blocking_socket_operation))
 
 ICALL_TYPE(SOCKEX, "System.Net.Sockets.SocketException", SOCKEX_1)
 ICALL(SOCKEX_1, "WSAGetLastError_internal", ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal)
index eddd8bf2b076cf5dfdf7ee9e9b63a38f6c573e52..756f58f8062a0fe4032498e136eb6a9c94968924 100644 (file)
@@ -6676,11 +6676,6 @@ ves_icall_System_Environment_Exit (int result)
 {
        mono_environment_exitcode_set (result);
 
-/* FIXME: There are some cleanup hangs that should be worked out, but
- * if the program is going to exit, everything will be cleaned up when
- * NaCl exits anyway.
- */
-#ifndef __native_client__
        if (!mono_runtime_try_shutdown ())
                mono_thread_exit ();
 
@@ -6688,7 +6683,6 @@ ves_icall_System_Environment_Exit (int result)
        mono_thread_suspend_all_other_threads ();
 
        mono_runtime_quit ();
-#endif
 
        /* we may need to do some cleanup here... */
        exit (result);
@@ -7365,12 +7359,6 @@ mono_ArgIterator_IntGetNextArg (MonoArgIterator *iter)
        iter->args = (guint8*)(((gsize)iter->args + (align) - 1) & ~(align - 1));
 #endif
        res.value = iter->args;
-#if defined(__native_client__) && SIZEOF_REGISTER == 8
-       /* Values are stored as 8 byte register sized objects, but 'value'
-        * is dereferenced as a pointer in other routines.
-        */
-       res.value = (char*)res.value + 4;
-#endif
 #if G_BYTE_ORDER != G_LITTLE_ENDIAN
        if (arg_size <= sizeof (gpointer)) {
                int dummy;
index f60de81c46bdd63387cdb457671478449335dcdb..968c34ec79c99490429e0578873a53f7892411bb 100644 (file)
@@ -1252,7 +1252,7 @@ mono_string_new_len_wrapper (const char *text, guint length)
        return result;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 /*
  * mono_mb_emit_exception_marshal_directive:
@@ -1272,8 +1272,7 @@ mono_mb_emit_exception_marshal_directive (MonoMethodBuilder *mb, char *msg)
        }
        mono_mb_emit_exception_full (mb, "System.Runtime.InteropServices", "MarshalDirectiveException", s);
 }
-
-#endif /* !DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 guint
 mono_type_to_ldind (MonoType *type)
@@ -1387,7 +1386,7 @@ handle_enum:
        return -1;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 static void
 emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv conv, MonoMarshalSpec *mspec)
@@ -2464,7 +2463,7 @@ mono_marshal_emit_thread_force_interrupt_checkpoint (MonoMethodBuilder *mb)
        emit_thread_force_interrupt_checkpoint (mb);
 }
 
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 /* This is a JIT icall, it sets the pending exception and returns NULL on error. */
 static MonoAsyncResult *
@@ -2533,7 +2532,7 @@ mono_delegate_begin_invoke (MonoDelegate *delegate, gpointer *params)
        return result;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 int
 mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolean save_this)
@@ -2577,7 +2576,7 @@ mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolea
        return params_var;
 }
 
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 static char*
 mono_signature_to_name (MonoMethodSignature *sig, const char *prefix)
@@ -3202,7 +3201,7 @@ mono_marshal_get_delegate_begin_invoke (MonoMethod *method)
                mb = mono_mb_new (get_wrapper_target_class (method->klass->image), name, MONO_WRAPPER_DELEGATE_BEGIN_INVOKE);
        g_free (name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        params_var = mono_mb_emit_save_args (mb, sig, FALSE);
 
        mono_mb_emit_ldarg (mb, 0);
@@ -3325,7 +3324,7 @@ mono_delegate_end_invoke (MonoDelegate *delegate, gpointer *params)
        return res;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 void
 mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type)
@@ -3388,7 +3387,7 @@ mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type)
        mono_mb_emit_byte (mb, CEE_RET);
 }
 
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 /**
  * mono_marshal_get_delegate_end_invoke:
@@ -3444,7 +3443,7 @@ mono_marshal_get_delegate_end_invoke (MonoMethod *method)
                mb = mono_mb_new (get_wrapper_target_class (method->klass->image), name, MONO_WRAPPER_DELEGATE_END_INVOKE);
        g_free (name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        params_var = mono_mb_emit_save_args (mb, sig, FALSE);
 
        mono_mb_emit_ldarg (mb, 0);
@@ -3646,7 +3645,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
                mb = mono_mb_new (get_wrapper_target_class (method->klass->image), name, MONO_WRAPPER_DELEGATE_INVOKE);
        g_free (name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        void_ret = sig->ret->type == MONO_TYPE_VOID && !method->string_ctor;
 
        /* allocate local 0 (object) */
@@ -3813,7 +3812,7 @@ mono_marshal_get_delegate_invoke_internal (MonoMethod *method, gboolean callvirt
        mono_mb_emit_byte (mb, CEE_RET);
 
        mb->skip_visibility = 1;
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
        info = mono_wrapper_info_create (mb, subtype);
        info->d.delegate_invoke.method = method;
@@ -4008,7 +4007,7 @@ runtime_invoke_signature_equal (MonoMethodSignature *sig1, MonoMethodSignature *
                return mono_metadata_signature_equal (sig1, sig2);
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 /*
  * emit_invoke_call:
@@ -4029,8 +4028,10 @@ emit_invoke_call (MonoMethodBuilder *mb, MonoMethod *method,
 
        /* to make it work with our special string constructors */
        if (!string_dummy) {
+               MonoError error;
                MONO_GC_REGISTER_ROOT_SINGLE (string_dummy, MONO_ROOT_SOURCE_MARSHAL, "dummy marshal string");
-               string_dummy = mono_string_new_wrapper ("dummy");
+               string_dummy = mono_string_new_checked (mono_get_root_domain (), "dummy", &error);
+               mono_error_assert_ok (&error);
        }
 
        if (virtual_) {
@@ -4434,7 +4435,7 @@ mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual_)
        mb = mono_mb_new (target_klass, name,  MONO_WRAPPER_RUNTIME_INVOKE);
        g_free (name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        param_names [0] = "this";
        param_names [1] = "params";
        param_names [2] = "exc";
@@ -4445,7 +4446,7 @@ mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean virtual_)
 #endif
 
        if (need_direct_wrapper) {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                mb->skip_visibility = 1;
 #endif
                info = mono_wrapper_info_create (mb, virtual_ ? WRAPPER_SUBTYPE_RUNTIME_INVOKE_VIRTUAL : WRAPPER_SUBTYPE_RUNTIME_INVOKE_DIRECT);
@@ -4529,7 +4530,7 @@ mono_marshal_get_runtime_invoke_dynamic (void)
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_RUNTIME_INVOKE);
        g_free (name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /* allocate local 0 (object) tmp */
        mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
        /* allocate local 1 (object) exc */
@@ -4590,7 +4591,7 @@ mono_marshal_get_runtime_invoke_dynamic (void)
        mono_mb_patch_branch (mb, pos);
        //mono_mb_emit_ldloc (mb, 0);
        mono_mb_emit_byte (mb, CEE_RET);
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_RUNTIME_INVOKE_DYNAMIC);
 
@@ -4664,7 +4665,7 @@ mono_marshal_get_runtime_invoke_for_sig (MonoMethodSignature *sig)
        mb = mono_mb_new (mono_defaults.object_class, name,  MONO_WRAPPER_RUNTIME_INVOKE);
        g_free (name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        param_names [0] = "this";
        param_names [1] = "params";
        param_names [2] = "exc";
@@ -4705,7 +4706,7 @@ mono_marshal_get_runtime_invoke_for_sig (MonoMethodSignature *sig)
        return res;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 static void
 mono_mb_emit_auto_layout_exception (MonoMethodBuilder *mb, MonoClass *klass)
 {
@@ -4746,7 +4747,7 @@ mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gcon
        else
                csig2 = mono_metadata_signature_dup_full (mono_defaults.corlib, sig);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        if (sig->hasthis)
                mono_mb_emit_byte (mb, CEE_LDARG_0);
 
@@ -4780,7 +4781,7 @@ emit_marshal_custom (EmitMarshalContext *m, int argnum, MonoType *t,
                                         int conv_arg, MonoType **conv_arg_type, 
                                         MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        if (action == MARSHAL_ACTION_CONV_IN && t->type == MONO_TYPE_VALUETYPE)
                *conv_arg_type = &mono_defaults.int_class->byval_arg;
        return conv_arg;
@@ -5096,7 +5097,7 @@ emit_marshal_asany (EmitMarshalContext *m, int argnum, MonoType *t,
                                        int conv_arg, MonoType **conv_arg_type, 
                                        MarshalAction action)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        MonoMethodBuilder *mb = m->mb;
 
        switch (action) {
@@ -5143,7 +5144,7 @@ emit_marshal_vtype (EmitMarshalContext *m, int argnum, MonoType *t,
                                        int conv_arg, MonoType **conv_arg_type, 
                                        MarshalAction action)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        MonoMethodBuilder *mb = m->mb;
        MonoClass *klass, *date_time_class;
        int pos = 0, pos2;
@@ -5420,7 +5421,7 @@ emit_marshal_string (EmitMarshalContext *m, int argnum, MonoType *t,
                                         int conv_arg, MonoType **conv_arg_type, 
                                         MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        switch (action) {
        case MARSHAL_ACTION_CONV_IN:
                *conv_arg_type = &mono_defaults.int_class->byval_arg;
@@ -5599,7 +5600,7 @@ emit_marshal_safehandle (EmitMarshalContext *m, int argnum, MonoType *t,
                         MonoMarshalSpec *spec, int conv_arg, 
                         MonoType **conv_arg_type, MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        if (action == MARSHAL_ACTION_CONV_IN)
                *conv_arg_type = &mono_defaults.int_class->byval_arg;
 #else
@@ -5763,7 +5764,7 @@ emit_marshal_handleref (EmitMarshalContext *m, int argnum, MonoType *t,
                        MonoMarshalSpec *spec, int conv_arg, 
                        MonoType **conv_arg_type, MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        if (action == MARSHAL_ACTION_CONV_IN)
                *conv_arg_type = &mono_defaults.int_class->byval_arg;
 #else
@@ -5830,7 +5831,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
                     int conv_arg, MonoType **conv_arg_type, 
                     MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        if (action == MARSHAL_ACTION_CONV_IN)
                *conv_arg_type = &mono_defaults.int_class->byval_arg;
 #else
@@ -6332,8 +6333,7 @@ emit_marshal_object (EmitMarshalContext *m, int argnum, MonoType *t,
        return conv_arg;
 }
 
-#ifndef DISABLE_JIT
-
+#ifdef HAVE_ONLINE_VES
 #ifndef DISABLE_COM
 
 static int
@@ -6450,7 +6450,7 @@ emit_marshal_variant (EmitMarshalContext *m, int argnum, MonoType *t,
 }
 
 #endif /* DISABLE_COM */
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 static gboolean
 mono_pinvoke_is_unicode (MonoMethodPInvoke *piinfo)
@@ -6477,7 +6477,7 @@ emit_marshal_array (EmitMarshalContext *m, int argnum, MonoType *t,
                                        int conv_arg, MonoType **conv_arg_type, 
                                        MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        switch (action) {
        case MARSHAL_ACTION_CONV_IN:
                *conv_arg_type = &mono_defaults.object_class->byval_arg;
@@ -7246,7 +7246,7 @@ emit_marshal_boolean (EmitMarshalContext *m, int argnum, MonoType *t,
                      int conv_arg, MonoType **conv_arg_type, 
                      MarshalAction action)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        switch (action) {
        case MARSHAL_ACTION_CONV_IN:
                if (t->byref)
@@ -7415,7 +7415,7 @@ emit_marshal_ptr (EmitMarshalContext *m, int argnum, MonoType *t,
                  MonoMarshalSpec *spec, int conv_arg, 
                  MonoType **conv_arg_type, MarshalAction action)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        MonoMethodBuilder *mb = m->mb;
 
        switch (action) {
@@ -7450,7 +7450,7 @@ emit_marshal_char (EmitMarshalContext *m, int argnum, MonoType *t,
                   MonoMarshalSpec *spec, int conv_arg, 
                   MonoType **conv_arg_type, MarshalAction action)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        MonoMethodBuilder *mb = m->mb;
 
        switch (action) {
@@ -7478,7 +7478,7 @@ emit_marshal_scalar (EmitMarshalContext *m, int argnum, MonoType *t,
                     MonoMarshalSpec *spec, int conv_arg, 
                     MonoType **conv_arg_type, MarshalAction action)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        MonoMethodBuilder *mb = m->mb;
 
        switch (action) {
@@ -7522,7 +7522,7 @@ emit_marshal (EmitMarshalContext *m, int argnum, MonoType *t,
                return emit_marshal_string (m, argnum, t, spec, conv_arg, conv_arg_type, action);
        case MONO_TYPE_CLASS:
        case MONO_TYPE_OBJECT:
-#if !defined(DISABLE_COM) && !defined(DISABLE_JIT)
+#if !defined(DISABLE_COM) && defined(HAVE_ONLINE_VES)
                if (spec && spec->native == MONO_NATIVE_STRUCT)
                        return emit_marshal_variant (m, argnum, t, spec, conv_arg, conv_arg_type, action);
 #endif
@@ -7585,6 +7585,9 @@ typedef enum {
        /* Wrap the argument in an object handle, pass the handle to the icall,
           write the value out from the handle when the icall returns */
        ICALL_HANDLES_WRAP_OBJ_INOUT,
+       /* Initialized an object handle to null, pass to the icalls,
+          write the value out from the handle when the icall returns */
+       ICALL_HANDLES_WRAP_OBJ_OUT,
        /* Wrap the argument (a valuetype reference) in a handle to pin its enclosing object,
           but pass the raw reference to the icall */
        ICALL_HANDLES_WRAP_VALUETYPE_REF,
@@ -7606,7 +7609,12 @@ static IcallHandlesWrap
 signature_param_uses_handles (MonoMethodSignature *sig, int param)
 {
        if (MONO_TYPE_IS_REFERENCE (sig->params [param])) {
-               return mono_signature_param_is_out (sig, param) ? ICALL_HANDLES_WRAP_OBJ_INOUT : ICALL_HANDLES_WRAP_OBJ;
+               if (mono_signature_param_is_out (sig, param))
+                       return ICALL_HANDLES_WRAP_OBJ_OUT;
+               else if (mono_type_is_byref (sig->params [param]))
+                       return ICALL_HANDLES_WRAP_OBJ_INOUT;
+               else
+                       return ICALL_HANDLES_WRAP_OBJ;
        } else if (mono_type_is_byref (sig->params [param]))
                return ICALL_HANDLES_WRAP_VALUETYPE_REF;
        else
@@ -7614,7 +7622,7 @@ signature_param_uses_handles (MonoMethodSignature *sig, int param)
 }
 
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 /**
  * mono_marshal_emit_native_wrapper:
  * \param image the image to use for looking up custom marshallers
@@ -7898,7 +7906,7 @@ mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoM
 
        mono_mb_emit_byte (mb, CEE_RET);
 }
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 /**
  * mono_marshal_get_native_wrapper:
@@ -7997,7 +8005,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                /* create a wrapper to preserve .ctor in stack trace */
                                mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_MANAGED_TO_MANAGED);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                                mono_mb_emit_byte (mb, CEE_LDARG_0);
                                for (i = 1; i <= csig->param_count; i++)
                                        mono_mb_emit_ldarg (mb, i);
@@ -8031,7 +8039,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
         * registered in the runtime doing the AOT compilation.
         */
        if (!piinfo->addr && !aot) {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                mono_mb_emit_exception (mb, exc_class, exc_arg);
 #endif
                info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE);
@@ -8059,7 +8067,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                if (method->string_ctor)
                        csig->ret = &mono_defaults.string_class->byval_arg;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                // FIXME:
                MonoClass *handle_stack_mark_class;
                MonoClass *error_class;
@@ -8091,8 +8099,9 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                switch (w) {
                                case ICALL_HANDLES_WRAP_OBJ:
                                case ICALL_HANDLES_WRAP_OBJ_INOUT:
+                               case ICALL_HANDLES_WRAP_OBJ_OUT:
                                        ret->params [i] = mono_class_get_byref_type (mono_class_from_mono_type(csig->params[i]));
-                                       if (w == ICALL_HANDLES_WRAP_OBJ_INOUT)
+                                       if (w == ICALL_HANDLES_WRAP_OBJ_OUT || w == ICALL_HANDLES_WRAP_OBJ_INOUT)
                                                save_handles_to_locals = TRUE;
                                        break;
                                case ICALL_HANDLES_WRAP_NONE:
@@ -8129,6 +8138,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                                handles_locals [j].handle = -1;
                                                break;
                                        case ICALL_HANDLES_WRAP_OBJ_INOUT:
+                                       case ICALL_HANDLES_WRAP_OBJ_OUT:
                                                handles_locals [j].handle = mono_mb_add_local (mb, sig->params [i]);
                                                break;
                                        default:
@@ -8176,8 +8186,17 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                        mono_mb_emit_icall (mb, mono_icall_handle_new);
                                        break;
                                case ICALL_HANDLES_WRAP_OBJ_INOUT:
-                                       /* handleI = argI = mono_handle_new (NULL) */
-                                       mono_mb_emit_byte (mb, CEE_LDNULL);
+                               case ICALL_HANDLES_WRAP_OBJ_OUT:
+                                       /* if inout:
+                                        *   handleI = argI = mono_handle_new (*argI_raw)
+                                        * otherwise:
+                                        *   handleI = argI = mono_handle_new (NULL)
+                                        */
+                                       if (handles_locals[j].wrap == ICALL_HANDLES_WRAP_OBJ_INOUT) {
+                                               mono_mb_emit_ldarg (mb, j);
+                                               mono_mb_emit_byte (mb, CEE_LDIND_REF);
+                                       } else
+                                               mono_mb_emit_byte (mb, CEE_LDNULL);
                                        mono_mb_emit_icall (mb, mono_icall_handle_new);
                                        /* tmp = argI */
                                        mono_mb_emit_byte (mb, CEE_DUP);
@@ -8235,6 +8254,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                        case ICALL_HANDLES_WRAP_VALUETYPE_REF:
                                                break;
                                        case ICALL_HANDLES_WRAP_OBJ_INOUT:
+                                       case ICALL_HANDLES_WRAP_OBJ_OUT:
                                                /* *argI_raw = MONO_HANDLE_RAW (handleI) */
 
                                                /* argI_raw */
@@ -8280,7 +8300,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
        if (!aot)
                g_assert (piinfo->addr);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mspecs = g_new (MonoMarshalSpec*, sig->param_count + 1);
        mono_method_get_marshal_info (method, mspecs);
 
@@ -8295,7 +8315,7 @@ mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions,
                                                                                 info, NULL);
        mono_mb_free (mb);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        for (i = sig->param_count; i >= 0; i--)
                if (mspecs [i])
                        mono_metadata_free_marshal_spec (mspecs [i]);
@@ -8343,7 +8363,7 @@ mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_NATIVE);
        mb->method->save_lmf = 1;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mono_marshal_emit_native_wrapper (image, mb, sig, piinfo, mspecs, func, FALSE, TRUE, FALSE);
 #endif
 
@@ -8408,7 +8428,7 @@ mono_marshal_get_native_func_wrapper_aot (MonoClass *klass)
        mb = mono_mb_new (invoke->klass, name, MONO_WRAPPER_MANAGED_TO_NATIVE);
        mb->method->save_lmf = 1;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mono_marshal_emit_native_wrapper (image, mb, sig, piinfo, mspecs, NULL, FALSE, TRUE, TRUE);
 #endif
 
@@ -8443,7 +8463,7 @@ mono_marshal_get_native_func_wrapper_aot (MonoClass *klass)
 void
 mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle)
 {
-#ifdef DISABLE_JIT
+#ifndef HAVE_ONLINE_VES
        MonoMethodSignature *sig, *csig;
        int i;
 
@@ -8975,7 +8995,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
                                                                                         mb, csig, sig->param_count + 16,
                                                                                         info, NULL);
        } else {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                mb->dynamic = TRUE;
 #endif
                res = mono_mb_create (mb, csig, sig->param_count + 16, NULL);
@@ -9038,7 +9058,7 @@ mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type)
 
                mono_marshal_emit_managed_wrapper (mb, sig, mspecs, &m, method, 0);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                mb->dynamic = TRUE;
 #endif
                method = mono_mb_create (mb, csig, sig->param_count + 16, NULL);
@@ -9058,7 +9078,7 @@ mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type)
        mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_MANAGED_TO_MANAGED);
 
        param_count = sig->param_count + sig->hasthis;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        for (i = 0; i < param_count; i++)
                mono_mb_emit_ldarg (mb, i);
 
@@ -9079,7 +9099,7 @@ mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type)
        return compiled_ptr;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 /*
  * The code directly following this is the cache hit, value positive branch
@@ -9142,7 +9162,7 @@ generate_check_cache (int obj_arg_position, int class_arg_position, int cache_ar
        mono_mb_emit_icall (mb, mono_marshal_isinst_with_cache);
 }
 
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
 /**
  * mono_marshal_get_castclass_with_cache:
@@ -9173,7 +9193,7 @@ mono_marshal_get_castclass_with_cache (void)
        sig->ret = &mono_defaults.object_class->byval_arg;
        sig->pinvoke = 0;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        generate_check_cache (obj_arg_position, class_arg_position, cache_arg_position, 
                                                                                                &return_null_pos, &negative_cache_hit_pos, &positive_cache_hit_pos, mb);
        invalid_cast_pos = mono_mb_emit_branch (mb, CEE_BRFALSE);
@@ -9192,7 +9212,7 @@ mono_marshal_get_castclass_with_cache (void)
        mono_mb_patch_branch (mb, return_null_pos);
        mono_mb_emit_byte (mb, CEE_LDNULL);
        mono_mb_emit_byte (mb, CEE_RET);
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_CASTCLASS_WITH_CACHE);
        res = mono_mb_create (mb, sig, 8, info);
@@ -9260,7 +9280,7 @@ mono_marshal_get_isinst_with_cache (void)
        sig->ret = &mono_defaults.object_class->byval_arg;
        sig->pinvoke = 0;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        generate_check_cache (obj_arg_position, class_arg_position, cache_arg_position, 
                &return_null_pos, &negative_cache_hit_pos, &positive_cache_hit_pos, mb);
        // Return the object gotten via the slow path.
@@ -9319,7 +9339,7 @@ mono_marshal_get_struct_to_ptr (MonoClass *klass)
 
        mb = mono_mb_new (klass, stoptr->name, MONO_WRAPPER_UNKNOWN);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        if (klass->blittable) {
                mono_mb_emit_byte (mb, CEE_LDARG_1);
                mono_mb_emit_byte (mb, CEE_LDARG_0);
@@ -9401,7 +9421,7 @@ mono_marshal_get_ptr_to_struct (MonoClass *klass)
 
        mb = mono_mb_new (klass, "PtrToStructure", MONO_WRAPPER_UNKNOWN);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        if (klass->blittable) {
                mono_mb_emit_byte (mb, CEE_LDARG_1);
                mono_mb_emit_ldflda (mb, sizeof (MonoObject));
@@ -9469,7 +9489,7 @@ mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method)
        }
 
        mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_UNKNOWN);
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mono_mb_emit_exception_full (mb, "System", "ExecutionEngineException", "Shouldn't be called.");
        mono_mb_emit_byte (mb, CEE_RET);
 #endif
@@ -9545,7 +9565,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE);
        info->d.synchronized.method = method;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mb->skip_visibility = 1;
        /* result */
        if (!MONO_TYPE_IS_VOID (sig->ret))
@@ -9555,7 +9575,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)
        if (method->klass->valuetype && !(method->flags & MONO_METHOD_ATTR_STATIC)) {
                /* FIXME Is this really the best way to signal an error here?  Isn't this called much later after class setup? -AK */
                mono_class_set_type_load_failure (method->klass, "");
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                /* This will throw the type load exception when the wrapper is compiled */
                mono_mb_emit_byte (mb, CEE_LDNULL);
                mono_mb_emit_op (mb, CEE_ISINST, method->klass);
@@ -9573,7 +9593,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)
                return res;
        }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /* this */
        this_local = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
        taken_local = mono_mb_add_local (mb, &mono_defaults.boolean_class->byval_arg);
@@ -9605,7 +9625,7 @@ mono_marshal_get_synchronized_wrapper (MonoMethod *method)
 
        mono_marshal_unlock ();
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /* Push this or the type object */
        if (method->flags & METHOD_ATTRIBUTE_STATIC) {
                /* We have special handling for this in the JIT */
@@ -9704,7 +9724,7 @@ mono_marshal_get_unbox_wrapper (MonoMethod *method)
 
        g_assert (sig->hasthis);
        
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mono_mb_emit_ldarg (mb, 0); 
        mono_mb_emit_icon (mb, sizeof (MonoObject));
        mono_mb_emit_byte (mb, CEE_ADD);
@@ -9776,7 +9796,7 @@ get_virtual_stelemref_kind (MonoClass *element_class)
        return STELEMREF_CLASS;
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 static void
 load_array_element_address (MonoMethodBuilder *mb)
@@ -9860,7 +9880,7 @@ get_virtual_stelemref_wrapper (int kind)
                signature = sig;
        }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        param_names [0] = "index";
        param_names [1] = "value";
        mono_mb_set_param_names (mb, param_names);
@@ -10260,7 +10280,7 @@ get_virtual_stelemref_wrapper (int kind)
                mono_mb_emit_byte (mb, CEE_RET);
                g_assert (0);
        }
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_VIRTUAL_STELEMREF);
        info->d.virtual_stelemref.kind = kind;
        res = mono_mb_create (mb, signature, 4, info);
@@ -10333,7 +10353,7 @@ mono_marshal_get_stelemref (void)
        sig->params [1] = &mono_defaults.int_class->byval_arg; /* this is a natural sized int */
        sig->params [2] = &mono_defaults.object_class->byval_arg;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        aklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
        vklass = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
        array_slot_addr = mono_mb_add_local (mb, &mono_defaults.object_class->this_arg);
@@ -10473,7 +10493,7 @@ mono_marshal_get_gsharedvt_in_wrapper (void)
        sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
        sig->ret = &mono_defaults.void_class->byval_arg;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /*
         * The body is generated by the JIT, we use a wrapper instead of a trampoline so EH works.
         */
@@ -10507,7 +10527,7 @@ mono_marshal_get_gsharedvt_out_wrapper (void)
        sig = mono_metadata_signature_alloc (mono_defaults.corlib, 0);
        sig->ret = &mono_defaults.void_class->byval_arg;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /*
         * The body is generated by the JIT, we use a wrapper instead of a trampoline so EH works.
         */
@@ -10581,7 +10601,7 @@ mono_marshal_get_array_address (int rank, int elem_size)
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_MANAGED_TO_MANAGED);
        g_free (name);
        
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        bounds = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
        ind = mono_mb_add_local (mb, &mono_defaults.int32_class->byval_arg);
        realidx = mono_mb_add_local (mb, &mono_defaults.int32_class->byval_arg);
@@ -10677,7 +10697,7 @@ mono_marshal_get_array_address (int rank, int elem_size)
        mono_mb_emit_exception (mb, "IndexOutOfRangeException", NULL);
 
        g_free (branch_positions);
-#endif /* DISABLE_JIT */
+#endif /* HAVE_ONLINE_VES */
 
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_ELEMENT_ADDR);
        info->d.element_addr.rank = rank;
@@ -10754,7 +10774,7 @@ mono_marshal_get_array_accessor_wrapper (MonoMethod *method)
 
        mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_UNKNOWN);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /* Call the method */
        if (sig->hasthis)
                mono_mb_emit_ldarg (mb, 0);
@@ -12049,7 +12069,7 @@ mono_marshal_get_generic_array_helper (MonoClass *klass, gchar *name, MonoMethod
        csig = mono_metadata_signature_dup_full (method->klass->image, sig);
        csig->generic_param_count = 0;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mono_mb_emit_ldarg (mb, 0);
        for (i = 0; i < csig->param_count; i++)
                mono_mb_emit_ldarg (mb, i + 1);
@@ -12186,7 +12206,7 @@ mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method)
        if (MONO_TYPE_ISSTRUCT (sig->ret))
                csig->ret = &mono_defaults.object_class->byval_arg;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /* local 0 (temp for exception object) */
        mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
 
index 9ce5f04e8eb68ef4957988ca74b6b13458c361cc..81d16ce4b2d48aee49ea5ef811744e95cce8016b 100644 (file)
@@ -67,7 +67,7 @@ mono_mb_new_base (MonoClass *klass, MonoWrapperType type)
        m->inline_info = 1;
        m->wrapper_type = type;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mb->code_size = 40;
        mb->code = (unsigned char *)g_malloc (mb->code_size);
        mb->init_locals = TRUE;
@@ -104,7 +104,7 @@ mono_mb_new (MonoClass *klass, const char *name, MonoWrapperType type)
 void
 mono_mb_free (MonoMethodBuilder *mb)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        GList *l;
 
        for (l = mb->locals_list; l; l = l->next) {
@@ -134,7 +134,7 @@ mono_mb_free (MonoMethodBuilder *mb)
 MonoMethod *
 mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack)
 {
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        MonoMethodHeader *header;
 #endif
        MonoMethodWrapper *mw;
@@ -147,7 +147,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
 
        image = mb->method->klass->image;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        if (mb->dynamic) {
                method = mb->method;
                mw = (MonoMethodWrapper*)method;
@@ -177,7 +177,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
                else
                        method->name = mono_image_strdup (image, mb->name);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
                mw->header = header = (MonoMethodHeader *) 
                        mono_image_alloc0 (image, MONO_SIZEOF_METHOD_HEADER + mb->locals * sizeof (MonoType *));
 
@@ -190,7 +190,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
 #endif
        }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /* Free the locals list so mono_mb_free () doesn't free the types twice */
        g_list_free (mb->locals_list);
        mb->locals_list = NULL;
@@ -200,7 +200,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
        if (!signature->hasthis)
                method->flags |= METHOD_ATTRIBUTE_STATIC;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        if (max_stack < 8)
                max_stack = 8;
 
@@ -236,7 +236,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
                mw->method_data = data;
        }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        /*{
                static int total_code = 0;
                static int total_alloc = 0;
@@ -284,7 +284,7 @@ mono_mb_add_data (MonoMethodBuilder *mb, gpointer data)
        return g_list_length ((GList *)mw->method_data);
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 /**
  * mono_mb_add_local:
index b94abb0d64a87f9bb7e04cc2eac9f29968e0e878..b13416ffa2c7ad7d953b50ec0dac2b1018382f8b 100644 (file)
@@ -25,7 +25,7 @@ typedef struct _MonoMethodBuilder {
        MonoMethod *method;
        char *name;
        gboolean no_dup_name;
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        GList *locals_list;
        int locals;
        gboolean dynamic;
@@ -53,7 +53,7 @@ mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, in
 guint32
 mono_mb_add_data (MonoMethodBuilder *mb, gpointer data);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 void
 mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value);
 
index 7cff2952632bb4673e16069e807be67ed6b08122..e3d19ca7c130c3ef57cf87b841a6920a1712e55d 100644 (file)
@@ -668,7 +668,7 @@ mono_config_parse (const char *filename) {
        mono_config_parse_file (mono_cfg);
        g_free (mono_cfg);
 
-#if !defined(TARGET_WIN32) && !defined(__native_client__)
+#if !defined(TARGET_WIN32)
        home = g_get_home_dir ();
        user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", NULL);
        mono_config_parse_file (user_cfg);
diff --git a/mono/metadata/nacl-stub.c b/mono/metadata/nacl-stub.c
deleted file mode 100644 (file)
index ca87582..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * \file
- */
-
-#if defined(__native_client__)
-
-#include "nacl-stub.h"
-
-struct group *getgrnam(const char *name)
-{
-       return NULL;
-}
-
-struct group *getgrgid(gid_t gid)
-{
-       errno = EIO;
-       return NULL;
-}
-
-int fsync(int fd)
-{
-       errno = EINVAL;
-       return -1;
-}
-
-#ifdef USE_NEWLIB
-dev_t makedev(int maj, int min)
-{
-       return (maj)*256+(min);
-}
-
-int utime(const char *filename, const void *times)
-{
-       errno = EACCES;
-       return -1;
-}
-
-int kill(pid_t pid, int sig)
-{
-       errno = EACCES;
-       return -1;
-}
-
-int getrusage(int who, void *usage)
-{
-       errno = EACCES;
-       return -1;
-}
-
-int lstat(const char *path, struct stat *buf)
-{
-       return stat (path, buf);
-}
-
-int getdtablesize(void)
-{
-#ifdef OPEN_MAX
-  return OPEN_MAX;
-#else
-  return 256;
-#endif
-}
-
-size_t getpagesize(void)
-{
-#ifdef PAGE_SIZE
-  return PAGE_SIZE;
-#else
-  return 4096;
-#endif
-}
-
-int sem_trywait(sem_t *sem) {
-  g_assert_not_reached ();
-  return -1;
-}
-
-int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout) {
-  g_assert_not_reached ();
-  return -1;
-}
-
-#endif
-
-#endif
index 7af56df2a72e2c59963beca822adaea5cf906cdd..0ff70982305f5ce6e10bac804d38af94b47a8189 100644 (file)
@@ -266,6 +266,10 @@ typedef enum {
        CallType_OneWay = 3
 } MonoCallType;
 
+/* MonoSafeHandle is in class-internals.h. */
+/* Safely access System.Net.Sockets.SafeSocketHandle from native code */
+TYPED_HANDLE_DECL (MonoSafeHandle);
+
 /* This corresponds to System.Type */
 struct _MonoReflectionType {
        MonoObject object;
@@ -417,6 +421,12 @@ struct _MonoInternalThread {
        gpointer last;
 };
 
+/* It's safe to access System.Threading.InternalThread from native code via a
+ * raw pointer because all instances should be pinned.  But for uniformity of
+ * icall wrapping, let's declare a MonoInternalThreadHandle anyway.
+ */
+TYPED_HANDLE_DECL (MonoInternalThread);
+
 struct _MonoThread {
        MonoObject obj;
        struct _MonoInternalThread *internal_thread;
@@ -1438,6 +1448,15 @@ typedef struct {
        MonoProperty *prop;
 } CattrNamedArg;
 
+/* All MonoInternalThread instances should be pinned, so it's safe to use the raw ptr.  However
+ * for uniformity, icall wrapping will make handles anyway.  So this is the method for getting the payload.
+ */
+static inline MonoInternalThread*
+mono_internal_thread_handle_ptr (MonoInternalThreadHandle h)
+{
+       return MONO_HANDLE_RAW (h); /* Safe */
+}
+
 gboolean          mono_image_create_pefile (MonoReflectionModuleBuilder *module, gpointer file, MonoError *error);
 guint32       mono_image_insert_string (MonoReflectionModuleBuilderHandle module, MonoStringHandle str, MonoError *error);
 guint32       mono_image_create_token  (MonoDynamicImage *assembly, MonoObjectHandle obj, gboolean create_methodspec, gboolean register_token, MonoError *error);
index 30d2a1f0c2320eaf8f8cb96950129a7cf57a1c70..375831531f6773464a0868363a37450985c6128c 100644 (file)
@@ -267,6 +267,15 @@ DECL_OFFSET(SeqPointInfo, ss_tramp_addr)
 DECL_OFFSET(SeqPointInfo, bp_addrs)
 #endif
 
+#ifdef ENABLE_INTERPRETER
+DECL_OFFSET(InterpMethodArguments, ilen)
+DECL_OFFSET(InterpMethodArguments, iargs)
+DECL_OFFSET(InterpMethodArguments, flen)
+DECL_OFFSET(InterpMethodArguments, fargs)
+DECL_OFFSET(InterpMethodArguments, retval)
+DECL_OFFSET(InterpMethodArguments, is_float_ret)
+#endif
+
 #endif //DISABLE_JIT_OFFSETS
 
 #endif //USED_CROSS_COMPILER_OFFSETS
index 7cb7f291259d689cacb1404e3142f599b5118b1a..b1897453b467043ae166a9085071157320bd438c 100644 (file)
@@ -245,7 +245,7 @@ mono_gc_is_critical_method (MonoMethod *method)
        return sgen_is_critical_method (method);
 }
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 
 static void
 emit_nursery_check (MonoMethodBuilder *mb, int *nursery_check_return_labels, gboolean is_concurrent)
@@ -317,7 +317,7 @@ mono_gc_get_specific_write_barrier (gboolean is_concurrent)
        else
                mb = mono_mb_new (mono_defaults.object_class, "wbarrier_noconc", MONO_WRAPPER_WRITE_BARRIER);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
 #ifdef MANAGED_WBARRIER
        emit_nursery_check (mb, nursery_check_labels, is_concurrent);
        /*
@@ -1126,7 +1126,7 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
 
        mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_ALLOC);
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        if (slowpath) {
                switch (atype) {
                case ATYPE_NORMAL:
@@ -1461,7 +1461,7 @@ create_allocator (int atype, ManagedAllocatorVariant variant)
        info->d.alloc.gc_name = "sgen";
        info->d.alloc.alloc_type = atype;
 
-#ifndef DISABLE_JIT
+#ifdef HAVE_ONLINE_VES
        mb->init_locals = FALSE;
 #endif
 
index 5cc8e1d86f906d0541dff394a7f445f59fb8de8f..6f1a34e2dfc46b18eea5a8d7131ff418a934bcba 100644 (file)
@@ -3916,10 +3916,6 @@ collect_appdomain_thread (gpointer key, gpointer value, gpointer user_data)
 gboolean
 mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout)
 {
-#ifdef __native_client__
-       return FALSE;
-#endif
-
        abort_appdomain_data user_data;
        gint64 start_time;
        int orig_timeout = timeout;
index d99023e9e34da6ffa0f8ff58ff6d50d423e1796b..37ec577a6b02fb17f37d0a5f02813a867cb08f6a 100644 (file)
@@ -36,6 +36,19 @@ struct MonoW32HandleNamedEvent {
        MonoW32HandleNamespace sharedns;
 };
 
+static void event_handle_signal (gpointer handle, MonoW32HandleType type, MonoW32HandleEvent *event_handle)
+{
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: signalling %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       if (!event_handle->manual) {
+               event_handle->set_count = 1;
+               mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+       } else {
+               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+       }
+}
+
 static gboolean event_handle_own (gpointer handle, MonoW32HandleType type, gboolean *abandoned)
 {
        MonoW32HandleEvent *event_handle;
@@ -64,9 +77,9 @@ static gboolean event_handle_own (gpointer handle, MonoW32HandleType type, gbool
        return TRUE;
 }
 
-static void event_signal(gpointer handle)
+static void event_signal(gpointer handle, gpointer handle_specific)
 {
-       ves_icall_System_Threading_Events_SetEvent_internal (handle);
+       event_handle_signal (handle, MONO_W32HANDLE_EVENT, (MonoW32HandleEvent*) handle_specific);
 }
 
 static gboolean event_own (gpointer handle, gboolean *abandoned)
@@ -74,9 +87,9 @@ static gboolean event_own (gpointer handle, gboolean *abandoned)
        return event_handle_own (handle, MONO_W32HANDLE_EVENT, abandoned);
 }
 
-static void namedevent_signal (gpointer handle)
+static void namedevent_signal (gpointer handle, gpointer handle_specific)
 {
-       ves_icall_System_Threading_Events_SetEvent_internal (handle);
+       event_handle_signal (handle, MONO_W32HANDLE_NAMEDEVENT, (MonoW32HandleEvent*) handle_specific);
 }
 
 /* NB, always called with the shared handle lock held */
index 6fcb0f691f19ed0ec8c362698b4ee38fe6893e9a..38ca36a1a9eff4f07f8c468757c7d74c7278cb72 100644 (file)
@@ -721,11 +721,6 @@ _wapi_io_scandir (const gchar *dirname, const gchar *pattern, gchar ***namelist)
 static gboolean
 _wapi_lock_file_region (gint fd, off_t offset, off_t length)
 {
-#if defined(__native_client__)
-       printf("WARNING: %s: fcntl() not available on Native Client!\n", __func__);
-       // behave as below -- locks are not available
-       return TRUE;
-#else
        struct flock lock_data;
        gint ret;
 
@@ -766,16 +761,11 @@ _wapi_lock_file_region (gint fd, off_t offset, off_t length)
        }
 
        return TRUE;
-#endif /* __native_client__ */
 }
 
 static gboolean
 _wapi_unlock_file_region (gint fd, off_t offset, off_t length)
 {
-#if defined(__native_client__)
-       printf("WARNING: %s: fcntl() not available on Native Client!\n", __func__);
-       return TRUE;
-#else
        struct flock lock_data;
        gint ret;
 
@@ -811,7 +801,6 @@ _wapi_unlock_file_region (gint fd, off_t offset, off_t length)
        }
 
        return TRUE;
-#endif /* __native_client__ */
 }
 
 static void file_close (gpointer handle, gpointer data);
@@ -1529,8 +1518,6 @@ static gboolean file_setendoffile(gpointer handle)
        }
 #endif
 
-/* Native Client has no ftruncate function, even in standalone sel_ldr. */
-#ifndef __native_client__
        /* always truncate, because the extend write() adds an extra
         * byte to the end of the file
         */
@@ -1547,7 +1534,6 @@ static gboolean file_setendoffile(gpointer handle)
                _wapi_set_last_error_from_errno ();
                return(FALSE);
        }
-#endif
                
        return(TRUE);
 }
@@ -2407,13 +2393,6 @@ mono_w32file_create(const gunichar2 *name, guint32 fileaccess, guint32 sharemode
                
                return(INVALID_HANDLE_VALUE);
        }
-#ifdef __native_client__
-       /* Workaround: Native Client currently returns the same fake inode
-        * for all files, so do a simple hash on the filename so we don't
-        * use the same share info for each file.
-        */
-       statbuf.st_ino = g_str_hash(filename);
-#endif
 
        if (share_allows_open (&statbuf, sharemode, fileaccess,
                         &file_handle.share_info) == FALSE) {
@@ -2988,7 +2967,6 @@ _wapi_stdhandle_create (gint fd, const gchar *name)
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating standard handle type %s, fd %d", __func__, name, fd);
 
-#if !defined(__native_client__)
        /* Check if fd is valid */
        do {
                flags = fcntl(fd, F_GETFL);
@@ -3019,13 +2997,6 @@ _wapi_stdhandle_create (gint fd, const gchar *name)
                file_handle.fileaccess = 0;
                break;
        }
-#else
-       /*
-        * fcntl will return -1 in nacl, as there is no real file system API.
-        * Yet, standard streams are available.
-        */
-       file_handle.fileaccess = (fd == STDIN_FILENO) ? GENERIC_READ : GENERIC_WRITE;
-#endif
 
        file_handle.fd = fd;
        file_handle.filename = g_strdup(name);
@@ -3529,7 +3500,6 @@ retry:
                goto retry;
        }
 
-#ifndef __native_client__
        result = _wapi_lstat (filename, &linkbuf);
        if (result != 0) {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: lstat failed: %s", __func__, filename);
@@ -3537,7 +3507,6 @@ retry:
                g_free (filename);
                goto retry;
        }
-#endif
 
        utf8_filename = mono_utf8_from_external (filename);
        if (utf8_filename == NULL) {
@@ -3561,11 +3530,7 @@ retry:
        else
                create_time = buf.st_ctime;
        
-#ifdef __native_client__
-       find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, NULL);
-#else
        find_data->dwFileAttributes = _wapi_stat_to_file_attributes (utf8_filename, &buf, &linkbuf);
-#endif
 
        time_t_to_filetime (create_time, &find_data->ftCreationTime);
        time_t_to_filetime (buf.st_atime, &find_data->ftLastAccessTime);
@@ -3750,20 +3715,14 @@ mono_w32file_get_attributes (const gunichar2 *name)
                return (INVALID_FILE_ATTRIBUTES);
        }
 
-#ifndef __native_client__
        result = _wapi_lstat (utf8_name, &linkbuf);
        if (result != 0) {
                _wapi_set_last_path_error_from_errno (NULL, utf8_name);
                g_free (utf8_name);
                return (INVALID_FILE_ATTRIBUTES);
        }
-#endif
        
-#ifdef __native_client__
-       ret = _wapi_stat_to_file_attributes (utf8_name, &buf, NULL);
-#else
        ret = _wapi_stat_to_file_attributes (utf8_name, &buf, &linkbuf);
-#endif
        
        g_free (utf8_name);
 
@@ -3908,12 +3867,6 @@ mono_w32file_get_cwd (guint32 length, gunichar2 *buffer)
        glong count;
        gsize bytes;
 
-#ifdef __native_client__
-       gchar *path = g_get_current_dir ();
-       if (length < strlen(path) + 1 || path == NULL)
-               return 0;
-       memcpy (buffer, path, strlen(path) + 1);
-#else
        if (getcwd ((gchar*)buffer, length) == NULL) {
                if (errno == ERANGE) { /*buffer length is not big enough */ 
                        gchar *path = g_get_current_dir (); /*FIXME g_get_current_dir doesn't work with broken paths and calling it just to know the path length is silly*/
@@ -3927,7 +3880,6 @@ mono_w32file_get_cwd (guint32 length, gunichar2 *buffer)
                _wapi_set_last_error_from_errno ();
                return 0;
        }
-#endif
 
        utf16_path = mono_unicode_from_external ((gchar*)buffer, &bytes);
        count = (bytes/2)+1;
@@ -4919,7 +4871,7 @@ mono_w32file_get_drive_type(const gunichar2 *root_path_name)
        return (drive_type);
 }
 
-#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__native_client__) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
+#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
 static gchar*
 get_fstypename (gchar *utfpath)
 {
index 6500ba7fcf0d9d75cd73253f349f8c7d4b5bac00..f6862a9a7dba737452b39cb840286b84d52883c1 100644 (file)
@@ -809,7 +809,7 @@ mono_w32handle_ops_signal (gpointer handle)
        type = handle_data->type;
 
        if (handle_ops[type] != NULL && handle_ops[type]->signal != NULL) {
-               handle_ops[type]->signal (handle);
+               handle_ops[type]->signal (handle, handle_data->specific);
        }
 }
 
index 741dd0832356212c99d603faf744da68e4ffc4cf..029f24dad82d3135cccc00d71e162b2d78d27424 100644 (file)
@@ -53,7 +53,7 @@ typedef struct
        void (*close)(gpointer handle, gpointer data);
 
        /* mono_w32handle_signal_and_wait */
-       void (*signal)(gpointer signal);
+       void (*signal)(gpointer signal, gpointer data);
 
        /* Called by mono_w32handle_wait_one and mono_w32handle_wait_multiple,
         * with the handle locked (shared handles aren't locked.)
index 7c339ceda0841b2150bc2a1aa0c97727bceb30cd..189b808ba22436aace20b71b1449db5ca1838f88 100644 (file)
@@ -64,6 +64,38 @@ thread_disown_mutex (MonoInternalThread *internal, gpointer handle)
        mono_w32handle_unref (handle);
 }
 
+static void
+mutex_handle_signal (gpointer handle, MonoW32HandleType type, MonoW32HandleMutex *mutex_handle)
+{
+       pthread_t tid;
+
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: signalling %s handle %p, tid: %p recursion: %d",
+               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+
+       tid = pthread_self ();
+
+       if (mutex_handle->abandoned) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p is abandoned",
+                       __func__, mono_w32handle_get_typename (type), handle);
+       } else if (!pthread_equal (mutex_handle->tid, tid)) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
+                       __func__, mono_w32handle_get_typename (type), handle, (long)mutex_handle->tid, (long)tid);
+       } else {
+               /* OK, we own this mutex */
+               mutex_handle->recursion--;
+
+               if (mutex_handle->recursion == 0) {
+                       thread_disown_mutex (mono_thread_internal_current (), handle);
+
+                       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
+                               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+
+                       mutex_handle->tid = 0;
+                       mono_w32handle_set_signal_state (handle, TRUE, FALSE);
+               }
+       }
+}
+
 static gboolean
 mutex_handle_own (gpointer handle, MonoW32HandleType type, gboolean *abandoned)
 {
@@ -123,9 +155,9 @@ mutex_handle_is_owned (gpointer handle, MonoW32HandleType type)
        }
 }
 
-static void mutex_signal(gpointer handle)
+static void mutex_signal(gpointer handle, gpointer handle_specific)
 {
-       ves_icall_System_Threading_Mutex_ReleaseMutex_internal (handle);
+       mutex_handle_signal (handle, MONO_W32HANDLE_MUTEX, (MonoW32HandleMutex*) handle_specific);
 }
 
 static gboolean mutex_own (gpointer handle, gboolean *abandoned)
@@ -135,13 +167,12 @@ static gboolean mutex_own (gpointer handle, gboolean *abandoned)
 
 static gboolean mutex_is_owned (gpointer handle)
 {
-       
        return mutex_handle_is_owned (handle, MONO_W32HANDLE_MUTEX);
 }
 
-static void namedmutex_signal (gpointer handle)
+static void namedmutex_signal (gpointer handle, gpointer handle_specific)
 {
-       ves_icall_System_Threading_Mutex_ReleaseMutex_internal (handle);
+       mutex_handle_signal (handle, MONO_W32HANDLE_NAMEDMUTEX, (MonoW32HandleMutex*) handle_specific);
 }
 
 /* NB, always called with the shared handle lock held */
index 22336c2fd45e90ba75451c214541bf89e9439c3e..0db4d5946fdc9f854d0c465c0437e1c4fabb93dd 100644 (file)
@@ -27,6 +27,24 @@ struct MonoW32HandleNamedSemaphore {
        MonoW32HandleNamespace sharedns;
 };
 
+static void sem_handle_signal (gpointer handle, MonoW32HandleType type, MonoW32HandleSemaphore *sem_handle)
+{
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: signalling %s handle %p",
+               __func__, mono_w32handle_get_typename (type), handle);
+
+       /* No idea why max is signed, but thats the spec :-( */
+       if (sem_handle->val + 1 > (guint32)sem_handle->max) {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
+                       __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, 1, sem_handle->max);
+       } else {
+               mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
+                       __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, 1, sem_handle->max);
+
+               sem_handle->val += 1;
+               mono_w32handle_set_signal_state (handle, TRUE, TRUE);
+       }
+}
+
 static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type, gboolean *abandoned)
 {
        MonoW32HandleSemaphore *sem_handle;
@@ -50,9 +68,9 @@ static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type, gboolea
        return TRUE;
 }
 
-static void sema_signal(gpointer handle)
+static void sema_signal(gpointer handle, gpointer handle_specific)
 {
-       ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal(handle, 1, NULL);
+       sem_handle_signal (handle, MONO_W32HANDLE_SEM, (MonoW32HandleSemaphore*) handle_specific);
 }
 
 static gboolean sema_own (gpointer handle, gboolean *abandoned)
@@ -60,9 +78,9 @@ static gboolean sema_own (gpointer handle, gboolean *abandoned)
        return sem_handle_own (handle, MONO_W32HANDLE_SEM, abandoned);
 }
 
-static void namedsema_signal (gpointer handle)
+static void namedsema_signal (gpointer handle, gpointer handle_specific)
 {
-       ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (handle, 1, NULL);
+       sem_handle_signal (handle, MONO_W32HANDLE_NAMEDSEM, (MonoW32HandleSemaphore*) handle_specific);
 }
 
 /* NB, always called with the shared handle lock held */
index 75d90df2ed919996d24da13192ded7818e02f240..87743377324bc01c406342ed181dd3d7229d36ff 100644 (file)
@@ -1331,8 +1331,9 @@ mono_w32socket_convert_error (gint error)
 }
 
 gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto)
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error)
 {
+       error_init (error);
 #if defined (SO_REUSEPORT)
        return TRUE;
 #else
index e6a6f9713a42afb628240a0fc970286528629a0c..a3f8d410583248e150c7a930fa068255ad35624f 100644 (file)
@@ -310,7 +310,8 @@ mono_w32socket_convert_error (gint error)
 }
 
 gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto)
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error)
 {
+       error_init (error);
        return TRUE;
 }
index 54be06158213a4e05ae56ac13f1f3ea11317fdc9..bd802a67bb1c2c1f7c07a14c70e3b1e9f8a8c468 100644 (file)
 static gboolean
 addrinfo_to_IPHostEntry_handles (MonoAddressInfo *info, MonoStringHandleOut h_name, MonoArrayHandleOut h_aliases, MonoArrayHandleOut h_addr_list, gboolean add_local_ips, MonoError *error);
 
+static MonoObjectHandle
+create_object_handle_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror, MonoError *error);
+
+static struct sockaddr*
+create_sockaddr_from_handle (MonoObjectHandle saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error);
+
 #ifdef HOST_WIN32
 
 static SOCKET
@@ -686,13 +692,14 @@ get_socket_assembly (void)
 }
 
 gpointer
-ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObject *this_obj, gint32 family, gint32 type, gint32 proto, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObjectHandle this_obj, gint32 family, gint32 type, gint32 proto, gint32 *werror, MonoError *error)
 {
        SOCKET sock;
        gint32 sock_family;
        gint32 sock_proto;
        gint32 sock_type;
        
+       error_init (error);
        *werror = 0;
        
        sock_family = convert_family ((MonoAddressFamily)family);
@@ -727,10 +734,11 @@ ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObject *this_obj, gint3
  * file) is really an IntPtr which needs to be converted to a guint32.
  */
 void
-ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror, MonoError *error)
 {
        LOGDEBUG (g_message ("%s: closing 0x%x", __func__, sock));
 
+       error_init (error);
        *werror = 0;
 
        /* Clear any pending work item from this socket if the underlying
@@ -751,11 +759,12 @@ ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal (void)
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror, MonoError *error)
 {
        int ret;
        guint64 amount;
        
+       error_init (error);
        *werror = 0;
 
        /* FIXME: this might require amount to be unsigned long. */
@@ -769,10 +778,11 @@ ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werr
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror, MonoError *error)
 {
        int ret;
        
+       error_init (error);
        *werror = 0;
 
        ret = mono_w32socket_set_blocking (sock, block);
@@ -781,11 +791,12 @@ ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean bloc
 }
 
 gpointer
-ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking, MonoError *error)
 {
        gboolean interrupted;
        SOCKET newsock;
 
+       error_init (error);
        *werror = 0;
 
        mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
@@ -812,10 +823,11 @@ ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror,
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_Listen_internal(gsize sock, guint32 backlog, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Listen_internal(gsize sock, guint32 backlog, gint32 *werror, MonoError *error)
 {
        int ret;
        
+       error_init (error);
        *werror = 0;
 
        MONO_ENTER_GC_SAFE;
@@ -849,12 +861,10 @@ is_ipv4_mapped_any (const struct in6_addr *addr)
 }
 #endif
 
-static MonoObject*
-create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror, MonoError *error)
+static MonoObjectHandle
+create_object_handle_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror, MonoError *error)
 {
        MonoDomain *domain = mono_domain_get ();
-       MonoObject *sockaddr_obj;
-       MonoArray *data;
        MonoAddressFamily family;
 
        error_init (error);
@@ -862,8 +872,8 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
        /* Build a System.Net.SocketAddress object instance */
        if (!domain->sockaddr_class)
                domain->sockaddr_class = mono_class_load_from_name (get_socket_assembly (), "System.Net", "SocketAddress");
-       sockaddr_obj = mono_object_new_checked (domain, domain->sockaddr_class, error);
-       return_val_if_nok (error, NULL);
+       MonoObjectHandle sockaddr_obj = MONO_HANDLE_NEW (MonoObject, mono_object_new_checked (domain, domain->sockaddr_class, error));
+       return_val_if_nok (error, MONO_HANDLE_NEW (MonoObject, NULL));
        
        /* Locate the SocketAddress data buffer in the object */
        if (!domain->sockaddr_data_field) {
@@ -881,8 +891,8 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
         * the length of the entire sockaddr_in/in6, including
         * sizeof (unsigned short) of the family */
        /* We can't really avoid the +2 as all code below depends on this size - INCLUDING unix domain sockets.*/
-       data = mono_array_new_cached (domain, mono_get_byte_class (), sa_size + 2, error);
-       return_val_if_nok (error, NULL);
+       MonoArrayHandle data = mono_array_new_handle (domain, mono_get_byte_class (), sa_size + 2, error);
+       return_val_if_nok (error, MONO_HANDLE_NEW (MonoObject, NULL));
 
        /* The data buffer is laid out as follows:
         * bytes 0 and 1 are the address family
@@ -893,11 +903,11 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
        family = convert_to_mono_family (saddr->sa_family);
        if (family == AddressFamily_Unknown) {
                *werror = WSAEAFNOSUPPORT;
-               return NULL;
+               return MONO_HANDLE_NEW (MonoObject, NULL);
        }
 
-       mono_array_set (data, guint8, 0, family & 0x0FF);
-       mono_array_set (data, guint8, 1, (family >> 8) & 0x0FF);
+       MONO_HANDLE_ARRAY_SETVAL (data, guint8, 0, family & 0x0FF);
+       MONO_HANDLE_ARRAY_SETVAL (data, guint8, 1, (family >> 8) & 0x0FF);
        
        if (saddr->sa_family == AF_INET) {
                struct sockaddr_in *sa_in = (struct sockaddr_in *)saddr;
@@ -906,19 +916,19 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
                int buffer_size = 8;
                
                if (sa_size < buffer_size) {
-                       mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
-                       return NULL;
+                       mono_error_set_generic_error (error, "System", "SystemException", "");
+                       return MONO_HANDLE_NEW (MonoObject, NULL);
                }
                
-               mono_array_set (data, guint8, 2, (port>>8) & 0xff);
-               mono_array_set (data, guint8, 3, (port) & 0xff);
-               mono_array_set (data, guint8, 4, (address>>24) & 0xff);
-               mono_array_set (data, guint8, 5, (address>>16) & 0xff);
-               mono_array_set (data, guint8, 6, (address>>8) & 0xff);
-               mono_array_set (data, guint8, 7, (address) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 2, (port>>8) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 3, (port) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 4, (address>>24) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 5, (address>>16) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 6, (address>>8) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 7, (address) & 0xff);
        
-               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
-               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
+               mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_field, MONO_HANDLE_RAW (data)); /* FIXME: use handles for mono_field_set_value */
+               mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_length_field, &buffer_size); /* FIXME: use handles for mono_field_set_value */
 
                return sockaddr_obj;
        }
@@ -931,34 +941,34 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
                guint16 port = ntohs (sa_in->sin6_port);
 
                if (sa_size < buffer_size) {
-                       mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
-                       return NULL;
+                       mono_error_set_generic_error (error, "System", "SystemException", "");
+                       return MONO_HANDLE_NEW (MonoObject, NULL);
                }
 
-               mono_array_set (data, guint8, 2, (port>>8) & 0xff);
-               mono_array_set (data, guint8, 3, (port) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 2, (port>>8) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 3, (port) & 0xff);
                
                if (is_ipv4_mapped_any (&sa_in->sin6_addr)) {
                        // Map ::ffff:0:0 to :: (bug #5502)
                        for (i = 0; i < 16; i++)
-                               mono_array_set (data, guint8, 8 + i, 0);
+                               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 8 + i, 0);
                } else {
                        for (i = 0; i < 16; i++) {
-                               mono_array_set (data, guint8, 8 + i,
-                                                               sa_in->sin6_addr.s6_addr [i]);
+                               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 8 + i,
+                                                         sa_in->sin6_addr.s6_addr [i]);
                        }
                }
 
-               mono_array_set (data, guint8, 24, sa_in->sin6_scope_id & 0xff);
-               mono_array_set (data, guint8, 25,
-                                               (sa_in->sin6_scope_id >> 8) & 0xff);
-               mono_array_set (data, guint8, 26,
-                                               (sa_in->sin6_scope_id >> 16) & 0xff);
-               mono_array_set (data, guint8, 27,
-                                               (sa_in->sin6_scope_id >> 24) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 24, sa_in->sin6_scope_id & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 25,
+                                         (sa_in->sin6_scope_id >> 8) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 26,
+                                         (sa_in->sin6_scope_id >> 16) & 0xff);
+               MONO_HANDLE_ARRAY_SETVAL (data, guint8, 27,
+                                         (sa_in->sin6_scope_id >> 24) & 0xff);
 
-               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
-               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
+               mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_field, MONO_HANDLE_RAW (data)); /* FIXME: use handles for mono_field_set_value */
+               mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_length_field, &buffer_size); /* FIXME: use handles for mono_field_set_value */
 
                return sockaddr_obj;
        }
@@ -969,17 +979,17 @@ create_object_from_sockaddr (struct sockaddr *saddr, int sa_size, gint32 *werror
                int buffer_size = sa_size + 2;
 
                for (i = 0; i < sa_size; i++)
-                       mono_array_set (data, guint8, i + 2, saddr->sa_data [i]);
+                       MONO_HANDLE_ARRAY_SETVAL (data, guint8, i + 2, saddr->sa_data [i]);
                
-               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_field, data);
-               mono_field_set_value (sockaddr_obj, domain->sockaddr_data_length_field, &buffer_size);
+               mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_field, MONO_HANDLE_RAW (data)); /* FIXME: use handles for mono_field_set_value */
+               mono_field_set_value (MONO_HANDLE_RAW (sockaddr_obj), domain->sockaddr_data_length_field, &buffer_size); /* FIXME: use handles for mono_field_set_value */
 
                return sockaddr_obj;
        }
 #endif
        else {
                *werror = WSAEAFNOSUPPORT;
-               return NULL;
+               return MONO_HANDLE_NEW (MonoObject, NULL);
        }
 }
 
@@ -1005,14 +1015,12 @@ get_sockaddr_size (int family)
        return size;
 }
 
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror)
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error)
 {
        gchar *sa;
        socklen_t salen;
        int ret;
-       MonoObject *result;
-       MonoError error;
        
        *werror = 0;
        
@@ -1033,34 +1041,31 @@ ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 a
                *werror = mono_w32socket_get_last_error ();
                if (salen > 128)
                        g_free (sa);
-               return NULL;
+               return NULL_HANDLE;
        }
        
        LOGDEBUG (g_message("%s: bound to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)&sa)->sin_addr), ntohs (((struct sockaddr_in *)&sa)->sin_port)));
 
-       result = create_object_from_sockaddr ((struct sockaddr *)sa, salen, werror, &error);
+       MonoObjectHandle result = create_object_handle_from_sockaddr ((struct sockaddr *)sa, salen, werror, error);
        if (salen > 128)
                g_free (sa);
-       if (!mono_error_ok (&error))
-               mono_error_set_pending_exception (&error);
        return result;
 }
 
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror)
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error)
 {
        gchar *sa;
        socklen_t salen;
        int ret;
-       MonoObject *result;
-       MonoError error;
        
+       error_init (error);
        *werror = 0;
        
        salen = get_sockaddr_size (convert_family ((MonoAddressFamily)af));
        if (salen == 0) {
                *werror = WSAEAFNOSUPPORT;
-               return NULL;
+               return MONO_HANDLE_NEW (MonoObject, NULL);
        }
        sa = (salen <= 128) ? (gchar *)alloca (salen) : (gchar *)g_malloc0 (salen);
        /* Note: linux returns just 2 for AF_UNIX. Always. */
@@ -1075,24 +1080,21 @@ ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32
                *werror = mono_w32socket_get_last_error ();
                if (salen > 128)
                        g_free (sa);
-               return NULL;
+               return MONO_HANDLE_NEW (MonoObject, NULL);
        }
        
        LOGDEBUG (g_message("%s: connected to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)&sa)->sin_addr), ntohs (((struct sockaddr_in *)&sa)->sin_port)));
 
-       result = create_object_from_sockaddr ((struct sockaddr *)sa, salen, werror, &error);
+       MonoObjectHandle result = create_object_handle_from_sockaddr ((struct sockaddr *)sa, salen, werror, error);
        if (salen > 128)
                g_free (sa);
-       if (!mono_error_ok (&error))
-               mono_error_set_pending_exception (&error);
        return result;
 }
 
 static struct sockaddr*
-create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error)
+create_sockaddr_from_handle (MonoObjectHandle saddr_obj, socklen_t *sa_size, gint32 *werror, MonoError *error)
 {
        MonoDomain *domain = mono_domain_get ();
-       MonoArray *data;
        gint32 family;
        int len;
 
@@ -1113,7 +1115,7 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
                g_assert (domain->sockaddr_data_length_field);
        }
 
-       data = *(MonoArray **)(((char *)saddr_obj) + domain->sockaddr_data_field->offset);
+       MonoArrayHandle data = MONO_HANDLE_NEW_GET_FIELD (saddr_obj, MonoArray, domain->sockaddr_data_field);
 
        /* The data buffer is laid out as follows:
         * byte 0 is the address family low byte
@@ -1124,33 +1126,33 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
         * UNIX:
         *      the rest is the file name
         */
-       len = *(int *)(((char *)saddr_obj) + domain->sockaddr_data_length_field->offset);
+       len = MONO_HANDLE_GET_FIELD_VAL (saddr_obj, int, domain->sockaddr_data_length_field);
        g_assert (len >= 2);
 
-       family = convert_family ((MonoAddressFamily)(mono_array_get (data, guint8, 0) + (mono_array_get (data, guint8, 1) << 8)));
+       uint32_t gchandle;
+       guint8 *buf = MONO_ARRAY_HANDLE_PIN (data, guint8, 0, &gchandle);
+       family = convert_family ((MonoAddressFamily)(buf[0] + (buf[1] << 8)));
        if (family == AF_INET) {
                struct sockaddr_in *sa;
                guint16 port;
                guint32 address;
                
                if (len < 8) {
-                       mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
+                       mono_error_set_generic_error (error, "System", "SystemException", "");
+                       mono_gchandle_free (gchandle);
                        return NULL;
                }
 
                sa = g_new0 (struct sockaddr_in, 1);
-               port = (mono_array_get (data, guint8, 2) << 8) +
-                       mono_array_get (data, guint8, 3);
-               address = (mono_array_get (data, guint8, 4) << 24) +
-                       (mono_array_get (data, guint8, 5) << 16 ) +
-                       (mono_array_get (data, guint8, 6) << 8) +
-                       mono_array_get (data, guint8, 7);
+               port = (buf[2] << 8) + buf[3];
+               address = (buf[4] << 24) + (buf[5] << 16) + (buf[6] << 8) + buf[7];
 
                sa->sin_family = family;
                sa->sin_addr.s_addr = htonl (address);
                sa->sin_port = htons (port);
 
                *sa_size = sizeof (struct sockaddr_in);
+               mono_gchandle_free (gchandle);
                return (struct sockaddr *)sa;
        }
 #ifdef HAVE_STRUCT_SOCKADDR_IN6
@@ -1161,26 +1163,24 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
                guint32 scopeid;
                
                if (len < 28) {
-                       mono_error_set_exception_instance (error, mono_exception_from_name (mono_get_corlib (), "System", "SystemException"));
+                       mono_error_set_generic_error (error, "System", "SystemException", "");
+                       mono_gchandle_free (gchandle);
                        return NULL;
                }
 
                sa = g_new0 (struct sockaddr_in6, 1);
-               port = mono_array_get (data, guint8, 3) +
-                       (mono_array_get (data, guint8, 2) << 8);
-               scopeid = mono_array_get (data, guint8, 24) + 
-                       (mono_array_get (data, guint8, 25) << 8) + 
-                       (mono_array_get (data, guint8, 26) << 16) + 
-                       (mono_array_get (data, guint8, 27) << 24);
+               port = buf[3] + (buf[2] << 8);
+               scopeid = buf[24] + (buf[25] << 8) + (buf[26] << 16) + (buf[27] << 24);
 
                sa->sin6_family = family;
                sa->sin6_port = htons (port);
                sa->sin6_scope_id = scopeid;
 
                for (i = 0; i < 16; i++)
-                       sa->sin6_addr.s6_addr [i] = mono_array_get (data, guint8, 8 + i);
+                       sa->sin6_addr.s6_addr [i] = buf[8 + i];
 
                *sa_size = sizeof (struct sockaddr_in6);
+               mono_gchandle_free (gchandle);
                return (struct sockaddr *)sa;
        }
 #endif
@@ -1194,6 +1194,7 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
                 */
                if (len - 2 >= sizeof (sock_un->sun_path)) {
                        mono_error_set_exception_instance (error, mono_get_exception_index_out_of_range ());
+                       mono_gchandle_free (gchandle);
                        return NULL;
                }
                
@@ -1201,35 +1202,34 @@ create_sockaddr_from_object (MonoObject *saddr_obj, socklen_t *sa_size, gint32 *
 
                sock_un->sun_family = family;
                for (i = 0; i < len - 2; i++)
-                       sock_un->sun_path [i] = mono_array_get (data, guint8, i + 2);
+                       sock_un->sun_path [i] = buf[i + 2];
                
                *sa_size = len;
+               mono_gchandle_free (gchandle);
                return (struct sockaddr *)sock_un;
        }
 #endif
        else {
                *werror = WSAEAFNOSUPPORT;
+               mono_gchandle_free (gchandle);
                return 0;
        }
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObject *sockaddr, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, MonoError *error)
 {
-       MonoError error;
        struct sockaddr *sa;
        socklen_t sa_size;
        int ret;
        
+       error_init (error);
        *werror = 0;
        
-       sa = create_sockaddr_from_object (sockaddr, &sa_size, werror, &error);
+       sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
        if (*werror != 0)
                return;
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
+       return_if_nok (error);
 
        LOGDEBUG (g_message("%s: binding to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port)));
 
@@ -1249,7 +1249,7 @@ enum {
 
 MonoBoolean
 ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode,
-                                                                                                  gint timeout, gint32 *werror)
+                                                  gint timeout, gint32 *werror, MonoError *error)
 {
        MonoInternalThread *thread = mono_thread_internal_current ();
        mono_pollfd *pfds;
@@ -1257,6 +1257,7 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode,
        gboolean interrupted;
        time_t start;
 
+       error_init (error);
        *werror = 0;
 
        pfds = g_new0 (mono_pollfd, 1);
@@ -1334,23 +1335,20 @@ ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode,
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObject *sockaddr, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error)
 {
-       MonoError error;
        struct sockaddr *sa;
        socklen_t sa_size;
        int ret;
        gboolean interrupted;
 
+       error_init  (error);
        *werror = 0;
 
-       sa = create_sockaddr_from_object (sockaddr, &sa_size, werror, &error);
+       sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
        if (*werror != 0)
                return;
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return;
-       }
+       return_if_nok (error);
 
        LOGDEBUG (g_message("%s: connecting to %s port %d", __func__, inet_ntoa (((struct sockaddr_in *)sa)->sin_addr), ntohs (((struct sockaddr_in *)sa)->sin_port)));
 
@@ -1377,10 +1375,12 @@ ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObject *so
 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
 
 void
-ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error)
 {
        gboolean interrupted;
 
+       error_init (error);
+
        LOGDEBUG (g_message("%s: disconnecting from socket %p (reuse %d)", __func__, sock, reuse));
 
        mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
@@ -1400,23 +1400,21 @@ ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean
 #endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT) */
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
 {
        int ret;
-       gchar *buf;
        gint32 alen;
        int recvflags = 0;
        gboolean interrupted;
        MonoInternalThread* curthread G_GNUC_UNUSED = mono_thread_internal_current ();
        
+       error_init (error);
        *werror = 0;
        
-       alen = mono_array_length (buffer);
+       alen = mono_array_handle_length (buffer);
        if (offset > alen - count)
                return 0;
        
-       buf = mono_array_addr (buffer, gchar, offset);
-       
        recvflags = convert_socketflags (flags);
        if (recvflags == -1) {
                *werror = WSAEOPNOTSUPP;
@@ -1427,10 +1425,15 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArray *buf
        if (interrupted)
                return 0;
 
+       uint32_t gchandle;
+       gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_recv (sock, buf, count, recvflags, blocking);
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+       
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 
@@ -1445,18 +1448,17 @@ ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArray *buf
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
 {
        int ret, count;
        gboolean interrupted;
        guint32 recv;
-       WSABUF *wsabufs;
        guint32 recvflags = 0;
        
+       error_init (error);
        *werror = 0;
        
-       wsabufs = mono_array_addr (buffers, WSABUF, 0);
-       count = mono_array_length (buffers);
+       count = mono_array_handle_length (buffers);
        
        recvflags = convert_socketflags (flags);
        if (recvflags == -1) {
@@ -1470,10 +1472,15 @@ ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArra
                return 0;
        }
 
+       uint32_t gchandle;
+       WSABUF *wsabufs = MONO_ARRAY_HANDLE_PIN (buffers, WSABUF, 0, &gchandle);
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_recvbuffers (sock, wsabufs, count, &recv, &recvflags, NULL, NULL, blocking);
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 
@@ -1488,9 +1495,8 @@ ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArra
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error)
 {
-       MonoError error;
        int ret;
        gchar *buf;
        gint32 alen;
@@ -1499,21 +1505,18 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray
        socklen_t sa_size;
        gboolean interrupted;
        
+       error_init (error);
        *werror = 0;
        
-       alen = mono_array_length (buffer);
+       alen = mono_array_handle_length (buffer);
        if (offset > alen - count)
                return 0;
 
-       sa = create_sockaddr_from_object (*sockaddr, &sa_size, werror, &error);
+       sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
        if (*werror != 0)
                return 0;
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
+       if (!is_ok (error))
                return 0;
-       }
-       
-       buf = mono_array_addr (buffer, gchar, offset);
        
        recvflags = convert_socketflags (flags);
        if (recvflags == -1) {
@@ -1528,10 +1531,15 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray
                return 0;
        }
 
+       uint32_t gchandle;
+       buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_recvfrom (sock, buf, count, recvflags, sa, &sa_size, blocking);
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 
@@ -1550,14 +1558,13 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray
         * returned the remote address. All we can do is return null.
         */
        if (sa_size) {
-               *sockaddr = create_object_from_sockaddr (sa, sa_size, werror, &error);
-               if (!mono_error_ok (&error)) {
-                       mono_error_set_pending_exception (&error);
+               MONO_HANDLE_ASSIGN (sockaddr, create_object_handle_from_sockaddr (sa, sa_size, werror, error));
+               if (!is_ok (error)) {
                        g_free (sa);
                        return 0;
                }
        } else {
-               *sockaddr = NULL;
+               MONO_HANDLE_ASSIGN (sockaddr, MONO_HANDLE_NEW (MonoObject, NULL));
        }
 
        g_free (sa);
@@ -1566,24 +1573,22 @@ ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
 {
        int ret;
-       gchar *buf;
        gint32 alen;
        int sendflags = 0;
        gboolean interrupted;
        
+       error_init (error);
        *werror = 0;
        
-       alen = mono_array_length (buffer);
+       alen = mono_array_handle_length (buffer);
        if (offset > alen - count)
                return 0;
 
        LOGDEBUG (g_message("%s: alen: %d", __func__, alen));
        
-       buf = mono_array_addr (buffer, gchar, offset);
-
        LOGDEBUG (g_message("%s: Sending %d bytes", __func__, count));
 
        sendflags = convert_socketflags (flags);
@@ -1598,10 +1603,15 @@ ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArray *buffer
                return 0;
        }
 
+       uint32_t gchandle;
+       gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_send (sock, buf, count, sendflags, blocking);
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 
@@ -1616,18 +1626,17 @@ ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArray *buffer
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags, gint32 *werror, gboolean blocking, MonoError *error)
 {
        int ret, count;
        guint32 sent;
-       WSABUF *wsabufs;
        guint32 sendflags = 0;
        gboolean interrupted;
        
+       error_init (error);
        *werror = 0;
        
-       wsabufs = mono_array_addr (buffers, WSABUF, 0);
-       count = mono_array_length (buffers);
+       count = mono_array_handle_length (buffers);
        
        sendflags = convert_socketflags (flags);
        if (sendflags == -1) {
@@ -1641,10 +1650,15 @@ ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArray *
                return 0;
        }
 
+       uint32_t gchandle;
+       WSABUF *wsabufs = MONO_ARRAY_HANDLE_PIN (buffers, WSABUF, 0, &gchandle);
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_sendbuffers (sock, wsabufs, count, &sent, sendflags, NULL, NULL, blocking);
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 
@@ -1659,11 +1673,9 @@ ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArray *
 }
 
 gint32
-ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count, gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error)
 {
-       MonoError error;
        int ret;
-       gchar *buf;
        gint32 alen;
        int sendflags = 0;
        struct sockaddr *sa;
@@ -1672,23 +1684,18 @@ ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buff
        
        *werror = 0;
        
-       alen = mono_array_length (buffer);
+       alen = mono_array_handle_length (buffer);
        if (offset > alen - count) {
                return 0;
        }
 
-       sa = create_sockaddr_from_object(sockaddr, &sa_size, werror, &error);
+       sa = create_sockaddr_from_handle (sockaddr, &sa_size, werror, error);
        if (*werror != 0)
                return 0;
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
-               return 0;
-       }
+       return_val_if_nok (error, 0);
        
        LOGDEBUG (g_message ("%s: alen: %d", __func__, alen));
        
-       buf = mono_array_addr (buffer, gchar, offset);
-
        LOGDEBUG (g_message("%s: Sending %d bytes", __func__, count));
 
        sendflags = convert_socketflags (flags);
@@ -1705,10 +1712,15 @@ ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buff
                return 0;
        }
 
+       uint32_t gchandle;
+       gchar *buf = MONO_ARRAY_HANDLE_PIN (buffer, gchar, offset, &gchandle);
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_sendto (sock, buf, count, sendflags, sa, sa_size, blocking);
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 
@@ -1725,63 +1737,103 @@ ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buff
 }
 
 static SOCKET
-Socket_to_SOCKET (MonoObject *sockobj)
+Socket_to_SOCKET (MonoObjectHandle sockobj)
 {
-       MonoSafeHandle *safe_handle;
        MonoClassField *field;
        
-       field = mono_class_get_field_from_name (sockobj->vtable->klass, "m_Handle");
-       safe_handle = ((MonoSafeHandle *)(*(gpointer *)(((char *)sockobj) + field->offset)));
+       field = mono_class_get_field_from_name (mono_handle_class (sockobj), "m_Handle");
+       MonoSafeHandleHandle safe_handle = MONO_HANDLE_NEW_GET_FIELD(sockobj, MonoSafeHandle, field);
 
-       if (safe_handle == NULL)
+       if (MONO_HANDLE_IS_NULL (safe_handle))
                return -1;
 
-       return (SOCKET)safe_handle->handle;
+       return (SOCKET)MONO_HANDLE_GETVAL (safe_handle, handle);
 }
 
 #define POLL_ERRORS (MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL)
 
+static gboolean
+collect_pollfds_from_array (MonoArrayHandle sockets, int i, int nfds, mono_pollfd *pfds, int *idx, int *mode)
+{
+       HANDLE_FUNCTION_ENTER ();
+       gboolean result = TRUE;
+       MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, NULL);
+       MONO_HANDLE_ARRAY_GETREF (obj, sockets, i);
+       if (MONO_HANDLE_IS_NULL (obj)) {
+               (*mode)++;
+               goto leave;
+       }
+
+       if (*idx >= nfds) {
+               result = FALSE;
+               goto leave;
+       }
+
+       pfds [*idx].fd = Socket_to_SOCKET (obj);
+       pfds [*idx].events = (*mode == 0) ? MONO_POLLIN : (*mode == 1) ? MONO_POLLOUT : POLL_ERRORS;
+       (*idx)++;
+leave:
+       HANDLE_FUNCTION_RETURN_VAL (result);
+}
+
+static void
+set_socks_array_from_pollfds (MonoArrayHandle sockets, int i, mono_pollfd *pfds, int *ret, int *mode, MonoArrayHandle socks, int *idx)
+{
+       HANDLE_FUNCTION_ENTER ();
+       mono_pollfd *pfd;
+
+       MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, NULL);
+       MONO_HANDLE_ARRAY_GETREF (obj, sockets, i);
+       if (MONO_HANDLE_IS_NULL (obj)) {
+               (*mode)++;
+               (*idx)++;
+               goto leave;
+       }
+
+       pfd = &pfds [i - *mode];
+       if (pfd->revents == 0)
+               goto leave;
+
+       (*ret)--;
+       if (((*mode == 0 && (pfd->revents & (MONO_POLLIN | POLL_ERRORS)) != 0)) ||
+           ((*mode == 1 && (pfd->revents & (MONO_POLLOUT | POLL_ERRORS)) != 0)) ||
+           ((pfd->revents & POLL_ERRORS) != 0)) {
+               MONO_HANDLE_ARRAY_SETREF (socks, *idx, obj);
+               (*idx)++;
+       }
+leave:
+       HANDLE_FUNCTION_RETURN ();
+}
+
 void
-ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32 timeout, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gint32 timeout, gint32 *werror, MonoError *error)
 {
-       MonoError error;
        MonoInternalThread *thread = mono_thread_internal_current ();
-       MonoObject *obj;
        mono_pollfd *pfds;
        int nfds, idx;
        int ret;
        int i, count;
        int mode;
        MonoClass *sock_arr_class;
-       MonoArray *socks;
        time_t start;
        uintptr_t socks_size;
        gboolean interrupted;
 
+       error_init (error);
        *werror = 0;
 
        /* *sockets -> READ, null, WRITE, null, ERROR, null */
-       count = mono_array_length (*sockets);
+       count = mono_array_handle_length (sockets);
        nfds = count - 3; /* NULL separators */
        pfds = g_new0 (mono_pollfd, nfds);
        mode = idx = 0;
        for (i = 0; i < count; i++) {
-               obj = mono_array_get (*sockets, MonoObject *, i);
-               if (obj == NULL) {
-                       mode++;
-                       continue;
-               }
-
-               if (idx >= nfds) {
+               if (!collect_pollfds_from_array (sockets, i, nfds, pfds, &idx, &mode)) {
                        /* The socket array was bogus */
                        g_free (pfds);
                        *werror = WSAEFAULT;
                        return;
                }
-
-               pfds [idx].fd = Socket_to_SOCKET (obj);
-               pfds [idx].events = (mode == 0) ? MONO_POLLIN : (mode == 1) ? MONO_POLLOUT : POLL_ERRORS;
-               idx++;
        }
 
        timeout = (timeout >= 0) ? (timeout / 1000) : -1;
@@ -1820,7 +1872,7 @@ ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32
                if (ret == -1 && errno == EINTR) {
                        if (mono_thread_test_state (thread, ThreadState_AbortRequested)) {
                                g_free (pfds);
-                               *sockets = NULL;
+                               MONO_HANDLE_ASSIGN (sockets, MONO_HANDLE_NEW (MonoObject, NULL));
                                return;
                        }
 
@@ -1839,56 +1891,35 @@ ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32
 
        if (ret == 0) {
                g_free (pfds);
-               *sockets = NULL;
+               MONO_HANDLE_ASSIGN (sockets, MONO_HANDLE_NEW (MonoObject, NULL));
                return;
        }
 
-       sock_arr_class = ((MonoObject *)*sockets)->vtable->klass;
+       sock_arr_class = mono_handle_class (sockets);
        socks_size = ((uintptr_t)ret) + 3; /* space for the NULL delimiters */
-       socks = mono_array_new_full_checked (mono_domain_get (), sock_arr_class, &socks_size, NULL, &error);
-       if (!mono_error_ok (&error)) {
-               mono_error_set_pending_exception (&error);
+       MonoArrayHandle socks = MONO_HANDLE_NEW (MonoArray, mono_array_new_full_checked (mono_domain_get (), sock_arr_class, &socks_size, NULL, error));
+       if (!is_ok (error)) {
                g_free (pfds);
                return;
        }
 
        mode = idx = 0;
        for (i = 0; i < count && ret > 0; i++) {
-               mono_pollfd *pfd;
-
-               obj = mono_array_get (*sockets, MonoObject *, i);
-               if (obj == NULL) {
-                       mode++;
-                       idx++;
-                       continue;
-               }
-
-               pfd = &pfds [i - mode];
-               if (pfd->revents == 0)
-                       continue;
-
-               ret--;
-               if (mode == 0 && (pfd->revents & (MONO_POLLIN | POLL_ERRORS)) != 0) {
-                       mono_array_setref (socks, idx++, obj);
-               } else if (mode == 1 && (pfd->revents & (MONO_POLLOUT | POLL_ERRORS)) != 0) {
-                       mono_array_setref (socks, idx++, obj);
-               } else if ((pfd->revents & POLL_ERRORS) != 0) {
-                       mono_array_setref (socks, idx++, obj);
-               }
+               set_socks_array_from_pollfds (sockets, i, pfds, &ret, &mode, socks, &idx);
        }
 
-       *sockets = socks;
+       MONO_HANDLE_ASSIGN (sockets, socks);
        g_free (pfds);
 }
 
-static MonoObject*
-int_to_object (MonoDomain *domain, int val, MonoError *error)
+static MonoObjectHandle
+int_to_object_handle (MonoDomain *domain, int val, MonoError *error)
 {
-       return mono_value_box_checked (domain, mono_get_int32_class (), &val, error);
+       return MONO_HANDLE_NEW (MonoObject, mono_value_box_checked (domain, mono_get_int32_class (), &val, error));
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name, MonoObject **obj_val, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name, MonoObjectHandle obj_val, gint32 *werror, MonoError *error)
 {
        int system_level = 0;
        int system_name = 0;
@@ -1907,12 +1938,11 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi
 #  endif
        socklen_t credsize = sizeof (cred);
 #endif
-       MonoError error;
        MonoDomain *domain = mono_domain_get ();
-       MonoObject *obj;
        MonoClass *obj_class;
        MonoClassField *field;
        
+       error_init (error);
        *werror = 0;
        
 #if !defined(SO_EXCLUSIVEADDRUSE) && defined(SO_REUSEADDR)
@@ -1931,8 +1961,7 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi
                return;
        }
        if (ret == -2) {
-               *obj_val = int_to_object (domain, 0, &error);
-               mono_error_set_pending_exception (&error);
+               MONO_HANDLE_ASSIGN (obj_val, int_to_object_handle (domain, 0, error));
                return;
        }
 
@@ -1971,36 +2000,42 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi
        }
        
        switch (name) {
-       case SocketOptionName_Linger:
+       case SocketOptionName_Linger: {
                /* build a System.Net.Sockets.LingerOption */
                obj_class = mono_class_load_from_name (get_socket_assembly (),
                                                                                           "System.Net.Sockets",
                                                                                           "LingerOption");
-               obj = mono_object_new_checked (domain, obj_class, &error);
-               if (!mono_error_ok (&error)) {
-                       mono_error_set_pending_exception (&error);
-                       return;
-               }
+               MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_object_new_checked (domain, obj_class, error));
+               return_if_nok (error);
 
                /* Locate and set the fields "bool enabled" and "int
                 * lingerTime"
                 */
                field = mono_class_get_field_from_name(obj_class, "enabled");
-               *(guint8 *)(((char *)obj)+field->offset) = linger.l_onoff;
+               MONO_HANDLE_SET_FIELD_VAL (obj, guint8, field, linger.l_onoff);
 
                field = mono_class_get_field_from_name(obj_class, "lingerTime");
-               *(guint32 *)(((char *)obj)+field->offset)=linger.l_linger;
+               MONO_HANDLE_SET_FIELD_VAL (obj, guint32, field, linger.l_linger);
+
+               MONO_HANDLE_ASSIGN (obj_val, obj);
                break;
-       case SocketOptionName_DontLinger:
+       }
+       case SocketOptionName_DontLinger: {
                /* construct a bool int in val - true if linger is off */
-               obj = int_to_object (domain, !linger.l_onoff, &error);
-               mono_error_set_pending_exception (&error);
+               MonoObjectHandle obj = int_to_object_handle (domain, !linger.l_onoff, error);
+               return_if_nok (error);
+
+               MONO_HANDLE_ASSIGN (obj_val, obj);
                break;
+       }
        case SocketOptionName_SendTimeout:
-       case SocketOptionName_ReceiveTimeout:
-               obj = int_to_object (domain, time_ms, &error);
-               mono_error_set_pending_exception (&error);
+       case SocketOptionName_ReceiveTimeout: {
+               MonoObjectHandle obj = int_to_object_handle (domain, time_ms, error);
+               return_if_nok (error);
+
+               MONO_HANDLE_ASSIGN (obj_val, obj);
                break;
+       }
 
 #ifdef SO_PEERCRED
        case SocketOptionName_PeerCred:  {
@@ -2009,7 +2044,6 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi
                 * possible
                 */
                static MonoImage *mono_posix_image = NULL;
-               MonoPeerCredData *cred_data;
                
                if (mono_posix_image == NULL) {
                        mono_posix_image = mono_image_loaded ("Mono.Posix");
@@ -2027,40 +2061,40 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gi
                obj_class = mono_class_load_from_name (mono_posix_image,
                                                 "Mono.Posix",
                                                 "PeerCredData");
-               obj = mono_object_new_checked (domain, obj_class, &error);
-               if (!mono_error_ok (&error)) {
-                       mono_error_set_pending_exception (&error);
-                       return;
-               }
-               cred_data = (MonoPeerCredData *)obj;
-               cred_data->pid = cred.pid;
-               cred_data->uid = cred.uid;
-               cred_data->gid = cred.gid;
+               MonoPeerCredDataHandle cred_data = MONO_HANDLE_NEW (MonoPeerCredData, mono_object_new_checked (domain, obj_class, error));
+               return_if_nok (error);
+
+               MONO_HANDLE_SETVAL (cred_data, pid, gint, cred.pid);
+               MONO_HANDLE_SETVAL (cred_data, uid, gint, cred.uid);
+               MONO_HANDLE_SETVAL (cred_data, gid, gint, cred.gid);
+
+               MONO_HANDLE_ASSIGN (obj_val, cred_data);
                break;
        }
 #endif
 
-       default:
+       default: {
 #if !defined(SO_EXCLUSIVEADDRUSE) && defined(SO_REUSEADDR)
                if (level == SocketOptionLevel_Socket && name == SocketOptionName_ExclusiveAddressUse)
                        val = val ? 0 : 1;
 #endif
-               obj = int_to_object (domain, val, &error);
-               mono_error_set_pending_exception (&error);
-       }
+               MonoObjectHandle obj = int_to_object_handle (domain, val, error);
+               return_if_nok (error);
 
-       *obj_val = obj;
+               MONO_HANDLE_ASSIGN (obj_val, obj);
+       }
+       }
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name, MonoArray **byte_val, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name, MonoArrayHandle byte_val, gint32 *werror, MonoError *error)
 {
        int system_level = 0;
        int system_name = 0;
        int ret;
-       guchar *buf;
        socklen_t valsize;
        
+       error_init (error);
        *werror = 0;
        
        ret = convert_sockopt_level_and_name((MonoSocketOptionLevel)level, (MonoSocketOptionName)name, &system_level,
@@ -2072,8 +2106,10 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gi
        if (ret == -2)
                return;
 
-       valsize = mono_array_length (*byte_val);
-       buf = mono_array_addr (*byte_val, guchar, 0);
+       valsize = mono_array_handle_length (byte_val);
+
+       uint32_t gchandle;
+       guchar *buf = MONO_ARRAY_HANDLE_PIN (byte_val, guchar, 0, &gchandle);
 
        MONO_ENTER_GC_SAFE;
 
@@ -2081,43 +2117,47 @@ ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gi
 
        MONO_EXIT_GC_SAFE;
 
+       mono_gchandle_free (gchandle);
+
        if (ret == SOCKET_ERROR)
                *werror = mono_w32socket_get_last_error ();
 }
 
 #if defined(HAVE_STRUCT_IP_MREQN) || defined(HAVE_STRUCT_IP_MREQ)
 static struct in_addr
-ipaddress_to_struct_in_addr (MonoObject *ipaddr)
+ipaddress_handle_to_struct_in_addr (MonoObjectHandle ipaddr)
 {
        struct in_addr inaddr;
        MonoClassField *field;
        
-       field = mono_class_get_field_from_name (ipaddr->vtable->klass, "m_Address");
+       field = mono_class_get_field_from_name (mono_handle_class (ipaddr), "m_Address");
+       g_assert (field);
 
        /* No idea why .net uses a 64bit type to hold a 32bit value...
         *
         * Internal value of IPAddess is in little-endian order
         */
-       inaddr.s_addr = GUINT_FROM_LE ((guint32)*(guint64 *)(((char *)ipaddr) + field->offset));
+       inaddr.s_addr = GUINT_FROM_LE ((guint32)MONO_HANDLE_GET_FIELD_VAL (ipaddr, guint64, field));
        
        return inaddr;
 }
 
 #ifdef HAVE_STRUCT_SOCKADDR_IN6
 static struct in6_addr
-ipaddress_to_struct_in6_addr (MonoObject *ipaddr)
+ipaddress_handle_to_struct_in6_addr (MonoObjectHandle ipaddr)
 {
        struct in6_addr in6addr;
        MonoClassField *field;
-       MonoArray *data;
        int i;
 
-       field = mono_class_get_field_from_name (ipaddr->vtable->klass, "m_Numbers");
+       field = mono_class_get_field_from_name (mono_handle_class (ipaddr), "m_Numbers");
        g_assert (field);
-       data = *(MonoArray **)(((char *)ipaddr) + field->offset);
+       MonoArrayHandle data = MONO_HANDLE_NEW_GET_FIELD (ipaddr, MonoArray, field);
 
        for (i = 0; i < 8; i++) {
-               const guint16 s = GUINT16_TO_BE (mono_array_get (data, guint16, i));
+               guint16 v;
+               MONO_HANDLE_ARRAY_GETVAL (v, data, guint16, i);
+               const guint16 s = GUINT16_TO_BE (v);
 
 /* Solaris/MacOS have only the 8 bit version. */
 #ifndef s6_addr16
@@ -2168,7 +2208,7 @@ get_local_interface_id (int family)
 #endif /* defined(__APPLE__) || defined(__FreeBSD__) */
 
 void
-ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name, MonoObjectHandle obj_val, MonoArrayHandle byte_val, gint32 int_val, gint32 *werror, MonoError *error)
 {
        struct linger linger;
        int system_level = 0;
@@ -2177,6 +2217,7 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
        int sol_ip;
        int sol_ipv6;
 
+       error_init (error);
        *werror = 0;
 
        sol_ipv6 = mono_networking_get_ipv6_protocol ();
@@ -2201,7 +2242,8 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                return;
 
        /* Only one of obj_val, byte_val or int_val has data */
-       if (obj_val) {
+       if (!MONO_HANDLE_IS_NULL (obj_val)) {
+               MonoClass *obj_class = mono_handle_class (obj_val);
                MonoClassField *field;
                int valsize;
                
@@ -2210,10 +2252,10 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                        /* Dig out "bool enabled" and "int lingerTime"
                         * fields
                         */
-                       field = mono_class_get_field_from_name (obj_val->vtable->klass, "enabled");
-                       linger.l_onoff = *(guint8 *)(((char *)obj_val) + field->offset);
-                       field = mono_class_get_field_from_name (obj_val->vtable->klass, "lingerTime");
-                       linger.l_linger = *(guint32 *)(((char *)obj_val) + field->offset);
+                       field = mono_class_get_field_from_name (obj_class, "enabled");
+                       linger.l_onoff = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint8, field);
+                       field = mono_class_get_field_from_name (obj_class, "lingerTime");
+                       linger.l_linger = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint32, field);
                        
                        valsize = sizeof (linger);
                        ret = mono_w32socket_setsockopt (sock, system_level, system_name, &linger, valsize);
@@ -2222,7 +2264,7 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                case SocketOptionName_DropMembership:
 #if defined(HAVE_STRUCT_IP_MREQN) || defined(HAVE_STRUCT_IP_MREQ)
                {
-                       MonoObject *address = NULL;
+                       MonoObjectHandle address = MONO_HANDLE_NEW (MonoObject, NULL);
 #ifdef HAVE_STRUCT_SOCKADDR_IN6
                        if (system_level == sol_ipv6) {
                                struct ipv6_mreq mreq6;
@@ -2230,15 +2272,15 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                                /*
                                 *      Get group address
                                 */
-                               field = mono_class_get_field_from_name (obj_val->vtable->klass, "m_Group");
+                               field = mono_class_get_field_from_name (obj_class, "m_Group");
                                g_assert (field);
-                               address = *(MonoObject **)(((char *)obj_val) + field->offset);
+                               MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field));
                                
-                               if (address)
-                                       mreq6.ipv6mr_multiaddr = ipaddress_to_struct_in6_addr (address);
+                               if (!MONO_HANDLE_IS_NULL (address))
+                                       mreq6.ipv6mr_multiaddr = ipaddress_handle_to_struct_in6_addr (address);
 
-                               field = mono_class_get_field_from_name (obj_val->vtable->klass, "m_Interface");
-                               mreq6.ipv6mr_interface = *(guint64 *)(((char *)obj_val) + field->offset);
+                               field = mono_class_get_field_from_name (obj_class, "m_Interface");
+                               mreq6.ipv6mr_interface = MONO_HANDLE_GET_FIELD_VAL (obj_val, guint64, field);
                                
 #if defined(__APPLE__) || defined(__FreeBSD__)
                                /*
@@ -2272,26 +2314,26 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                                 * members, so I have to dig the value out of
                                 * those :-(
                                 */
-                               field = mono_class_get_field_from_name (obj_val->vtable->klass, "group");
-                               address = *(MonoObject **)(((char *)obj_val) + field->offset);
+                               field = mono_class_get_field_from_name (obj_class, "group");
+                               MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field));
 
                                /* address might not be defined and if so, set the address to ADDR_ANY.
                                 */
-                               if (address)
-                                       mreq.imr_multiaddr = ipaddress_to_struct_in_addr (address);
+                               if (!MONO_HANDLE_IS_NULL (address))
+                                       mreq.imr_multiaddr = ipaddress_handle_to_struct_in_addr (address);
 
-                               field = mono_class_get_field_from_name (obj_val->vtable->klass, "localAddress");
-                               address = *(MonoObject **)(((char *)obj_val) + field->offset);
+                               field = mono_class_get_field_from_name (obj_class, "localAddress");
+                               MONO_HANDLE_ASSIGN (address, MONO_HANDLE_NEW_GET_FIELD (obj_val, MonoObject, field));
 
 #ifdef HAVE_STRUCT_IP_MREQN
-                               if (address)
-                                       mreq.imr_address = ipaddress_to_struct_in_addr (address);
+                               if (!MONO_HANDLE_IS_NULL (address))
+                                       mreq.imr_address = ipaddress_handle_to_struct_in_addr (address);
 
-                               field = mono_class_get_field_from_name (obj_val->vtable->klass, "ifIndex");
-                               mreq.imr_ifindex = *(gint32 *)(((char *)obj_val) + field->offset);
+                               field = mono_class_get_field_from_name (obj_class, "ifIndex");
+                               mreq.imr_ifindex = MONO_HANDLE_GET_FIELD_VAL (obj_val, gint32, field);
 #else
-                               if (address)
-                                       mreq.imr_interface = ipaddress_to_struct_in_addr (address);
+                               if (!MONO_HANDLE_IS_NULL (address))
+                                       mreq.imr_interface = ipaddress_handle_to_struct_in_addr (address);
 #endif /* HAVE_STRUCT_IP_MREQN */
 
                                ret = mono_w32socket_setsockopt (sock, system_level, system_name, &mreq, sizeof (mreq));
@@ -2304,9 +2346,10 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                        *werror = WSAEINVAL;
                        return;
                }
-       } else if (byte_val!=NULL) {
-               int valsize = mono_array_length (byte_val);
-               guchar *buf = mono_array_addr (byte_val, guchar, 0);
+       } else if (!MONO_HANDLE_IS_NULL (byte_val)) {
+               int valsize = mono_array_handle_length (byte_val);
+               uint32_t gchandle;
+               guchar *buf = MONO_ARRAY_HANDLE_PIN (byte_val, guchar, 0, &gchandle);
                
                switch(name) {
                case SocketOptionName_DontLinger:
@@ -2322,6 +2365,7 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
                        ret = mono_w32socket_setsockopt (sock, system_level, system_name, buf, valsize);
                        break;
                }
+               mono_gchandle_free (gchandle);
        } else {
                /* ReceiveTimeout/SendTimeout get here */
                switch (name) {
@@ -2367,11 +2411,12 @@ ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32
 }
 
 void
-ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror, MonoError *error)
 {
        int ret;
        gboolean interrupted;
 
+       error_init (error);
        *werror = 0;
 
        mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
@@ -2398,33 +2443,37 @@ ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, g
 }
 
 gint
-ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArray *input, MonoArray *output, gint32 *werror)
+ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArrayHandle input, MonoArrayHandle output, gint32 *werror, MonoError *error)
 {
        glong output_bytes = 0;
        gchar *i_buffer, *o_buffer;
        gint i_len, o_len;
+       uint32_t i_gchandle, o_gchandle;
        gint ret;
 
+       error_init (error);
        *werror = 0;
        
        if ((guint32)code == FIONBIO)
                /* Invalid command. Must use Socket.Blocking */
                return -1;
 
-       if (input == NULL) {
+       if (MONO_HANDLE_IS_NULL (input)) {
                i_buffer = NULL;
                i_len = 0;
+               i_gchandle = 0;
        } else {
-               i_buffer = mono_array_addr (input, gchar, 0);
-               i_len = mono_array_length (input);
+               i_len = mono_array_handle_length (input);
+               i_buffer = MONO_ARRAY_HANDLE_PIN (input, gchar, 0, &i_gchandle);
        }
 
-       if (output == NULL) {
+       if (MONO_HANDLE_IS_NULL (output)) {
                o_buffer = NULL;
                o_len = 0;
+               o_gchandle = 0;
        } else {
-               o_buffer = mono_array_addr (output, gchar, 0);
-               o_len = mono_array_length (output);
+               o_len = mono_array_handle_length (output);
+               o_buffer = MONO_ARRAY_HANDLE_PIN (output, gchar, 0, &o_gchandle);
        }
 
        MONO_ENTER_GC_SAFE;
@@ -2433,6 +2482,11 @@ ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code,
 
        MONO_EXIT_GC_SAFE;
 
+       if (i_gchandle)
+               mono_gchandle_free (i_gchandle);
+       if (o_gchandle)
+               mono_gchandle_free (o_gchandle);
+
        if (ret == SOCKET_ERROR) {
                *werror = mono_w32socket_get_last_error ();
                return -1;
@@ -2709,36 +2763,32 @@ ves_icall_System_Net_Dns_GetHostName_internal (MonoStringHandleOut h_name, MonoE
 
 #if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT | HAVE_UWP_WINAPI_SUPPORT)
 gboolean
-ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags, gint32 *werror, gboolean blocking)
+ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHandle filename, MonoArrayHandle pre_buffer, MonoArrayHandle post_buffer, gint flags, gint32 *werror, gboolean blocking, MonoError *error)
 {
        HANDLE file;
        gboolean ret;
        gboolean interrupted;
        TRANSMIT_FILE_BUFFERS buffers;
+       uint32_t pre_buffer_gchandle = 0;
+       uint32_t post_buffer_gchandle = 0;
 
+       error_init (error);
        *werror = 0;
 
-       if (filename == NULL)
+       if (MONO_HANDLE_IS_NULL (filename))
                return FALSE;
 
        /* FIXME: replace file by a proper fd that we can call open and close on, as they are interruptible */
 
-       file = mono_w32file_create (mono_string_chars (filename), GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0);
+       uint32_t filename_gchandle;
+       gunichar2 *filename_chars = mono_string_handle_pin_chars (filename, &filename_gchandle);
+       file = mono_w32file_create (filename_chars, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, 0);
+       mono_gchandle_free (filename_gchandle);
        if (file == INVALID_HANDLE_VALUE) {
                *werror = mono_w32error_get_last ();
                return FALSE;
        }
 
-       memset (&buffers, 0, sizeof (buffers));
-       if (pre_buffer != NULL) {
-               buffers.Head = mono_array_addr (pre_buffer, guchar, 0);
-               buffers.HeadLength = mono_array_length (pre_buffer);
-       }
-       if (post_buffer != NULL) {
-               buffers.Tail = mono_array_addr (post_buffer, guchar, 0);
-               buffers.TailLength = mono_array_length (post_buffer);
-       }
-
        mono_thread_info_install_interrupt (abort_syscall, (gpointer) (gsize) mono_native_thread_id_get (), &interrupted);
        if (interrupted) {
                mono_w32file_close (file);
@@ -2746,10 +2796,26 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoString *f
                return FALSE;
        }
 
+
+       memset (&buffers, 0, sizeof (buffers));
+       if (!MONO_HANDLE_IS_NULL (pre_buffer)) {
+               buffers.Head = MONO_ARRAY_HANDLE_PIN (pre_buffer, guchar, 0, &pre_buffer_gchandle);
+               buffers.HeadLength = mono_array_handle_length (pre_buffer);
+       }
+       if (!MONO_HANDLE_IS_NULL (post_buffer)) {
+               buffers.Tail = MONO_ARRAY_HANDLE_PIN (post_buffer, guchar, 0, &post_buffer_gchandle);
+               buffers.TailLength = mono_array_handle_length (post_buffer);
+       }
+
        MONO_ENTER_GC_SAFE;
        ret = mono_w32socket_transmit_file (sock, file, &buffers, flags, blocking);
        MONO_EXIT_GC_SAFE;
 
+       if (pre_buffer_gchandle)
+               mono_gchandle_free (pre_buffer_gchandle);
+       if (post_buffer_gchandle)
+               mono_gchandle_free (post_buffer_gchandle);
+
        if (!ret)
                *werror = mono_w32socket_get_last_error ();
 
@@ -2784,14 +2850,14 @@ mono_network_cleanup (void)
 }
 
 void
-icall_cancel_blocking_socket_operation (MonoThread *thread)
+icall_cancel_blocking_socket_operation (MonoThreadObjectHandle thread, MonoError *error)
 {
-       MonoInternalThread *internal;
-
-       internal = thread->internal_thread;
-       g_assert (internal);
+       error_init (error);
+       MonoInternalThreadHandle internal = MONO_HANDLE_NEW_GET (MonoInternalThread, thread, internal_thread);
+       g_assert (!MONO_HANDLE_IS_NULL (internal));
 
-       mono_thread_info_abort_socket_syscall_for_close (MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid));
+       guint64 tid = mono_internal_thread_handle_ptr (internal)->tid;
+       mono_thread_info_abort_socket_syscall_for_close (MONO_UINT_TO_NATIVE_THREAD_ID (tid));
 }
 
 #endif /* #ifndef DISABLE_SOCKETS */
index f66076389d22621f80c96418dd09bfe82e75b512..1788e2175bd517655a0c2125a03587ec53b7b38d 100644 (file)
@@ -166,85 +166,98 @@ typedef struct
        gint gid;
 } MonoPeerCredData;
 
+/* Safely access Mono.Posix.PeerCredData from native code */
+TYPED_HANDLE_DECL (MonoPeerCredData);
+
 gpointer
-ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObject *this_obj, gint32 family, gint32 type, gint32 proto,
-       gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Socket_internal (MonoObjectHandle this_obj, gint32 family, gint32 type,
+                                                    gint32 proto, gint32 *werror, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Close_internal (gsize sock, gint32 *werror, MonoError *error);
 
 gint32
 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal (void);
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Available_internal (gsize sock, gint32 *werror, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Blocking_internal (gsize sock, gboolean block, gint32 *werror, MonoError *error);
 
 gpointer
-ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Accept_internal (gsize sock, gint32 *werror, gboolean blocking, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Listen_internal (gsize sock, guint32 backlog, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Listen_internal (gsize sock, guint32 backlog, gint32 *werror, MonoError *error);
 
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *error);
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error);
 
-MonoObject*
-ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *error);
+MonoObjectHandle
+ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal (gsize sock, gint32 af, gint32 *werror, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObject *sockaddr, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Bind_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObject *sockaddr, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Connect_internal (gsize sock, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error);
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
-       gint32 flags, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Receive_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+                                                     gint32 flags, gint32 *werror, gboolean blocking, MonoError *error);
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *error,
-       gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Receive_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags,
+                                                           gint32 *werror, gboolean blocking, MonoError *error);
+
+/* gint32 */
+/* ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count, */
+/*                                                       gint32 flags, MonoObject **sockaddr, gint32 *werror, gboolean blocking); */
 
 gint32
-ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
-       gint32 flags, MonoObject **sockaddr, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_ReceiveFrom_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+                                                         gint32 flags, MonoObjectHandle sockaddr, gint32 *werror, gboolean blocking, MonoError *error);
+
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
-       gint32 flags, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Send_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+                                                  gint32 flags, gint32 *werror, gboolean blocking, MonoError *error);
 
 gint32
-ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArray *buffers, gint32 flags, gint32 *error,
-       gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_Send_array_internal (gsize sock, MonoArrayHandle buffers, gint32 flags,
+                                                        gint32 *werror, gboolean blocking, MonoError *error);
 
 gint32
-ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArray *buffer, gint32 offset, gint32 count,
-       gint32 flags, MonoObject *sockaddr, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_SendTo_internal (gsize sock, MonoArrayHandle buffer, gint32 offset, gint32 count,
+                                                    gint32 flags, MonoObjectHandle sockaddr, gint32 *werror,
+                                                    gboolean blocking, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArray **sockets, gint32 timeout, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Select_internal (MonoArrayHandle sockets, gint32 timeout, gint32 *werror, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Shutdown_internal (gsize sock, gint32 how, gint32 *werror, MonoError *error);
 
 void
 ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal (gsize sock, gint32 level, gint32 name,
-       MonoObject **obj_val, gint32 *error);
+                                                                 MonoObjectHandle obj_val, gint32 *werror,
+                                                                 MonoError *error);
 
 void
 ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal (gsize sock, gint32 level, gint32 name,
-       MonoArray **byte_val, gint32 *error);
+                                                                 MonoArrayHandle byte_val, gint32 *werror,
+                                                                 MonoError *error);
 
 void
 ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal (gsize sock, gint32 level, gint32 name,
-       MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error);
+                                                             MonoObjectHandle obj_val, MonoArrayHandle byte_val,
+                                                             gint32 int_val, gint32 *werror, MonoError *error);
 
 int
-ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code, MonoArray *input, MonoArray *output,
-       gint32 *error);
+ves_icall_System_Net_Sockets_Socket_IOControl_internal (gsize sock, gint32 code,
+                                                       MonoArrayHandle input, MonoArrayHandle output,
+                                                       gint32 *werror, MonoError *error);
 
 MonoBoolean
 ves_icall_System_Net_Dns_GetHostByName_internal (MonoStringHandle host, MonoStringHandleOut h_name,
@@ -260,20 +273,21 @@ MonoBoolean
 ves_icall_System_Net_Dns_GetHostName_internal (MonoStringHandleOut h_name, MonoError *error);
 
 MonoBoolean
-ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, gint timeout, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Poll_internal (gsize sock, gint mode, gint timeout, gint32 *werror, MonoError *error);
 
 void
-ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *error);
+ves_icall_System_Net_Sockets_Socket_Disconnect_internal (gsize sock, MonoBoolean reuse, gint32 *werror, MonoError *error);
 
 gboolean
-ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoString *filename, MonoArray *pre_buffer,
-       MonoArray *post_buffer, gint flags, gint32 *error, gboolean blocking);
+ves_icall_System_Net_Sockets_Socket_SendFile_internal (gsize sock, MonoStringHandle filename,
+                                                      MonoArrayHandle pre_buffer, MonoArrayHandle post_buffer,
+                                                      gint flags, gint32 *werror, gboolean blocking, MonoError *error);
 
 void
-icall_cancel_blocking_socket_operation (MonoThread *thread);
+icall_cancel_blocking_socket_operation (MonoThreadObjectHandle thread, MonoError *error);
 
 gboolean
-ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto);
+ves_icall_System_Net_Sockets_Socket_SupportPortReuse (MonoProtocolType proto, MonoError *error);
 
 void
 mono_network_init(void);
index a08d93b4137fe71b2f60d77b25010a51bd3d5638..b2107a6c524d8a33b267af7af06c601020fa2caf 100755 (executable)
@@ -509,10 +509,6 @@ test_sources =                     \
        MemoryIntrinsics.il     \
        mixed.cs
 
-if NACL_CODEGEN
-test_sources += nacl.cs
-endif
-
 regtests_UNIVERSAL = \
        basic.exe \
        basic-float.exe \
@@ -529,10 +525,6 @@ regtests_UNIVERSAL = \
        unaligned.exe   \
        basic-vectors.exe
 
-if NACL_CODEGEN
-regtests_UNIVERSAL += nacl.exe
-endif
-
 regtests_DISABLED = 
 
 if FULL_AOT_TESTS
@@ -678,11 +670,7 @@ generics-variant-types.dll: generics-variant-types.il
 MemoryIntrinsics.dll: MemoryIntrinsics.il
        $(ILASM) -dll -output=$@ $<
 
-if NACL_CODEGEN
-GENMDESC_OPTS=--nacl
-else !NACL_CODEGEN
 GENMDESC_OPTS=
-endif !NACL_CODEGEN
 
 # we don't always use the perl impl because it's an additional
 # build dependency for the poor windows users
@@ -691,11 +679,7 @@ endif !NACL_CODEGEN
 if CROSS_COMPILING
 GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
 else !CROSS_COMPILING
-if NACL_CODEGEN
-GENMDESC_PRG=perl $(srcdir)/genmdesc.pl $(arch_define) $(srcdir) $(GENMDESC_OPTS)
-else
 GENMDESC_PRG=./genmdesc $(GENMDESC_OPTS)
-endif
 endif !CROSS_COMPILING
 
 cpu-x86.h: cpu-x86.md genmdesc$(EXEEXT)
index 626473c8d0b846c2f271127a88be0c10ad5cd1f2..3c4e3aa899f535656ae0429158f5bf8af40dec6c 100644 (file)
@@ -78,7 +78,7 @@
 #define TARGET_WIN32_MSVC
 #endif
 
-#if defined(__linux__) || defined(__native_client_codegen__)
+#if defined(__linux__)
 #define RODATA_SECT ".rodata"
 #elif defined(TARGET_MACH)
 #define RODATA_SECT ".section __TEXT, __const"
@@ -953,10 +953,8 @@ emit_code_bytes (MonoAotCompile *acfg, const guint8* buf, int size)
 #ifdef TARGET_X86
 #ifdef TARGET_WIN32
 #define AOT_TARGET_STR "X86 (WIN32)"
-#elif defined(__native_client_codegen__)
-#define AOT_TARGET_STR "X86 (native client codegen)"
 #else
-#define AOT_TARGET_STR "X86 (!native client codegen)"
+#define AOT_TARGET_STR "X86"
 #endif
 #endif
 
@@ -4429,7 +4427,13 @@ method_has_type_vars (MonoMethod *method)
 static
 gboolean mono_aot_mode_is_full (MonoAotOptions *opts)
 {
-       return opts->mode == MONO_AOT_MODE_FULL;
+       return opts->mode == MONO_AOT_MODE_FULL || opts->mode == MONO_AOT_MODE_INTERP;
+}
+
+static
+gboolean mono_aot_mode_is_interp (MonoAotOptions *opts)
+{
+       return opts->mode == MONO_AOT_MODE_INTERP;
 }
 
 static
@@ -6823,6 +6827,11 @@ emit_trampolines (MonoAotCompile *acfg)
 
 #endif /* #ifdef MONO_ARCH_HAVE_FULL_AOT_TRAMPOLINES */
 
+               if (mono_aot_mode_is_interp (&acfg->aot_opts)) {
+                       mono_arch_get_enter_icall_trampoline (&info);
+                       emit_trampoline (acfg, acfg->got_offset, info);
+               }
+
                /* Emit trampolines which are numerous */
 
                /*
@@ -7163,6 +7172,8 @@ mono_aot_parse_options (const char *aot_options, MonoAotOptions *opts)
                        opts->mode = MONO_AOT_MODE_FULL;
                } else if (str_begins_with (arg, "hybrid")) {
                        opts->mode = MONO_AOT_MODE_HYBRID;                      
+               } else if (str_begins_with (arg, "interp")) {
+                       opts->mode = MONO_AOT_MODE_INTERP;
                } else if (str_begins_with (arg, "threads=")) {
                        opts->nthreads = atoi (arg + strlen ("threads="));
                } else if (str_begins_with (arg, "static")) {
@@ -8639,7 +8650,7 @@ execute_system (const char * command)
 {
        int status = 0;
 
-#if defined(HOST_WIN32) && defined(HAVE_SYSTEM)
+#if defined(HOST_WIN32)
        // We need an extra set of quotes around the whole command to properly handle commands 
        // with spaces since internally the command is called through "cmd /c.
        char * quoted_command = g_strdup_printf ("\"%s\"", command);
@@ -10361,19 +10372,13 @@ compile_asm (MonoAotCompile *acfg)
 #define AS_OPTIONS "-a64 -mppc64"
 #elif defined(sparc) && SIZEOF_VOID_P == 8
 #define AS_OPTIONS "-xarch=v9"
-#elif defined(TARGET_X86) && defined(TARGET_MACH) && !defined(__native_client_codegen__)
+#elif defined(TARGET_X86) && defined(TARGET_MACH)
 #define AS_OPTIONS "-arch i386"
 #else
 #define AS_OPTIONS ""
 #endif
 
-#ifdef __native_client_codegen__
-#if defined(TARGET_AMD64)
-#define AS_NAME "nacl64-as"
-#else
-#define AS_NAME "nacl-as"
-#endif
-#elif defined(TARGET_OSX)
+#if defined(TARGET_OSX)
 #define AS_NAME "clang"
 #elif defined(TARGET_WIN32_MSVC)
 #define AS_NAME "clang.exe"
@@ -10402,7 +10407,7 @@ compile_asm (MonoAotCompile *acfg)
 #elif defined(TARGET_WIN32) && !defined(TARGET_ANDROID)
 #define LD_NAME "gcc"
 #define LD_OPTIONS "-shared"
-#elif defined(TARGET_X86) && defined(TARGET_MACH) && !defined(__native_client_codegen__)
+#elif defined(TARGET_X86) && defined(TARGET_MACH)
 #define LD_NAME "clang"
 #define LD_OPTIONS "-m32 -dynamiclib"
 #elif defined(TARGET_ARM) && !defined(TARGET_ANDROID)
@@ -11525,7 +11530,7 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
                }
        }
 
-       {
+       if (!mono_aot_mode_is_interp (&acfg->aot_opts)) {
                int method_index;
 
        for (method_index = 0; method_index < acfg->image->tables [MONO_TABLE_METHOD].rows; ++method_index) {
@@ -11588,9 +11593,12 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
        if (mono_aot_mode_is_full (&acfg->aot_opts) || mono_aot_mode_is_hybrid (&acfg->aot_opts))
                mono_set_partial_sharing_supported (TRUE);
 
-       res = collect_methods (acfg);
-       if (!res)
-               return 1;
+       if (!mono_aot_mode_is_interp (&acfg->aot_opts)) {
+               res = collect_methods (acfg);
+
+               if (!res)
+                       return 1;
+       }
 
        {
                GList *l;
@@ -11615,6 +11623,26 @@ mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options)
        }
 #endif
 
+       if (mono_aot_mode_is_interp (&acfg->aot_opts)) {
+               MonoMethod *wrapper;
+               MonoMethodSignature *sig;
+
+               /* object object:interp_in_static (object,intptr,intptr,intptr) */
+               sig = mono_create_icall_signature ("object object ptr ptr ptr");
+               wrapper = mini_get_interp_in_wrapper (sig);
+               add_method (acfg, wrapper);
+
+               /* int object:interp_in_static (intptr,int,intptr) */
+               sig = mono_create_icall_signature ("int32 ptr int32 ptr");
+               wrapper = mini_get_interp_in_wrapper (sig);
+               add_method (acfg, wrapper);
+
+               /* void object:interp_in_static (object,intptr,intptr,intptr) */
+               sig = mono_create_icall_signature ("void object ptr ptr ptr");
+               wrapper = mini_get_interp_in_wrapper (sig);
+               add_method (acfg, wrapper);
+       }
+
        TV_GETTIME (atv);
 
        compile_methods (acfg);
index 30ef9a64ad7bc9628a0e2a5a52c7306b469dd6d1..a93776da15a6b4f6a3a024ab68856eb9cfdb8044 100644 (file)
@@ -1015,6 +1015,8 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                                ref->method = mono_marshal_get_gsharedvt_in_wrapper ();
                        } else if (subtype == WRAPPER_SUBTYPE_GSHAREDVT_OUT) {
                                ref->method = mono_marshal_get_gsharedvt_out_wrapper ();
+                       } else if (subtype == WRAPPER_SUBTYPE_INTERP_IN) {
+                               ref->method = mini_get_interp_in_wrapper (target->signature);
                        } else if (subtype == WRAPPER_SUBTYPE_GSHAREDVT_IN_SIG) {
                                MonoMethodSignature *sig = decode_signature (module, p, &p);
                                if (!sig)
@@ -2017,7 +2019,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                        }
                }
                if (!sofile) {
-                       if (mono_aot_only && assembly->image->tables [MONO_TABLE_METHOD].rows) {
+                       if (mono_aot_only && !mono_use_interpreter && assembly->image->tables [MONO_TABLE_METHOD].rows) {
                                aot_name = g_strdup_printf ("%s%s", assembly->image->name, MONO_SOLIB_EXT);
                                g_error ("Failed to load AOT module '%s' in aot-only mode.\n", aot_name);
                                g_free (aot_name);
@@ -2061,7 +2063,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
        }
 
        if (!usable) {
-               if (mono_aot_only) {
+               if (mono_aot_only && !mono_use_interpreter) {
                        g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", found_aot_name, msg);
                } else {
                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable: %s.", found_aot_name, msg);
@@ -2283,16 +2285,6 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
         * non-lazily, since we can't handle out-of-date errors later.
         * The cached class info also depends on the exact assemblies.
         */
-#if defined(__native_client__)
-       /* TODO: Don't 'load_image' on mscorlib due to a */
-       /* recursive loading problem.  This should be    */
-       /* removed if mscorlib is loaded from disk.      */
-       if (strncmp(assembly->aname.name, "mscorlib", 8)) {
-               do_load_image = TRUE;
-       } else {
-               do_load_image = FALSE;
-       }
-#endif
        if (do_load_image) {
                for (i = 0; i < amodule->image_table_len; ++i) {
                        MonoError error;
@@ -2353,9 +2345,7 @@ mono_aot_init (void)
        mono_os_mutex_init_recursive (&aot_page_mutex);
        aot_modules = g_hash_table_new (NULL, NULL);
 
-#ifndef __native_client__
        mono_install_assembly_load_hook (load_aot_module, NULL);
-#endif
        mono_counters_register ("Async JIT info size", MONO_COUNTER_INT|MONO_COUNTER_JIT, &async_jit_info_size);
 
        char *lastaot = g_getenv ("MONO_LASTAOT");
index 2f964b4162f88a70a06caaf992da8b14db18bac2..0dab1240f8637cd2ac334e2b881124aeb441ca83 100644 (file)
@@ -819,17 +819,9 @@ replace_in_block (MonoBasicBlock *bb, MonoBasicBlock *orig, MonoBasicBlock *repl
 }
 
 static void
-replace_out_block_in_code (MonoBasicBlock *bb, MonoBasicBlock *orig, MonoBasicBlock *repl) {
+replace_out_block_in_code (MonoBasicBlock *bb, MonoBasicBlock *orig, MonoBasicBlock *repl)
+{
        MonoInst *ins;
-
-#if defined(__native_client_codegen__)
-       /* Need to maintain this flag for the new block because */
-       /* we can't jump indirectly to a non-aligned block.     */
-       if (orig->flags & BB_INDIRECT_JUMP_TARGET)
-       {
-               repl->flags |= BB_INDIRECT_JUMP_TARGET;
-       }
-#endif
        
        for (ins = bb->code; ins != NULL; ins = ins->next) {
                switch (ins->opcode) {
index bfdddb37547e5dac5d9f4f094b1084d87b359826..88b1b18b68b8e0492dc328d8b4347d14843a43b8 100644 (file)
@@ -7096,11 +7096,17 @@ do_invoke_method (DebuggerTlsData *tls, Buffer *buf, InvokeData *invoke, guint8
                                args [i] = arg_buf [i];
                        }
                } else {
-                       arg_buf [i] = (guint8 *)g_alloca (mono_class_instance_size (mono_class_from_mono_type (sig->params [i])));
+                       MonoClass *arg_class = mono_class_from_mono_type (sig->params [i]);
+                       arg_buf [i] = (guint8 *)g_alloca (mono_class_instance_size (arg_class));
                        err = decode_value (sig->params [i], domain, arg_buf [i], p, &p, end);
                        if (err != ERR_NONE)
                                break;
-                       args [i] = arg_buf [i];
+                       if (mono_class_is_nullable (arg_class)) {
+                               args [i] = mono_nullable_box (arg_buf [i], arg_class, &error);
+                               mono_error_assert_ok (&error);
+                       } else {
+                               args [i] = arg_buf [i];
+                       }
                }
        }
 
index 8719a12994c8e3fa936f5c34277412141aa72953..934eb0a54a363138728a0bdc19f64f45e77df70b 100644 (file)
@@ -121,10 +121,6 @@ opt_names [] = {
 
 #endif
 
-#ifdef __native_client__
-extern char *nacl_mono_path;
-#endif
-
 #define DEFAULT_OPTIMIZATIONS (        \
        MONO_OPT_PEEPHOLE |     \
        MONO_OPT_CFOLD |        \
@@ -1603,9 +1599,6 @@ mono_main (int argc, char* argv[])
 #ifdef HOST_WIN32
        int mixed_mode = FALSE;
 #endif
-#ifdef __native_client__
-       gboolean nacl_null_checks_off = FALSE;
-#endif
 
 #ifdef MOONLIGHT
 #ifndef HOST_WIN32
@@ -1937,13 +1930,6 @@ mono_main (int argc, char* argv[])
 #else
                        fprintf (stderr, "Mono Warning: --interp= not enabled in this runtime.\n");
 #endif
-
-#ifdef __native_client__
-               } else if (strcmp (argv [i], "--nacl-mono-path") == 0){
-                       nacl_mono_path = g_strdup(argv[++i]);
-               } else if (strcmp (argv [i], "--nacl-null-checks-off") == 0){
-                       nacl_null_checks_off = TRUE;
-#endif
                } else if (strncmp (argv [i], "--assembly-loader=", strlen("--assembly-loader=")) == 0) {
                        gchar *arg = argv [i] + strlen ("--assembly-loader=");
                        if (strcmp (arg, "strict") == 0)
@@ -1968,13 +1954,6 @@ mono_main (int argc, char* argv[])
                }
        }
 
-#ifdef __native_client_codegen__
-       if (!nacl_null_checks_off) {
-               MonoDebugOptions *opt = mini_get_debug_options ();
-               opt->explicit_null_checks = TRUE;
-       }
-#endif
-
 #if defined(DISABLE_HW_TRAPS) || defined(MONO_ARCH_DISABLE_HW_TRAPS)
        // Signal handlers not available
        {
@@ -2397,6 +2376,10 @@ mono_jit_set_aot_mode (MonoAotMode mode)
                mono_set_generic_sharing_vt_supported (TRUE);
                mono_set_partial_sharing_supported (TRUE);
        }
+       if (mono_aot_mode == MONO_AOT_MODE_INTERP) {
+               mono_aot_only = TRUE;
+               mono_use_interpreter = TRUE;
+       }
 }
 
 /**
index f21ba2b5d18493d36caff6c2c3f4a94196963640..07f498e628ba1812082dbf0cb1d3a12b2d86245d 100644 (file)
@@ -1462,7 +1462,6 @@ class Tests
                return 0;
        }
        
-       [Category ("NaClDisable")]
        public static int test_0_div_zero () {
                int d = 1;
                int q = 0;
@@ -1633,7 +1632,6 @@ class Tests
                return 0;
        }
 
-       [Category ("NaClDisable")]
        public static int test_0_long_div_zero () {
                long d = 1;
                long q = 0;
index 357651ee64175b78d2d4ecb3fd1d88ee7b808853..60ff683a9af013b5e752fba402e179e89eb425d5 100644 (file)
 #include <string.h>
 #include <mono/metadata/opcodes.h>
 
-#if defined(__native_client__) || defined(__native_client_codegen__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
 #define MINI_OP(a,b,dest,src1,src2) b,
 #define MINI_OP3(a,b,dest,src1,src2,src3) b,
 /* keep in sync with the enum in mini.h */
index 7f681b23bb5ba355da140cd5fb52c4b0fac81acb..6a741ca23b0ac313ca8be69ed98f7e507ebbebdf 100644 (file)
@@ -135,9 +135,6 @@ mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint
 void
 mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id)
 {
-#if defined(__native_client__)
-       return;
-#endif
 #ifndef DISABLE_LOGGING
        GHashTable *offset_to_bb_hash = NULL;
        int i, cindex, bb_num;
index f381ac8358750ff78ef0ac55f11862c110b6442d..b5cf20dfde120e02d353ad7e69e64c3b82788dd6 100644 (file)
@@ -55,7 +55,7 @@
  * TARGET_ASM_GAS == GNU assembler
  */
 #if !defined(TARGET_ASM_APPLE) && !defined(TARGET_ASM_GAS)
-#if defined(TARGET_MACH) && !defined(__native_client_codegen__)
+#if defined(TARGET_MACH)
 #define TARGET_ASM_APPLE
 #else
 #define TARGET_ASM_GAS
@@ -329,11 +329,6 @@ bin_writer_emit_ensure_buffer (BinSection *section, int size)
                while (new_size <= new_offset)
                        new_size *= 2;
                data = (guint8 *)g_malloc0 (new_size);
-#ifdef __native_client_codegen__
-               /* for Native Client, fill empty space with HLT instruction */
-               /* instead of 00.                                           */
-               memset(data, 0xf4, new_size);
-#endif         
                memcpy (data, section->data, section->data_len);
                g_free (section->data);
                section->data = data;
index 3b19a6d1bdaba5b7215c34a9ece4020672d6abf7..895ea8242bacaa448fb3195fe3230fbcb3d1cdcd 100644 (file)
@@ -94,6 +94,7 @@ typedef struct _RuntimeMethod
        MonoType *rtype;
        MonoType **param_types;
        MonoJitInfo *jinfo;
+       MonoDomain *domain;
 } RuntimeMethod;
 
 struct _MonoInvocation {
@@ -114,7 +115,6 @@ struct _MonoInvocation {
 };
 
 typedef struct {
-       MonoDomain *domain;
        MonoDomain *original_domain;
        MonoInvocation *base_frame;
        MonoInvocation *current_frame;
index 712ad43c11e6a12adbeaeadb681d08fa5ab3d415..a103ed22b6a851c332eed65ef8484189bd284847 100644 (file)
@@ -284,6 +284,7 @@ mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoErro
 
        rtm = mono_domain_alloc0 (domain, sizeof (RuntimeMethod));
        rtm->method = method;
+       rtm->domain = domain;
        rtm->param_count = sig->param_count;
        rtm->hasthis = sig->hasthis;
        rtm->rtype = mini_get_underlying_type (sig->ret);
@@ -332,17 +333,23 @@ interp_pop_lmf (MonoLMFExt *ext)
 }
 
 static inline RuntimeMethod*
-get_virtual_method (MonoDomain *domain, RuntimeMethod *runtime_method, MonoObject *obj)
+get_virtual_method (RuntimeMethod *runtime_method, MonoObject *obj)
 {
        MonoMethod *m = runtime_method->method;
+       MonoDomain *domain = runtime_method->domain;
+       RuntimeMethod *ret = NULL;
        MonoError error;
 
+#ifndef DISABLE_REMOTING
+       if (mono_object_is_transparent_proxy (obj)) {
+               ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
+               mono_error_assert_ok (&error);
+               return ret;
+       }
+#endif
+
        if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
-               RuntimeMethod *ret = NULL;
-               if (mono_object_is_transparent_proxy (obj)) {
-                       ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
-                       mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-               } else if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
+               if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
                        ret = mono_interp_get_runtime_method (domain, mono_marshal_get_synchronized_wrapper (m), &error);
                        mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                } else {
@@ -580,7 +587,7 @@ fill_in_trace (MonoException *exception, MonoInvocation *frame)
 {
        MonoError error;
        char *stack_trace = dump_frame (frame);
-       MonoDomain *domain = mono_domain_get();
+       MonoDomain *domain = frame->runtime_method->domain;
        (exception)->stack_trace = mono_string_new_checked (domain, stack_trace, &error);
        mono_error_cleanup (&error); /* FIXME: don't swallow the error */
        (exception)->trace_ips = get_trace_ips (domain, frame);
@@ -985,10 +992,14 @@ ves_pinvoke_method (MonoInvocation *frame, MonoMethodSignature *sig, MonoFuncV a
 
        g_assert (!frame->runtime_method);
        if (!mono_interp_enter_icall_trampoline) {
-               MonoTrampInfo *info;
-               mono_interp_enter_icall_trampoline = mono_arch_get_enter_icall_trampoline (&info);
-               // TODO:
-               // mono_tramp_info_register (info, NULL);
+               if (mono_aot_only) {
+                       mono_interp_enter_icall_trampoline = mono_aot_get_trampoline ("enter_icall_trampoline");
+               } else {
+                       MonoTrampInfo *info;
+                       mono_interp_enter_icall_trampoline = mono_arch_get_enter_icall_trampoline (&info);
+                       // TODO:
+                       // mono_tramp_info_register (info, NULL);
+               }
        }
 
        InterpMethodArguments *margs = build_args_from_sig (sig, frame);
@@ -1007,8 +1018,6 @@ ves_pinvoke_method (MonoInvocation *frame, MonoMethodSignature *sig, MonoFuncV a
        interp_pop_lmf (&ext);
 
        context->managed_code = 1;
-       /* domain can only be changed by native code */
-       context->domain = mono_domain_get ();
 
        if (*mono_thread_interruption_request_flag ()) {
                MonoException *exc = mono_thread_interruption_checkpoint ();
@@ -1369,7 +1378,6 @@ mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoOb
 
        if (setjmp(env)) {
                if (context != &context_struct) {
-                       context->domain = mono_domain_get ();
                        context->current_frame = old_frame;
                        context->managed_code = 0;
                } else
@@ -1390,7 +1398,7 @@ mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoOb
        else
                old_frame = context->current_frame;
 
-       context->domain = mono_domain_get ();
+       MonoDomain *domain = mono_domain_get ();
 
        switch (sig->ret->type) {
        case MONO_TYPE_VOID:
@@ -1403,7 +1411,7 @@ mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoOb
                isobject = 1;
                break;
        case MONO_TYPE_VALUETYPE:
-               retval = mono_object_new_checked (context->domain, klass, error);
+               retval = mono_object_new_checked (domain, klass, error);
                ret = mono_object_unbox (retval);
                if (!sig->ret->data.klass->enumtype)
                        result.data.vt = ret;
@@ -1412,7 +1420,7 @@ mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoOb
                break;
        case MONO_TYPE_GENERICINST:
                if (!MONO_TYPE_IS_REFERENCE (sig->ret)) {
-                       retval = mono_object_new_checked (context->domain, klass, error);
+                       retval = mono_object_new_checked (domain, klass, error);
                        ret = mono_object_unbox (retval);
                        if (!sig->ret->data.klass->enumtype)
                                result.data.vt = ret;
@@ -1424,11 +1432,11 @@ mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoOb
                break;
 
        case MONO_TYPE_PTR:
-               retval = mono_object_new_checked (context->domain, mono_defaults.int_class, error);
+               retval = mono_object_new_checked (domain, mono_defaults.int_class, error);
                ret = mono_object_unbox (retval);
                break;
        default:
-               retval = mono_object_new_checked (context->domain, klass, error);
+               retval = mono_object_new_checked (domain, klass, error);
                ret = mono_object_unbox (retval);
                break;
        }
@@ -1502,8 +1510,8 @@ handle_enum:
 
        if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
                method = mono_marshal_get_native_wrapper (method, FALSE, FALSE);
-       INIT_FRAME (&frame,context->current_frame,args,&result,mono_get_root_domain (),method,error);
 
+       INIT_FRAME (&frame,context->current_frame,args,&result,domain,method,error);
        if (exc)
                frame.invoke_trap = 1;
        context->managed_code = 1;
@@ -1574,7 +1582,6 @@ interp_entry (InterpEntryData *data)
        } else {
                old_frame = context->current_frame;
        }
-       context->domain = mono_domain_get ();
 
        args = alloca (sizeof (stackval) * (sig->param_count + (sig->hasthis ? 1 : 0)));
        if (sig->hasthis)
@@ -1825,6 +1832,240 @@ do_icall (ThreadContext *context, int op, stackval *sp, gpointer ptr)
        return sp;
 }
 
+static stackval *
+do_jit_call (stackval *sp, unsigned char *vt_sp, ThreadContext *context, MonoInvocation *frame, RuntimeMethod *rmethod)
+{
+       MonoMethodSignature *sig;
+       MonoFtnDesc ftndesc;
+       guint8 res_buf [256];
+       MonoType *type;
+       MonoLMFExt ext;
+
+       //printf ("%s\n", mono_method_full_name (rmethod->method, 1));
+
+       /*
+        * Call JITted code through a gsharedvt_out wrapper. These wrappers receive every argument
+        * by ref and return a return value using an explicit return value argument.
+        */
+       if (!rmethod->jit_wrapper) {
+               MonoMethod *method = rmethod->method;
+               MonoError error;
+
+               sig = mono_method_signature (method);
+               g_assert (sig);
+
+               MonoMethod *wrapper = mini_get_gsharedvt_out_sig_wrapper (sig);
+               //printf ("J: %s %s\n", mono_method_full_name (method, 1), mono_method_full_name (wrapper, 1));
+
+               gpointer jit_wrapper = mono_jit_compile_method_jit_only (wrapper, &error);
+               mono_error_assert_ok (&error);
+
+               gpointer addr = mono_jit_compile_method_jit_only (method, &error);
+               g_assert (addr);
+               mono_error_assert_ok (&error);
+
+               rmethod->jit_addr = addr;
+               rmethod->jit_sig = sig;
+               mono_memory_barrier ();
+               rmethod->jit_wrapper = jit_wrapper;
+
+       } else {
+               sig = rmethod->jit_sig;
+       }
+
+       sp -= sig->param_count;
+       if (sig->hasthis)
+               --sp;
+
+       ftndesc.addr = rmethod->jit_addr;
+       ftndesc.arg = NULL;
+
+       // FIXME: Optimize this
+
+       gpointer args [32];
+       int pindex = 0;
+       int stack_index = 0;
+       if (rmethod->hasthis) {
+               args [pindex ++] = sp [0].data.p;
+               stack_index ++;
+       }
+       type = rmethod->rtype;
+       if (type->type != MONO_TYPE_VOID) {
+               if (MONO_TYPE_ISSTRUCT (type))
+                       args [pindex ++] = vt_sp;
+               else
+                       args [pindex ++] = res_buf;
+       }
+       for (int i = 0; i < rmethod->param_count; ++i) {
+               MonoType *t = rmethod->param_types [i];
+               stackval *sval = &sp [stack_index + i];
+               if (sig->params [i]->byref) {
+                       args [pindex ++] = sval->data.p;
+               } else if (MONO_TYPE_ISSTRUCT (t)) {
+                       args [pindex ++] = sval->data.p;
+               } else if (MONO_TYPE_IS_REFERENCE (t)) {
+                       args [pindex ++] = &sval->data.p;
+               } else {
+                       switch (t->type) {
+                       case MONO_TYPE_I1:
+                       case MONO_TYPE_U1:
+                       case MONO_TYPE_I2:
+                       case MONO_TYPE_U2:
+                       case MONO_TYPE_I4:
+                       case MONO_TYPE_U4:
+                       case MONO_TYPE_VALUETYPE:
+                               args [pindex ++] = &sval->data.i;
+                               break;
+                       case MONO_TYPE_PTR:
+                       case MONO_TYPE_FNPTR:
+                       case MONO_TYPE_I:
+                       case MONO_TYPE_U:
+                       case MONO_TYPE_OBJECT:
+                               args [pindex ++] = &sval->data.p;
+                               break;
+                       case MONO_TYPE_I8:
+                       case MONO_TYPE_U8:
+                               args [pindex ++] = &sval->data.l;
+                               break;
+                       default:
+                               printf ("%s\n", mono_type_full_name (t));
+                               g_assert_not_reached ();
+                       }
+               }
+       }
+
+       interp_push_lmf (&ext, frame);
+
+       switch (pindex) {
+       case 0: {
+               void (*func)(gpointer) = rmethod->jit_wrapper;
+
+               func (&ftndesc);
+               break;
+       }
+       case 1: {
+               void (*func)(gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], &ftndesc);
+               break;
+       }
+       case 2: {
+               void (*func)(gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], args [1], &ftndesc);
+               break;
+       }
+       case 3: {
+               void (*func)(gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], args [1], args [2], &ftndesc);
+               break;
+       }
+       case 4: {
+               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], args [1], args [2], args [3], &ftndesc);
+               break;
+       }
+       case 5: {
+               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], args [1], args [2], args [3], args [4], &ftndesc);
+               break;
+       }
+       case 6: {
+               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], args [1], args [2], args [3], args [4], args [5], &ftndesc);
+               break;
+       }
+       case 7: {
+               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
+
+               func (args [0], args [1], args [2], args [3], args [4], args [5], args [6], &ftndesc);
+               break;
+       }
+       default:
+               g_assert_not_reached ();
+               break;
+       }
+
+       interp_pop_lmf (&ext);
+
+       MonoType *rtype = rmethod->rtype;
+       switch (rtype->type) {
+       case MONO_TYPE_VOID:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_ARRAY:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+               sp->data.p = *(gpointer*)res_buf;
+               break;
+       case MONO_TYPE_I1:
+               sp->data.i = *(gint8*)res_buf;
+               break;
+       case MONO_TYPE_U1:
+               sp->data.i = *(guint8*)res_buf;
+               break;
+       case MONO_TYPE_I2:
+               sp->data.i = *(gint16*)res_buf;
+               break;
+       case MONO_TYPE_U2:
+               sp->data.i = *(guint16*)res_buf;
+               break;
+       case MONO_TYPE_I4:
+               sp->data.i = *(gint32*)res_buf;
+               break;
+       case MONO_TYPE_U4:
+               sp->data.i = *(guint32*)res_buf;
+               break;
+       case MONO_TYPE_VALUETYPE:
+               /* The result was written to vt_sp */
+               sp->data.p = vt_sp;
+               break;
+       case MONO_TYPE_GENERICINST:
+               if (MONO_TYPE_IS_REFERENCE (rtype)) {
+                       sp->data.p = *(gpointer*)res_buf;
+               } else {
+                       /* The result was written to vt_sp */
+                       sp->data.p = vt_sp;
+               }
+               break;
+       default:
+               printf ("%s\n", mono_type_full_name (rtype));
+               g_assert_not_reached ();
+               break;
+       }
+
+       return sp;
+}
+
+static void
+do_debugger_tramp (void (*tramp) (void), MonoInvocation *frame)
+{
+       MonoLMFExt ext;
+       interp_push_lmf (&ext, frame);
+       tramp ();
+       interp_pop_lmf (&ext);
+}
+
+static void
+do_transform_method (MonoInvocation *frame, ThreadContext *context)
+{
+       MonoLMFExt ext;
+
+       /* Use the parent frame as the current frame is not complete yet */
+       interp_push_lmf (&ext, frame->parent);
+
+       frame->ex = mono_interp_transform_method (frame->runtime_method, context);
+       context->managed_code = 1;
+
+       interp_pop_lmf (&ext);
+}
+
 /*
  * These functions are the entry points into the interpreter from compiled code.
  * They are called by the interp_in wrappers. They have the following signature:
@@ -1992,13 +2233,12 @@ mono_interp_create_method_pointer (MonoMethod *method, MonoError *error)
        gpointer addr;
        MonoMethodSignature *sig = mono_method_signature (method);
        MonoMethod *wrapper;
-       RuntimeMethod *rmethod;
+       RuntimeMethod *rmethod = mono_interp_get_runtime_method (mono_domain_get (), method, error);
 
        /* HACK: method_ptr of delegate should point to a runtime method*/
        if (method->wrapper_type && method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD)
-               return mono_interp_get_runtime_method (mono_domain_get (), method, error);
+               return rmethod;
 
-       rmethod = mono_interp_get_runtime_method (mono_domain_get (), method, error);
        if (rmethod->jit_entry)
                return rmethod->jit_entry;
        wrapper = mini_get_interp_in_wrapper (sig);
@@ -2034,9 +2274,10 @@ mono_interp_create_method_pointer (MonoMethod *method, MonoError *error)
         * rgctx register using a trampoline.
         */
 
-       // FIXME: AOT
-       g_assert (!mono_aot_only);
-       addr = mono_arch_get_static_rgctx_trampoline (ftndesc, jit_wrapper);
+       if (mono_aot_only)
+               addr = mono_aot_get_static_rgctx_trampoline (ftndesc, jit_wrapper);
+       else
+               addr = mono_arch_get_static_rgctx_trampoline (ftndesc, jit_wrapper);
 
        mono_memory_barrier ();
        rmethod->jit_entry = addr;
@@ -2140,16 +2381,7 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                g_free (mn);
 #endif
 
-               MonoLMFExt ext;
-
-               /* Use the parent frame as the current frame is not complete yet */
-               interp_push_lmf (&ext, frame->parent);
-
-               frame->ex = mono_interp_transform_method (frame->runtime_method, context);
-               context->managed_code = 1;
-
-               interp_pop_lmf (&ext);
-
+               do_transform_method (frame, context);
                if (frame->ex) {
                        rtm = NULL;
                        ip = NULL;
@@ -2197,18 +2429,10 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                MINT_IN_CASE(MINT_NOP)
                        ++ip;
                        MINT_IN_BREAK;
-               MINT_IN_CASE(MINT_BREAK) {
+               MINT_IN_CASE(MINT_BREAK)
                        ++ip;
-
-                       MonoLMFExt ext;
-
-                       interp_push_lmf (&ext, frame);
-
-                       mono_debugger_agent_user_break ();
-
-                       interp_pop_lmf (&ext);
+                       do_debugger_tramp (mono_debugger_agent_user_break, frame);
                        MINT_IN_BREAK;
-               }
                MINT_IN_CASE(MINT_LDNULL) 
                        sp->data.p = NULL;
                        ++ip;
@@ -2350,12 +2574,15 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                                --sp;
                        child_frame.stack_args = sp;
 
+#ifndef DISABLE_REMOTING
                        /* `this' can be NULL for string:.ctor */
                        if (csignature->hasthis && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+                               child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
+                       } else
+#endif
+                       if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+                               child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        }
 
@@ -2460,11 +2687,13 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                                --sp;
                        child_frame.stack_args = sp;
 
+#ifndef DISABLE_REMOTING
                        /* `this' can be NULL for string:.ctor */
                        if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+                               child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        }
+#endif
 
                        ves_exec_method_with_context (&child_frame, context, NULL, NULL, -1);
 
@@ -2508,10 +2737,12 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                        }
                        child_frame.stack_args = sp;
 
+#ifndef DISABLE_REMOTING
                        if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
-                               child_frame.runtime_method = mono_interp_get_runtime_method (context->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+                               child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        }
+#endif
 
                        ves_exec_method_with_context (&child_frame, context, NULL, NULL, -1);
 
@@ -2535,165 +2766,10 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                }
 
                MINT_IN_CASE(MINT_JIT_CALL) {
-                       MonoMethodSignature *sig;
                        RuntimeMethod *rmethod = rtm->data_items [* (guint16 *)(ip + 1)];
-                       MonoFtnDesc ftndesc;
-                       guint8 res_buf [256];
-                       MonoType *type;
-                       MonoLMFExt ext;
-
-                       //printf ("%s\n", mono_method_full_name (rmethod->method, 1));
-
-                       /*
-                        * Call JITted code through a gsharedvt_out wrapper. These wrappers receive every argument
-                        * by ref and return a return value using an explicit return value argument.
-                        */
-                       if (!rmethod->jit_wrapper) {
-                               MonoMethod *method = rmethod->method;
-                               MonoError error;
-
-                               sig = mono_method_signature (method);
-                               g_assert (sig);
-
-                               MonoMethod *wrapper = mini_get_gsharedvt_out_sig_wrapper (sig);
-                               //printf ("J: %s %s\n", mono_method_full_name (method, 1), mono_method_full_name (wrapper, 1));
-
-                               gpointer jit_wrapper = mono_jit_compile_method_jit_only (wrapper, &error);
-                               mono_error_assert_ok (&error);
-
-                               gpointer addr = mono_jit_compile_method_jit_only (method, &error);
-                               g_assert (addr);
-                               mono_error_assert_ok (&error);
-
-                               rmethod->jit_addr = addr;
-                               rmethod->jit_sig = sig;
-                               mono_memory_barrier ();
-                               rmethod->jit_wrapper = jit_wrapper;
-
-                       } else {
-                               sig = rmethod->jit_sig;
-                       }
-
                        frame->ip = ip;
                        ip += 2;
-                       sp -= sig->param_count;
-                       if (sig->hasthis)
-                               --sp;
-
-                       ftndesc.addr = rmethod->jit_addr;
-                       ftndesc.arg = NULL;
-
-                       // FIXME: Optimize this
-
-                       gpointer args [32];
-                       int pindex = 0;
-                       int stack_index = 0;
-                       if (rmethod->hasthis) {
-                               args [pindex ++] = sp [0].data.p;
-                               stack_index ++;
-                       }
-                       type = rmethod->rtype;
-                       if (type->type != MONO_TYPE_VOID) {
-                               if (MONO_TYPE_ISSTRUCT (type))
-                                       args [pindex ++] = vt_sp;
-                               else
-                                       args [pindex ++] = res_buf;
-                       }
-                       for (int i = 0; i < rmethod->param_count; ++i) {
-                               MonoType *t = rmethod->param_types [i];
-                               stackval *sval = &sp [stack_index + i];
-                               if (sig->params [i]->byref) {
-                                       args [pindex ++] = sval->data.p;
-                               } else if (MONO_TYPE_ISSTRUCT (t)) {
-                                       args [pindex ++] = sval->data.p;
-                               } else if (MONO_TYPE_IS_REFERENCE (t)) {
-                                       args [pindex ++] = &sval->data.p;
-                               } else {
-                                       switch (t->type) {
-                                       case MONO_TYPE_I1:
-                                       case MONO_TYPE_U1:
-                                       case MONO_TYPE_I2:
-                                       case MONO_TYPE_U2:
-                                       case MONO_TYPE_I4:
-                                       case MONO_TYPE_U4:
-                                       case MONO_TYPE_VALUETYPE:
-                                               args [pindex ++] = &sval->data.i;
-                                               break;
-                                       case MONO_TYPE_PTR:
-                                       case MONO_TYPE_FNPTR:
-                                       case MONO_TYPE_I:
-                                       case MONO_TYPE_U:
-                                       case MONO_TYPE_OBJECT:
-                                               args [pindex ++] = &sval->data.p;
-                                               break;
-                                       case MONO_TYPE_I8:
-                                       case MONO_TYPE_U8:
-                                               args [pindex ++] = &sval->data.l;
-                                               break;
-                                       default:
-                                               printf ("%s\n", mono_type_full_name (t));
-                                               g_assert_not_reached ();
-                                       }
-                               }
-                       }
-
-                       interp_push_lmf (&ext, frame);
-
-                       switch (pindex) {
-                       case 0: {
-                               void (*func)(gpointer) = rmethod->jit_wrapper;
-
-                               func (&ftndesc);
-                               break;
-                       }
-                       case 1: {
-                               void (*func)(gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], &ftndesc);
-                               break;
-                       }
-                       case 2: {
-                               void (*func)(gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], args [1], &ftndesc);
-                               break;
-                       }
-                       case 3: {
-                               void (*func)(gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], args [1], args [2], &ftndesc);
-                               break;
-                       }
-                       case 4: {
-                               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], args [1], args [2], args [3], &ftndesc);
-                               break;
-                       }
-                       case 5: {
-                               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], args [1], args [2], args [3], args [4], &ftndesc);
-                               break;
-                       }
-                       case 6: {
-                               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], args [1], args [2], args [3], args [4], args [5], &ftndesc);
-                               break;
-                       }
-                       case 7: {
-                               void (*func)(gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer, gpointer) = rmethod->jit_wrapper;
-
-                               func (args [0], args [1], args [2], args [3], args [4], args [5], args [6], &ftndesc);
-                               break;
-                       }
-                       default:
-                               g_assert_not_reached ();
-                               break;
-                       }
-
-                       interp_pop_lmf (&ext);
+                       sp = do_jit_call (sp, vt_sp, context, frame, rmethod);
 
                        if (context->has_resume_state) {
                                /*
@@ -2707,56 +2783,9 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                                else
                                        goto exit_frame;
                        }
-
-                       MonoType *rtype = rmethod->rtype;
-                       switch (rtype->type) {
-                       case MONO_TYPE_VOID:
-                       case MONO_TYPE_OBJECT:
-                       case MONO_TYPE_STRING:
-                       case MONO_TYPE_CLASS:
-                       case MONO_TYPE_ARRAY:
-                       case MONO_TYPE_SZARRAY:
-                       case MONO_TYPE_I:
-                       case MONO_TYPE_U:
-                               sp->data.p = *(gpointer*)res_buf;
-                               break;
-                       case MONO_TYPE_I1:
-                               sp->data.i = *(gint8*)res_buf;
-                               break;
-                       case MONO_TYPE_U1:
-                               sp->data.i = *(guint8*)res_buf;
-                               break;
-                       case MONO_TYPE_I2:
-                               sp->data.i = *(gint16*)res_buf;
-                               break;
-                       case MONO_TYPE_U2:
-                               sp->data.i = *(guint16*)res_buf;
-                               break;
-                       case MONO_TYPE_I4:
-                               sp->data.i = *(gint32*)res_buf;
-                               break;
-                       case MONO_TYPE_U4:
-                               sp->data.i = *(guint32*)res_buf;
-                               break;
-                       case MONO_TYPE_VALUETYPE:
-                               /* The result was written to vt_sp */
-                               sp->data.p = vt_sp;
-                               break;
-                       case MONO_TYPE_GENERICINST:
-                               if (MONO_TYPE_IS_REFERENCE (rtype)) {
-                                       sp->data.p = *(gpointer*)res_buf;
-                               } else {
-                                       /* The result was written to vt_sp */
-                                       sp->data.p = vt_sp;
-                               }
-                               break;
-                       default:
-                               printf ("%s\n", mono_type_full_name (rtype));
-                               g_assert_not_reached ();
-                               break;
-                       }
-                       if (rtype->type != MONO_TYPE_VOID)
+                       if (rmethod->rtype->type != MONO_TYPE_VOID)
                                sp++;
+
                        MINT_IN_BREAK;
                }
 
@@ -2779,7 +2808,7 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                        this_arg = sp->data.p;
                        if (!this_arg)
                                THROW_EX (mono_get_exception_null_reference(), ip - 2);
-                       child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
+                       child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
 
                        MonoClass *this_class = this_arg->vtable->klass;
                        if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
@@ -2834,7 +2863,7 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                        this_arg = sp->data.p;
                        if (!this_arg)
                                THROW_EX (mono_get_exception_null_reference(), ip - 2);
-                       child_frame.runtime_method = get_virtual_method (context->domain, child_frame.runtime_method, this_arg);
+                       child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
 
                        MonoClass *this_class = this_arg->vtable->klass;
                        if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
@@ -3605,7 +3634,7 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                        if (newobj_class->parent == mono_defaults.array_class) {
                                sp -= csig->param_count;
                                child_frame.stack_args = sp;
-                               o = ves_array_create (&child_frame, context->domain, newobj_class, csig, sp);
+                               o = ves_array_create (&child_frame, rtm->domain, newobj_class, csig, sp);
                                if (child_frame.ex)
                                        THROW_EX (child_frame.ex, ip);
                                goto array_constructed;
@@ -3633,7 +3662,7 @@ ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, uns
                        } else {
                                if (newobj_class != mono_defaults.string_class) {
                                        context->managed_code = 0;
-                                       o = mono_object_new_checked (context->domain, newobj_class, &error);
+                                       o = mono_object_new_checked (rtm->domain, newobj_class, &error);
                                        mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                                        context->managed_code = 1;
                                        if (*mono_thread_interruption_request_flag ())
@@ -3788,14 +3817,15 @@ array_constructed:
                                THROW_EX (mono_get_exception_null_reference (), ip);
                        field = rtm->data_items[* (guint16 *)(ip + 1)];
                        ip += 2;
+#ifndef DISABLE_REMOTING
                        if (mono_object_is_transparent_proxy (o)) {
                                MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
 
                                addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else {
+                       } else
+#endif
                                addr = (char*)o + field->offset;
-                       }                               
 
                        stackval_from_data (field->type, &sp [-1], addr, FALSE);
                        MINT_IN_BREAK;
@@ -3812,13 +3842,14 @@ array_constructed:
                        field = rtm->data_items[* (guint16 *)(ip + 1)];
                        i32 = READ32(ip + 2);
                        ip += 4;
+#ifndef DISABLE_REMOTING
                        if (mono_object_is_transparent_proxy (o)) {
                                MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
                                addr = mono_load_remote_field_checked (o, klass, field, &tmp, &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
-                       } else {
+                       } else
+#endif
                                addr = (char*)o + field->offset;
-                       }                               
 
                        sp [-1].data.p = vt_sp;
                        memcpy(sp [-1].data.p, (char *)o + * (guint16 *)(ip + 1), i32);
@@ -3874,11 +3905,13 @@ array_constructed:
                        field = rtm->data_items[* (guint16 *)(ip + 1)];
                        ip += 2;
 
+#ifndef DISABLE_REMOTING
                        if (mono_object_is_transparent_proxy (o)) {
                                MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
                                mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        } else
+#endif
                                stackval_to_data (field->type, &sp [-1], (char*)o + field->offset, FALSE);
 
                        sp -= 2;
@@ -3894,11 +3927,13 @@ array_constructed:
                        i32 = READ32(ip + 2);
                        ip += 4;
 
+#ifndef DISABLE_REMOTING
                        if (mono_object_is_transparent_proxy (o)) {
                                MonoClass *klass = ((MonoTransparentProxy*)o)->remote_class->proxy_class;
                                mono_store_remote_field_checked (o, klass, field, &sp [-1].data, &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        } else
+#endif
                                memcpy((char*)o + field->offset, sp [-1].data.p, i32);
 
                        sp -= 2;
@@ -3907,14 +3942,14 @@ array_constructed:
                }
                MINT_IN_CASE(MINT_LDSFLDA) {
                        MonoClassField *field = rtm->data_items[*(guint16 *)(ip + 1)];
-                       sp->data.p = mono_class_static_field_address (context->domain, field);
+                       sp->data.p = mono_class_static_field_address (rtm->domain, field);
                        ip += 2;
                        ++sp;
                        MINT_IN_BREAK;
                }
                MINT_IN_CASE(MINT_LDSFLD) {
                        MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       gpointer addr = mono_class_static_field_address (rtm->domain, field);
                        stackval_from_data (field->type, sp, addr, FALSE);
                        ip += 2;
                        ++sp;
@@ -3922,7 +3957,7 @@ array_constructed:
                }
                MINT_IN_CASE(MINT_LDSFLD_VT) {
                        MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       gpointer addr = mono_class_static_field_address (rtm->domain, field);
                        int size = READ32 (ip + 2);
                        ip += 4;
 
@@ -3934,7 +3969,7 @@ array_constructed:
                }
                MINT_IN_CASE(MINT_STSFLD) {
                        MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       gpointer addr = mono_class_static_field_address (rtm->domain, field);
                        ip += 2;
                        --sp;
                        stackval_to_data (field->type, sp, addr, FALSE);
@@ -3942,7 +3977,7 @@ array_constructed:
                }
                MINT_IN_CASE(MINT_STSFLD_VT) {
                        MonoClassField *field = rtm->data_items [* (guint16 *)(ip + 1)];
-                       gpointer addr = mono_class_static_field_address (context->domain, field);
+                       gpointer addr = mono_class_static_field_address (rtm->domain, field);
                        int size = READ32 (ip + 2);
                        ip += 4;
 
@@ -4020,20 +4055,20 @@ array_constructed:
 
                        if (c->byval_arg.type == MONO_TYPE_VALUETYPE && !c->enumtype) {
                                int size = mono_class_value_size (c, NULL);
-                               sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, sp [-1 - offset].data.p, &error);
+                               sp [-1 - offset].data.p = mono_value_box_checked (rtm->domain, c, sp [-1 - offset].data.p, &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                                size = (size + 7) & ~7;
                                vt_sp -= size;
                        } else {
                                stackval_to_data (&c->byval_arg, &sp [-1 - offset], (char *) &sp [-1 - offset], FALSE);
-                               sp [-1 - offset].data.p = mono_value_box_checked (context->domain, c, &sp [-1 - offset], &error);
+                               sp [-1 - offset].data.p = mono_value_box_checked (rtm->domain, c, &sp [-1 - offset], &error);
                                mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        }
                        ip += 3;
                        MINT_IN_BREAK;
                }
                MINT_IN_CASE(MINT_NEWARR)
-                       sp [-1].data.p = (MonoObject*) mono_array_new_checked (context->domain, rtm->data_items[*(guint16 *)(ip + 1)], sp [-1].data.i, &error);
+                       sp [-1].data.p = (MonoObject*) mono_array_new_checked (rtm->domain, rtm->data_items[*(guint16 *)(ip + 1)], sp [-1].data.i, &error);
                        if (!mono_error_ok (&error)) {
                                THROW_EX (mono_error_convert_to_exception (&error), ip);
                        }
@@ -4539,7 +4574,7 @@ array_constructed:
                        ++sp;
                        MINT_IN_BREAK;
                MINT_IN_CASE(MINT_MONO_NEWOBJ)
-                       sp->data.p = mono_object_new_checked (context->domain, rtm->data_items [*(guint16 *)(ip + 1)], &error);
+                       sp->data.p = mono_object_new_checked (rtm->domain, rtm->data_items [*(guint16 *)(ip + 1)], &error);
                        mono_error_cleanup (&error); /* FIXME: don't swallow the error */
                        ip += 2;
                        sp++;
@@ -4572,8 +4607,8 @@ array_constructed:
                        MonoDomain *tls_domain = (MonoDomain *) ((gpointer (*)()) mono_tls_get_tls_getter (TLS_KEY_DOMAIN, FALSE)) ();
                        gpointer tls_jit = ((gpointer (*)()) mono_tls_get_tls_getter (TLS_KEY_DOMAIN, FALSE)) ();
 
-                       if (tls_domain != context->domain || !tls_jit)
-                               context->original_domain = mono_jit_thread_attach (context->domain);
+                       if (tls_domain != rtm->domain || !tls_jit)
+                               context->original_domain = mono_jit_thread_attach (rtm->domain);
                        MINT_IN_BREAK;
                }
                MINT_IN_CASE(MINT_MONO_JIT_DETACH)
@@ -4582,7 +4617,6 @@ array_constructed:
                        MINT_IN_BREAK;
                MINT_IN_CASE(MINT_SDB_INTR_LOC)
                        if (G_UNLIKELY (ss_enabled)) {
-                               MonoLMFExt ext;
                                static void (*ss_tramp) (void);
 
                                if (!ss_tramp) {
@@ -4597,14 +4631,12 @@ array_constructed:
                                 */
                                frame->ip = ip + 1;
 
-                               interp_push_lmf (&ext, frame);
                                /*
                                 * Use the same trampoline as the JIT. This ensures that
                                 * the debugger has the context for the last interpreter
                                 * native frame.
                                 */
-                               ss_tramp ();
-                               interp_pop_lmf (&ext);
+                               do_debugger_tramp (ss_tramp, frame);
 
                                if (context->has_resume_state) {
                                        if (frame == context->handler_frame)
@@ -4620,8 +4652,6 @@ array_constructed:
                        ++ip;
                        MINT_IN_BREAK;
                MINT_IN_CASE(MINT_SDB_BREAKPOINT) {
-                       MonoLMFExt ext;
-
                        static void (*bp_tramp) (void);
                        if (!bp_tramp) {
                                void *tramp = mini_get_breakpoint_trampoline ();
@@ -4631,10 +4661,8 @@ array_constructed:
 
                        frame->ip = ip;
 
-                       interp_push_lmf (&ext, frame);
                        /* Use the same trampoline as the JIT */
-                       bp_tramp ();
-                       interp_pop_lmf (&ext);
+                       do_debugger_tramp (bp_tramp, frame);
 
                        if (context->has_resume_state) {
                                if (frame == context->handler_frame)
@@ -4744,7 +4772,7 @@ array_constructed:
                        if (!sp->data.p)
                                THROW_EX (mono_get_exception_null_reference (), ip - 2);
                                
-                       sp->data.p = get_virtual_method (context->domain, m, sp->data.p);
+                       sp->data.p = get_virtual_method (m, sp->data.p);
                        ++sp;
                        MINT_IN_BREAK;
                }
@@ -5173,6 +5201,7 @@ ves_exec_method (MonoInvocation *frame)
 {
        ThreadContext *context = mono_native_tls_get_value (thread_context_id);
        ThreadContext context_struct;
+       MonoDomain *domain = frame->runtime_method->domain;
        MonoError error;
        jmp_buf env;
 
@@ -5184,7 +5213,6 @@ ves_exec_method (MonoInvocation *frame)
        }
        if (context == NULL) {
                context = &context_struct;
-               context_struct.domain = mono_domain_get ();
                context_struct.base_frame = frame;
                context_struct.current_frame = NULL;
                context_struct.env_frame = frame;
@@ -5195,7 +5223,7 @@ ves_exec_method (MonoInvocation *frame)
        }
        frame->ip = NULL;
        frame->parent = context->current_frame;
-       frame->runtime_method = mono_interp_get_runtime_method (context->domain, frame->method, &error);
+       frame->runtime_method = mono_interp_get_runtime_method (domain, frame->method, &error);
        mono_error_cleanup (&error); /* FIXME: don't swallow the error */
        context->managed_code = 1;
        ves_exec_method_with_context (frame, context, NULL, NULL, -1);
index 03e848a42db2775bdbb0e7894d26b371f8daac5e..57b50650a7bd6525d669d4616715d2470b692e0a 100644 (file)
@@ -1327,7 +1327,7 @@ generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, Mo
        MonoMethodHeader *header = mono_method_get_header (method);
        MonoMethodSignature *signature = mono_method_signature (method);
        MonoImage *image = method->klass->image;
-       MonoDomain *domain = mono_domain_get ();
+       MonoDomain *domain = rtm->domain;
        MonoClass *constrained_class = NULL;
        MonoError error;
        int offset, mt, i, i32;
@@ -2565,11 +2565,14 @@ generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, Mo
 
                        MonoClass *field_klass = mono_class_from_mono_type (field->type);
                        mt = mint_type (&field_klass->byval_arg);
+#ifndef DISABLE_REMOTING
                        if (klass->marshalbyref) {
                                g_assert (!is_static);
                                ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT :  MINT_LDRMFLD);
                                ADD_CODE(&td, get_data_item_index (&td, field));
-                       } else  {
+                       } else
+#endif
+                       {
                                if (is_static) {
                                        ADD_CODE (&td, MINT_POP);
                                        ADD_CODE (&td, 0);
@@ -2605,11 +2608,14 @@ generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, Mo
                        mono_class_init (klass);
                        mt = mint_type(field->type);
 
+#ifndef DISABLE_REMOTING
                        if (klass->marshalbyref) {
                                g_assert (!is_static);
                                ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
                                ADD_CODE(&td, get_data_item_index (&td, field));
-                       } else  {
+                       } else
+#endif
+                       {
                                if (is_static) {
                                        ADD_CODE (&td, MINT_POP);
                                        ADD_CODE (&td, 1);
@@ -3915,12 +3921,12 @@ mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *cont
        const MonoOpcode *opcode;
        MonoMethod *m;
        MonoClass *class;
-       MonoDomain *domain = mono_domain_get ();
        unsigned char *is_bb_start;
        int in;
        MonoVTable *method_class_vt;
        int backwards;
        MonoGenericContext *generic_context = NULL;
+       MonoDomain *domain = runtime_method->domain;
 
        // g_printerr ("TRANSFORM(0x%016lx): begin %s::%s\n", mono_thread_current (), method->klass->name, method->name);
        method_class_vt = mono_class_vtable (domain, runtime_method->method->klass);
index 648e69cf18cc49cff4c27e6ee517637df2d83a68..2b66be22f182a3b0b0289899dd46a4e02fe054bb 100644 (file)
@@ -1089,16 +1089,6 @@ mono_lconv_to_r8_un (guint64 a)
 }
 #endif
 
-#if defined(__native_client_codegen__) || defined(__native_client__)
-/* When we cross-compile to Native Client we can't directly embed calls */
-/* to the math library on the host. This will use the fmod on the target*/
-double
-mono_fmod(double a, double b)
-{
-       return fmod(a, b);
-}
-#endif
-
 gpointer
 mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg)
 {
index f605a709507ac845e886240354877a313bd91c68..ffe4342d2398168fc42fde8ef57f2e2649eaf7f9 100644 (file)
@@ -99,10 +99,6 @@ double mono_conv_to_r8_un (guint32 a);
 
 double mono_lconv_to_r8_un (guint64 a);
 
-#if defined(__native_client_codegen__) || defined(__native_client__)
-double mono_fmod(double a, double b);
-#endif
-
 gpointer mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg);
 
 MonoString*
index 59e713da790443c5c6201607af18213f34d1351f..302b28b69e2d7393f036a55141ac6de893df55dc 100644 (file)
@@ -54,7 +54,10 @@ typedef enum {
         * equivalent to mono_jit_set_aot_only (true) */
        MONO_AOT_MODE_FULL,
        /* Same as full, but use only llvm compiled code */
-       MONO_AOT_MODE_LLVMONLY
+       MONO_AOT_MODE_LLVMONLY,
+       /* Uses Interpreter, JIT is disabled and not allowed,
+        * equivalent to "--full-aot --interpreter" */
+       MONO_AOT_MODE_INTERP
 } MonoAotMode;
 
 MONO_API void
index 3817d2809f9e0acecb6c2857f0be4a0246017371..0c37dc1533c5b699e6444e144b806f9f8a7dfaed 100644 (file)
@@ -6445,27 +6445,6 @@ mini_get_method (MonoCompile *cfg, MonoMethod *m, guint32 token, MonoClass *klas
        return method;
 }
 
-MonoClass*
-mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
-{
-       MonoError error;
-       MonoClass *klass;
-
-       if (method->wrapper_type != MONO_WRAPPER_NONE) {
-               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
-               if (context) {
-                       klass = mono_class_inflate_generic_class_checked (klass, context, &error);
-                       mono_error_cleanup (&error); /* FIXME don't swallow the error */
-               }
-       } else {
-               klass = mono_class_get_and_inflate_typespec_checked (method->klass->image, token, context, &error);
-               mono_error_cleanup (&error); /* FIXME don't swallow the error */
-       }
-       if (klass)
-               mono_class_init (klass);
-       return klass;
-}
-
 static inline MonoMethodSignature*
 mini_get_signature (MonoMethod *method, guint32 token, MonoGenericContext *context, MonoError *error)
 {
index 2978af64ecb07220ee87c0e7a8af7afb8f30c7f7..60bbd6807498d948f2a1b24ace680e6064e99e95 100644 (file)
@@ -3229,7 +3229,7 @@ mono_emit_stack_alloc (MonoCompile *cfg, guchar *code, MonoInst* tree)
 #if defined(TARGET_WIN32)
        need_touch = TRUE;
 #elif defined(MONO_ARCH_SIGSEGV_ON_ALTSTACK)
-       if (!tree->flags & MONO_INST_INIT)
+       if (!(tree->flags & MONO_INST_INIT))
                need_touch = TRUE;
 #endif
 
index 10a9daa20ef24f7fd45f015a82d119d3c3f80a17..9f2be7efacc50d72195d484bcfcafa460ac77e44 100644 (file)
@@ -323,7 +323,7 @@ mono_arm_patchable_bl (guint8 *code, int cond)
        return code;
 }
 
-#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(__native_client__) && !defined(MONO_CROSS_COMPILE)
+#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(MONO_CROSS_COMPILE)
 #define HAVE_AEABI_READ_TP 1
 #endif
 
index 671014199b8be525e33d87a860309975b9e4df74..2e8914c395c6160462754e6c8c34155e31eb9079 100644 (file)
@@ -329,7 +329,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_DYN_CALL_SUPPORTED 1
 #define MONO_ARCH_DYN_CALL_PARAM_AREA (DYN_CALL_STACK_ARGS * sizeof (mgreg_t))
 
-#ifndef MONO_CROSS_COMPILE
+#if !(defined(TARGET_ANDROID) && defined(MONO_CROSS_COMPILE))
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
 #endif
 
index 8aeb6ffb2f48e88b4a227ad352ad2b78a995d54c..e4cb111cc38994bdd1b10b5b9b7a1ac7bb93bb4c 100644 (file)
@@ -9,6 +9,9 @@
 #include "config.h"
 
 #include "mini.h"
+#ifdef ENABLE_INTERPRETER
+#include "interp/interp.h"
+#endif
 #include "tasklets.h"
 #include <mono/metadata/abi-details.h>
 
index c24bf22d601ac7040b1965ed698977fcb99c80fa..de4898bdd3e06cfce4162bfbce591c22bc293ff7 100644 (file)
@@ -282,6 +282,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX 1
 #define MONO_ARCH_HAVE_SETUP_RESUME_FROM_SIGNAL_HANDLER_CTX 1
 #define MONO_ARCH_GSHARED_SUPPORTED 1
+#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
 
 /* set the next to 0 once inssel-mips.brg is updated */
 #define MIPS_PASS_STRUCTS_BY_VALUE 1
index 3659f7b99a420a344268ab756e9daedbfde50f4f..5bcf5435df0e2a65a9a2f154b6582c80f8f3674f 100644 (file)
@@ -75,7 +75,7 @@
 #include <mach/clock.h>
 #endif
 
-#if defined(__native_client__) || defined(HOST_WATCHOS)
+#if defined(HOST_WATCHOS)
 
 void
 mono_runtime_setup_stat_profiler (void)
@@ -840,16 +840,7 @@ mono_runtime_setup_stat_profiler (void)
 
 #endif
 
-#endif /* defined(__native_client__) || defined(HOST_WATCHOS) */
-
-#if defined(__native_client__)
-
-void
-mono_gdb_render_native_backtraces (pid_t crashed_pid)
-{
-}
-
-#else
+#endif /* defined(HOST_WATCHOS) */
 
 static gboolean
 native_stack_with_gdb (pid_t crashed_pid, const char **argv, FILE *commands, char* commands_filename)
@@ -946,8 +937,6 @@ exec:
 #endif // HAVE_EXECV
 }
 
-#endif /* defined(__native_client__) */
-
 #if !defined (__MACH__)
 
 gboolean
index aaa6ddda3ecf8a2310758f067c1a1eaa89911693..718bb98d6fa4077ed1e8179f5c3bbb419ca3c21e 100644 (file)
@@ -236,6 +236,7 @@ typedef struct MonoCompileArch {
 #define MONO_ARCH_SOFT_DEBUG_SUPPORTED 1
 #endif
 #define MONO_ARCH_HAVE_OP_TAIL_CALL 1
+#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
 
 #define PPC_NUM_REG_ARGS (PPC_LAST_ARG_REG-PPC_FIRST_ARG_REG+1)
 #define PPC_NUM_REG_FPARGS (PPC_LAST_FPARG_REG-PPC_FIRST_FPARG_REG+1)
index 7d427a915ee53263ccff6c19689782a15c5c48d7..f67497d6836e7989f6d9378287d704d08f1de5da 100644 (file)
@@ -372,16 +372,6 @@ mono_global_codeman_foreach (MonoCodeManagerFunc func, void *user_data)
        mono_jit_unlock ();
 }
 
-#if defined(__native_client_codegen__) && defined(__native_client__)
-void
-mono_nacl_gc()
-{
-#ifdef __native_client_gc__
-       __nacl_suspend_thread_if_needed();
-#endif
-}
-#endif /* __native_client__ */
-
 /**
  * mono_create_unwind_op:
  *
@@ -1403,21 +1393,12 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                break;
        }
        case MONO_PATCH_INFO_GC_SAFE_POINT_FLAG:
-#if defined(__native_client_codegen__)
-               target = (gpointer)&__nacl_thread_suspension_needed;
-#else
                g_assert (mono_threads_is_coop_enabled ());
                target = (gpointer)&mono_polling_required;
-#endif
                break;
        case MONO_PATCH_INFO_SWITCH: {
                gpointer *jump_table;
                int i;
-#if defined(__native_client__) && defined(__native_client_codegen__)
-               /* This memory will leak, but we don't care if we're */
-               /* not deleting JIT'd methods anyway                 */
-               jump_table = g_malloc0 (sizeof(gpointer) * patch_info->data.table->table_size);
-#else
                if (method && method->dynamic) {
                        jump_table = (void **)mono_code_manager_reserve (mono_dynamic_code_hash_lookup (domain, method)->code_mp, sizeof (gpointer) * patch_info->data.table->table_size);
                } else {
@@ -1427,7 +1408,6 @@ mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code,
                                jump_table = (void **)mono_domain_code_reserve (domain, sizeof (gpointer) * patch_info->data.table->table_size);
                        }
                }
-#endif
 
                for (i = 0; i < patch_info->data.table->table_size; i++) {
                        jump_table [i] = code + GPOINTER_TO_INT (patch_info->data.table->table [i]);
@@ -1757,6 +1737,27 @@ mono_get_jit_info_from_method (MonoDomain *domain, MonoMethod *method)
        return lookup_method (domain, method);
 }
 
+MonoClass*
+mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
+{
+       MonoError error;
+       MonoClass *klass;
+
+       if (method->wrapper_type != MONO_WRAPPER_NONE) {
+               klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
+               if (context) {
+                       klass = mono_class_inflate_generic_class_checked (klass, context, &error);
+                       mono_error_cleanup (&error); /* FIXME don't swallow the error */
+               }
+       } else {
+               klass = mono_class_get_and_inflate_typespec_checked (method->klass->image, token, context, &error);
+               mono_error_cleanup (&error); /* FIXME don't swallow the error */
+       }
+       if (klass)
+               mono_class_init (klass);
+       return klass;
+}
+
 #if ENABLE_JIT_MAP
 static FILE* perf_map_file;
 
@@ -2062,7 +2063,18 @@ lookup_start:
 
 #ifdef MONO_USE_AOT_COMPILER
        if (opt & MONO_OPT_AOT) {
-               MonoDomain *domain = mono_domain_get ();
+               MonoDomain *domain = NULL;
+
+               if (mono_aot_mode == MONO_AOT_MODE_INTERP && method->wrapper_type == MONO_WRAPPER_UNKNOWN) {
+                       WrapperInfo *info = mono_marshal_get_wrapper_info (method);
+                       g_assert (info);
+                       if (info->subtype == WRAPPER_SUBTYPE_INTERP_IN)
+                               /* AOT'd wrappers for interp must be owned by root domain */
+                               domain = mono_get_root_domain ();
+               }
+
+               if (!domain)
+                       domain = mono_domain_get ();
 
                mono_class_init (method->klass);
 
@@ -3763,7 +3775,7 @@ mini_init (const char *filename, const char *runtime_version)
 
        CHECKED_MONO_INIT ();
 
-#if defined(__linux__) && !defined(__native_client__)
+#if defined(__linux__)
        if (access ("/proc/self/maps", F_OK) != 0) {
                g_print ("Mono requires /proc to be mounted.\n");
                exit (1);
@@ -4067,10 +4079,6 @@ register_icalls (void)
        register_icall (mono_thread_interruption_checkpoint, "mono_thread_interruption_checkpoint", "object", FALSE);
        register_icall (mono_thread_force_interruption_checkpoint_noraise, "mono_thread_force_interruption_checkpoint_noraise", "object", FALSE);
 
-#if defined(__native_client__) || defined(__native_client_codegen__)
-       register_icall (mono_nacl_gc, "mono_nacl_gc", "void", FALSE);
-#endif
-
        if (mono_threads_is_coop_enabled ())
                register_icall (mono_threads_state_poll, "mono_threads_state_poll", "void", FALSE);
 
@@ -4139,12 +4147,8 @@ register_icalls (void)
        register_opcode_emulation (OP_LCONV_TO_R_UN, "__emul_lconv_to_r8_un", "double long", mono_lconv_to_r8_un, "mono_lconv_to_r8_un", FALSE);
 #endif
 #ifdef MONO_ARCH_EMULATE_FREM
-#if !defined(__native_client__)
        register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", fmod, "fmod", FALSE);
        register_opcode_emulation (OP_RREM, "__emul_rrem", "float float float", fmodf, "fmodf", FALSE);
-#else
-       register_opcode_emulation (OP_FREM, "__emul_frem", "double double double", mono_fmod, "mono_fmod", FALSE);
-#endif
 #endif
 
 #ifdef MONO_ARCH_SOFT_FLOAT_FALLBACK
index 5c40278e39d373a23da950143ee37b14b4054685..a3d0a60000383c2ad3c790fdadd618b6ed149220 100644 (file)
@@ -237,6 +237,7 @@ typedef struct {
 #define MONO_ARCH_HAVE_DUMMY_INIT 1
 #define MONO_ARCH_HAVE_SDB_TRAMPOLINES 1
 #define MONO_ARCH_HAVE_PATCH_CODE_NEW 1
+#define MONO_ARCH_HAVE_INIT_LMF_EXT 1
 
 /* Used for optimization, not complete */
 #define MONO_ARCH_IS_OP_MEMBASE(opcode) ((opcode) == OP_X86_PUSH_MEMBASE)
index c81919ececada46517dc824b89e7a60219885640..10d6eac8b16d0b4a0306565c4a7642c07e5f1edd 100644 (file)
@@ -2152,18 +2152,11 @@ mono_postprocess_patches (MonoCompile *cfg)
                }
                case MONO_PATCH_INFO_SWITCH: {
                        gpointer *table;
-#if defined(__native_client__) && defined(__native_client_codegen__)
-                       /* This memory will leak.  */
-                       /* TODO: can we free this when  */
-                       /* making the final jump table? */
-                       table = g_malloc0 (sizeof(gpointer) * patch_info->data.table->table_size);
-#else
                        if (cfg->method->dynamic) {
                                table = (void **)mono_code_manager_reserve (cfg->dynamic_info->code_mp, sizeof (gpointer) * patch_info->data.table->table_size);
                        } else {
                                table = (void **)mono_domain_code_reserve (cfg->domain, sizeof (gpointer) * patch_info->data.table->table_size);
                        }
-#endif
 
                        for (i = 0; i < patch_info->data.table->table_size; i++) {
                                /* Might be NULL if the switch is eliminated */
@@ -2385,9 +2378,6 @@ mono_codegen (MonoCompile *cfg)
        } else {
                mono_domain_code_commit (code_domain, cfg->native_code, cfg->code_size, cfg->code_len);
        }
-#if defined(__native_client_codegen__) && defined(__native_client__)
-       cfg->native_code = code_dest;
-#endif
        mono_profiler_code_buffer_new (cfg->native_code, cfg->code_len, MONO_PROFILER_CODE_BUFFER_METHOD, cfg->method);
        
        mono_arch_flush_icache (cfg->native_code, cfg->code_len);
@@ -2869,12 +2859,8 @@ mono_create_gc_safepoint (MonoCompile *cfg, MonoBasicBlock *bblock)
        if (cfg->verbose_level > 1)
                printf ("ADDING SAFE POINT TO BB %d\n", bblock->block_num);
 
-#if defined(__native_client_codegen__)
-       NEW_AOTCONST (cfg, poll_addr, MONO_PATCH_INFO_GC_SAFE_POINT_FLAG, (gpointer)&__nacl_thread_suspension_needed);
-#else
        g_assert (mono_threads_is_coop_enabled ());
        NEW_AOTCONST (cfg, poll_addr, MONO_PATCH_INFO_GC_SAFE_POINT_FLAG, (gpointer)&mono_polling_required);
-#endif
 
        MONO_INST_NEW (cfg, ins, OP_GC_SAFE_POINT);
        ins->sreg1 = poll_addr->dreg;
@@ -2919,19 +2905,13 @@ mono_insert_safepoints (MonoCompile *cfg)
 {
        MonoBasicBlock *bb;
 
-#if !defined(__native_client_codegen__)
        if (!mono_threads_is_coop_enabled ())
                return;
-#endif
 
        if (cfg->method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE) {
                WrapperInfo *info = mono_marshal_get_wrapper_info (cfg->method);
-#if defined(__native_client__) || defined(__native_client_codegen__)
-               gpointer poll_func = &mono_nacl_gc;
-#else
                g_assert (mono_threads_is_coop_enabled ());
                gpointer poll_func = &mono_threads_state_poll;
-#endif
 
                if (info && info->subtype == WRAPPER_SUBTYPE_ICALL_WRAPPER && info->d.icall.func == poll_func) {
                        if (cfg->verbose_level > 1)
@@ -3207,13 +3187,9 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
                cfg->gen_seq_points = FALSE;
                cfg->gen_sdb_seq_points = FALSE;
        }
-       /* coop / nacl requires loop detection to happen */
-#if defined(__native_client_codegen__)
-       cfg->opt |= MONO_OPT_LOOP;
-#else
+       /* coop requires loop detection to happen */
        if (mono_threads_is_coop_enabled ())
                cfg->opt |= MONO_OPT_LOOP;
-#endif
        cfg->explicit_null_checks = debug_options.explicit_null_checks || (flags & JIT_FLAG_EXPLICIT_NULL_CHECKS);
        cfg->soft_breakpoints = debug_options.soft_breakpoints;
        cfg->check_pinvoke_callconv = debug_options.check_pinvoke_callconv;
@@ -4359,8 +4335,12 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
                }
        }
 
-       if (!mono_runtime_class_init_full (vtable, error))
-               return NULL;
+       if (!(method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE ||
+                 method->wrapper_type == MONO_WRAPPER_REMOTING_INVOKE_WITH_CHECK ||
+                 method->wrapper_type == MONO_WRAPPER_XDOMAIN_INVOKE)) {
+               if (!mono_runtime_class_init_full (vtable, error))
+                       return NULL;
+       }
        return code;
 }
 
index ed10d8f937934da36d172b9a60b1b2847947453d..1fcb2f1d892789f35101633f0ec5c7a9f9498535 100644 (file)
 #include "mono/metadata/security-manager.h"
 #include "mono/metadata/exception.h"
 
-#ifdef __native_client_codegen__
-#include <nacl/nacl_dyncode.h>
-#endif
-
-
 /*
  * The mini code should not have any compile time dependencies on the GC being used, so the same object file from mini/
  * can be linked into both mono and mono-sgen.
@@ -1679,11 +1674,6 @@ typedef struct {
        MonoInst *stack_inbalance_var;
 
        unsigned char   *cil_start;
-#ifdef __native_client_codegen__
-       /* this alloc is not aligned, native_code */
-       /* is the 32-byte aligned version of this */
-       unsigned char   *native_code_alloc;
-#endif
        unsigned char   *native_code;
        guint            code_size;
        guint            code_len;
@@ -2500,12 +2490,6 @@ void      mono_liveness_handle_exception_clauses (MonoCompile *cfg);
 /* Native Client functions */
 gpointer mono_realloc_native_code(MonoCompile *cfg);
 
-#if defined(__native_client__) || defined(__native_client_codegen__)
-extern volatile int __nacl_thread_suspension_needed;
-void __nacl_suspend_thread_if_needed(void);
-void mono_nacl_gc(void);
-#endif
-
 extern MonoDebugOptions debug_options;
 
 static inline MonoMethod*
@@ -2814,6 +2798,9 @@ gboolean  mono_arch_is_breakpoint_event         (void *info, void *sigctx);
 void     mono_arch_skip_breakpoint              (MonoContext *ctx, MonoJitInfo *ji);
 void     mono_arch_skip_single_step             (MonoContext *ctx);
 gpointer mono_arch_get_seq_point_info           (MonoDomain *domain, guint8 *code);
+#endif
+
+#ifdef MONO_ARCH_HAVE_INIT_LMF_EXT
 void     mono_arch_init_lmf_ext                 (MonoLMFExt *ext, gpointer prev_lmf);
 #endif
 
index e5d6ae6bdb82618cfa703fd77e2811170f68788e..c0aa5fdf64a8a37f27bbaced10183f224d0d42ed 100644 (file)
@@ -2,11 +2,7 @@
  * \file
  */
 
-#if defined(__native_client__) && defined(__x86_64__)
-typedef guint64 regmask_t;
-#else
 typedef size_t regmask_t;
-#endif
 
 enum {
        MONO_REG_INT,
index 723238f4e94b55edada227fd251ffe40344a769b..13c09ac33a72ca821bbd6085e2568cf7596171d3 100644 (file)
@@ -1042,7 +1042,13 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
        g_assert_not_reached ();
        return NULL;
 }
-       
+
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
 #endif /* DISABLE_JIT */
 
 guint8*
index da998d4b1aa72bf4197d648a21d7dea3d42d85ec..e8503e61c6c68da41fa2f9ef51cbd4db7e7f58d8 100644 (file)
@@ -877,4 +877,10 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
        return NULL;
 }
 
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
 #endif /* !DISABLE_JIT */
index 0e67d3d63c613675eadd855c134d887d123e9e3c..faecb47d4de845102c506bef722fab3652b24cd2 100644 (file)
@@ -633,3 +633,10 @@ mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code)
        return ((guint32*)plt_entry) [6];
 #endif
 }
+
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
index 89ae8d64281d6b3e412b04d0b165b17a0a8591c0..55a6d77191e6a34d30958724a11cb3950be2f46a 100644 (file)
@@ -818,3 +818,10 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
        return buf;
 }
 
+gpointer
+mono_arch_get_enter_icall_trampoline (MonoTrampInfo **info)
+{
+       g_assert_not_reached ();
+       return NULL;
+}
+
index f962de50f3a4bce1af1b243626fe27253982edab..f96c8a3fcccfba10337d1c2c3597139df56c46c5 100644 (file)
@@ -50,10 +50,8 @@ endif
 
 # FIXME fix the profiler tests to work with coop.
 if !ENABLE_COOP
-if !NACL_CODEGEN
 check_targets = testlog
 endif
-endif
 
 endif
 endif
index f98fd353e378c0dfa7cb9baa2225b2b8a48e20b6..fb6a40bc75133bb2ec224ad7e2d1b1e8c90e7102 100644 (file)
 #define HASH_SIZE 9371
 #define SMALL_HASH_SIZE 31
 
-#if defined(__native_client__) || defined(__native_client_codegen__)
-volatile int __nacl_thread_suspension_needed = 0;
-void __nacl_suspend_thread_if_needed() {}
-#endif
-
 static int debug = 0;
 static int collect_traces = 0;
 static int show_traces = 0;
index 82d637d2b2674c12cca0fb0331d4966fe8085a6f..8d3252eb186d6879d8028a80f42acce32ba7d8ca 100644 (file)
@@ -314,7 +314,7 @@ should_work_func (void *data_untyped)
        WorkerData *data = (WorkerData*)data_untyped;
        int current_worker = (int) (data - workers_data);
 
-       return started && current_worker < active_workers_num;
+       return started && current_worker < active_workers_num && state_is_working_or_enqueued (data->state);
 }
 
 static void
index 15af95e3e2a6c0ab31d9fc27487e642101626771..351d439e3713b3fb4abea69087e30aed7ee7b077 100755 (executable)
@@ -707,92 +707,6 @@ PLATFORM_DISABLED_TESTS += \
        sgen-bridge-xref.exe
 endif
 
-if NACL_CODEGEN
-# Tests that use Thread.Abort()
-PLATFORM_DISABLED_TESTS= abort-stress-1.exe \
-                         abort-stress-2.exe \
-                         abort-stress-3.exe \
-                         appdomain-thread-abort.exe \
-                         async-exc-compilation.exe \
-                         bug-561239.exe \
-                         bug-70561.exe \
-                         finalizer-abort.exe \
-                         finally_guard.exe \
-                         finally_block_ending_in_dead_bb.exe \
-                         main-returns-abort-resetabort.exe \
-                         main-returns-background-abort-resetabort.exe \
-                         thread6.exe \
-                         threadpool-exceptions5.exe \
-                         threadpool-exceptions6.exe
-
-PLATFORM_DISABLED_TESTS+= w32message.exe
-
-# Tests that rely on AppDomain.Unload
-PLATFORM_DISABLED_TESTS+= appdomain-async-invoke.exe \
-                          appdomain-exit.exe \
-                          appdomain-unload-callback.exe \
-                          appdomain-unload.exe \
-                          domain-stress.exe \
-                          generic-unloading.2.exe \
-                          monitor.exe \
-                          remoting4.exe \
-                          threadpool-exceptions7.exe \
-                          xdomain-threads.exe
-
-# pinvoke2 attaches a thread to the runtime, but
-# doesn't 'unattach' it and it hangs in GC on exit
-PLATFORM_DISABLED_TESTS+= pinvoke2.exe
-
-# Tests that currently hang waiting for non-main threads
-# to exit in NaCl, need to investigate.  Most are AppDomain
-# creation and Delegate tests.
-PLATFORM_DISABLED_TESTS+= appdomain1.exe \
-                          delegate9.exe \
-                          marshal-valuetypes.exe \
-                          cross-domain.exe \
-                          stackframes-async.2.exe \
-                          generic-marshalbyref.2.exe \
-                          generic-xdomain.2.exe \
-                          bug-415577.exe
-
-# Tests that fail trying to write files (appdomain create mostly)
-PLATFORM_DISABLED_TESTS+= bug-335131.2.exe \
-                          bug-349190.2.exe \
-                          bug-80307.exe \
-                          bug-462592.exe
-
-# FIXME: don't know why delegate2.exe fails, it shouldn't
-PLATFORM_DISABLED_TESTS+= delegate2.exe
-
-# These tests newly fail with the latest revision. pinvoke3 fails because
-# of a thread attach, the others have not been investigated.  TODO revisit.
-PLATFORM_DISABLED_TESTS+= pinvoke3.exe \
-                          async_read.exe \
-                          async-with-cb-throws.exe \
-                          appdomain-unload-doesnot-raise-pending-events.exe \
-                          gsharing-valuetype-layout.exe
-
-if X86
-# FIXME: There are problems with async callbacks and results on NaCl 32-bit
-PLATFORM_DISABLED_TESTS+= delegate1.exe \
-                          delegate3.exe \
-                          delegate5.exe \
-                          delegate8.exe \
-                          threadpool.exe \
-                          threadpool1.exe \
-                          threadpool-exceptions3.exe \
-                          bug-323114.exe \
-                          delegate-exit.exe \
-                          bug-80392.2.exe
-
-# FIXME: These tests hang/fail for unknown reasons, deal with exiting
-PLATFORM_DISABLED_TESTS+= main-returns-background-resetabort.exe \
-                          main-returns-background.exe \
-                          main-returns-background-change.exe
-endif
-
-endif
-
 if ENABLE_COOP
 COOP_DISABLED_TESTS= thunks.exe
 else
@@ -987,7 +901,6 @@ LLVM = $(filter --llvm, $(MONO_ENV_OPTIONS))
 # delegate-invoke.exe depends on 929c6bc9b6d76a273f251e6f5dfacac36e9c38bd which was
 # reverted.
 # bug-Xamarin-5278.exe got broken by 5d26590e79da139a284459299aee95c25f4cd835
-# bug-45841-fpstack-exceptions.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47053
 # appdomain-thread-abort.exe: https://bugzilla.xamarin.com/show_bug.cgi?id=47054
 KNOWN_FAILING_TESTS = \
        delegate-async-exception.exe    \
@@ -995,7 +908,6 @@ KNOWN_FAILING_TESTS = \
        bug-459094.exe \
        delegate-invoke.exe \
        bug-Xamarin-5278.exe \
-       bug-45841-fpstack-exceptions.exe \
        appdomain-thread-abort.exe
 
 DISABLED_TESTS = \
@@ -1037,6 +949,7 @@ INTERP_DISABLED_TESTS = \
        bug-327438.2.exe \
        bug-335131.2.exe \
        bug-415577.exe \
+       bug-45841-fpstack-exceptions.exe \
        bug-461867.exe \
        bug-461941.exe \
        bug-46661.exe \
@@ -1221,8 +1134,6 @@ tests: compile-tests
 #
 # Test that no symbols are missed in eglib-remap.h
 #
-if NACL_CODEGEN
-else
 if PLATFORM_LINUX
 test-platform: test-eglib-remap
 else
@@ -1230,7 +1141,6 @@ if PLATFORM_DARWIN
 test-platform: test-eglib-remap
 endif
 endif
-endif
 # The following regexp describes all symbols that start with "g_" but are not part of eglibc.
 # The optional underscore prepending symbol names may or may not appear depending on the
 # system and the state of the leading-underscore compiler flag.
@@ -1929,12 +1839,8 @@ test-generic-sharing-normal: $(TESTS_GSHARED) $(TESTSAOT_GSHARED)
 test-generic-sharing-managed: test-runner.exe $(TESTS_GSHARED) $(TESTSAOT_GSHARED) 
        $(Q) $(TOOLS_RUNTIME) $(TEST_RUNNER) -j a --testsuite-name "gshared" --disabled "$(DISABLED_TESTS)" --opt-sets "gshared gshared,shared gshared,-inline gshared,-inline,shared" $(TESTS_GSHARED)
 
-if NACL_CODEGEN
-test-generic-sharing:
-else
 test-generic-sharing:
        @if test x$(M) != x0; then $(MAKE) test-generic-sharing-managed; else $(MAKE) test-generic-sharing-normal; fi
-endif
 
 EXTRA_DIST += async-exceptions.cs
 async-exceptions.exe : async-exceptions.cs
@@ -1957,16 +1863,12 @@ patch-libtool:
        touch libtest.c
 
 
-if NACL_CODEGEN
-test-process-exit:
-else
 EXTRA_DIST += threadpool-in-processexit.cs threadpool-in-processexit.exe.stdout.expected
 test-process-exit:
        @$(MCS) $(srcdir)/threadpool-in-processexit.cs -out:threadpool-in-processexit.exe
        @echo "Testing threadpool-in-processexit.exe..."
        @$(RUNTIME) threadpool-in-processexit.exe > threadpool-in-processexit.exe.stdout
        @diff -w threadpool-in-processexit.exe.stdout $(srcdir)/threadpool-in-processexit.exe.stdout.expected
-endif
 
 # tests that expect a 1 exit code
 TESTS_UNHANDLED_EXCEPTION_1_SRC =      \
index d6574763760ba04232a3924b931ff059bb9caa38..74117c2ba7179430dfb3ff1e9f46ec1723cb232d 100644 (file)
@@ -41,7 +41,7 @@
     .locals init (valuetype [System.Data]System.Data.SqlTypes.SqlDecimal V_0)
     .try
     {
-               ldc.r8 5
+       ldstr "Exception 1"
        newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
        throw
                          pop
@@ -57,7 +57,7 @@
     IL_0021:  nop
     .try
     {
-               ldc.r8 5
+       ldstr "Exception 2"
        newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
        throw
                          pop
@@ -73,7 +73,7 @@
     IL_0033:  nop
     .try
     {
-               ldc.r8 5
+       ldstr "Exception 3"
        newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
        throw
       IL_0044:  leave.s    IL_0049
@@ -88,7 +88,7 @@
     IL_0049:  nop
     .try
     {
-               ldc.r8 5
+       ldstr "Exception 4"
        newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
        throw
                pop
     IL_005f:  nop
     .try
     {
-               ldc.r8 5
+       ldstr "Exception 5"
        newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
        throw
                pop
     IL_0071:  nop
     .try
     {
-               ldc.r8 5
+       ldstr "Exception 6"
        newobj     instance void [mscorlib]System.OverflowException::.ctor(string)
        throw
                pop
index 3177f2d17a1194f5ebc59fbea7382990120a4db5..296893ff2e7f2a77a8e7b5e46f4684d45421b8a4 100644 (file)
@@ -484,13 +484,6 @@ DEFAULT_MMAP_THRESHOLD       default: 256K
 #endif  /* HAVE_MORECORE */
 #endif  /* DARWIN */
 
-#if defined(__native_client__)
-#undef HAVE_MMAP
-#undef HAVE_MREMAP
-#define HAVE_MMAP 0
-#define HAVE_MREMAP 0
-#endif
-
 #ifndef LACKS_SYS_TYPES_H
 #include <sys/types.h>  /* For size_t */
 #endif  /* LACKS_SYS_TYPES_H */
index efbe9f03e7a28eeed84c76c2c110f7ce3bf16f6e..3861e54f5e6a04b75c661be7308939c904008859 100644 (file)
@@ -36,7 +36,7 @@
 void
 mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
 {
-#if defined (__native_client__) || defined (HOST_WATCHOS)
+#if defined (HOST_WATCHOS)
        printf("WARNING: mono_arch_sigctx_to_monoctx() called!\n");
        mctx->eax = 0xDEADBEEF;
        mctx->ebx = 0xDEADBEEF;
@@ -95,13 +95,13 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
        mctx->esi = ctx->SC_ESI;
        mctx->edi = ctx->SC_EDI;
        mctx->eip = ctx->SC_EIP;
-#endif /* if defined(__native_client__) */
+#endif
 }
 
 void
 mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
 {
-#if defined(__native_client__) || defined(HOST_WATCHOS)
+#if defined(HOST_WATCHOS)
        printf("WARNING: mono_arch_monoctx_to_sigctx() called!\n");
 #elif MONO_CROSS_COMPILE
        g_assert_not_reached ();
@@ -151,7 +151,7 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
        ctx->SC_ESI = mctx->esi;
        ctx->SC_EDI = mctx->edi;
        ctx->SC_EIP = mctx->eip;
-#endif /* __native_client__ */
+#endif
 }
 
 #elif (defined(__x86_64__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_AMD64)) /* defined(__i386__) */
@@ -165,10 +165,6 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
 void
 mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
 {
-#if defined(__native_client_codegen__) || defined(__native_client__)
-       printf("WARNING: mono_arch_sigctx_to_monoctx() called!\n");
-#endif
-
 #ifdef MONO_CROSS_COMPILE
        g_assert_not_reached ();
 #elif defined(MONO_SIGNAL_USE_UCONTEXT_T)
@@ -239,10 +235,6 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
 void
 mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
 {
-#if defined(__native_client__) || defined(__native_client_codegen__)
-  printf("WARNING: mono_arch_monoctx_to_sigctx() called!\n");
-#endif
-
 #ifdef MONO_CROSS_COMPILE
        g_assert_not_reached ();
 #elif defined(MONO_SIGNAL_USE_UCONTEXT_T)
@@ -358,8 +350,6 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
 {
 #ifdef MONO_CROSS_COMPILE
        g_assert_not_reached ();
-#elif defined(__native_client__)
-       g_assert_not_reached ();
 #else
        arm_ucontext *my_uc = sigctx;
 
@@ -378,8 +368,6 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *ctx)
 {
 #ifdef MONO_CROSS_COMPILE
        g_assert_not_reached ();
-#elif defined(__native_client__)
-       g_assert_not_reached ();
 #else
        arm_ucontext *my_uc = ctx;
 
index 3cc722f0aae7d7909614be82bc9b3f14ab41b121..b26442f73f5c7897e5ec9da2bf1881399dacf2fa 100644 (file)
@@ -44,10 +44,6 @@ typedef struct __darwin_xmm_reg MonoContextSimdReg;
 #endif
 #endif
 
-#if defined(__native_client__)
-#undef MONO_SIGNAL_USE_UCONTEXT_T
-#endif
-
 #ifdef __HAIKU__
 /* sigcontext surrogate */
 struct sigcontext {
@@ -213,7 +209,7 @@ typedef struct {
 
 #include <mono/arch/amd64/amd64-codegen.h>
 
-#if !defined( HOST_WIN32 ) && !defined(__native_client__) && !defined(__native_client_codegen__)
+#if !defined( HOST_WIN32 )
 
 #if defined(HAVE_SIGACTION) || defined(__APPLE__)  // the __APPLE__ check is required for the tvos simulator, which has ucontext_t but not sigaction
 #define MONO_SIGNAL_USE_UCONTEXT_T 1
@@ -243,30 +239,6 @@ typedef struct {
 extern void mono_context_get_current (void *);
 #define MONO_CONTEXT_GET_CURRENT(ctx) do { mono_context_get_current((void*)&(ctx)); } while (0)
 
-#elif defined(__native_client__)
-#define MONO_CONTEXT_GET_CURRENT(ctx)  \
-       __asm__ __volatile__(   \
-               "movq $0x0,  %%nacl:0x00(%%r15, %0, 1)\n"       \
-               "movq %%rcx, %%nacl:0x08(%%r15, %0, 1)\n"       \
-               "movq %%rdx, %%nacl:0x10(%%r15, %0, 1)\n"       \
-               "movq %%rbx, %%nacl:0x18(%%r15, %0, 1)\n"       \
-               "movq %%rsp, %%nacl:0x20(%%r15, %0, 1)\n"       \
-               "movq %%rbp, %%nacl:0x28(%%r15, %0, 1)\n"       \
-               "movq %%rsi, %%nacl:0x30(%%r15, %0, 1)\n"       \
-               "movq %%rdi, %%nacl:0x38(%%r15, %0, 1)\n"       \
-               "movq %%r8,  %%nacl:0x40(%%r15, %0, 1)\n"       \
-               "movq %%r9,  %%nacl:0x48(%%r15, %0, 1)\n"       \
-               "movq %%r10, %%nacl:0x50(%%r15, %0, 1)\n"       \
-               "movq %%r11, %%nacl:0x58(%%r15, %0, 1)\n"       \
-               "movq %%r12, %%nacl:0x60(%%r15, %0, 1)\n"       \
-               "movq %%r13, %%nacl:0x68(%%r15, %0, 1)\n"       \
-               "movq %%r14, %%nacl:0x70(%%r15, %0, 1)\n"       \
-               "movq %%r15, %%nacl:0x78(%%r15, %0, 1)\n"       \
-               "leaq (%%rip), %%rdx\n" \
-               "movq %%rdx, %%nacl:0x80(%%r15, %0, 1)\n"       \
-               :       \
-               : "a" ((int64_t)&(ctx)) \
-               : "rdx", "memory")
 #else
 
 #define MONO_CONTEXT_GET_CURRENT_GREGS(ctx) \
index ac7747c8799f9f0f12b53613a2d9e45627d159fc..333617edc92d8a5d59cb359cc15e9fd25e3d7445 100644 (file)
@@ -12,9 +12,9 @@
 #define MONO_SOLIB_EXT ".dll"
 #elif defined(__ppc__) && defined(TARGET_MACH)
 #define MONO_SOLIB_EXT ".dylib"
-#elif defined(TARGET_MACH) && defined(TARGET_X86) && !defined(__native_client_codegen__)
+#elif defined(TARGET_MACH) && defined(TARGET_X86)
 #define MONO_SOLIB_EXT ".dylib"
-#elif defined(TARGET_MACH) && defined(TARGET_AMD64) && !defined(__native_client_codegen__)
+#elif defined(TARGET_MACH) && defined(TARGET_AMD64)
 #define MONO_SOLIB_EXT ".dylib"
 #else
 #define MONO_SOLIB_EXT ".so"
index 4bd214d4dddc26787ab4c8c702c5cf667f74a08e..f66ff902e1d6c90a0e0931559ac618b743a0ac29 100644 (file)
@@ -331,20 +331,6 @@ mono_file_unmap (void *addr, void *handle)
  * \p length must be a multiple of the page size.
  * \returns \c 0 on success.
  */
-#if defined(__native_client__)
-int
-mono_mprotect (void *addr, size_t length, int flags)
-{
-       int prot = prot_from_flags (flags);
-       void *new_addr;
-
-       if (flags & MONO_MMAP_DISCARD) memset (addr, 0, length);
-
-       new_addr = mmap(addr, length, prot, MAP_PRIVATE | MAP_FIXED | MAP_ANONYMOUS, -1, 0);
-       if (new_addr == addr) return 0;
-        return -1;
-}
-#else
 int
 mono_mprotect (void *addr, size_t length, int flags)
 {
@@ -367,7 +353,6 @@ mono_mprotect (void *addr, size_t length, int flags)
        }
        return mprotect (addr, length, prot);
 }
-#endif // __native_client__
 
 #else
 
index 13b8a32393716ec9473ce9d9e4bbd9ef6e849087..fc6b61f2c4f35e07cb76b816c269411391dba48c 100644 (file)
@@ -26,7 +26,7 @@
 
 #ifdef HOST_WIN32
 // Windows specific implementation in mono-rand-windows.c
-#elif defined (HAVE_SYS_UN_H) && !defined(__native_client__)
+#elif defined (HAVE_SYS_UN_H)
 
 #include <errno.h>
 #include <fcntl.h>
index 1dbb223608647398daaa6ff780b70fc868a889ad..289bd98cd66e2faa8c61063213ce5aba2de7d38e 100644 (file)
@@ -39,8 +39,6 @@ mono_threads_suspend_search_alternative_signal (void)
 #endif
 }
 
-#ifndef __native_client__
-
 static int suspend_signal_num = -1;
 static int restart_signal_num = -1;
 static int abort_signal_num = -1;
@@ -274,33 +272,4 @@ mono_threads_suspend_get_abort_signal (void)
        return abort_signal_num;
 }
 
-#else
-
-void
-mono_threads_suspend_init_signals (void)
-{
-       g_assert_not_reached ();
-}
-
-gint
-mono_threads_suspend_get_suspend_signal (void)
-{
-       return -1;
-}
-
-gint
-mono_threads_suspend_get_restart_signal (void)
-{
-       return -1;
-}
-
-gint
-mono_threads_suspend_get_abort_signal (void)
-{
-       return -1;
-}
-
-#endif /* __native_client__ */
-
-
 #endif /* defined(USE_POSIX_BACKEND) */
index 9ee2a77402de20bebbca6cabbd61ec0a3f7917bd..5d0e1ab29112e3e8b0ce624e2cbd257a6519f077 100644 (file)
@@ -30,7 +30,7 @@
 extern int tkill (pid_t tid, int signal);
 #endif
 
-#if defined(_POSIX_VERSION) || defined(__native_client__)
+#if defined(_POSIX_VERSION)
 
 #include <pthread.h>
 
@@ -150,9 +150,6 @@ mono_threads_pthread_kill (MonoThreadInfo *info, int signum)
                errno = old_errno;
        }
        return result;
-#elif defined(__native_client__)
-       /* Workaround pthread_kill abort() in NaCl glibc. */
-       return 0;
 #elif !defined(HAVE_PTHREAD_KILL)
        g_error ("pthread_kill() is not supported by this platform");
 #else
@@ -234,7 +231,7 @@ mono_native_thread_join (MonoNativeThreadId tid)
        return !pthread_join (tid, &res);
 }
 
-#endif /* defined(_POSIX_VERSION) || defined(__native_client__) */
+#endif /* defined(_POSIX_VERSION) */
 
 #if defined(USE_POSIX_BACKEND)
 
index e6d151ce2566c841cfdba4ae8d1f083d30bfcfa6..dac28b7037dbe4f739cfa543457f1d8514305c14 100644 (file)
@@ -1310,10 +1310,6 @@ mono_thread_info_tls_set (THREAD_INFO_TYPE *info, MonoTlsKey key, gpointer value
        ((MonoThreadInfo*)info)->tls [key] = value;
 }
 
-#if defined(__native_client__)
-void nacl_shutdown_gc_thread(void);
-#endif
-
 /*
  * mono_thread_info_exit:
  *
@@ -1323,10 +1319,6 @@ void nacl_shutdown_gc_thread(void);
 void
 mono_thread_info_exit (gsize exit_code)
 {
-#if defined(__native_client__)
-       nacl_shutdown_gc_thread();
-#endif
-
        mono_thread_info_detach ();
 
        mono_threads_platform_exit (0);
index dc26a4ac42e8d8b4068467a2c90f92cab9025208..63cad57d86825aeaf3e3b15d60737fe9d5b252c2 100644 (file)
@@ -109,7 +109,7 @@ and reduce the number of casts drastically.
 /* If this is defined, use the signals backed on Mach. Debug only as signals can't be made usable on OSX. */
 // #define USE_SIGNALS_ON_MACH
 
-#if defined (_POSIX_VERSION) || defined (__native_client__)
+#if defined (_POSIX_VERSION)
 #if defined (__MACH__) && !defined (USE_SIGNALS_ON_MACH)
 #define USE_MACH_BACKEND
 #else
@@ -119,7 +119,7 @@ and reduce the number of casts drastically.
 #define USE_WINDOWS_BACKEND
 #else
 #error "no backend support for current platform"
-#endif /* defined (_POSIX_VERSION) || defined (__native_client__) */
+#endif /* defined (_POSIX_VERSION) */
 
 enum {
        STATE_STARTING                          = 0x00,
index 987689a9cd8e946671fd35f5ae4d42c39cc61a30..c3615d14bbedc53d4cabf12999b183a2f2a42ad9 100644 (file)
@@ -275,11 +275,7 @@ my_g_bit_nth_lsf (gsize mask, gint nth_bit)
        if ((mask == 0) || (nth_bit == BITS_PER_CHUNK))
                return -1;
 
-#if defined(__native_client__) && (defined(__i386__) || defined(__x86_64))
-#define USE_X86_32BIT_INSTRUCTIONS 1
-#endif
-
-#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
+#if (defined(__i386__) && defined(__GNUC__))
  {
         int r;
         /* This depends on mask != 0 */
@@ -309,7 +305,7 @@ static inline gint
 my_g_bit_nth_lsf_nomask (gsize mask)
 {
        /* Mask is expected to be != 0 */
-#if (defined(__i386__) && defined(__GNUC__)) || defined(USE_X86_32BIT_INSTRUCTIONS)
+#if (defined(__i386__) && defined(__GNUC__))
        int r;
 
        __asm__("bsfl %1,%0\n\t"
index 7807fe88fea7e36cd654395ffde0e0679b5eb74f..904bb51f570fc0b934a3977016f1380de8f2fd7b 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <ItemGroup Label="ProjectConfigurations">\r
     <ProjectConfiguration Include="Debug|Win32">\r
@@ -78,7 +78,6 @@
     <ClCompile Include="..\mono\metadata\mono-conc-hash.c" />\r
     <ClCompile Include="..\mono\metadata\mono-mlist.c" />\r
     <ClCompile Include="..\mono\metadata\mono-perfcounters.c" />\r
-    <ClCompile Include="..\mono\metadata\nacl-stub.c" />\r
     <ClCompile Include="..\mono\metadata\null-gc.c" />\r
     <ClCompile Include="..\mono\metadata\number-ms.c" />\r
     <ClCompile Include="..\mono\metadata\object.c" />\r
index 3b1b01037ccb53cf69b148065107f4e33881f25c..6c8dcdfb4fe6c64f05c3335567d566570843348a 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
   <ItemGroup>\r
     <ClCompile Include="..\mono\metadata\assembly.c">\r
     <ClCompile Include="..\mono\metadata\mono-security.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="..\mono\metadata\nacl-stub.c">\r
-      <Filter>Source Files</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="..\mono\metadata\null-gc.c">\r
       <Filter>Source Files</Filter>\r
     </ClCompile>\r
diff --git a/nacl/README b/nacl/README
deleted file mode 100644 (file)
index 03a77ba..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Building NaCl Mono with glibc (newlib support is eliminated but should still be buildable with small effort) is complex.  Instructions live here for the adventurous: https://docs.google.com/a/google.com/document/d/1Jd_4M7mlmxF8daVbepAy_8RKYcRbhifXanRYyBKkVa4/pub
-
diff --git a/nacl/common.sh b/nacl/common.sh
deleted file mode 100644 (file)
index 65e7dc7..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
-# Copyright (c) 2011 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that be
-# found in the LICENSE file.
-#
-
-set -o nounset
-set -o errexit
-
-# scripts that source this file must be run from within packages tree
-readonly SAVE_PWD=$(pwd)
-
-# Pick platform directory for compiler.
-readonly OS_NAME=$(uname -s)
-if [ $OS_NAME = "Darwin" ]; then
-  readonly OS_SUBDIR="mac"
-  readonly OS_SUBDIR_SHORT="mac"
-elif [ $OS_NAME = "Linux" ]; then
-  readonly OS_SUBDIR="linux"
-  readonly OS_SUBDIR_SHORT="linux"
-else
-  readonly OS_SUBDIR="windows"
-  readonly OS_SUBDIR_SHORT="win"
-fi
-
-readonly MACHINE=$(uname -m)
-if [ $MACHINE = "x86_64" ]; then
-  readonly TARGET_BITSIZE=${TARGET_BITSIZE:-"64"}
-  readonly HOST_BITSIZE=${HOST_BITSIZE:-"64"}
-else
-  # uname -m reports i686 on Linux and i386 on Mac
-  readonly TARGET_BITSIZE=${TARGET_BITSIZE:-"32"}
-  readonly HOST_BITSIZE=${HOST_BITSIZE:-"32"}
-fi
-
-if [ $TARGET_BITSIZE == "64" ]; then
-  readonly TARGET_BIT_PREFIX="64"
-  readonly CROSS_ID=x86_64
-else
-  readonly TARGET_BIT_PREFIX=""
-  readonly CROSS_ID=i686
-fi
-# we might want to override the detected host platform (e.g. on OSX 10.6)
-if [ $HOST_BITSIZE == "64" ]; then
-  readonly HOST_BIT_PREFIX="64"
-else
-  readonly HOST_BIT_PREFIX=""
-fi
-
-export NACL_CROSS_PREFIX=${CROSS_ID}-nacl
-export NACL_CROSS_PREFIX_DASH=${NACL_CROSS_PREFIX}-
-
-readonly NACL_NEWLIB=${NACL_NEWLIB:-"0"}
-
-if [ $NACL_NEWLIB = "1" ]; then
-  readonly NACL_SDK_BASE=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86_newlib
-else
-case "${NACL_SDK_ROOT}" in
-*pepper_15* | *pepper_16* | *pepper_17*)
-  readonly NACL_SDK_BASE=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86
-  ;;
-*)
-  readonly NACL_SDK_BASE=${NACL_SDK_ROOT}/toolchain/${OS_SUBDIR_SHORT}_x86_glibc
-  ;;
-esac
-fi
-
-readonly NACL_BIN_PATH=${NACL_SDK_BASE}/bin
-export NACLCC=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}gcc
-export NACLCXX=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}g++
-export NACLAR=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ar
-export NACLRANLIB=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ranlib
-export NACLLD=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}ld
-export NACLAS=${NACL_BIN_PATH}/${NACL_CROSS_PREFIX_DASH}as
-
-# NACL_SDK_GCC_SPECS_PATH is where nacl-gcc 'specs' file will be installed
-readonly NACL_SDK_GCC_SPECS_PATH=${NACL_SDK_BASE}/lib/gcc/x86_64-nacl/4.4.3
-
-# NACL_SDK_USR is where the headers, libraries, etc. will be installed
-readonly NACL_SDK_USR=${NACL_SDK_BASE}/${NACL_CROSS_PREFIX}/usr
-readonly NACL_SDK_USR_INCLUDE=${NACL_SDK_USR}/include
-readonly NACL_SDK_USR_LIB=${NACL_SDK_USR}/lib
-
-
-######################################################################
-# Helper functions
-######################################################################
-
-Banner() {
-  echo "######################################################################"
-  echo $*
-  echo "######################################################################"
-}
-
-
-VerifyPath() {
-  # make sure path isn't all slashes (possibly from an unset variable)
-  local PATH=$1
-  local TRIM=${PATH##/}
-  if [ ${#TRIM} -ne 0 ]; then
-    return 0
-  else
-    return 1
-  fi
-}
-
-
-ChangeDir() {
-  local NAME=$1
-  if VerifyPath ${NAME}; then
-    cd ${NAME}
-  else
-    echo "ChangeDir called with bad path."
-    exit -1
-  fi
-}
-
-
-Remove() {
-  local NAME=$1
-  if VerifyPath ${NAME}; then
-    rm -rf ${NAME}
-  else
-    echo "Remove called with bad path."
-    exit -1
-  fi
-}
-
-
-MakeDir() {
-  local NAME=$1
-  if VerifyPath ${NAME}; then
-    mkdir -p ${NAME}
-  else
-    echo "MakeDir called with bad path."
-    exit -1
-  fi
-}
-
-
-PatchSpecFile() {
-  # fix up spaces so gcc sees entire path
-  local SED_SAFE_SPACES_USR_INCLUDE=${NACL_SDK_USR_INCLUDE/ /\ /}
-  local SED_SAFE_SPACES_USR_LIB=${NACL_SDK_USR_LIB/ /\ /}
-  # have nacl-gcc dump specs file & add include & lib search paths
-  ${NACL_SDK_BASE}/bin/x86_64-nacl-gcc -dumpspecs |\
-    sed "/*cpp:/{
-      N
-      s|$| -I${SED_SAFE_SPACES_USR_INCLUDE}|
-    }" |\
-    sed "/*link_libgcc:/{
-      N
-      s|$| -L${SED_SAFE_SPACES_USR_LIB}|
-    }" >${NACL_SDK_GCC_SPECS_PATH}/specs
-}
-
-
-DefaultConfigureStep() {
-  Banner "Configuring ${PACKAGE_NAME}"
-  # export the nacl tools
-  export CC=${NACLCC}
-  export CXX=${NACLCXX}
-  export AR=${NACLAR}
-  export RANLIB=${NACLRANLIB}
-  export PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig
-  export PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB}
-  export PATH=${NACL_BIN_PATH}:${PATH};
-  ChangeDir ${NACL_PACKAGES_REPOSITORY}/${PACKAGE_NAME}
-  Remove ${PACKAGE_NAME}-build
-  MakeDir ${PACKAGE_NAME}-build
-  cd ${PACKAGE_NAME}-build
-  ../configure \
-    --host=nacl \
-    --disable-shared \
-    --prefix=${NACL_SDK_USR} \
-    --exec-prefix=${NACL_SDK_USR} \
-    --libdir=${NACL_SDK_USR_LIB} \
-    --oldincludedir=${NACL_SDK_USR_INCLUDE} \
-    --with-http=off \
-    --with-html=off \
-    --with-ftp=off \
-    --with-x=no
-}
-
-
-DefaultBuildStep() {
-  # assumes pwd has makefile
-  make clean
-if [ $TARGET_BITSIZE == "64" ]; then
-  make -j8
-else
-  make
-fi
-}
-
-
-DefaultInstallStep() {
-  # assumes pwd has makefile
-  make install
-}
-
-
-DefaultCleanUpStep() {
-  PatchSpecFile
-  ChangeDir ${SAVE_PWD}
-}
-
-
-DefaultPackageInstall() {
-  DefaultPreInstallStep
-  DefaultDownloadStep
-  DefaultExtractStep
-  DefaultPatchStep
-  DefaultConfigureStep
-  DefaultBuildStep
-  DefaultInstallStep
-  DefaultCleanUpStep
-}
diff --git a/nacl/config-nacl-runtime.cache b/nacl/config-nacl-runtime.cache
deleted file mode 100644 (file)
index 4bd26c4..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-ac_cv_func_mmap=${ac_cv_func_mmap=no}
-ac_cv_var_timezone=${ac_cv_var_timezone=yes}
-ac_cv_host=${ac_cv_host=i686-pc-nacl}
-ac_cv_target=${ac_cv_target=i686-pc-nacl}
-ac_cv_func_backtrace_symbols=${ac_cv_func_backtrace_symbols=no}
-mono_cv_uscore=${mono_cv_uscore=no}
diff --git a/nacl/config-nacl-runtime64.cache b/nacl/config-nacl-runtime64.cache
deleted file mode 100644 (file)
index b952fef..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-ac_cv_func_mmap=${ac_cv_func_mmap=no}
-ac_cv_var_timezone=${ac_cv_var_timezone=yes}
-ac_cv_host=${ac_cv_host=x86_64-pc-nacl}
-ac_cv_target=${ac_cv_target=x86_64-pc-nacl}
-ac_cv_func_backtrace_symbols=${ac_cv_func_backtrace_symbols=no}
-mono_cv_uscore=${mono_cv_uscore=no}
diff --git a/nacl/nacl-runtime-mono.sh b/nacl/nacl-runtime-mono.sh
deleted file mode 100755 (executable)
index d93bb97..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2009 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that be
-# found in the LICENSE file.
-#
-
-# nacl-runtime-mono.sh
-#
-# usage:  nacl-runtime-mono.sh
-#
-# this script builds mono runtime for Native Client 
-#
-
-readonly MONO_TRUNK_NACL=$(pwd)
-
-source common.sh
-
-readonly PACKAGE_NAME=runtime${TARGET_BIT_PREFIX}-build
-readonly INSTALL_PATH=${MONO_TRUNK_NACL}/naclmono-${CROSS_ID}
-
-
-CustomConfigureStep() {
-  Banner "Configuring ${PACKAGE_NAME}"
-  # export the nacl tools
-  set +e
-  if [ -f ${PACKAGE_NAME}/Makefile ]
-  then
-    cd ${PACKAGE_NAME}
-  fi
-  make distclean
-  cd ${MONO_TRUNK_NACL}
-  set -e
-  if [ $TARGET_BITSIZE == "32" ]; then
-    CONFIG_OPTS="--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --target=i686-pc-linux-gnu"
-  else
-    CONFIG_OPTS="--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu"
-  fi
-  # UGLY hack to allow dynamic linking
-  sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../configure
-  sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../libgc/configure
-  sed -i -e s/elf_i386/elf_nacl/ -e s/elf_x86_64/elf64_nacl/ ../eglib/configure
-  Remove ${PACKAGE_NAME}
-  MakeDir ${PACKAGE_NAME}
-  cd ${PACKAGE_NAME}
-  CC=${NACLCC} CXX=${NACLCXX} AR=${NACLAR} RANLIB=${NACLRANLIB} PKG_CONFIG_PATH=${NACL_SDK_USR_LIB}/pkgconfig LD="${NACLLD}" \
-  PKG_CONFIG_LIBDIR=${NACL_SDK_USR_LIB} PATH=${NACL_BIN_PATH}:${PATH} LIBS="-lnacl_dyncode -lc -lg -lnosys -lnacl" \
-  CFLAGS="-g -O2 -D_POSIX_PATH_MAX=256 -DPATH_MAX=256" ../../configure \
-    ${CONFIG_OPTS} \
-    --exec-prefix=${INSTALL_PATH} \
-    --libdir=${INSTALL_PATH}/lib \
-    --prefix=${INSTALL_PATH} \
-    --program-prefix="" \
-    --oldincludedir=${INSTALL_PATH}/include \
-    --with-glib=embedded \
-    --with-tls=pthread \
-    --enable-threads=posix \
-    --without-sigaltstack \
-    --without-mmap \
-    --with-gc=included \
-    --enable-nacl-gc \
-    --with-sgen=no \
-    --enable-nls=no \
-    --enable-nacl-codegen \
-    --disable-system-aot \
-    --enable-shared \
-    --disable-parallel-mark \
-    --with-static-mono=no
-
-}
-
-CustomInstallStep() {
-  make install
-}
-
-CustomPackageInstall() {
-  CustomConfigureStep
-  DefaultBuildStep
-  CustomInstallStep
-}
-
-CustomPackageInstall
-exit 0
diff --git a/nacl/nacl_interp_loader_sdk.sh b/nacl/nacl_interp_loader_sdk.sh
deleted file mode 100755 (executable)
index 1e4bd31..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2012 The Native Client Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Usage: nacl_interp_loader.sh PLATFORM NEXE ARGS...
-
-# Assumes this file is sitting in the source tree.
-# This should be changed for some proper SDK installation setup.
-NACL_SDK_ROOT=${NACL_SDK_ROOT:-/path/to/naclsdk/pepper_XX}
-
-case "$1" in
-i?86)
-  arch=x86_32
-  libdir=lib32
-  ;;
-x86_64)
-  arch=x86_64
-  libdir=lib64
-  ;;
-arm|v7l)
-  arch=arm
-  libdir=lib32
-  ;;
-*)
-  echo >&2 "$0: Do not recognize architecture \"$1\""
-  exit 127
-  ;;
-esac
-
-shift
-
-case "${NACL_SDK_ROOT}" in
-*pepper_15* | *pepper_16* | *pepper_17*)
-  SEL_LDR="$NACL_SDK_ROOT/toolchain/linux_x86/bin/sel_ldr_${arch}"
-  IRT="$NACL_SDK_ROOT/toolchain/linux_x86/runtime/irt_core_${arch}.nexe"
-  RTLD="$NACL_SDK_ROOT/toolchain/linux_x86/x86_64-nacl/${libdir}/runnable-ld.so"
-  LIBDIR="$NACL_SDK_ROOT/toolchain/linux_x86/x86_64-nacl/${libdir}"
-  ;;
-*)
-  SEL_LDR="$NACL_SDK_ROOT/tools/sel_ldr_${arch}"
-  IRT="$NACL_SDK_ROOT/tools/irt_core_${arch}.nexe"
-  RTLD="$NACL_SDK_ROOT/toolchain/linux_x86_glibc/x86_64-nacl/${libdir}/runnable-ld.so"
-  LIBDIR="$NACL_SDK_ROOT/toolchain/linux_x86_glibc/x86_64-nacl/${libdir}"
-  ;;
-esac
-
-IGNORE_VALIDATOR_ARG=""
-if [ x"$NACL_IGNORE_VALIDATOR" == x"1" ]; then
-  IGNORE_VALIDATOR_ARG="-c"
-fi
-
-exec "$SEL_LDR" -E "NACL_PWD=`pwd`" -E "MONO_PATH=$MONO_PATH" \
-  -E "MONO_CFG_DIR=$MONO_CFG_DIR" -E "MONO_SHARED_DIR=$MONO_SHARED_DIR" \
-  -a $IGNORE_VALIDATOR_ARG -S -B "$IRT" -l /dev/null -- "$RTLD" \
-  --library-path $LIBDIR "$@"
index e40baac24a60de35f24de559a598a2f68e7ad6ab..bfb2c70ddbb74ec79e952a456fe2f6893be02da9 100644 (file)
@@ -1,8 +1,8 @@
 GitHubTarballPackage(
     'mono',
     'libgdiplus',
-    '2.11',
-    '4e7ab0f555a13a6b2f954c714c4ee5213954ff79',
+    '5.4',
+    '350eb49a45ca5a7383c01d49df72438347a5dbc9',
     configure='CFLAGS="%{gcc_flags} %{local_gcc_flags} -I/opt/X11/include" ./autogen.sh --prefix="%{package_prefix}"',
     override_properties={
         'make': 'C_INCLUDE_PATH="" make'})
index 09cacd29d87d14ce5699c848d135a41e8585394c..fd05dcb18d7da0901c48e892863dc9278a81af02 100644 (file)
@@ -2,7 +2,7 @@ import fileinput
 
 class MSBuild (GitHubPackage):
        def __init__ (self):
-               GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.0',
+               GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.3',
                        git_branch = 'xplat-master')
 
        def build (self):
index 2d52fdae9731b7685a601996c03c3c47e394418b..a1c6eeb7c36c83cd9b17f01bcde612ce6074c38a 100644 (file)
@@ -7,7 +7,8 @@ class MonoExtensionsPackage(Package):
         Package.__init__(self, 'mono-extensions', None,
                          sources=['git@github.com:xamarin/mono-extensions.git'],
                          git_branch=self.profile.release_packages[
-                             'mono'].git_branch
+                             'mono'].git_branch,
+                         revision='07ad37d63e0e9dcf7c879a72bc14c5d6c794f7b6'
                          )
         self.source_dir_name = 'mono-extensions'
 
index ae87dfa88c37f436cff9022ff5b69127d58b7e8e..052a45eeaeb3bf235e56a49bec0550313c14c96e 100644 (file)
@@ -167,12 +167,8 @@ mcs-compileall: mono-wrapper etc/mono/config
        if [ "$$ok" = "false" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='verify' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='mcs-compileall' success='False' time='0'><results><test-case name='fail' executed='True' success='False' time='0'><failure><message>Verifying framework assemblies failed. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-verify.xml; fi; \
        $$ok
 
-if NACL_CODEGEN
-check-local:
-else
 check-local: mcs-compileall mcs-do-test-profiles
        $(MAKE) mcs-do-run-test-profiles
-endif
 
 # Compile all mcs tests
 test: mcs-do-test-profiles
index 7c2822f4b996ef75426ccfdb805e0f56e6a5b8d7..33ff88d6f2143b1195c623b07b66c11a70a2fef9 100644 (file)
@@ -4,13 +4,4 @@ MONO_CFG_DIR='@mono_cfg_dir@'
 PATH="$r/runtime/_tmpinst/bin:$PATH"
 MONO_EXECUTABLE=${MONO_EXECUTABLE:-"$r/@mono_runtime@"}
 export MONO_CFG_DIR PATH
-if [ -n "@nacl_self_host@" ]; then
-  case "$@" in
-    # gacutil.exe and mdoc.exe require filesystem functionality not
-    # exposed in NaCl.
-    # mcs.exe was added to the list recently because mcs under NaCl
-    # no longer produces equivalent output. TODO: investigate
-    */mcs.exe* | */gacutil.exe* | */mdoc.exe* ) exec /usr/local/bin/mono "$@";;
-  esac
-fi
 exec "$r/libtool" --mode=execute "${MONO_EXECUTABLE}" --config "@mono_cfg_dir@/mono/config" "$@"
index 59dfb9121535523c69d85d2decf9a8360d0f02c9..9e41e894d5511b7bb505f473981ffd9813a8eaf6 100755 (executable)
@@ -50,6 +50,7 @@ ${TESTCMD} --label=Microsoft.Build.Framework --timeout=5m make -w -C mcs/class/M
 ${TESTCMD} --label=Microsoft.Build.Tasks --timeout=5m make -w -C mcs/class/Microsoft.Build.Tasks run-test
 ${TESTCMD} --label=Microsoft.Build.Utilities --timeout=5m make -w -C mcs/class/Microsoft.Build.Utilities run-test
 ${TESTCMD} --label=Mono.C5 --timeout=5m make -w -C mcs/class/Mono.C5 run-test
+${TESTCMD} --label=Mono.Options --timeout=5m make -w -C mcs/class/Mono.Options run-test
 ${TESTCMD} --label=Mono.Tasklets --timeout=5m make -w -C mcs/class/Mono.Tasklets run-test
 ${TESTCMD} --label=System.Configuration --timeout=5m make -w -C mcs/class/System.Configuration run-test
 ${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test
@@ -72,6 +73,7 @@ ${TESTCMD} --label=System.Web.DynamicData --timeout=5m make -w -C mcs/class/Syst
 ${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test
 ${TESTCMD} --label=WindowsBase --timeout=5m make -w -C mcs/class/WindowsBase run-test
 ${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test
+if [[ ${label} == w* ]]; then ${TESTCMD} --label=System.Numerics-xunit --skip; else ${TESTCMD} --label=System.Numerics-xunit --timeout=5m make -w -C mcs/class/System.Numerics run-xunit-test; fi
 ${TESTCMD} --label=System.Runtime.DurableInstancing --timeout=5m make -w -C mcs/class/System.Runtime.DurableInstancing run-test
 ${TESTCMD} --label=System.ServiceModel.Discovery --timeout=5m make -w -C mcs/class/System.ServiceModel.Discovery run-test
 ${TESTCMD} --label=System.Xaml --timeout=5m make -w -C mcs/class/System.Xaml run-test
index 54016f99faabf8b5b3d422139a4207878a9c8a82..0de260a32377b2e456c9c8b30e65349195ee9a08 100644 (file)
@@ -809,6 +809,7 @@ namespace CppSharp
                 "SeqPointInfo",
                 "DynCallArgs", 
                 "MonoLMFTramp",
+                "InterpMethodArguments",
             };
 
             DumpClasses(writer, ctx, optionalTypes, optional: true);
index bc9c003c0adf4d369086ca9dd28406f5df1c199f..d279e1d3edad4d42ef488f543d23076e3bdf1bc7 100644 (file)
 /* Using the simple generational GC. */
 /* #undef HAVE_SGEN_GC */
 
+/* Some VES is available at runtime */
+#define HAVE_ONLINE_VES 1
+
  /* Have signal */
 #define HAVE_SIGNAL 1