Merge pull request #5439 from alexrp/master
authorAlex Rønne Petersen <alex@alexrp.com>
Thu, 24 Aug 2017 17:21:47 +0000 (19:21 +0200)
committerGitHub <noreply@github.com>
Thu, 24 Aug 2017 17:21:47 +0000 (19:21 +0200)
[profiler] Fix some stack imbalance issues due to missing method leave events.

173 files changed:
CODEOWNERS
README.md
configure.ac
docs/mono-tools.config
external/api-snapshot
external/bockbuild
libgc/include/private/gcconfig.h
libgc/include/private/pthread_support.h
libgc/pthread_stop_world.c
libgc/pthread_support.c
mcs/class/Facades/System.Data.SqlClient/TypeForwarders.cs
mcs/class/Facades/System.Security.Cryptography.Cng/TypeForwarders.cs
mcs/class/Facades/System.ServiceModel.Http/TypeForwarders.cs
mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args [deleted file]
mcs/class/Mono.Options/Mono.Options/Options.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs
mcs/class/Mono.Security/Test/Mono.Security_test.args [deleted file]
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptHandle.cs
mcs/class/System.Core/Microsoft.Win32.SafeHandles/SafeNCryptKeyHandle.cs
mcs/class/System.Core/common_System.Core.dll.sources
mcs/class/System.Core/net_4_x_System.Core.dll.sources
mcs/class/System.Data/Test/data_linux_test.args [deleted file]
mcs/class/System.Security/Test/security_linux_test.args [deleted file]
mcs/class/System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter.cs
mcs/class/System.Web.Services/Test/System.Web.Services_test.args [deleted file]
mcs/class/System.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs
mcs/class/System/Mono.AppleTls/AppleCertificateHelper.cs
mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
mcs/class/System/Mono.AppleTls/Trust.cs
mcs/class/System/ReferenceSources/Win32Exception.cs
mcs/class/System/System.Net/WebConnection.cs
mcs/class/corlib/Test/System.Reflection/AssemblyNameTest.cs
mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs [new file with mode: 0644]
mcs/class/corlib/Test/System.Runtime.Remoting/SynchronizationAttributeTest.cs
mcs/class/corlib/Test/System.Text/UnicodeEncodingTest.cs
mcs/class/corlib/Test/System.Threading.Tasks/TaskTest.cs
mcs/class/corlib/corlib_test.dll.sources
mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources
mcs/class/referencesource/System.Core/System/Security/Cryptography/ECDsaCng.cs
mcs/mcs/tuples.cs
mcs/tests/test-tuple-06.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/mkbundle/mkbundle.cs
mcs/tools/sqlsharp/unix.args [deleted file]
mcs/tools/xbuild/Makefile
mcs/tools/xbuild/data/deniedAssembliesList.txt [new file with mode: 0644]
mono/dis/Makefile.am
mono/eglib/Makefile.am
mono/eglib/goutput.c
mono/metadata/Makefile.am
mono/metadata/assembly.c
mono/metadata/boehm-gc.c
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/debug-helpers.c
mono/metadata/debug-helpers.h
mono/metadata/gc.c
mono/metadata/icall-def.h
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/jit-info.c
mono/metadata/loader.c
mono/metadata/marshal.c
mono/metadata/mempool.c
mono/metadata/metadata-cross-helpers.c
mono/metadata/metadata-verify.c
mono/metadata/metadata.c
mono/metadata/mono-config.c
mono/metadata/mono-route.c
mono/metadata/mono-route.h
mono/metadata/object-internals.h
mono/metadata/object-offsets.h
mono/metadata/object.c
mono/metadata/object.h
mono/metadata/sgen-mono.c
mono/metadata/tabledefs.h
mono/metadata/threadpool-worker-default.c
mono/metadata/threads.c
mono/metadata/verify.c
mono/metadata/verify.h
mono/metadata/w32error-unix.c
mono/metadata/w32error.h
mono/metadata/w32file-unix.c
mono/metadata/w32process-unix-default.c
mono/metadata/w32process-unix-internals.h
mono/metadata/w32process-unix.c
mono/metadata/w32socket-unix.c
mono/mini/Makefile.am.in
mono/mini/aot-runtime.c
mono/mini/debugger-agent.c
mono/mini/debugger-agent.h
mono/mini/driver.c
mono/mini/exceptions-arm.c
mono/mini/iltests.il
mono/mini/jit-icalls.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64.c
mono/mini/mini-arm.c
mono/mini/mini-exceptions.c
mono/mini/mini-gc.c
mono/mini/mini-generic-sharing.c
mono/mini/mini-mips.c
mono/mini/mini-posix.c
mono/mini/mini-ppc.c
mono/mini/mini-runtime.c
mono/mini/mini-s390x.c
mono/mini/mini-sparc.c
mono/mini/mini-x86.c
mono/mini/mini.c
mono/mini/mini.h
mono/mini/trace.c
mono/mini/tramp-amd64.c
mono/profiler/Makefile.am
mono/sgen/gc-internal-agnostic.h
mono/sgen/sgen-alloc.c
mono/sgen/sgen-archdep.h
mono/sgen/sgen-client.h
mono/sgen/sgen-gc.c
mono/sgen/sgen-marksweep.c
mono/tests/Makefile.am
mono/tests/bug-58782-capture-and-throw.cs [new file with mode: 0644]
mono/tests/bug-58782-plain-throw.cs [new file with mode: 0644]
mono/tests/delegate14.cs [new file with mode: 0644]
mono/tests/libtest.c
mono/tests/method-access.il
mono/unit-tests/Makefile.am
mono/utils/Makefile.am
mono/utils/atomic.c
mono/utils/atomic.h
mono/utils/mono-compiler.h
mono/utils/mono-context.h
mono/utils/mono-dl-posix.c
mono/utils/mono-dl-wasm.c [new file with mode: 0644]
mono/utils/mono-hwcap-arm.c
mono/utils/mono-hwcap-wasm.c [new file with mode: 0644]
mono/utils/mono-log-android.c
mono/utils/mono-logger-internals.h
mono/utils/mono-logger.c
mono/utils/mono-membar.h
mono/utils/mono-mmap.c
mono/utils/mono-os-mutex.h
mono/utils/mono-path.c
mono/utils/mono-proclib.c
mono/utils/mono-sigcontext.h
mono/utils/mono-threads-android.c
mono/utils/mono-threads-linux.c
mono/utils/mono-threads-posix-signals.c
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-wasm.c [new file with mode: 0644]
mono/utils/mono-threads.c
mono/utils/mono-threads.h
mono/utils/mono-time.c
mono/utils/unlocked.h
packaging/MacSDK/libgdiplus.py
packaging/MacSDK/msbuild.py
packaging/MacSDK/packaging/resources/whitelist.txt
packaging/Windows/defs/managed-components
packaging/Windows/defs/mono
packaging/Windows/defs/mono64
scripts/.gitignore
scripts/Makefile.am
support/errno.c
support/mph.h
support/sys-mman.c
support/sys-sendfile.c
support/unistd.c
tools/monograph/Makefile.am
tools/nuget-hash-extractor/Makefile
tools/nuget-hash-extractor/download.sh
tools/offsets-tool/MonoAotOffsetsDumper.cs
tools/pedump/Makefile.am
tools/pedump/pedump.c
winconfig.h

index 29241f71f455c9c081cb0360d0a64c0da4f9afff..66819f702843902ff1b3fb8a220eecc382daf9f3 100644 (file)
 # https://github.com/blog/2392-introducing-code-owners
 # https://help.github.com/articles/about-codeowners
 
-acceptance-tests/* @akoeplinger
-acceptance-tests/profiler-stress* @alexrp
-docs/sources/mono-api-profiler.html @alexrp
-man @marek-safar @miguel
-man/mprof-report.1 @alexrp
-mcs/build @marek-safar
-mcs/class @marek-safar
-mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
-mcs/class/Mono.Btls.Interface @baulig
-mcs/class/Mono.Data.Tds @egorbo
-mcs/class/Mono.Debugger.Soft @vargaz
-mcs/class/Mono.Options @jonpryor
-mcs/class/Mono.Profiler.Log @alexrp
-mcs/class/Mono.Security/Mono.Security/Interface @baulig
-mcs/class/System/Mono.AppleTls @baulig
-mcs/class/System/Mono.Btls @baulig
-mcs/class/System/Mono.Net.Security @baulig
-mcs/class/System/Mono.Security.Interface @baulig
-mcs/class/System.Data @egorbo
-mcs/errors @marek-safar
-mcs/mcs @marek-safar
-mcs/tests @marek-safar
-mono/eglib @kumpera
-mono/metadata @vargaz
-mono/metadata/*profiler* @alexrp
-mono/metadata/monitor* @brzvlad
-mono/metadata/sgen* @brzvlad
-mono/metadata/threads* @luhenry @kumpera
-mono/metadata/threadpool* @luhenry
-mono/metadata/w32* @luhenry
-mono/mini @vargaz
-mono/mini/*cfgdump* @lewurm
-mono/mini/*exceptions* @lewurm
-mono/mini/*ppc* @lewurm
-mono/mini/*type-check* @lewurm
-mono/mini/interp/* @lewurm
-mono/mini/*profiler* @alexrp
-mono/profiler @alexrp
-mono/sgen @brzvlad
-mono/utils @kumpera
-mono/utils/atomic* @alexrp
-mono/utils/mono-hwcap* @alexrp
-mono/utils/mono-mem* @alexrp
-mono/utils/mono-threads* @luhenry @kumpera
-msvc/*profiler* @alexrp
-msvc/scripts @akoeplinger
-packaging/Windows @akoeplinger
-samples/profiler @alexrp
-samples/size @alexrp
-scripts @akoeplinger
-scripts/ci @akoeplinger
-scripts/ci/run-test-profiler-stress-tests.sh @alexrp
+/acceptance-tests @akoeplinger
+/acceptance-tests/profiler-stress* @alexrp
+
+/docs @luhenry @marek-safar
+/docs/sources/mono-api-profiler.html @alexrp
+
+/man @marek-safar @miguel
+/man/mprof-report.1 @alexrp
+
+/mcs/build @marek-safar @akoeplinger
+
+/mcs/class @marek-safar @akoeplinger
+/mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
+/mcs/class/Mono.Btls.Interface @baulig
+/mcs/class/Mono.Data.Tds @egorbo
+/mcs/class/Mono.Debugger.Soft @vargaz
+/mcs/class/Mono.Options @jonpryor
+/mcs/class/Mono.Profiler.Log @alexrp
+/mcs/class/Mono.Security/Mono.Security/Interface @baulig
+/mcs/class/System/Mono.AppleTls @baulig
+/mcs/class/System/Mono.Btls @baulig
+/mcs/class/System/Mono.Net.Security @baulig
+/mcs/class/System/Mono.Security.Interface @baulig
+/mcs/class/System.Data @egorbo
+
+/mcs/errors @marek-safar
+/mcs/mcs @marek-safar
+/mcs/tests @marek-safar
+
+/mono/eglib @kumpera @vargaz @luhenry
+
+/mono/metadata @vargaz @kumpera
+/mono/metadata/*verify* @kumpera
+/mono/metadata/*profiler* @alexrp
+/mono/metadata/monitor* @brzvlad
+/mono/metadata/sgen* @brzvlad
+/mono/metadata/threads* @luhenry @kumpera
+/mono/metadata/threadpool* @luhenry
+/mono/metadata/w32* @luhenry
+
+/mono/mini @vargaz @kumpera
+/mono/mini/*cfgdump* @lewurm
+/mono/mini/*exceptions* @lewurm
+/mono/mini/*ppc* @lewurm
+/mono/mini/*type-check* @lewurm
+/mono/mini/interp/* @lewurm
+/mono/mini/*profiler* @alexrp
+
+/mono/profiler @alexrp @kumpera
+
+/mono/sgen @brzvlad @kumpera
+
+/mono/utils @kumpera @vargaz
+/mono/utils/atomic* @alexrp
+/mono/utils/mono-hwcap* @alexrp
+/mono/utils/mono-mem* @alexrp
+/mono/utils/mono-threads* @luhenry @kumpera
+
+/msvc/*profiler* @alexrp
+/msvc/scripts @akoeplinger
+
+/packaging/ @alexischr @akoeplinger
+/packaging/MacSDK/msbuild.py @radical @akoeplinger
+
+/samples/profiler @alexrp
+/samples/size @alexrp
+
+/scripts @akoeplinger
+/scripts/ci @akoeplinger
+/scripts/ci/run-test-profiler-stress-tests.sh @alexrp
+
+/tools @kumpera
+/tools/checker @tritao
+/tools/crash-bisector @kumpera
+/tools/locale-builder @marek-safar
+/tools/monograph @vargaz
+/tools/nuget-hash-extractor @marek-safar
+/tools/offsets-tool @lewurm @rolfbjarne
+/tools/pedump @kumpera @lambdageek
+/tools/sgen @brzvlad
index bd25f4ab2473301bff6f41d5c956015b4df7663e..facec5b23836396c9fbc11120c5f8eee8fd64b1c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -483,6 +483,16 @@ http://code.google.com/p/nativeclient/
   * Currently this is used with Mono's AOT engine as
 Native Client does not support JIT engines yet.
 
+* `--enable-wasm`
+
+  * Use this option to configure mono to run on WebAssembly. It will
+    set both host and target to the WebAssembly triplet. This overrides
+    the values passed to `--host` or `--target` and ignored what config.sub guesses.
+
+    This is a workaround to enable usage of old automake versions that don't
+    recognize the wasm triplet.
+
+
 Working With Submodules
 =======================
 
index 0abf9ebb4695b9b1866e7d92408c193b547d1518..c3000129cfc00d37b5a7afe38fc1f658d2d3e734 100644 (file)
@@ -96,8 +96,15 @@ need_link_unlink=no
 #Set to extra linker flags to be passed to the runtime binaries (mono /mono-sgen)
 extra_runtime_ldflags=""
 
+
+# Hack for WASM
+# Current autotools (v1.15) doesn't have a triplet we can use for wasm so the kludge we do is to
+# work around it by using a feature flag instead
+AC_ARG_ENABLE(wasm,[  --enable-wasm    Hack to set the current runtime to target wasm], enable_wasm=$enableval)
+
 # Thread configuration inspired by sleepycat's db
 AC_MSG_CHECKING([host platform characteristics])
+
 libgc_threads=no
 has_dtrace=no
 parallel_mark=yes
@@ -107,10 +114,20 @@ host_win32=no
 target_win32=no
 platform_android=no
 host_darwin=no
+
+
+if test "x$enable_wasm" = "xyes"; then
+CFLAGS="$CFLAGS -D_REENTRANT -D_GNU_SOURCE -DNO_UNALIGNED_ACCESS -s WASM=1 -DWASM -Os"
+CPPFLAGS="$CPPFLAGS -D_REENTRANT -DUSE_MMAP -D_GNU_SOURCE -DNO_UNALIGNED_ACCESS -s WASM=1 -DWASM -Os"
+libdl="-ldl"
+libgc_threads=pthreads
+
+else
+
 case "$host" in
        *-mingw*|*-*-cygwin*)
                AC_DEFINE(DISABLE_PORTABILITY,1,[Disable the io-portability layer])
-               AC_DEFINE(PLATFORM_NO_SYMLINKS,1,[This platform does not support symlinks])
+               AC_DEFINE(HOST_NO_SYMLINKS,1,[This platform does not support symlinks])
                host_win32=yes
                mono_cv_clang=no
                if test "x$cross_compiling" = "xno"; then
@@ -141,7 +158,7 @@ case "$host" in
                CPPFLAGS="$CPPFLAGS -D_REENTRANT -DGC_NETBSD_THREADS -D_GNU_SOURCE"
                libmono_cflags="-D_REENTRANT"
                LDFLAGS="$LDFLAGS -pthread"
-               CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD"
+               CPPFLAGS="$CPPFLAGS -DHOST_BSD"
                libmono_ldflags="-pthread"
                need_link_unlink=yes
                libdl="-ldl"
@@ -176,7 +193,7 @@ case "$host" in
                        LDFLAGS="$LDFLAGS $PTHREAD_LIBS -L/usr/local/lib"
                        libmono_ldflags="$PTHREAD_LIBS"
                fi
-               CPPFLAGS="$CPPFLAGS -DPLATFORM_BSD"
+               CPPFLAGS="$CPPFLAGS -DHOST_BSD"
                need_link_unlink=yes
                AC_DEFINE(PTHREAD_POINTER_ID, 1, [pthread is a pointer])
                libdl=
@@ -186,7 +203,7 @@ case "$host" in
                with_sgen_default_concurrent=yes
                ;;
        *-*-*openbsd*)
-               CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DPLATFORM_BSD -D_REENTRANT -DUSE_MMAP"
+               CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_OPENBSD_THREADS -DHOST_BSD -D_REENTRANT -DUSE_MMAP"
                if test "x$disable_munmap" != "xyes"; then
                CPPFLAGS="$CPPFLAGS -DUSE_MUNMAP"
                fi
@@ -202,7 +219,7 @@ case "$host" in
                ;;
        *-*-linux-android*)
                platform_android=yes
-               AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
+               AC_DEFINE(HOST_ANDROID,1,[Targeting the Android platform])
                AC_DEFINE(TARGET_ANDROID,1,[Targeting the Android platform])
 
                CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT -DUSE_MMAP"
@@ -284,7 +301,7 @@ case "$host" in
                use_sigposix=yes
                ;;
        *-*-solaris*)
-               CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DPLATFORM_SOLARIS"
+               CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_MMAP -DUSE_MUNMAP -DHOST_SOLARIS"
                need_link_unlink=yes
                libmono_cflags="-D_REENTRANT"
                libgc_threads=pthreads
@@ -296,7 +313,7 @@ case "$host" in
                parallel_mark="Disabled_Currently_Hangs_On_MacOSX"
                host_darwin=yes
                target_mach=yes
-               CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DPLATFORM_MACOSX -DUSE_MMAP -DUSE_MUNMAP"
+               CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_MACOSX_THREADS -DUSE_MMAP -DUSE_MUNMAP"
                libmono_cflags="-D_THREAD_SAFE"
                need_link_unlink=yes
                AC_DEFINE(PTHREAD_POINTER_ID)
@@ -350,6 +367,10 @@ case "$host" in
                libdl="-ldl"
                ;;
 esac
+
+# WASM hack
+fi
+
 AC_MSG_RESULT(ok)
 
 if test x$need_link_unlink = xyes; then
@@ -364,6 +385,10 @@ if test x$target_win32 = xyes; then
    AC_DEFINE(TARGET_WIN32, 1, [Target Platform is Win32])
 fi
 
+if test x$host_darwin = xyes; then
+   AC_DEFINE(HOST_DARWIN, 1, [Host Platform is Darwin])
+fi
+
 # Defined for all targets/platforms using classic Windows API support.
 AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
 AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
@@ -371,16 +396,16 @@ AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
 AC_SUBST(extra_runtime_ldflags)
 AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes)
 AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
-AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
-AM_CONDITIONAL(PLATFORM_DARWIN, test x$host_darwin = xyes)
-AM_CONDITIONAL(PLATFORM_SIGPOSIX, test x$use_sigposix = xyes)
-AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
+AM_CONDITIONAL(HOST_LINUX, echo x$target_os | grep -q linux)
+AM_CONDITIONAL(HOST_DARWIN, test x$host_darwin = xyes)
+AM_CONDITIONAL(HOST_SIGPOSIX, test x$use_sigposix = xyes)
+AM_CONDITIONAL(HOST_ANDROID, test x$platform_android = xyes)
 
-if test -z "$PLATFORM_DARWIN_TRUE"; then :
+if test -z "$HOST_DARWIN_TRUE"; then :
 PLATFORM_AOT_SUFFIX=.dylib
 fi
 
-if test -z "$PLATFORM_LINUX_TRUE"; then :
+if test -z "$HOST_LINUX_TRUE"; then :
 PLATFORM_AOT_SUFFIX=.so
 fi
 
@@ -3034,6 +3059,18 @@ jit_wanted=true
 boehm_supported=true
 BTLS_SUPPORTED=no
 BTLS_PLATFORM=
+
+if test "x$enable_wasm" = "xyes"; then
+TARGET=WASM
+HOST=WASM
+arch_target=wasm
+AC_DEFINE(TARGET_WASM, 1, [Target wasm])
+BTLS_SUPPORTED=no
+with_tls=pthread
+target_mach=no
+
+else
+
 case "$host" in
        mips*)
                TARGET=MIPS;
@@ -3436,6 +3473,8 @@ SPARC64)
        ;;
 esac
 
+#WASM hack
+fi
 
 
 dnl *************
@@ -4305,6 +4344,8 @@ AM_CONDITIONAL(HOST_X86, test x$HOST = xX86)
 AM_CONDITIONAL(HOST_AMD64, test x$HOST = xAMD64)
 AM_CONDITIONAL(HOST_ARM, test x$HOST = xARM)
 AM_CONDITIONAL(HOST_ARM64, test x$HOST = xARM64)
+AM_CONDITIONAL(HOST_WASM, test x$HOST = xWASM)
+
 AM_CONDITIONAL(CROSS_COMPILE, test "x$host" != "x$target")
 
 AC_SUBST(LIBC)
index b8a850b078faad374e035543b910696ac9ee9263..f83f62df4297562938cef98668924866b57de2e4 100644 (file)
@@ -37,7 +37,6 @@
   <manpage name="mono-xmltool(1)"       page="../man/mono-xmltool.1" />
   <manpage name="mozroots(1)"           page="../man/mozroots.1" />
   <manpage name="permview(1)"           page="../man/permview.1" />
-  <manpage name="prj2make(1)"           page="../man/prj2make.1" />
   <manpage name="resgen(1)"             page="../man/resgen.1" />
   <manpage name="secutil(1)"            page="../man/secutil.1" />
   <manpage name="setreg(1)"             page="../man/setreg.1" />
index 2563306d41f7f7fa30421c629d0f3b60b08b1169..bf03a7c5cf6b692fa662f1568ad66de35166b8ea 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 2563306d41f7f7fa30421c629d0f3b60b08b1169
+Subproject commit bf03a7c5cf6b692fa662f1568ad66de35166b8ea
index 47f82456814a05b077e31b58d66c1e4c640aac79..f2c8f2e7fb17e8a55b6679c7d13e3634ec45c639 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 47f82456814a05b077e31b58d66c1e4c640aac79
+Subproject commit f2c8f2e7fb17e8a55b6679c7d13e3634ec45c639
index 3cbab919b940b448ad20511d686465ea2f261fe7..03305b61de01731151772653f01ed98a332076b9 100644 (file)
 #           if defined(__GLIBC__)&& __GLIBC__>=2
 #              define SEARCH_FOR_DATA_START
 #           else /* !GLIBC2 */
-#              if defined(PLATFORM_ANDROID)
+#              if defined(HOST_ANDROID)
 #                      define __environ environ
 #              endif
                extern char **__environ;
 #           include <features.h>
 #           if defined(__GLIBC__) && __GLIBC__ >= 2
 #               define SEARCH_FOR_DATA_START
-#           elif defined(PLATFORM_ANDROID)
+#           elif defined(HOST_ANDROID)
 #               define SEARCH_FOR_DATA_START
 #           else
                 extern char **__environ;
index bcb89b6a1982ab53a0ee338491c61a35997d0ba2..0abbd242a85632e6879d15210142c7b45dadc50e 100644 (file)
@@ -45,7 +45,7 @@ typedef struct GC_Thread_Rep {
                                  /* guaranteed to be dead, but we may  */
                                  /* not yet have registered the join.) */
     pthread_t id;
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
     pid_t kernel_id;
 #endif
     /* Extra bookkeeping information the stopping code uses */
index 3bfdfbf35eddc525cb5667d1e6a258babf555ea5..afa77dadfab52b020debb373f370f7b42c32fe21 100644 (file)
@@ -337,7 +337,7 @@ void GC_push_all_stacks()
 pthread_t GC_stopping_thread;
 int GC_stopping_pid;
 
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
 static
 int android_thread_kill(pid_t tid, int sig)
 {
@@ -379,7 +379,7 @@ int GC_suspend_all()
              GC_printf1("Sending suspend signal to 0x%lx\n", p -> id);
            #endif
 
-#ifndef PLATFORM_ANDROID
+#ifndef HOST_ANDROID
         result = pthread_kill(p -> id, SIG_SUSPEND);
 #else
         result = android_thread_kill(p -> kernel_id, SIG_SUSPEND);
@@ -658,7 +658,7 @@ static void pthread_start_world()
              GC_printf1("Sending restart signal to 0x%lx\n", p -> id);
            #endif
 
-#ifndef PLATFORM_ANDROID
+#ifndef HOST_ANDROID
         result = pthread_kill(p -> id, SIG_THR_RESTART);
 #else
         result = android_thread_kill(p -> kernel_id, SIG_THR_RESTART);
index cdca33252758a32a390a64e6fd275cc423071154..097d588a7b55fd77569d2def2b9e80348068085c 100644 (file)
@@ -764,7 +764,7 @@ GC_thread GC_new_thread(pthread_t id)
     }
     if (result == 0) return(0);
     result -> id = id;
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
     result -> kernel_id = gettid();
 #endif
     result -> next = GC_threads[hv];
index d8f7bb5be561ec55cdacd76549276d2ff8925382..fa807fa7aa2d587386e2335a188f5f0b295ff1f9 100644 (file)
@@ -30,6 +30,7 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyColumnMappingCollection))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlBulkCopyOptions))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlClientFactory))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlClientMetaDataCollectionNames))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlCommand))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlConnection))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Data.SqlClient.SqlConnectionStringBuilder))]
index 309d6fb5ce34cb7bdd3c5fa7162cc29ab342bf77..ade174b59d5caa4caa116833c0aa976168c9e4c4 100644 (file)
@@ -41,6 +41,8 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngProvider))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngUIPolicy))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.CngUIProtectionLevels))]
+// TODO: [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.DSACng))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECDsaCng))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.ECKeyXmlFormat))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.RSACng))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Security.Cryptography.TripleDESCng))]
index 4aa28e9e49f0bc660137f259cfe73a0b8d799c84..597267838d2f9cfe170d462411e6ed88ba60518a 100644 (file)
@@ -36,6 +36,7 @@
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.Channels.WebSocketTransportUsage))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpBindingBase))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpClientCredentialType))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpProxyCredentialType))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.HttpTransportSecurity))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpBinding))]
 [assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.NetHttpsBinding))]
diff --git a/mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args b/mcs/class/Mono.Directory.LDAP/Test/dslib_linux_test.args
deleted file mode 100644 (file)
index 1388443..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-Mono.Directory.LDAP/BindSimpleTest.cs
-Mono.Directory.LDAP/QueryRootDSETest.cs
index 0d93439c3b6d1e6c2ec3444a5b4fff4db10110ab..a68c1608b7c5a3c94341d582df92419b98c91181 100644 (file)
@@ -32,8 +32,8 @@
 //
 
 // Compile With:
-//   mcs -debug+ -r:System.Core Options.cs -o:Mono.Options.dll
-//   mcs -debug+ -d:LINQ -r:System.Core Options.cs -o:Mono.Options.dll
+//   mcs -debug+ -r:System.Core Options.cs -o:Mono.Options.dll -t:library
+//   mcs -debug+ -d:LINQ -r:System.Core Options.cs -o:Mono.Options.dll -t:library
 //
 // The LINQ version just changes the implementation of
 // OptionSet.Parse(IEnumerable<string>), and confers no semantic changes.
index 89f9aaed0748d2760ef74c49be8c6763426889de..49e2d85f4c3a9917b3efe1882f27f9272e202952 100644 (file)
@@ -137,7 +137,7 @@ namespace Mono.Security.Protocol.Tls.Handshake.Client
                                return null;
 
                        foreach (X509Certificate certificate in this.Context.ClientSettings.Certificates) {
-                               if (cert.GetName () == cert.GetIssuerName ())
+                               if (certificate.GetName () == cert.GetIssuerName ())
                                        return certificate;
                        }
                        return null;
diff --git a/mcs/class/Mono.Security/Test/Mono.Security_test.args b/mcs/class/Mono.Security/Test/Mono.Security_test.args
deleted file mode 100644 (file)
index 912b8e6..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-Mono.Security/StrongNameTest.cs
-Mono.Security.Authenticode/PrivateKeyTest.cs
-Mono.Security.Authenticode/SoftwarePublisherCertificateTest.cs
-Mono.Security.Cryptography/ARC4ManagedTest.cs
-Mono.Security.Cryptography/MD2ManagedTest.cs
-Mono.Security.Cryptography/MD2Test.cs
index cbf1491612fcb12ef9a378c26e6cf214b0d30835..da4d7f36b9e769e5003eefda2ca57534f8862bf1 100644 (file)
@@ -37,6 +37,12 @@ namespace Microsoft.Win32.SafeHandles
                {
                }
 
+               protected SafeNCryptHandle (IntPtr handle, System.Runtime.InteropServices.SafeHandle parentHandle)
+                       : base (false)
+               {
+                       throw new NotImplementedException ();
+               }
+
                public override bool IsInvalid { get { throw new NotImplementedException (); } }
 
                protected override bool ReleaseHandle ()
