[profiler] Fix some stack imbalance issues due to missing method leave events.
# 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
* 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
=======================
#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
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
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"
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=
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
;;
*-*-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"
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
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)
libdl="-ldl"
;;
esac
+
+# WASM hack
+fi
+
AC_MSG_RESULT(ok)
if test x$need_link_unlink = 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])
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
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;
;;
esac
+#WASM hack
+fi
dnl *************
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)
<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" />
-Subproject commit 2563306d41f7f7fa30421c629d0f3b60b08b1169
+Subproject commit bf03a7c5cf6b692fa662f1568ad66de35166b8ea
-Subproject commit 47f82456814a05b077e31b58d66c1e4c640aac79
+Subproject commit f2c8f2e7fb17e8a55b6679c7d13e3634ec45c639
# 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;
/* 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 */
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)
{
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);
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);
}
if (result == 0) return(0);
result -> id = id;
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
result -> kernel_id = gettid();
#endif
result -> next = GC_threads[hv];
[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))]
[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))]
[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))]
+++ /dev/null
-Mono.Directory.LDAP/BindSimpleTest.cs
-Mono.Directory.LDAP/QueryRootDSETest.cs
//
// 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.
return null;
foreach (X509Certificate certificate in this.Context.ClientSettings.Certificates) {
- if (cert.GetName () == cert.GetIssuerName ())
+ if (certificate.GetName () == cert.GetIssuerName ())
return certificate;
}
return null;
+++ /dev/null
-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
{
}
+ 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 ()
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
+
namespace Microsoft.Win32.SafeHandles
{
public sealed class SafeNCryptKeyHandle : SafeNCryptHandle
{
}
+ public SafeNCryptKeyHandle (IntPtr handle, System.Runtime.InteropServices.SafeHandle parentHandle)
+ : base (handle, parentHandle)
+ {
+
+ }
+
protected override bool ReleaseNativeHandle ()
{
return false;
../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
../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
+++ /dev/null
-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
+++ /dev/null
-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
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"};
+++ /dev/null
---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
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;
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;
}
}
}
*
*/
- 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)
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
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)
}
}
+ 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);
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";
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";
object socketLock = new object ();
IWebConnectionState state;
WebExceptionStatus status;
- WaitCallback initConn;
bool keepAlive;
byte [] buffer;
EventHandler abortHandler;
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");
+ }
}
}
--- /dev/null
+//
+// 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");
+ }
+
+ }
+}
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");
}
[Test]
- [Category ("NotWorking")]
public void GetString_Odd_Count_0 ()
{
byte [] array = new byte [3];
}
[Test]
- [Category ("NotWorking")]
public void GetString_Odd_Count_ff ()
{
byte [] array = new byte [3] { 0xff, 0xff, 0xff };
{
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]
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
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
throw new NotImplementedException ();
}
+ public CngAlgorithm HashAlgorithm { get; set; }
+
public CngKey Key {
get {
throw new NotImplementedException ();
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) };
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;
--- /dev/null
+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
</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">
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;
}
+++ /dev/null
--o SqlSharpCli.exe
-SqlSharpCli.cs
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
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
$(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 \
"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 \
--- /dev/null
+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
$(GLIB_LIBS) \
$(LIBICONV)
-if PLATFORM_DARWIN
+if HOST_DARWIN
monodis_LDFLAGS=-framework CoreFoundation -framework Foundation
endif
if HOST_WIN32
libeglib_la_LIBADD = -lm $(LIBICONV) -lpsapi
else
-if PLATFORM_ANDROID
+if HOST_ANDROID
libeglib_la_LIBADD = -llog
endif
endif
exit (0);
}
-#if PLATFORM_ANDROID
+#if HOST_ANDROID
#include <android/log.h>
static android_LogPriority
platform_sources = $(unix_sources)
endif
-if PLATFORM_ANDROID
+if HOST_ANDROID
platform_sources += ../../support/libm/complex.c
endif
#include <sys/stat.h>
#endif
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
#include <mach-o/dyld.h>
#endif
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
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;
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 */
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));
}
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;
}
#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
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
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;
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:
#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;
}
}
- UnlockedIncrementSize (&mono_stats.inflated_type_count);
+ UnlockedIncrement (&mono_stats.inflated_type_count);
return inflated;
}
if (!inflated)
return type;
- UnlockedIncrementSize (&mono_stats.inflated_type_count);
+ UnlockedIncrement (&mono_stats.inflated_type_count);
return inflated;
}
return (MonoMethod*)cached;
}
- UnlockedIncrementSize (&mono_stats.inflated_method_count);
+ UnlockedIncrement (&mono_stats.inflated_method_count);
inflated_methods_size += sizeof (MonoMethodInflated);
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)) {
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;
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;
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
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 : "");
}
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)
{
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);
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 ();
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
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
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 {
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 {
"System.IO.Compression.dll",
"System.Net.Http.dll",
"System.Text.Encoding.CodePages.dll",
- "System.Reflection.DispatchProxy.dll",
"System.Threading.Overlapped.dll"
};
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")
"System.IO.Compression",
"System.Net.Http",
"System.Text.Encoding.CodePages",
- "System.Reflection.DispatchProxy",
"System.Threading.Overlapped"
};
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),
#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>
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
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);
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);
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;
methods_size += sizeof (MonoMethod);
}
- mono_stats.method_count ++;
+ InterlockedIncrement (&mono_stats.method_count);
result->slot = -1;
result->klass = klass;
mono_gchandle_free (gchandle);
- mono_raise_exception (exc);
+ mono_reraise_exception (exc);
}
/*
#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
} d;
};
-static long total_bytes_allocated = 0;
+static gint64 total_bytes_allocated = 0;
/**
* mono_mempool_new:
/**
* 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)
{
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) {
/**
* 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
*
*
* \returns the address of a newly allocated memory block.
*/
-MONO_NO_SANITIZE_THREAD
gpointer
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 {
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;
long
mono_mempool_get_bytes_allocated (void)
{
- return total_bytes_allocated;
+ return UnlockedRead64 (&total_bytes_allocated);
}
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");
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;
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));
/*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);
+ }
}
}
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)
{
{
verify_typeref_table (ctx);
verify_typeref_table_global_constraints (ctx);
+ verify_methodimpl_table_global_constraints (ctx);
}
static 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)
#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"
#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"
* 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>
return 0;
}
-#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */
+#endif /* #if defined(HOST_DARWIN) || defined(HOST_BSD) */
#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>
/* 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__ */
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);
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);
// 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)
#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);
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
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++) {
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);
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;
}
#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
}
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);
/* 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) {
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;
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)
{
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))) {
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);
*/
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);
}
}
#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
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;
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);
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;
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))
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);
#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
#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)
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);
}
#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
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;
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));
#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
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);
} _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" },
}
#endif
-#if defined (PLATFORM_MACOSX) || defined (__linux__)
+#if defined (HOST_DARWIN) || defined (__linux__)
static guint32
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);
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;
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];
#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
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;
* 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
{
#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)
goto done;
}
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
handler = g_strdup ("/usr/bin/open");
#else
/*
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.
//
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
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)
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
void
mono_aot_handle_pagefault (void *ptr)
{
-#ifndef PLATFORM_WIN32
+#ifndef HOST_WIN32
guint8* start = (guint8*)ROUND_DOWN (((gssize)ptr), mono_pagesize ());
int res;
#include <ws2tcpip.h>
#endif
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
#include <linux/in.h>
#include <linux/tcp.h>
#include <sys/endian.h>
#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)
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)
{
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
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){
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) {
#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
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
+ }
}
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);
/* 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);
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))) {
}
}
+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.
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:
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:
#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"
}
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)));
#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"
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
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);
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;
* 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 ();
#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
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 ();
mono_runtime_printf ("%s", text->str);
-#if PLATFORM_WIN32 && TARGET_WIN32 && _DEBUG
+#if HOST_WIN32 && TARGET_WIN32 && _DEBUG
OutputDebugStringA(text->str);
#endif
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)
{
#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))
/* 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;
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;
}
/* 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;
}
/* 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 */
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);
}
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;
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;
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
/*
* 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
#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>
}
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);
#include "jit-icalls.h"
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
#include <mach/mach.h>
#include <mach/mach_time.h>
#include <mach/clock.h>
return FALSE;
}
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
void
mono_runtime_install_handlers (void)
{
#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) {
add_signal_handler (SIGSEGV, mono_sigsegv_signal_handler, 0);
}
-#ifndef PLATFORM_MACOSX
+#ifndef HOST_DARWIN
void
mono_runtime_install_handlers (void)
{
static volatile gint32 sampling_thread_running;
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
static clock_serv_t sampling_clock_service;
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
* 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
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
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
#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
}
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);
#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>
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
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)
{
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;
#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"
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);
#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"
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);
#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"
}
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
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
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;
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;
#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
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
#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
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));
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
libmono_dep = $(monodir)/mono/mini/$(LIBMONO_LA)
endif
-if PLATFORM_ANDROID
+if HOST_ANDROID
prof_ldflags = -avoid-version
endif
#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;
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 {
#define REDZONE_SIZE 0
+#elif defined (TARGET_WASM)
+
+#define REDZONE_SIZE 0
+
#endif
#endif /* __MONO_SGENARCHDEP_H__ */
/*
* 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
#include <errno.h>
#include <assert.h>
#include <stdlib.h>
+#include <glib.h>
#include "mono/sgen/sgen-gc.h"
#include "mono/sgen/sgen-cardtable.h"
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
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);
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 ();
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 ();
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);
{
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;
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 ();
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");
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
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)
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;
}
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
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 ();
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;
}
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
#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
delegate11.cs \
delegate12.cs \
delegate13.cs \
+ delegate14.cs \
largeexp.cs \
largeexp2.cs \
marshalbyref1.cs \
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
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
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
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 \
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
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 += \
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
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 \
#
# 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
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
--- /dev/null
+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
--- /dev/null
+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
--- /dev/null
+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 ();
+ }
+}
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;
}
}
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
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
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
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 \
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 \
arch_sources += mono-hwcap-s390x.c
endif
+if HOST_WASM
+arch_sources += mono-hwcap-wasm.c
+endif
+
else
arch_sources += mono-hwcap-cross.c
return(ret);
}
-void InterlockedWrite(volatile gint8 *dst, gint8 val)
+void InterlockedWrite8(volatile gint8 *dst, gint8 val)
{
int thr_ret;
#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_ */
#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
* 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__) || \
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;
--- /dev/null
+#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
#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>
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;
--- /dev/null
+/**
+ * \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)
+{
+}
*/
#include <config.h>
-#if defined (PLATFORM_ANDROID)
+#if defined (HOST_ANDROID)
#include <android/log.h>
#include "mono-logger-internals.h"
#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__)
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);
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;
#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
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
#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
* 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)
{
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);
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.
* * 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:
*
int
mono_atexit (void (*func)(void))
{
-#ifdef PLATFORM_ANDROID
+#ifdef HOST_ANDROID
/* Some versions of android libc doesn't define atexit () */
return 0;
#else
#define __MONO_MONO_SIGCONTEXT_H__
#include <config.h>
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
#include <asm/sigcontext.h>
#endif
#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
#include <config.h>
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
#include <pthread.h>
#include <stdio.h>
#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>
static int
abort_signal_get (void)
{
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
return SIGTTIN;
#elif defined (SIGRTMIN)
static int abort_signum = -1;
static int
suspend_signal_get (void)
{
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
return SIGPWR;
#elif defined (SIGRTMIN)
static int suspend_signum = -1;
static int
restart_signal_get (void)
{
-#if defined(PLATFORM_ANDROID)
+#if defined(HOST_ANDROID)
return SIGXCPU;
#elif defined (SIGRTMIN)
static int restart_signum = -1;
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);
#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
extern int tkill (pid_t tid, int signal);
#endif
-#if defined(_POSIX_VERSION)
+#if defined(_POSIX_VERSION) && !defined (TARGET_WASM)
#include <pthread.h>
void
mono_threads_suspend_register (MonoThreadInfo *info)
{
-#if defined (PLATFORM_ANDROID)
+#if defined (HOST_ANDROID)
info->native_handle = gettid ();
#endif
}
--- /dev/null
+#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
} 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 */
/* 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
#include <sys/sysctl.h>
#endif
-#if defined(PLATFORM_MACOSX)
+#if defined(HOST_DARWIN)
#include <mach/mach.h>
#include <mach/mach_time.h>
#endif
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 ();
* 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.
*/
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_ */
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'})
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')
csc
csharp
csharp2
+csi
dbsessmgr
dbsessmgr2
dbsessmgr4
pedump
permview
peverify
-prj2make
resgen
resgen2
secutil
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
}
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/
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
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/
/chktrust
/cilc
/crlupdate
+/csi
/csharp
/csharp2
/disco
macpack$(SCRIPT_SUFFIX) \
mdoc$(SCRIPT_SUFFIX) \
mono-cil-strip$(SCRIPT_SUFFIX) \
- prj2make$(SCRIPT_SUFFIX) \
soapsuds$(SCRIPT_SUFFIX) \
caspol$(SCRIPT_SUFFIX) \
cert-sync$(SCRIPT_SUFFIX) \
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.
* 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
#define _XOPEN_SOURCE 600
#endif
-#ifdef PLATFORM_MACOSX
+#ifdef HOST_DARWIN
/* For mincore () */
#define _DARWIN_C_SOURCE
#endif
_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
/* 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)
{
$(LIBICONV) \
-lm
-if PLATFORM_DARWIN
+if HOST_DARWIN
monograph_LDFLAGS=-framework CoreFoundation
endif
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:
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
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
});*/
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"
});
}
});
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"
});
});
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"
});
$(GLIB_LIBS) \
$(LIBICONV)
-if PLATFORM_DARWIN
+if HOST_DARWIN
pedump_LDFLAGS=-framework CoreFoundation -framework Foundation
endif
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);
}
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;
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++;
"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;
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;
}
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
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);
#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"