Merge pull request #2236 from akoeplinger/add-dataflow
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 17 Nov 2015 21:03:53 +0000 (22:03 +0100)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Tue, 17 Nov 2015 21:03:53 +0000 (22:03 +0100)
[System.Threading.Tasks.Dataflow] Replace implementation with CoreFx version

130 files changed:
.gitignore
README.md
mcs/Makefile
mcs/build/profiles/monotouch.make
mcs/build/profiles/monotouch_runtime.make
mcs/build/profiles/monotouch_tv_runtime.make [new file with mode: 0644]
mcs/build/profiles/monotouch_watch_runtime.make [new file with mode: 0644]
mcs/class/Makefile
mcs/class/Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs
mcs/class/Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs
mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs
mcs/class/System.Core/monotouch_tv_runtime_System.Core.dll.sources [new file with mode: 0644]
mcs/class/System.Core/monotouch_watch_runtime_System.Core.dll.sources [new file with mode: 0644]
mcs/class/System.XML/monotouch_tv_runtime_System.Xml.dll.sources [new file with mode: 0644]
mcs/class/System.XML/monotouch_watch_runtime_System.Xml.dll.sources [new file with mode: 0644]
mcs/class/System/Mono.Net.Security/ChainValidationHelper.cs
mcs/class/System/Mono.Net.Security/SystemCertificateValidator.cs
mcs/class/System/monotouch_tv_runtime_System.dll.sources [new file with mode: 0644]
mcs/class/System/monotouch_watch_runtime_System.dll.sources [new file with mode: 0644]
mcs/class/corlib/Test/System/DateTimeOffsetTestCoreFx.cs
mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources [new file with mode: 0644]
mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources [new file with mode: 0644]
mcs/docs/compiler.txt
mcs/mcs/expression.cs
mcs/tests/test-null-operator-20.cs [new file with mode: 0644]
mcs/tests/ver-il-net_4_x.xml
mcs/tools/linker/Descriptors/mscorlib.xml
mcs/tools/linker/Mono.Linker.Steps/BlacklistStep.cs
mcs/tools/linker/Mono.Linker.Steps/ResolveFromXmlStep.cs
mono/metadata/Makefile.am
mono/metadata/abi-details.h
mono/metadata/appdomain.c
mono/metadata/assembly.c
mono/metadata/attach.c
mono/metadata/boehm-gc.c
mono/metadata/class-internals.h
mono/metadata/class.c
mono/metadata/cominterop.c
mono/metadata/console-null.c
mono/metadata/console-unix.c
mono/metadata/console-win32.c
mono/metadata/domain.c
mono/metadata/gc-internal.h [deleted file]
mono/metadata/gc-internals.h [new file with mode: 0644]
mono/metadata/gc.c
mono/metadata/icall.c
mono/metadata/image.c
mono/metadata/jit-info.c
mono/metadata/loader.c
mono/metadata/marshal.c
mono/metadata/marshal.h
mono/metadata/metadata.c
mono/metadata/monitor.c
mono/metadata/mono-config.c
mono/metadata/mono-debug.c
mono/metadata/mono-hash.c
mono/metadata/mono-ptr-array.h
mono/metadata/null-gc.c
mono/metadata/object-offsets.h
mono/metadata/object.c
mono/metadata/profiler.c
mono/metadata/reflection-internals.h
mono/metadata/reflection.c
mono/metadata/security-core-clr.c
mono/metadata/sgen-bridge-internal.h [deleted file]
mono/metadata/sgen-bridge-internals.h [new file with mode: 0644]
mono/metadata/sgen-bridge.c
mono/metadata/sgen-client-mono.h
mono/metadata/sgen-mono.c
mono/metadata/sgen-new-bridge.c
mono/metadata/sgen-old-bridge.c
mono/metadata/sgen-os-coop.c [deleted file]
mono/metadata/sgen-os-mach.c [deleted file]
mono/metadata/sgen-os-posix.c [deleted file]
mono/metadata/sgen-os-win32.c [deleted file]
mono/metadata/sgen-stw.c
mono/metadata/sgen-tarjan-bridge.c
mono/metadata/string-icalls.c
mono/metadata/threadpool-ms-io.c
mono/metadata/threadpool-ms.c
mono/metadata/threads.c
mono/mini/Makefile.am.in
mono/mini/aot-compiler.c
mono/mini/aot-compiler.h [new file with mode: 0644]
mono/mini/aot-runtime.c
mono/mini/arch-stubs.c
mono/mini/debugger-agent.c
mono/mini/decompose.c
mono/mini/driver.c
mono/mini/exceptions-amd64.c
mono/mini/exceptions-ia64.c
mono/mini/exceptions-sparc.c
mono/mini/exceptions-x86.c
mono/mini/method-to-ir.c
mono/mini/mini-amd64.c
mono/mini/mini-arm.c
mono/mini/mini-arm.h
mono/mini/mini-darwin.c
mono/mini/mini-exceptions.c
mono/mini/mini-gc.c
mono/mini/mini-llvm.c
mono/mini/mini-posix.c
mono/mini/mini-runtime.c
mono/mini/mini-windows.c
mono/mini/mini-x86.c
mono/mini/mini.c
mono/mini/mini.h
mono/mini/tasklets.c
mono/mini/tramp-amd64.c
mono/mini/tramp-s390x.c
mono/mini/tramp-x86.c
mono/utils/Makefile.am
mono/utils/mono-logger-internal.h [deleted file]
mono/utils/mono-logger-internals.h [new file with mode: 0644]
mono/utils/mono-logger.c
mono/utils/mono-mmap-internal.h [deleted file]
mono/utils/mono-mmap-internals.h [new file with mode: 0644]
mono/utils/mono-mmap.c
mono/utils/mono-threads-posix-abort-syscall.c
mono/utils/mono-threads-posix-signals.c
mono/utils/mono-threads-posix-signals.h [deleted file]
mono/utils/mono-threads-posix.c
mono/utils/mono-threads-state-machine.c
mono/utils/mono-threads.c
mono/utils/mono-threads.h
msvc/libmonoruntime.vcxproj
msvc/libmonoutils.vcxproj
runtime/Makefile.am
samples/embed/testi.c [deleted file]

index 1cb061f77894615a877ca23c16bcce6acb8e816d..3258779bae5618a8cfb4e68ad84b7959c1b2d9e7 100644 (file)
@@ -125,4 +125,5 @@ mono.h
 mono-*.tar.*
 tmpinst-dir.stamp
 msvc/scripts/inputs/
+extensions-config.h
 
index 27c6036d1a8c5c96fc07a62f1aeb2e027e2f2ae5..96559ab5c34307f3b10e964dfd4ce67b465ae4cc 100644 (file)
--- a/README.md
+++ b/README.md
@@ -80,8 +80,7 @@ Testing and Installation
 You can run the mono and mcs test suites with the command: `make check`.
 
 Expect to find a few test suite failures. As a sanity check, you
-can compare the failures you got with [https://wrench.mono-project.com/Wrench/](https://wrench.mono-project.com/Wrench/)
-and [http://jenkins.mono-project.com/](http://jenkins.mono-project.com/).
+can compare the failures you got with [https://jenkins.mono-project.com/](https://jenkins.mono-project.com/).
 
 You can now install mono with: `make install`
 
index 35ae9f963f528d93e7a519e3423db8e2f474e19e..f6127157641bbf50f43ca438ecb8044ff927b3fa 100644 (file)
@@ -11,6 +11,8 @@ monotouch_SUBDIRS := build class
 monotouch_watch_SUBDIRS := build class
 monotouch_tv_SUBDIRS := build class
 monotouch_runtime_SUBDIRS := build class
+monotouch_watch_runtime_SUBDIRS := build class
+monotouch_tv_runtime_SUBDIRS := build class
 xammac_SUBDIRS := build class
 mobile_SUBDIRS := build class
 mobile_static_SUBDIRS := build class
@@ -65,6 +67,8 @@ $(_boot_:%=profile-do--monotouch--%):         profile-do--monotouch--%:
 $(_boot_:%=profile-do--monotouch_watch--%):   profile-do--monotouch_watch--%:   profile-do--build--%
 $(_boot_:%=profile-do--monotouch_tv--%):      profile-do--monotouch_tv--%:      profile-do--build--%
 $(_boot_:%=profile-do--monotouch_runtime--%):  profile-do--monotouch_runtime--%:  profile-do--build--%
+$(_boot_:%=profile-do--monotouch_watch_runtime--%):  profile-do--monotouch_watch_runtime--%:  profile-do--build--%
+$(_boot_:%=profile-do--monotouch_tv_runtime--%):     profile-do--monotouch_tv_runtime--%:     profile-do--build--%
 $(_boot_:%=profile-do--xammac--%):            profile-do--xammac--%:            profile-do--build--%
 $(_boot_:%=profile-do--xammac_net_4_5--%):    profile-do--xammac_net_4_5--%:           profile-do--build--%
 $(_boot_:%=profile-do--mobile--%):            profile-do--mobile--%:         profile-do--build--%
index bdeba2bac4e5701b52e7f365c5fcea413a2a0164..39d5443914fe7284745307a13b0c1e65b1c15c1e 100644 (file)
@@ -1,42 +1,4 @@
-#! -*- makefile -*-
+include $(topdir)/build/profiles/monotouch_runtime.make
 
-BOOTSTRAP_PROFILE = build
-
-BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
-MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
-
-# Use system resgen as we don't want local System.Windows.Forms dependency
-RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2
-
-profile-check:
-       @:
-
-DEFAULT_REFERENCES = -r:mscorlib.dll
-
-PROFILE_MCS_FLAGS = \
-       -d:NET_1_1 \
-       -d:NET_2_0 \
-       -d:NET_2_1 \
-       -d:NET_3_5 \
-       -d:NET_4_0 \
-       -d:NET_4_5 \
-       -d:MOBILE,MOBILE_LEGACY \
-       -d:MONO \
-       -d:DISABLE_CAS_USE \
-       -d:MONOTOUCH \
-       -d:DISABLE_REMOTING \
-       -d:DISABLE_COM \
-       -d:FULL_AOT_RUNTIME \
-       -nowarn:1699 \
-       -nostdlib \
-       -lib:$(topdir)/class/lib/$(PROFILE) \
-       $(DEFAULT_REFERENCES) \
-       $(PLATFORM_DEBUG_FLAGS)
-
-FRAMEWORK_VERSION = 2.1
-NO_TEST = yes
-
-# the tuner takes care of the install
-NO_INSTALL = yes
-MOBILE_STATIC = yes
-MOBILE_PROFILE = yes
+PROFILE_MCS_FLAGS += \
+       -d:FULL_AOT_RUNTIME
index 8f42ec8acbe599b29d7311ddcdfab8c0202d7b6a..de74d7d92bff19bc79b78c3d21e7cf6815abd678 100644 (file)
@@ -14,7 +14,24 @@ profile-check:
        @:
 
 DEFAULT_REFERENCES = -r:mscorlib.dll
-PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_2_1 -d:NET_3_5 -d:NET_4_0 -d:NET_4_5 -d:MONO -d:DISABLE_CAS_USE  -d:MOBILE,MOBILE_LEGACY -d:MONOTOUCH -D:DISABLE_REMOTING -d:DISABLE_COM -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
+PROFILE_MCS_FLAGS = \
+       -d:NET_1_1 \
+       -d:NET_2_0 \
+       -d:NET_2_1 \
+       -d:NET_3_5 \
+       -d:NET_4_0 \
+       -d:NET_4_5 \
+       -d:MOBILE,MOBILE_LEGACY \
+       -d:MONO \
+       -d:DISABLE_CAS_USE \
+       -d:MONOTOUCH \
+       -d:DISABLE_REMOTING \
+       -d:DISABLE_COM \
+       -nowarn:1699 \
+       -nostdlib \
+       -lib:$(topdir)/class/lib/$(PROFILE) \
+       $(DEFAULT_REFERENCES) \
+       $(PLATFORM_DEBUG_FLAGS)
 
 FRAMEWORK_VERSION = 2.1
 
diff --git a/mcs/build/profiles/monotouch_tv_runtime.make b/mcs/build/profiles/monotouch_tv_runtime.make
new file mode 100644 (file)
index 0000000..c6c98dc
--- /dev/null
@@ -0,0 +1,4 @@
+include $(topdir)/build/profiles/monotouch_runtime.make
+
+PROFILE_MCS_FLAGS += \
+       -d:MONOTOUCH_TV
diff --git a/mcs/build/profiles/monotouch_watch_runtime.make b/mcs/build/profiles/monotouch_watch_runtime.make
new file mode 100644 (file)
index 0000000..0a63182
--- /dev/null
@@ -0,0 +1,4 @@
+include $(topdir)/build/profiles/monotouch_runtime.make
+
+PROFILE_MCS_FLAGS += \
+       -d:MONOTOUCH_WATCH
index 309f3826aabeae5d3680fcdbd03dce6e75a6aa3b..64790f2005f35d3b1e2fcc2b9500325668655ba9 100644 (file)
@@ -85,6 +85,9 @@ monotouch_runtime_dirs := \
        System.XML \
        Mono.CSharp
 
+monotouch_watch_runtime_dirs := $(monotouch_runtime_dirs)
+monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs)
+
 xammac_4_5_dirs := \
        corlib  \
        System  \
@@ -283,6 +286,8 @@ monotouch_SUBDIRS := $(monotouch_dirs)
 monotouch_watch_SUBDIRS := $(monotouch_watch_dirs)
 monotouch_tv_SUBDIRS    := $(monotouch_tv_dirs)
 monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
+monotouch_watch_runtime_SUBDIRS := $(monotouch_watch_runtime_dirs)
+monotouch_tv_runtime_SUBDIRS := $(monotouch_tv_runtime_dirs)
 mobile_static_SUBDIRS := $(mobile_static_dirs)
 mobile_SUBDIRS := $(mobile_dynamic_dirs)
 xammac_SUBDIRS := $(xammac_dirs)
index 7fab7f7f35d4127d4febd09c9445cafe8c3d39ef..a02a3f9316a75fc5c827426c846c66982232b29b 100644 (file)
@@ -98,9 +98,12 @@ namespace Mono.Security.Interface
                 */
                ValidationResult ValidateCertificate (string targetHost, bool serverMode, X509CertificateCollection certificates);
 
+               /*
+                * On OS X and Mobile, the @chain will be initialized with the @certificates, but not actually built.
+                */
                bool InvokeSystemValidator (
                        string targetHost, bool serverMode, X509CertificateCollection certificates,
-                       ref MonoSslPolicyErrors errors, ref int status11);
+                       X509Chain chain, ref MonoSslPolicyErrors errors, ref int status11);
        }
 
        public static class CertificateValidationHelper