index 3dcbfae8d6d2728bf032b18b4e48108bd6bad687..06840259bf63c1222250deed9864449bd017d4c1 100644 (file)
@@ -26,6 +26,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+using System;
+
 namespace Microsoft.Win32.SafeHandles
 {
        public sealed class SafeNCryptKeyHandle : SafeNCryptHandle
@@ -34,6 +36,12 @@ namespace Microsoft.Win32.SafeHandles
                {
                }
 
+               public SafeNCryptKeyHandle (IntPtr handle, System.Runtime.InteropServices.SafeHandle parentHandle)
+                       : base (handle, parentHandle)
+               {
+
+               }
+
                protected override bool ReleaseNativeHandle ()
                {
                        return false;
index b521fe7b41c251c2dc89474990f179692f499c79..cfe271aeee0f79bab2d76540c229f345d706f046 100644 (file)
@@ -71,6 +71,7 @@ corefx/SR.missing.cs
 ../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
 ../referencesource/System.Core/System/Security/Cryptography/ECDsa.cs
 ../referencesource/System.Core/System/Security/Cryptography/ECDsaCng.cs
+../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs
 ../referencesource/System.Core/System/Security/Cryptography/NCryptNative.cs
 ../referencesource/System.Core/System/Security/Cryptography/RsaCng.cs
 
index 215215e76a2d7eb8b64eadeb1b8a0ba800294625..5cc42d8a3cf3be4a42c55d4f1d66778dee6eda00 100644 (file)
@@ -14,6 +14,5 @@ System.Security.Cryptography/SHA512Cng.cs
 
 ../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs
 ../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs
-../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs
 
 ../referencesource/System.Core/System/threading/ReaderWriterLockSlim/LockRecursionException.cs
diff --git a/mcs/class/System.Data/Test/data_linux_test.args b/mcs/class/System.Data/Test/data_linux_test.args
deleted file mode 100644 (file)
index 6f30e2a..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-System.Data.SqlTypes/SqlBinaryTest.cs
-System.Data.SqlTypes/SqlBooleanTest.cs
-System.Data.SqlTypes/SqlByteTest.cs
-System.Data.SqlTypes/SqlDoubleTest.cs
-System.Data.SqlTypes/SqlInt16Test.cs
-System.Data.SqlTypes/SqlInt32Test.cs
-System.Data.SqlTypes/SqlInt64Test.cs
-System.Data.SqlTypes/SqlSingleTest.cs
-System.Data.SqlTypes/SqlMoneyTest.cs
-System.Data.SqlTypes/SqlDateTimeTest.cs
-System.Data.SqlTypes/SqlGuidTest.cs
-System.Data.SqlTypes/SqlDecimalTest.cs
-System.Data.SqlTypes/SqlStringTest.cs
-System.Xml/XmlDataDocumentTest.cs
-System.Data/ConstraintCollectionTest.cs
-System.Data/ConstraintTest.cs
-System.Data/DataColumnCollectionTest.cs
-System.Data/DataColumnTest.cs
-System.Data/DataRelationTest.cs
-System.Data/DataRowCollectionTest.cs
-System.Data/DataRowTest.cs
-System.Data/DataSetTest.cs
-System.Data/DataTableTest.cs
-System.Data/DataViewTest.cs
-System.Data/ForeignKeyConstraintTest.cs
-System.Data/UniqueConstraintTest.cs
\ No newline at end of file
diff --git a/mcs/class/System.Security/Test/security_linux_test.args b/mcs/class/System.Security/Test/security_linux_test.args
deleted file mode 100644 (file)
index a4c30e3..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-System.Security.Cryptography.Xml/AssertCrypto.cs
-System.Security.Cryptography.Xml/DataObjectTest.cs
-System.Security.Cryptography.Xml/DSAKeyValueTest.cs
-System.Security.Cryptography.Xml/KeyInfoNameTest.cs
-System.Security.Cryptography.Xml/KeyInfoNodeTest.cs
-System.Security.Cryptography.Xml/KeyInfoRetrievalMethodTest.cs
-System.Security.Cryptography.Xml/KeyInfoTest.cs
-System.Security.Cryptography.Xml/KeyInfoX509DataTest.cs
-System.Security.Cryptography.Xml/ReferenceTest.cs
-System.Security.Cryptography.Xml/RSAKeyValueTest.cs
-System.Security.Cryptography.Xml/SignatureTest.cs
-System.Security.Cryptography.Xml/SignedInfoTest.cs
-System.Security.Cryptography.Xml/SignedXmlTest.cs
-System.Security.Cryptography.Xml/TransformChainTest.cs
-System.Security.Cryptography.Xml/XmlDsigBase64TransformTest.cs
-System.Security.Cryptography.Xml/XmlDsigC14NTransformTest.cs
-System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransformTest.cs
-System.Security.Cryptography.Xml/XmlDsigXsltTransformTest.cs
index cd586fa05c3a2276c9077328b6f6c7540e2dc2f1..398c0d8d7b65698976a33f1f44719fe3e7c9dbb9 100644 (file)
@@ -649,6 +649,7 @@ namespace System.ServiceModel.Syndication
 
                string [] rfc822formats = new string [] {
                        "ddd, dd MMM yyyy HH:mm:ss 'Z'",
+                       "ddd, dd MMM yyyy HH:mm:ss 'GMT'",
                        "ddd, dd MMM yyyy HH:mm:ss zzz",
                        "ddd, dd MMM yyyy HH:mm:ss"};
 
diff --git a/mcs/class/System.Web.Services/Test/System.Web.Services_test.args b/mcs/class/System.Web.Services/Test/System.Web.Services_test.args
deleted file mode 100644 (file)
index 4cac28d..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---target library
--o System.Web.Services_test.dll
---noconfig
--r ../../lib/corlib.dll
--r ../../lib/System.dll
--r ../../lib/System.Web.Services.dll
--r ../../lib/System.EnterpriseServices.dll
--r ../../../nunit20/NUnit.Framework.dll
-System.Web.Services/WebMethodAttributeTest.cs
-System.Web.Services/WebServiceAttributeTest.cs
-System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
-System.Web.Services.Discovery/ContractReferenceTest.cs
index 1d090632a1ac178fa39c8d2a335a6c32534ba0f1..b60c42b346611dc2e9d9b68824662ca4cb5f0d9f 100644 (file)
@@ -1564,8 +1564,8 @@ namespace System.Windows.Forms
                        Color back_color, fore_color;
                        Rectangle text_draw = e.Bounds;
                        StringFormat string_format = new StringFormat ();
-                       string_format.FormatFlags = StringFormatFlags.LineLimit;
-                       
+                       string_format.FormatFlags = StringFormatFlags.LineLimit | StringFormatFlags.NoWrap;
+
                        if ((e.State & DrawItemState.Selected) == DrawItemState.Selected) {
                                back_color = ColorHighlight;
                                fore_color = ColorHighlightText;
index d3b29fa2721179ad4337eff51a0b33239b3a3801..710433ef071619a21464d6a07c31f1eafc12cff0 100644 (file)
@@ -133,28 +133,28 @@ namespace Mono.AppleTls
                                        targetHost = targetHost.Substring (0, pos);
                        }
 
-                       var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost);
-                       var trust = new SecTrust (certificates, policy);
-
-                       if (validator.Settings.TrustAnchors != null) {
-                               var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
-                               if (status != SecStatusCode.Success)
-                                       throw new InvalidOperationException (status.ToString ());
-                               trust.SetAnchorCertificatesOnly (false);
-                       }
-
-                       if (validator.Settings.CertificateValidationTime != null) {
-                               var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
-                               if (status != SecStatusCode.Success)
-                                       throw new InvalidOperationException (status.ToString ());
+                       using (var policy = SecPolicy.CreateSslPolicy (!serverMode, targetHost))
+                       using (var trust = new SecTrust (certificates, policy)) {
+                               if (validator.Settings.TrustAnchors != null) {
+                                       var status = trust.SetAnchorCertificates (validator.Settings.TrustAnchors);
+                                       if (status != SecStatusCode.Success)
+                                               throw new InvalidOperationException (status.ToString ());
+                                       trust.SetAnchorCertificatesOnly (false);
+                               }
+
+                               if (validator.Settings.CertificateValidationTime != null) {
+                                       var status = trust.SetVerifyDate (validator.Settings.CertificateValidationTime.Value);
+                                       if (status != SecStatusCode.Success)
+                                               throw new InvalidOperationException (status.ToString ());
+                               }
+
+                               var result = trust.Evaluate ();
+                               if (result == SecTrustResult.Unspecified)
+                                       return true;
+
+                               errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
+                               return false;
                        }
-
-                       var result = trust.Evaluate ();
-                       if (result == SecTrustResult.Unspecified)
-                               return true;
-
-                       errors |= MonoSslPolicyErrors.RemoteCertificateChainErrors;
-                       return false;
                }
        }
 }
index 563e35f01d15e9f6583699ec2273c4a641919b82..1d53227f5e9777b78de91c2287cea8b2c5c8edf9 100644 (file)
@@ -234,32 +234,41 @@ namespace Mono.AppleTls
                         * 
                         */
 
-                       var trust = GetPeerTrust (!IsServer);
-                       X509CertificateCollection certificates;
+                       bool ok;
+                       SecTrust trust = null;
+                       X509CertificateCollection certificates = null;
 
-                       if (trust == null || trust.Count == 0) {
-                               remoteCertificate = null;
-                               if (!IsServer)
-                                       throw new TlsException (AlertDescription.CertificateUnknown);
-                               certificates = null;
-                       } else {
-                               if (trust.Count > 1)
-                                       Debug ("WARNING: Got multiple certificates in SecTrust!");
+                       try {
+                               trust = GetPeerTrust (!IsServer);
 
-                               certificates = new X509CertificateCollection ();
-                               for (int i = 0; i < trust.Count; i++)
-                                       certificates.Add (trust [(IntPtr)i].ToX509Certificate ());
+                               if (trust == null || trust.Count == 0) {
+                                       remoteCertificate = null;
+                                       if (!IsServer)
+                                               throw new TlsException (AlertDescription.CertificateUnknown);
+                                       certificates = null;
+                               } else {
+                                       if (trust.Count > 1)
+                                               Debug ("WARNING: Got multiple certificates in SecTrust!");
 
-                               remoteCertificate = certificates [0];
-                               Debug ("Got peer trust: {0}", remoteCertificate);
-                       }
+                                       certificates = new X509CertificateCollection ();
+                                       for (int i = 0; i < trust.Count; i++)
+                                               certificates.Add (trust.GetCertificate (i));
+
+                                       remoteCertificate = new X509Certificate (certificates [0]);
+                                       Debug ("Got peer trust: {0}", remoteCertificate);
+                               }
 
-                       bool ok;
-                       try {
                                ok = ValidateCertificate (certificates);
                        } catch (Exception ex) {
                                Debug ("Certificate validation failed: {0}", ex);
                                throw new TlsException (AlertDescription.CertificateUnknown, "Certificate validation threw exception.");
+                       } finally {
+                               if (trust != null)
+                                       trust.Dispose ();
+                               if (certificates != null) {
+                                       for (int i = 0; i < certificates.Count; i++)
+                                               certificates [i].Dispose ();
+                               }
                        }
 
                        if (!ok)
@@ -664,7 +673,7 @@ namespace Mono.AppleTls
                                if (value == IntPtr.Zero)
                                        throw new TlsException (AlertDescription.CertificateUnknown);
                        }
-                       return (value == IntPtr.Zero) ? null : new SecTrust (value);
+                       return (value == IntPtr.Zero) ? null : new SecTrust (value, true);
                }
 
                #endregion
index 33a505043e813768b24d5d970360d827dd3d21c2..3ec3c4dd608140a2f503c7d98fdbf338593a167f 100644 (file)
@@ -66,6 +66,8 @@ namespace Mono.AppleTls {
                        foreach (var certificate in certificates)
                                array [i++] = new SecCertificate (certificate);
                        Initialize (array, policy);
+                       for (i = 0; i < array.Length; i++)
+                               array [i].Dispose ();
                }
 
                void Initialize (SecCertificate[] array, SecPolicy policy)
@@ -122,6 +124,17 @@ namespace Mono.AppleTls {
                        }
                }
 
+               internal X509Certificate GetCertificate (int index)
+               {
+                       if (handle == IntPtr.Zero)
+                               throw new ObjectDisposedException ("SecTrust");
+                       if (index < 0 || index >= Count)
+                               throw new ArgumentOutOfRangeException ("index");
+
+                       var ptr = SecTrustGetCertificateAtIndex (handle, (IntPtr)index);
+                       return new X509Certificate (ptr);
+               }
+
                [DllImport (AppleTlsContext.SecurityLibrary)]
                extern static SecStatusCode /* OSStatus */ SecTrustSetAnchorCertificates (IntPtr /* SecTrustRef */ trust, IntPtr /* CFArrayRef */ anchorCertificates);
 
index d5b1e3863d6a490fd850c1deae055f0429bdcbda..a18b9fba8f695be595e34687b92949f3dd80fb69 100644 (file)
@@ -46,6 +46,7 @@ namespace System.ComponentModel
                        case 32: /* ERROR_SHARING_VIOLATION */ return "Sharing violation";
                        case 33: /* ERROR_LOCK_VIOLATION */ return "Lock violation";
                        case 50: /* ERROR_NOT_SUPPORTED */ return "Operation not supported";
+                       case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
                        case 87: /* ERROR_INVALID_PARAMETER */ return "Invalid parameter";
                        case 120: /* ERROR_CALL_NOT_IMPLEMENTED */ return "Call not implemented";
                        case 123: /* ERROR_INVALID_NAME */ return "Invalid name";
@@ -143,7 +144,6 @@ namespace System.ComponentModel
                        case 52: /* ERROR_DUP_NAME */ return "Duplicate name";
                        case 53: /* ERROR_BAD_NETPATH */ return "Bad netpath";
                        case 54: /* ERROR_NETWORK_BUSY */ return "Network busy";
-                       case 55: /* ERROR_DEV_NOT_EXIST */ return "Device does not exist";
                        case 56: /* ERROR_TOO_MANY_CMDS */ return "Too many commands";
                        case 57: /* ERROR_ADAP_HDW_ERR */ return "ADAP HDW error";
                        case 58: /* ERROR_BAD_NET_RESP */ return "Bad net response";
index e1435f84b643cbab403b80237bc8ebdf51ae121c..68c480fa86eb26acd2e517e0023975863b0f32a1 100644 (file)
@@ -56,7 +56,6 @@ namespace System.Net
                object socketLock = new object ();
                IWebConnectionState state;
                WebExceptionStatus status;
-               WaitCallback initConn;
                bool keepAlive;
                byte [] buffer;
                EventHandler abortHandler;
index b707567f1de9e8bae42dce2492e7df4b572f5908..ceac114da7162b26a38bebe2d929b454118bee24 100644 (file)
@@ -1862,6 +1862,26 @@ public class AssemblyNameTest {
 
                Assert.AreEqual ("", an.CultureName);
        }
+
+       [Test]
+       public void TestDecodingEcmaKey ()
+       {
+        var x = new AssemblyName( "System, PublicKey=00000000000000000400000000000000" );
+               Assert.IsNull (x.GetPublicKey (), "#1");
+               Assert.IsNotNull (x.GetPublicKeyToken (), "#2");
+
+               var t = x.GetPublicKeyToken ();
+               Assert.AreEqual (8, t.Length, "#3");
+
+               Assert.AreEqual (0xB7, t [0], "#4.0");
+               Assert.AreEqual (0x7A, t [1], "#4.1");
+               Assert.AreEqual (0x5C, t [2], "#4.2");
+               Assert.AreEqual (0x56, t [3], "#4.3");
+               Assert.AreEqual (0x19, t [4], "#4.4");
+               Assert.AreEqual (0x34, t [5], "#4.5");
+               Assert.AreEqual (0xE0, t [6], "#4.6");
+               Assert.AreEqual (0x89, t [7], "#4.7");
+       }
 }
 
 }
diff --git a/mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs b/mcs/class/corlib/Test/System.Runtime.Remoting.Proxies/RealProxyTest.cs
new file mode 100644 (file)
index 0000000..36d8906
--- /dev/null
@@ -0,0 +1,76 @@
+//
+// MonoTests.System.Runtime.Remoting.Proxies.RealProxyTest.cs
+//
+//
+
+using System;
+using System.Runtime.Remoting.Messaging;
+using System.Runtime.Remoting.Proxies;
+using NUnit.Framework;
+
+namespace MonoTests.System.Runtime.Remoting.Proxies {
+       [TestFixture]
+       public class RealProxyTest {
+
+               public class ExampleInterfaceProxy : RealProxy {
+                       public bool Called;
+
+                       public ExampleInterfaceProxy () : base (typeof(IComparable))
+                       {
+                               Called = false;
+                       }
+
+                       public override IMessage Invoke (IMessage msg)
+                       {
+                               Called = true;
+                               return new ReturnMessage (typeof(IComparable), null, 0, null, null);
+                       }
+               }
+
+               [Test]
+               public void InterfaceProxyGetTypeOkay ()
+               {
+                       // Regression test for #17325
+                       // Check that GetType () for a proxy of an interface
+                       // returns the interface.
+                       var prox = new ExampleInterfaceProxy ();
+                       var tprox = prox.GetTransparentProxy ();
+
+                       Assert.IsNotNull (tprox, "#1");
+
+                       var tproxType = tprox.GetType ();
+
+                       Assert.IsFalse (prox.Called, "#2"); // this is true on .NET Framework, but false on Mono.
+
+                       Assert.IsNotNull (tproxType, "#3");
+                       Assert.IsTrue (tproxType.IsAssignableFrom (typeof(IComparable)), "#4");
+               }
+
+               [Test]
+               public void InterfaceProxyGetTypeViaReflectionOkay ()
+               {
+                       // Regression test for #17325
+                       // Check that GetType () for a proxy of an interface
+                       // returns the interface.
+                       //
+                       // This versions calls GetType using reflection, which
+                       // avoids the fast path in the JIT.
+                       var prox = new ExampleInterfaceProxy ();
+                       var tprox = prox.GetTransparentProxy ();
+
+                       Assert.IsNotNull (tprox, "#1");
+
+
+                       var m = typeof(object).GetMethod ("GetType");
+
+                       var tproxType = m.Invoke (tprox, null);
+
+                       Assert.IsTrue (prox.Called, "#2");
+
+                       Assert.IsNotNull (tproxType, "#3");
+                       Assert.IsTrue (tproxType is Type, "#4");
+                       Assert.IsTrue ((tproxType as Type).IsAssignableFrom (typeof(IComparable)), "#5");
+               }
+
+       }
+}
index 4005d1ad6c56783437c7dc1339473b5cc4e2e445..8693bdfbe5ec8b6cb1a76bf68ecbe5b91befd154 100644 (file)
@@ -341,7 +341,7 @@ namespace MonoTests.System.Runtime.Remoting
                        Thread tr = new Thread (new ThreadStart (CallbackThread));
                        tr.Start();
                        
-                       bool terminated = tr.Join(2000);
+                       bool terminated = tr.Join(10000);
                        Assert.IsTrue(terminated, "Thread didn't get lock of context bound object.");
                        
                        Assert.IsTrue (!otResult, "Concurrency detected in CallbackThread");
index e780524afe159689a756d40445428ab7361b38d2..418183526fa37fe7ede65c5fb382b7f0f7cadd15 100644 (file)
@@ -219,7 +219,6 @@ namespace MonoTests.System.Text
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void GetString_Odd_Count_0 ()
                {
                        byte [] array = new byte [3];
@@ -231,7 +230,6 @@ namespace MonoTests.System.Text
                }
 
                [Test]
