mono-*.tar.*
tmpinst-dir.stamp
msvc/scripts/inputs/
+extensions-config.h
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`
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
$(_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--%
-#! -*- 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
@:
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
--- /dev/null
+include $(topdir)/build/profiles/monotouch_runtime.make
+
+PROFILE_MCS_FLAGS += \
+ -d:MONOTOUCH_TV
--- /dev/null
+include $(topdir)/build/profiles/monotouch_runtime.make
+
+PROFILE_MCS_FLAGS += \
+ -d:MONOTOUCH_WATCH
System.XML \
Mono.CSharp
+monotouch_watch_runtime_dirs := $(monotouch_runtime_dirs)
+monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs)
+
xammac_4_5_dirs := \
corlib \
System \
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)
*/
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
/*
* 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;
bool cloned = false;
bool checkCertName = true;
bool checkCertRevocationStatus = false;
- bool useServicePointManagerCallback = false;
+ bool useServicePointManagerCallback = true;
bool skipSystemValidators = false;
bool callbackNeedsChain = true;
ICertificateValidator certificateValidator;
// 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)
{
private void InternalWriteCallback(IAsyncResult ar)
{
- if (this.disposed)
- return;
-
InternalAsyncResult internalResult = (InternalAsyncResult)ar.AsyncState;
try
{
+ this.checkDisposed();
this.innerStream.EndWrite(ar);
internalResult.SetComplete();
}
--- /dev/null
+#include monotouch_System.Core.dll.sources
--- /dev/null
+#include monotouch_System.Core.dll.sources
--- /dev/null
+#include mobile_System.Xml.dll.sources
--- /dev/null
+#include mobile_System.Xml.dll.sources
#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;
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;
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;
}
#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;
#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);
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];
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)
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;
--- /dev/null
+#include monotouch_System.dll.sources
--- /dev/null
+#include monotouch_System.dll.sources
{
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]
// 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)
// 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);
}
--- /dev/null
+#include corlib.dll.sources
\ No newline at end of file
--- /dev/null
+#include corlib.dll.sources
\ No newline at end of file
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
// 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)
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;
--- /dev/null
+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 ();
+ }
+}
</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">
<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" />
}
}
- 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);
+ }
}
}
}
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)
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";
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 ()
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)
file-io.h \
filewatcher.c \
filewatcher.h \
- gc-internal.h \
+ gc-internals.h \
icall.c \
icall-def.h \
image.c \
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 \
#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
#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"
#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"
#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>
#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>
#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>
#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"
#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>
#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>
/*
* 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>
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__ */
#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>
#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"
#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>
#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>
#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>
#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>
#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>
+++ /dev/null
-/*
- * 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__ */
-
--- /dev/null
+/*
+ * 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__ */
+
#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>
#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>
#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>
#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>
#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>
#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>
#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>
#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"
} ProxyWrapperInfo;
typedef struct {
- int nursery_bits;
} WriteBarrierWrapperInfo;
typedef struct {
}
if (t->byref) {
*align = MONO_ABI_ALIGNOF (gpointer);
- return sizeof (gpointer);
+ return MONO_ABI_SIZEOF (gpointer);
}
simple_type = t->type;
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: {
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);
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;
#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>
#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"
#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>
#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
#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.
#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>
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)
#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"
#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>
#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"
/*
* 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>
char*
mono_identifier_unescape_type_name_chars (char* identifier);
-#endif
+#endif /* __MONO_METADATA_REFLECTION_INTERNALS_H__ */
#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"
#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>
#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"
+++ /dev/null
-/*
- * 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
--- /dev/null
+/*
+ * 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
#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;
#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);
{
}
-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
#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;
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;
#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);
}
#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);
}
#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
#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;
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-/*
- * 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
+++ /dev/null
-#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
#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
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
#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)
{
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");
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);
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);
mono_threads_wait_pending_operations ();
mono_threads_end_global_suspend ();
}
+
#endif
#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;
#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 () */
#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);
#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>
#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>
#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>
#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>
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;
}
driver.c \
debug-mini.c \
linear-scan.c \
+ aot-compiler.h \
aot-compiler.c \
aot-runtime.c \
graph.c \
#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"
}
case MONO_WRAPPER_WRITE_BARRIER: {
g_assert (info);
- encode_value (info->d.wbarrier.nursery_bits, p, &p);
break;
}
case MONO_WRAPPER_STELEMREF: {
--- /dev/null
+#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
+
+
+
+
#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>
#include "seq-points.h"
#include "version.h"
#include "debugger-agent.h"
+#include "aot-compiler.h"
#ifndef DISABLE_AOT
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: {
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:
*
gboolean
mono_arch_opcode_needs_emulation (MonoCompile *cfg, int opcode)
{
- return FALSE;
+ return TRUE;
}
#endif
#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>
#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
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) {
#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"
#include "mini.h"
#include "jit.h"
+#include "aot-compiler.h"
+
#include <string.h>
#include <ctype.h>
#include <locale.h>
#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>
#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"
#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"
#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>
#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>
#include "jit.h"
#include "debugger-agent.h"
#include "seq-points.h"
+#include "aot-compiler.h"
#define BRANCH_COST 10
#define INLINE_LENGTH_LIMIT 20
#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>
gboolean
mono_arm_have_tls_get (void)
{
+ return FALSE;
#ifdef HAVE_FAST_TLS
return TRUE;
#else
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.
#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
#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>
#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"
#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)
//#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))
#include "llvm-c/Analysis.h"
#include "mini-llvm-cpp.h"
+#include "aot-compiler.h"
#ifdef __MINGW32__
#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>
#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>
#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>
#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>
#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>
#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/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>
#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>
#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>
#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))
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);
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);
#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)
#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>
#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>
#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>
mono-md5.c \
mono-sha1.c \
mono-logger.c \
- mono-logger-internal.h \
+ mono-logger-internals.h \
mono-codeman.c \
dlmalloc.h \
dlmalloc.c \
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 \
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 \
+++ /dev/null
-#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__ */
--- /dev/null
+#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__ */
#include <glib.h>
#include "mono-compiler.h"
-#include "mono-logger-internal.h"
+#include "mono-logger-internals.h"
typedef struct {
GLogLevelFlags level;
+++ /dev/null
-/*
- * 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__ */
-
--- /dev/null
+/*
+ * 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__ */
+
#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>
#endif
#include "mono-threads.h"
-#include "mono-threads-posix-signals.h"
#if defined(USE_POSIX_BACKEND)
#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
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) {
#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
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);
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) */
+++ /dev/null
-
-#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
#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>
- 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);
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)
#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);
mono_thread_info_suspend_unlock ();
}
-gboolean
-mono_thread_info_unified_management_enabled (void)
-{
- return unified_suspend_enabled;
-}
-
/*
* mono_thread_info_set_is_async_context:
*
//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);
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__ */
<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
<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
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
+++ /dev/null
-#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;
-}
-