index 7305c51784d6f7dc3e77c9335138d4c3c0cd6d52..dc81e862f2f07690e90e5cc01af83cbf38bc2f27 100644 (file)
@@ -117,13 +117,15 @@ namespace Mono.Security.Interface
                /*
                 * If @serverMode is true, then we're a server and want to validate a certificate
                 * that we received from a client.
-                * 
+                *
+                * On OS X and Mobile, the @chain will be initialized with the @certificates, but not actually built.
+                *
                 * Returns `true` if certificate validation has been performed and `false` to invoke the
                 * default system validator.
                 */
                public virtual bool InvokeSystemCertificateValidator (
                        ICertificateValidator validator, string targetHost, bool serverMode,
-                       X509CertificateCollection certificates, out bool success,
+                       X509CertificateCollection certificates, X509Chain chain, out bool success,
                        ref MonoSslPolicyErrors errors, ref int status11)
                {
                        success = false;
index 077ed335e785ae4f941b514c6e681af996cc3b9a..802f78f0aa13f7234187b62875f61f8f88713c1c 100644 (file)
@@ -84,7 +84,7 @@ namespace Mono.Security.Interface
                bool cloned = false;
                bool checkCertName = true;
                bool checkCertRevocationStatus = false;
-               bool useServicePointManagerCallback = false;
+               bool useServicePointManagerCallback = true;
                bool skipSystemValidators = false;
                bool callbackNeedsChain = true;
                ICertificateValidator certificateValidator;
index 384fbaea0e8a50a4cc3439d603de04cc6e17af50..ffd1adc2050134e7a4fe83792a5b6f631d6fd2f3 100644 (file)
@@ -633,15 +633,14 @@ namespace Mono.Security.Protocol.Tls
                // record and return are the records (may be more than one) we have
                private void InternalReadCallback(IAsyncResult result)
                {
-                       if (this.disposed)
-                               return;
-
                        object[] state = (object[])result.AsyncState;
                        byte[] recbuf = (byte[])state[0];
                        InternalAsyncResult internalResult = (InternalAsyncResult)state[1];
 
                        try
                        {
+                               this.checkDisposed();
+                               
                                int n = innerStream.EndRead(result);
                                if (n > 0)
                                {
@@ -795,13 +794,11 @@ namespace Mono.Security.Protocol.Tls
 
                private void InternalWriteCallback(IAsyncResult ar)
                {
-                       if (this.disposed)
-                               return;
-                       
                        InternalAsyncResult internalResult = (InternalAsyncResult)ar.AsyncState;
 
                        try
                        {
+                               this.checkDisposed();
                                this.innerStream.EndWrite(ar);
                                internalResult.SetComplete();
                        }
diff --git a/mcs/class/System.Core/monotouch_tv_runtime_System.Core.dll.sources b/mcs/class/System.Core/monotouch_tv_runtime_System.Core.dll.sources
new file mode 100644 (file)
index 0000000..b050f33
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_System.Core.dll.sources
diff --git a/mcs/class/System.Core/monotouch_watch_runtime_System.Core.dll.sources b/mcs/class/System.Core/monotouch_watch_runtime_System.Core.dll.sources
new file mode 100644 (file)
index 0000000..b050f33
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_System.Core.dll.sources
diff --git a/mcs/class/System.XML/monotouch_tv_runtime_System.Xml.dll.sources b/mcs/class/System.XML/monotouch_tv_runtime_System.Xml.dll.sources
new file mode 100644 (file)
index 0000000..b663093
--- /dev/null
@@ -0,0 +1 @@
+#include mobile_System.Xml.dll.sources
diff --git a/mcs/class/System.XML/monotouch_watch_runtime_System.Xml.dll.sources b/mcs/class/System.XML/monotouch_watch_runtime_System.Xml.dll.sources
new file mode 100644 (file)
index 0000000..b663093
--- /dev/null
@@ -0,0 +1 @@
+#include mobile_System.Xml.dll.sources
index b7f6d3be94edc9abc408925020d856559743a45f..7c7103fc61eef07b74f36b894c7acd819df4a698 100644 (file)
@@ -49,8 +49,10 @@ using Mono.Security.X509.Extensions;
 #endif
 #if MONO_X509_ALIAS
 using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
+using XX509Chain = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509Chain;
 #else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
+using XX509Chain = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509Chain;
 #endif
 
 using System;
@@ -307,17 +309,28 @@ namespace Mono.Net.Security
                        int status11 = 0; // Error code passed to the obsolete ICertificatePolicy callback
                        X509Chain chain = null;
 
+                       bool wantsChain = SystemCertificateValidator.NeedsChain (settings);
+                       if (!wantsChain && hasCallback) {
+                               if (settings == null || settings.CallbackNeedsCertificateChain)
+                                       wantsChain = true;
+                       }
+
+                       if (wantsChain)
+                               chain = SystemCertificateValidator.CreateX509Chain (certs);
+
+                       if (wantsChain || SystemCertificateValidator.NeedsChain (settings))
+                               SystemCertificateValidator.BuildX509Chain (certs, chain, ref errors, ref status11);
+
                        bool providerValidated = false;
                        if (provider != null && provider.HasCustomSystemCertificateValidator) {
-                               if (SystemCertificateValidator.NeedsChain (settings))
-                                       throw new NotSupportedException ("Cannot use MonoTlsProvider.InvokeSystemCertificateValidator() when the X509Chain is required.");
                                var xerrors = (MonoSslPolicyErrors)errors;
-                               providerValidated = provider.InvokeSystemCertificateValidator (this, host, server, certs, out result, ref xerrors, ref status11);
+                               var xchain = (XX509Chain)(object)chain;
+                               providerValidated = provider.InvokeSystemCertificateValidator (this, host, server, certs, xchain, out result, ref xerrors, ref status11);
                                errors = (SslPolicyErrors)xerrors;
                        }
 
                        if (!providerValidated)
-                               result = SystemCertificateValidator.Evaluate (settings, host, certs, ref chain, ref errors, ref status11);
+                               result = SystemCertificateValidator.Evaluate (settings, host, certs, chain, ref errors, ref status11);
 
                        if (policy != null && (!(policy is DefaultCertificatePolicy) || certValidationCallback == null)) {
                                ServicePoint sp = null;
@@ -343,14 +356,11 @@ namespace Mono.Net.Security
                        return new ValidationResult (result, user_denied, status11, (MonoSslPolicyErrors)errors);
                }
 
-               public bool InvokeSystemValidator (string targetHost, bool serverMode, XX509CertificateCollection certificates, ref MonoSslPolicyErrors xerrors, ref int status11)
+               public bool InvokeSystemValidator (string targetHost, bool serverMode, XX509CertificateCollection certificates, XX509Chain xchain, ref MonoSslPolicyErrors xerrors, ref int status11)
                {
-                       if (SystemCertificateValidator.NeedsChain (settings))
-                               throw new NotSupportedException ("Cannot use ICertificateValidator.InvokeSystemValidator() when the X509Chain is required.");
-
-                       X509Chain chain = null;
+                       X509Chain chain = (X509Chain)(object)xchain;
                        var errors = (SslPolicyErrors)xerrors;
-                       var result = SystemCertificateValidator.Evaluate (settings, targetHost, certificates, ref chain, ref errors, ref status11);
+                       var result = SystemCertificateValidator.Evaluate (settings, targetHost, certificates, chain, ref errors, ref status11);
                        xerrors = (MonoSslPolicyErrors)errors;
                        return result;
                }
index 39cfa73e66d8e6162bbfdb5af2392a68dd4217ad..0809c44880be017ff2540c3929040b2c5eefc7df 100644 (file)
@@ -18,8 +18,10 @@ using Mono.Security.X509.Extensions;
 #endif
 #if MONO_X509_ALIAS
 using XX509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
+using XX509Chain = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509Chain;
 #else
 using XX509CertificateCollection = System.Security.Cryptography.X509Certificates.X509CertificateCollection;
+using XX509Chain = System.Security.Cryptography.X509Certificates.X509Chain;
 #endif
 
 using System;
@@ -72,27 +74,36 @@ namespace Mono.Net.Security
 #endif
                }
 
-               static X509Chain ComputeX509Chain (XX509CertificateCollection certs, ref SslPolicyErrors errors, ref int status11)
+               public static X509Chain CreateX509Chain (XX509CertificateCollection certs)
                {
-#if MOBILE
-                       return null;
-#else
-                       if (is_macosx)
-                               return null;
-
                        var chain = new X509Chain ();
                        chain.ChainPolicy = new X509ChainPolicy ();
 
+#if !MOBILE
                        chain.ChainPolicy.RevocationMode = revocation_mode;
+#endif
 
                        for (int i = 1; i < certs.Count; i++) {
                                chain.ChainPolicy.ExtraStore.Add (certs [i]);
                        }
 
+                       return chain;
+               }
+
+               public static bool BuildX509Chain (XX509CertificateCollection certs, X509Chain chain, ref SslPolicyErrors errors, ref int status11)
+               {
+#if MOBILE
+                       return true;
+#else
+                       if (is_macosx)
+                               return true;
+
                        var leaf = (X509Certificate2)certs [0];
 
+                       bool ok;
                        try {
-                               if (!chain.Build (leaf))
+                               ok = chain.Build (leaf);
+                               if (!ok)
                                        errors |= GetErrorsFromChain (chain);
                        } catch (Exception e) {
                                Console.Error.WriteLine ("ERROR building certificate chain: {0}", e);
@@ -100,13 +111,17 @@ namespace Mono.Net.Security
                                errors |= SslPolicyErrors.RemoteCertificateChainErrors;
                        }
 
-                       status11 = GetStatusFromChain (chain);
+                       try {
+                               status11 = GetStatusFromChain (chain);
+                       } catch {
+                               status11 = 0x800B010B; // TRUST_E_FAIL - generic
+                       }
 
                        return chain;
 #endif
                }
 
-               static void CheckUsage (XX509CertificateCollection certs, string host, ref SslPolicyErrors errors, ref int status11)
+               static bool CheckUsage (XX509CertificateCollection certs, string host, ref SslPolicyErrors errors, ref int status11)
                {
 #if !MONOTOUCH
                        var leaf = (X509Certificate2)certs[0];
@@ -115,14 +130,17 @@ namespace Mono.Net.Security
                                if (!CheckCertificateUsage (leaf)) {
                                        errors |= SslPolicyErrors.RemoteCertificateChainErrors;
                                        status11 = -2146762490; //CERT_E_PURPOSE 0x800B0106
+                                       return false;
                                }
 
                                if (host != null && !CheckServerIdentity (leaf, host)) {
                                        errors |= SslPolicyErrors.RemoteCertificateNameMismatch;
                                        status11 = -2146762481; // CERT_E_CN_NO_MATCH 0x800B010F
+                                       return false;
                                }
                        }
 #endif
+                       return true;
                }
 
                static bool EvaluateSystem (XX509CertificateCollection certs, XX509CertificateCollection anchors, string host, X509Chain chain, ref SslPolicyErrors errors, ref int status11)
@@ -171,14 +189,10 @@ namespace Mono.Net.Security
 
                public static bool Evaluate (
                        MonoTlsSettings settings, string host, XX509CertificateCollection certs,
-                       ref X509Chain chain, ref SslPolicyErrors errors, ref int status11)
+                       X509Chain chain, ref SslPolicyErrors errors, ref int status11)
                {
-#if !MOBILE
-                       if (NeedsChain (settings) && chain == null)
-                               chain = ComputeX509Chain (certs, ref errors, ref status11);
-#endif
-
-                       CheckUsage (certs, host, ref errors, ref status11);
+                       if (!CheckUsage (certs, host, ref errors, ref status11))
+                               return false;
 
                        if (settings != null && settings.SkipSystemValidators)
                                return false;
diff --git a/mcs/class/System/monotouch_tv_runtime_System.dll.sources b/mcs/class/System/monotouch_tv_runtime_System.dll.sources
new file mode 100644 (file)
index 0000000..7c0bd59
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_System.dll.sources
diff --git a/mcs/class/System/monotouch_watch_runtime_System.dll.sources b/mcs/class/System/monotouch_watch_runtime_System.dll.sources
new file mode 100644 (file)
index 0000000..7c0bd59
--- /dev/null
@@ -0,0 +1 @@
+#include monotouch_System.dll.sources
index e056e537594269fe96592b54a4c18ce10aa4d074..fb7b3d7b1de839aa5ee2ea61bbd1e54e55308e90 100644 (file)
@@ -73,14 +73,14 @@ public static class DateTimeOffsetUnixTimeConversionTests
     {
         long expectedMilliseconds = test.UnixTimeMilliseconds;
         long actualMilliseconds = test.DateTimeOffset.ToUnixTimeMilliseconds();
-        Assert.Equals(expectedMilliseconds, actualMilliseconds);
+        Assert.AreEqual(expectedMilliseconds, actualMilliseconds);
     }
 
     private static void TestToUnixTimeSeconds(TestTime test)
     {
         long expectedSeconds = test.UnixTimeSeconds;
         long actualSeconds = test.DateTimeOffset.ToUnixTimeSeconds();
-        Assert.Equals(expectedSeconds, actualSeconds);
+        Assert.AreEqual(expectedSeconds, actualSeconds);
     }
 
     [Test]
@@ -98,7 +98,7 @@ public static class DateTimeOffsetUnixTimeConversionTests
         // Only assert that expected == actual up to millisecond precision for conversion from milliseconds
         long expectedTicks = (test.DateTimeOffset.UtcTicks / TimeSpan.TicksPerMillisecond) * TimeSpan.TicksPerMillisecond;
         long actualTicks = DateTimeOffset.FromUnixTimeMilliseconds(test.UnixTimeMilliseconds).UtcTicks;
-        Assert.Equals(expectedTicks, actualTicks);
+        Assert.AreEqual(expectedTicks, actualTicks);
     }
 
     private static void TestFromUnixTimeSeconds(TestTime test)
@@ -106,7 +106,7 @@ public static class DateTimeOffsetUnixTimeConversionTests
         // Only assert that expected == actual up to second precision for conversion from seconds
         long expectedTicks = (test.DateTimeOffset.UtcTicks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond;
         long actualTicks = DateTimeOffset.FromUnixTimeSeconds(test.UnixTimeSeconds).UtcTicks;
-        Assert.Equals(expectedTicks, actualTicks);
+        Assert.AreEqual(expectedTicks, actualTicks);
     }
 
 
diff --git a/mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources b/mcs/class/corlib/monotouch_tv_runtime_corlib.dll.sources
new file mode 100644 (file)
index 0000000..9e173da
--- /dev/null
@@ -0,0 +1 @@
+#include corlib.dll.sources
\ No newline at end of file
diff --git a/mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources b/mcs/class/corlib/monotouch_watch_runtime_corlib.dll.sources
new file mode 100644 (file)
index 0000000..9e173da
--- /dev/null
@@ -0,0 +1 @@
+#include corlib.dll.sources
\ No newline at end of file
index 328f174f71d4dd87f590ea3c4e8f4841ac7a3a0a..9e516ffd01cf38d0b47eb7b4ee55459617f66ae9 100755 (executable)
 
        In the Mono C# compiler, we use a class for each of the
        statements and expressions in the C# language.  For example,
-       there is a `While' class for the the `while' statement, a
+       there is a `While' class for the `while' statement, a
        `Cast' class to represent a cast expression and so on.
 
        There is a Statement class, and an Expression class which are
index 32831afb1f0cacf3f7fa80d44d723bebd25459a5..53e1f1b707b1b3f5a153025fd774a6b1937b6aa8 100644 (file)
@@ -7093,8 +7093,11 @@ namespace Mono.CSharp
                        // Next, evaluate all the expressions in the argument list
                        //
                        bool dynamic_arg = false;
-                       if (arguments != null)
-                               arguments.Resolve (ec, out dynamic_arg);
+                       if (arguments != null) {
+                               using (ec.With (ResolveContext.Options.DontSetConditionalAccessReceiver, false)) {
+                                       arguments.Resolve (ec, out dynamic_arg);
+                               }
+                       }
 
                        TypeSpec expr_type = member_expr.Type;
                        if (expr_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic)
@@ -10857,7 +10860,9 @@ namespace Mono.CSharp
                        eclass = ExprClass.IndexerAccess;
 
                        bool dynamic;
-                       arguments.Resolve (rc, out dynamic);
+                       using (rc.With (ResolveContext.Options.DontSetConditionalAccessReceiver, false)) {
+                               arguments.Resolve (rc, out dynamic);
+                       }
 
                        if (indexers == null && InstanceExpression.Type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
                                dynamic = true;
diff --git a/mcs/tests/test-null-operator-20.cs b/mcs/tests/test-null-operator-20.cs
new file mode 100644 (file)
index 0000000..d22f962
--- /dev/null
@@ -0,0 +1,13 @@
+class M
+{
+       public static void Main ()
+       {
+               string s = null;
+               s?.CompareTo ("xx").CompareTo(s?.EndsWith ("x")).GetHashCode ();
+
+               string s1 = "abcd";
+               string s2 = null;
+
+               var idx = s1.Substring(1)[s2?.GetHashCode () ?? 0].GetHashCode ();
+       }
+}
index 6218e73ddf27abba174bf3c61885a763272ab9ab..7c3e7dc6e5c44cb4fbd5025715336e7f6ab21dbd 100644 (file)
       </method>
     </type>
   </test>
+  <test name="test-null-operator-20.cs">
+    <type name="M">
+      <method name="Void Main()" attrs="150">
+        <size>182</size>
+      </method>
+      <method name="Void .ctor()" attrs="6278">
+        <size>7</size>
+      </method>
+    </type>
+  </test>
   <test name="test-partial-01.cs">
     <type name="Foo.Hello">
       <method name="Void .ctor()" attrs="6278">
index 0fae1a02c00e199a0a7ce7fc313fa3cd73f34963..6e07617be3ed6e8fcc86a9bfb68cb99571db7292 100644 (file)
                <type fullname="System.Threading.ExecutionContext" />
                <type fullname="System.Threading.Interlocked">
                        <method name="CompareExchange" />
+                       <method name="Exchange" />
                </type>
                <type fullname="System.Threading.Monitor">
                        <method name="Enter" />
index c65d3037c8e64b6960bf38b312bc2e801aaac43b..b09e9e6a7220b46214d66da56c9c6d980ff7df03 100644 (file)
@@ -61,22 +61,23 @@ namespace Mono.Linker.Steps {
                                }
                        }
 
-                       foreach (var rsc in Context.GetAssemblies ()
-                                                               .SelectMany (asm => asm.Modules)
-                                                               .SelectMany (mod => mod.Resources)
-                                                               .Where (res => res.ResourceType == ResourceType.Embedded)
-                                                               .Where (res => Path.GetExtension (res.Name) == ".xml")
-                                                               .Where (res => IsReferenced (GetAssemblyName (res.Name)))
-                                                               .Cast<EmbeddedResource> ()) {
-                               try {
-                                       if (Context.LogInternalExceptions)
-                                               Console.WriteLine ("Processing embedded resource linker descriptor: {0}", rsc.Name);
-
-                                       Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc));
-                               } catch (XmlException ex) {
-                                       /* This could happen if some broken XML file is embedded. */
-                                       if (Context.LogInternalExceptions)
-                                               Console.WriteLine ("Error processing {0}: {1}", rsc.Name, ex);
+                       foreach (var asm in Context.GetAssemblies ()) {
+                               foreach (var rsc in asm.Modules
+                                                                       .SelectMany (mod => mod.Resources)
+                                                                       .Where (res => res.ResourceType == ResourceType.Embedded)
+                                                                       .Where (res => Path.GetExtension (res.Name) == ".xml")
+                                                                       .Where (res => IsReferenced (GetAssemblyName (res.Name)))
+                                                                       .Cast<EmbeddedResource> ()) {
+                                       try {
+                                               if (Context.LogInternalExceptions)
+                                                       Console.WriteLine ("Processing embedded resource linker descriptor: {0}", rsc.Name);
+
+                                               Context.Pipeline.AddStepAfter (typeof (TypeMapStep), GetExternalResolveStep (rsc, asm));
+                                       } catch (XmlException ex) {
+                                               /* This could happen if some broken XML file is embedded. */
+                                               if (Context.LogInternalExceptions)
+                                                       Console.WriteLine ("Error processing {0}: {1}", rsc.Name, ex);
+                                       }
                                }
                        }
                }
@@ -99,14 +100,14 @@ namespace Mono.Linker.Steps {
                        return false;
                }
 
-               static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource)
+               static ResolveFromXmlStep GetExternalResolveStep (EmbeddedResource resource, AssemblyDefinition assembly)
                {
-                       return new ResolveFromXmlStep (GetExternalDescriptor (resource));
+                       return new ResolveFromXmlStep (GetExternalDescriptor (resource), "resource " + resource.Name + " in " + assembly.FullName);
                }
 
                static ResolveFromXmlStep GetResolveStep (string descriptor)
                {
-                       return new ResolveFromXmlStep (GetDescriptor (descriptor));
+                       return new ResolveFromXmlStep (GetDescriptor (descriptor), "descriptor " + descriptor + " from " + Assembly.GetExecutingAssembly ().FullName);
                }
 
                static XPathDocument GetExternalDescriptor (EmbeddedResource resource)
index 6a797c16e4ecd0baeb9d8ac9945c2729f4a9a84b..5e9f681fd1784d25dfd201c93fc913c409c6fa9f 100644 (file)
@@ -38,6 +38,13 @@ using Mono.Cecil;
 
 namespace Mono.Linker.Steps {
 
+       public class XmlResolutionException : Exception {
+               public XmlResolutionException (string message, Exception innerException)
+                       : base (message, innerException)
+               {
+               }
+       }
+
        public class ResolveFromXmlStep : ResolveStep {
 
                static readonly string _signature = "signature";
@@ -47,10 +54,12 @@ namespace Mono.Linker.Steps {
                static readonly string _ns = string.Empty;
 
                XPathDocument _document;
+               string _xmlDocumentLocation;
 
-               public ResolveFromXmlStep (XPathDocument document)
+               public ResolveFromXmlStep (XPathDocument document, string xmlDocumentLocation = "<unspecified>")
                {
                        _document = document;
+                       _xmlDocumentLocation = xmlDocumentLocation;
                }
 
                protected override void Process ()
@@ -63,7 +72,11 @@ namespace Mono.Linker.Steps {
                        if (nav.LocalName != "linker")
                                return;
 
-                       ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
+                       try {
+                               ProcessAssemblies (Context, nav.SelectChildren ("assembly", _ns));
+                       } catch (Exception ex) {
+                               throw new XmlResolutionException (string.Format ("Failed to process XML description: {0}", _xmlDocumentLocation), ex);
+                       }
                }
 
                void ProcessAssemblies (LinkContext context, XPathNodeIterator iterator)
index 145ea11f951e1e33eca71409dc8997c90fb6628b..09c4ef1a798fb0642766b9dcbb4581a090fc7286 100644 (file)
@@ -129,7 +129,7 @@ common_sources = \
        file-io.h               \
        filewatcher.c           \
        filewatcher.h           \
-       gc-internal.h           \
+       gc-internals.h          \
        icall.c                 \
        icall-def.h             \
        image.c                 \
@@ -232,13 +232,9 @@ boehm_sources = \
        boehm-gc.c
 
 sgen_sources = \
-       sgen-os-posix.c         \
-       sgen-os-mach.c          \
-       sgen-os-win32.c         \
-       sgen-os-coop.c          \
        sgen-bridge.c           \
        sgen-bridge.h           \
-       sgen-bridge-internal.h  \
+       sgen-bridge-internals.h \
        sgen-old-bridge.c               \
        sgen-new-bridge.c               \
        sgen-tarjan-bridge.c            \
index d4d00deff44394764a3206f2a1149415751a0057..2dd021fdf75685adb08e51c9195f6b60a2802ebf 100644 (file)
@@ -9,7 +9,8 @@
 
 #define MONO_ABI_ALIGNOF(type) MONO_ALIGN_ ## type
 #define MONO_CURRENT_ABI_ALIGNOF(type) ((int)G_STRUCT_OFFSET(struct { char c; type x; }, x))
-
+#define MONO_ABI_SIZEOF(type) MONO_SIZEOF_ ## type
+#define MONO_CURRENT_ABI_SIZEOF(type) ((int)sizeof(type))
 
 #undef DECL_OFFSET
 #undef DECL_OFFSET2
@@ -17,6 +18,7 @@
 #define DECL_OFFSET2(struct,field,offset) MONO_OFFSET_ ## struct ## _ ## field = offset,
 #define DECL_ALIGN(type) MONO_ALIGN_ ##type = MONO_CURRENT_ABI_ALIGNOF (type),
 #define DECL_ALIGN2(type,size) MONO_ALIGN_ ##type = size,
+#define DECL_SIZE(type) MONO_SIZEOF_ ##type = MONO_CURRENT_ABI_SIZEOF (type),
 
 enum {
 #include "object-offsets.h"
index 84ac82eb981229445adeb9e39426b44e683ebf55..0e57d84fb44b27e15872550dbadec7855c493395 100644 (file)
@@ -32,7 +32,7 @@
 #endif
 #endif
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/domain-internals.h>
 #include "mono/metadata/metadata-internals.h"
@@ -42,7 +42,7 @@
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/metadata/socket-io.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-gc.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/monitor.h>
@@ -56,7 +56,7 @@
 #include <mono/metadata/tokentype.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/utils/mono-uri.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-path.h>
 #include <mono/utils/mono-stdlib.h>
 #include <mono/utils/mono-io-portability.h>
index c44dffda11e2777e042f822e00e0d02ce301b18d..3ea11123186a9720f1c2fa894364939cbaa3c721 100644 (file)
@@ -30,7 +30,7 @@
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/mono-config-dirs.h>
 #include <mono/utils/mono-digest.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-path.h>
 #include <mono/metadata/reflection.h>
 #include <mono/metadata/coree.h>
index 71e87e1c577f09e113fdc7ca9dba54647a044b44..cea84bc86ef762b4b43568ea6df44b89e9badf11 100644 (file)
@@ -37,7 +37,7 @@
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/threads-types.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-threads.h>
 #include "attach.h"
 
index 1dd66072d7222c77eb438122e6e762ac9c3d0cb3..666f6381ebc0d6473e3435217e21f002fb57f1f4 100644 (file)
@@ -11,7 +11,7 @@
 #include <string.h>
 
 #define GC_I_HIDE_POINTERS
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-gc.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/class-internals.h>
@@ -23,7 +23,7 @@
 #include <mono/metadata/runtime.h>
 #include <mono/metadata/sgen-toggleref.h>
 #include <mono/utils/atomic.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/mono-time.h>
 #include <mono/utils/mono-threads.h>
index 920cf8292ceb6e62648c17e117d81eb96835730e..a7f7454749877cfd50665064a3f17904e6ebdc30 100644 (file)
@@ -1,8 +1,8 @@
 /* 
  * Copyright 2012 Xamarin Inc
  */
-#ifndef __MONO_METADATA_CLASS_INTERBALS_H__
-#define __MONO_METADATA_CLASS_INTERBALS_H__
+#ifndef __MONO_METADATA_CLASS_INTERNALS_H__
+#define __MONO_METADATA_CLASS_INTERNALS_H__
 
 #include <mono/metadata/class.h>
 #include <mono/metadata/object.h>
@@ -1416,4 +1416,4 @@ mono_field_from_token_checked (MonoImage *image, uint32_t token, MonoClass **ret
 gpointer
 mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
 
-#endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */
+#endif /* __MONO_METADATA_CLASS_INTERNALS_H__ */
index e66d2c3b575169a8b7b7a42b6fb0295c5c41f8e3..5b81f05e28bb397cf2ccf1d37a0327f8c1adaa3e 100644 (file)
 #include <mono/metadata/security-manager.h>
 #include <mono/metadata/security-core-clr.h>
 #include <mono/metadata/attrdefs.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-string.h>
 #include <mono/utils/mono-error-internals.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-memory-model.h>
 #include <mono/utils/atomic.h>
 #include <mono/utils/bsearch.h>
index dda430f3fc7390b25ef11129f7a3143fc6c703d0..7ac6667914d94aee80c89eea89b3b8679e76e7c2 100644 (file)
 #include "mono/metadata/monitor.h"
 #include "mono/metadata/metadata-internals.h"
 #include "mono/metadata/domain-internals.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mono/metadata/threads-types.h"
 #include "mono/metadata/string-icalls.h"
 #include "mono/metadata/attrdefs.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mono/utils/mono-counters.h"
 #include "mono/utils/strenc.h"
 #include "mono/utils/atomic.h"
index 46554d214abaadce47008ef1d68aa61f794bf319..7c778bfacd14e66a927884e720d07a7d9bcd315f 100644 (file)
@@ -11,7 +11,7 @@
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/domain-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 #include <mono/metadata/console-io.h>
 #include <mono/metadata/exception.h>
index 7708a482d7d2cc17b484f49c7235c599a8bb96fa..9629857be704a59656a345ab33761c1a7f95c676 100644 (file)
@@ -31,7 +31,7 @@
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/domain-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/metadata.h>
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/utils/mono-signal-handler.h>
index 7de83602c9b252cdfce50d16369e75de67e2f1a0..ff703808c3d9587a3cb6e7ed4a19b919e4cd1139 100644 (file)
@@ -24,7 +24,7 @@
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/domain-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/metadata.h>
 
 #include <mono/metadata/console-io.h>
index a7509bda4f4f2f265e43e8109e97b4c89c669f01..85d89d579fc62b6afb8f8b831c1aaec79ceedab0 100644 (file)
 #include <string.h>
 #include <sys/stat.h>
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-compiler.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-membar.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/hazard-pointer.h>
@@ -33,7 +33,7 @@
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/metadata-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/mono-config.h>
diff --git a/mono/metadata/gc-internal.h b/mono/metadata/gc-internal.h
deleted file mode 100644 (file)
index c8c2620..0000000
+++ /dev/null
@@ -1,372 +0,0 @@
-/*
- * metadata/gc-internal.h: Internal GC interface
- *
- * Author: Paolo Molaro <lupus@ximian.com>
- *
- * (C) 2002 Ximian, Inc.
- * Copyright 2012 Xamarin Inc (http://www.xamarin.com)
- */
-
-#ifndef __MONO_METADATA_GC_INTERNAL_H__
-#define __MONO_METADATA_GC_INTERNAL_H__
-
-#include <glib.h>
-#include <mono/utils/gc_wrapper.h>
-#include <mono/metadata/object-internals.h>
-#include <mono/metadata/threads-types.h>
-#include <mono/sgen/gc-internal-agnostic.h>
-#include <mono/utils/gc_wrapper.h>
-
-#define mono_domain_finalizers_lock(domain) mono_mutex_lock (&(domain)->finalizable_objects_hash_lock);
-#define mono_domain_finalizers_unlock(domain) mono_mutex_unlock (&(domain)->finalizable_objects_hash_lock);
-
-/* Register a memory area as a conservatively scanned GC root */
-#define MONO_GC_REGISTER_ROOT_PINNING(x,src,msg) mono_gc_register_root ((char*)&(x), sizeof(x), MONO_GC_DESCRIPTOR_NULL, (src), (msg))
-
-#define MONO_GC_UNREGISTER_ROOT(x) mono_gc_deregister_root ((char*)&(x))
-
-/*
- * Register a memory location as a root pointing to memory allocated using
- * mono_gc_alloc_fixed (). This includes MonoGHashTable.
- */
-/* The result of alloc_fixed () is not GC tracked memory */
-#define MONO_GC_REGISTER_ROOT_FIXED(x,src,msg) do { \
-       if (!mono_gc_is_moving ())                              \
-               MONO_GC_REGISTER_ROOT_PINNING ((x),(src),(msg)); \
-       } while (0)
-
-/*
- * Return a GC descriptor for an array containing N pointers to memory allocated
- * by mono_gc_alloc_fixed ().
- */
-/* For SGEN, the result of alloc_fixed () is not GC tracked memory */
-#define MONO_GC_ROOT_DESCR_FOR_FIXED(n) (mono_gc_is_moving () ? mono_gc_make_root_descr_all_refs (0) : MONO_GC_DESCRIPTOR_NULL)
-
-/* Register a memory location holding a single object reference as a GC root */
-#define MONO_GC_REGISTER_ROOT_SINGLE(x,src,msg) do { \
-       g_assert (sizeof (x) == sizeof (MonoObject*)); \
-       mono_gc_register_root ((char*)&(x), sizeof(MonoObject*), mono_gc_make_root_descr_all_refs (1), (src), (msg)); \
-       } while (0)
-
-/*
- * This is used for fields which point to objects which are kept alive by other references
- * when using Boehm.
- */
-#define MONO_GC_REGISTER_ROOT_IF_MOVING(x,src,msg) do { \
-       if (mono_gc_is_moving ()) \
-               MONO_GC_REGISTER_ROOT_SINGLE(x,src,msg);                \
-} while (0)
-
-#define MONO_GC_UNREGISTER_ROOT_IF_MOVING(x) do { \
-       if (mono_gc_is_moving ()) \
-               MONO_GC_UNREGISTER_ROOT (x);                    \
-} while (0)
-
-/* useful until we keep track of gc-references in corlib etc. */
-#define IS_GC_REFERENCE(class,t) (mono_gc_is_moving () ? FALSE : ((t)->type == MONO_TYPE_U && (class)->image == mono_defaults.corlib))
-
-void   mono_object_register_finalizer               (MonoObject  *obj);
-void   ves_icall_System_GC_InternalCollect          (int          generation);
-gint64 ves_icall_System_GC_GetTotalMemory           (MonoBoolean  forceCollection);
-void   ves_icall_System_GC_KeepAlive                (MonoObject  *obj);
-void   ves_icall_System_GC_ReRegisterForFinalize    (MonoObject  *obj);
-void   ves_icall_System_GC_SuppressFinalize         (MonoObject  *obj);
-void   ves_icall_System_GC_WaitForPendingFinalizers (void);
-
-MonoObject *ves_icall_System_GCHandle_GetTarget (guint32 handle);
-guint32     ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint32 type);
-void        ves_icall_System_GCHandle_FreeHandle (guint32 handle);
-gpointer    ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle);
-void        ves_icall_System_GC_register_ephemeron_array (MonoObject *array);
-MonoObject  *ves_icall_System_GC_get_ephemeron_tombstone (void);
-
-MonoBoolean ves_icall_Mono_Runtime_SetGCAllowSynchronousMajor (MonoBoolean flag);
-
-extern void mono_gc_init (void);
-extern void mono_gc_base_init (void);
-extern void mono_gc_cleanup (void);
-extern void mono_gc_base_cleanup (void);
-
-/*
- * Return whenever the current thread is registered with the GC (i.e. started
- * by the GC pthread wrappers on unix.
- */
-extern gboolean mono_gc_is_gc_thread (void);
-
-extern gboolean mono_gc_is_finalizer_internal_thread (MonoInternalThread *thread);
-
-extern void mono_gc_set_stack_end (void *stack_end);
-
-/* only valid after the RECLAIM_START GC event and before RECLAIM_END
- * Not exported in public headers, but can be linked to (unsupported).
- */
-gboolean mono_object_is_alive (MonoObject* obj);
-gboolean mono_gc_is_finalizer_thread (MonoThread *thread);
-gpointer mono_gc_out_of_memory (size_t size);
-void     mono_gc_enable_events (void);
-void     mono_gc_enable_alloc_events (void);
-
-void mono_gchandle_set_target (guint32 gchandle, MonoObject *obj);
-
-/*Ephemeron functionality. Sgen only*/
-gboolean    mono_gc_ephemeron_array_add (MonoObject *obj);
-
-/* To disable synchronous, evacuating collections - concurrent SGen only */
-gboolean    mono_gc_set_allow_synchronous_major (gboolean flag);
-
-MonoBoolean
-mono_gc_GCHandle_CheckCurrentDomain (guint32 gchandle);
-
-/* User defined marking function */
-/* It should work like this:
- * foreach (ref in GC references in the are structure pointed to by ADDR)
- *    mark_func (ref)
- */
-typedef void (*MonoGCMarkFunc)     (MonoObject **addr, void *gc_data);
-typedef void (*MonoGCRootMarkFunc) (void *addr, MonoGCMarkFunc mark_func, void *gc_data);
-
-/* Create a descriptor with a user defined marking function */
-MonoGCDescriptor mono_gc_make_root_descr_user (MonoGCRootMarkFunc marker);
-
-/* Return whenever user defined marking functions are supported */
-gboolean mono_gc_user_markers_supported (void);
-
-/* desc is the result from mono_gc_make_descr*. A NULL value means
- * all the words might contain GC pointers.
- * The memory is non-moving and it will be explicitly deallocated.
- * size bytes will be available from the returned address (ie, descr
- * must not be stored in the returned memory)
- * NOTE: Under Boehm, this returns memory allocated using GC_malloc, so the result should
- * be stored into a location registered using MONO_GC_REGISTER_ROOT_FIXED ().
- */
-void* mono_gc_alloc_fixed            (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
-void  mono_gc_free_fixed             (void* addr);
-
-/* make sure the gchandle was allocated for an object in domain */
-gboolean mono_gchandle_is_in_domain (guint32 gchandle, MonoDomain *domain);
-void     mono_gchandle_free_domain  (MonoDomain *domain);
-
-typedef void (*FinalizerThreadCallback) (gpointer user_data);
-
-/* if there are finalizers to run, run them. Returns the number of finalizers run */
-gboolean mono_gc_pending_finalizers (void);
-void     mono_gc_finalize_notify    (void);
-
-void* mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size);
-void* mono_gc_alloc_obj (MonoVTable *vtable, size_t size);
-void* mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length);
-void* mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uintptr_t bounds_size);
-void* mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len);
-MonoGCDescriptor mono_gc_make_descr_for_string (gsize *bitmap, int numbits);
-
-void  mono_gc_register_for_finalization (MonoObject *obj, void *user_data);
-void  mono_gc_add_memory_pressure (gint64 value);
-MONO_API int   mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
-void  mono_gc_deregister_root (char* addr);
-int   mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size);
-void  mono_gc_run_finalize (void *obj, void *data);
-void  mono_gc_clear_domain (MonoDomain * domain);
-void* mono_gc_alloc_mature (MonoVTable *vtable);
-
-/* 
- * Register a root which can only be written using a write barrier.
- * Writes to the root must be done using a write barrier (MONO_ROOT_SETREF).
- * If the root uses an user defined mark routine, the writes are not required to be
- * to the area between START and START+SIZE.
- * The write barrier allows the GC to avoid scanning this root at each collection, so it
- * is more efficient.
- * FIXME: Add an API for clearing remset entries if a root with a user defined
- * mark routine is deleted.
- */
-int mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
-
-void mono_gc_wbarrier_set_root (gpointer ptr, MonoObject *value);
-
-/* Set a field of a root registered using mono_gc_register_root_wbarrier () */
-#define MONO_ROOT_SETREF(s,fieldname,value) do {       \
-       mono_gc_wbarrier_set_root (&((s)->fieldname), (MonoObject*)value); \
-} while (0)
-
-void  mono_gc_finalize_threadpool_threads (void);
-
-/* fast allocation support */
-
-int mono_gc_get_aligned_size_for_allocator (int size);
-MonoMethod* mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box, gboolean known_instance_size);
-MonoMethod* mono_gc_get_managed_array_allocator (MonoClass *klass);
-MonoMethod *mono_gc_get_managed_allocator_by_type (int atype, gboolean slowpath);
-
-guint32 mono_gc_get_managed_allocator_types (void);
-
-/* Return a short string identifying the GC, indented to be saved in AOT images */
-const char *mono_gc_get_gc_name (void);
-
-/* Fast write barriers */
-MonoMethod* mono_gc_get_specific_write_barrier (gboolean is_concurrent);
-MonoMethod* mono_gc_get_write_barrier (void);
-
-/* Fast valuetype copy */
-void mono_gc_wbarrier_value_copy_bitmap (gpointer dest, gpointer src, int size, unsigned bitmap);
-
-/* helper for the managed alloc support */
-MonoString *mono_string_alloc (int length);
-
-/* 
- * Functions supplied by the runtime and called by the GC. Currently only used
- * by SGEN.
- */
-typedef struct {
-       /* 
-        * Function called during thread startup/attach to allocate thread-local data 
-        * needed by the other functions.
-        */
-       gpointer (*thread_attach_func) (void);
-       /* 
-        * Function called during thread deatch to free the data allocated by
-        * thread_attach_func.
-        */
-       void (*thread_detach_func) (gpointer user_data);
-       /* 
-        * Function called from every thread when suspending for GC. It can save
-        * data needed for marking from thread stacks. user_data is the data returned 
-        * by attach_func. This might called with GC locks held and the word stopped,
-        * so it shouldn't do any synchronization etc.
-        */
-       void (*thread_suspend_func) (gpointer user_data, void *sigcontext, MonoContext *ctx);
-       /* 
-        * Function called to mark from thread stacks. user_data is the data returned 
-        * by attach_func. This is called twice, with the word stopped:
-        * - in the first pass, it should mark areas of the stack using
-        *   conservative marking by calling mono_gc_conservatively_scan_area ().
-        * - in the second pass, it should mark the remaining areas of the stack
-        *   using precise marking by calling mono_gc_scan_object ().
-        */
-       void (*thread_mark_func) (gpointer user_data, guint8 *stack_start, guint8 *stack_end, gboolean precise, void *gc_data);
-       /*
-        * Function called for debugging to get the current managed method for
-        * tracking the provenances of objects.
-        */
-       gpointer (*get_provenance_func) (void);
-} MonoGCCallbacks;
-
-/* Set the callback functions callable by the GC */
-void mono_gc_set_gc_callbacks (MonoGCCallbacks *callbacks);
-MonoGCCallbacks *mono_gc_get_gc_callbacks (void);
-
-/* Functions callable from the thread mark func */
-
-/* Scan the memory area between START and END conservatively */
-void mono_gc_conservatively_scan_area (void *start, void *end);
-
-/* Scan OBJ, returning its new address */
-void *mono_gc_scan_object (void *obj, void *gc_data);
-
-/* Return the suspend signal number used by the GC to suspend threads,
-   or -1 if not applicable. */
-int mono_gc_get_suspend_signal (void);
-
-/* Return the suspend signal number used by the GC to suspend threads,
-   or -1 if not applicable. */
-int mono_gc_get_restart_signal (void);
-
-/*
- * Return a human readable description of the GC in malloc-ed memory.
- */
-char* mono_gc_get_description (void);
-
-/*
- * Configure the GC to desktop mode
- */
-void mono_gc_set_desktop_mode (void);
-
-/*
- * Return whenever this GC can move objects
- */
-gboolean mono_gc_is_moving (void);
-
-typedef void* (*MonoGCLockedCallbackFunc) (void *data);
-
-void* mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data);
-
-int mono_gc_get_los_limit (void);
-
-guint8* mono_gc_get_card_table (int *shift_bits, gpointer *card_mask);
-gboolean mono_gc_card_table_nursery_check (void);
-
-void* mono_gc_get_nursery (int *shift_bits, size_t *size);
-
-void mono_gc_set_current_thread_appdomain (MonoDomain *domain);
-
-void mono_gc_set_skip_thread (gboolean skip);
-
-#ifndef HOST_WIN32
-int mono_gc_pthread_create (pthread_t *new_thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
-#endif
-
-/*
- * Return whenever GC is disabled
- */
-gboolean mono_gc_is_disabled (void);
-
-/*
- * Return whenever this is the null GC
- */
-gboolean mono_gc_is_null (void);
-
-void mono_gc_set_string_length (MonoString *str, gint32 new_length);
-
-#if defined(__MACH__)
-void mono_gc_register_mach_exception_thread (pthread_t thread);
-pthread_t mono_gc_get_mach_exception_thread (void);
-#endif
-
-gboolean mono_gc_precise_stack_mark_enabled (void);
-
-typedef struct _RefQueueEntry RefQueueEntry;
-
-struct _RefQueueEntry {
-       void *dis_link;
-       guint32 gchandle;
-       MonoDomain *domain;
-       void *user_data;
-       RefQueueEntry *next;
-};
-
-struct _MonoReferenceQueue {
-       RefQueueEntry *queue;
-       mono_reference_queue_callback callback;
-       MonoReferenceQueue *next;
-       gboolean should_be_deleted;
-};
-
-enum {
-       MONO_GC_FINALIZER_EXTENSION_VERSION = 1,
-};
-
-typedef struct {
-       int version;
-       gboolean (*is_class_finalization_aware) (MonoClass *klass);
-       void (*object_queued_for_finalization) (MonoObject *object);
-} MonoGCFinalizerCallbacks;
-
-MONO_API void mono_gc_register_finalizer_callbacks (MonoGCFinalizerCallbacks *callbacks);
-
-
-#ifdef HOST_WIN32
-BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved);
-#endif
-
-guint mono_gc_get_vtable_bits (MonoClass *klass);
-
-void mono_gc_register_altstack (gpointer stack, gint32 stack_size, gpointer altstack, gint32 altstack_size);
-
-/* If set, print debugging messages around finalizers. */
-extern gboolean log_finalizers;
-
-/* If set, do not run finalizers. */
-extern gboolean mono_do_not_finalize;
-/* List of names of classes not to finalize. */
-extern gchar **mono_do_not_finalize_class_names;
-
-#endif /* __MONO_METADATA_GC_INTERNAL_H__ */
-
diff --git a/mono/metadata/gc-internals.h b/mono/metadata/gc-internals.h
new file mode 100644 (file)
index 0000000..465c92b
--- /dev/null
@@ -0,0 +1,372 @@
+/*
+ * metadata/gc-internals.h: Internal GC interface
+ *
+ * Author: Paolo Molaro <lupus@ximian.com>
+ *
+ * (C) 2002 Ximian, Inc.
+ * Copyright 2012 Xamarin Inc (http://www.xamarin.com)
+ */
+
+#ifndef __MONO_METADATA_GC_INTERNAL_H__
+#define __MONO_METADATA_GC_INTERNAL_H__
+
+#include <glib.h>
+#include <mono/utils/gc_wrapper.h>
+#include <mono/metadata/object-internals.h>
+#include <mono/metadata/threads-types.h>
+#include <mono/sgen/gc-internal-agnostic.h>
+#include <mono/utils/gc_wrapper.h>
+
+#define mono_domain_finalizers_lock(domain) mono_mutex_lock (&(domain)->finalizable_objects_hash_lock);
+#define mono_domain_finalizers_unlock(domain) mono_mutex_unlock (&(domain)->finalizable_objects_hash_lock);
+
+/* Register a memory area as a conservatively scanned GC root */
+#define MONO_GC_REGISTER_ROOT_PINNING(x,src,msg) mono_gc_register_root ((char*)&(x), sizeof(x), MONO_GC_DESCRIPTOR_NULL, (src), (msg))
+
+#define MONO_GC_UNREGISTER_ROOT(x) mono_gc_deregister_root ((char*)&(x))
+
+/*
+ * Register a memory location as a root pointing to memory allocated using
+ * mono_gc_alloc_fixed (). This includes MonoGHashTable.
+ */
+/* The result of alloc_fixed () is not GC tracked memory */
+#define MONO_GC_REGISTER_ROOT_FIXED(x,src,msg) do { \
+       if (!mono_gc_is_moving ())                              \
+               MONO_GC_REGISTER_ROOT_PINNING ((x),(src),(msg)); \
+       } while (0)
+
+/*
+ * Return a GC descriptor for an array containing N pointers to memory allocated
+ * by mono_gc_alloc_fixed ().
+ */
+/* For SGEN, the result of alloc_fixed () is not GC tracked memory */
+#define MONO_GC_ROOT_DESCR_FOR_FIXED(n) (mono_gc_is_moving () ? mono_gc_make_root_descr_all_refs (0) : MONO_GC_DESCRIPTOR_NULL)
+
+/* Register a memory location holding a single object reference as a GC root */
+#define MONO_GC_REGISTER_ROOT_SINGLE(x,src,msg) do { \
+       g_assert (sizeof (x) == sizeof (MonoObject*)); \
+       mono_gc_register_root ((char*)&(x), sizeof(MonoObject*), mono_gc_make_root_descr_all_refs (1), (src), (msg)); \
+       } while (0)
+
+/*
+ * This is used for fields which point to objects which are kept alive by other references
+ * when using Boehm.
+ */
+#define MONO_GC_REGISTER_ROOT_IF_MOVING(x,src,msg) do { \
+       if (mono_gc_is_moving ()) \
+               MONO_GC_REGISTER_ROOT_SINGLE(x,src,msg);                \
+} while (0)
+
+#define MONO_GC_UNREGISTER_ROOT_IF_MOVING(x) do { \
+       if (mono_gc_is_moving ()) \
+               MONO_GC_UNREGISTER_ROOT (x);                    \
+} while (0)
+
+/* useful until we keep track of gc-references in corlib etc. */
+#define IS_GC_REFERENCE(class,t) (mono_gc_is_moving () ? FALSE : ((t)->type == MONO_TYPE_U && (class)->image == mono_defaults.corlib))
+
+void   mono_object_register_finalizer               (MonoObject  *obj);
+void   ves_icall_System_GC_InternalCollect          (int          generation);
+gint64 ves_icall_System_GC_GetTotalMemory           (MonoBoolean  forceCollection);
+void   ves_icall_System_GC_KeepAlive                (MonoObject  *obj);
+void   ves_icall_System_GC_ReRegisterForFinalize    (MonoObject  *obj);
+void   ves_icall_System_GC_SuppressFinalize         (MonoObject  *obj);
+void   ves_icall_System_GC_WaitForPendingFinalizers (void);
+
+MonoObject *ves_icall_System_GCHandle_GetTarget (guint32 handle);
+guint32     ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint32 type);
+void        ves_icall_System_GCHandle_FreeHandle (guint32 handle);
+gpointer    ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle);
+void        ves_icall_System_GC_register_ephemeron_array (MonoObject *array);
+MonoObject  *ves_icall_System_GC_get_ephemeron_tombstone (void);
+
+MonoBoolean ves_icall_Mono_Runtime_SetGCAllowSynchronousMajor (MonoBoolean flag);
+
+extern void mono_gc_init (void);
+extern void mono_gc_base_init (void);
+extern void mono_gc_cleanup (void);
+extern void mono_gc_base_cleanup (void);
+
+/*
+ * Return whenever the current thread is registered with the GC (i.e. started
+ * by the GC pthread wrappers on unix.
+ */
+extern gboolean mono_gc_is_gc_thread (void);
+
+extern gboolean mono_gc_is_finalizer_internal_thread (MonoInternalThread *thread);
+
+extern void mono_gc_set_stack_end (void *stack_end);
+
+/* only valid after the RECLAIM_START GC event and before RECLAIM_END
+ * Not exported in public headers, but can be linked to (unsupported).
+ */
+gboolean mono_object_is_alive (MonoObject* obj);
+gboolean mono_gc_is_finalizer_thread (MonoThread *thread);
+gpointer mono_gc_out_of_memory (size_t size);
+void     mono_gc_enable_events (void);
+void     mono_gc_enable_alloc_events (void);
+
+void mono_gchandle_set_target (guint32 gchandle, MonoObject *obj);
+
+/*Ephemeron functionality. Sgen only*/
+gboolean    mono_gc_ephemeron_array_add (MonoObject *obj);
+
+/* To disable synchronous, evacuating collections - concurrent SGen only */
+gboolean    mono_gc_set_allow_synchronous_major (gboolean flag);
+
+MonoBoolean
+mono_gc_GCHandle_CheckCurrentDomain (guint32 gchandle);
+
+/* User defined marking function */
+/* It should work like this:
+ * foreach (ref in GC references in the are structure pointed to by ADDR)
+ *    mark_func (ref)
+ */
+typedef void (*MonoGCMarkFunc)     (MonoObject **addr, void *gc_data);
+typedef void (*MonoGCRootMarkFunc) (void *addr, MonoGCMarkFunc mark_func, void *gc_data);
+
+/* Create a descriptor with a user defined marking function */
+MonoGCDescriptor mono_gc_make_root_descr_user (MonoGCRootMarkFunc marker);
+
+/* Return whenever user defined marking functions are supported */
+gboolean mono_gc_user_markers_supported (void);
+
+/* desc is the result from mono_gc_make_descr*. A NULL value means
+ * all the words might contain GC pointers.
+ * The memory is non-moving and it will be explicitly deallocated.
+ * size bytes will be available from the returned address (ie, descr
+ * must not be stored in the returned memory)
+ * NOTE: Under Boehm, this returns memory allocated using GC_malloc, so the result should
+ * be stored into a location registered using MONO_GC_REGISTER_ROOT_FIXED ().
+ */
+void* mono_gc_alloc_fixed            (size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
+void  mono_gc_free_fixed             (void* addr);
+
+/* make sure the gchandle was allocated for an object in domain */
+gboolean mono_gchandle_is_in_domain (guint32 gchandle, MonoDomain *domain);
+void     mono_gchandle_free_domain  (MonoDomain *domain);
+
+typedef void (*FinalizerThreadCallback) (gpointer user_data);
+
+/* if there are finalizers to run, run them. Returns the number of finalizers run */
+gboolean mono_gc_pending_finalizers (void);
+void     mono_gc_finalize_notify    (void);
+
+void* mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size);
+void* mono_gc_alloc_obj (MonoVTable *vtable, size_t size);
+void* mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length);
+void* mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uintptr_t bounds_size);
+void* mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len);
+MonoGCDescriptor mono_gc_make_descr_for_string (gsize *bitmap, int numbits);
+
+void  mono_gc_register_for_finalization (MonoObject *obj, void *user_data);
+void  mono_gc_add_memory_pressure (gint64 value);
+MONO_API int   mono_gc_register_root (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
+void  mono_gc_deregister_root (char* addr);
+int   mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size);
+void  mono_gc_run_finalize (void *obj, void *data);
+void  mono_gc_clear_domain (MonoDomain * domain);
+void* mono_gc_alloc_mature (MonoVTable *vtable);
+
+/* 
+ * Register a root which can only be written using a write barrier.
+ * Writes to the root must be done using a write barrier (MONO_ROOT_SETREF).
+ * If the root uses an user defined mark routine, the writes are not required to be
+ * to the area between START and START+SIZE.
+ * The write barrier allows the GC to avoid scanning this root at each collection, so it
+ * is more efficient.
+ * FIXME: Add an API for clearing remset entries if a root with a user defined
+ * mark routine is deleted.
+ */
+int mono_gc_register_root_wbarrier (char *start, size_t size, MonoGCDescriptor descr, MonoGCRootSource source, const char *msg);
+
+void mono_gc_wbarrier_set_root (gpointer ptr, MonoObject *value);
+
+/* Set a field of a root registered using mono_gc_register_root_wbarrier () */
+#define MONO_ROOT_SETREF(s,fieldname,value) do {       \
+       mono_gc_wbarrier_set_root (&((s)->fieldname), (MonoObject*)value); \
+} while (0)
+
+void  mono_gc_finalize_threadpool_threads (void);
+
+/* fast allocation support */
+
+int mono_gc_get_aligned_size_for_allocator (int size);
+MonoMethod* mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box, gboolean known_instance_size);
+MonoMethod* mono_gc_get_managed_array_allocator (MonoClass *klass);
+MonoMethod *mono_gc_get_managed_allocator_by_type (int atype, gboolean slowpath);
+
+guint32 mono_gc_get_managed_allocator_types (void);
+
+/* Return a short string identifying the GC, indented to be saved in AOT images */
+const char *mono_gc_get_gc_name (void);
+
+/* Fast write barriers */
+MonoMethod* mono_gc_get_specific_write_barrier (gboolean is_concurrent);
+MonoMethod* mono_gc_get_write_barrier (void);
+
+/* Fast valuetype copy */
+void mono_gc_wbarrier_value_copy_bitmap (gpointer dest, gpointer src, int size, unsigned bitmap);
+
+/* helper for the managed alloc support */
+MonoString *mono_string_alloc (int length);
+
+/* 
+ * Functions supplied by the runtime and called by the GC. Currently only used
+ * by SGEN.
+ */
+typedef struct {
+       /* 
+        * Function called during thread startup/attach to allocate thread-local data 
+        * needed by the other functions.
+        */
+       gpointer (*thread_attach_func) (void);
+       /* 
+        * Function called during thread deatch to free the data allocated by
+        * thread_attach_func.
+        */
+       void (*thread_detach_func) (gpointer user_data);
+       /* 
+        * Function called from every thread when suspending for GC. It can save
+        * data needed for marking from thread stacks. user_data is the data returned 
+        * by attach_func. This might called with GC locks held and the word stopped,
+        * so it shouldn't do any synchronization etc.
+        */
+       void (*thread_suspend_func) (gpointer user_data, void *sigcontext, MonoContext *ctx);
+       /* 
+        * Function called to mark from thread stacks. user_data is the data returned 
+        * by attach_func. This is called twice, with the word stopped:
+        * - in the first pass, it should mark areas of the stack using
+        *   conservative marking by calling mono_gc_conservatively_scan_area ().
+        * - in the second pass, it should mark the remaining areas of the stack
+        *   using precise marking by calling mono_gc_scan_object ().
+        */
+       void (*thread_mark_func) (gpointer user_data, guint8 *stack_start, guint8 *stack_end, gboolean precise, void *gc_data);
+       /*
+        * Function called for debugging to get the current managed method for
+        * tracking the provenances of objects.
+        */
+       gpointer (*get_provenance_func) (void);
+} MonoGCCallbacks;
+
+/* Set the callback functions callable by the GC */
+void mono_gc_set_gc_callbacks (MonoGCCallbacks *callbacks);
+MonoGCCallbacks *mono_gc_get_gc_callbacks (void);
+
+/* Functions callable from the thread mark func */
+
+/* Scan the memory area between START and END conservatively */
+void mono_gc_conservatively_scan_area (void *start, void *end);
+
+/* Scan OBJ, returning its new address */
+void *mono_gc_scan_object (void *obj, void *gc_data);
+
+/* Return the suspend signal number used by the GC to suspend threads,
+   or -1 if not applicable. */
+int mono_gc_get_suspend_signal (void);
+
+/* Return the suspend signal number used by the GC to suspend threads,
+   or -1 if not applicable. */
+int mono_gc_get_restart_signal (void);
+
+/*
+ * Return a human readable description of the GC in malloc-ed memory.
+ */
+char* mono_gc_get_description (void);
+
+/*
+ * Configure the GC to desktop mode
+ */
+void mono_gc_set_desktop_mode (void);
+
+/*
+ * Return whenever this GC can move objects
+ */
+gboolean mono_gc_is_moving (void);
+
+typedef void* (*MonoGCLockedCallbackFunc) (void *data);
+
+void* mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data);
+
+int mono_gc_get_los_limit (void);
+
+guint8* mono_gc_get_card_table (int *shift_bits, gpointer *card_mask);
+gboolean mono_gc_card_table_nursery_check (void);
+
+void* mono_gc_get_nursery (int *shift_bits, size_t *size);
+
+void mono_gc_set_current_thread_appdomain (MonoDomain *domain);
+
+void mono_gc_set_skip_thread (gboolean skip);
+
+#ifndef HOST_WIN32
+int mono_gc_pthread_create (pthread_t *new_thread, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg);
+#endif
+
+/*
+ * Return whenever GC is disabled
+ */
+gboolean mono_gc_is_disabled (void);
+
+/*
+ * Return whenever this is the null GC
+ */
+gboolean mono_gc_is_null (void);
+
+void mono_gc_set_string_length (MonoString *str, gint32 new_length);
+
+#if defined(__MACH__)
+void mono_gc_register_mach_exception_thread (pthread_t thread);
+pthread_t mono_gc_get_mach_exception_thread (void);
+#endif
+
+gboolean mono_gc_precise_stack_mark_enabled (void);
+
+typedef struct _RefQueueEntry RefQueueEntry;
+
+struct _RefQueueEntry {
+       void *dis_link;
+       guint32 gchandle;
+       MonoDomain *domain;
+       void *user_data;
+       RefQueueEntry *next;
+};
+
+struct _MonoReferenceQueue {
+       RefQueueEntry *queue;
+       mono_reference_queue_callback callback;
+       MonoReferenceQueue *next;
+       gboolean should_be_deleted;
+};
+
+enum {
+       MONO_GC_FINALIZER_EXTENSION_VERSION = 1,
+};
+
+typedef struct {
+       int version;
+       gboolean (*is_class_finalization_aware) (MonoClass *klass);
+       void (*object_queued_for_finalization) (MonoObject *object);
+} MonoGCFinalizerCallbacks;
+
+MONO_API void mono_gc_register_finalizer_callbacks (MonoGCFinalizerCallbacks *callbacks);
+
+
+#ifdef HOST_WIN32
+BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved);
+#endif
+
+guint mono_gc_get_vtable_bits (MonoClass *klass);
+
+void mono_gc_register_altstack (gpointer stack, gint32 stack_size, gpointer altstack, gint32 altstack_size);
+
+/* If set, print debugging messages around finalizers. */
+extern gboolean log_finalizers;
+
+/* If set, do not run finalizers. */
+extern gboolean mono_do_not_finalize;
+/* List of names of classes not to finalize. */
+extern gchar **mono_do_not_finalize_class_names;
+
+#endif /* __MONO_METADATA_GC_INTERNAL_H__ */
+
index 39929e411f13a769324656a152486e2a0de182ec..18f3b655cad9097d0046b02d9daeb35a315884cf 100644 (file)
@@ -12,7 +12,7 @@
 #include <glib.h>
 #include <string.h>
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-gc.h>
 #include <mono/metadata/threads.h>
 #include <mono/metadata/tabledefs.h>
@@ -26,8 +26,8 @@
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/sgen/sgen-conf.h>
 #include <mono/sgen/sgen-gc.h>
-#include <mono/utils/mono-logger-internal.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/utils/mono-logger-internals.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/marshal.h> /* for mono_delegate_free_ftnptr () */
 #include <mono/metadata/attach.h>
 #include <mono/metadata/console-io.h>
index cb5b857ea79066295db3560e34a39e087409b681..1b36b74bc697c68e14b008387c7a54125f16164e 100644 (file)
@@ -55,7 +55,7 @@
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/reflection-internals.h>
 #include <mono/metadata/marshal.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-gc.h>
 #include <mono/metadata/rand.h>
 #include <mono/metadata/sysmath.h>
index aaa7d313271d2dbf86c0032cf80a3cf77d4caf94..d88757ab4fdb729f27cf39ccb3e398144f426e54 100644 (file)
@@ -27,7 +27,7 @@
 #include "marshal.h"
 #include "coree.h"
 #include <mono/io-layer/io-layer.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-path.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-io-portability.h>
index c7ed68656b890fbce3fb5d290bf1a6db7cdaa3c2..06375a4977384fa0470080717388e77d08baed90 100644 (file)
 #include <string.h>
 #include <sys/stat.h>
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-compiler.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-membar.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/hazard-pointer.h>
@@ -33,7 +33,7 @@
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/metadata-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/mono-config.h>
index c9b2131e70e97e32bc3228c6c103f1fe4d94b150..b99d6a00b1168fc4ccd5be41af8686ab7c62bb64 100644 (file)
@@ -39,7 +39,7 @@
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/lock-tracer.h>
 #include <mono/metadata/verify-internals.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-dl.h>
 #include <mono/utils/mono-membar.h>
 #include <mono/utils/mono-counters.h>
index 5227acb1aaf20ee0c9f40a1c19b5108ea5d0f905..4a2de28586961787758d9773ba6223c42b0c4b9e 100644 (file)
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/metadata-internals.h"
 #include "mono/metadata/domain-internals.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mono/metadata/threads-types.h"
 #include "mono/metadata/string-icalls.h"
 #include "mono/metadata/attrdefs.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mono/metadata/cominterop.h"
 #include "mono/metadata/remoting.h"
 #include "mono/metadata/reflection-internals.h"
index ff3c39ed251511f714e418a1baad5397dda8c095..29350e4d8461acd65ac7c286a2d00063d12c8fde 100644 (file)
@@ -171,7 +171,6 @@ typedef struct {
 } ProxyWrapperInfo;
 
 typedef struct {
-       int nursery_bits;
 } WriteBarrierWrapperInfo;
 
 typedef struct {
index c3bb80740ea2622b37749c30bafdd07108f9babf..1f74ab9debc2f4852bb91568e8c69291fa711ce7 100644 (file)
@@ -4550,7 +4550,7 @@ mono_type_size (MonoType *t, int *align)
        }
        if (t->byref) {
                *align = MONO_ABI_ALIGNOF (gpointer);
-               return sizeof (gpointer);
+               return MONO_ABI_SIZEOF (gpointer);
        }
 
        simple_type = t->type;
@@ -4588,26 +4588,22 @@ mono_type_size (MonoType *t, int *align)
        case MONO_TYPE_I:
        case MONO_TYPE_U:
                *align = MONO_ABI_ALIGNOF (gpointer);
-               return sizeof (gpointer);
-       case MONO_TYPE_STRING:
-               *align = MONO_ABI_ALIGNOF (gpointer);
-               return sizeof (gpointer);
-       case MONO_TYPE_OBJECT:
-               *align = MONO_ABI_ALIGNOF (gpointer);
-               return sizeof (gpointer);
+               return MONO_ABI_SIZEOF (gpointer);
        case MONO_TYPE_VALUETYPE: {
                if (t->data.klass->enumtype)
                        return mono_type_size (mono_class_enum_basetype (t->data.klass), align);
                else
                        return mono_class_value_size (t->data.klass, (guint32*)align);
        }
+       case MONO_TYPE_STRING:
+       case MONO_TYPE_OBJECT:
        case MONO_TYPE_CLASS:
        case MONO_TYPE_SZARRAY:
        case MONO_TYPE_PTR:
        case MONO_TYPE_FNPTR:
        case MONO_TYPE_ARRAY:
                *align = MONO_ABI_ALIGNOF (gpointer);
-               return sizeof (gpointer);
+               return MONO_ABI_SIZEOF (gpointer);
        case MONO_TYPE_TYPEDBYREF:
                return mono_class_value_size (mono_defaults.typed_reference_class, (guint32*)align);
        case MONO_TYPE_GENERICINST: {
@@ -4623,14 +4619,14 @@ mono_type_size (MonoType *t, int *align)
                                return mono_class_value_size (mono_class_from_mono_type (t), (guint32*)align);
                } else {
                        *align = MONO_ABI_ALIGNOF (gpointer);
-                       return sizeof (gpointer);
+                       return MONO_ABI_SIZEOF (gpointer);
                }
        }
        case MONO_TYPE_VAR:
        case MONO_TYPE_MVAR:
                if (!t->data.generic_param->gshared_constraint || t->data.generic_param->gshared_constraint->type == MONO_TYPE_VALUETYPE) {
                        *align = MONO_ABI_ALIGNOF (gpointer);
-                       return sizeof (gpointer);
+                       return MONO_ABI_SIZEOF (gpointer);
                } else {
                        /* The gparam can only match types given by gshared_constraint */
                        return mono_type_size (t->data.generic_param->gshared_constraint, align);
@@ -4661,7 +4657,7 @@ mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open)
        int tmp;
        MonoTypeEnum simple_type;
 #if SIZEOF_VOID_P == SIZEOF_REGISTER
-       int stack_slot_size = sizeof (gpointer);
+       int stack_slot_size = MONO_ABI_SIZEOF (gpointer);
        int stack_slot_align = MONO_ABI_ALIGNOF (gpointer);
 #elif SIZEOF_VOID_P < SIZEOF_REGISTER
        int stack_slot_size = SIZEOF_REGISTER;
index 151c1d382c91033269361ce8ff1fcdbb2da617f2..f86c4233baf90375a94ee5c248a54c3df585d88a 100644 (file)
@@ -20,7 +20,7 @@
 #include <mono/io-layer/io-layer.h>
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/class-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/method-builder.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/tabledefs.h>
index 440bc5f5da19018d0e031ece20fd6603e1733f8b..e29fe9d0fccf942479547318a64628afd60af3c4 100644 (file)
@@ -17,7 +17,7 @@
 #include "mono/metadata/mono-config.h"
 #include "mono/metadata/metadata-internals.h"
 #include "mono/metadata/object-internals.h"
-#include "mono/utils/mono-logger-internal.h"
+#include "mono/utils/mono-logger-internals.h"
 
 #if defined(TARGET_PS3)
 #define CONFIG_OS "CellOS"
index 42c980214eb53a73ef54cd57c7e3af979dd362d0..04b5d647be15838b4ffb9a7024ad297c0af6592f 100644 (file)
@@ -18,7 +18,7 @@
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/mono-endian.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mempool.h>
 #include <mono/metadata/debug-mono-ppdb.h>
 #include <string.h>
index d1685bc3ddaa9c62be6f4d353d74db30fdeda055..bbfa757212bd7706345bf9b4de0851d14af76cc8 100644 (file)
@@ -30,7 +30,7 @@
 #include <math.h>
 #include <glib.h>
 #include "mono-hash.h"
-#include "metadata/gc-internal.h"
+#include "metadata/gc-internals.h"
 #include <mono/utils/checked-build.h>
 
 #ifdef HAVE_BOEHM_GC
index e8be3a526b0d2681025fbe45e4c9e1a94201b935..8ecac9866101498875a7edbd1ee03fd176f72a6d 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <glib.h>
 
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 
 /* This is an implementation of a growable pointer array that avoids doing memory allocations for small sizes.
  * It works by allocating an initial small array on stack and only going to gc tracked memory if needed.
index b1880ba69d8c8a26aa3d6cf948956a89ed48cf21..773410ad7b6fcfb9c073ebc42025e51dd1e22400 100644 (file)
@@ -9,7 +9,7 @@
 #include "config.h"
 #include <glib.h>
 #include <mono/metadata/mono-gc.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/runtime.h>
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-threads.h>
index 56e05fbac4cef41cadd8d4137020f021c1dc80f0..bd5c719e60ac57e05ea16a9203ea746a278e1261 100644 (file)
@@ -38,6 +38,14 @@ DECL_ALIGN(float)
 DECL_ALIGN(double)
 DECL_ALIGN(gpointer)
 
+DECL_SIZE(gint8)
+DECL_SIZE(gint16)
+DECL_SIZE(gint32)
+DECL_SIZE(gint64)
+DECL_SIZE(float)
+DECL_SIZE(double)
+DECL_SIZE(gpointer)
+
 #ifndef DISABLE_METADATA_OFFSETS
 //object offsets
 DECL_OFFSET(MonoObject, vtable)
index 2f1c27da01119ed2fbc259b9eaa5acb4dc4b3ee1..938289bd8f85b8ce23dffe6e0cc52375aa52e0c7 100644 (file)
@@ -21,7 +21,7 @@
 #include <mono/metadata/tokentype.h>
 #include <mono/metadata/loader.h>
 #include <mono/metadata/object.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/domain-internals.h>
 #include "mono/metadata/metadata-internals.h"
@@ -36,7 +36,7 @@
 #include "mono/metadata/profiler-private.h"
 #include "mono/metadata/security-manager.h"
 #include "mono/metadata/mono-debug-debugger.h"
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/verify-internals.h>
 #include <mono/utils/strenc.h>
 #include <mono/utils/mono-counters.h>
index a9d0e68f6dee9c9a678c548c321b55d3304898ca..435e4671a2bbd129403bdccd99daeb9af5525ccd 100644 (file)
@@ -19,7 +19,7 @@
 #include "mono/metadata/metadata-internals.h"
 #include "mono/metadata/class-internals.h"
 #include "mono/metadata/domain-internals.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mono/metadata/mono-config-dirs.h"
 #include "mono/io-layer/io-layer.h"
 #include "mono/utils/mono-dl.h"
index 7244722d8e0ec2c8f57528f1927b09564541ce09..dc8141bbdbfbc468815ac40c82d779d04c2467c7 100644 (file)
@@ -1,8 +1,8 @@
 /* 
  * Copyright 2014 Xamarin Inc
  */
-#ifndef __MONO_METADATA_REFLECTION_INTERBALS_H__
-#define __MONO_METADATA_REFLECTION_INTERBALS_H__
+#ifndef __MONO_METADATA_REFLECTION_INTERNALS_H__
+#define __MONO_METADATA_REFLECTION_INTERNALS_H__
 
 #include <mono/metadata/reflection.h>
 #include <mono/utils/mono-compiler.h>
@@ -14,4 +14,4 @@ mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_k
 char*
 mono_identifier_unescape_type_name_chars (char* identifier);
 
-#endif
+#endif /* __MONO_METADATA_REFLECTION_INTERNALS_H__ */
index 0c1fbe397c928589c94143fc0e9fa459353749cf..3d34adb29f1e17c9ab403fde6200c5a422f820d2 100644 (file)
@@ -17,7 +17,7 @@
 #include "mono/metadata/metadata-internals.h"
 #include <mono/metadata/profiler-private.h>
 #include "mono/metadata/class-internals.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mono/metadata/tokentype.h"
 #include "mono/metadata/domain-internals.h"
 #include "mono/metadata/opcodes.h"
@@ -35,7 +35,7 @@
 #include "image.h"
 #include "cil-coff.h"
 #include "mono-endian.h"
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/security-core-clr.h>
 #include <mono/metadata/debug-helpers.h>
index 07f5da24dbcb91568711a7d5e558ce2cda624d30..6ec8cbe1ea8b8f90b88af1a1bebc0d65115a2ef6 100644 (file)
@@ -16,7 +16,7 @@
 #include <mono/metadata/object.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/debug-helpers.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 
 #include "security-core-clr.h"
 
diff --git a/mono/metadata/sgen-bridge-internal.h b/mono/metadata/sgen-bridge-internal.h
deleted file mode 100644 (file)
index 301300b..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * sgen-bridge-internal.h: The cross-GC bridge.
- *
- * Copyright (C) 2015 Xamarin Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __MONO_SGENBRIDGEINTERNAL_H__
-#define __MONO_SGENBRIDGEINTERNAL_H__
-
-#include "config.h"
-
-#ifdef HAVE_SGEN_GC
-
-#include "mono/utils/mono-compiler.h"
-
-#include "mono/sgen/sgen-gc.h"
-#include "mono/metadata/sgen-bridge.h"
-
-extern volatile gboolean bridge_processing_in_progress;
-extern MonoGCBridgeCallbacks bridge_callbacks;
-
-gboolean sgen_need_bridge_processing (void);
-void sgen_bridge_reset_data (void);
-void sgen_bridge_processing_stw_step (void);
-void sgen_bridge_processing_finish (int generation);
-gboolean sgen_is_bridge_object (GCObject *obj);
-MonoGCBridgeObjectKind sgen_bridge_class_kind (MonoClass *klass);
-void sgen_bridge_register_finalized_object (GCObject *object);
-void sgen_bridge_describe_pointer (GCObject *object);
-
-gboolean sgen_is_bridge_object (GCObject *obj);
-void sgen_mark_bridge_object (GCObject *obj);
-
-gboolean sgen_bridge_handle_gc_debug (const char *opt);
-void sgen_bridge_print_gc_debug_usage (void);
-
-typedef struct {
-       void (*reset_data) (void);
-       void (*processing_stw_step) (void);
-       void (*processing_build_callback_data) (int generation);
-       void (*processing_after_callback) (int generation);
-       MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
-       void (*register_finalized_object) (GCObject *object);
-       void (*describe_pointer) (GCObject *object);
-       void (*enable_accounting) (void);
-       void (*set_dump_prefix) (const char *prefix);
-
-       /*
-        * These are set by processing_build_callback_data().
-        */
-       int num_sccs;
-       MonoGCBridgeSCC **api_sccs;
-
-       int num_xrefs;
-       MonoGCBridgeXRef *api_xrefs;
-} SgenBridgeProcessor;
-
-void sgen_old_bridge_init (SgenBridgeProcessor *collector);
-void sgen_new_bridge_init (SgenBridgeProcessor *collector);
-void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
-void sgen_set_bridge_implementation (const char *name);
-void sgen_bridge_set_dump_prefix (const char *prefix);
-
-#endif
-
-#endif
diff --git a/mono/metadata/sgen-bridge-internals.h b/mono/metadata/sgen-bridge-internals.h
new file mode 100644 (file)
index 0000000..ac7dfb9
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * sgen-bridge-internals.h: The cross-GC bridge.
+ *
+ * Copyright (C) 2015 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __MONO_SGENBRIDGEINTERNAL_H__
+#define __MONO_SGENBRIDGEINTERNAL_H__
+
+#include "config.h"
+
+#ifdef HAVE_SGEN_GC
+
+#include "mono/utils/mono-compiler.h"
+
+#include "mono/sgen/sgen-gc.h"
+#include "mono/metadata/sgen-bridge.h"
+
+extern volatile gboolean bridge_processing_in_progress;
+extern MonoGCBridgeCallbacks bridge_callbacks;
+
+gboolean sgen_need_bridge_processing (void);
+void sgen_bridge_reset_data (void);
+void sgen_bridge_processing_stw_step (void);
+void sgen_bridge_processing_finish (int generation);
+gboolean sgen_is_bridge_object (GCObject *obj);
+MonoGCBridgeObjectKind sgen_bridge_class_kind (MonoClass *klass);
+void sgen_bridge_register_finalized_object (GCObject *object);
+void sgen_bridge_describe_pointer (GCObject *object);
+
+gboolean sgen_is_bridge_object (GCObject *obj);
+void sgen_mark_bridge_object (GCObject *obj);
+
+gboolean sgen_bridge_handle_gc_debug (const char *opt);
+void sgen_bridge_print_gc_debug_usage (void);
+
+typedef struct {
+       void (*reset_data) (void);
+       void (*processing_stw_step) (void);
+       void (*processing_build_callback_data) (int generation);
+       void (*processing_after_callback) (int generation);
+       MonoGCBridgeObjectKind (*class_kind) (MonoClass *klass);
+       void (*register_finalized_object) (GCObject *object);
+       void (*describe_pointer) (GCObject *object);
+       void (*enable_accounting) (void);
+       void (*set_dump_prefix) (const char *prefix);
+
+       /*
+        * These are set by processing_build_callback_data().
+        */
+       int num_sccs;
+       MonoGCBridgeSCC **api_sccs;
+
+       int num_xrefs;
+       MonoGCBridgeXRef *api_xrefs;
+} SgenBridgeProcessor;
+
+void sgen_old_bridge_init (SgenBridgeProcessor *collector);
+void sgen_new_bridge_init (SgenBridgeProcessor *collector);
+void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector);
+void sgen_set_bridge_implementation (const char *name);
+void sgen_bridge_set_dump_prefix (const char *prefix);
+
+#endif
+
+#endif
index c85d60d9affa04e94f2b687e6d49b461e33cab67..67e6a05bf30af7889765dfbd9699b322dcbe02eb 100644 (file)
 #include <stdlib.h>
 
 #include "sgen/sgen-gc.h"
-#include "sgen-bridge-internal.h"
+#include "sgen-bridge-internals.h"
 #include "sgen/sgen-hash-table.h"
 #include "sgen/sgen-qsort.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
 
 MonoGCBridgeCallbacks bridge_callbacks;
 static SgenBridgeProcessor bridge_processor;
index 28105cb047553cec6cf26a1aaa2786fa75e87c41..76a194facef23de23a087cdf345a5601c410bb97 100644 (file)
@@ -88,10 +88,10 @@ struct _SgenClientThreadInfo {
 #include "metadata/profiler-private.h"
 #include "utils/dtrace.h"
 #include "utils/mono-counters.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
 #include "utils/mono-time.h"
 #include "utils/mono-semaphore.h"
-#include "metadata/sgen-bridge-internal.h"
+#include "metadata/sgen-bridge-internals.h"
 
 extern void mono_sgen_register_moved_object (void *obj, void *destination);
 extern void mono_sgen_gc_event_moves (void);
@@ -655,11 +655,6 @@ sgen_client_binary_protocol_gray_dequeue (gpointer queue, gpointer cursor, gpoin
 {
 }
 
-int sgen_thread_handshake (BOOL suspend);
-gboolean sgen_suspend_thread (SgenThreadInfo *info);
-gboolean sgen_resume_thread (SgenThreadInfo *info);
-void sgen_wait_for_suspend_ack (int count);
-
 #ifdef HAVE_KW_THREAD
 extern __thread SgenThreadInfo *sgen_thread_info;
 #define TLAB_ACCESS_INIT
index 02262b3f3609755c08f811ef9502fc0f28a70bd7..8df25bc9e1794929d9e36f3ca2e03c0e7513c535 100644 (file)
 #include "metadata/abi-details.h"
 #include "metadata/mono-gc.h"
 #include "metadata/runtime.h"
-#include "metadata/sgen-bridge-internal.h"
-#include "metadata/gc-internal.h"
+#include "metadata/sgen-bridge-internals.h"
+#include "metadata/gc-internals.h"
 #include "utils/mono-memory-model.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
+#include "utils/mono-threads.h"
 
 #ifdef HEAVY_STATISTICS
 static guint64 stat_wbarrier_set_arrayref = 0;
@@ -190,6 +191,18 @@ mono_gc_wbarrier_value_copy_bitmap (gpointer _dest, gpointer _src, int size, uns
        sgen_wbarrier_value_copy_bitmap (_dest, _src, size, bitmap);
 }
 
+int
+mono_gc_get_suspend_signal (void)
+{
+       return mono_threads_posix_get_suspend_signal ();
+}
+
+int
+mono_gc_get_restart_signal (void)
+{
+       return mono_threads_posix_get_restart_signal ();
+}
+
 static MonoMethod *write_barrier_conc_method;
 static MonoMethod *write_barrier_noconc_method;
 
@@ -332,8 +345,6 @@ mono_gc_get_specific_write_barrier (gboolean is_concurrent)
 #endif
        res = mono_mb_create_method (mb, sig, 16);
        info = mono_wrapper_info_create (mb, WRAPPER_SUBTYPE_NONE);
-       /* The generated barrier depends on this being the same at runtime */
-       info->d.wbarrier.nursery_bits = DEFAULT_NURSERY_BITS;
        mono_marshal_set_wrapper_info (res, info);
        mono_mb_free (mb);
 
@@ -2872,13 +2883,6 @@ sgen_client_init (void)
        }
 #endif
 
-       /*
-        * This needs to happen before any internal allocations because
-        * it inits the small id which is required for hazard pointer
-        * operations.
-        */
-       sgen_os_init ();
-
        mono_gc_register_thread (&dummy);
 }
 
index 9958f07dbba1b0fa50d522b2aa70efe2a257e79a..65981ccc665f6708c3786cb94674375572d5367a 100644 (file)
 #include <errno.h>
 
 #include "sgen/sgen-gc.h"
-#include "sgen-bridge-internal.h"
+#include "sgen-bridge-internals.h"
 #include "sgen/sgen-hash-table.h"
 #include "sgen/sgen-qsort.h"
 #include "sgen/sgen-client.h"
 #include "tabledefs.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
 
 //#define NEW_XREFS
 #ifdef NEW_XREFS
index 98b0d7eeb9770a9b2582db45801f75397478f73f..63b39f4946ab644eb84cc1b6ea2cae9cfb4f0485 100644 (file)
 #include <stdlib.h>
 
 #include "sgen/sgen-gc.h"
-#include "sgen-bridge-internal.h"
+#include "sgen-bridge-internals.h"
 #include "sgen/sgen-hash-table.h"
 #include "sgen/sgen-qsort.h"
 #include "sgen/sgen-client.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
 
 typedef struct {
        int size;
diff --git a/mono/metadata/sgen-os-coop.c b/mono/metadata/sgen-os-coop.c
deleted file mode 100644 (file)
index 165c0d4..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * sgen-os-coop.c: SGen Cooperative backend support.
- *
- * Author:
- *     João Matos (joao.matos@xamarin.com)
- * Copyright (C) 2015 Xamarin Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "config.h"
-#ifdef HAVE_SGEN_GC
-
-
-#include <glib.h>
-#include "sgen/sgen-gc.h"
-#include "sgen/sgen-archdep.h"
-#include "sgen/sgen-protocol.h"
-#include "metadata/object-internals.h"
-#include "metadata/gc-internal.h"
-
-
-#if defined(USE_COOP_GC)
-
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       g_error ("FIXME");
-       return FALSE;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       g_error ("FIXME");
-       return FALSE;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-}
-
-/* LOCKING: assumes the GC lock is held */
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       g_error ("FIXME");
-       return 0;
-}
-
-void
-sgen_os_init (void)
-{
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return -1;
-}
-
-int
-mono_gc_get_restart_signal (void)
-{
-       return -1;
-}
-
-#endif
-#endif
\ No newline at end of file
diff --git a/mono/metadata/sgen-os-mach.c b/mono/metadata/sgen-os-mach.c
deleted file mode 100644 (file)
index 46d30d8..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * sgen-os-mach.c: Mach-OS support.
- *
- * Author:
- *     Paolo Molaro (lupus@ximian.com)
- *     Mark Probst (mprobst@novell.com)
- *     Geoff Norton (gnorton@novell.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Copyright (C) 2012 Xamarin Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "config.h"
-#ifdef HAVE_SGEN_GC
-
-
-#include <glib.h>
-#include "sgen/sgen-gc.h"
-#include "sgen/sgen-archdep.h"
-#include "sgen/sgen-protocol.h"
-#include "sgen/sgen-thread-pool.h"
-#include "metadata/object-internals.h"
-#include "metadata/gc-internal.h"
-
-#if defined(__MACH__)
-#include "utils/mach-support.h"
-#endif
-
-#if defined(__MACH__) && MONO_MACH_ARCH_SUPPORTED
-
-#if !defined(USE_COOP_GC)
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       return thread_resume (info->client_info.info.native_handle) == KERN_SUCCESS;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       mach_msg_type_number_t num_state;
-       thread_state_t state;
-       kern_return_t ret;
-       ucontext_t ctx;
-       mcontext_t mctx;
-
-       gpointer stack_start;
-
-       state = (thread_state_t) alloca (mono_mach_arch_get_thread_state_size ());
-       mctx = (mcontext_t) alloca (mono_mach_arch_get_mcontext_size ());
-
-       ret = thread_suspend (info->client_info.info.native_handle);
-       if (ret != KERN_SUCCESS)
-               return FALSE;
-
-       ret = mono_mach_arch_get_thread_state (info->client_info.info.native_handle, state, &num_state);
-       if (ret != KERN_SUCCESS)
-               return FALSE;
-
-       mono_mach_arch_thread_state_to_mcontext (state, mctx);
-       ctx.uc_mcontext = mctx;
-
-       info->client_info.stopped_domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
-       info->client_info.stopped_ip = (gpointer) mono_mach_arch_get_ip (state);
-       info->client_info.stack_start = NULL;
-       stack_start = (char*) mono_mach_arch_get_sp (state) - REDZONE_SIZE;
-       /* If stack_start is not within the limits, then don't set it in info and we will be restarted. */
-       if (stack_start >= info->client_info.stack_start_limit && stack_start <= info->client_info.stack_end) {
-               info->client_info.stack_start = stack_start;
-
-#ifdef USE_MONO_CTX
-               mono_sigctx_to_monoctx (&ctx, &info->client_info.ctx);
-#else
-               ARCH_COPY_SIGCTX_REGS (&info->client_info.regs, &ctx);
-#endif
-       } else {
-               g_assert (!info->client_info.stack_start);
-       }
-
-       /* Notify the JIT */
-       if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, &ctx, NULL);
-
-       SGEN_LOG (2, "thread %p stopped at %p stack_start=%p", (void*)(gsize)info->client_info.info.native_handle, info->client_info.stopped_ip, info->client_info.stack_start);
-       binary_protocol_thread_suspend ((gpointer)mono_thread_info_get_tid (info), info->client_info.stopped_ip);
-
-       return TRUE;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-    /* mach thread_resume is synchronous so we dont need to wait for them */
-}
-
-/* LOCKING: assumes the GC lock is held */
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       SgenThreadInfo *cur_thread = mono_thread_info_current ();
-       kern_return_t ret;
-       SgenThreadInfo *info;
-
-       int count = 0;
-
-       cur_thread->client_info.suspend_done = TRUE;
-       FOREACH_THREAD_SAFE (info) {
-               if (info == cur_thread || sgen_thread_pool_is_thread_pool_thread (mono_thread_info_get_tid (info)))
-                       continue;
-
-               info->client_info.suspend_done = FALSE;
-               if (info->client_info.gc_disabled)
-                       continue;
-
-               if (suspend) {
-                       if (!sgen_suspend_thread (info))
-                               continue;
-               } else {
-                       ret = thread_resume (info->client_info.info.native_handle);
-                       if (ret != KERN_SUCCESS)
-                               continue;
-               }
-               count ++;
-       } END_FOREACH_THREAD_SAFE
-       return count;
-}
-
-void
-sgen_os_init (void)
-{
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return -1;
-}
-
-int
-mono_gc_get_restart_signal (void)
-{
-       return -1;
-}
-#endif
-#endif
-#endif
diff --git a/mono/metadata/sgen-os-posix.c b/mono/metadata/sgen-os-posix.c
deleted file mode 100644 (file)
index a45d6be..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * sgen-os-posix.c: Posix support.
- *
- * Author:
- *     Paolo Molaro (lupus@ximian.com)
- *     Mark Probst (mprobst@novell.com)
- *     Geoff Norton (gnorton@novell.com)
- *
- * Copyright 2010 Novell, Inc (http://www.novell.com)
- * Copyright (C) 2012 Xamarin Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "config.h"
-
-#if defined(HAVE_SGEN_GC) && !defined(USE_COOP_GC)
-#if !defined(__MACH__) && !MONO_MACH_ARCH_SUPPORTED && defined(HAVE_PTHREAD_KILL)
-
-#include <errno.h>
-#include <glib.h>
-#include "sgen/sgen-gc.h"
-#include "metadata/gc-internal.h"
-#include "sgen/sgen-archdep.h"
-#include "metadata/object-internals.h"
-#include "utils/mono-signal-handler.h"
-
-#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-const static int suspend_signal_num = SIGXFSZ;
-#else
-const static int suspend_signal_num = SIGPWR;
-#endif
-const static int restart_signal_num = SIGXCPU;
-
-static SgenSemaphore suspend_ack_semaphore;
-static SgenSemaphore *suspend_ack_semaphore_ptr;
-
-static sigset_t suspend_signal_mask;
-static sigset_t suspend_ack_signal_mask;
-
-static void
-suspend_thread (SgenThreadInfo *info, void *context)
-{
-       int stop_count;
-#ifndef USE_MONO_CTX
-       gpointer regs [ARCH_NUM_REGS];
-#endif
-       MonoContext ctx;
-       gpointer stack_start;
-
-       info->client_info.stopped_domain = mono_domain_get ();
-       info->client_info.signal = 0;
-       stop_count = sgen_global_stop_count;
-       /* duplicate signal */
-       if (0 && info->client_info.stop_count == stop_count)
-               return;
-
-#ifdef USE_MONO_CTX
-       if (context) {
-               mono_sigctx_to_monoctx (context, &ctx);
-               info->client_info.stopped_ip = MONO_CONTEXT_GET_IP (&ctx);
-               stack_start = (((guint8 *) MONO_CONTEXT_GET_SP (&ctx)) - REDZONE_SIZE);
-       } else {
-               info->client_info.stopped_ip = NULL;
-               stack_start = NULL;
-       }
-#else
-       info->client_info.stopped_ip = context ? (gpointer) ARCH_SIGCTX_IP (context) : NULL;
-       stack_start = context ? (char*) ARCH_SIGCTX_SP (context) - REDZONE_SIZE : NULL;
-#endif
-
-       /* If stack_start is not within the limits, then don't set it
-          in info and we will be restarted. */
-       if (stack_start >= info->client_info.stack_start_limit && stack_start <= info->client_info.stack_end) {
-               info->client_info.stack_start = stack_start;
-
-#ifdef USE_MONO_CTX
-               if (context) {
-                       memcpy (&info->client_info.ctx, &ctx, sizeof (MonoContext));
-               } else {
-                       memset (&info->client_info.ctx, 0, sizeof (MonoContext));
-               }
-#else
-               if (context) {
-                       ARCH_COPY_SIGCTX_REGS (regs, context);
-                       memcpy (&info->client_info.regs, regs, sizeof (info->client_info.regs));
-               } else {
-                       memset (&info->client_info.regs, 0, sizeof (info->client_info.regs));
-               }
-#endif
-       } else {
-               g_assert (!info->client_info.stack_start);
-       }
-
-       /* Notify the JIT */
-       if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, context, NULL);
-
-       SGEN_LOG (4, "Posting suspend_ack_semaphore for suspend from %p %p", info, (gpointer)mono_native_thread_id_get ());
-
-       /*
-       Block the restart signal. 
-       We need to block the restart signal while posting to the suspend_ack semaphore or we race to sigsuspend,
-       which might miss the signal and get stuck.
-       */
-       pthread_sigmask (SIG_BLOCK, &suspend_ack_signal_mask, NULL);
-
-       /* notify the waiting thread */
-       SGEN_SEMAPHORE_POST (suspend_ack_semaphore_ptr);
-       info->client_info.stop_count = stop_count;
-
-       /* wait until we receive the restart signal */
-       do {
-               info->client_info.signal = 0;
-               sigsuspend (&suspend_signal_mask);
-       } while (info->client_info.signal != restart_signal_num);
-
-       /* Unblock the restart signal. */
-       pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
-
-       SGEN_LOG (4, "Posting suspend_ack_semaphore for resume from %p %p\n", info, (gpointer)mono_native_thread_id_get ());
-       /* notify the waiting thread */
-       SGEN_SEMAPHORE_POST (suspend_ack_semaphore_ptr);
-}
-
-/* LOCKING: assumes the GC lock is held (by the stopping thread) */
-MONO_SIG_HANDLER_FUNC (static, suspend_handler)
-{
-       /*
-        * The suspend signal handler potentially uses syscalls that
-        * can set errno, and it calls functions that use the hazard
-        * pointer machinery.  Since we're interrupting other code we
-        * must restore those to the values they had when we
-        * interrupted.
-        */
-       SgenThreadInfo *info;
-       int old_errno = errno;
-       int hp_save_index = mono_hazard_pointer_save_for_signal_handler ();
-       MONO_SIG_HANDLER_GET_CONTEXT;
-
-       info = mono_thread_info_current ();
-       suspend_thread (info, ctx);
-
-       mono_hazard_pointer_restore_for_signal_handler (hp_save_index);
-       errno = old_errno;
-}
-
-MONO_SIG_HANDLER_FUNC (static, restart_handler)
-{
-       SgenThreadInfo *info;
-       int old_errno = errno;
-
-       info = mono_thread_info_current ();
-       info->client_info.signal = restart_signal_num;
-       SGEN_LOG (4, "Restart handler in %p %p", info, (gpointer)mono_native_thread_id_get ());
-       errno = old_errno;
-}
-
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       return mono_threads_pthread_kill (info, restart_signal_num) == 0;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       return mono_threads_pthread_kill (info, suspend_signal_num) == 0;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-       int i, result;
-
-       for (i = 0; i < count; ++i) {
-               while ((result = SGEN_SEMAPHORE_WAIT (suspend_ack_semaphore_ptr)) != 0) {
-                       if (errno != EINTR) {
-                               g_error ("SGEN_SEMAPHORE_WAIT FAILED with %d errno %d (%s)", result, errno, strerror (errno));
-                       }
-               }
-       }
-}
-
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       int count, result;
-       SgenThreadInfo *info;
-       int signum = suspend ? suspend_signal_num : restart_signal_num;
-
-       MonoNativeThreadId me = mono_native_thread_id_get ();
-
-       count = 0;
-       mono_thread_info_current ()->client_info.suspend_done = TRUE;
-       FOREACH_THREAD_SAFE (info) {
-               if (mono_native_thread_id_equals (mono_thread_info_get_tid (info), me)) {
-                       continue;
-               }
-               info->client_info.suspend_done = FALSE;
-               if (info->client_info.gc_disabled)
-                       continue;
-               /*if (signum == suspend_signal_num && info->stop_count == global_stop_count)
-                       continue;*/
-               result = mono_threads_pthread_kill (info, signum);
-               if (result == 0) {
-                       count++;
-               } else {
-                       info->client_info.skip = 1;
-               }
-       } END_FOREACH_THREAD_SAFE
-
-       sgen_wait_for_suspend_ack (count);
-
-       SGEN_LOG (4, "%s handshake for %d threads\n", suspend ? "suspend" : "resume", count);
-
-       return count;
-}
-
-void
-sgen_os_init (void)
-{
-       struct sigaction sinfo;
-
-       if (mono_thread_info_unified_management_enabled ())
-               return;
-
-       suspend_ack_semaphore_ptr = &suspend_ack_semaphore;
-       SGEN_SEMAPHORE_INIT (&suspend_ack_semaphore, 0);
-
-       sigfillset (&sinfo.sa_mask);
-       sinfo.sa_flags = SA_RESTART | SA_SIGINFO;
-       sinfo.sa_sigaction = suspend_handler;
-       if (sigaction (suspend_signal_num, &sinfo, NULL) != 0) {
-               g_error ("failed sigaction");
-       }
-
-       sinfo.sa_handler = (void*) restart_handler;
-       if (sigaction (restart_signal_num, &sinfo, NULL) != 0) {
-               g_error ("failed sigaction");
-       }
-
-       sigfillset (&suspend_signal_mask);
-       sigdelset (&suspend_signal_mask, restart_signal_num);
-
-       sigemptyset (&suspend_ack_signal_mask);
-       sigaddset (&suspend_ack_signal_mask, restart_signal_num);
-       
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return suspend_signal_num;
-}
-
-int
-mono_gc_get_restart_signal (void)
-{
-       return restart_signal_num;
-}
-#endif
-#endif
diff --git a/mono/metadata/sgen-os-win32.c b/mono/metadata/sgen-os-win32.c
deleted file mode 100644 (file)
index 3145a5e..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-#include "config.h"
-
-#if defined(HAVE_SGEN_GC) && defined(HOST_WIN32)
-
-#include "io-layer/io-layer.h"
-
-#include "sgen/sgen-gc.h"
-#include "metadata/gc-internal.h"
-
-gboolean
-sgen_resume_thread (SgenThreadInfo *info)
-{
-       DWORD id = mono_thread_info_get_tid (info);
-       HANDLE handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
-       DWORD result;
-
-       g_assert (handle);
-
-       result = ResumeThread (handle);
-       g_assert (result != (DWORD)-1);
-
-       CloseHandle (handle);
-
-       return result != (DWORD)-1;
-}
-
-gboolean
-sgen_suspend_thread (SgenThreadInfo *info)
-{
-       DWORD id = mono_thread_info_get_tid (info);
-       HANDLE handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
-       CONTEXT context;
-       DWORD result;
-
-       g_assert (id != GetCurrentThreadId ());
-
-       g_assert (handle);
-
-       result = SuspendThread (handle);
-       if (result == (DWORD)-1) {
-               fprintf (stderr, "could not suspend thread %x (handle %p): %d\n", id, handle, GetLastError ()); fflush (stderr);
-               CloseHandle (handle);
-               return FALSE;
-       }
-
-       context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
-
-       if (!GetThreadContext (handle, &context)) {
-               g_assert_not_reached ();
-               ResumeThread (handle);
-               CloseHandle (handle);
-               return FALSE;
-       }
-
-       g_assert (context.ContextFlags & CONTEXT_INTEGER);
-       g_assert (context.ContextFlags & CONTEXT_CONTROL);
-
-       CloseHandle (handle);
-
-#if !defined(MONO_CROSS_COMPILE)
-#ifdef USE_MONO_CTX
-       memset (&info->client_info.ctx, 0, sizeof (MonoContext));
-#ifdef TARGET_AMD64
-    info->client_info.ctx.gregs[AMD64_RIP] = context.Rip;
-    info->client_info.ctx.gregs[AMD64_RAX] = context.Rax;
-    info->client_info.ctx.gregs[AMD64_RCX] = context.Rcx;
-    info->client_info.ctx.gregs[AMD64_RDX] = context.Rdx;
-    info->client_info.ctx.gregs[AMD64_RBX] = context.Rbx;
-    info->client_info.ctx.gregs[AMD64_RSP] = context.Rsp;
-    info->client_info.ctx.gregs[AMD64_RBP] = context.Rbp;
-    info->client_info.ctx.gregs[AMD64_RSI] = context.Rsi;
-    info->client_info.ctx.gregs[AMD64_RDI] = context.Rdi;
-    info->client_info.ctx.gregs[AMD64_R8] = context.R8;
-    info->client_info.ctx.gregs[AMD64_R9] = context.R9;
-    info->client_info.ctx.gregs[AMD64_R10] = context.R10;
-    info->client_info.ctx.gregs[AMD64_R11] = context.R11;
-    info->client_info.ctx.gregs[AMD64_R12] = context.R12;
-    info->client_info.ctx.gregs[AMD64_R13] = context.R13;
-    info->client_info.ctx.gregs[AMD64_R14] = context.R14;
-    info->client_info.ctx.gregs[AMD64_R15] = context.R15;
-    info->client_info.stopped_ip = info->client_info.ctx.gregs[AMD64_RIP];
-    info->client_info.stack_start = (char*)info->client_info.ctx.gregs[AMD64_RSP] - REDZONE_SIZE;
-#else
-       info->client_info.ctx.edi = context.Edi;
-       info->client_info.ctx.esi = context.Esi;
-       info->client_info.ctx.ebx = context.Ebx;
-       info->client_info.ctx.edx = context.Edx;
-       info->client_info.ctx.ecx = context.Ecx;
-       info->client_info.ctx.eax = context.Eax;
-       info->client_info.ctx.ebp = context.Ebp;
-       info->client_info.ctx.esp = context.Esp;
-       info->client_info.stopped_ip = (gpointer)context.Eip;
-       info->client_info.stack_start = (char*)context.Esp - REDZONE_SIZE;
-#endif
-
-#else
-       info->client_info.regs [0] = context.Edi;
-       info->client_info.regs [1] = context.Esi;
-       info->client_info.regs [2] = context.Ebx;
-       info->client_info.regs [3] = context.Edx;
-       info->client_info.regs [4] = context.Ecx;
-       info->client_info.regs [5] = context.Eax;
-       info->client_info.regs [6] = context.Ebp;
-       info->client_info.regs [7] = context.Esp;
-       info->client_info.stopped_ip = (gpointer)context.Eip;
-       info->client_info.stack_start = (char*)context.Esp - REDZONE_SIZE;
-#endif
-#endif
-
-       /* Notify the JIT */
-       if (mono_gc_get_gc_callbacks ()->thread_suspend_func)
-               mono_gc_get_gc_callbacks ()->thread_suspend_func (info->client_info.runtime_data, NULL, NULL);
-
-       return TRUE;
-}
-
-void
-sgen_wait_for_suspend_ack (int count)
-{
-       /* Win32 suspend/resume is synchronous, so we don't need to wait for anything */
-}
-
-int
-sgen_thread_handshake (BOOL suspend)
-{
-       SgenThreadInfo *info;
-       SgenThreadInfo *current = mono_thread_info_current ();
-       int count = 0;
-
-       current->client_info.suspend_done = TRUE;
-       FOREACH_THREAD_SAFE (info) {
-               if (info == current)
-                       continue;
-               info->client_info.suspend_done = FALSE;
-               if (info->client_info.gc_disabled)
-                       continue;
-               if (suspend) {
-                       if (!sgen_suspend_thread (info))
-                               continue;
-               } else {
-                       if (!sgen_resume_thread (info))
-                               continue;
-               }
-               ++count;
-       } END_FOREACH_THREAD_SAFE
-       return count;
-}
-
-void
-sgen_os_init (void)
-{
-}
-
-int
-mono_gc_get_suspend_signal (void)
-{
-       return -1;
-}
-
-#endif
index 8ef67fc7f43de429ece707aacc09571f7453ed08..60a69950f8eb74f7f3def4bd35403b37dbc3fdd7 100644 (file)
@@ -33,8 +33,9 @@
 #include "sgen/sgen-thread-pool.h"
 #include "metadata/profiler-private.h"
 #include "sgen/sgen-client.h"
-#include "metadata/sgen-bridge-internal.h"
-#include "metadata/gc-internal.h"
+#include "metadata/sgen-bridge-internals.h"
+#include "metadata/gc-internals.h"
+#include "utils/mono-threads.h"
 
 #define TV_DECLARE SGEN_TV_DECLARE
 #define TV_GETTIME SGEN_TV_GETTIME
@@ -68,7 +69,7 @@ update_current_thread_stack (void *start)
        void *reg_ptr = cur_thread_regs;
 #endif
        SgenThreadInfo *info = mono_thread_info_current ();
-       
+
        info->client_info.stack_start = align_pointer (&stack_guard);
        g_assert (info->client_info.stack_start >= info->client_info.stack_start_limit && info->client_info.stack_start < info->client_info.stack_end);
 #ifdef USE_MONO_CTX
@@ -84,107 +85,6 @@ update_current_thread_stack (void *start)
 #endif
 }
 
-static gboolean
-is_ip_in_managed_allocator (MonoDomain *domain, gpointer ip)
-{
-       MonoJitInfo *ji;
-
-       if (!mono_thread_internal_current ())
-               /* Happens during thread attach */
-               return FALSE;
-
-       if (!ip || !domain)
-               return FALSE;
-       if (!sgen_has_critical_method ())
-               return FALSE;
-
-       /*
-        * mono_jit_info_table_find is not async safe since it calls into the AOT runtime to load information for
-        * missing methods (#13951). To work around this, we disable the AOT fallback. For this to work, the JIT needs
-        * to register the jit info for all GC critical methods after they are JITted/loaded.
-        */
-       ji = mono_jit_info_table_find_internal (domain, ip, FALSE, FALSE);
-       if (!ji)
-               return FALSE;
-
-       return sgen_is_critical_method (mono_jit_info_get_method (ji));
-}
-
-static int
-restart_threads_until_none_in_managed_allocator (void)
-{
-       SgenThreadInfo *info;
-       int num_threads_died = 0;
-       int sleep_duration = -1;
-
-       for (;;) {
-               int restart_count = 0, restarted_count = 0;
-               /* restart all threads that stopped in the
-                  allocator */
-               FOREACH_THREAD_SAFE (info) {
-                       gboolean result;
-                       if (info->client_info.skip || info->client_info.gc_disabled || info->client_info.suspend_done)
-                               continue;
-                       if (mono_thread_info_is_live (info) &&
-                                       (!info->client_info.stack_start || info->client_info.in_critical_region || info->client_info.info.inside_critical_region ||
-                                       is_ip_in_managed_allocator (info->client_info.stopped_domain, info->client_info.stopped_ip))) {
-                               binary_protocol_thread_restart ((gpointer)mono_thread_info_get_tid (info));
-                               SGEN_LOG (3, "thread %p resumed.", (void*) (size_t) info->client_info.info.native_handle);
-                               result = sgen_resume_thread (info);
-                               if (result) {
-                                       ++restart_count;
-                               } else {
-                                       info->client_info.skip = 1;
-                               }
-                       } else {
-                               /* we set the stopped_ip to
-                                  NULL for threads which
-                                  we're not restarting so
-                                  that we can easily identify
-                                  the others */
-                               info->client_info.stopped_ip = NULL;
-                               info->client_info.stopped_domain = NULL;
-                               info->client_info.suspend_done = TRUE;
-                       }
-               } END_FOREACH_THREAD_SAFE
-               /* if no threads were restarted, we're done */
-               if (restart_count == 0)
-                       break;
-
-               /* wait for the threads to signal their restart */
-               sgen_wait_for_suspend_ack (restart_count);
-
-               if (sleep_duration < 0) {
-                       mono_thread_info_yield ();
-                       sleep_duration = 0;
-               } else {
-                       g_usleep (sleep_duration);
-                       sleep_duration += 10;
-               }
-
-               /* stop them again */
-               FOREACH_THREAD (info) {
-                       gboolean result;
-                       if (info->client_info.skip || info->client_info.stopped_ip == NULL)
-                               continue;
-                       result = sgen_suspend_thread (info);
-
-                       if (result) {
-                               ++restarted_count;
-                       } else {
-                               info->client_info.skip = 1;
-                       }
-               } END_FOREACH_THREAD
-               /* some threads might have died */
-               num_threads_died += restart_count - restarted_count;
-               /* wait for the threads to signal their suspension
-                  again */
-               sgen_wait_for_suspend_ack (restarted_count);
-       }
-
-       return num_threads_died;
-}
-
 static void
 acquire_gc_locks (void)
 {
@@ -227,15 +127,7 @@ sgen_client_stop_world (int generation)
        SGEN_LOG (3, "stopping world n %d from %p %p", sgen_global_stop_count, mono_thread_info_current (), (gpointer)mono_native_thread_id_get ());
        TV_GETTIME (stop_world_time);
 
-       if (mono_thread_info_unified_management_enabled ()) {
-               sgen_unified_suspend_stop_world ();
-       } else {
-               int count, dead;
-               count = sgen_thread_handshake (TRUE);
-               dead = restart_threads_until_none_in_managed_allocator ();
-               if (count < dead)
-                       g_error ("More threads have died (%d) that been initialy suspended %d", dead, count);
-       }
+       sgen_unified_suspend_stop_world ();
 
        SGEN_LOG (3, "world stopped");
 
@@ -273,10 +165,7 @@ sgen_client_restart_world (int generation, GGTimingInfo *timing)
 
        TV_GETTIME (start_handshake);
 
-       if (mono_thread_info_unified_management_enabled ())
-               sgen_unified_suspend_restart_world ();
-       else
-               sgen_thread_handshake (FALSE);
+       sgen_unified_suspend_restart_world ();
 
        TV_GETTIME (end_sw);
        time_restart_world += TV_ELAPSED (start_handshake, end_sw);
@@ -445,11 +334,7 @@ sgen_unified_suspend_stop_world (void)
                mono_threads_wait_pending_operations ();
 
                if (sleep_duration < 0) {
-#ifdef HOST_WIN32
-                       SwitchToThread ();
-#else
-                       sched_yield ();
-#endif
+                       mono_thread_info_yield ();
                        sleep_duration = 0;
                } else {
                        g_usleep (sleep_duration);
@@ -497,4 +382,5 @@ sgen_unified_suspend_restart_world (void)
        mono_threads_wait_pending_operations ();
        mono_threads_end_global_suspend ();
 }
+
 #endif
index 910fa9bf1fc582de56b904463ba62d72d95be964..10cf234c4268382f35a2c94a62a99c4100346aea 100644 (file)
 #include <stdlib.h>
 
 #include "sgen/sgen-gc.h"
-#include "sgen-bridge-internal.h"
+#include "sgen-bridge-internals.h"
 #include "sgen/sgen-hash-table.h"
 #include "sgen/sgen-qsort.h"
 #include "tabledefs.h"
-#include "utils/mono-logger-internal.h"
+#include "utils/mono-logger-internals.h"
 
 typedef struct {
        int size;
index 98fbf3070459d0b244e4bc79a4603a06d25d2800..773613c669283ddb99ca1bcc946a5754d544096f 100644 (file)
@@ -23,7 +23,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/profiler.h>
 #include <mono/metadata/profiler-private.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 /* This function is redirected to String.CreateString ()
    by mono_marshal_get_native_wrapper () */
index f3d54ae9720c2c1c5b9b18061e71fc486cb76e98..6ac26ed033c111604bba586cfa527ea766b8e8dd 100644 (file)
 #include <fcntl.h>
 #endif
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-mlist.h>
 #include <mono/metadata/threadpool-ms.h>
 #include <mono/metadata/threadpool-ms-io.h>
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/mono-lazy-init.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 
 typedef struct {
        gboolean (*init) (gint wakeup_pipe_fd);
index b9d9f941c0cb13b2d380bd5418c286df5b3dcdc3..fd6fe24d461212d60f5ef72d90a8c46e2f39f436 100644 (file)
@@ -27,7 +27,7 @@
 
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/exception.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/object.h>
 #include <mono/metadata/object-internals.h>
 #include <mono/metadata/threadpool-ms.h>
@@ -37,7 +37,7 @@
 #include <mono/utils/mono-complex.h>
 #include <mono/utils/mono-lazy-init.h>
 #include <mono/utils/mono-logger.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-proclib.h>
 #include <mono/utils/mono-threads.h>
 #include <mono/utils/mono-time.h>
index e156a8684db7c9464699f7f18cbdc02df7230eec..588cafd10fc4d6642bce9c6c53c998c753dc2556 100644 (file)
@@ -24,7 +24,7 @@
 #include <mono/metadata/exception.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/monitor.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/runtime.h>
 #include <mono/io-layer/io-layer.h>
@@ -41,7 +41,7 @@
 #include <mono/utils/atomic.h>
 #include <mono/utils/mono-memory-model.h>
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 #ifdef HAVE_SIGNAL_H
 #include <signal.h>
@@ -921,8 +921,10 @@ mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gb
                return NULL;
 
        /* Check that the managed and unmanaged layout of MonoInternalThread matches */
+#ifndef MONO_CROSS_COMPILE
        if (mono_check_corlib_version () == NULL)
                g_assert (((char*)&internal->unused2 - (char*)internal) == mono_defaults.internal_thread_class->fields [mono_defaults.internal_thread_class->field.count - 1].offset);
+#endif
 
        return internal;
 }
index ecaa1b2afe47286dac47d2b554cac7ab7ec76119..ead2a71747b3b44e054395440f750eb39a58e57e 100755 (executable)
@@ -407,6 +407,7 @@ common_sources = \
        driver.c                \
        debug-mini.c            \
        linear-scan.c           \
+       aot-compiler.h          \
        aot-compiler.c          \
        aot-runtime.c           \
        graph.c                 \
index 220d89d4e5f87788399821b42083998540e2b8b5..8e96bed61a6b55bbbe21bb2d61a4cf731f3c243c 100644 (file)
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/marshal.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/threads-types.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-time.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/json.h>
 
-#include "mini.h"
+#include "aot-compiler.h"
 #include "seq-points.h"
 #include "image-writer.h"
 #include "dwarfwriter.h"
@@ -2819,7 +2819,6 @@ encode_method_ref (MonoAotCompile *acfg, MonoMethod *method, guint8 *buf, guint8
                }
                case MONO_WRAPPER_WRITE_BARRIER: {
                        g_assert (info);
-                       encode_value (info->d.wbarrier.nursery_bits, p, &p);
                        break;
                }
                case MONO_WRAPPER_STELEMREF: {
diff --git a/mono/mini/aot-compiler.h b/mono/mini/aot-compiler.h
new file mode 100644 (file)
index 0000000..5cea3a2
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef __MONO_AOT_COMPILER_H__
+#define __MONO_AOT_COMPILER_H__
+
+#include "mini.h"
+
+int mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options);
+void* mono_aot_readonly_field_override (MonoClassField *field);
+gboolean mono_aot_is_shared_got_offset (int offset) MONO_LLVM_INTERNAL;
+
+guint32  mono_aot_get_got_offset            (MonoJumpInfo *ji) MONO_LLVM_INTERNAL;
+char*    mono_aot_get_method_name           (MonoCompile *cfg) MONO_LLVM_INTERNAL;
+gboolean mono_aot_is_direct_callable        (MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
+void     mono_aot_mark_unused_llvm_plt_entry(MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
+char*    mono_aot_get_plt_symbol            (MonoJumpInfoType type, gconstpointer data) MONO_LLVM_INTERNAL;
+char*    mono_aot_get_direct_call_symbol    (MonoJumpInfoType type, gconstpointer data);
+int      mono_aot_get_method_index          (MonoMethod *method) MONO_LLVM_INTERNAL;
+MonoJumpInfo* mono_aot_patch_info_dup       (MonoJumpInfo* ji) MONO_LLVM_INTERNAL;
+
+#endif
+
+
+
+
index 63f6e1f713f84648ae33628e5db5fd12e6b0c5ca..b77ab2b0f2be21d8d5b575810cfd38807b854752 100644 (file)
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/marshal.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/mono-endian.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
@@ -60,6 +60,7 @@
 #include "seq-points.h"
 #include "version.h"
 #include "debugger-agent.h"
+#include "aot-compiler.h"
 
 #ifndef DISABLE_AOT
 
@@ -895,15 +896,7 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
                        break;
                }
                case MONO_WRAPPER_WRITE_BARRIER: {
-                       int nursery_bits = decode_value (p, &p);
-
                        ref->method = mono_gc_get_write_barrier ();
-                       if (ref->method) {
-                               /* Sanity check */
-                               info = mono_marshal_get_wrapper_info (ref->method);
-                               g_assert (info);
-                               g_assert (info->d.wbarrier.nursery_bits == nursery_bits);
-                       }
                        break;
                }
                case MONO_WRAPPER_STELEMREF: {
@@ -2151,18 +2144,6 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
                mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: loaded AOT Module for %s.\n", assembly->image->name);
 }
 
-/*
- * mono_aot_register_globals:
- *
- *   This is called by the ctor function in AOT images compiled with the
- * 'no-dlsym' option.
- */
-void
-mono_aot_register_globals (gpointer *globals)
-{
-       g_assert_not_reached ();
-}
-
 /*
  * mono_aot_register_module:
  *
index 3d40a0097fac62e31f3b58497eee1f386d3a4d09..a75bab23586eab4d4d92fadbde33c865897c48b0 100644 (file)
@@ -61,7 +61,7 @@ mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins)
 gboolean
 mono_arch_opcode_needs_emulation (MonoCompile *cfg, int opcode)
 {
-       return FALSE;
+       return TRUE;
 }
 #endif
 
index db2dc5defcfb927f74c874c9584a600c9fab007a..eef2438346a647340bd3a238de55a2830ddc42d7 100644 (file)
@@ -54,7 +54,7 @@
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/debug-mono-symfile.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/threadpool-ms.h>
index 764408bd9a8ef9abb9b02a0944bfbd72ab873c2d..d3fc7f2e92305f7f6cabeb442b61774466a2fe58 100644 (file)
@@ -12,7 +12,7 @@
 #include "ir-emit.h"
 #include "jit-icalls.h"
 
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/abi-details.h>
 
 #ifndef DISABLE_JIT
@@ -447,7 +447,7 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
        case OP_IREM:
        case OP_IDIV_UN:
        case OP_IREM_UN:
-               if (!(cfg->backend->emulate_div && !mono_arch_opcode_needs_emulation (cfg, ins->opcode)))
+               if (cfg->backend->emulate_div && mono_arch_opcode_needs_emulation (cfg, ins->opcode))
                        emulate = TRUE;
                if (!emulate) {
                        if (cfg->backend->need_div_check) {
index 2008859cda6114035d9c1215c128e68485262eda..ff482db7b5182da706ee7d2dd81e009bc22e5a44 100644 (file)
@@ -45,7 +45,7 @@
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/security-manager.h>
 #include <mono/metadata/security-core-clr.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/coree.h>
 #include <mono/metadata/attach.h>
 #include "mono/utils/mono-counters.h"
@@ -53,6 +53,8 @@
 
 #include "mini.h"
 #include "jit.h"
+#include "aot-compiler.h"
+
 #include <string.h>
 #include <ctype.h>
 #include <locale.h>
index 4f7e336e6d2ee53f4ef524810ac7d667809d8723..ca3b19bfb0a2495050561f1bb5c8c073be3f943e 100644 (file)
@@ -28,7 +28,7 @@
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/exception.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/utils/mono-mmap.h>
 
index b9299cbe4fd3181883a5bf90efa29e896e4f6328..9d13bfbf2c59a3f485e4a2d963cda406fb4caf04 100644 (file)
@@ -29,7 +29,7 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/exception.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-debug.h>
 
 #include "mini.h"
index b3b5633597644d39ff345274d0fc4f2749b21d66..d9b3d9d99c658bfc396ef0e01aa21af3633d7a03 100644 (file)
@@ -21,7 +21,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/tokentype.h>
 
 #include "mini.h"
index 3db25ca7f810f8ab363fe926b3a75c355c3e10da..87a67abd930f3d4ee33149018d6a2ed89ca38fb1 100644 (file)
@@ -23,7 +23,7 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/exception.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/utils/mono-mmap.h>
 
index 069c99bb6d45b76e60dcfef7a1d6a51af5a803b0..fdbe5272fc8a0e6f17c24a6ab66fc41764ba0dd5 100644 (file)
@@ -50,7 +50,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/mono-debug-debugger.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/security-manager.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/security-core-clr.h>
@@ -69,6 +69,7 @@
 #include "jit.h"
 #include "debugger-agent.h"
 #include "seq-points.h"
+#include "aot-compiler.h"
 
 #define BRANCH_COST 10
 #define INLINE_LENGTH_LIMIT 20
index 42348b88fda4dd2c3e96a78d1d6f3f3d639461e2..1abbd14540854d1fcf16e946999897b98b0e684f 100644 (file)
@@ -26,7 +26,7 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-memory-model.h>
index 6016ab56ab279be2575726bd12205643d3a46eb6..2798808809f1167c428ac397f996c6d98be4ecf8 100644 (file)
@@ -678,6 +678,7 @@ mono_arm_have_fast_tls (void)
 gboolean
 mono_arm_have_tls_get (void)
 {
+       return FALSE;
 #ifdef HAVE_FAST_TLS
        return TRUE;
 #else
@@ -4621,7 +4622,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
                                g_assert (arm_is_imm12 (info_var->inst_offset));
                        }
 
-                       if (!cfg->soft_breakpoints) {
+                       if (!cfg->soft_breakpoints && !cfg->compile_aot) {
                                /*
                                 * Read from the single stepping trigger page. This will cause a
                                 * SIGSEGV when single stepping is enabled.
index b09db53452a1993fc7f13f51d056a678d1ef3a03..1994ba0a6abf5d77addee2dc77a8730b3f0df1ff 100644 (file)
@@ -306,7 +306,7 @@ typedef struct MonoCompileArch {
 #endif
 
 #define MONO_ARCH_HAVE_TLS_GET (mono_arm_have_tls_get ())
-#define MONO_ARCH_HAVE_TLS_GET_REG 1
+// #define MONO_ARCH_HAVE_TLS_GET_REG 1
 
 /* ARM doesn't have too many registers, so we have to use a callee saved one */
 #define MONO_ARCH_RGCTX_REG ARMREG_V5
index 309ebd82531bf937c0f302cc1955da251b7f8435..659075cc30a7f7297017b408d8df42eaf82f72c6 100644 (file)
 #include <mono/metadata/verify-internals.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/attach.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/dtrace.h>
 
index f26568502bcb28daa7aece7df5c228c6fec7ebb5..820025e4599eecfd6c581baa5e41f32368cb6675 100644 (file)
 #include <mono/metadata/debug-helpers.h>
 #include <mono/metadata/exception.h>
 #include <mono/metadata/object-internals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/profiler.h>
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-mlist.h>
 #include <mono/utils/mono-mmap.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 
 #include "mini.h"
 #include "trace.h"
index c01d3e74968ac783ccf060fbeb9e2027ca94323a..47265e1d10f50156070c8372ba7447619fb12436 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "config.h"
 #include "mini-gc.h"
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 static gboolean
 get_provenance (StackFrameInfo *frame, MonoContext *ctx, gpointer data)
@@ -38,7 +38,7 @@ get_provenance_func (void)
 //#if defined(MONO_ARCH_GC_MAPS_SUPPORTED)
 
 #include <mono/metadata/sgen-conf.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-counters.h>
 
 #define SIZEOF_SLOT ((int)sizeof (mgreg_t))
index 3f04bbf35cabac51efd66b21a550e5dbf947cbcc..07b19c46ab0769e5f06074f067fa2fd5b9787532 100644 (file)
@@ -29,6 +29,7 @@
 #include "llvm-c/Analysis.h"
 
 #include "mini-llvm-cpp.h"
+#include "aot-compiler.h"
 
 #ifdef __MINGW32__
 
index fe5cc782f833f26e4d965be3e4667654fc703f5d..724c4aa2c8739dadfeb23d5cc49833e71eee6775 100644 (file)
@@ -44,7 +44,7 @@
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/verify.h>
 #include <mono/metadata/verify-internals.h>
@@ -53,7 +53,7 @@
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/dtrace.h>
 #include <mono/utils/mono-signal-handler.h>
index 08cd5857886100ebdee00660ae77ac5f2d49bef2..41fd8fccadf6187eb7f2cd5aafee97303f552659 100644 (file)
@@ -42,7 +42,7 @@
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/attach.h>
@@ -51,7 +51,7 @@
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-error-internals.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-path.h>
 #include <mono/utils/mono-tls.h>
index b2c80c78f9e42f064a8fe1ab6ead3f35174b4e46..4bcc19b5bfb64d86d12da04f3653159639057a1f 100644 (file)
@@ -29,7 +29,7 @@
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/verify.h>
 #include <mono/metadata/verify-internals.h>
@@ -38,7 +38,7 @@
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/dtrace.h>
 
index e84275d9d0b2be95479944ef68a78dafe0cd2e4d..09b747b525c7acf1018d3271701bccb3275e5031 100644 (file)
@@ -23,7 +23,7 @@
 #include <mono/metadata/threads.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/utils/mono-math.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-mmap.h>
index 076e36d48aabe204db2bdb4ec64c7d935aa97936..e96c0dce16cad93258db77d18358afad4e46f943 100644 (file)
@@ -39,7 +39,7 @@
 #include <mono/metadata/mono-config.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/mono-debug.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/threads-types.h>
 #include <mono/metadata/verify.h>
 #include <mono/metadata/verify-internals.h>
@@ -50,7 +50,7 @@
 #include <mono/utils/mono-compiler.h>
 #include <mono/utils/mono-counters.h>
 #include <mono/utils/mono-error-internals.h>
-#include <mono/utils/mono-logger-internal.h>
+#include <mono/utils/mono-logger-internals.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-path.h>
 #include <mono/utils/mono-tls.h>
index 2c014940e5f2711c3bea30c20e7ff9f36cb2aaf9..11f89ba23b62eb2dc3571818fd87deba7d418e21 100644 (file)
 #endif
 
 /* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 125
+#define MONO_AOT_FILE_VERSION 126
 
 //TODO: This is x86/amd64 specific.
 #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
@@ -2277,7 +2277,6 @@ void      mono_analyze_liveness_gc          (MonoCompile *cfg);
 void      mono_linear_scan                  (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_mask);
 void      mono_global_regalloc              (MonoCompile *cfg);
 void      mono_create_jump_table            (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
-int       mono_compile_assembly             (MonoAssembly *ass, guint32 opts, const char *aot_options);
 MonoCompile *mini_method_compile            (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts, int aot_method_index);
 void      mono_destroy_compile              (MonoCompile *cfg);
 MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode);
@@ -2378,28 +2377,16 @@ gpointer mono_aot_get_gsharedvt_arg_trampoline(gpointer arg, gpointer addr);
 guint8*  mono_aot_get_unwind_info           (MonoJitInfo *ji, guint32 *unwind_info_len);
 guint32  mono_aot_method_hash               (MonoMethod *method);
 MonoMethod* mono_aot_get_array_helper_from_wrapper (MonoMethod *method);
-guint32  mono_aot_get_got_offset            (MonoJumpInfo *ji) MONO_LLVM_INTERNAL;
-gboolean mono_aot_is_shared_got_offset      (int offset) MONO_LLVM_INTERNAL;
-char*    mono_aot_get_method_name           (MonoCompile *cfg) MONO_LLVM_INTERNAL;
-gboolean mono_aot_is_direct_callable        (MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
-void     mono_aot_mark_unused_llvm_plt_entry(MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
-char*    mono_aot_get_plt_symbol            (MonoJumpInfoType type, gconstpointer data) MONO_LLVM_INTERNAL;
-char*    mono_aot_get_direct_call_symbol    (MonoJumpInfoType type, gconstpointer data);
-int      mono_aot_get_method_index          (MonoMethod *method) MONO_LLVM_INTERNAL;
-MonoJumpInfo* mono_aot_patch_info_dup       (MonoJumpInfo* ji) MONO_LLVM_INTERNAL;
 void     mono_aot_set_make_unreadable       (gboolean unreadable);
 gboolean mono_aot_is_pagefault              (void *ptr);
 void     mono_aot_handle_pagefault          (void *ptr);
 void     mono_aot_register_jit_icall        (const char *name, gpointer addr);
-void*    mono_aot_readonly_field_override   (MonoClassField *field);
 guint32  mono_aot_find_method_index         (MonoMethod *method);
 void     mono_aot_init_llvm_method          (gpointer aot_module, guint32 method_index);
 void     mono_aot_init_gshared_method_this  (gpointer aot_module, guint32 method_index, MonoObject *this_ins);
 void     mono_aot_init_gshared_method_rgctx  (gpointer aot_module, guint32 method_index, MonoMethodRuntimeGenericContext *rgctx);
 
 /* This is an exported function */
-MONO_API void     mono_aot_register_globals          (gpointer *globals);
-/* This too */
 MONO_API void     mono_aot_register_module           (gpointer *aot_info);
 
 void     mono_xdebug_init                   (const char *xdebug_opts);
index e406f413205050453886872ba66ae0f40b5483c7..6b5be99a733b904cf065f9e6ddfb887057846f93 100644 (file)
@@ -2,7 +2,7 @@
 #include "config.h"
 #include "tasklets.h"
 #include "mono/metadata/exception.h"
-#include "mono/metadata/gc-internal.h"
+#include "mono/metadata/gc-internals.h"
 #include "mini.h"
 
 #if defined(MONO_SUPPORT_TASKLETS)
index e9ac1b8a11a2a70d596a975c27b96002551092b0..4468ad30869360109c099a0d5801983aa098b522 100644 (file)
@@ -19,7 +19,7 @@
 #include <mono/metadata/tabledefs.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/profiler-private.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/arch/amd64/amd64-codegen.h>
 
 #include <mono/utils/memcheck.h>
index 00fa048d84cb5931cca2611a83f9074c251b6adb..4a604f97e16c1c72b5e6f2256774f25cbc61e4e0 100644 (file)
@@ -39,7 +39,7 @@
 
 #include <mono/metadata/abi-details.h>
 #include <mono/metadata/appdomain.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/metadata/marshal.h>
 #include <mono/metadata/profiler-private.h>
 #include <mono/metadata/tabledefs.h>
index 6e79922512c9f3b165e62ebace0af1d2de63b81f..3644a936639adb502acb1082a3ca2fa1db912ab6 100644 (file)
@@ -18,7 +18,7 @@
 #include <mono/metadata/mono-debug.h>
 #include <mono/metadata/mono-debug-debugger.h>
 #include <mono/metadata/profiler-private.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 #include <mono/arch/x86/x86-codegen.h>
 
 #include <mono/utils/memcheck.h>
index 0b465253d540e4a65129326cf84065755f0927f7..307225d3c6e4d2e3154fba0612f248e7a2f9ee7e 100644 (file)
@@ -15,7 +15,7 @@ monoutils_sources = \
        mono-md5.c              \
        mono-sha1.c             \
        mono-logger.c           \
-       mono-logger-internal.h  \
+       mono-logger-internals.h \
        mono-codeman.c          \
        dlmalloc.h              \
        dlmalloc.c              \
@@ -36,7 +36,7 @@ monoutils_sources = \
        mono-math.c             \
        mono-mmap.c             \
        mono-mmap.h             \
-       mono-mmap-internal.h    \
+       mono-mmap-internals.h   \
        mono-mutex.c            \
        mono-mutex.h            \
        mono-lazy-init.h                \
@@ -102,7 +102,6 @@ monoutils_sources = \
        mono-threads-state-machine.c    \
        mono-threads-posix.c    \
        mono-threads-posix-signals.c    \
-       mono-threads-posix-signals.h    \
        mono-threads-mach.c     \
        mono-threads-mach-helper.c      \
        mono-threads-windows.c  \
diff --git a/mono/utils/mono-logger-internal.h b/mono/utils/mono-logger-internal.h
deleted file mode 100644 (file)
index ee88665..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef __MONO_LOGGER_INTERNAL_H__
-#define __MONO_LOGGER_INTERNAL_H__
-
-#include <glib.h>
-#include "mono-logger.h"
-
-G_BEGIN_DECLS
-
-typedef enum {
-       MONO_TRACE_ASSEMBLY             = (1<<0),
-       MONO_TRACE_TYPE                 = (1<<1),
-       MONO_TRACE_DLLIMPORT            = (1<<2),
-       MONO_TRACE_GC                   = (1<<3),
-        MONO_TRACE_CONFIG              = (1<<4),
-       MONO_TRACE_AOT                  = (1<<5),
-       MONO_TRACE_SECURITY             = (1<<6),
-       MONO_TRACE_THREADPOOL           = (1<<7),
-       MONO_TRACE_IO_THREADPOOL        = (1<<8),
-       MONO_TRACE_ALL                  = MONO_TRACE_ASSEMBLY |
-                                         MONO_TRACE_TYPE |
-                                         MONO_TRACE_DLLIMPORT |
-                                         MONO_TRACE_GC |
-                                         MONO_TRACE_CONFIG |
-                                         MONO_TRACE_AOT |
-                                         MONO_TRACE_SECURITY |
-                                         MONO_TRACE_THREADPOOL |
-                                         MONO_TRACE_IO_THREADPOOL
-} MonoTraceMask;
-
-void 
-mono_trace_cleanup (void);
-
-void 
-mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...);
-
-void 
-mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
-
-void 
-mono_trace_set_level (GLogLevelFlags level);
-
-void 
-mono_trace_set_mask (MonoTraceMask mask);
-
-void 
-mono_trace_push (GLogLevelFlags level, MonoTraceMask mask);
-
-void 
-mono_trace_pop (void);
-
-gboolean
-mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask);
-
-#ifdef G_HAVE_ISO_VARARGS
-#define mono_trace_error(...)  mono_trace(G_LOG_LEVEL_ERROR, \
-                                                                                       __VA_ARGS__)
-#define mono_trace_warning(...) mono_trace(G_LOG_LEVEL_WARNING, \
-                                                                                       __VA_ARGS__)
-#define mono_trace_message(...) mono_trace(G_LOG_LEVEL_MESSAGE, \
-                                                                                       __VA_ARGS__)
-#elif defined(G_HAVE_GNUC_VARARGS)
-#define mono_trace_error(format...)    mono_trace(G_LOG_LEVEL_ERROR, \
-                                                                                       format)
-#define mono_trace_warning(format...) mono_trace(G_LOG_LEVEL_WARNING, \
-                                                                                       format)
-#define mono_trace_message(format...) mono_trace(G_LOG_LEVEL_MESSAGE, \
-                                                                                       format)
-#else /* no varargs macros */
-G_GNUC_UNUSED static void
-mono_trace_error(MonoTraceMask mask, const char *format, ...)
-{
-       va_list args;
-       va_start (args, format);
-       mono_tracev(G_LOG_LEVEL_ERROR, mask, format, args);
-       va_end (args);
-}
-
-G_GNUC_UNUSED static void
-mono_trace_warning(MonoTraceMask mask, const char *format, ...)
-{
-       va_list args;
-       va_start (args, format);
-       mono_tracev(G_LOG_LEVEL_WARNING, mask, format, args);
-       va_end (args);
-}
-
-G_GNUC_UNUSED static void
-mono_trace_message(MonoTraceMask mask, const char *format, ...)
-{
-       va_list args;
-       va_start (args, format);
-       mono_tracev(G_LOG_LEVEL_MESSAGE, mask, format, args);
-       va_end (args);
-}
-
-#endif /* !__GNUC__ */
-
-#if defined (PLATFORM_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__)
-#define mono_runtime_printf_err(format, ...) g_log ("mono-rt", G_LOG_LEVEL_CRITICAL, format "\n", ##__VA_ARGS__)
-#define mono_runtime_stdout_fflush() do { } while (0)
-
-#else
-
-#define mono_gc_printf(gc_log_file, format, ...) do {  \
-       fprintf (gc_log_file, format, ##__VA_ARGS__);   \
-       fflush (gc_log_file);   \
-} while (0)
-
-#define mono_runtime_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
-#define mono_runtime_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
-#define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
-
-#endif
-
-
-G_END_DECLS
-
-#endif /* __MONO_LOGGER_INTERNAL_H__ */
diff --git a/mono/utils/mono-logger-internals.h b/mono/utils/mono-logger-internals.h
new file mode 100644 (file)
index 0000000..ee88665
--- /dev/null
@@ -0,0 +1,121 @@
+#ifndef __MONO_LOGGER_INTERNAL_H__
+#define __MONO_LOGGER_INTERNAL_H__
+
+#include <glib.h>
+#include "mono-logger.h"
+
+G_BEGIN_DECLS
+
+typedef enum {
+       MONO_TRACE_ASSEMBLY             = (1<<0),
+       MONO_TRACE_TYPE                 = (1<<1),
+       MONO_TRACE_DLLIMPORT            = (1<<2),
+       MONO_TRACE_GC                   = (1<<3),
+        MONO_TRACE_CONFIG              = (1<<4),
+       MONO_TRACE_AOT                  = (1<<5),
+       MONO_TRACE_SECURITY             = (1<<6),
+       MONO_TRACE_THREADPOOL           = (1<<7),
+       MONO_TRACE_IO_THREADPOOL        = (1<<8),
+       MONO_TRACE_ALL                  = MONO_TRACE_ASSEMBLY |
+                                         MONO_TRACE_TYPE |
+                                         MONO_TRACE_DLLIMPORT |
+                                         MONO_TRACE_GC |
+                                         MONO_TRACE_CONFIG |
+                                         MONO_TRACE_AOT |
+                                         MONO_TRACE_SECURITY |
+                                         MONO_TRACE_THREADPOOL |
+                                         MONO_TRACE_IO_THREADPOOL
+} MonoTraceMask;
+
+void 
+mono_trace_cleanup (void);
+
+void 
+mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...);
+
+void 
+mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
+
+void 
+mono_trace_set_level (GLogLevelFlags level);
+
+void 
+mono_trace_set_mask (MonoTraceMask mask);
+
+void 
+mono_trace_push (GLogLevelFlags level, MonoTraceMask mask);
+
+void 
+mono_trace_pop (void);
+
+gboolean
+mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask);
+
+#ifdef G_HAVE_ISO_VARARGS
+#define mono_trace_error(...)  mono_trace(G_LOG_LEVEL_ERROR, \
+                                                                                       __VA_ARGS__)
+#define mono_trace_warning(...) mono_trace(G_LOG_LEVEL_WARNING, \
+                                                                                       __VA_ARGS__)
+#define mono_trace_message(...) mono_trace(G_LOG_LEVEL_MESSAGE, \
+                                                                                       __VA_ARGS__)
+#elif defined(G_HAVE_GNUC_VARARGS)
+#define mono_trace_error(format...)    mono_trace(G_LOG_LEVEL_ERROR, \
+                                                                                       format)
+#define mono_trace_warning(format...) mono_trace(G_LOG_LEVEL_WARNING, \
+                                                                                       format)
+#define mono_trace_message(format...) mono_trace(G_LOG_LEVEL_MESSAGE, \
+                                                                                       format)
+#else /* no varargs macros */
+G_GNUC_UNUSED static void
+mono_trace_error(MonoTraceMask mask, const char *format, ...)
+{
+       va_list args;
+       va_start (args, format);
+       mono_tracev(G_LOG_LEVEL_ERROR, mask, format, args);
+       va_end (args);
+}
+
+G_GNUC_UNUSED static void
+mono_trace_warning(MonoTraceMask mask, const char *format, ...)
+{
+       va_list args;
+       va_start (args, format);
+       mono_tracev(G_LOG_LEVEL_WARNING, mask, format, args);
+       va_end (args);
+}
+
+G_GNUC_UNUSED static void
+mono_trace_message(MonoTraceMask mask, const char *format, ...)
+{
+       va_list args;
+       va_start (args, format);
+       mono_tracev(G_LOG_LEVEL_MESSAGE, mask, format, args);
+       va_end (args);
+}
+
+#endif /* !__GNUC__ */
+
+#if defined (PLATFORM_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__)
+#define mono_runtime_printf_err(format, ...) g_log ("mono-rt", G_LOG_LEVEL_CRITICAL, format "\n", ##__VA_ARGS__)
+#define mono_runtime_stdout_fflush() do { } while (0)
+
+#else
+
+#define mono_gc_printf(gc_log_file, format, ...) do {  \
+       fprintf (gc_log_file, format, ##__VA_ARGS__);   \
+       fflush (gc_log_file);   \
+} while (0)
+
+#define mono_runtime_printf(format, ...) fprintf (stdout, format "\n", ##__VA_ARGS__)
+#define mono_runtime_printf_err(format, ...) fprintf (stderr, format "\n", ##__VA_ARGS__)
+#define mono_runtime_stdout_fflush() do { fflush (stdout); } while (0)
+
+#endif
+
+
+G_END_DECLS
+
+#endif /* __MONO_LOGGER_INTERNAL_H__ */
index 0b2c8a7f69b4e070157089cf25bb0d0b42a68a8f..09d72dd2f008325724e2bf60c4d25b499a1eeed5 100644 (file)
@@ -4,7 +4,7 @@
 #include <glib.h>
 
 #include "mono-compiler.h"
-#include "mono-logger-internal.h"
+#include "mono-logger-internals.h"
 
 typedef struct {
        GLogLevelFlags  level;
diff --git a/mono/utils/mono-mmap-internal.h b/mono/utils/mono-mmap-internal.h
deleted file mode 100644 (file)
index b23ba16..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * mono-mmap-internal.h: Internal virtual memory stuff.
- *
- * Copyright (C) 2014 Xamarin Inc
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License 2.0 as published by the Free Software Foundation;
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License 2.0 along with this library; if not, write to the Free
- * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#ifndef __MONO_UTILS_MMAP_INTERNAL_H__
-#define __MONO_UTILS_MMAP_INTERNAL_H__
-
-#include "mono-compiler.h"
-
-int mono_pages_not_faulted (void *addr, size_t length);
-
-#endif /* __MONO_UTILS_MMAP_INTERNAL_H__ */
-
diff --git a/mono/utils/mono-mmap-internals.h b/mono/utils/mono-mmap-internals.h
new file mode 100644 (file)
index 0000000..ed6f015
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * mono-mmap-internals.h: Internal virtual memory stuff.
+ *
+ * Copyright (C) 2014 Xamarin Inc
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License 2.0 as published by the Free Software Foundation;
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License 2.0 along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef __MONO_UTILS_MMAP_INTERNAL_H__
+#define __MONO_UTILS_MMAP_INTERNAL_H__
+
+#include "mono-compiler.h"
+
+int mono_pages_not_faulted (void *addr, size_t length);
+
+#endif /* __MONO_UTILS_MMAP_INTERNAL_H__ */
+
index bb1ec15d4742a387436eb28771c3304a6b68a7b7..f3b4d17c77bd9104d49c742c56b84d70a1d63eb7 100644 (file)
@@ -31,7 +31,7 @@
 #endif
 
 #include "mono-mmap.h"
-#include "mono-mmap-internal.h"
+#include "mono-mmap-internals.h"
 #include "mono-proclib.h"
 #include <mono/utils/mono-threads.h>
 
index 7e836163d67856cd520d26234228d9cebb627a90..8432bdab3c59cc1ef40d68f8890add0ef064ca86 100644 (file)
@@ -15,7 +15,6 @@
 #endif
 
 #include "mono-threads.h"
-#include "mono-threads-posix-signals.h"
 
 #if defined(USE_POSIX_BACKEND)
 
index ade08008827ad746753bbaa654bb7d5a47654ae5..c324dfbcd237b48dd3c6c7292bc53dbf372e0839 100644 (file)
@@ -18,7 +18,6 @@
 #include <signal.h>
 
 #include "mono-semaphore.h"
-#include "mono-threads-posix-signals.h"
 
 #if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
 #define DEFAULT_SUSPEND_SIGNAL SIGXFSZ
@@ -38,14 +37,14 @@ static sigset_t suspend_ack_signal_mask;
 extern int mono_gc_get_suspend_signal (void);
 
 static int
-signal_search_alternative (int min_signal)
+signal_search_alternative (void)
 {
 #if !defined (SIGRTMIN)
        g_error ("signal search only works with RTMIN");
 #else
        int i;
        /* we try to avoid SIGRTMIN and any one that might have been set already, see bug #75387 */
-       for (i = MAX (min_signal, SIGRTMIN) + 1; i < SIGRTMAX; ++i) {
+       for (i = SIGRTMIN + 1; i < SIGRTMAX; ++i) {
                struct sigaction sinfo;
                sigaction (i, NULL, &sinfo);
                if (sinfo.sa_handler == SIG_DFL && (void*)sinfo.sa_sigaction == (void*)SIG_DFL) {
@@ -75,62 +74,21 @@ signal_add_handler (int signo, gpointer handler, int flags)
 #endif
 }
 
-static int
-suspend_signal_get (void)
-{
-#if defined(PLATFORM_ANDROID)
-       return SIGUNUSED;
-#elif !defined (SIGRTMIN)
-#ifdef SIGUSR1
-       return SIGUSR1;
-#else
-       return -1;
-#endif /* SIGUSR1 */
-#else
-       static int suspend_signum = -1;
-       if (suspend_signum == -1)
-               suspend_signum = signal_search_alternative (-1);
-       return suspend_signum;
-#endif /* SIGRTMIN */
-}
-
-static int
-restart_signal_get (void)
-{
-#if defined(PLATFORM_ANDROID)
-       return SIGTTOU;
-#elif !defined (SIGRTMIN)
-#ifdef SIGUSR2
-       return SIGUSR2;
-#else
-       return -1;
-#endif /* SIGUSR1 */
-#else
-       static int resume_signum = -1;
-       if (resume_signum == -1)
-               resume_signum = signal_search_alternative (suspend_signal_get () + 1);
-       return resume_signum;
-#endif /* SIGRTMIN */
-}
-
-
 static int
 abort_signal_get (void)
 {
 #if defined(PLATFORM_ANDROID)
        return SIGTTIN;
-#elif !defined (SIGRTMIN)
-#ifdef SIGTTIN
-       return SIGTTIN;
-#else
-       return -1;
-#endif /* SIGRTMIN */
-#else
+#elif defined (SIGRTMIN)
        static int abort_signum = -1;
        if (abort_signum == -1)
-               abort_signum = signal_search_alternative (restart_signal_get () + 1);
+               abort_signum = signal_search_alternative ();
        return abort_signum;
-#endif /* SIGRTMIN */
+#elif defined (SIGTTIN)
+       return SIGTTIN;
+#else
+       return -1;
+#endif
 }
 
 static void
@@ -254,18 +212,11 @@ mono_threads_posix_init_signals (MonoThreadPosixInitSignals signals)
 
        switch (signals) {
        case MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART: {
-               if (mono_thread_info_unified_management_enabled ()) {
-                       suspend_signal_num = DEFAULT_SUSPEND_SIGNAL;
-                       restart_signal_num = DEFAULT_RESTART_SIGNAL;
-               } else {
-                       suspend_signal_num = suspend_signal_get ();
-                       restart_signal_num = restart_signal_get ();
-               }
+               suspend_signal_num = DEFAULT_SUSPEND_SIGNAL;
+               restart_signal_num = DEFAULT_RESTART_SIGNAL;
 
                sigfillset (&suspend_signal_mask);
                sigdelset (&suspend_signal_mask, restart_signal_num);
-               if (!mono_thread_info_unified_management_enabled ())
-                       sigdelset (&suspend_signal_mask, mono_gc_get_suspend_signal ());
 
                sigemptyset (&suspend_ack_signal_mask);
                sigaddset (&suspend_ack_signal_mask, restart_signal_num);
@@ -312,4 +263,24 @@ mono_threads_posix_get_abort_signal (void)
        return abort_signal_num;
 }
 
+#else /* defined(USE_POSIX_BACKEND) */
+
+gint
+mono_threads_posix_get_suspend_signal (void)
+{
+       return -1;
+}
+
+gint
+mono_threads_posix_get_restart_signal (void)
+{
+       return -1;
+}
+
+gint
+mono_threads_posix_get_abort_signal (void)
+{
+       return -1;
+}
+
 #endif /* defined(USE_POSIX_BACKEND) */
diff --git a/mono/utils/mono-threads-posix-signals.h b/mono/utils/mono-threads-posix-signals.h
deleted file mode 100644 (file)
index 2bdcf8e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-
-#ifndef __MONO_THREADS_POSIX_SIGNALS_H__
-#define __MONO_THREADS_POSIX_SIGNALS_H__
-
-#include <config.h>
-#include <glib.h>
-
-#include "mono-threads.h"
-
-#if defined(USE_POSIX_BACKEND) || defined(USE_POSIX_SYSCALL_ABORT)
-
-typedef enum {
-       MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART,
-       MONO_THREADS_POSIX_INIT_SIGNALS_ABORT,
-} MonoThreadPosixInitSignals;
-
-void
-mono_threads_posix_init_signals (MonoThreadPosixInitSignals signals);
-
-gint
-mono_threads_posix_get_suspend_signal (void);
-
-gint
-mono_threads_posix_get_restart_signal (void);
-
-gint
-mono_threads_posix_get_abort_signal (void);
-
-#endif /* defined(USE_POSIX_BACKEND) || defined(USE_POSIX_SYSCALL_ABORT) */
-
-#endif /* __MONO_THREADS_POSIX_SIGNALS_H__ */
\ No newline at end of file
index 437b7421ea8cf77890ddd62176a7626584bbecdf..b4e5880d15cd35a139c828edfedbd238a610012b 100644 (file)
@@ -15,8 +15,7 @@
 #endif
 
 #include <mono/utils/mono-threads.h>
-#include <mono/utils/mono-threads-posix-signals.h>
-#include <mono/metadata/gc-internal.h>
+#include <mono/metadata/gc-internals.h>
 
 #include <errno.h>
 
index 098e02c7ee32e1a558cd6c103ac6a8a03e70a486..f4730695b428af31d2c1ea0ba39d974df4bd1ad3 100644 (file)
@@ -466,7 +466,8 @@ retry_state_change:
                - the thread was previously suspended, which means we should never reach end suspend in the first place.
                - another suspend happened concurrently, which means the global suspend lock didn't happen.
                */
-               g_assert (suspend_count == 1);
+               if (G_UNLIKELY(suspend_count != 1))
+                       g_error ("[%p] suspend_count = %d, but must be 1", mono_thread_info_get_tid (info), suspend_count);
                if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_RUNNING, suspend_count - 1), raw_state) != raw_state)
                        goto retry_state_change;
                trace_state_change ("COMPENSATE_FINISH_ASYNC_SUSPEND", info, raw_state, STATE_RUNNING, -1);
index abad3b64aaacaf2ce6acbd8b46fab97791266354..97e633f6238ba53619413d8e6be5b4908dc0db4d 100644 (file)
@@ -61,7 +61,6 @@ static gboolean mono_threads_inited = FALSE;
 
 static MonoSemType suspend_semaphore;
 static size_t pending_suspends;
-static gboolean unified_suspend_enabled;
 
 #define mono_thread_info_run_state(info) (((MonoThreadInfo*)info)->thread_state & THREAD_STATE_MASK)
 
@@ -629,8 +628,6 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
 #endif
        g_assert (res);
 
-       unified_suspend_enabled = g_getenv ("MONO_ENABLE_UNIFIED_SUSPEND") != NULL || mono_threads_is_coop_enabled ();
-
        MONO_SEM_INIT (&global_suspend_semaphore, 1);
        MONO_SEM_INIT (&suspend_semaphore, 0);
 
@@ -1072,12 +1069,6 @@ mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid)
        mono_thread_info_suspend_unlock ();
 }
 
-gboolean
-mono_thread_info_unified_management_enabled (void)
-{
-       return unified_suspend_enabled;
-}
-
 /*
  * mono_thread_info_set_is_async_context:
  *
index 8a7782fad12d6bc69c507a992f9e909f06d9ac33..a0442c3784cf2f51b8317d1cab8a43753bb08d80 100644 (file)
@@ -377,9 +377,6 @@ mono_thread_info_end_self_suspend (void);
 
 //END of new API
 
-gboolean
-mono_thread_info_unified_management_enabled (void);
-
 void
 mono_thread_info_setup_async_call (THREAD_INFO_TYPE *info, void (*target_func)(void*), void *user_data);
 
@@ -641,4 +638,25 @@ gboolean mono_threads_wait_pending_operations (void);
 void mono_threads_begin_global_suspend (void);
 void mono_threads_end_global_suspend (void);
 
+#if defined(USE_POSIX_BACKEND)
+
+typedef enum {
+       MONO_THREADS_POSIX_INIT_SIGNALS_SUSPEND_RESTART,
+       MONO_THREADS_POSIX_INIT_SIGNALS_ABORT,
+} MonoThreadPosixInitSignals;
+
+void
+mono_threads_posix_init_signals (MonoThreadPosixInitSignals signals);
+
+#endif /* defined(USE_POSIX_BACKEND) */
+
+gint
+mono_threads_posix_get_suspend_signal (void);
+
+gint
+mono_threads_posix_get_restart_signal (void);
+
+gint
+mono_threads_posix_get_abort_signal (void);
+
 #endif /* __MONO_THREADS_H__ */
index c2791b7f497c0832067bef443cd24e6ce5f76396..f4be234ee2e1d035a49b4ca78acb097f950f650a 100644 (file)
     <ClInclude Include="..\mono\metadata\exception.h" />\r
     <ClInclude Include="..\mono\metadata\file-io.h" />\r
     <ClInclude Include="..\mono\metadata\filewatcher.h" />\r
-    <ClInclude Include="..\mono\metadata\gc-internal.h" />\r
+    <ClInclude Include="..\mono\metadata\gc-internals.h" />\r
     <ClInclude Include="..\mono\metadata\number-ms.h" />\r
     <ClInclude Include="..\mono\metadata\seq-points-data.h" />\r
     <ClInclude Include="..\mono\metadata\threadpool-ms-io.h" />\r
index 939f52048d73e8025bf515d850da7fb8096683c0..311f116ffb8ed86770700390bacbe932790e6391 100644 (file)
     <ClInclude Include="..\mono\utils\mono-internal-hash.h" />\r
     <ClInclude Include="..\mono\utils\mono-io-portability.h" />\r
     <ClInclude Include="..\mono\utils\mono-linked-list-set.h" />\r
-    <ClInclude Include="..\mono\utils\mono-logger-internal.h" />\r
+    <ClInclude Include="..\mono\utils\mono-logger-internals.h" />\r
     <ClInclude Include="..\mono\utils\mono-logger.h" />\r
     <ClInclude Include="..\mono\utils\mono-machine.h" />\r
     <ClInclude Include="..\mono\utils\mono-math.h" />\r
     <ClInclude Include="..\mono\utils\mono-stdlib.h" />\r
     <ClInclude Include="..\mono\utils\mono-string.h" />\r
     <ClInclude Include="..\mono\utils\mono-threads.h" />\r
-    <ClCompile Include="..\mono\utils\mono-threads-posix-signals.h" />\r
     <ClInclude Include="..\mono\utils\mono-time.h" />\r
     <ClInclude Include="..\mono\utils\mono-tls.h" />\r
     <ClInclude Include="..\mono\utils\mono-uri.h" />\r
index f2e02e28cbc972cb0b2a5572971a885ac23bbeaa..3e9251af29e941e13deebecaa275ca3e87c50f2c 100644 (file)
@@ -41,11 +41,11 @@ build_profiles += monotouch monotouch_runtime
 endif
 
 if INSTALL_MONOTOUCH_WATCH
-build_profiles += monotouch_watch
+build_profiles += monotouch_watch monotouch_watch_runtime
 endif
 
 if INSTALL_MONOTOUCH_TV
-build_profiles += monotouch_tv
+build_profiles += monotouch_tv monotouch_tv_runtime
 endif
 
 if INSTALL_XAMMAC
diff --git a/samples/embed/testi.c b/samples/embed/testi.c
deleted file mode 100644 (file)
index a1ea82b..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-#include <mono/interpreter/embed.h>
-#include <mono/metadata/environment.h>
-
-/*
- * Very simple mint embedding example.
- * Compile with: 
- *     gcc -o testi testi.c `pkg-config --cflags --libs mint` -lm
- *     mcs test.cs
- * Run with:
- *     ./testi test.exe
- */
-
-static MonoString*
-gimme () {
-       return mono_string_new (mono_domain_get (), "All your monos are belong to us!");
-}
-
-typedef struct
-{
-       MonoDomain *domain;
-       const char *file;
-       int argc;
-       char **argv;
-} MainThreadArgs;
-
-static void main_thread_handler (gpointer user_data)
-{
-       MainThreadArgs *main_args=(MainThreadArgs *)user_data;
-       MonoAssembly *assembly;
-
-       assembly = mono_domain_assembly_open (main_args->domain,
-                                             main_args->file);
-       if (!assembly)
-               exit (2);
-       /*
-        * mono_jit_exec() will run the Main() method in the assembly.
-        * The return value needs to be looked up from
-        * System.Environment.ExitCode.
-        */
-       mono_interp_exec (main_args->domain, assembly, main_args->argc,
-                      main_args->argv);
-}
-
-
-int 
-main(int argc, char* argv[]) {
-       MonoDomain *domain;
-       const char *file;
-       int retval;
-       MainThreadArgs main_args;
-       
-       if (argc < 2){
-               fprintf (stderr, "Please provide an assembly to load\n");
-               return 1;
-       }
-       file = argv [1];
-       /*
-        * mono_jit_init() creates a domain: each assembly is
-        * loaded and run in a MonoDomain.
-        */
-       domain = mono_interp_init (file);
-       /*
-        * We add our special internal call, so that C# code
-        * can call us back.
-        */
-       mono_add_internal_call ("MonoEmbed::gimme", gimme);
-
-       main_args.domain=domain;
-       main_args.file=file;
-       main_args.argc=argc-1;
-       main_args.argv=argv+1;
-       
-       mono_runtime_exec_managed_code (domain, main_thread_handler,
-                                       &main_args);
-
-       retval=mono_environment_exitcode_get ();
-       
-       mono_interp_cleanup (domain);
-       return retval;
-}
-