-               [Category ("NotWorking")]
                public void GetString_Odd_Count_ff ()
                {
                        byte [] array = new byte [3] { 0xff, 0xff, 0xff };
index 1cf78170bce5425cb632778321ca355ab3e3937b..2bc45681cebc5f7e05d926960bb2fe012b8cd6f9 100644 (file)
@@ -1258,7 +1258,7 @@ namespace MonoTests.System.Threading.Tasks
                {
                        var t = Task.Delay (300);
                        Assert.IsTrue (TaskStatus.WaitingForActivation == t.Status || TaskStatus.Running == t.Status, "#1");
-                       Assert.IsTrue (t.Wait (400), "#2");
+                       Assert.IsTrue (t.Wait (1200), "#2");
                }
 
                [Test]
index 1f8fe1b01681b2255dc7b26bf99fb7468e123b2d..5fee569b7c7770d6aac101d5457f9d3aef620fdc 100644 (file)
@@ -205,6 +205,7 @@ System.Runtime.Remoting.Channels/ChannelServicesTest.cs
 System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
 System.Runtime.Remoting.Messaging/CallContextTest.cs
 System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs
+System.Runtime.Remoting.Proxies/RealProxyTest.cs
 System.Runtime.Serialization/FormatterServicesTests.cs
 System.Runtime.Serialization/ObjectIDGeneratorTests.cs
 System.Runtime.Serialization/SerializationBinderTest.cs
index 0b368fe3531598ba19cb259b31e939a6098e6677..63b58916eaee510654e48dace49a84ad71c09ea4 100644 (file)
@@ -40,6 +40,7 @@ System.Runtime.Remoting.Channels/ChannelServicesTest.cs
 System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
 System.Runtime.Remoting.Messaging/CallContextTest.cs
 System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs
+System.Runtime.Remoting.Proxies/RealProxyTest.cs
 System.Security.AccessControl/AuthorizationRuleTest.cs
 System.Security.AccessControl/CommonAceTest.cs
 System.Security.AccessControl/CommonAclTest.cs
index cd8283a9f64a650ba537e8053d5ec1d951e0ce5d..39ad193190cc159a1f79e91ca9072a06511c6506 100644 (file)
@@ -35,6 +35,8 @@ namespace System.Security.Cryptography {
             throw new NotImplementedException ();
         }
 
+        public CngAlgorithm HashAlgorithm { get; set; }
+
         public CngKey Key {
             get {
                 throw new NotImplementedException ();
@@ -52,6 +54,38 @@ namespace System.Security.Cryptography {
         public override bool VerifyHash(byte[] hash, byte[] signature) {
             throw new NotImplementedException();
         }
+
+        public void FromXmlString (string xml, ECKeyXmlFormat format) {
+            throw new NotImplementedException();
+        }
+
+        public byte[] SignData (byte[] data) {
+            throw new NotImplementedException();
+        }
+
+        public byte[] SignData (System.IO.Stream data) {
+            throw new NotImplementedException();
+        }
+
+        public byte[] SignData (byte[] data, int offset, int count) {
+            throw new NotImplementedException();
+        }
+
+        public string ToXmlString (ECKeyXmlFormat format) {
+            throw new NotImplementedException();
+        }
+
+        public bool VerifyData (byte[] data, byte[] signature) {
+            throw new NotImplementedException();
+        }
+
+        public bool VerifyData (System.IO.Stream data, byte[] signature) {
+            throw new NotImplementedException();
+        }
+
+        public bool VerifyData (byte[] data, int offset, int count, byte[] signature) {
+            throw new NotImplementedException();
+        }
 #else
         private static KeySizes[] s_legalKeySizes = new KeySizes[] { new KeySizes(256, 384, 128), new KeySizes(521, 521, 0) };
 
index 559c2f3ee43b32b2a6861129f397ea459fde7a11..bb7faf734df22e1fddf9404fac279a2a91619158 100644 (file)
@@ -234,15 +234,15 @@ namespace Mono.CSharp
                public static bool CheckOverrideName (TypeSpec type, TypeSpec baseType)
                {
                        var btype_ntuple = baseType as NamedTupleSpec;
-                       var mtype_ntupe = type as NamedTupleSpec;
-                       if (btype_ntuple == null && mtype_ntupe == null)
+                       var mtype_ntuple = type as NamedTupleSpec;
+                       if (btype_ntuple == null && mtype_ntuple == null)
                                return true;
 
-                       if (btype_ntuple != null || mtype_ntupe != null)
+                       if (btype_ntuple == null || mtype_ntuple == null)
                                return false;
 
                        var b_elements = btype_ntuple.elements;
-                       var m_elements = mtype_ntupe.elements;
+                       var m_elements = mtype_ntuple.elements;
                        for (int i = 0; i < b_elements.Count; ++i) {
                                if (b_elements [i] != m_elements [i])
                                        return false;
diff --git a/mcs/tests/test-tuple-06.cs b/mcs/tests/test-tuple-06.cs
new file mode 100644 (file)
index 0000000..64bb9b0
--- /dev/null
@@ -0,0 +1,19 @@
+class Base
+{
+       public virtual (int, long rest) Foo ()
+       {
+               return (1, 2);
+       }
+}
+
+class Test : Base
+{
+       public override (int, long rest) Foo ()
+       {
+               return (3, 4);
+       }
+
+       public static void Main ()
+       {       
+       }
+}
\ No newline at end of file
index d3c5c4ff729670f377698b2044e242d2abcefb1c..db5bfbd387c5090a47e7c7e01c8813a6cec6540e 100644 (file)
       </method>
     </type>
   </test>
+  <test name="test-tuple-06.cs">
+    <type name="Base">
+      <method name="System.ValueTuple`2[System.Int32,System.Int64] Foo()" attrs="454">
+        <size>17</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+    <type name="Test">
+      <method name="System.ValueTuple`2[System.Int32,System.Int64] Foo()" attrs="198">
+        <size>17</size>
+      </method>
+      <method name="Void Main()" attrs="150">
+        <size>2</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 4febb86c32014b1ea38858496f77a55cf301bbe2..97cf6c6a240c6521ec1a7d23a6a0f5f70365a443 100755 (executable)
@@ -1169,9 +1169,18 @@ void          mono_register_config_for_assembly (const char* assembly_name, cons
                        return true;
                try {
                        Assembly a = universe.LoadFile (path);
+                       if (a == null) {
+                               Error ("Unable to to load assembly `{0}'", path);
+                               return false;
+                       }
 
                        foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
                                a = LoadAssembly (an.Name);
+                               if (a == null) {
+                                       Error ("Unable to load assembly `{0}' referenced by `{1}'", an.Name, path);
+                                       return false;
+                               }
+
                                if (!QueueAssembly (files, a.CodeBase))
                                        return false;
                        }
diff --git a/mcs/tools/sqlsharp/unix.args b/mcs/tools/sqlsharp/unix.args
deleted file mode 100644 (file)
index 3bd22b9..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
--o SqlSharpCli.exe
-SqlSharpCli.cs
index 406829f8021e462580eb1fbdd272df99a1602f0f..20268929bff93d35118ce83778a464fe510710cc 100644 (file)
@@ -18,6 +18,7 @@ install-local: install-extras
 
 PORTABLE_TARGETS_SRC:=data/Portable/Targets
 PCL5_FX_SRC:=data/Portable/Frameworks/v5.0
+DENIED_ASSEMBLY_LIST_SRC=data/deniedAssembliesList.txt
 
 NETFRAMEWORK_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETFramework
 PCL5_FX_DIR=$(mono_libdir)/mono/xbuild-frameworks/.NETPortable/v5.0
@@ -35,7 +36,7 @@ endif
 install-versioned-files: install-bin-data install-nuget-imports
 
 #install files that are only installed once across all xbuild versions
-install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets
+install-global-files: install-frameworks install-web-targets install-pcl-targets install-pcl5-framework install-nuget-targets install-msbuild-specific-files
 
 install-bin-data:
        $(MKINSTALLDIRS) $(DESTDIR)$(XBUILD_BIN_DIR)/MSBuild
@@ -122,6 +123,10 @@ install-pcl5-framework:
        $(INSTALL_DATA) "$(PCL5_FX_SRC)/ASP.NET Core 1.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/ASP.NET Core 1.0.xml"
        $(INSTALL_DATA) "$(PCL5_FX_SRC)/Windows Universal 10.0.xml" "$(DESTDIR)$(PCL5_FX_DIR)/SupportedFrameworks/Windows Universal 10.0.xml"
 
+install-msbuild-specific-files:
+       $(MKINSTALLDIRS) $(DESTDIR)$(mono_libdir)/mono/xbuild
+       $(INSTALL_DATA) $(DENIED_ASSEMBLY_LIST_SRC) $(DESTDIR)$(mono_libdir)/mono/xbuild
+
 EXTRA_DISTFILES = \
        data/xbuild.rsp \
        data/xbuild.exe.config.in \
@@ -164,6 +169,7 @@ EXTRA_DISTFILES = \
        "data/Portable/Frameworks/v5.0/ASP.NET Core 1.0.xml" \
        "data/Portable/Frameworks/v5.0/FrameworkList.xml" \
        "data/Portable/Frameworks/v5.0/Windows Universal 10.0.xml" \
+       data/deniedAssembliesList.txt \
        frameworks/net_2.0.xml \
        frameworks/net_3.0.xml \
        frameworks/net_3.5.xml \
diff --git a/mcs/tools/xbuild/data/deniedAssembliesList.txt b/mcs/tools/xbuild/data/deniedAssembliesList.txt
new file mode 100644 (file)
index 0000000..95122c2
--- /dev/null
@@ -0,0 +1,18 @@
+System.Globalization.Extensions.dll,475DBF02-9F68-44F1-8FB5-C9F69F1BD2B1,4,0,0,0
+System.Globalization.Extensions.dll,5FCD54F0-4B97-4259-875D-30E481F02EA2,4,0,1,0
+System.Globalization.Extensions.dll,E9FCFF5B-4DE1-4BDC-9CE8-08C640FC78CC,4,0,2,0
+System.IO.Compression.dll,44FCA06C-A510-4B3E-BDBF-D08D697EF65A,4,1,0,0
+System.IO.Compression.dll,3A58A219-266B-47C3-8BE8-4E4F394147AB,4,1,2,0
+System.Net.Http.dll,269B562C-CC15-4736-B1B1-68D4A43CAA98,4,1,0,0
+System.Net.Http.dll,EA2EC6DC-51DD-479C-BFC2-E713FB9E7E47,4,1,0,1
+System.Net.Http.dll,C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0,4,1,1,0
+System.Net.Http.dll,817F01C3-4011-477D-890A-98232B85553D,4,1,1,0
+System.Net.Http.dll,09D4A140-061C-4884-9B63-22067E841931,4,1,1,1
+System.Runtime.InteropServices.RuntimeInformation.dll,F13660F8-9D0D-419F-BA4E-315693DD26EA,4,0,0,0
+System.Runtime.InteropServices.RuntimeInformation.dll,DD91439F-3167-478E-BD2C-BF9C036A1395,4,0,1,0
+System.Text.Encoding.CodePages.dll,C142254F-DEB5-46A7-AE43-6F10320D1D1F,4,0,1,0
+System.Text.Encoding.CodePages.dll,FD178CD4-EF4F-44D5-9C3F-812B1E25126B,4,0,2,0
+System.Text.Encoding.CodePages.dll,F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8,4,1,0,0
+System.Threading.Overlapped.dll,9F5D4F09-787A-458A-BA08-553AA71470F1,4,0,0,0
+System.Threading.Overlapped.dll,FCBD003B-2BB4-4940-BAEF-63AF520C2336,4,0,1,0
+System.Threading.Overlapped.dll,87697E71-D192-4F0B-BAD4-02BBC7793005,4,0,2,0
index 06085362c54484072e624443e2c11b6a9dc573c3..f1e79e317873425230b3eb0ff011313988852317 100644 (file)
@@ -54,7 +54,7 @@ monodis_LDADD =                       \
        $(GLIB_LIBS)                    \
        $(LIBICONV)
 
-if PLATFORM_DARWIN
+if HOST_DARWIN
 monodis_LDFLAGS=-framework CoreFoundation -framework Foundation
 endif
 
index 08cf40a763d7e399764231fb3f1bb7e6bd85a25f..87051a6be13320bd7e07a3a71baf14c5427d6c1c 100644 (file)
@@ -55,7 +55,7 @@ AM_CPPFLAGS = -I$(srcdir)
 if HOST_WIN32
 libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
 else
-if PLATFORM_ANDROID
+if HOST_ANDROID
 libeglib_la_LIBADD = -llog
 endif
 endif
index 7b1627c0cd27b61955f820f5b20bbdc38e60144d..e785170621ca6ebfc2669c4d9bf2b866ed5c94ff 100644 (file)
@@ -137,7 +137,7 @@ g_assertion_message (const gchar *format, ...)
        exit (0);
 }
 
-#if PLATFORM_ANDROID
+#if HOST_ANDROID
 #include <android/log.h>
 
 static android_LogPriority
index 95867a3e4ca4fe233f645b950b6b8e59fbd8fac8..2fbf826ceece5a6338eadd77b1deb9d5267801e0 100644 (file)
@@ -59,7 +59,7 @@ unix_sources = \
 platform_sources = $(unix_sources)
 endif
 
-if PLATFORM_ANDROID
+if HOST_ANDROID
 platform_sources += ../../support/libm/complex.c
 endif
 
index 35896715ac6ead8cd6b48aa2b7cbff950f2f7832..684a401c95919b0ccce2a70159eb022884260ffb 100644 (file)
@@ -50,7 +50,7 @@
 #include <sys/stat.h>
 #endif
 
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
 #include <mach-o/dyld.h>
 #endif
 
@@ -840,7 +840,7 @@ set_dirs (char *exe)
 void
 mono_set_rootdir (void)
 {
-#if defined(HOST_WIN32) || (defined(PLATFORM_MACOSX) && !defined(TARGET_ARM))
+#if defined(HOST_WIN32) || (defined(HOST_DARWIN) && !defined(TARGET_ARM))
        gchar *bindir, *installdir, *root, *name, *resolvedname, *config;
 
 #ifdef HOST_WIN32
@@ -2372,17 +2372,18 @@ parse_public_key (const gchar *key, gchar** pubkey, gboolean *is_ecma)
        const gchar *pkey;
        gchar header [16], val, *arr, *endp;
        gint i, j, offset, bitlen, keylen, pkeylen;
-       
+
+       //both pubkey and is_ecma are required arguments
+       g_assert (pubkey && is_ecma);
+
        keylen = strlen (key) >> 1;
        if (keylen < 1)
                return FALSE;
 
        /* allow the ECMA standard key */
        if (strcmp (key, "00000000000000000400000000000000") == 0) {
-               if (pubkey) {
-                       *pubkey = g_strdup (key);
-                       *is_ecma = TRUE;
-               }
+               *pubkey = NULL;
+               *is_ecma = TRUE;
                return TRUE;
        }
        *is_ecma = FALSE;
@@ -2427,10 +2428,6 @@ parse_public_key (const gchar *key, gchar** pubkey, gboolean *is_ecma)
        bitlen = read32 (header + 12) >> 3;
        if ((bitlen + 16 + 4) != pkeylen)
                return FALSE;
-
-       /* parsing is OK and the public key itself is not requested back */
-       if (!pubkey)
-               return TRUE;
                
        arr = (gchar *)g_malloc (keylen + 4);
        /* Encode the size of the blob */
@@ -2453,7 +2450,7 @@ build_assembly_name (const char *name, const char *version, const char *culture,
        gint major, minor, build, revision;
        gint len;
        gint version_parts;
-       gchar *pkey, *pkeyptr, *encoded, tok [8];
+       gchar *pkeyptr, *encoded, tok [8];
 
        memset (aname, 0, sizeof (MonoAssemblyName));
 
@@ -2502,17 +2499,16 @@ build_assembly_name (const char *name, const char *version, const char *culture,
        }
 
        if (key) {
-               gboolean is_ecma;
+               gboolean is_ecma = FALSE;
+               gchar *pkey = NULL;
                if (strcmp (key, "null") == 0 || !parse_public_key (key, &pkey, &is_ecma)) {
                        mono_assembly_name_free (aname);
                        return FALSE;
                }
 
                if (is_ecma) {
-                       if (save_public_key)
-                               aname->public_key = (guint8*)pkey;
-                       else
-                               g_free (pkey);
+                       g_assert (pkey == NULL);
+                       aname->public_key = NULL;
                        g_strlcpy ((gchar*)aname->public_key_token, "b77a5c561934e089", MONO_PUBLIC_KEY_TOKEN_LENGTH);
                        return TRUE;
                }
index e642be65561d391bdbf0bccef417f6394b531c56..a93f04a867d0512a93bd8aafd49c19656eea153c 100644 (file)
@@ -44,7 +44,7 @@
 #define THREAD_LOCAL_ALLOC 1
 #include "private/pthread_support.h"
 
-#if defined(PLATFORM_MACOSX) && defined(HAVE_PTHREAD_GET_STACKADDR_NP)
+#if defined(HOST_DARWIN) && defined(HAVE_PTHREAD_GET_STACKADDR_NP)
 void *pthread_get_stackaddr_np(pthread_t);
 #endif
 
@@ -179,7 +179,7 @@ mono_gc_base_init (void)
        default_push_other_roots = GC_push_other_roots;
        GC_push_other_roots = mono_push_other_roots;
 
-#if !defined(PLATFORM_ANDROID)
+#if !defined(HOST_ANDROID)
        /* If GC_no_dls is set to true, GC_find_limit is not called. This causes a seg fault on Android. */
        GC_no_dls = TRUE;
 #endif
@@ -458,7 +458,7 @@ on_gc_notification (GC_EventType event)
                if (mono_perfcounters)
                        mono_perfcounters->gc_collections0++;
 #endif
-               gc_stats.major_gc_count ++;
+               InterlockedIncrement (&gc_stats.major_gc_count);
                gc_start_time = mono_100ns_ticks ();
                break;
 
@@ -482,7 +482,7 @@ on_gc_notification (GC_EventType event)
                        mono_perfcounters->gc_gen0size = heap_size;
                }
 #endif
-               gc_stats.major_gc_time += mono_100ns_ticks () - gc_start_time;
+               InterlockedAdd64 (&gc_stats.major_gc_time, mono_100ns_ticks () - gc_start_time);
                mono_trace_message (MONO_TRACE_GC, "gc took %" G_GINT64_FORMAT " usecs", (mono_100ns_ticks () - gc_start_time) / 10);
                break;
        default:
index 909e950c6c934c642b55c47aa2eeb21800faa031..67f360e975e3bd44ed0f3f8213170d341c133904 100644 (file)
@@ -756,39 +756,31 @@ typedef struct {
 #define MONO_SIZEOF_REMOTE_CLASS (sizeof (MonoRemoteClass) - MONO_ZERO_LEN_ARRAY * SIZEOF_VOID_P)
 
 typedef struct {
-       guint64 new_object_count;
-       gsize initialized_class_count;
-       gsize generic_vtable_count;
-       size_t used_class_count;
-       size_t method_count;
-       size_t class_vtable_size;
-       size_t class_static_data_size;
-       size_t generic_instance_count;
-       gsize generic_class_count;
-       gsize inflated_method_count;
-       size_t inflated_method_count_2;
-       gsize inflated_type_count;
-       size_t generics_metadata_size;
-       size_t delegate_creations;
-       size_t imt_tables_size;
-       size_t imt_number_of_tables;
-       size_t imt_number_of_methods;
-       size_t imt_used_slots;
-       size_t imt_slots_with_collisions;
-       size_t imt_max_collisions_in_slot;
-       size_t imt_method_count_when_max_collisions;
-       size_t imt_trampolines_size;
-       size_t jit_info_table_insert_count;
-       size_t jit_info_table_remove_count;
-       size_t jit_info_table_lookup_count;
-       size_t generics_sharable_methods;
-       size_t generics_unsharable_methods;
-       size_t generics_shared_methods;
-       size_t gsharedvt_methods;
-       size_t minor_gc_count;
-       size_t major_gc_count;
-       size_t minor_gc_time_usecs;
-       size_t major_gc_time_usecs;
+       gint32 initialized_class_count;
+       gint32 generic_vtable_count;
+       gint32 used_class_count;
+       gint32 method_count;
+       gint32 class_vtable_size;
+       gint32 class_static_data_size;
+       gint32 generic_class_count;
+       gint32 inflated_method_count;
+       gint32 inflated_type_count;
+       gint32 delegate_creations;
+       gint32 imt_tables_size;
+       gint32 imt_number_of_tables;
+       gint32 imt_number_of_methods;
+       gint32 imt_used_slots;
+       gint32 imt_slots_with_collisions;
+       gint32 imt_max_collisions_in_slot;
+       gint32 imt_method_count_when_max_collisions;
+       gint32 imt_trampolines_size;
+       gint32 jit_info_table_insert_count;
+       gint32 jit_info_table_remove_count;
+       gint32 jit_info_table_lookup_count;
+       gint32 generics_sharable_methods;
+       gint32 generics_unsharable_methods;
+       gint32 generics_shared_methods;
+       gint32 gsharedvt_methods;
        gboolean enabled;
 } MonoStats;
 
index 2e3dcd73856b25bb5cf6694a8b4594c04ca3ce1d..6492fd6ca214bf232689e806cb2daac25bc5afb4 100644 (file)
@@ -865,7 +865,7 @@ mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type,
                }
        }
 
-       UnlockedIncrementSize (&mono_stats.inflated_type_count);
+       UnlockedIncrement (&mono_stats.inflated_type_count);
        return inflated;
 }
 
@@ -929,7 +929,7 @@ mono_class_inflate_generic_type_no_copy (MonoImage *image, MonoType *type, MonoG
        if (!inflated)
                return type;
 
-       UnlockedIncrementSize (&mono_stats.inflated_type_count);
+       UnlockedIncrement (&mono_stats.inflated_type_count);
        return inflated;
 }
 
@@ -1090,7 +1090,7 @@ mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *k
                return (MonoMethod*)cached;
        }
 
-       UnlockedIncrementSize (&mono_stats.inflated_method_count);
+       UnlockedIncrement (&mono_stats.inflated_method_count);
 
        inflated_methods_size += sizeof (MonoMethodInflated);
 
@@ -3569,7 +3569,7 @@ mono_class_setup_vtable_full (MonoClass *klass, GList *in_setup)
                return;
        }
 
-       UnlockedIncrementSize (&mono_stats.generic_vtable_count);
+       UnlockedIncrement (&mono_stats.generic_vtable_count);
        in_setup = g_list_prepend (in_setup, klass);
 
        if (mono_class_is_ginst (klass)) {
@@ -4903,7 +4903,7 @@ mono_class_init (MonoClass *klass)
                        goto leave;
        }
 
-       UnlockedIncrementSize (&mono_stats.initialized_class_count);
+       UnlockedIncrement (&mono_stats.initialized_class_count);
 
        if (mono_class_is_ginst (klass) && !mono_class_get_generic_class (klass)->is_dynamic) {
                MonoClass *gklass = mono_class_get_generic_class (klass)->container_class;
@@ -5048,10 +5048,10 @@ mono_class_init (MonoClass *klass)
                return !mono_class_has_failure (klass);
        }
 
-       UnlockedIncrementSize (&mono_stats.initialized_class_count);
+       UnlockedIncrement (&mono_stats.initialized_class_count);
 
        if (mono_class_is_ginst (klass) && !mono_class_get_generic_class (klass)->is_dynamic)
-               UnlockedIncrementSize (&mono_stats.generic_class_count);
+               UnlockedIncrement (&mono_stats.generic_class_count);
 
        if (mono_class_is_ginst (klass) || image_is_dynamic (klass->image) || !klass->type_token || (has_cached_info && !cached_info.has_nested_classes))
                klass->nested_classes_inited = TRUE;
index df6a4fed185b5e3bcf438a30654406119eb2f417..5fe0b9a77b528c38b85da04777331fb1bd842261 100644 (file)
@@ -838,6 +838,13 @@ mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret,
        char *inst_desc = NULL;
        MonoError error;
 
+       const char *class_method_separator = ":";
+       const char *method_sig_space = " ";
+       if (format == MONO_TYPE_NAME_FORMAT_REFLECTION) {
+               class_method_separator = ".";
+               method_sig_space = "";
+       }
+
        if (format == MONO_TYPE_NAME_FORMAT_IL)
                klass_desc = mono_type_full_name (&method->klass->byval_arg);
        else
@@ -897,16 +904,19 @@ mono_method_get_name_full (MonoMethod *method, gboolean signature, gboolean ret,
                        strcpy (wrapper, "");
                if (ret && sig) {
                        char *ret_str = mono_type_full_name (sig->ret);
-                       res = g_strdup_printf ("%s%s %s:%s%s (%s)", wrapper, ret_str, klass_desc,
-                                                                  method->name, inst_desc ? inst_desc : "", tmpsig);
+                       res = g_strdup_printf ("%s%s %s%s%s%s%s(%s)", wrapper, ret_str, klass_desc,
+                                                                  class_method_separator,
+                                                                  method->name, inst_desc ? inst_desc : "", method_sig_space, tmpsig);
                        g_free (ret_str);
                } else {
-                       res = g_strdup_printf ("%s%s:%s%s (%s)", wrapper, klass_desc,
-                                                                  method->name, inst_desc ? inst_desc : "", tmpsig);
+                       res = g_strdup_printf ("%s%s%s%s%s%s(%s)", wrapper, klass_desc,
+                                                                  class_method_separator,
+                                                                  method->name, inst_desc ? inst_desc : "", method_sig_space, tmpsig);
                }
                g_free (tmpsig);
        } else {
-               res = g_strdup_printf ("%s%s:%s%s", wrapper, klass_desc,
+               res = g_strdup_printf ("%s%s%s%s%s", wrapper, klass_desc,
+                                                          class_method_separator,
                                                           method->name, inst_desc ? inst_desc : "");
        }
 
@@ -931,6 +941,17 @@ mono_method_get_full_name (MonoMethod *method)
        return mono_method_get_name_full (method, TRUE, TRUE, MONO_TYPE_NAME_FORMAT_IL);
 }
 
+/**
+ * mono_method_get_reflection_name:
+ *
+ * Returns the name of the method, including signature, using the same formating as reflection.
+ */
+char *
+mono_method_get_reflection_name (MonoMethod *method)
+{
+       return mono_method_get_name_full (method, TRUE, FALSE, MONO_TYPE_NAME_FORMAT_REFLECTION);
+}
+
 static const char*
 print_name_space (MonoClass *klass)
 {
index fa4aa39706002ea1ee7c635ed1aeac7202fba581..a67de5523f0b9813c88ad45e867f9e16d6bbc9ab 100644 (file)
@@ -43,6 +43,7 @@ MONO_API MonoMethod*     mono_method_desc_search_in_class (MonoMethodDesc *desc,
 MONO_API MonoMethod*     mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image);
 
 MONO_API char*           mono_method_full_name (MonoMethod *method, mono_bool signature);
+MONO_API char*           mono_method_get_reflection_name (MonoMethod *method);
 
 MONO_API char*           mono_field_full_name (MonoClassField *field);
 
index 467a9239d19ce288cf071fb35f080a4de963a54d..4b1a56f4c0feeba858aca442d9e0ab057d7b1130 100644 (file)
@@ -933,11 +933,11 @@ mono_gc_init (void)
        mono_coop_mutex_init_recursive (&finalizer_mutex);
        mono_coop_mutex_init_recursive (&reference_queue_mutex);
 
-       mono_counters_register ("Minor GC collections", MONO_COUNTER_GC | MONO_COUNTER_UINT, &gc_stats.minor_gc_count);
-       mono_counters_register ("Major GC collections", MONO_COUNTER_GC | MONO_COUNTER_UINT, &gc_stats.major_gc_count);
+       mono_counters_register ("Minor GC collections", MONO_COUNTER_GC | MONO_COUNTER_INT, &gc_stats.minor_gc_count);
+       mono_counters_register ("Major GC collections", MONO_COUNTER_GC | MONO_COUNTER_INT, &gc_stats.major_gc_count);
        mono_counters_register ("Minor GC time", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &gc_stats.minor_gc_time);
-       mono_counters_register ("Major GC time", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &gc_stats.major_gc_time);
-       mono_counters_register ("Major GC time concurrent", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &gc_stats.major_gc_time_concurrent);
+       mono_counters_register ("Major GC time", MONO_COUNTER_GC | MONO_COUNTER_LONG | MONO_COUNTER_TIME, &gc_stats.major_gc_time);
+       mono_counters_register ("Major GC time concurrent", MONO_COUNTER_GC | MONO_COUNTER_LONG | MONO_COUNTER_TIME, &gc_stats.major_gc_time_concurrent);
 
        mono_gc_base_init ();
 
index 2cc591e8c8c7d361548c07e02d52aa0763e43e36..ecd050a26e0469e29f4d71f42dce3c75fe5bdc7f 100644 (file)
@@ -447,7 +447,7 @@ HANDLES(ICALL(NDNS_1, "GetHostByAddr_internal(string,string&,string[]&,string[]&
 HANDLES(ICALL(NDNS_2, "GetHostByName_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByName_internal))
 HANDLES(ICALL(NDNS_3, "GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal))
 
-#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
+#if defined(HOST_DARWIN) || defined(HOST_BSD)
 ICALL_TYPE(MAC_IFACE_PROPS, "System.Net.NetworkInformation.MacOsIPInterfaceProperties", MAC_IFACE_PROPS_1)
 ICALL(MAC_IFACE_PROPS_1, "ParseRouteInfo_internal", ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal)
 #endif
index 76ccc633aacb095aa61157cda783347c1df962ee..2e485848486d0363b3b7d0929849fcec894b26b6 100644 (file)
@@ -1256,7 +1256,13 @@ ves_icall_System_Object_GetType (MonoObjectHandle obj, MonoError *error)
        if (mono_class_is_transparent_proxy (klass)) {
                MonoTransparentProxyHandle proxy_obj = MONO_HANDLE_CAST (MonoTransparentProxy, obj);
                MonoRemoteClass *remote_class = MONO_HANDLE_GETVAL (proxy_obj, remote_class);
-               MonoType *proxy_type = &remote_class->proxy_class->byval_arg;
+               /* If it's a transparent proxy for an interface, return the
+                * interface type, not the unhelpful proxy_class class (which
+                * is just MarshalByRefObject). */
+               MonoType *proxy_type =
+                       mono_remote_class_is_interface_proxy (remote_class) ?
+                       &remote_class->interfaces[0]->byval_arg :
+                       &remote_class->proxy_class->byval_arg;
                return mono_type_get_object_handle (domain, proxy_type, error);
        } else
 #endif
index 827ba841c3d5ec61836f1d62c42356499427340b..3f4dd249c6d1b189901384dd07c1e8868ac638e9 100644 (file)
@@ -1113,6 +1113,11 @@ Right now the list of nugets are the ones that provide the assemblies in $ignore
 
 This is to be removed once a proper fix is shipped through nuget.
 
+Please keep this in sync with mcs/tools/xbuild/data/deniedAssembliesList.txt
+If any assemblies are added/removed, then this should be regenerated with:
+
+  $ mono tools/nuget-hash-extractor/nuget-hash-extractor.exe nugets guids_for_msbuild > mcs/tools/xbuild/data/deniedAssembliesList.txt
+
 */
 
 typedef enum {
@@ -1121,8 +1126,7 @@ typedef enum {
        SYS_IO_COMPRESSION = 2, //System.IO.Compression
        SYS_NET_HTTP = 3, //System.Net.Http
        SYS_TEXT_ENC_CODEPAGES = 4, //System.Text.Encoding.CodePages
-       SYS_REF_DISP_PROXY = 5, //System.Reflection.DispatchProxy
-       SYS_THREADING_OVERLAPPED = 6, //System.Threading.Overlapped
+       SYS_THREADING_OVERLAPPED = 5, //System.Threading.Overlapped
 } IgnoredAssemblyNames;
 
 typedef struct {
@@ -1142,7 +1146,6 @@ const char *ignored_assemblies_file_names[] = {
        "System.IO.Compression.dll",
        "System.Net.Http.dll",
        "System.Text.Encoding.CodePages.dll",
-       "System.Reflection.DispatchProxy.dll",
        "System.Threading.Overlapped.dll"
 };
 
@@ -1159,13 +1162,11 @@ static const IgnoredAssembly ignored_assemblies [] = {
        IGNORED_ASSEMBLY (0x8437178B, SYS_NET_HTTP, "C0E04D9C-70CF-48A6-A179-FBFD8CE69FD0", "4.3.0 net46"),
        IGNORED_ASSEMBLY (0xFAFDA422, SYS_NET_HTTP, "817F01C3-4011-477D-890A-98232B85553D", "4.3.1 net46"),
        IGNORED_ASSEMBLY (0x472FA630, SYS_NET_HTTP, "09D4A140-061C-4884-9B63-22067E841931", "4.3.2 net46"),
-       IGNORED_ASSEMBLY (0x4A15555E, SYS_REF_DISP_PROXY, "E40AFEB4-CABE-4124-8412-B46AB79C92FD", "4.0.0 net46"),
-       IGNORED_ASSEMBLY (0xD20D9783, SYS_REF_DISP_PROXY, "2A69F0AD-B86B-40F2-8E4C-5B671E47479F", "4.0.1 netstandard1.3"),
-       IGNORED_ASSEMBLY (0xA33A7E68, SYS_REF_DISP_PROXY, "D4E8D2DB-BD65-4168-99EA-D2C1BDEBF9CC", "4.3.0 netstandard1.3"),
        IGNORED_ASSEMBLY (0x46A4A1C5, SYS_RT_INTEROP_RUNTIME_INFO, "F13660F8-9D0D-419F-BA4E-315693DD26EA", "4.0.0 net45"),
        IGNORED_ASSEMBLY (0xD07383BB, SYS_RT_INTEROP_RUNTIME_INFO, "DD91439F-3167-478E-BD2C-BF9C036A1395", "4.3.0 net45"),
        IGNORED_ASSEMBLY (0x911D9EC3, SYS_TEXT_ENC_CODEPAGES, "C142254F-DEB5-46A7-AE43-6F10320D1D1F", "4.0.1 net46"),
        IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES, "FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),
+       IGNORED_ASSEMBLY (0xF6D18A2E, SYS_TEXT_ENC_CODEPAGES, "F5CCCBEC-E1AD-4DBB-9B44-9B42C86B94B8", "4.4.0 net461"),
        IGNORED_ASSEMBLY (0xAA21986B, SYS_THREADING_OVERLAPPED, "9F5D4F09-787A-458A-BA08-553AA71470F1", "4.0.0 net46"),
        IGNORED_ASSEMBLY (0x7D927C2A, SYS_THREADING_OVERLAPPED, "FCBD003B-2BB4-4940-BAEF-63AF520C2336", "4.0.1 net46"),
        IGNORED_ASSEMBLY (0x6FE03EE2, SYS_THREADING_OVERLAPPED, "87697E71-D192-4F0B-BAD4-02BBC7793005", "4.3.0 net46")
@@ -1178,7 +1179,6 @@ const char *ignored_assemblies_names[] = {
        "System.IO.Compression",
        "System.Net.Http",
        "System.Text.Encoding.CodePages",
-       "System.Reflection.DispatchProxy",
        "System.Threading.Overlapped"
 };
 
@@ -1194,13 +1194,11 @@ static const IgnoredAssemblyVersion ignored_assembly_versions [] = {
        IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 0, 1),
        IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 0),
        IGNORED_ASM_VER (SYS_NET_HTTP, 4, 1, 1, 1),
-       IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 0, 0),
-       IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 1, 0),
-       IGNORED_ASM_VER (SYS_REF_DISP_PROXY, 4, 0, 2, 0),
        IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 0, 0),
        IGNORED_ASM_VER (SYS_RT_INTEROP_RUNTIME_INFO, 4, 0, 1, 0),
        IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 1, 0),
        IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 0, 2, 0),
+       IGNORED_ASM_VER (SYS_TEXT_ENC_CODEPAGES, 4, 1, 0, 0),
        IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 0, 0),
        IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 1, 0),
        IGNORED_ASM_VER (SYS_THREADING_OVERLAPPED, 4, 0, 2, 0),
index 085fb67a3759d029dbfafca2fab6a61251d04c7c..3344679e81236c9bdd9138a45f00d58d7986ad26 100644 (file)
@@ -28,6 +28,7 @@
 #include <mono/utils/mono-tls.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/unlocked.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/domain-internals.h>
@@ -263,7 +264,7 @@ mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_
        MonoJitInfo *ji, *module_ji;
        MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
 
-       ++mono_stats.jit_info_table_lookup_count;
+       UnlockedIncrement (&mono_stats.jit_info_table_lookup_count);
 
        /* First we have to get the domain's jit_info_table.  This is
           complicated by the fact that a writer might substitute a
@@ -654,7 +655,7 @@ mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji)
 
        mono_domain_lock (domain);
 
-       ++mono_stats.jit_info_table_insert_count;
+       UnlockedIncrement (&mono_stats.jit_info_table_insert_count);
 
        jit_info_table_add (domain, &domain->jit_info_table, ji);
 
@@ -738,7 +739,7 @@ mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji)
        mono_domain_lock (domain);
        table = domain->jit_info_table;
 
-       ++mono_stats.jit_info_table_remove_count;
+       UnlockedIncrement (&mono_stats.jit_info_table_remove_count);
 
        jit_info_table_remove (table, ji);
 
index 61a6f94146588d2f175fdc83e83e760e0ea9c805..0cd4e07b7395ddb3c828a725489412460d6fea31 100644 (file)
@@ -1143,7 +1143,7 @@ static MonoDl *internal_module;
 static gboolean
 is_absolute_path (const char *path)
 {
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
        if (!strncmp (path, "@executable_path/", 17) || !strncmp (path, "@loader_path/", 13) ||
            !strncmp (path, "@rpath/", 7))
            return TRUE;
@@ -1658,7 +1658,7 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass,
                methods_size += sizeof (MonoMethod);
        }
 
-       mono_stats.method_count ++;
+       InterlockedIncrement (&mono_stats.method_count);
 
        result->slot = -1;
        result->klass = klass;
index cc682a9eed2d39d600efd3c48176e52dec8881f0..63358bf3baff17983faf525d7d4c0fe1c9d5b5b1 100644 (file)
@@ -12366,7 +12366,7 @@ ftnptr_eh_callback_default (guint32 gchandle)
 
        mono_gchandle_free (gchandle);
 
-       mono_raise_exception (exc);
+       mono_reraise_exception (exc);
 }
 
 /*
index 3d86989db70470a6bfbcb0c3011ab85f73a31193..be5af1083f22281a64b8431eb7505a6437dc1584 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "mempool.h"
 #include "mempool-internals.h"
-#include "utils/mono-compiler.h"
+#include "utils/unlocked.h"
 
 /*
  * MonoMemPool is for fast allocation of memory. We free
@@ -78,7 +78,7 @@ struct _MonoMemPool {
        } d;
 };
 
-static long total_bytes_allocated = 0;
+static gint64 total_bytes_allocated = 0;
 
 /**
  * mono_mempool_new:
@@ -93,19 +93,9 @@ mono_mempool_new (void)
 
 /**
  * mono_mempool_new_size:
- *
- *   clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
- *     * mono_mempool_alloc
- *     * mono_mempool_new_size
- *     * mono_mempool_destroy
- *   while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
- *   the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
- *   https://bugzilla.xamarin.com/show_bug.cgi?id=57936
- *
  * \param initial_size the amount of memory to initially reserve for the memory pool.
  * \returns a new memory pool with a specific initial memory reservation.
  */
-MONO_NO_SANITIZE_THREAD
 MonoMemPool *
 mono_mempool_new_size (int initial_size)
 {
@@ -125,32 +115,22 @@ mono_mempool_new_size (int initial_size)
        pool->pos = (guint8*)pool + SIZEOF_MEM_POOL; // Start after header
        pool->end = (guint8*)pool + initial_size;    // End at end of allocated space 
        pool->d.allocated = pool->size = initial_size;
-       total_bytes_allocated += initial_size;
+       UnlockedAdd64 (&total_bytes_allocated, initial_size);
        return pool;
 }
 
 /**
  * mono_mempool_destroy:
- *
- *   clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
- *     * mono_mempool_alloc
- *     * mono_mempool_new_size
- *     * mono_mempool_destroy
- *   while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
- *   the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
- *   https://bugzilla.xamarin.com/show_bug.cgi?id=57936
- *
  * \param pool the memory pool to destroy
  *
  * Free all memory associated with this pool.
  */
-MONO_NO_SANITIZE_THREAD
 void
 mono_mempool_destroy (MonoMemPool *pool)
 {
        MonoMemPool *p, *n;
 
-       total_bytes_allocated -= pool->d.allocated;
+       UnlockedSubtract64 (&total_bytes_allocated, pool->d.allocated);
 
        p = pool;
        while (p) {
@@ -272,15 +252,6 @@ get_next_size (MonoMemPool *pool, int size)
 
 /**
  * mono_mempool_alloc:
- *
- *   clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
- *     * mono_mempool_alloc
- *     * mono_mempool_new_size
- *     * mono_mempool_destroy
- *   while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
- *   the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
- *   https://bugzilla.xamarin.com/show_bug.cgi?id=57936
- *
  * \param pool the memory pool to use
  * \param size size of the memory block
  *
@@ -288,7 +259,6 @@ get_next_size (MonoMemPool *pool, int size)
  *
  * \returns the address of a newly allocated memory block.
  */
-MONO_NO_SANITIZE_THREAD
 gpointer
 mono_mempool_alloc (MonoMemPool *pool, guint size)
 {
@@ -318,7 +288,7 @@ mono_mempool_alloc (MonoMemPool *pool, guint size)
                        np->size = new_size;
                        pool->next = np;
                        pool->d.allocated += new_size;
-                       total_bytes_allocated += new_size;
+                       UnlockedAdd64 (&total_bytes_allocated, new_size);
 
                        rval = (guint8*)np + SIZEOF_MEM_POOL;
                } else {
@@ -332,7 +302,7 @@ mono_mempool_alloc (MonoMemPool *pool, guint size)
                        pool->pos = (guint8*)np + SIZEOF_MEM_POOL;
                        pool->end = (guint8*)np + new_size;
                        pool->d.allocated += new_size;
-                       total_bytes_allocated += new_size;
+                       UnlockedAdd64 (&total_bytes_allocated, new_size);
 
                        rval = pool->pos;
                        pool->pos += size;
@@ -462,5 +432,5 @@ mono_mempool_get_allocated (MonoMemPool *pool)
 long
 mono_mempool_get_bytes_allocated (void)
 {
-       return total_bytes_allocated;
+       return UnlockedRead64 (&total_bytes_allocated);
 }
index 119da77be3d79ea710a4b18889cf41eabe3d1dec..c4c81eaf32c8995a477773a8b60397189d5cf4d1 100644 (file)
@@ -36,11 +36,11 @@ dump_arch (void)
 static int
 dump_os (void)
 {
-#if defined (PLATFORM_WIN32)
+#if defined (HOST_WIN32)
        g_print ("#ifdef TARGET_WIN32\n");
-#elif defined (PLATFORM_ANDROID)
+#elif defined (HOST_ANDROID)
        g_print ("#ifdef TARGET_ANDROID\n");
-#elif defined (PLATFORM_MACOSX)
+#elif defined (HOST_DARWIN)
        g_print ("#ifdef TARGET_OSX\n");
 #elif defined (PLATFORM_IOS)
        g_print ("#ifdef TARGET_IOS\n");
index f31983c303f3a9b039fb44ba970437689a3a7114..666c158332e59a59b3bcbb48ea0328defc7a9dd5 100644 (file)
@@ -1894,8 +1894,13 @@ handle_enum:
                FAIL (ctx, g_strdup_printf ("CustomAttribute: Invalid boxed object type %x", sub_type));
        }
 
-
        case MONO_TYPE_CLASS:
+               if (klass && klass->enumtype) {
+                       klass = klass->element_class;
+                       type = klass->byval_arg.type;
+                       goto handle_enum;
+               }
+
                if (klass != mono_defaults.systemtype_class)
                        FAIL (ctx, g_strdup_printf ("CustomAttribute: Invalid class parameter type %s:%s ",klass->name_space, klass->name));
                *_ptr = ptr;
@@ -2413,7 +2418,7 @@ verify_typedef_table (VerifyContext *ctx)
        for (i = 0; i < table->rows; ++i) {
                mono_metadata_decode_row (table, i, data, MONO_TYPEDEF_SIZE);
                if (data [MONO_TYPEDEF_FLAGS] & INVALID_TYPEDEF_FLAG_BITS)
-                       ADD_ERROR (ctx, g_strdup_printf ("Invalid typedef row %d invalid flags field 0x%08x", i, data [MONO_TYPEDEF_FLAGS]));
+                       ADD_ERROR (ctx, g_strdup_printf ("Invalid typedef row %d invalid flags field 0x%08x rejected bits: 0x%08x", i, data [MONO_TYPEDEF_FLAGS], data [MONO_TYPEDEF_FLAGS] & INVALID_TYPEDEF_FLAG_BITS));
 
                if ((data [MONO_TYPEDEF_FLAGS] & TYPE_ATTRIBUTE_LAYOUT_MASK) == 0x18)
                        ADD_ERROR (ctx, g_strdup_printf ("Invalid typedef row %d invalid class layout 0x18", i));
@@ -2962,8 +2967,11 @@ verify_cattr_table_full (VerifyContext *ctx)
                /*This can't fail since this is checked in is_valid_cattr_blob*/
                g_assert (decode_signature_header (ctx, data [MONO_CUSTOM_ATTR_VALUE], &size, &ptr));
 
-               if (!is_valid_cattr_content (ctx, ctor, ptr, size))
-                       ADD_ERROR (ctx, g_strdup_printf ("Invalid CustomAttribute content row %d Value field 0x%08x", i, data [MONO_CUSTOM_ATTR_VALUE]));
+               if (!is_valid_cattr_content (ctx, ctor, ptr, size)) {
+                       char *ctor_name =  mono_method_full_name (ctor, TRUE);
+                       ADD_ERROR (ctx, g_strdup_printf ("Invalid CustomAttribute content row %d Value field 0x%08x ctor: %s", i, data [MONO_CUSTOM_ATTR_VALUE], ctor_name));
+                       g_free (ctor_name);
+               }
        }
 }
 
@@ -3750,6 +3758,54 @@ verify_typeref_table_global_constraints (VerifyContext *ctx)
        g_hash_table_destroy (unique_types);
 }
 
+typedef struct {
+       guint32 klass;
+       guint32 method_declaration;
+} MethodImplUniqueId;
+
+static guint
+methodimpl_hash (gconstpointer _key)
+{
+       const MethodImplUniqueId *key = (const MethodImplUniqueId *)_key;
+       return key->klass ^ key->method_declaration;
+}
+
+static gboolean
+methodimpl_equals (gconstpointer _a, gconstpointer _b)
+{
+       const MethodImplUniqueId *a = (const MethodImplUniqueId *)_a;
+       const MethodImplUniqueId *b = (const MethodImplUniqueId *)_b;
+       return a->klass == b->klass && a->method_declaration == b->method_declaration;
+}
+
+static void
+verify_methodimpl_table_global_constraints (VerifyContext *ctx)
+{
+       int i;
+       guint32 data [MONO_METHODIMPL_SIZE];
+       MonoTableInfo *table = &ctx->image->tables [MONO_TABLE_METHODIMPL];
+       GHashTable *unique_impls = g_hash_table_new_full (&methodimpl_hash, &methodimpl_equals, g_free, NULL);
+
+       for (i = 0; i < table->rows; ++i) {
+               MethodImplUniqueId *impl = g_new (MethodImplUniqueId, 1);
+               mono_metadata_decode_row (table, i, data, MONO_METHODIMPL_SIZE);
+
+               impl->klass = data [MONO_METHODIMPL_CLASS];
+               impl->method_declaration = data [MONO_METHODIMPL_DECLARATION];
+
+               if (g_hash_table_lookup (unique_impls, impl)) {
+                       ADD_ERROR_NO_RETURN (ctx, g_strdup_printf ("MethodImpl table row %d has duplicate for tuple (0x%x, 0x%x)", impl->klass, impl->method_declaration));
+                       g_hash_table_destroy (unique_impls);
+                       g_free (impl);
+                       return;
+               }
+               g_hash_table_insert (unique_impls, impl, GUINT_TO_POINTER (1));
+       }
+
+       g_hash_table_destroy (unique_impls);
+}
+
+
 static void
 verify_tables_data_global_constraints (VerifyContext *ctx)
 {
@@ -3761,6 +3817,7 @@ verify_tables_data_global_constraints_full (VerifyContext *ctx)
 {
        verify_typeref_table (ctx);
        verify_typeref_table_global_constraints (ctx);
+       verify_methodimpl_table_global_constraints (ctx);
 }
 
 static void
index b41dbf4e8186eff36f490f2a4d4844b032c73295..0ba52ce0b7359d578d94ed18991d85ce6a2cbb15 100644 (file)
@@ -1641,6 +1641,16 @@ mono_metadata_init (void)
 {
        int i;
 
+       /* We guard against double initialization due to how pedump in verification mode works.
+       Until runtime initialization is properly factored to work with what it needs we need workarounds like this.
+       FIXME: https://bugzilla.xamarin.com/show_bug.cgi?id=58793
+       */
+       static gboolean inited;
+
+       if (inited)
+               return;
+       inited = TRUE;
+
        type_cache = g_hash_table_new (mono_type_hash, mono_type_equal);
 
        for (i = 0; i < NBUILTIN_TYPES (); ++i)
index 7ee7fe2e23a7fabca3e238729679264827738188..c3840963bd92b69c156c1cc999630e3fa97c2402 100644 (file)
@@ -42,6 +42,8 @@
 #define CONFIG_OS "hpux"
 #elif defined(__HAIKU__)
 #define CONFIG_OS "haiku"
+#elif defined (TARGET_WASM)
+#define CONFIG_OS "wasm"
 #else
 #warning Unknown operating system
 #define CONFIG_OS "unknownOS"
@@ -82,6 +84,9 @@
 #elif defined(mips) || defined(__mips) || defined(_mips)
 #define CONFIG_CPU "mips"
 #define CONFIG_WORDSIZE "32"
+#elif defined(TARGET_WASM)
+#define CONFIG_CPU "wasm"
+#define CONFIG_WORDSIZE "32"
 #else
 #error Unknown CPU
 #define CONFIG_CPU "unknownCPU"
index a35bd562743f5c334749fb692aaba4a99d149e64..c90af3cdfe33b8b89d1ce23f65a14e42046ff636 100644 (file)
@@ -7,9 +7,9 @@
  *   Ben Woods (woodsb02@gmail.com)
  */
 
-#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
-
 #include <config.h>
+
+#if defined(HOST_DARWIN) || defined(HOST_BSD)
 #include <sys/socket.h>
 #include <net/if.h>
 #include <net/if_dl.h>
@@ -134,4 +134,4 @@ in_addr_t gateway_from_rtm(struct rt_msghdr *rtm)
        return 0;
 }
 
-#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */
+#endif /* #if defined(HOST_DARWIN) || defined(HOST_BSD) */
index 5086fbd3ef05f2d31dbd450cf44a2014ca016e77..03d179d71c6874255c6ee9a1f64976f4089af9d2 100644 (file)
@@ -5,7 +5,7 @@
 #ifndef __MONO_ROUTE_H__
 #define __MONO_ROUTE_H__
 
-#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
+#if defined(HOST_DARWIN) || defined(HOST_BSD)
 
 #include <sys/socket.h>
 
@@ -23,5 +23,5 @@ in_addr_t gateway_from_rtm (struct rt_msghdr *rtm);
 /* Category icalls */
 extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list);
 
-#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */
+#endif /* #if defined(HOST_DARWIN) || defined(HOST_BSD) */
 #endif /* __MONO_ROUTE_H__ */
index 6167cb0ca127efd96d6f3cfb66ca2d3e058c4e8f..07aaee6830005ba3f2df4103838289d2820a772a 100644 (file)
@@ -643,6 +643,7 @@ typedef struct {
        gboolean (*mono_current_thread_has_handle_block_guard) (void);
        gboolean (*mono_above_abort_threshold) (void);
        void (*mono_clear_abort_threshold) (void);
+       void (*mono_reraise_exception) (MonoException *ex);
 } MonoRuntimeExceptionHandlingCallbacks;
 
 MONO_COLD void mono_set_pending_exception (MonoException *exc);
@@ -1571,6 +1572,9 @@ ves_icall_array_new_specific (MonoVTable *vtable, uintptr_t n);
 MonoRemoteClass*
 mono_remote_class (MonoDomain *domain, MonoStringHandle class_name, MonoClass *proxy_class, MonoError *error);
 
+gboolean
+mono_remote_class_is_interface_proxy (MonoRemoteClass *remote_class);
+
 MonoObject *
 mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg, MonoObject **exc, MonoArray **out_args, MonoError *error);
 
index dcf37e0015cf646f710a3c277e705980b25b6793..233f9528ed90ca0a34cdf5377989320fe0dc61c7 100644 (file)
@@ -178,7 +178,16 @@ DECL_OFFSET(MonoDelegateTrampInfo, method_ptr)
 // Architecture-specific offsets
 // -----------------------------
 
-#if defined(TARGET_X86)
+#if defined(TARGET_WASM)
+DECL_OFFSET(MonoContext, wasm_ip)
+DECL_OFFSET(MonoContext, wasm_bp)
+DECL_OFFSET(MonoContext, wasm_sp)
+DECL_OFFSET(MonoContext, llvm_exc_reg)
+
+DECL_OFFSET(MonoLMF, method)
+DECL_OFFSET(MonoLMF, lmf_addr)
+
+#elif defined(TARGET_X86)
 DECL_OFFSET(MonoContext, eax)
 DECL_OFFSET(MonoContext, ebx)
 DECL_OFFSET(MonoContext, ecx)
index 45f261697b6243399776adc012750e770b441291..4ebc52bca25fdeb0a644e042c1b45fa89af53009 100644 (file)
@@ -49,6 +49,7 @@
 #include <mono/utils/mono-threads-coop.h>
 #include "cominterop.h"
 #include <mono/utils/w32api.h>
+#include <mono/utils/unlocked.h>
 
 static void
 get_default_field_value (MonoDomain* domain, MonoClassField *field, void *value, MonoError *error);
@@ -1217,12 +1218,12 @@ add_imt_builder_entry (MonoImtBuilderEntry **imt_builder, MonoMethod *method, gu
        if (imt_builder [imt_slot] != NULL) {
                entry->children = imt_builder [imt_slot]->children + 1;
                if (entry->children == 1) {
-                       mono_stats.imt_slots_with_collisions++;
+                       UnlockedIncrement (&mono_stats.imt_slots_with_collisions);
                        *imt_collisions_bitmap |= (1 << imt_slot);
                }
        } else {
                entry->children = 0;
-               mono_stats.imt_used_slots++;
+               UnlockedIncrement (&mono_stats.imt_used_slots);
        }
        imt_builder [imt_slot] = entry;
 #if DEBUG_IMT
@@ -1477,17 +1478,17 @@ build_imt_slots (MonoClass *klass, MonoVTable *vt, MonoDomain *domain, gpointer*
 
                if (imt_builder [i] != NULL) {
                        int methods_in_slot = imt_builder [i]->children + 1;
-                       if (methods_in_slot > mono_stats.imt_max_collisions_in_slot) {
-                               mono_stats.imt_max_collisions_in_slot = methods_in_slot;
+                       if (methods_in_slot > UnlockedRead (&mono_stats.imt_max_collisions_in_slot)) {
+                               UnlockedWrite (&mono_stats.imt_max_collisions_in_slot, methods_in_slot);
                                record_method_count_for_max_collisions = TRUE;
                        }
                        method_count += methods_in_slot;
                }
        }
        
-       mono_stats.imt_number_of_methods += method_count;
+       UnlockedAdd (&mono_stats.imt_number_of_methods, method_count);
        if (record_method_count_for_max_collisions) {
-               mono_stats.imt_method_count_when_max_collisions = method_count;
+               UnlockedWrite (&mono_stats.imt_method_count_when_max_collisions, method_count);
        }
        
        for (i = 0; i < MONO_IMT_SIZE; i++) {
@@ -1900,16 +1901,16 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
 
        if (klass->interface_offsets_count) {
                imt_table_bytes = sizeof (gpointer) * (MONO_IMT_SIZE);
-               mono_stats.imt_number_of_tables++;
-               mono_stats.imt_tables_size += imt_table_bytes;
+               UnlockedIncrement (&mono_stats.imt_number_of_tables);
+               UnlockedAdd (&mono_stats.imt_tables_size, imt_table_bytes);
        } else {
                imt_table_bytes = 0;
        }
 
        vtable_size = imt_table_bytes + MONO_SIZEOF_VTABLE + vtable_slots * sizeof (gpointer);
 
-       mono_stats.used_class_count++;
-       mono_stats.class_vtable_size += vtable_size;
+       UnlockedIncrement (&mono_stats.used_class_count);
+       UnlockedAdd (&mono_stats.class_vtable_size, vtable_size);
 
        interface_offsets = alloc_vtable (domain, vtable_size, imt_table_bytes);
        vt = (MonoVTable*) ((char*)interface_offsets + imt_table_bytes);
@@ -1961,7 +1962,7 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
                        vt->vtable [klass->vtable_size] = mono_domain_alloc0 (domain, class_size);
                }
                vt->has_static_fields = TRUE;
-               mono_stats.class_static_data_size += class_size;
+               UnlockedAdd (&mono_stats.class_static_data_size, class_size);
        }
 
        iter = NULL;
@@ -2155,6 +2156,22 @@ mono_class_create_runtime_vtable (MonoDomain *domain, MonoClass *klass, MonoErro
 }
 
 #ifndef DISABLE_REMOTING
+/**
+ * mono_remote_class_is_interface_proxy:
+ * \param remote_class
+ *
+ * Returns TRUE if the given remote class is a proxying an interface (as
+ * opposed to a class deriving from MarshalByRefObject).
+ */
+gboolean
+mono_remote_class_is_interface_proxy (MonoRemoteClass *remote_class)
+{
+       /* This if condition is taking advantage of how mono_remote_class ()
+        * works: if that code changes, this needs to change too. */
+       return (remote_class->interface_count >= 1 &&
+               remote_class->proxy_class == mono_defaults.marshalbyrefobject_class);
+}
+
 /**
  * mono_class_proxy_vtable:
  * \param domain the application domain
@@ -2232,12 +2249,12 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
        }
 
        imt_table_bytes = sizeof (gpointer) * MONO_IMT_SIZE;
-       mono_stats.imt_number_of_tables++;
-       mono_stats.imt_tables_size += imt_table_bytes;
+       UnlockedIncrement (&mono_stats.imt_number_of_tables);
+       UnlockedAdd (&mono_stats.imt_tables_size, imt_table_bytes);
 
        vtsize = imt_table_bytes + MONO_SIZEOF_VTABLE + klass->vtable_size * sizeof (gpointer);
 
-       mono_stats.class_vtable_size += vtsize + extra_interface_vtsize;
+       UnlockedAdd (&mono_stats.class_vtable_size, vtsize + extra_interface_vtsize);
 
        interface_offsets = alloc_vtable (domain, vtsize + extra_interface_vtsize, imt_table_bytes);
        pvt = (MonoVTable*) ((char*)interface_offsets + imt_table_bytes);
@@ -2249,6 +2266,18 @@ mono_class_proxy_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, Mono
        /* we need to keep the GC descriptor for a transparent proxy or we confuse the precise GC */
        pvt->gc_descr = mono_defaults.transparent_proxy_class->gc_descr;
 
+       if (mono_remote_class_is_interface_proxy (remote_class)) {
+               /* If it's a transparent proxy for an interface, set the
+                * MonoVTable:type to the interface type, not the placeholder
+                * MarshalByRefObject class.  This is used when mini JITs calls
+                * to Object.GetType ()
+                */
+               MonoType *itf_proxy_type = &remote_class->interfaces[0]->byval_arg;
+               pvt->type = mono_type_get_object_checked (domain, itf_proxy_type, error);
+               if (!is_ok (error))
+                       goto failure;
+       }
+
        /* initialize vtable */
        mono_class_setup_vtable (klass);
        for (i = 0; i < klass->vtable_size; ++i) {
@@ -2516,6 +2545,12 @@ mono_remote_class (MonoDomain *domain, MonoStringHandle class_name, MonoClass *p
        key = mp_key;
 
        if (mono_class_is_interface (proxy_class)) {
+               /* If we need to proxy an interface, we use this stylized
+                * representation (interface_count >= 1, proxy_class is
+                * MarshalByRefObject).  The code in
+                * mono_remote_class_is_interface_proxy () depends on being
+                * able to detect that we're doing this, so if this
+                * representation changes, change GetType, too. */
                rc = (MonoRemoteClass *)mono_domain_alloc (domain, MONO_SIZEOF_REMOTE_CLASS + sizeof(MonoClass*));
                rc->interface_count = 1;
                rc->interfaces [0] = proxy_class;
@@ -7288,6 +7323,25 @@ mono_raise_exception (MonoException *ex)
        eh_callbacks.mono_raise_exception (ex);
 }
 
+/**
+ * mono_raise_exception:
+ * \param ex exception object
+ * Signal the runtime that the exception \p ex has been raised in unmanaged code.
+ */
+void
+mono_reraise_exception (MonoException *ex)
+{
+       MONO_REQ_GC_UNSAFE_MODE;
+
+       /*
+        * NOTE: Do NOT annotate this function with G_GNUC_NORETURN, since
+        * that will cause gcc to omit the function epilog, causing problems when
+        * the JIT tries to walk the stack, since the return address on the stack
+        * will point into the next function in the executable, not this one.
+        */
+       eh_callbacks.mono_reraise_exception (ex);
+}
+
 void
 mono_raise_exception_with_context (MonoException *ex, MonoContext *ctx) 
 {
@@ -7813,7 +7867,7 @@ mono_delegate_ctor_with_method (MonoObjectHandle this_obj, MonoObjectHandle targ
        if (method)
                MONO_HANDLE_SETVAL (delegate, method, MonoMethod*, method);
 
-       mono_stats.delegate_creations++;
+       UnlockedIncrement (&mono_stats.delegate_creations);
 
 #ifndef DISABLE_REMOTING
        if (!MONO_HANDLE_IS_NULL (target) && mono_class_is_transparent_proxy (mono_handle_class (target))) {
index c439fda2e8073f981d0736b0e82e9ac50a52b931..0454f86d454a501ea62a1d29daa509819885e275 100644 (file)
@@ -243,6 +243,9 @@ mono_monitor_exit            (MonoObject *obj);
 MONO_API void
 mono_raise_exception       (MonoException *ex);
 
+MONO_API void
+mono_reraise_exception     (MonoException *ex);
+
 MONO_RT_EXTERNAL_ONLY
 MONO_API void
 mono_runtime_object_init    (MonoObject *this_obj);
index 93bdb1fb5c7e8de8bc64d1af3de5846da6786b27..8604d9321a0aa47e35178ebb6013b3e48fb5cd6c 100644 (file)
@@ -2799,18 +2799,19 @@ mono_gc_add_memory_pressure (gint64 value)
  */
 
 void
-sgen_client_degraded_allocation (size_t size)
+sgen_client_degraded_allocation (void)
 {
-       static int last_major_gc_warned = -1;
-       static int num_degraded = 0;
+       static gint32 last_major_gc_warned = -1;
+       static gint32 num_degraded = 0;
 
-       if (last_major_gc_warned < (int)gc_stats.major_gc_count) {
-               ++num_degraded;
-               if (num_degraded == 1 || num_degraded == 3)
+       gint32 major_gc_count = InterlockedRead (&gc_stats.major_gc_count);
+       if (InterlockedRead (&last_major_gc_warned) < major_gc_count) {
+               gint32 num = InterlockedIncrement (&num_degraded);
+               if (num == 1 || num == 3)
                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "Warning: Degraded allocation.  Consider increasing nursery-size if the warning persists.");
-               else if (num_degraded == 10)
+               else if (num == 10)
                        mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "Warning: Repeated degraded allocation.  Consider increasing nursery-size.");
-               last_major_gc_warned = gc_stats.major_gc_count;
+               InterlockedWrite (&last_major_gc_warned, major_gc_count);
        }
 }
 
index 90cb93e050c3f4391107e77567d1c3667d00c5b7..e3aa51b4cf5f8673bf6f9980648eb88d48084698 100644 (file)
@@ -127,6 +127,8 @@ enum {
 
 #define TYPE_ATTRIBUTE_IMPORT                0x00001000
 #define TYPE_ATTRIBUTE_SERIALIZABLE          0x00002000
+#define TYPE_ATTRIBUTE_WINDOWS_RUNTIME       0x00004000
+
 
 #define TYPE_ATTRIBUTE_STRING_FORMAT_MASK    0x00030000
 #define TYPE_ATTRIBUTE_ANSI_CLASS            0x00000000
index 87256b511873d728e0124cb92180551a3b3dc15b..b0ff471fe4ee92f0f8fda2cd3ea423c2f701c807 100644 (file)
@@ -286,7 +286,7 @@ mono_threadpool_worker_init (MonoThreadPoolWorkerCallback callback)
 
        worker.limit_worker_min = threads_count;
 
-#if defined (PLATFORM_ANDROID) || defined (HOST_IOS)
+#if defined (HOST_ANDROID) || defined (HOST_IOS)
        worker.limit_worker_max = CLAMP (threads_count * 100, MIN (threads_count, 200), MAX (threads_count, 200));
 #else
        worker.limit_worker_max = threads_count * 100;
@@ -387,7 +387,7 @@ worker_park (void)
        gboolean timeout = FALSE;
        gboolean interrupted = FALSE;
 
-       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker parking",
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking",
                GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
 
        mono_coop_mutex_lock (&worker.parked_threads_lock);
@@ -431,7 +431,7 @@ done:
 
        mono_coop_mutex_unlock (&worker.parked_threads_lock);
 
-       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
                GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())), timeout ? "yes" : "no", interrupted ? "yes" : "no");
 
        return timeout;
@@ -464,7 +464,7 @@ worker_thread (gpointer unused)
        MonoInternalThread *thread;
        ThreadPoolWorkerCounter counter;
 
-       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker starting",
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker starting",
                GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
 
        if (!mono_refcount_tryinc (&worker))
@@ -502,7 +502,7 @@ worker_thread (gpointer unused)
                counter._.working --;
        });
 
-       mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing",
+       mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker finishing",
                GUINT_TO_POINTER (MONO_NATIVE_THREAD_ID_TO_UINT (mono_native_thread_id_get ())));
 
        mono_refcount_dec (&worker);
index 97efd32c1cdac04e48296a738ee74cf9a8098346..8eb4fe5f24e474e619a68bb2e17a00cb1f52f043 100644 (file)
 #include <objbase.h>
 #endif
 
-#if defined(PLATFORM_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64)
+#if defined(HOST_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64)
 #define USE_TKILL_ON_ANDROID 1
 #endif
 
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
 #include <errno.h>
 
 #ifdef USE_TKILL_ON_ANDROID
@@ -462,8 +462,8 @@ typedef union {
 #define SPECIAL_STATIC_OFFSET_TYPE_THREAD 0
 #define SPECIAL_STATIC_OFFSET_TYPE_CONTEXT 1
 
-#define MAKE_SPECIAL_STATIC_OFFSET(index, offset, type) \
-       ((SpecialStaticOffset) { .fields = { (index), (offset), (type) } }.raw)
+#define MAKE_SPECIAL_STATIC_OFFSET(idx, off, ty) \
+       ((SpecialStaticOffset) { .fields = { .index = (idx), .offset = (off), .type = (ty) } }.raw)
 #define ACCESS_SPECIAL_STATIC_OFFSET(x,f) \
        (((SpecialStaticOffset *) &(x))->fields.f)
 
index 3677d9e4b7000a26e269aebc690e625978725d77..fa38edffc031b768aa6ef39b683e33ace1408eae 100644 (file)
@@ -3227,6 +3227,8 @@ do_invoke_method (VerifyContext *ctx, int method_token, gboolean virtual_)
                        value = stack_pop_safe (ctx);
                        if (IS_STRICT_MODE (ctx) && (value->stype & THIS_POINTER_MASK) != THIS_POINTER_MASK)
                                CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Invalid 'this ptr' argument for constructor at 0x%04x", ctx->ip_offset));
+                       if (!(value->stype & UNINIT_THIS_MASK))
+                               CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Calling the base constructor on an initialized this pointer at 0x%04x", ctx->ip_offset));
                } else {
                        value = stack_pop (ctx);
                }
index ed7920e69f9346ecadb255199f81b9529eee6fc2..162ef4434e6829119b29a2b82ed5d11936788dc5 100644 (file)
@@ -8,7 +8,6 @@
 #include <mono/metadata/metadata.h>
 #include <mono/metadata/image.h>
 #include <mono/metadata/loader.h>
-#include <mono/metadata/class-internals.h>
 #include <glib.h> /* GSList dep */
 
 MONO_BEGIN_DECLS
@@ -53,7 +52,7 @@ typedef struct {
 
 typedef struct {
        MonoVerifyInfo info;
-       MonoExceptionType exception_type : 8; /*should be one of MONO_EXCEPTION_* */
+       int8_t exception_type; /*should be one of MONO_EXCEPTION_* */
 } MonoVerifyInfoExtended;
 
 
index df41473dfe896fbc0e1fbe07c82f20b00a360eeb..d25681126a4be13107c66a64fc52b24bb9dadcca 100644 (file)
@@ -66,6 +66,9 @@ mono_w32error_unix_to_win32 (guint32 error)
        case EINTR: return ERROR_IO_PENDING; /* best match I could find */
        case EPIPE: return ERROR_WRITE_FAULT;
        case ELOOP: return ERROR_CANT_RESOLVE_FILENAME;
+#ifdef ENODEV
+       case ENODEV: return ERROR_DEV_NOT_EXIST;
+#endif
 
        default:
                g_error ("%s: unknown error (%d) \"%s\"", __FILE__, error, g_strerror (error));
index bd42451469ffb2bdc511c9262e2b6c0312f4cf81..e66f920b42addefdad06be3418b8107774730673 100644 (file)
@@ -31,6 +31,7 @@
 #define ERROR_LOCK_VIOLATION       33
 #define ERROR_HANDLE_DISK_FULL     39
 #define ERROR_NOT_SUPPORTED        50
+#define ERROR_DEV_NOT_EXIST        55
 #define ERROR_FILE_EXISTS          80
 #define ERROR_CANNOT_MAKE          82
 #define ERROR_INVALID_PARAMETER    87
index a3ac2264f6da7addaebd76807e466a43745ce499..65547135b3b11adacd09a7ed750c426e93d78f43 100644 (file)
@@ -1195,7 +1195,7 @@ static guint32 file_seek(FileHandle *filehandle, gint32 movedistance,
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: moving fd %d by %" G_GINT64_FORMAT " bytes from %d", __func__, ((MonoFDHandle*) filehandle)->fd, offset, whence);
 
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        /* bionic doesn't support -D_FILE_OFFSET_BITS=64 */
        MONO_ENTER_GC_SAFE;
        newpos=lseek64(((MonoFDHandle*) filehandle)->fd, offset, whence);
@@ -4245,7 +4245,7 @@ typedef struct {
 } _wapi_drive_type;
 
 static _wapi_drive_type _wapi_drive_types[] = {
-#if PLATFORM_MACOSX
+#if HOST_DARWIN
        { DRIVE_REMOTE, "afp" },
        { DRIVE_REMOTE, "autofs" },
        { DRIVE_CDROM, "cddafs" },
@@ -4402,7 +4402,7 @@ static guint32 _wapi_get_drive_type(const gchar* fstype)
 }
 #endif
 
-#if defined (PLATFORM_MACOSX) || defined (__linux__)
+#if defined (HOST_DARWIN) || defined (__linux__)
 static guint32
 GetDriveTypeFromPath (const gchar *utf8_root_path_name)
 {
@@ -4414,7 +4414,7 @@ GetDriveTypeFromPath (const gchar *utf8_root_path_name)
        MONO_EXIT_GC_SAFE;
        if (res == -1)
                return DRIVE_UNKNOWN;
-#if PLATFORM_MACOSX
+#if HOST_DARWIN
        return _wapi_get_drive_type (buf.f_fstypename);
 #else
        return _wapi_get_drive_type (buf.f_type);
@@ -4507,11 +4507,11 @@ mono_w32file_get_drive_type(const gunichar2 *root_path_name)
        return (drive_type);
 }
 
-#if defined (PLATFORM_MACOSX) || defined (__linux__) || defined(PLATFORM_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
+#if defined (HOST_DARWIN) || defined (__linux__) || defined(HOST_BSD) || defined(__FreeBSD_kernel__) || defined(__HAIKU__)
 static gchar*
 get_fstypename (gchar *utfpath)
 {
-#if defined (PLATFORM_MACOSX) || defined (__linux__)
+#if defined (HOST_DARWIN) || defined (__linux__)
        struct statfs stat;
 #if __linux__
        _wapi_drive_type *current;
@@ -4522,7 +4522,7 @@ get_fstypename (gchar *utfpath)
        MONO_EXIT_GC_SAFE;
        if (statfs_res == -1)
                return NULL;
-#if PLATFORM_MACOSX
+#if HOST_DARWIN
        return g_strdup (stat.f_fstypename);
 #else
        current = &_wapi_drive_types[0];
index 3bc10906b8cf008b7dfeac476ec147708730d5e7..91e1d218ad5dc60905cc1442759788ed2713e30d 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <unistd.h>
 
-#ifdef PLATFORM_SOLARIS
+#ifdef HOST_SOLARIS
 /* procfs.h cannot be included if this define is set, but it seems to work fine if it is undefined */
 #if _FILE_OFFSET_BITS == 64
 #undef _FILE_OFFSET_BITS
@@ -41,7 +41,7 @@ mono_w32process_get_name (pid_t pid)
        gchar buf[256];
        gchar *ret = NULL;
 
-#if defined(PLATFORM_SOLARIS)
+#if defined(HOST_SOLARIS)
        filename = g_strdup_printf ("/proc/%d/psinfo", pid);
        if ((fp = fopen (filename, "r")) != NULL) {
                struct psinfo info;
index 5db6bd49446d42a422be8c427b0ee3068c07eb0f..ecab6c5ae125393c9c41171672fe3ffe64df1cce 100644 (file)
@@ -12,7 +12,7 @@
  * FOR EXCLUSIVE USE BY w32process-unix.c
  */
 
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
 #define USE_OSX_BACKEND
 #elif (defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(HAVE_LINK_H)
 #define USE_BSD_BACKEND
index 280c3a9213d0a90fd528961ca4c14d878eba7d76..8a55844b6e08884068d95bb62ce3a0037eed9578 100644 (file)
@@ -544,7 +544,7 @@ process_is_alive (pid_t pid)
 {
 #if defined(HOST_WATCHOS)
        return TRUE; // TODO: Rewrite using sysctl
-#elif defined(PLATFORM_MACOSX) || defined(__OpenBSD__) || defined(__FreeBSD__)
+#elif defined(HOST_DARWIN) || defined(__OpenBSD__) || defined(__FreeBSD__)
        if (pid == 0)
                return FALSE;
        if (kill (pid, 0) == 0)
@@ -2105,7 +2105,7 @@ ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoW32ProcessStar
                        goto done;
                }
 
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
                handler = g_strdup ("/usr/bin/open");
 #else
                /*
index bc1b5ccd818d44f09bfa459f94156f2aaaae2b22..74e1fcceab52e3ea2d17a1eb0bdee60f2d4c98fc 100644 (file)
@@ -1373,7 +1373,7 @@ mono_w32socket_get_available (SOCKET sock, guint64 *amount)
                return SOCKET_ERROR;
        }
 
-#if defined (PLATFORM_MACOSX)
+#if defined (HOST_DARWIN)
        // ioctl (socket, FIONREAD, XXX) returns the size of
        // the UDP header as well on Darwin.
        //
index 848f75d3fe1544ed2dedbd459355d7c30a563280..e33441b6d35a4218910e493ff5375292217e37b7 100755 (executable)
@@ -87,7 +87,7 @@ monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
 if HOST_WIN32
 libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
 else
-if PLATFORM_ANDROID
+if HOST_ANDROID
 libmonoldflags= -avoid-version $(monoldflags)
 else
 libmonoldflags=$(monoldflags) -version-info 1:0:0
@@ -168,7 +168,7 @@ if LOADED_LLVM
 lib_LTLIBRARIES += libmono-llvm.la
 libmono_llvm_la_SOURCES = mini-llvm.c mini-llvm-cpp.cpp llvm-jit.cpp
 libmono_llvm_la_LIBADD = $(GLIB_LIBS) $(LLVM_LIBS) $(LLVM_LDFLAGS)
-if PLATFORM_DARWIN
+if HOST_DARWIN
 libmono_llvm_la_LDFLAGS=-Wl,-undefined -Wl,suppress -Wl,-flat_namespace
 else
 libmono_llvm_la_LIBADD += $(top_builddir)/mono/mini/libmonoboehm-$(API_VER).la $(boehm_libs)
@@ -609,12 +609,12 @@ os_sources = $(windows_sources)
 monobin_platform_ldflags=
 endif
 
-if PLATFORM_SIGPOSIX
+if HOST_SIGPOSIX
 os_sources = $(posix_sources)
 monobin_platform_ldflags=
 endif
 
-if PLATFORM_DARWIN
+if HOST_DARWIN
 os_sources = $(darwin_sources) $(posix_sources)
 #monobin_platform_ldflags=-sectcreate __TEXT __info_plist $(top_srcdir)/mono/mini/Info.plist -framework CoreFoundation -framework Foundation
 monobin_platform_ldflags=-framework CoreFoundation -framework Foundation
index 01c2fe883933e8922c563f7ba899d0e22c4de338..d6c2486414f3278b960ec7480d50137ea27e7cee 100644 (file)
@@ -5800,7 +5800,7 @@ mono_aot_is_pagefault (void *ptr)
 void
 mono_aot_handle_pagefault (void *ptr)
 {
-#ifndef PLATFORM_WIN32
+#ifndef HOST_WIN32
        guint8* start = (guint8*)ROUND_DOWN (((gssize)ptr), mono_pagesize ());
        int res;
 
index b625580c1fe4c347fedcc46b41f7473db085cc88..016423072bd74048996f6c85363e28b6c52d90d7 100644 (file)
@@ -47,7 +47,7 @@
 #include <ws2tcpip.h>
 #endif
 
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
 #include <linux/in.h>
 #include <linux/tcp.h>
 #include <sys/endian.h>
@@ -607,7 +607,7 @@ typedef struct ReplyPacket {
 
 #define DEBUG(level,s) do { if (G_UNLIKELY ((level) <= log_level)) { s; fflush (log_file); } } while (0)
 
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
 #define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { g_print (__VA_ARGS__); } } while (0)
 #else
 #define DEBUG_PRINTF(level, ...) do { if (G_UNLIKELY ((level) <= log_level)) { fprintf (log_file, __VA_ARGS__); fflush (log_file); } } while (0)
@@ -5941,7 +5941,7 @@ mono_debugger_agent_debug_log_is_enabled (void)
        return agent_config.enabled;
 }
 
-#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID)
+#if defined(HOST_ANDROID) || defined(TARGET_ANDROID)
 void
 mono_debugger_agent_unhandled_exception (MonoException *exc)
 {
index 41fe82ea98ede8d2e3cca7dae2d7163358c875b4..3267f82740e77dc4428855ec8a8d75b64e978e78 100644 (file)
@@ -28,7 +28,7 @@ debugger_agent_breakpoint_from_context (MonoContext *ctx);
 void
 mono_debugger_agent_free_domain_info (MonoDomain *domain);
 
-#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID)
+#if defined(HOST_ANDROID) || defined(TARGET_ANDROID)
 void
 mono_debugger_agent_unhandled_exception (MonoException *exc);
 #endif
index f8d485292afd01fb50f4b7e7fc14c08e261704bd..297179bf86cabaa76b112108bb7a977d9c65db1f 100644 (file)
@@ -1420,7 +1420,7 @@ mono_jit_parse_options (int argc, char * argv[])
                        opt->break_on_exc = TRUE;
                } else if (strcmp (argv [i], "--stats") == 0) {
                        mono_counters_enable (-1);
-                       mono_stats.enabled = TRUE;
+                       InterlockedWriteBool (&mono_stats.enabled, TRUE);
                        mono_jit_stats.enabled = TRUE;
                } else if (strcmp (argv [i], "--break") == 0) {
                        if (i+1 >= argc){
@@ -1767,7 +1767,7 @@ mono_main (int argc, char* argv[])
                        mono_print_vtable = TRUE;
                } else if (strcmp (argv [i], "--stats") == 0) {
                        mono_counters_enable (-1);
-                       mono_stats.enabled = TRUE;
+                       InterlockedWriteBool (&mono_stats.enabled, TRUE);
                        mono_jit_stats.enabled = TRUE;
 #ifndef DISABLE_AOT
                } else if (strcmp (argv [i], "--aot") == 0) {
index dac83f0bb43552682bc79bb91749fc6bc39f3940..de769c87fff8d41d8af7e149f6173e65d1568f8a 100644 (file)
@@ -15,9 +15,9 @@
 #include <string.h>
 
 #ifndef MONO_CROSS_COMPILE
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
 #include <asm/sigcontext.h>
-#endif  /* def PLATFORM_ANDROID */
+#endif  /* def HOST_ANDROID */
 #endif
 
 #ifdef HAVE_UCONTEXT_H
index 09c94309b70353d96b20dcc7a676d4e01665515b..b2d92af2cc6213805c3944fc37174168b125aa99 100644 (file)
@@ -2896,4 +2896,131 @@ END:
     IL_0018:  ldloc.0
        ret
        }
+
+    .field  private static  int32 byte_val
+    .field  private static  int32 short_val
+
+    .method static int32 widen_arguments (unsigned int8 a, int8 b, int16 c, unsigned int16 d) cil managed noinlining
+    {
+               .maxstack 4
+               ldsfld int32 Tests::byte_val
+               starg.s 0
+               ldarg.0
+               ldc.i4 128 //0x80
+               beq L_0
+
+               ldc.i4.1
+               ret
+L_0:
+               ldsfld int32 Tests::byte_val
+               starg.s 1
+               ldarg.1
+               ldc.i4 -128 //-0x80
+               beq L_1
+
+               ldc.i4.2
+               ret
+
+L_1:
+               ldsfld int32 Tests::short_val
+               starg.s 2
+               ldarg.2
+               ldc.i4 -32768 //-0x8000
+               beq L_2
+
+               ldc.i4.3
+               ret
+
+L_2:
+               ldsfld int32 Tests::short_val
+               starg.s 3
+               ldarg.3
+               ldc.i4 32768 //0x8000
+               beq L_3
+
+               ldc.i4.4
+               ret
+
+L_3:
+               ldc.i4.0
+               ret
+    }
+
+       .method public static int32 test_0_implicit_widen_of_argument_stores () cil managed
+       {
+               .maxstack 5
+               /*
+               This test verifies that storing an I4 value from the evail stack into a local variable triggers proper widening.
+               The values are picked so storing them have different values depending on the sign'ness of the local variable.
+               */
+               ldc.i4 0x180
+               stsfld int32 Tests::byte_val
+               ldc.i4 0x18000
+               stsfld int32 Tests::short_val
+
+               ldc.i4.0
+               ldc.i4.0
+               ldc.i4.0
+               ldc.i4.0
+               call int32 Tests::widen_arguments (unsigned int8 a, int8 b, int16 c, unsigned int16 d)
+               ret
+       }
+
+    .method public static int32 test_0_implicit_widen_of_local_stores () cil managed
+    {
+               .maxstack 4
+               .locals init (
+                       unsigned int8   V_0,
+                       int8    V_1,
+                       int16   V_2,
+                       unsigned int16  V_3)
+
+               /*
+               This test verifies that storing an I4 value from the evail stack into a local variable triggers proper widening.
+               The values are picked so storing them have different values depending on the sign'ness of the local variable.
+               */
+               ldc.i4 0x180
+               stsfld int32 Tests::byte_val
+               ldc.i4 0x18000
+               stsfld int32 Tests::short_val
+
+               ldsfld int32 Tests::byte_val
+               stloc.0
+               ldloc.0
+               ldc.i4 128 //0x80
+               beq L_0
+
+               ldc.i4.1
+               ret
+L_0:
+               ldsfld int32 Tests::byte_val
+               stloc.1
+               ldloc.1
+               ldc.i4 -128 //-0x80
+               beq L_1
+
+               ldc.i4.2
+               ret
+L_1:
+               ldsfld int32 Tests::short_val
+               stloc.2
+               ldloc.2
+               ldc.i4 -32768 //-0x8000
+               beq L_2
+
+               ldc.i4.3
+               ret
+L_2:
+               ldsfld int32 Tests::short_val
+               stloc.3
+               ldloc.3
+               ldc.i4 32768 //0x8000
+               beq L_3
+
+               ldc.i4.4
+               ret
+L_3:
+               ldc.i4.0
+               ret
+    }
 }
index 2b66be22f182a3b0b0289899dd46a4e02fe054bb..255ab56533a5fed56be61fd7ae1476aad2d3726c 100644 (file)
@@ -1911,8 +1911,8 @@ mono_interruption_checkpoint_from_trampoline (void)
 void
 mono_throw_method_access (MonoMethod *caller, MonoMethod *callee)
 {
-       char *caller_name = mono_method_full_name (caller, 1);
-       char *callee_name = mono_method_full_name (callee, 1);
+       char *caller_name = mono_method_get_reflection_name (caller);
+       char *callee_name = mono_method_get_reflection_name (callee);
        MonoError error;
 
        error_init (&error);
index 104df90ad0f418f99f369a69af2442111fe7006e..442ec3c0a5c9005eab5da957140d8c8851189215 100644 (file)
@@ -3972,6 +3972,8 @@ handle_delegate_ctor (MonoCompile *cfg, MonoClass *klass, MonoInst *target, Mono
        /* Set target field */
        /* Optimize away setting of NULL target */
        if (!MONO_INS_IS_PCONST_NULL (target)) {
+               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, target->dreg, 0);
+               MONO_EMIT_NEW_COND_EXC (cfg, EQ, "NullReferenceException");
                MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, obj->dreg, MONO_STRUCT_OFFSET (MonoDelegate, target), target->dreg);
                if (cfg->gen_write_barriers) {
                        dreg = alloc_preg (cfg);
@@ -6607,10 +6609,78 @@ set_exception_type_from_invalid_il (MonoCompile *cfg, MonoMethod *method, unsign
        cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
 }
 
+static guint32
+mono_type_to_stloc_coerce (MonoType *type)
+{
+       if (type->byref)
+               return 0;
+
+       type = mini_get_underlying_type (type);
+handle_enum:
+       switch (type->type) {
+       case MONO_TYPE_I1:
+               return OP_ICONV_TO_I1;
+       case MONO_TYPE_U1:
+               return OP_ICONV_TO_U1;
+       case MONO_TYPE_I2:
+               return OP_ICONV_TO_I2;
+       case MONO_TYPE_U2:
+               return OP_ICONV_TO_U2;
+       case MONO_TYPE_I4:
+       case MONO_TYPE_U4:
+       case MONO_TYPE_I:
+       case MONO_TYPE_U:
+       case MONO_TYPE_PTR:
+       case MONO_TYPE_FNPTR:
+       case MONO_TYPE_CLASS:
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_OBJECT:
+       case MONO_TYPE_SZARRAY:
+       case MONO_TYPE_ARRAY:
+       case MONO_TYPE_I8:
+       case MONO_TYPE_U8:
+       case MONO_TYPE_R4:
+       case MONO_TYPE_R8:
+       case MONO_TYPE_TYPEDBYREF:
+       case MONO_TYPE_GENERICINST:
+               return 0;
+       case MONO_TYPE_VALUETYPE:
+               if (type->data.klass->enumtype) {
+                       type = mono_class_enum_basetype (type->data.klass);
+                       goto handle_enum;
+               }
+               return 0;
+       case MONO_TYPE_VAR:
+       case MONO_TYPE_MVAR: //TODO I believe we don't need to handle gsharedvt as there won't be match and, for example, u1 is not covariant to u32
+               return 0;
+       default:
+               g_error ("unknown type 0x%02x in mono_type_to_stloc_coerce", type->type);
+       }
+       return -1;
+}
+
 static void
 emit_stloc_ir (MonoCompile *cfg, MonoInst **sp, MonoMethodHeader *header, int n)
 {
        MonoInst *ins;
+       guint32 coerce_op = mono_type_to_stloc_coerce (header->locals [n]);
+
+       if (coerce_op) {
+               if (cfg->cbb->last_ins == sp [0] && sp [0]->opcode == coerce_op) {
+                       if (cfg->verbose_level > 2)
+                               printf ("Found existing coercing is enough for stloc\n");
+               } else {
+                       MONO_INST_NEW (cfg, ins, coerce_op);
+                       ins->dreg = alloc_ireg (cfg);
+                       ins->sreg1 = sp [0]->dreg;
+                       ins->type = STACK_I4;
+                       ins->klass = mono_class_from_mono_type (header->locals [n]);
+                       MONO_ADD_INS (cfg->cbb, ins);
+                       *sp = mono_decompose_opcode (cfg, ins);
+               }
+       }
+
+
        guint32 opcode = mono_type_to_regmove (cfg, header->locals [n]);
        if ((opcode == OP_MOVE) && cfg->cbb->last_ins == sp [0]  &&
                        ((sp [0]->opcode == OP_ICONST) || (sp [0]->opcode == OP_I8CONST))) {
@@ -6625,6 +6695,30 @@ emit_stloc_ir (MonoCompile *cfg, MonoInst **sp, MonoMethodHeader *header, int n)
        }
 }
 
+static void
+emit_starg_ir (MonoCompile *cfg, MonoInst **sp, int n)
+{
+       MonoInst *ins;
+       guint32 coerce_op = mono_type_to_stloc_coerce (cfg->arg_types [n]);
+
+       if (coerce_op) {
+               if (cfg->cbb->last_ins == sp [0] && sp [0]->opcode == coerce_op) {
+                       if (cfg->verbose_level > 2)
+                               printf ("Found existing coercing is enough for starg\n");
+               } else {
+                       MONO_INST_NEW (cfg, ins, coerce_op);
+                       ins->dreg = alloc_ireg (cfg);
+                       ins->sreg1 = sp [0]->dreg;
+                       ins->type = STACK_I4;
+                       ins->klass = mono_class_from_mono_type (cfg->arg_types [n]);
+                       MONO_ADD_INS (cfg->cbb, ins);
+                       *sp = mono_decompose_opcode (cfg, ins);
+               }
+       }
+
+       EMIT_NEW_ARGSTORE (cfg, ins, n, *sp);
+}
+
 /*
  * ldloca inhibits many optimizations so try to get rid of it in common
  * cases.
@@ -7798,7 +7892,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                        CHECK_ARG (n);
                        if (!dont_verify_stloc && target_type_is_incompatible (cfg, param_types [ip [1]], *sp))
                                UNVERIFIED;
-                       EMIT_NEW_ARGSTORE (cfg, ins, n, *sp);
+                       emit_starg_ir (cfg, sp, n);
                        ip += 2;
                        break;
                case CEE_LDLOC_S:
@@ -12284,7 +12378,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                                CHECK_ARG (n);
                                if (!dont_verify_stloc && target_type_is_incompatible (cfg, param_types [n], *sp))
                                        UNVERIFIED;
-                               EMIT_NEW_ARGSTORE (cfg, ins, n, *sp);
+                               emit_starg_ir (cfg, sp, n);
                                ip += 4;
                                break;
                        case CEE_LDLOC:
index 9653be3ff367be99133adc474923eadbd2392eb1..02f056f694d4c81251766673338a371789a0c452 100644 (file)
@@ -37,6 +37,7 @@
 #include <mono/utils/mono-tls.h>
 #include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/unlocked.h>
 
 #include "trace.h"
 #include "ir-emit.h"
@@ -8011,7 +8012,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
        }
 
        if (!fail_tramp)
-               mono_stats.imt_trampolines_size += code - start;
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
        g_assert (code - start <= size);
        g_assert_checked (mono_arch_unwindinfo_validate_size (unwind_ops, MONO_TRAMPOLINE_UNWINDINFO_SIZE(0)));
 
index 98bc4bf7ee5483d0c8cb6b25075ec150b3031e92..1e56345f03d271d03e69ab814e3cfef87f2f2243 100644 (file)
@@ -22,6 +22,7 @@
 #include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-threads-coop.h>
+#include <mono/utils/unlocked.h>
 
 #include "mini-arm.h"
 #include "cpu-arm.h"
@@ -335,7 +336,7 @@ mono_arm_patchable_bl (guint8 *code, int cond)
        return code;
 }
 
-#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(MONO_CROSS_COMPILE)
+#if defined(__ARM_EABI__) && defined(__linux__) && !defined(HOST_ANDROID) && !defined(MONO_CROSS_COMPILE)
 #define HAVE_AEABI_READ_TP 1
 #endif
 
@@ -7046,7 +7047,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
 
        mono_arch_flush_icache ((guint8*)start, size);
        MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL));
-       mono_stats.imt_trampolines_size += code - start;
+       UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
 
        g_assert (DISTANCE (start, code) <= size);
 
index 4f81d7c4c37c42793c25b489ae438325e5c68dd7..9f5c87b6a13194aaf1afee42f1c0ecef32cbf445 100644 (file)
@@ -251,10 +251,13 @@ mono_exceptions_init (void)
 
        cbs.mono_walk_stack_with_state = mono_walk_stack_with_state;
 
-       if (mono_llvm_only)
+       if (mono_llvm_only) {
                cbs.mono_raise_exception = mono_llvm_raise_exception;
-       else
+               cbs.mono_reraise_exception = mono_llvm_reraise_exception;
+       } else {
                cbs.mono_raise_exception = (void (*)(MonoException *))mono_get_throw_exception ();
+               cbs.mono_reraise_exception = (void (*)(MonoException *))mono_get_rethrow_exception ();
+       }
        cbs.mono_raise_exception_with_ctx = mono_raise_exception_with_ctx;
        cbs.mono_exception_walk_trace = mono_exception_walk_trace;
        cbs.mono_install_handler_block_guard = mono_install_handler_block_guard;
@@ -2709,12 +2712,12 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T
                 * glibc fork acquires some locks, so if the crash happened inside malloc/free,
                 * it will deadlock. Call the syscall directly instead.
                 */
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
                /* SYS_fork is defined to be __NR_fork which is not defined in some ndk versions */
                g_assert_not_reached ();
-#elif !defined(PLATFORM_MACOSX) && defined(SYS_fork)
+#elif !defined(HOST_DARWIN) && defined(SYS_fork)
                pid = (pid_t) syscall (SYS_fork);
-#elif defined(PLATFORM_MACOSX) && HAVE_FORK
+#elif defined(HOST_DARWIN) && HAVE_FORK
                pid = (pid_t) fork ();
 #else
                g_assert_not_reached ();
@@ -2742,7 +2745,7 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T
 #endif
  }
 #else
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        /* set DUMPABLE for this process so debuggerd can attach with ptrace(2), see:
         * https://android.googlesource.com/platform/bionic/+/151da681000c07da3c24cd30a3279b1ca017f452/linker/debugger.cpp#206
         * this has changed on later versions of Android.  Also, we don't want to
@@ -2782,7 +2785,7 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T
 
        if (!mono_do_crash_chaining) {
                /*Android abort is a fluke, it doesn't abort, it triggers another segv. */
-#if defined (PLATFORM_ANDROID)
+#if defined (HOST_ANDROID)
                exit (-1);
 #else
                abort ();
@@ -2845,7 +2848,7 @@ mono_print_thread_dump_internal (void *sigctx, MonoContext *start_ctx)
 
        mono_runtime_printf ("%s", text->str);
 
-#if PLATFORM_WIN32 && TARGET_WIN32 && _DEBUG
+#if HOST_WIN32 && TARGET_WIN32 && _DEBUG
        OutputDebugStringA(text->str);
 #endif
 
@@ -3239,6 +3242,12 @@ mono_llvm_raise_exception (MonoException *e)
        mono_llvm_throw_exception ((MonoObject*)e);
 }
 
+void
+mono_llvm_reraise_exception (MonoException *e)
+{
+       mono_llvm_rethrow_exception ((MonoObject*)e);
+}
+
 void
 mono_llvm_throw_corlib_exception (guint32 ex_token_index)
 {
index 3b5463e80fb1c16626c54ad26547553a3fbee682..ae9204f82601f2c041548231acc7fe1c41029b6e 100644 (file)
@@ -42,6 +42,7 @@ get_provenance_func (void)
 #include <mono/metadata/sgen-conf.h>
 #include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-counters.h>
+#include <mono/utils/unlocked.h>
 
 #define SIZEOF_SLOT ((int)sizeof (mgreg_t))
 
@@ -254,27 +255,27 @@ static gboolean precise_frame_limit_inited;
 
 /* Stats */
 typedef struct {
-       int scanned_stacks;
-       int scanned;
-       int scanned_precisely;
-       int scanned_conservatively;
-       int scanned_registers;
-       int scanned_native;
-       int scanned_other;
+       gint32 scanned_stacks;
+       gint32 scanned;
+       gint32 scanned_precisely;
+       gint32 scanned_conservatively;
+       gint32 scanned_registers;
+       gint32 scanned_native;
+       gint32 scanned_other;
        
-       int all_slots;
-       int noref_slots;
-       int ref_slots;
-       int pin_slots;
-
-       int gc_maps_size;
-       int gc_callsites_size;
-       int gc_callsites8_size;
-       int gc_callsites16_size;
-       int gc_callsites32_size;
-       int gc_bitmaps_size;
-       int gc_map_struct_size;
-       int tlsdata_size;
+       gint32 all_slots;
+       gint32 noref_slots;
+       gint32 ref_slots;
+       gint32 pin_slots;
+
+       gint32 gc_maps_size;
+       gint32 gc_callsites_size;
+       gint32 gc_callsites8_size;
+       gint32 gc_callsites16_size;
+       gint32 gc_callsites32_size;
+       gint32 gc_bitmaps_size;
+       gint32 gc_map_struct_size;
+       gint32 tlsdata_size;
 } JITGCStats;
 
 static JITGCStats stats;
@@ -601,7 +602,7 @@ thread_attach_func (void)
        tls = g_new0 (TlsData, 1);
        tls->tid = mono_native_thread_id_get ();
        tls->info = mono_thread_info_current ();
-       stats.tlsdata_size += sizeof (TlsData);
+       UnlockedAdd (&stats.tlsdata_size, sizeof (TlsData));
 
        return tls;
 }
@@ -762,7 +763,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end)
        /* tls == NULL can happen during startup */
        if (mono_thread_internal_current () == NULL || !tls) {
                mono_gc_conservatively_scan_area (stack_start, stack_end);
-               stats.scanned_stacks += stack_end - stack_start;
+               UnlockedAdd (&stats.scanned_stacks, stack_end - stack_start);
                return;
        }
 
@@ -993,7 +994,7 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end)
                        /* This scans the previously skipped frames as well */
                        DEBUG (fprintf (logfile, "\tscan area %p-%p (%d).\n", stack_limit, real_frame_start, (int)(real_frame_start - stack_limit)));
                        mono_gc_conservatively_scan_area (stack_limit, real_frame_start);
-                       stats.scanned_other += real_frame_start - stack_limit;
+                       UnlockedAdd (&stats.scanned_other, real_frame_start - stack_limit);
                }
 
                /* Mark stack slots */
@@ -1119,16 +1120,16 @@ conservative_pass (TlsData *tls, guint8 *stack_start, guint8 *stack_end)
        if (stack_limit < stack_end) {
                DEBUG (fprintf (logfile, "\tscan remaining stack %p-%p (%d).\n", stack_limit, stack_end, (int)(stack_end - stack_limit)));
                mono_gc_conservatively_scan_area (stack_limit, stack_end);
-               stats.scanned_native += stack_end - stack_limit;
+               UnlockedAdd (&stats.scanned_native, stack_end - stack_limit);
        }
 
        DEBUG (fprintf (logfile, "Marked %d bytes, p=%d,c=%d out of %d.\n", scanned, scanned_precisely, scanned_conservatively, (int)(stack_end - stack_start)));
 
-       stats.scanned_stacks += stack_end - stack_start;
-       stats.scanned += scanned;
-       stats.scanned_precisely += scanned_precisely;
-       stats.scanned_conservatively += scanned_conservatively;
-       stats.scanned_registers += scanned_registers;
+       UnlockedAdd (&stats.scanned_stacks, stack_end - stack_start);
+       UnlockedAdd (&stats.scanned, scanned);
+       UnlockedAdd (&stats.scanned_precisely, scanned_precisely);
+       UnlockedAdd (&stats.scanned_conservatively, scanned_conservatively);
+       UnlockedAdd (&stats.scanned_registers, scanned_registers);
 
        //mono_gc_conservatively_scan_area (stack_start, stack_end);
 }
@@ -2423,17 +2424,17 @@ create_map (MonoCompile *cfg)
                        guint8 *offsets = p;
                        for (i = 0; i < ncallsites; ++i)
                                offsets [i] = callsites [i]->pc_offset;
-                       stats.gc_callsites8_size += ncallsites * sizeof (guint8);
+                       UnlockedAdd (&stats.gc_callsites8_size, ncallsites * sizeof (guint8));
                } else if (map->callsite_entry_size == 2) {
                        guint16 *offsets = (guint16*)p;
                        for (i = 0; i < ncallsites; ++i)
                                offsets [i] = callsites [i]->pc_offset;
-                       stats.gc_callsites16_size += ncallsites * sizeof (guint16);
+                       UnlockedAdd (&stats.gc_callsites16_size, ncallsites * sizeof (guint16));
                } else {
                        guint32 *offsets = (guint32*)p;
                        for (i = 0; i < ncallsites; ++i)
                                offsets [i] = callsites [i]->pc_offset;
-                       stats.gc_callsites32_size += ncallsites * sizeof (guint32);
+                       UnlockedAdd (&stats.gc_callsites32_size, ncallsites * sizeof (guint32));
                }
                p += ncallsites * map->callsite_entry_size;
 
@@ -2443,10 +2444,10 @@ create_map (MonoCompile *cfg)
 
                g_assert ((guint8*)p - (guint8*)emap <= alloc_size);
 
-               stats.gc_maps_size += alloc_size;
-               stats.gc_callsites_size += ncallsites * map->callsite_entry_size;
-               stats.gc_bitmaps_size += bitmaps_size;
-               stats.gc_map_struct_size += sizeof (GCEncodedMap) + encoded_size;
+               UnlockedAdd (&stats.gc_maps_size, alloc_size);
+               UnlockedAdd (&stats.gc_callsites_size, ncallsites * map->callsite_entry_size);
+               UnlockedAdd (&stats.gc_bitmaps_size, bitmaps_size);
+               UnlockedAdd (&stats.gc_map_struct_size, sizeof (GCEncodedMap) + encoded_size);
 
                cfg->jit_info->gc_info = emap;
 
@@ -2454,10 +2455,10 @@ create_map (MonoCompile *cfg)
                cfg->gc_map_size = alloc_size;
        }
 
-       stats.all_slots += nslots;
-       stats.ref_slots += ntypes [SLOT_REF];
-       stats.noref_slots += ntypes [SLOT_NOREF];
-       stats.pin_slots += ntypes [SLOT_PIN];
+       UnlockedAdd (&stats.all_slots, nslots);
+       UnlockedAdd (&stats.ref_slots, ntypes [SLOT_REF]);
+       UnlockedAdd (&stats.noref_slots, ntypes [SLOT_NOREF]);
+       UnlockedAdd (&stats.pin_slots, ntypes [SLOT_PIN]);
 }
 
 void
index 9943d883966e1b74b6be10e1b515c3fbe945e0ba..243c83cbe5d9cbbbe8e902d1d27ab72a043269e4 100644 (file)
@@ -390,7 +390,7 @@ info_has_identity (MonoRgctxInfoType info_type)
 /*
  * LOCKING: loader lock
  */
-#if defined(PLATFORM_ANDROID) && defined(TARGET_ARM)
+#if defined(HOST_ANDROID) && defined(TARGET_ARM)
 /* work around for HW bug on Nexus9 when running on armv7 */
 #ifdef __clang__
 static __attribute__ ((optnone)) void
index 3bf1147f7613a070502021971194fbec39227fea..0a489649c86dc3eae078a1a0342647d73ca8a5f8 100644 (file)
@@ -21,6 +21,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-hwcap.h>
+#include <mono/utils/unlocked.h>
 
 #include <mono/arch/mips/mips-codegen.h>
 
@@ -5709,7 +5710,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
        }
 
        if (!fail_tramp)
-               mono_stats.imt_trampolines_size += code - start;
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
        g_assert (code - start <= size);
        mono_arch_flush_icache (start, size);
 
index 8b17287a21a5aa0bd48fc9828176dda9ec1b255b..331b7ca3c02bff600ca6b3d5ae8e517824bf28c1 100644 (file)
@@ -68,7 +68,7 @@
 
 #include "jit-icalls.h"
 
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
 #include <mach/mach.h>
 #include <mach/mach_time.h>
 #include <mach/clock.h>
@@ -95,7 +95,7 @@ MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal)
        return FALSE;
 }
 
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
 void
 mono_runtime_install_handlers (void)
 {
@@ -302,7 +302,7 @@ add_signal_handler (int signo, gpointer handler, int flags)
 #ifdef MONO_ARCH_SIGSEGV_ON_ALTSTACK
 
 /*Apple likes to deliver SIGBUS for *0 */
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
        if (signo == SIGSEGV || signo == SIGBUS) {
 #else
        if (signo == SIGSEGV) {
@@ -396,7 +396,7 @@ mono_runtime_posix_install_handlers (void)
        add_signal_handler (SIGSEGV, mono_sigsegv_signal_handler, 0);
 }
 
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
 void
 mono_runtime_install_handlers (void)
 {
@@ -428,7 +428,7 @@ mono_runtime_cleanup_handlers (void)
 
 static volatile gint32 sampling_thread_running;
 
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
 
 static clock_serv_t sampling_clock_service;
 
@@ -699,7 +699,7 @@ mono_runtime_shutdown_stat_profiler (void)
 
        mono_profiler_sampling_thread_post ();
 
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
        /*
         * There is a slight problem when we're using CLOCK_PROCESS_CPUTIME_ID: If
         * we're shutting down and there's largely no activity in the process other
@@ -755,7 +755,7 @@ mono_runtime_setup_stat_profiler (void)
         * get us a 100% sampling rate. However, this may interfere with the GC's
         * STW logic. Could perhaps be solved by taking the suspend lock.
         */
-#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (PLATFORM_ANDROID)
+#if defined (USE_POSIX_BACKEND) && defined (SIGRTMIN) && !defined (HOST_ANDROID)
        /* Just take the first real-time signal we can get. */
        profiler_signal = mono_threads_suspend_search_alternative_signal ();
 #else
@@ -855,7 +855,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
 
        memset (argv, 0, sizeof (char*) * 10);
 
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
        if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename))
                goto exec;
 #endif
@@ -863,7 +863,7 @@ mono_gdb_render_native_backtraces (pid_t crashed_pid)
        if (native_stack_with_gdb (crashed_pid, argv, commands, commands_filename))
                goto exec;
 
-#if !defined(PLATFORM_MACOSX)
+#if !defined(HOST_DARWIN)
        if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename))
                goto exec;
 #endif
index 97ded1bee40b4ebd96e792f9635e724d02a991cb..1a947639a241d3692584586ae0a099a69ecc9856 100644 (file)
@@ -19,6 +19,7 @@
 #include <mono/utils/mono-proclib.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-hwcap.h>
+#include <mono/utils/unlocked.h>
 
 #include "mini-ppc.h"
 #ifdef TARGET_POWERPC64
@@ -5740,7 +5741,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
        }
 
        if (!fail_tramp)
-               mono_stats.imt_trampolines_size += code - start;
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
        g_assert (code - start <= size);
        mono_arch_flush_icache (start, size);
 
index b839e49f09637e9d1314e10c13815ced0435d885..3b74b398e1bfed72b0773d0216b02bfb7208313a 100644 (file)
@@ -64,6 +64,7 @@
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/mono-threads-coop.h>
 #include <mono/utils/checked-build.h>
+#include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-proclib.h>
 #include <mono/metadata/w32handle.h>
 #include <mono/metadata/threadpool.h>
@@ -4045,7 +4046,7 @@ register_icalls (void)
        mono_add_internal_call ("Mono.Runtime::mono_runtime_cleanup_handlers",
                                mono_runtime_cleanup_handlers);
 
-#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID)
+#if defined(HOST_ANDROID) || defined(TARGET_ANDROID)
        mono_add_internal_call ("System.Diagnostics.Debugger::Mono_UnhandledException_internal",
                                mono_debugger_agent_unhandled_exception);
 #endif
@@ -4305,6 +4306,11 @@ register_icalls (void)
 
 MonoJitStats mono_jit_stats = {0};
 
+/**
+ * Counters of mono_stats can be read without locking here.
+ * MONO_NO_SANITIZE_THREAD tells Clang's ThreadSanitizer to hide all reports of these (known) races.
+ */
+MONO_NO_SANITIZE_THREAD
 static void
 print_jit_stats (void)
 {
@@ -4315,36 +4321,36 @@ print_jit_stats (void)
                g_print ("Biggest method:         %ld (%s)\n", mono_jit_stats.biggest_method_size,
                                 mono_jit_stats.biggest_method);
 
-               g_print ("Delegates created:      %ld\n", mono_stats.delegate_creations);
-               g_print ("Initialized classes:    %ld\n", mono_stats.initialized_class_count);
-               g_print ("Used classes:           %ld\n", mono_stats.used_class_count);
-               g_print ("Generic vtables:        %ld\n", mono_stats.generic_vtable_count);
-               g_print ("Methods:                %ld\n", mono_stats.method_count);
-               g_print ("Static data size:       %ld\n", mono_stats.class_static_data_size);
-               g_print ("VTable data size:       %ld\n", mono_stats.class_vtable_size);
+               g_print ("Delegates created:      %" G_GINT32_FORMAT "\n", mono_stats.delegate_creations);
+               g_print ("Initialized classes:    %" G_GINT32_FORMAT "\n", mono_stats.initialized_class_count);
+               g_print ("Used classes:           %" G_GINT32_FORMAT "\n", mono_stats.used_class_count);
+               g_print ("Generic vtables:        %" G_GINT32_FORMAT "\n", mono_stats.generic_vtable_count);
+               g_print ("Methods:                %" G_GINT32_FORMAT "\n", mono_stats.method_count);
+               g_print ("Static data size:       %" G_GINT32_FORMAT "\n", mono_stats.class_static_data_size);
+               g_print ("VTable data size:       %" G_GINT32_FORMAT "\n", mono_stats.class_vtable_size);
                g_print ("Mscorlib mempool size:  %d\n", mono_mempool_get_allocated (mono_defaults.corlib->mempool));
 
-               g_print ("\nInitialized classes:    %ld\n", mono_stats.generic_class_count);
-               g_print ("Inflated types:         %ld\n", mono_stats.inflated_type_count);
+               g_print ("\nInitialized classes:    %" G_GINT32_FORMAT "\n", mono_stats.generic_class_count);
+               g_print ("Inflated types:         %" G_GINT32_FORMAT "\n", mono_stats.inflated_type_count);
                g_print ("Generics virtual invokes: %ld\n", mono_jit_stats.generic_virtual_invocations);
 
-               g_print ("Sharable generic methods: %ld\n", mono_stats.generics_sharable_methods);
-               g_print ("Unsharable generic methods: %ld\n", mono_stats.generics_unsharable_methods);
-               g_print ("Shared generic methods: %ld\n", mono_stats.generics_shared_methods);
-               g_print ("Shared vtype generic methods: %ld\n", mono_stats.gsharedvt_methods);
-
-               g_print ("IMT tables size:        %ld\n", mono_stats.imt_tables_size);
-               g_print ("IMT number of tables:   %ld\n", mono_stats.imt_number_of_tables);
-               g_print ("IMT number of methods:  %ld\n", mono_stats.imt_number_of_methods);
-               g_print ("IMT used slots:         %ld\n", mono_stats.imt_used_slots);
-               g_print ("IMT colliding slots:    %ld\n", mono_stats.imt_slots_with_collisions);
-               g_print ("IMT max collisions:     %ld\n", mono_stats.imt_max_collisions_in_slot);
-               g_print ("IMT methods at max col: %ld\n", mono_stats.imt_method_count_when_max_collisions);
-               g_print ("IMT trampolines size:   %ld\n", mono_stats.imt_trampolines_size);
-
-               g_print ("JIT info table inserts: %ld\n", mono_stats.jit_info_table_insert_count);
-               g_print ("JIT info table removes: %ld\n", mono_stats.jit_info_table_remove_count);
-               g_print ("JIT info table lookups: %ld\n", mono_stats.jit_info_table_lookup_count);
+               g_print ("Sharable generic methods: %" G_GINT32_FORMAT "\n", mono_stats.generics_sharable_methods);
+               g_print ("Unsharable generic methods: %" G_GINT32_FORMAT "\n", mono_stats.generics_unsharable_methods);
+               g_print ("Shared generic methods: %" G_GINT32_FORMAT "\n", mono_stats.generics_shared_methods);
+               g_print ("Shared vtype generic methods: %" G_GINT32_FORMAT "\n", mono_stats.gsharedvt_methods);
+
+               g_print ("IMT tables size:        %" G_GINT32_FORMAT "\n", mono_stats.imt_tables_size);
+               g_print ("IMT number of tables:   %" G_GINT32_FORMAT "\n", mono_stats.imt_number_of_tables);
+               g_print ("IMT number of methods:  %" G_GINT32_FORMAT "\n", mono_stats.imt_number_of_methods);
+               g_print ("IMT used slots:         %" G_GINT32_FORMAT "\n", mono_stats.imt_used_slots);
+               g_print ("IMT colliding slots:    %" G_GINT32_FORMAT "\n", mono_stats.imt_slots_with_collisions);
+               g_print ("IMT max collisions:     %" G_GINT32_FORMAT "\n", mono_stats.imt_max_collisions_in_slot);
+               g_print ("IMT methods at max col: %" G_GINT32_FORMAT "\n", mono_stats.imt_method_count_when_max_collisions);
+               g_print ("IMT trampolines size:   %" G_GINT32_FORMAT "\n", mono_stats.imt_trampolines_size);
+
+               g_print ("JIT info table inserts: %" G_GINT32_FORMAT "\n", mono_stats.jit_info_table_insert_count);
+               g_print ("JIT info table removes: %" G_GINT32_FORMAT "\n", mono_stats.jit_info_table_remove_count);
+               g_print ("JIT info table lookups: %" G_GINT32_FORMAT "\n", mono_stats.jit_info_table_lookup_count);
 
                g_free (mono_jit_stats.max_ratio_method);
                mono_jit_stats.max_ratio_method = NULL;
index 5760bfb8672d8276721c86ee2e4a8928e6a830f4..28aa4dcb2d05fb371e5cae02737f766741bfd469 100644 (file)
@@ -268,6 +268,7 @@ if (ins->inst_target_bb->native_offset) {                                   \
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/unlocked.h>
 
 #include "mini-s390x.h"
 #include "cpu-s390x.h"
@@ -6678,7 +6679,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain,
        MONO_PROFILER_RAISE (jit_code_buffer, (start, code - start, MONO_PROFILER_CODE_BUFFER_IMT_TRAMPOLINE, NULL));
 
        if (!fail_tramp) 
-               mono_stats.imt_trampolines_size += (code - start);
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
 
        g_assert (code - start <= size);
 
index 7f5f68091e4a813dbfc9aceeac829c52743dbf1e..75868b976111366640a3974af502671fac0d6b91 100644 (file)
@@ -30,6 +30,7 @@
 #include <mono/metadata/tokentype.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-hwcap.h>
+#include <mono/utils/unlocked.h>
 
 #include "mini-sparc.h"
 #include "trace.h"
@@ -2359,7 +2360,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
 
        mono_arch_flush_icache ((guint8*)start, (code - start) * 4);
 
-       mono_stats.imt_trampolines_size += (code - start) * 4;
+       UnlockedAdd (&mono_stats.imt_trampolines_size, (code - start) * 4);
        g_assert (code - start <= size);
 
        mono_tramp_info_register (mono_tramp_info_create (NULL, start, code - start, NULL, NULL), domain);
index 86ddb41427893ec9429ea134d6dcbf0b75ad8a7f..f6b61bae8cc000152eec0fdd5c0676933663cdf2 100644 (file)
@@ -32,6 +32,7 @@
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-hwcap.h>
 #include <mono/utils/mono-threads.h>
+#include <mono/utils/unlocked.h>
 
 #include "trace.h"
 #include "mini-x86.h"
@@ -5641,7 +5642,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
        }
 
        if (!fail_tramp)
-               mono_stats.imt_trampolines_size += code - start;
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
        g_assert (code - start <= size);
 
 #if DEBUG_IMT
index 5e6e718486f8b7c29b519017b2acf237b41b8e58..608b4a32a0007b85e635e9cd11db6355d8778abf 100644 (file)
@@ -3125,9 +3125,9 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
 
        if (opts & MONO_OPT_GSHARED) {
                if (try_generic_shared)
-                       mono_stats.generics_sharable_methods++;
+                       InterlockedIncrement (&mono_stats.generics_sharable_methods);
                else if (mono_method_is_generic_impl (method))
-                       mono_stats.generics_unsharable_methods++;
+                       InterlockedIncrement (&mono_stats.generics_unsharable_methods);
        }
 
 #ifdef ENABLE_LLVM
@@ -3163,7 +3163,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
        cfg->llvm_only = (flags & JIT_FLAG_LLVM_ONLY) != 0;
        cfg->backend = current_backend;
 
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        if (cfg->method->wrapper_type != MONO_WRAPPER_NONE) {
                /* FIXME: Why is this needed */
                cfg->gen_seq_points = FALSE;
@@ -4236,9 +4236,9 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
                code = cfg->native_code;
 
                if (cfg->gshared && mono_method_is_generic_sharable (method, FALSE))
-                       mono_stats.generics_shared_methods++;
+                       InterlockedIncrement (&mono_stats.generics_shared_methods);
                if (cfg->gsharedvt)
-                       mono_stats.gsharedvt_methods++;
+                       InterlockedIncrement (&mono_stats.gsharedvt_methods);
        }
 
        jinfo = cfg->jit_info;
index 7ce873a38ce7b6bdb0f42d9830c4329fa4d4f844..9645a0de7b99d1b9ac7e8caedbb37a3bf0cabded 100644 (file)
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
 
 /* Remap printf to g_print (we use a mix of these in the mini code) */
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
 #define printf g_print
 #endif
 
@@ -2926,6 +2926,7 @@ void     mono_llvm_clear_exception              (void);
 MonoObject *mono_llvm_load_exception            (void);
 void     mono_llvm_reset_exception              (void);
 void     mono_llvm_raise_exception              (MonoException *e);
+void     mono_llvm_reraise_exception            (MonoException *e);
 gint32 mono_llvm_match_exception                (MonoJitInfo *jinfo, guint32 region_start, guint32 region_end, gpointer rgctx, MonoObject *this_obj);
 
 gboolean
index e5e36100f09575d94edbd0d24c29028a82ba949d..0e50ae550707597de0aee029b8dc9cdda3829405 100644 (file)
@@ -26,7 +26,7 @@
 #include <mono/utils/mono-memory-model.h>
 #include "trace.h"
 
-#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+#if defined (HOST_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
 #  undef printf
 #  define printf(...) g_log("mono", G_LOG_LEVEL_MESSAGE, __VA_ARGS__)
 #  undef fprintf
index 53e3bc2e834c53dd39f310e66e6f4da222d49f72..ea912ba6ce94a94a9c7e0735b15c05a0c24fa550 100644 (file)
@@ -705,8 +705,10 @@ mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info
 
        g_free (rgctx_null_jumps);
 
-       /* move the rgctx pointer to the VTABLE register */
-       amd64_mov_reg_reg (code, MONO_ARCH_VTABLE_REG, AMD64_ARG_REG1, sizeof(gpointer));
+       if (MONO_ARCH_VTABLE_REG != AMD64_ARG_REG1) {
+               /* move the rgctx pointer to the VTABLE register */
+               amd64_mov_reg_reg (code, MONO_ARCH_VTABLE_REG, AMD64_ARG_REG1, sizeof(gpointer));
+       }
 
        if (aot) {
                code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, g_strdup_printf ("specific_trampoline_lazy_fetch_%u", slot));
index f96c8a3fcccfba10337d1c2c3597139df56c46c5..88cd9d37a1a2851aa5944c04a5feb265f5651767 100644 (file)
@@ -30,7 +30,7 @@ lib_LTLIBRARIES = \
 suppressiondir = $(datadir)/mono-$(API_VER)/mono/profiler
 suppression_DATA = mono-profiler-log.suppression
 
-if PLATFORM_DARWIN
+if HOST_DARWIN
 if BITCODE
 prof_ldflags = -no-undefined
 else
@@ -44,7 +44,7 @@ else
 libmono_dep = $(monodir)/mono/mini/$(LIBMONO_LA)
 endif
 
-if PLATFORM_ANDROID
+if HOST_ANDROID
 prof_ldflags = -avoid-version
 endif
 
index 0367d145774dfc0f8804ef1b7e8a1ebba51c7fde..fef115796dd1b0d8f4553879d55c653c44959f54 100644 (file)
@@ -63,11 +63,11 @@ typedef enum {
 #define MONO_GC_HANDLE(slot, type) (((slot) << MONO_GC_HANDLE_TYPE_SHIFT) | (((type) & MONO_GC_HANDLE_TYPE_MASK) + 1))
 
 typedef struct {
-       guint minor_gc_count;
-       guint major_gc_count;
-       guint64 minor_gc_time;
-       guint64 major_gc_time;
-       guint64 major_gc_time_concurrent;
+       gint32 minor_gc_count;
+       gint32 major_gc_count;
+       gint64 minor_gc_time;
+       gint64 major_gc_time;
+       gint64 major_gc_time_concurrent;
 } GCStats;
 
 extern GCStats gc_stats;
index 2e1178ad3926402057862c87b67dd792684e9026..6c21c466f3fa6fcf51b6b210fa590129b04c668e 100644 (file)
@@ -69,7 +69,7 @@ alloc_degraded (GCVTable vtable, size_t size, gboolean for_mature)
        GCObject *p;
 
        if (!for_mature) {
-               sgen_client_degraded_allocation (size);
+               sgen_client_degraded_allocation ();
                SGEN_ATOMIC_ADD_P (degraded_mode, size);
                sgen_ensure_free_space (size, GENERATION_OLD);
        } else {
index 9fa6e2141c2e620e4a9d7d6b5671030019407e8a..9a3ad0157044ba79cbb6deb47a7b20a39ced03db 100644 (file)
 
 #define REDZONE_SIZE   0
 
+#elif defined (TARGET_WASM)
+
+#define REDZONE_SIZE   0
+
 #endif
 
 #endif /* __MONO_SGENARCHDEP_H__ */
index a492ad74a977db7c10f0ba579defa132157cfb67..99d77857935604a695e84b73bb93418b18f51b97 100644 (file)
@@ -122,7 +122,7 @@ void sgen_client_pinned_los_object (GCObject *obj);
 /*
  * Called for every degraded allocation.  No action is necessary.
  */
-void sgen_client_degraded_allocation (size_t size);
+void sgen_client_degraded_allocation (void);
 
 /*
  * Called whenever the amount of memory allocated for the managed heap changes.  No action
index 49c630f03f373ef59a4a37d6aafc96f29a157f0f..54ff725b22b3c169e7234dffde1a626cf11ee9c2 100644 (file)
 #include <errno.h>
 #include <assert.h>
 #include <stdlib.h>
+#include <glib.h>
 
 #include "mono/sgen/sgen-gc.h"
 #include "mono/sgen/sgen-cardtable.h"
@@ -1701,7 +1702,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        TV_GETTIME (last_minor_collection_start_tv);
        atv = last_minor_collection_start_tv;
 
-       binary_protocol_collection_begin (gc_stats.minor_gc_count, GENERATION_NURSERY);
+       binary_protocol_collection_begin (InterlockedRead (&gc_stats.minor_gc_count), GENERATION_NURSERY);
 
        object_ops_nopar = sgen_concurrent_collection_in_progress ()
                                ? &sgen_minor_collector.serial_ops_with_concurrent_major
@@ -1729,7 +1730,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        degraded_mode = 0;
        objects_pinned = 0;
 
-       SGEN_LOG (1, "Start nursery collection %d %p-%p, size: %d", gc_stats.minor_gc_count, nursery_section->data, nursery_section->end_data, (int)(nursery_section->end_data - nursery_section->data));
+       SGEN_LOG (1, "Start nursery collection %" G_GINT32_FORMAT " %p-%p, size: %d", InterlockedRead (&gc_stats.minor_gc_count), nursery_section->data, nursery_section->end_data, (int)(nursery_section->end_data - nursery_section->data));
 
        /* world must be stopped already */
        TV_GETTIME (btv);
@@ -1744,7 +1745,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        init_gray_queue (&gc_thread_gray_queue);
        ctx = CONTEXT_FROM_OBJECT_OPERATIONS (object_ops_nopar, &gc_thread_gray_queue);
 
-       gc_stats.minor_gc_count ++;
+       InterlockedIncrement (&gc_stats.minor_gc_count);
 
        sgen_process_fin_stage_entries ();
 
@@ -1861,9 +1862,9 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
        major_collector.finish_nursery_collection ();
 
        TV_GETTIME (last_minor_collection_end_tv);
-       gc_stats.minor_gc_time += TV_ELAPSED (last_minor_collection_start_tv, last_minor_collection_end_tv);
+       InterlockedAdd64 (&gc_stats.minor_gc_time, TV_ELAPSED (last_minor_collection_start_tv, last_minor_collection_end_tv));
 
-       sgen_debug_dump_heap ("minor", gc_stats.minor_gc_count - 1, NULL);
+       sgen_debug_dump_heap ("minor", InterlockedRead (&gc_stats.minor_gc_count) - 1, NULL);
 
        /* prepare the pin queue for the next collection */
        sgen_finish_pinning ();
@@ -1896,7 +1897,7 @@ collect_nursery (const char *reason, gboolean is_overflow, SgenGrayQueue *unpin_
                        time_minor_scan_los - los_scan_start,
                        time_minor_finish_gray_stack - finish_gray_start);
 
-       binary_protocol_collection_end (gc_stats.minor_gc_count - 1, GENERATION_NURSERY, 0, 0);
+       binary_protocol_collection_end (InterlockedRead (&gc_stats.minor_gc_count) - 1, GENERATION_NURSERY, 0, 0);
 
        if (check_nursery_objects_pinned && !sgen_minor_collector.is_split)
                sgen_check_nursery_objects_pinned (unpin_queue != NULL);
@@ -2147,7 +2148,7 @@ major_start_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason,
 {
        SgenObjectOperations *object_ops_nopar, *object_ops_par = NULL;
 
-       binary_protocol_collection_begin (gc_stats.major_gc_count, GENERATION_OLD);
+       binary_protocol_collection_begin (InterlockedRead (&gc_stats.major_gc_count), GENERATION_OLD);
 
        current_collection_generation = GENERATION_OLD;
 
@@ -2178,8 +2179,8 @@ major_start_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason,
        check_scan_starts ();
 
        degraded_mode = 0;
-       SGEN_LOG (1, "Start major collection %d", gc_stats.major_gc_count);
-       gc_stats.major_gc_count ++;
+       SGEN_LOG (1, "Start major collection %" G_GINT32_FORMAT, InterlockedRead (&gc_stats.major_gc_count));
+       InterlockedIncrement (&gc_stats.major_gc_count);
 
        if (major_collector.start_major_collection)
                major_collector.start_major_collection ();
@@ -2295,7 +2296,7 @@ major_finish_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason
        TV_GETTIME (atv);
        time_major_sweep += TV_ELAPSED (btv, atv);
 
-       sgen_debug_dump_heap ("major", gc_stats.major_gc_count - 1, reason);
+       sgen_debug_dump_heap ("major", InterlockedRead (&gc_stats.major_gc_count) - 1, reason);
 
        if (sgen_have_pending_finalizers ()) {
                SGEN_LOG (4, "Finalizer-thread wakeup");
@@ -2327,7 +2328,7 @@ major_finish_collection (SgenGrayQueue *gc_thread_gray_queue, const char *reason
                         time_major_scan_mod_union_los - los_scan_start,
                         time_major_finish_gray_stack - finish_gray_start);
 
-       binary_protocol_collection_end (gc_stats.major_gc_count - 1, GENERATION_OLD, counts.num_scanned_objects, counts.num_unique_scanned_objects);
+       binary_protocol_collection_end (InterlockedRead (&gc_stats.major_gc_count) - 1, GENERATION_OLD, counts.num_scanned_objects, counts.num_unique_scanned_objects);
 }
 
 static gboolean
@@ -2355,7 +2356,7 @@ major_do_collection (const char *reason, gboolean is_overflow, gboolean forced)
        sgen_gray_object_queue_dispose (&gc_thread_gray_queue);
 
        TV_GETTIME (time_end);
-       gc_stats.major_gc_time += TV_ELAPSED (time_start, time_end);
+       InterlockedAdd64 (&gc_stats.major_gc_time, TV_ELAPSED (time_start, time_end));
 
        /* FIXME: also report this to the user, preferably in gc-end. */
        if (major_collector.get_and_reset_num_major_objects_marked)
@@ -2391,7 +2392,7 @@ major_start_concurrent_collection (const char *reason)
        num_objects_marked = major_collector.get_and_reset_num_major_objects_marked ();
 
        TV_GETTIME (time_end);
-       gc_stats.major_gc_time += TV_ELAPSED (time_start, time_end);
+       InterlockedAdd64 (&gc_stats.major_gc_time, TV_ELAPSED (time_start, time_end));
 
        current_collection_generation = -1;
 }
@@ -2419,7 +2420,7 @@ major_update_concurrent_collection (void)
        sgen_los_update_cardtable_mod_union ();
 
        TV_GETTIME (total_end);
-       gc_stats.major_gc_time += TV_ELAPSED (total_start, total_end);
+       InterlockedAdd64 (&gc_stats.major_gc_time, TV_ELAPSED (total_start, total_end));
 }
 
 static void
@@ -2441,7 +2442,7 @@ major_finish_concurrent_collection (gboolean forced)
        sgen_workers_stop_all_workers (GENERATION_OLD);
 
        SGEN_TV_GETTIME (time_major_conc_collection_end);
-       gc_stats.major_gc_time_concurrent += SGEN_TV_ELAPSED (time_major_conc_collection_start, time_major_conc_collection_end);
+       InterlockedAdd64 (&gc_stats.major_gc_time_concurrent, SGEN_TV_ELAPSED (time_major_conc_collection_start, time_major_conc_collection_end));
 
        major_collector.update_cardtable_mod_union ();
        sgen_los_update_cardtable_mod_union ();
@@ -2456,7 +2457,7 @@ major_finish_concurrent_collection (gboolean forced)
        sgen_gray_object_queue_dispose (&gc_thread_gray_queue);
 
        TV_GETTIME (total_end);
-       gc_stats.major_gc_time += TV_ELAPSED (total_start, total_end);
+       InterlockedAdd64 (&gc_stats.major_gc_time, TV_ELAPSED (total_start, total_end));
 
        current_collection_generation = -1;
 }
@@ -3053,9 +3054,7 @@ sgen_gc_collect (int generation)
 int
 sgen_gc_collection_count (int generation)
 {
-       if (generation == 0)
-               return gc_stats.minor_gc_count;
-       return gc_stats.major_gc_count;
+       return InterlockedRead (generation == GENERATION_NURSERY ? &gc_stats.minor_gc_count : &gc_stats.major_gc_count);
 }
 
 size_t
index 35e1195dbfbbfc27c96546a05684c22ad1b6fa3e..5f4185d4df70ec4f48a692aae3edfc46cfd3396b 100644 (file)
@@ -1220,7 +1220,7 @@ major_get_and_reset_num_major_objects_marked (void)
 #endif
 
 /* gcc 4.2.1 from xcode4 crashes on sgen_card_table_get_card_address () when this is enabled */
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
 #if MONO_GNUC_VERSION <= 40300
 #undef PREFETCH_CARDS
 #endif
index e93fb7de81fe72e9473bece369a46c8fbe661770..d7b3119374d47584deb42bf0b5b4e826ceecc9d2 100755 (executable)
@@ -245,6 +245,7 @@ TESTS_CS_SRC=               \
        delegate11.cs           \
        delegate12.cs           \
        delegate13.cs           \
+       delegate14.cs           \
        largeexp.cs             \
        largeexp2.cs            \
        marshalbyref1.cs        \
@@ -512,7 +513,9 @@ TESTS_CS_SRC=               \
        bug-46661.cs    \
        w32message.cs \
        runtime-invoke.gen.cs \
-       imt_big_iface_test.cs
+       imt_big_iface_test.cs \
+       bug-58782-plain-throw.cs \
+       bug-58782-capture-and-throw.cs
 
 if AMD64
 TESTS_CS_SRC += async-exc-compilation.cs finally_guard.cs finally_block_ending_in_dead_bb.cs
@@ -648,9 +651,15 @@ TESTS_GSHARED_SRC = \
        bug-1147.cs     \
        generic-type-builder.2.cs
 
+PLATFORM_DISABLED_TESTS=
+
+if HOST_WIN32
+PLATFORM_DISABLED_TESTS += bug-58782-plain-throw.exe bug-58782-capture-and-throw.exe
+endif
+
 if AMD64
 # #651684
-PLATFORM_DISABLED_TESTS = finally_guard.exe
+PLATFORM_DISABLED_TESTS += finally_guard.exe
 
 if HOST_WIN32
 PLATFORM_DISABLED_TESTS += w32message.exe
@@ -661,7 +670,7 @@ endif
 if X86
 
 if HOST_WIN32
-PLATFORM_DISABLED_TESTS=async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
+PLATFORM_DISABLED_TESTS += async-exc-compilation.exe finally_guard.exe finally_block_ending_in_dead_bb.exe \
        bug-18026.exe monitor.exe threadpool-exceptions5.exe process-unref-race.exe w32message.exe \
        unhandled-exception-1.exe unhandled-exception-2.exe unhandled-exception-3.exe unhandled-exception-4.exe \
        unhandled-exception-5.exe unhandled-exception-6.exe unhandled-exception-7.exe unhandled-exception-8.exe
@@ -671,12 +680,12 @@ endif
 
 if POWERPC
 # bug #71274
-PLATFORM_DISABLED_TESTS=finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
+PLATFORM_DISABLED_TESTS += finalizer-abort.exe finalizer-exception.exe finalizer-exit.exe
 endif
 
 if POWERPC64
 # FIXME: These tests hang/fail for unknown reasons
-PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
+PLATFORM_DISABLED_TESTS += monitor.exe threadpool-exceptions5.exe appdomain-thread-abort.exe appdomain-unload.exe \
        pinvoke2.exe pinvoke3.exe pinvoke11.exe threadpool-exceptions7.exe winx64structs.exe bug-10127.exe pinvoke_ppcc.exe \
        pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe abort-cctor.exe load-exceptions.exe \
        sgen-domain-unload-2.exe sgen-weakref-stress.exe sgen-cementing-stress.exe sgen-new-threads-dont-join-stw.exe \
@@ -684,7 +693,7 @@ PLATFORM_DISABLED_TESTS=monitor.exe threadpool-exceptions5.exe appdomain-thread-
 endif
 
 if ARM
-PLATFORM_DISABLED_TESTS=filter-stack.exe
+PLATFORM_DISABLED_TESTS += filter-stack.exe
 INTERP_DISABLED_TESTS_PLATFORM=finalizer-exception.exe main-returns-abort-resetabort.exe block_guard_restore_aligment_on_exit.exe \
        delegate-exit.exe delegate-exit.exe delegate-delegate-exit.exe delegate-async-exit.exe delegate3.exe delegate1.exe
 endif
@@ -695,11 +704,11 @@ endif
 
 if MIPS
 # monitor.exe is racy
-PLATFORM_DISABLED_TESTS=filter-stack.exe monitor.exe
+PLATFORM_DISABLED_TESTS += filter-stack.exe monitor.exe
 endif
 
 if S390X
-PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe
+PLATFORM_DISABLED_TESTS += dynamic-method-resurrection.exe
 #PLATFORM_DISABLED_TESTS=dynamic-method-resurrection.exe exception17.exe
 
 PLATFORM_DISABLED_TESTS += \
@@ -758,7 +767,9 @@ PROFILE_DISABLED_TESTS += \
        marshal8.exe \
        pinvoke-2.2.exe \
        pinvoke3.exe \
-       thunks.exe
+       thunks.exe \
+       bug-58782-plain-throw.exe \
+       bug-58782-capture-and-throw.exe
 
 # Tests which load assemblies which are not
 # in the testing_aot_full profile
@@ -959,6 +970,8 @@ INTERP_DISABLED_TESTS = \
        bug-46661.exe \
        bug-47295.exe \
        bug-48015.exe \
+       bug-58782-plain-throw.exe \
+       bug-58782-capture-and-throw.exe \
        bug-544446.exe \
        bug-685908.exe \
        bug-80307.exe \
@@ -1139,10 +1152,10 @@ tests: compile-tests
 #
 # Test that no symbols are missed in eglib-remap.h
 #
-if PLATFORM_LINUX
+if HOST_LINUX
 test-platform: test-eglib-remap
 else
-if PLATFORM_DARWIN
+if HOST_DARWIN
 test-platform: test-eglib-remap
 endif
 endif
@@ -1693,7 +1706,8 @@ test-unhandled-exception: unhandled-exception-test-runner.2.exe
 
 safehandle.2.exe winx64structs.exe thunks.exe pinvoke3.exe pinvoke2.exe pinvoke-2.2.exe pinvoke17.exe pinvoke13.exe \
        pinvoke11.exe pinvoke_ppcs.exe pinvoke_ppci.exe pinvoke_ppcf.exe pinvoke_ppcd.exe pinvoke_ppcc.exe pinvoke.exe \
-       marshalbool.exe marshal9.exe marshal5.exe marshal.exe handleref.exe cominterop.exe bug-Xamarin-5278.exe: libtest.la
+       marshalbool.exe marshal9.exe marshal5.exe marshal.exe handleref.exe cominterop.exe bug-Xamarin-5278.exe \
+       bug-58782-plain-throw.exe bug-58782-capture-and-throw.exe: libtest.la
 
 event-get.2.exe$(PLATFORM_AOT_SUFFIX): event-il.exe$(PLATFORM_AOT_SUFFIX)
 event-get.2.exe: event-il.exe
diff --git a/mono/tests/bug-58782-capture-and-throw.cs b/mono/tests/bug-58782-capture-and-throw.cs
new file mode 100644 (file)
index 0000000..9a917ee
--- /dev/null
@@ -0,0 +1,55 @@
+using System;
+using System.Runtime.InteropServices;
+
+class Driver
+{
+       [DllImport ("libtest")]
+       static extern void mono_test_native_to_managed_exception_rethrow (Action action);
+
+       [DllImport ("libc")]
+       static extern void _exit (int exitCode);
+
+       static int Main (string[] args)
+       {
+               AppDomain.CurrentDomain.UnhandledException += (sender, exception_args) =>
+               {
+                       CustomException exc = exception_args.ExceptionObject as CustomException;
+                       if (exc == null) {
+                               Console.WriteLine ($"FAILED - Unknown exception: {exception_args.ExceptionObject}");
+                               _exit (1);
+                       }
+
+                       Console.WriteLine (exc.StackTrace);
+                       if (string.IsNullOrEmpty (exc.StackTrace)) {
+                               Console.WriteLine ("FAILED - StackTrace is null for unhandled exception.");
+                               _exit (2);
+                       } else {
+                               Console.WriteLine ("SUCCESS - StackTrace is not null for unhandled exception.");
+                               _exit (0);
+                       }
+               };
+
+               mono_test_native_to_managed_exception_rethrow (CaptureAndThrow);
+               Console.WriteLine ("Should have exited in the UnhandledException event handler.");
+               return 2;
+       }
+
+       static void CaptureAndThrow ()
+       {
+               try {
+                       Throw ();
+               } catch (Exception e) {
+                       System.Runtime.ExceptionServices.ExceptionDispatchInfo.Capture (e).Throw ();
+               }
+       }
+
+       static void Throw ()
+       {
+               throw new CustomException ("C");
+       }
+
+       class CustomException : Exception
+       {
+               public CustomException(string s) : base(s) {}
+       }
+}
\ No newline at end of file
diff --git a/mono/tests/bug-58782-plain-throw.cs b/mono/tests/bug-58782-plain-throw.cs
new file mode 100644 (file)
index 0000000..72ce01c
--- /dev/null
@@ -0,0 +1,51 @@
+using System;
+using System.Runtime.InteropServices;
+
+class Driver
+{
+       [DllImport ("libtest")]
+       static extern void mono_test_native_to_managed_exception_rethrow (Action action);
+
+       [DllImport ("libc")]
+       static extern void _exit (int exitCode);
+
+       static int Main (string[] args)
+       {
+               AppDomain.CurrentDomain.UnhandledException += (sender, exception_args) =>
+               {
+                       CustomException exc = exception_args.ExceptionObject as CustomException;
+                       if (exc == null) {
+                               Console.WriteLine ($"FAILED - Unknown exception: {exception_args.ExceptionObject}");
+                               _exit (1);
+                       }
+
+                       Console.WriteLine (exc.StackTrace);
+                       if (string.IsNullOrEmpty (exc.StackTrace)) {
+                               Console.WriteLine ("FAILED - StackTrace is null for unhandled exception.");
+                               _exit (2);
+                       } else {
+                               Console.WriteLine ("SUCCESS - StackTrace is not null for unhandled exception.");
+                               _exit (0);
+                       }
+               };
+
+               mono_test_native_to_managed_exception_rethrow (PlainThrow);
+               Console.WriteLine ("Should have exited in the UnhandledException event handler.");
+               return 3;
+       }
+
+       static void PlainThrow ()
+       {
+               Throw ();
+       }
+
+       static void Throw ()
+       {
+               throw new CustomException ("C");
+       }
+
+       class CustomException : Exception
+       {
+               public CustomException(string s) : base(s) {}
+       }
+}
\ No newline at end of file
diff --git a/mono/tests/delegate14.cs b/mono/tests/delegate14.cs
new file mode 100644 (file)
index 0000000..2fd7d62
--- /dev/null
@@ -0,0 +1,26 @@
+using System;
+
+// Regression test for bug #58888
+
+public static class Program
+{
+       public static int Main (string[] args)
+       {
+               ITest obj = null;
+               try
+               {
+                       GC.KeepAlive((Action)obj.Func);
+               }
+               catch (NullReferenceException)
+               {
+                       return 0;
+               }
+
+               return 1;
+       }
+
+       interface ITest
+       {
+               void Func ();
+       }
+}
index 9950476e4cac4a62f22e18559a11652cc0b2a8d4..39e5c3766a8fc0a7dc25bbcbaa546eb3fe0c01ea 100644 (file)
@@ -1356,7 +1356,10 @@ mono_test_return_empty_struct (int a)
 
        memset (&s, 0, sizeof (s));
 
+#if !(defined(__i386__) && defined(__clang__))
+       /* https://bugzilla.xamarin.com/show_bug.cgi?id=58901 */
        g_assert (a == 42);
+#endif
 
        return s;
 }
@@ -7482,3 +7485,23 @@ mono_test_marshal_pointer_array (int *arr[])
        }
        return 0;
 }
+
+#ifndef WIN32
+
+typedef void (*NativeToManagedExceptionRethrowFunc) ();
+
+void *mono_test_native_to_managed_exception_rethrow_thread (void *arg)
+{
+       NativeToManagedExceptionRethrowFunc func = (NativeToManagedExceptionRethrowFunc) arg;
+       func ();
+       return NULL;
+}
+
+LIBTEST_API void STDCALL
+mono_test_native_to_managed_exception_rethrow (NativeToManagedExceptionRethrowFunc func)
+{
+       pthread_t t;
+       pthread_create (&t, NULL, mono_test_native_to_managed_exception_rethrow_thread, func);
+       pthread_join (t, NULL);
+}
+#endif
index 558fb5931e4b8fa25ceaa486bcb8da40c6ab66e6..7bae078cc353a5a748869698c84a26521c203137 100644 (file)
@@ -50,7 +50,7 @@
                        br fail
                } catch [mscorlib]System.MethodAccessException {
                        call instance string [mscorlib]System.MethodAccessException::get_Message ()
-                       ldstr "Method `MethFail:sfoo ()' is inaccessible from method `Test:call_sfoo ()'"
+                       ldstr "Method `MethFail.sfoo()' is inaccessible from method `Test.call_sfoo()'"
                        call instance bool [mscorlib]System.String::Equals (string)
                        brfalse fail
                        br continue
index ec04c4d1c5f17f5df5dab43b834893dc048783f1..82eb31b21571823d17a3214ab19f413f590f2d49 100644 (file)
@@ -3,7 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/mono $(LIBGC_CPPFLAGS) $(GLIB_CFLA
 test_cflags = $(AM_CFLAGS) $(SGEN_DEFINES)
 test_ldadd = libtestlib.la \
        $(LIBGC_LIBS) $(GLIB_LIBS) -lm $(LIBICONV)
-if PLATFORM_DARWIN
+if HOST_DARWIN
 test_ldflags = -framework CoreFoundation -framework Foundation
 endif
 
index b277688859176ae54ff3a4d3c5b16ff574eccbb5..118ab953d0e8bcc172995e3e797a268899737113 100644 (file)
@@ -39,6 +39,7 @@ monoutils_sources = \
        mono-dl-windows.c       \
        mono-dl-darwin.c        \
        mono-dl-posix.c         \
+       mono-dl-wasm.c  \
        mono-dl.h               \
        mono-dl-windows-internals.h     \
        mono-log-windows.c      \
@@ -136,6 +137,7 @@ monoutils_sources = \
        mono-threads-openbsd.c  \
        mono-threads-android.c  \
        mono-threads-haiku.c    \
+       mono-threads-wasm.c     \
        mono-threads.h  \
        mono-threads-debug.h    \
        mono-threads-api.h      \
@@ -246,6 +248,10 @@ if S390X
 arch_sources += mono-hwcap-s390x.c
 endif
 
+if HOST_WASM
+arch_sources += mono-hwcap-wasm.c
+endif
+
 else
 
 arch_sources += mono-hwcap-cross.c
index c01d8ae5ff295ad2c00ba8631c16e9293720d8ac..2c8802412f91bb840589bd8d767be7b0dfef97d9 100644 (file)
@@ -406,7 +406,7 @@ gpointer InterlockedReadPointer(volatile gpointer *src)
        return(ret);
 }
 
-void InterlockedWrite(volatile gint8 *dst, gint8 val)
+void InterlockedWrite8(volatile gint8 *dst, gint8 val)
 {
        int thr_ret;
        
index decab93c7a96e58094b18a6a97047fb533a8c0b2..a3dd65a4dc28570fdf8d34881643300c93b8b988 100755 (executable)
@@ -464,4 +464,13 @@ extern void InterlockedWritePointer(volatile gpointer *dst, gpointer val);
 #define InterlockedAddP(p,add) InterlockedAdd64 ((volatile gint64*)p, (gint64)add)
 #endif
 
+/* The following functions cannot be found on any platform, and thus they can be declared without further existence checks */
+
+static inline void
+InterlockedWriteBool (volatile gboolean *dest, gboolean val)
+{
+       /* both, gboolean and gint32, are int32_t; the purpose of these casts is to make things explicit */
+       InterlockedWrite ((volatile gint32 *)dest, (gint32)val);
+}
+
 #endif /* _WAPI_ATOMIC_H_ */
index 746c84fb5131455564551cf4186402cbf41820f0..3e1b4108b4e2a3c9e27df66843593c7fdea0aff4 100644 (file)
@@ -74,7 +74,7 @@ typedef SSIZE_T ssize_t;
 #define MONO_EMPTY_SOURCE_FILE(x)
 #endif
 
-#if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
+#if !defined(_MSC_VER) && !defined(HOST_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
 #if MONO_LLVM_LOADED
 #define MONO_LLVM_INTERNAL MONO_API
 #else
index b26442f73f5c7897e5ec9da2bf1881399dacf2fa..827e0ed9f813a197db765b5267bd4fbf6f75104b 100644 (file)
@@ -34,7 +34,25 @@ typedef struct __darwin_xmm_reg MonoContextSimdReg;
  * MONO_CONTEXT_GET_CURRENT captures the current context as close as possible. One reg might be clobbered
  *  to hold the address of the target MonoContext. It will be a caller save one, so should not be a problem.
  */
-#if (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86))
+#if defined (TARGET_WASM)
+
+typedef struct {
+       mgreg_t wasm_sp;
+       mgreg_t wasm_bp;
+       mgreg_t llvm_exc_reg;
+       mgreg_t wasm_ip;
+       mgreg_t wasm_pc;
+} MonoContext;
+
+#define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->wasm_ip = (mgreg_t)(ip); } while (0);
+#define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->wasm_bp = (mgreg_t)(bp); } while (0);
+#define MONO_CONTEXT_SET_SP(ctx,sp) do { (ctx)->wasm_sp = (mgreg_t)(sp); } while (0);
+
+#define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->wasm_ip))
+#define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->wasm_bp))
+#define MONO_CONTEXT_GET_SP(ctx) ((gpointer)((ctx)->wasm_sp))
+
+#elif (defined(__i386__) && !defined(MONO_CROSS_COMPILE)) || (defined(TARGET_X86))
 
 /*HACK, move this to an eventual mono-signal.c*/
 #if defined( __linux__) || defined(__sun) || defined(__APPLE__) || defined(__NetBSD__) || \
index 0ade0d5414931c3bab348ef107cff8d3416fd3e2..c2b2b96d9d7419c0eea9d9400a84da27323b6d7a 100644 (file)
@@ -61,7 +61,7 @@ mono_dl_get_system_dir (void)
 void *
 mono_dl_open_file (const char *file, int flags)
 {
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        /* Bionic doesn't support NULL filenames */
        if (!file)
                return NULL;
diff --git a/mono/utils/mono-dl-wasm.c b/mono/utils/mono-dl-wasm.c
new file mode 100644 (file)
index 0000000..1d0dd98
--- /dev/null
@@ -0,0 +1,76 @@
+#include <config.h>
+
+#if defined (HOST_WASM)
+
+#include "mono/utils/mono-dl.h"
+#include "mono/utils/mono-embed.h"
+#include "mono/utils/mono-path.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <glib.h>
+
+const char *
+mono_dl_get_so_prefix (void)
+{
+       return "";
+}
+
+const char **
+mono_dl_get_so_suffixes (void)
+{
+       static const char *suffixes[] = {
+               ".wasm", //we only recognize .wasm files for DSOs.
+               "",
+       };
+       return suffixes;
+}
+
+int
+mono_dl_get_executable_path (char *buf, int buflen)
+{
+       strncpy (buf, "/managed", buflen); //This is a packaging convertion that our tooling should enforce
+       return 0;
+}
+
+const char*
+mono_dl_get_system_dir (void)
+{
+       return NULL;
+}
+
+
+void*
+mono_dl_lookup_symbol (MonoDl *module, const char *name)
+{
+       return NULL;
+}
+
+char*
+mono_dl_current_error_string (void)
+{
+       return g_strdup ("");
+}
+
+
+int
+mono_dl_convert_flags (int flags)
+{
+       return flags;
+}
+
+void *
+mono_dl_open_file (const char *file, int flags)
+{
+       return NULL;
+}
+
+void
+mono_dl_close_handle (MonoDl *module)
+{
+       //nothing to do
+}
+
+#endif
index 4ab9cd7b05ecb8898fe3738ac3e21cf940e13049..a44f43ac9e74392c9b207f3a9def06d6ab40ee87 100644 (file)
@@ -22,7 +22,7 @@
 
 #include "mono/utils/mono-hwcap.h"
 
-#if defined(HAVE_SYS_AUXV_H) && !defined(PLATFORM_ANDROID)
+#if defined(HAVE_SYS_AUXV_H) && !defined(HOST_ANDROID)
 #include <sys/auxv.h>
 #elif defined(__APPLE__)
 #include <mach/machine.h>
@@ -38,7 +38,7 @@
 void
 mono_hwcap_arch_init (void)
 {
-#if defined(HAVE_SYS_AUXV_H) && !defined(PLATFORM_ANDROID)
+#if defined(HAVE_SYS_AUXV_H) && !defined(HOST_ANDROID)
        unsigned long hwcap;
        unsigned long platform;
 
diff --git a/mono/utils/mono-hwcap-wasm.c b/mono/utils/mono-hwcap-wasm.c
new file mode 100644 (file)
index 0000000..d7d78b0
--- /dev/null
@@ -0,0 +1,15 @@
+/**
+ * \file
+ * wasm feature detection
+ *
+ * Authors:
+ *    Rodrigo Kumpera (kumpera@gmail.com)
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
+ */
+
+#include "mono/utils/mono-hwcap.h"
+
+void
+mono_hwcap_arch_init (void)
+{
+}
index 1072788a6f5165885bbb8d15ec265449325cbbde..fba61f760776ab8c4b173410cbe9459aaff2cb10 100644 (file)
@@ -10,7 +10,7 @@
  */
 #include <config.h>
 
-#if defined (PLATFORM_ANDROID)
+#if defined (HOST_ANDROID)
 
 #include <android/log.h>
 #include "mono-logger-internals.h"
index e28b3f361035b0c13167140acc67cad724d3da60..4a83afd5228feebe46deafcc847a97dd234a5de6 100644 (file)
@@ -134,7 +134,7 @@ mono_trace_message(MonoTraceMask mask, const char *format, ...)
 
 #endif /* !__GNUC__ */
 
-#if defined (PLATFORM_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
+#if defined (HOST_ANDROID) || (defined (TARGET_IOS) && defined (TARGET_IOS))
 
 #define mono_gc_printf(gc_log_file, format, ...) g_log ("mono-gc", G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__)
 #define mono_runtime_printf(format, ...) g_log ("mono-rt", G_LOG_LEVEL_MESSAGE, format "\n", ##__VA_ARGS__)
@@ -184,7 +184,7 @@ void mono_log_open_logfile (const char *, void *);
 void mono_log_write_logfile (const char *, GLogLevelFlags, mono_bool, const char *);
 void mono_log_close_logfile (void);
 
-#if PLATFORM_ANDROID
+#if HOST_ANDROID
 void mono_log_open_logcat (const char *path, void *userData);
 void mono_log_write_logcat (const char *log_domain, GLogLevelFlags level, mono_bool hdr, const char *message);
 void mono_log_close_logcat (void);
index aeaa3f97ceefab0bc79fe685d042ade9a91d5368..d8d9e82ee44a2cb30bd060af3a51372a50001814 100644 (file)
@@ -154,7 +154,7 @@ mono_trace_set_logdest_string (const char *dest)
        if(level_stack == NULL)
                mono_trace_init();
 
-#if PLATFORM_ANDROID
+#if HOST_ANDROID
        logger.opener = mono_log_open_logcat;
        logger.writer = mono_log_write_logcat;
        logger.closer = mono_log_close_logcat;
index 3f937b3b43164c6f8a97015bcff49fc6632324b3..7abf273a6508693e915cd7976e0f7cc0f76b1209 100644 (file)
 
 #include <glib.h>
 
-#ifdef _MSC_VER
+
+#ifdef TARGET_WASM
+
+static inline void mono_memory_barrier (void)
+{
+}
+
+static inline void mono_memory_read_barrier (void)
+{
+}
+
+static inline void mono_memory_write_barrier (void)
+{
+}
+
+#elif _MSC_VER
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN
 #endif
index af8df3236f710ee1b3bf5c5bf0482c21386a4073..3fa797bbd99dcb06b756647189b34b4b1420d476 100644 (file)
@@ -380,13 +380,17 @@ mono_valloc_granule (void)
 void*
 mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
 {
-       return g_malloc (length);
+       g_assert (addr == NULL);
+       return mono_valloc_aligned (length, mono_pagesize (), flags, type);
 }
 
 void*
 mono_valloc_aligned (size_t size, size_t alignment, int flags, MonoMemAccountType type)
 {
-       g_assert_not_reached ();
+       void *res = NULL;
+       if (posix_memalign (&res, alignment, size))
+               return NULL;
+       return res;
 }
 
 #define HAVE_VALLOC_ALIGNED
index be1f64858863ba930c0340e6bfe44201e24b659f..eb7c4bb5b15377205e5b6e35705959d1b636ee66 100644 (file)
@@ -41,7 +41,7 @@ G_BEGIN_DECLS
 
 #if !defined(HOST_WIN32)
 
-#if !defined(CLOCK_MONOTONIC) || defined(PLATFORM_MACOSX) || defined(PLATFORM_ANDROID)
+#if !defined(CLOCK_MONOTONIC) || defined(HOST_DARWIN) || defined(HOST_ANDROID)
 #define BROKEN_CLOCK_SOURCE
 #endif
 
index e93eb7e53f0192a0249eae1d06a0ce1cf39a03fa..d0dd89b4c0da0525f0c71633119322b7bee8c7c6 100644 (file)
@@ -108,7 +108,7 @@ mono_path_canonicalize (const char *path)
  * This ensures that the path that we store points to the final file
  * not a path to a symlink.
  */
-#if !defined(PLATFORM_NO_SYMLINKS)
+#if !defined(HOST_NO_SYMLINKS)
 static gchar *
 resolve_symlink (const char *path)
 {
@@ -147,7 +147,7 @@ resolve_symlink (const char *path)
 gchar *
 mono_path_resolve_symlinks (const char *path)
 {
-#if defined(PLATFORM_NO_SYMLINKS)
+#if defined(HOST_NO_SYMLINKS)
        return mono_path_canonicalize (path);
 #else
        gchar **split = g_strsplit (path, G_DIR_SEPARATOR_S, -1);
index 5c5b891d607ab952d55bc3699d857566c6ce9c64..714d9eb7a245af19256c06d7629aa8be6609c950 100644 (file)
@@ -682,7 +682,7 @@ mono_process_current_pid ()
 int
 mono_cpu_count (void)
 {
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        /* Android tries really hard to save power by powering off CPUs on SMP phones which
         * means the normal way to query cpu count returns a wrong value with userspace API.
         * Instead we use /sys entries to query the actual hardware CPU count.
@@ -750,7 +750,7 @@ mono_cpu_count (void)
  * * use sched_getaffinity (+ fallback to _SC_NPROCESSORS_ONLN in case of error) on x86. This
  * ensures we're inline with what OpenJDK [4] and CoreCLR [5] do
  * * use _SC_NPROCESSORS_CONF exclusively on ARM (I think we could eventually even get rid of
- * the PLATFORM_ANDROID special case)
+ * the HOST_ANDROID special case)
  *
  * Helpful links:
  *
@@ -891,7 +891,7 @@ mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error)
 int
 mono_atexit (void (*func)(void))
 {
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        /* Some versions of android libc doesn't define atexit () */
        return 0;
 #else
index c067ce22512786dd24cfea7715080b2355f48063..479b8d4bf012b35782f41bfaa79fe8e74f0cc682 100644 (file)
@@ -6,7 +6,7 @@
 #define __MONO_MONO_SIGCONTEXT_H__
 
 #include <config.h>
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
 #include <asm/sigcontext.h>
 #endif
 
@@ -89,7 +89,7 @@
        #define UCONTEXT_REG_ESI(ctx) (((ucontext_t*)(ctx))->sc_esi)
        #define UCONTEXT_REG_EDI(ctx) (((ucontext_t*)(ctx))->sc_edi)
        #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->sc_eip)
-#elif defined(PLATFORM_SOLARIS)
+#elif defined(HOST_SOLARIS)
        #define UCONTEXT_REG_EAX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [EAX])
        #define UCONTEXT_REG_EBX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [EBX])
        #define UCONTEXT_REG_ECX(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [ECX])
        #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [EIP])
 #else
 
-#if defined(PLATFORM_ANDROID) && !defined(HAVE_UCONTEXT_H)
+#if defined(HOST_ANDROID) && !defined(HAVE_UCONTEXT_H)
 /* No ucontext.h as of NDK v6b */
 typedef int greg_t;
 #define NGREG 19
index c8c17a3d3cfc1cda13b0f7a25ce4d47340d2f14a..dd4307bca372d4e3158be6626852bf47395a802d 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <config.h>
 
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
 
 #include <pthread.h>
 #include <stdio.h>
index d757cd66c318ec6e87a072d2597e2606909d8c3c..e73b86084fc2b9830eb8775db3ee65f5fce376af 100644 (file)
@@ -4,7 +4,7 @@
 
 #include <config.h>
 
-#if (defined(__linux__) && !defined(PLATFORM_ANDROID)) || defined(__FreeBSD_kernel__)
+#if (defined(__linux__) && !defined(HOST_ANDROID)) || defined(__FreeBSD_kernel__)
 
 #include <mono/utils/mono-threads.h>
 #include <pthread.h>
index 289bd98cd66e2faa8c61063213ce5aba2de7d38e..5f762c83abe784c9b66e1457287e3e34ea1a2ac1 100644 (file)
@@ -62,7 +62,7 @@ signal_add_handler (int signo, void (*handler)(int, siginfo_t *, void *), int fl
 static int
 abort_signal_get (void)
 {
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
        return SIGTTIN;
 #elif defined (SIGRTMIN)
        static int abort_signum = -1;
@@ -79,7 +79,7 @@ abort_signal_get (void)
 static int
 suspend_signal_get (void)
 {
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
        return SIGPWR;
 #elif defined (SIGRTMIN)
        static int suspend_signum = -1;
@@ -98,7 +98,7 @@ suspend_signal_get (void)
 static int
 restart_signal_get (void)
 {
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
        return SIGXCPU;
 #elif defined (SIGRTMIN)
        static int restart_signum = -1;
@@ -244,7 +244,7 @@ mono_threads_suspend_init_signals (void)
        On 32bits arm Android, signals with values >=32 are not usable as their headers ship a broken sigset_t.
        See 5005c6f3fbc1da584c6a550281689cc23f59fe6d for more details.
        */
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
        g_assert (suspend_signal_num < 32);
        g_assert (restart_signal_num < 32);
        g_assert (abort_signal_num < 32);
index 138cc9e4b6aebd411ea1e0f75b88ce42b1cb5176..6804024e156a0a6a31ff4c9ff3db282344197a02 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <errno.h>
 
-#if defined(PLATFORM_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64)
+#if defined(HOST_ANDROID) && !defined(TARGET_ARM64) && !defined(TARGET_AMD64)
 #define USE_TKILL_ON_ANDROID 1
 #endif
 
@@ -30,7 +30,7 @@
 extern int tkill (pid_t tid, int signal);
 #endif
 
-#if defined(_POSIX_VERSION)
+#if defined(_POSIX_VERSION) && !defined (TARGET_WASM)
 
 #include <pthread.h>
 
@@ -295,7 +295,7 @@ mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
 void
 mono_threads_suspend_register (MonoThreadInfo *info)
 {
-#if defined (PLATFORM_ANDROID)
+#if defined (HOST_ANDROID)
        info->native_handle = gettid ();
 #endif
 }
diff --git a/mono/utils/mono-threads-wasm.c b/mono/utils/mono-threads-wasm.c
new file mode 100644 (file)
index 0000000..6ef8a9c
--- /dev/null
@@ -0,0 +1,60 @@
+#include "config.h"
+
+#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-mmap.h>
+
+#if defined (USE_WASM_BACKEND)
+
+#define round_down(addr, val) ((void*)((addr) & ~((val) - 1)))
+
+void
+mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize)
+{
+       *staddr = round_down ((size_t)&staddr, 65536); //WASM pagesize is 64k
+       *stsize = 65536 * 4; //we say it's 4 pages, there isn't much that uses this beyond the GC
+}
+
+void
+mono_threads_suspend_init_signals (void)
+{
+}
+
+void
+mono_threads_suspend_init (void)
+{
+}
+
+void
+mono_threads_suspend_register (MonoThreadInfo *info)
+{
+}
+
+gboolean
+mono_threads_suspend_begin_async_resume (MonoThreadInfo *info)
+{
+       return TRUE;
+}
+
+void
+mono_threads_suspend_free (MonoThreadInfo *info)
+{
+}
+
+gboolean
+mono_threads_suspend_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+{
+       return TRUE;
+}
+
+gboolean
+mono_threads_suspend_check_suspend_result (MonoThreadInfo *info)
+{
+       return TRUE;
+}
+
+void
+mono_threads_suspend_abort_syscall (MonoThreadInfo *info)
+{
+}
+
+#endif
index e26ca1760c6fb49214c735925a064146b8005ec7..9ba005e01b5bd26800a8e5d16c9d7ababe8eeb43 100644 (file)
@@ -1313,7 +1313,7 @@ mono_thread_info_sleep (guint32 ms, gboolean *alerted)
                } while (1);
        } else {
                int ret;
-#if defined (__linux__) && !defined(PLATFORM_ANDROID)
+#if defined (__linux__) && !defined(HOST_ANDROID)
                struct timespec start, target;
 
                /* Use clock_nanosleep () to prevent time drifting problems when nanosleep () is interrupted by signals */
index ff3b40ed525e236b1fcafdeea25aaac9f4015620..ffa9de63a66e5468d8cd5fe58989202cb73755b1 100644 (file)
@@ -109,7 +109,9 @@ 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)
+#ifdef HOST_WASM
+#define USE_WASM_BACKEND
+#elif defined (_POSIX_VERSION)
 #if defined (__MACH__) && !defined (USE_SIGNALS_ON_MACH)
 #define USE_MACH_BACKEND
 #else
index ddca2c9ebb80d732c5697fdc97f2fa6858ddcdee..4a3b2705563e98068832db9c688e5267af79f0d6 100644 (file)
@@ -84,7 +84,7 @@ mono_100ns_datetime (void)
 #include <sys/sysctl.h>
 #endif
 
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
 #include <mach/mach.h>
 #include <mach/mach_time.h>
 #endif
@@ -143,7 +143,7 @@ gint64
 mono_100ns_ticks (void)
 {
        struct timeval tv;
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
        /* http://developer.apple.com/library/mac/#qa/qa1398/_index.html */
        static mach_timebase_info_data_t timebase;
        guint64 now = mach_absolute_time ();
index 5b812ac5b9894555db85458dc774f2c3acf74318..19114ac61051812767258e9aee684f6fc99efe57 100644 (file)
@@ -3,6 +3,12 @@
  * Contains inline functions to explicitly mark data races that should not be changed.
  * This way, instruments like Clang's ThreadSanitizer can be told to ignore very specific instructions.
  *
+ * Please keep this file and its methods organised:
+ *  * Increment, Decrement, Add, Subtract, Write, Read
+ *  * gint32 (""), guint32 ("Unsigned"),
+ *      gint64 ("64"), guint64 ("Unsigned64"),
+ *      gsize ("Size"), gboolean ("Bool")
+ *
  * Licensed under the MIT license. See LICENSE file in the project root for full license information.
  */
 
@@ -25,18 +31,46 @@ UnlockedIncrement (gint32 *val)
        return ++*val;
 }
 
+MONO_UNLOCKED_ATTRS
+gint32
+UnlockedAdd (gint32 *dest, gint32 add)
+{
+       return *dest += add;
+}
+
 MONO_UNLOCKED_ATTRS
 gint64
-UnlockedIncrement64 (gint64 *val)
+UnlockedAdd64 (gint64 *dest, gint64 add)
 {
-       return ++*val;
+       return *dest += add;
 }
 
 MONO_UNLOCKED_ATTRS
-gsize
-UnlockedIncrementSize (gsize *val)
+gint64
+UnlockedSubtract64 (gint64 *dest, gint64 sub)
 {
-       return ++*val;
+       return *dest -= sub;
+}
+
+MONO_UNLOCKED_ATTRS
+void
+UnlockedWrite (gint32 *dest, gint32 val)
+{
+       *dest = val;
+}
+
+MONO_UNLOCKED_ATTRS
+gint32
+UnlockedRead (gint32 *src)
+{
+       return *src;
+}
+
+MONO_UNLOCKED_ATTRS
+gint64
+UnlockedRead64 (gint64 *src)
+{
+       return *src;
 }
 
 #endif /* _UNLOCKED_H_ */
index bfb2c70ddbb74ec79e952a456fe2f6893be02da9..7c81fc62459369732498211ba9b5084e11bd888e 100644 (file)
@@ -1,8 +1,8 @@
 GitHubTarballPackage(
     'mono',
     'libgdiplus',
-    '5.4',
-    '350eb49a45ca5a7383c01d49df72438347a5dbc9',
+    '5.6',
+    'f07965ec5fc2b22bfb300d5fef410d25ae472a34',
     configure='CFLAGS="%{gcc_flags} %{local_gcc_flags} -I/opt/X11/include" ./autogen.sh --prefix="%{package_prefix}"',
     override_properties={
         'make': 'C_INCLUDE_PATH="" make'})
index 751994f004eb36762e1de714cef3089f76835f15..0eb54930aa06a576dfb14e9f8f3d4317f847168f 100644 (file)
@@ -3,7 +3,7 @@ import fileinput
 class MSBuild (GitHubPackage):
        def __init__ (self):
                GitHubPackage.__init__ (self, 'mono', 'msbuild', '15.4',
-                       revision = 'e497ddc04f507d9d8b6db399c3cff975cd4529de')
+                       revision = 'c907a5182a101624eb58e73fb24f97666abf477a')
 
        def build (self):
                self.sh ('./cibuild.sh --scope Compile --target Mono --host Mono --config Release')
index ca729ee9d871eebb7e03a38a831c6a3915b3b038..f62b3f3b9b8231b291177ed0057e129ffe691d91 100644 (file)
@@ -17,6 +17,7 @@ ClassInitGenerator
 csc
 csharp
 csharp2
+csi
 dbsessmgr
 dbsessmgr2
 dbsessmgr4
@@ -109,7 +110,6 @@ pdb2mdb
 pedump
 permview
 peverify
-prj2make
 resgen
 resgen2
 secutil
index ae98eefdd2e128635e5d84ed8489cafdb41e4703..87f293f7b798633a7f736bd8d6ffc37622d90179 100755 (executable)
@@ -21,7 +21,7 @@ download()
        report "Downloading x64 hostfxr.dll"
        wget --quiet -O ${REPODIR}/hostfxr-x64.zip https://www.nuget.org/api/v2/package/runtime.win-x64.Microsoft.NETCore.DotNetHostResolver/2.0.0-preview2-25407-01 || error "*** Could not download 64bit hostfxr.dll ***"
        report "Downloading x86 hostfxr.dll"
-       wget --quiet -O ${REPODIR}/hostfxr-x86.zip https://www.nuget.org/api/v2/package/runtime.win-x86.Microsoft.NETCore.DotNetHostResolver/2.0.0-preview2-25407-01 || error "*** Could not download 64bit hostfxr.dll ***"
+       wget --quiet -O ${REPODIR}/hostfxr-x86.zip https://www.nuget.org/api/v2/package/runtime.win-x86.Microsoft.NETCore.DotNetHostResolver/2.0.0-preview2-25407-01 || error "*** Could not download 32bit hostfxr.dll ***"
        report "Copying Mono MDK for Mac"
        cp $1 ${REPODIR}/mono.xar
 }
index aa7f81f83400cc76e2150b4d3331fbc960d43d7f..62117188f0b9be367d47b02347b51f7b8c6ed0d6 100755 (executable)
@@ -56,6 +56,7 @@ install()
        cp -a msvc/build/sgen/Win32/bin/Release/mono-2.0-sgen.dll       ${INSTALLDIR}/bin/
        cp -a msvc/build/sgen/Win32/lib/Release/mono-2.0-sgen.lib       ${INSTALLDIR}/lib/
        cp -a msvc/build/sgen/Win32/bin/Release/mono-2.0-sgen.pdb       ${INSTALLDIR}/lib/
+       cp -a msvc/build/sgen/Win32/lib/Release/libmono-static-sgen.lib ${INSTALLDIR}/lib/
        cp -a msvc/build/sgen/Win32/bin/Release/MonoPosixHelper.dll     ${INSTALLDIR}/bin/
        cp -a msvc/build/sgen/Win32/lib/Release/MonoPosixHelper.lib     ${INSTALLDIR}/lib/
        cp -a msvc/build/sgen/Win32/bin/Release/MonoPosixHelper.pdb     ${INSTALLDIR}/lib/
@@ -64,6 +65,7 @@ install()
        cp -a msvc/build/boehm/Win32/bin/Release/mono-2.0-boehm.dll     ${INSTALLDIR}/bin/
        cp -a msvc/build/boehm/Win32/lib/Release/mono-2.0-boehm.lib     ${INSTALLDIR}/lib/
        cp -a msvc/build/boehm/Win32/bin/Release/mono-2.0-boehm.pdb     ${INSTALLDIR}/lib/
+       cp -a msvc/build/boehm/Win32/lib/Release/libmono-static-boehm.lib       ${INSTALLDIR}/lib/
        cp -a ${INSTALLDIR}/bin/mono-sgen.exe   ${INSTALLDIR}/bin/mono.exe
        cp -a ${INSTALLDIR}/bin/mono-sgen.pdb   ${INSTALLDIR}/bin/mono.pdb
        popd
index 2d7dcc5f8d852b91b05fa4a9552a9b24f74c7731..d5a7362da3411564148d7a28ea2cf39ae8b9deef 100755 (executable)
@@ -56,6 +56,7 @@ install()
        cp -a msvc/build/sgen/x64/bin/Release/mono-2.0-sgen.dll ${INSTALLDIR}/bin/
        cp -a msvc/build/sgen/x64/lib/Release/mono-2.0-sgen.lib ${INSTALLDIR}/lib/
        cp -a msvc/build/sgen/x64/bin/Release/mono-2.0-sgen.pdb ${INSTALLDIR}/lib/
+       cp -a msvc/build/sgen/x64/lib/Release/libmono-static-sgen.lib   ${INSTALLDIR}/lib/
        cp -a msvc/build/sgen/x64/bin/Release/MonoPosixHelper.dll       ${INSTALLDIR}/bin/
        cp -a msvc/build/sgen/x64/lib/Release/MonoPosixHelper.lib       ${INSTALLDIR}/lib/
        cp -a msvc/build/sgen/x64/bin/Release/MonoPosixHelper.pdb       ${INSTALLDIR}/lib/
index f7f8b3fe0e2c0cfd7a429d6a2c01942b2407dc68..0c479324de92ea89389d6f4964173aebead542c1 100644 (file)
@@ -11,6 +11,7 @@
 /chktrust
 /cilc
 /crlupdate
+/csi
 /csharp
 /csharp2
 /disco
index b208d06d1f76a2651c321bc32ab7b4cc518369ee..9f792fd13655e10345e1d65dc48350d1ad4a0ba1 100644 (file)
@@ -72,7 +72,6 @@ scripts_4_0 = \
        macpack$(SCRIPT_SUFFIX)                 \
        mdoc$(SCRIPT_SUFFIX)                    \
        mono-cil-strip$(SCRIPT_SUFFIX)          \
-       prj2make$(SCRIPT_SUFFIX)                \
        soapsuds$(SCRIPT_SUFFIX)                \
        caspol$(SCRIPT_SUFFIX)                  \
        cert-sync$(SCRIPT_SUFFIX)               \
index b066d462b167c0a3121486d462612e3e050fb171..76b4b388e9862170e2647ed127d1bf71017f1fbd 100644 (file)
@@ -86,7 +86,7 @@ Mono_Posix_Syscall_strerror_r (int errnum, char *buf, mph_size_t n)
        mph_return_if_size_t_overflow (n);
 
        /* first, check for valid errnum */
-#if PLATFORM_ANDROID
+#if HOST_ANDROID
        /* Android NDK defines _GNU_SOURCE but strerror_r follows the XSI semantics
         * not the GNU one. XSI version returns an integer, as opposed to the GNU one
         * which returns pointer to the buffer.
index 141b675c01097f4e4e087756810cb5f5108bfa5c..e5992e5e71f03357080123ffb7a460016db8c488 100644 (file)
  * OS X doesn't define MAP_ANONYMOUS, but it does define MAP_ANON.
  * Alias them to fix: https://bugzilla.xamarin.com/show_bug.cgi?id=3419
  */
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
 #ifndef MAP_ANONYMOUS
 #define MAP_ANONYMOUS MAP_ANON
 #endif  /* ndef MAP_ANONYMOUS */
-#endif  /* ndef PLATFORM_MACOSX */
+#endif  /* ndef HOST_DARWIN */
 
 /*
  * XATTR_AUTO is a synonym for 0 within XattrFlags, but most systems don't
index afbe46624447d87a05a10d44e367427e0b45311d..143148f8ca3c0e345657eb62bd406252a157f935 100644 (file)
@@ -13,7 +13,7 @@
 #define _XOPEN_SOURCE 600
 #endif
 
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
 /* For mincore () */
 #define _DARWIN_C_SOURCE
 #endif
index 3edf7be4163bac5febd12a6987d64dfbaa5d2b86..7b6797acb04160a9b17fdc038389dfaece9dae5a 100644 (file)
@@ -31,7 +31,7 @@ Mono_Posix_Syscall_sendfile (int out_fd, int in_fd, mph_off_t *offset, mph_size_
 
        _offset = *offset;
 
-#if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD)
+#if defined(HOST_DARWIN) || defined(HOST_BSD)
        /* The BSD version has 6 arguments */
        g_assert_not_reached ();
 #else
index 1123f2bc0fac9112b60e8f398e11b685eb59783c..0f560e28d00afcb0eaefd31c415b2ca018bdfc29 100644 (file)
@@ -230,7 +230,7 @@ Mono_Posix_Syscall_setdomainname (const char *name, mph_size_t len)
 /* Android implements truncate, but doesn't declare it.
  * Result is a warning during compilation, so skip it.
  */
-#ifndef PLATFORM_ANDROID
+#ifndef HOST_ANDROID
 gint32
 Mono_Posix_Syscall_truncate (const char *path, mph_off_t length)
 {
index 1a53e3772b7a01686881710930f90104034ccfda..b64d44c231e6de3172bc4c1c9a3ee79d5bec59e5 100644 (file)
@@ -38,7 +38,7 @@ monograph_LDADD = \
        $(LIBICONV)                     \
        -lm
 
-if PLATFORM_DARWIN
+if HOST_DARWIN
 monograph_LDFLAGS=-framework CoreFoundation
 endif
 
index 05b30f25975919693cfcac349c3fad47f9c08492..4df4d768ff470719ccc2cc23dcc2cbc0a586c797 100644 (file)
@@ -10,13 +10,16 @@ nuget-hash-extractor.exe: $(SOURCES)
 
 download: .download_stamp_file
 
-run: download nuget-hash-extractor.exe exec-ver exec-asm
+run: download nuget-hash-extractor.exe exec-ver exec-asm exec-msbuild
 
 run-asm: download nuget-hash-extractor.exe exec-asm
 
 exec-asm:
        mono nuget-hash-extractor.exe nugets asm
 
+exec-msbuild:
+       mono nuget-hash-extractor.exe nugets guids_for_msbuild
+
 run-ver: download nuget-hash-extractor.exe exec-ver
 
 exec-ver:
index aee4e36d21271fd6c9d0af819edcb1ca8a57bb57..3e413ea253107644245ceff1bfca38695d987e78 100755 (executable)
@@ -1,5 +1,20 @@
 mkdir nugets
 
+##
+## Following are nugets which have net4* implementation but that implementation is Windows specific and won’t work on Mono or
+## with any profile derived from Mono net_4_x profile like Xamarin.Mac. This is due to no TFM for Mono or Xamarin.Mac which
+## would allow us to customize the behaviors.
+##
+## We don’t want to fix all broken nugets we only focus on few system-like that are likely to be used by broad audience and
+## we have working implementation available in one of Mono assemblies.
+##
+## PLEASE keep this in sync with mcs/tools/xbuild/data/deniedAssembliesList.txt
+##
+## If any nugets are added or removed here, then make sure to regenerate the above file with:
+##
+##   $ mono nuget-hash-extractor.exe nugets guids_for_msbuild > ../../mcs/tools/xbuild/data/deniedAssembliesList.txt
+##
+
 #System.Runtime.InteropServices.RuntimeInformation
 wget https://www.nuget.org/api/v2/package/System.Runtime.InteropServices.RuntimeInformation/4.3.0 -O nugets/system.runtime.interopservices.runtimeinformation.4.3.0.nupkg
 wget https://www.nuget.org/api/v2/package/System.Runtime.InteropServices.RuntimeInformation/4.0.0 -O nugets/system.runtime.interopservices.runtimeinformation.4.0.0.nupkg
@@ -23,20 +38,14 @@ wget https://www.nuget.org/api/v2/package/System.Net.Http/4.1.0 -O nugets/system
 wget https://www.nuget.org/api/v2/package/System.Net.Http/4.0.0 -O nugets/system.net.http.4.0.0.nupkg
 
 #System.Text.Encoding.CodePages
+wget https://www.nuget.org/api/v2/package/System.Text.Encoding.CodePages/4.4.0 -O nugets/system.text.encoding.codepages.4.4.0.nupkg
 wget https://www.nuget.org/api/v2/package/System.Text.Encoding.CodePages/4.3.0 -O nugets/system.text.encoding.codepages.4.3.0.nupkg
 wget https://www.nuget.org/api/v2/package/System.Text.Encoding.CodePages/4.0.1 -O nugets/system.text.encoding.codepages.4.0.1.nupkg
 wget https://www.nuget.org/api/v2/package/System.Text.Encoding.CodePages/4.0.0 -O nugets/system.text.encoding.codepages.4.0.0.nupkg
 
-#System.Reflection.DispatchProxy
-wget https://www.nuget.org/api/v2/package/System.Reflection.DispatchProxy/4.3.0 -O nugets/system.reflection.dispatchproxy.4.3.0.nupkg
-wget https://www.nuget.org/api/v2/package/System.Reflection.DispatchProxy/4.0.1 -O nugets/system.reflection.dispatchproxy.4.0.1.nupkg
-wget https://www.nuget.org/api/v2/package/System.Reflection.DispatchProxy/4.0.0 -O nugets/system.reflection.dispatchproxy.4.0.0.nupkg
-
 #System.Threading.Overlapped
 wget https://www.nuget.org/api/v2/package/System.Threading.Overlapped/4.3.0 -O nugets/system.threading.overlapped.4.3.0.nupkg
 wget https://www.nuget.org/api/v2/package/System.Threading.Overlapped/4.0.1 -O nugets/system.threading.overlapped.4.0.1.nupkg
 wget https://www.nuget.org/api/v2/package/System.Threading.Overlapped/4.0.0 -O nugets/system.threading.overlapped.4.0.0.nupkg
 
-#System.Security.Cryptography.OpenSsl when .net 4.6.2 + 1 is out
-
 touch .download_stamp_file
index 517cdbd0de4b786cb714fbd70a3de33f3d9eb366..81c438f810af4e969dfb95dccf4da9fc120f8f9f 100644 (file)
@@ -126,7 +126,7 @@ namespace CppSharp
                 });*/
 
             foreach (var target in AndroidTargets)
-                target.Defines.AddRange (new string[] { "PLATFORM_ANDROID",
+                target.Defines.AddRange (new string[] { "HOST_ANDROID",
                     "TARGET_ANDROID", "MONO_CROSS_COMPILE", "USE_MONO_CTX"
                 });
         }
@@ -148,7 +148,7 @@ namespace CppSharp
             });
 
             foreach (var target in iOSTargets) {
-                target.Defines.AddRange (new string[] { "PLATFORM_DARWIN",
+                target.Defines.AddRange (new string[] { "HOST_DARWIN",
                     "TARGET_IOS", "TARGET_MACH", "MONO_CROSS_COMPILE", "USE_MONO_CTX",
                     "_XOPEN_SOURCE"
                 });
@@ -162,7 +162,7 @@ namespace CppSharp
             });
 
             foreach (var target in DarwinTargets) {
-                target.Defines.AddRange (new string[] { "PLATFORM_DARWIN",
+                target.Defines.AddRange (new string[] { "HOST_DARWIN",
                     "TARGET_IOS", "TARGET_MACH", "MONO_CROSS_COMPILE", "USE_MONO_CTX",
                     "_XOPEN_SOURCE"
                 });
index 4fb8260abdb5eabf4910592d391487d1e3310721..7a2776c851421bcac377310c5bf2ac9627e7335c 100644 (file)
@@ -25,6 +25,6 @@ pedump_LDADD =                        \
        $(GLIB_LIBS)                    \
        $(LIBICONV)
 
-if PLATFORM_DARWIN
+if HOST_DARWIN
 pedump_LDFLAGS=-framework CoreFoundation -framework Foundation
 endif
index 322185faaf7dfd8049a94c213c41a76be9beb4b7..b75a8fed5bed87dc07e631fadb9fac3063039a14 100644 (file)
@@ -42,6 +42,8 @@ gboolean verify_metadata = FALSE;
 gboolean verify_code = FALSE;
 gboolean verify_partial_md = FALSE;
 
+static char *assembly_directory[2];
+
 static MonoAssembly *pedump_preload (MonoAssemblyName *aname, gchar **assemblies_path, gpointer user_data);
 static void pedump_assembly_load_hook (MonoAssembly *assembly, gpointer user_data);
 static MonoAssembly *pedump_assembly_search_hook (MonoAssemblyName *aname, gpointer user_data);
@@ -348,7 +350,7 @@ dump_dotnet_iinfo (MonoImage *image)
 }
 
 static int
-dump_verify_info (MonoImage *image, int flags)
+dump_verify_info (MonoImage *image, int flags, gboolean valid_only)
 {
        GSList *errors, *tmp;
        int count = 0, verifiable = 0;
@@ -387,6 +389,9 @@ dump_verify_info (MonoImage *image, int flags)
 
                        for (tmp = errors; tmp; tmp = tmp->next) {
                                MonoVerifyInfo *info = (MonoVerifyInfo *)tmp->data;
+                               if (info->status == MONO_VERIFY_NOT_VERIFIABLE && valid_only)
+                                       continue;
+
                                g_print ("%s: %s\n", desc [info->status], info->message);
                                if (info->status == MONO_VERIFY_ERROR) {
                                        count++;
@@ -426,51 +431,83 @@ verify_image_file (const char *fname)
                "Ok", "Error", "Warning", NULL, "CLS", NULL, NULL, NULL, "Not Verifiable"
        };
 
-       image = mono_image_open_raw (fname, &status);
-       if (!image) {
-               printf ("Could not open %s\n", fname);
-               return 1;
-       }
+       if (!strstr (fname, "mscorlib.dll")) {
+               image = mono_image_open_raw (fname, &status);
+               if (!image) {
+                       printf ("Could not open %s\n", fname);
+                       return 1;
+               }
 
-       if (!mono_verifier_verify_pe_data (image, &errors))
-               goto invalid_image;
+               if (!mono_verifier_verify_pe_data (image, &errors))
+                       goto invalid_image;
 
-       if (!mono_image_load_pe_data (image)) {
-               printf ("Could not load pe data for assembly %s\n", fname);
-               return 1;
-       }
+               if (!mono_image_load_pe_data (image)) {
+                       printf ("Could not load pe data for assembly %s\n", fname);
+                       return 1;
+               }
 
-       if (!mono_verifier_verify_cli_data (image, &errors))
-               goto invalid_image;
+               if (!mono_verifier_verify_cli_data (image, &errors))
+                       goto invalid_image;
 
-       if (!mono_image_load_cli_data (image)) {
-               printf ("Could not load cli data for assembly %s\n", fname);
-               return 1;
-       }
+               if (!mono_image_load_cli_data (image)) {
+                       printf ("Could not load cli data for assembly %s\n", fname);
+                       return 1;
+               }
 
-       if (!mono_verifier_verify_table_data (image, &errors))
-               goto invalid_image;
+               if (!mono_verifier_verify_table_data (image, &errors))
+                       goto invalid_image;
 
-       mono_image_load_names (image);
+               mono_image_load_names (image);
 
-       /*fake an assembly for class loading to work*/
-       assembly = g_new0 (MonoAssembly, 1);
-       assembly->in_gac = FALSE;
-       assembly->image = image;
-       image->assembly = assembly;
-       mono_assembly_fill_assembly_name (image, &assembly->aname);
+               /*fake an assembly for class loading to work*/
+               assembly = g_new0 (MonoAssembly, 1);
+               assembly->in_gac = FALSE;
+               assembly->image = image;
+               image->assembly = assembly;
+               mono_assembly_fill_assembly_name (image, &assembly->aname);
 
-       /*Finish initializing the runtime*/
-       mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
-       mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
+               /*Finish initializing the runtime*/
+               mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
+               mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
 
-       mono_init_version ("pedump", image->version);
+               mono_init_version ("pedump", image->version);
 
-       mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
+               mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
 
-       mono_icall_init ();
-       mono_marshal_init ();
+               mono_icall_init ();
+               mono_marshal_init ();
+       } else {
+               /*Finish initializing the runtime*/
+               mono_install_assembly_load_hook (pedump_assembly_load_hook, NULL);
+               mono_install_assembly_search_hook (pedump_assembly_search_hook, NULL);
 
+               mono_init_version ("pedump", NULL);
+
+               mono_install_assembly_preload_hook (pedump_preload, GUINT_TO_POINTER (FALSE));
+
+               mono_icall_init ();
+               mono_marshal_init ();
+               image = mono_get_corlib ();
+
+               if (!mono_verifier_verify_pe_data (image, &errors))
+                       goto invalid_image;
+
+               if (!mono_image_load_pe_data (image)) {
+                       printf ("Could not load pe data for assembly %s\n", fname);
+                       return 1;
+               }
+
+               if (!mono_verifier_verify_cli_data (image, &errors))
+                       goto invalid_image;
+
+               if (!mono_image_load_cli_data (image)) {
+                       printf ("Could not load cli data for assembly %s\n", fname);
+                       return 1;
+               }
+
+               if (!mono_verifier_verify_table_data (image, &errors))
+                       goto invalid_image;
+       }
 
        if (!verify_partial_md && !mono_verifier_verify_full_table_data (image, &errors))
                goto invalid_image;
@@ -600,6 +637,8 @@ pedump_preload (MonoAssemblyName *aname,
        if (assemblies_path && assemblies_path [0] != NULL) {
                result = real_load (assemblies_path, aname->culture, aname->name, refonly);
        }
+       if (!result)
+               result = real_load (assembly_directory, aname->culture, aname->name, refonly);
 
        return result;
 }
@@ -669,6 +708,12 @@ main (int argc, char *argv [])
        if (!file)
                usage ();
 
+       //We have to force the runtime to load the corlib under verification as its own corlib so core types are properly populated in mono_defaults.
+       if (strstr (file, "mscorlib.dll"))
+               g_setenv ("MONO_PATH", g_path_get_dirname (file), 1);
+       assembly_directory [0] = g_path_get_dirname (file);
+       assembly_directory [1] = NULL;
+
 #ifndef DISABLE_PERFCOUNTERS
        mono_perfcounters_init ();
 #endif
@@ -764,7 +809,7 @@ main (int argc, char *argv [])
                        return 4;
                }
 
-               code_result = dump_verify_info (assembly->image, verify_flags);
+               code_result = dump_verify_info (assembly->image, verify_flags, verifier_mode == MONO_VERIFIER_MODE_VALID);
                return code_result ? code_result : image_result;
        } else
                mono_image_close (image);
index 97d9f4c433a1a6462c6e92f3b25e7bd83098f713..00edfeec2f7bd4b97fcf92d01db189f9e93b607e 100644 (file)
@@ -55,7 +55,7 @@
 #define DISABLE_PORTABILITY 1
 
 /* Windows does not have symlinks */
-#define PLATFORM_NO_SYMLINKS 1
+#define HOST_NO_SYMLINKS 1
 
 /* String of disabled features */
 #define DISABLED_FEATURES "none"