reloc_libdir=`basename ${libdir}`
AC_SUBST(reloc_libdir)
-dnl if linker handles the version script
-no_version_script=no
-
# Set to yes if Unix sockets cannot be created in an anonymous namespace
need_link_unlink=no
need_link_unlink=yes
AC_DEFINE(PTHREAD_POINTER_ID)
AC_DEFINE(USE_MACH_SEMA, 1, [...])
- no_version_script=yes
libdl=
libgc_threads=pthreads
has_dtrace=yes
# Test whenever ld supports -version-script
AC_PROG_LD
AC_PROG_LD_GNU
-if test "x$lt_cv_prog_gnu_ld" = "xno"; then
- no_version_script=yes
-fi
AM_ICONV()
-AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
-
AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h)
AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/sem.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h)
AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],
utf16_template = _wmktemp( utf16_template);
if (utf16_template && *utf16_template) {
/* FIXME: _O_TEMPORARY causes file to disappear on close causing a test to fail */
- fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_EXCL, _S_IREAD | _S_IWRITE);
+ fd = _wopen( utf16_template, _O_BINARY | _O_CREAT /*| _O_TEMPORARY*/ | _O_RDWR | _O_EXCL, _S_IREAD | _S_IWRITE);
}
/* FIXME: this will crash if utf16_template == NULL */
-Subproject commit 4bb7900e7905930505b93124c2ab144936903ba4
+Subproject commit 309ab499a19f1d4580a5a0c0b4604a97bcc8763c
xsd.1 \
mono-configuration-crypto.1 \
ccrewrite.1 \
- cccheck.1
+ cccheck.1 \
+ mono-symbolicate.1
EXTRA_DIST = $(man_MANS)
--- /dev/null
+.\"
+.\" mono-symbolicate manual page.
+.\" Copyright 2015 Xamarin
+.\" Author:
+.\" Marcos Henrich <marcos.henrich@xamarin.com>
+.\"
+.TH "mono-symbolicate" 1
+.SH NAME
+mono-symbolicate \- Mono Symbolicate Tool
+.SH SYNOPSIS
+.PP
+.B mono-symbolicate exefile stacktracesfile [directories...]
+.SH DESCRIPTION
+mono-symbolicate is a tool that converts a stack trace with <filename unknown>:0
+into one with file names and line numbers.
+.PP
+The output of calling this tool will be the provided
+.I stacktracesfile
+where <filename unknown>:0 parts are replaced by
+a file name and a line number.
+.PP
+For the tool to work it needs to load referenced assemblies, it will first look
+in the same folder as
+.I exefile
+then from one of the provided
+.I directories.
+.PP
+The tool assumes that the folder with a referenced assembly called for example
+name.dll will also include name.dll.mdb,
+if the referenced assembly is AOT compiled then the tool is also expecting to find
+name.dll.msym.
+.SH AUTHOR
+Written by Marcos Henrich
+.SH COPYRIGHT
+Copyright (C) 2015 Xamarin.
+.SH MAILING LISTS
+Visit http://lists.ximian.com/mailman/listinfo/mono-devel-list for details.
+.SH WEB SITE
+Visit http://www.mono-project.com for details
sgen-gc.c. You can then use this command to explore the output
.nf
sgen-grep-binprot 0x1234 0x5678 < file
+.fi
.TP
\fBnursery-canaries\fR
If set, objects allocated in the nursery are suffixed with a canary (guard)
word, which is checked on each minor collection. Can be used to detect/debug
heap corruption issues.
-.fi
-.ne
-.RE
+
.TP
\fBdo-not-finalize\fR
If enabled, finalizers will not be run. Everything else will be
finalization queue where they survive until they're scheduled to
finalize. Once they're not in the queue anymore they will be
collected regularly.
-.fi
+
+.TP
+\fBlog-finalizers\fR
+Log verbosely around the finalization process to aid debugging.
.ne
.RE
.TP
void DumpPerformanceSummary ()
{
SetColor (eventColor);
- WriteLine ("Target perfomance summary:");
+ WriteLine ("Target performance summary:");
ResetColor ();
foreach (var pi in targetPerfTable.OrderBy (pair => pair.Value.Time))
WriteLine (String.Empty);
SetColor (eventColor);
- WriteLine ("Tasks perfomance summary:");
+ WriteLine ("Tasks performance summary:");
ResetColor ();
foreach (var pi in tasksPerfTable.OrderBy (pair => pair.Value.Time))
object[] args;
if (Arguments == null) {
- flags |= BindingFlags.GetProperty;
+ if ((flags & BindingFlags.CreateInstance) == 0)
+ flags |= BindingFlags.GetProperty;
args = null;
} else {
- flags |= BindingFlags.InvokeMethod;
+ if ((flags & BindingFlags.CreateInstance) == 0)
+ flags |= BindingFlags.InvokeMethod;
ExpandArguments (project, options);
args = PrepareMethodArguments (member_name, flags);
if (args == null)
canceled.Set ();
}
-#if XBUILD_12
protected MessageImportance StandardErrorImportanceToUse {
get {
return MessageImportance.Normal;
public bool LogStandardErrorAsError { get; set; }
public string StandardOutputImportance { get; set; }
-#endif
}
}
scs.Add((0x00 << 0x08) | 0x09, "TLS_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 8, 8, 56, 8, 8);
// Supported exportable ciphers
- scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0);
- scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8);
- scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8);
- scs.Add((0x00 << 0x08) | 0x60, "TLS_RSA_EXPORT_WITH_RC4_56_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
- scs.Add((0x00 << 0x08) | 0x61, "TLS_RSA_EXPORT_WITH_RC2_CBC_56_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 7, 16, 56, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x03, "TLS_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0);
+ // scs.Add((0x00 << 0x08) | 0x06, "TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x08, "TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x60, "TLS_RSA_EXPORT_WITH_RC4_56_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
+ // scs.Add((0x00 << 0x08) | 0x61, "TLS_RSA_EXPORT_WITH_RC2_CBC_56_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 7, 16, 56, 8, 8);
// 56 bits but we use 64 bits because of parity (DES is really 56 bits)
- scs.Add((0x00 << 0x08) | 0x62, "TLS_RSA_EXPORT_WITH_DES_CBC_56_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 8, 8, 64, 8, 8);
- scs.Add((0x00 << 0x08) | 0x64, "TLS_RSA_EXPORT_WITH_RC4_56_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
+ // scs.Add((0x00 << 0x08) | 0x62, "TLS_RSA_EXPORT_WITH_DES_CBC_56_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 8, 8, 64, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x64, "TLS_RSA_EXPORT_WITH_RC4_56_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
// Default CipherSuite
// scs.Add(0, "TLS_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, ExchangeAlgorithmType.None, true, false, 0, 0, 0, 0, 0);
scs.Add((0x00 << 0x08) | 0x09, "SSL_RSA_WITH_DES_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, false, true, 8, 8, 56, 8, 8);
// Supported exportable ciphers
- scs.Add((0x00 << 0x08) | 0x03, "SSL_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0);
- scs.Add((0x00 << 0x08) | 0x06, "SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8);
- scs.Add((0x00 << 0x08) | 0x08, "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8);
- scs.Add((0x00 << 0x08) | 0x60, "SSL_RSA_EXPORT_WITH_RC4_56_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
- scs.Add((0x00 << 0x08) | 0x61, "SSL_RSA_EXPORT_WITH_RC2_CBC_56_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 7, 16, 56, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x03, "SSL_RSA_EXPORT_WITH_RC4_40_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 5, 16, 40, 0, 0);
+ // scs.Add((0x00 << 0x08) | 0x06, "SSL_RSA_EXPORT_WITH_RC2_CBC_40_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 16, 40, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x08, "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 5, 8, 40, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x60, "SSL_RSA_EXPORT_WITH_RC4_56_MD5", CipherAlgorithmType.Rc4, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
+ // scs.Add((0x00 << 0x08) | 0x61, "SSL_RSA_EXPORT_WITH_RC2_CBC_56_MD5", CipherAlgorithmType.Rc2, HashAlgorithmType.Md5, ExchangeAlgorithmType.RsaKeyX, true, true, 7, 16, 56, 8, 8);
// 56 bits but we use 64 bits because of parity (DES is really 56 bits)
- scs.Add((0x00 << 0x08) | 0x62, "SSL_RSA_EXPORT_WITH_DES_CBC_56_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 8, 8, 64, 8, 8);
- scs.Add((0x00 << 0x08) | 0x64, "SSL_RSA_EXPORT_WITH_RC4_56_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
+ // scs.Add((0x00 << 0x08) | 0x62, "SSL_RSA_EXPORT_WITH_DES_CBC_56_SHA", CipherAlgorithmType.Des, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, true, 8, 8, 64, 8, 8);
+ // scs.Add((0x00 << 0x08) | 0x64, "SSL_RSA_EXPORT_WITH_RC4_56_SHA", CipherAlgorithmType.Rc4, HashAlgorithmType.Sha1, ExchangeAlgorithmType.RsaKeyX, true, false, 7, 16, 56, 0, 0);
// Default CipherSuite
// scs.Add(0, "SSL_NULL_WITH_NULL_NULL", CipherAlgorithmType.None, HashAlgorithmType.None, true, false, 0, 0, 0, 0, 0);
HandshakeType type, byte[] buffer)
{
ClientContext context = (ClientContext)this.context;
+ var last = context.LastHandshakeMsg;
switch (type)
{
return null;
case HandshakeType.ServerHello:
+ if (last != HandshakeType.HelloRequest)
+ break;
return new TlsServerHello(this.context, buffer);
+ // Optional
case HandshakeType.Certificate:
+ if (last != HandshakeType.ServerHello)
+ break;
return new TlsServerCertificate(this.context, buffer);
- case HandshakeType.ServerKeyExchange:
- return new TlsServerKeyExchange(this.context, buffer);
-
+ // Optional
case HandshakeType.CertificateRequest:
- return new TlsServerCertificateRequest(this.context, buffer);
+ if (last == HandshakeType.ServerKeyExchange || last == HandshakeType.Certificate)
+ return new TlsServerCertificateRequest(this.context, buffer);
+ break;
case HandshakeType.ServerHelloDone:
- return new TlsServerHelloDone(this.context, buffer);
+ if (last == HandshakeType.CertificateRequest || last == HandshakeType.Certificate || last == HandshakeType.ServerHello)
+ return new TlsServerHelloDone(this.context, buffer);
+ break;
case HandshakeType.Finished:
- return new TlsServerFinished(this.context, buffer);
-
+ // depends if a full (ServerHelloDone) or an abbreviated handshake (ServerHello) is being done
+ bool check = context.AbbreviatedHandshake ? (last == HandshakeType.ServerHello) : (last == HandshakeType.ServerHelloDone);
+ // ChangeCipherSpecDone is not an handshake message (it's a content type) but still needs to be happens before finished
+ if (check && context.ChangeCipherSpecDone) {
+ context.ChangeCipherSpecDone = false;
+ return new TlsServerFinished (this.context, buffer);
+ }
+ break;
+
default:
throw new TlsException(
AlertDescription.UnexpectedMessage,
"Unknown server handshake message received ({0})",
type.ToString()));
}
+ throw new TlsException (AlertDescription.HandshakeFailiure, String.Format ("Protocol error, unexpected protocol transition from {0} to {1}", last, type));
}
#endregion
set { this.protocolNegotiated = value; }
}
+ public bool ChangeCipherSpecDone { get; set; }
+
public SecurityProtocolType SecurityProtocol
{
get
} else {
ctx.StartSwitchingSecurityParameters (false);
}
+
+ ctx.ChangeCipherSpecDone = true;
}
public virtual HandshakeMessage GetMessage(HandshakeType type)
// Try to read the Record Content Type
int type = internalResult.InitialBuffer[0];
- // Set last handshake message received to None
- this.context.LastHandshakeMsg = HandshakeType.ClientHello;
-
ContentType contentType = (ContentType)type;
byte[] buffer = this.ReadRecordBuffer(type, record);
if (buffer == null)
// Try to read the Record Content Type
int type = recordTypeBuffer[0];
- // Set last handshake message received to None
- this.context.LastHandshakeMsg = HandshakeType.ClientHello;
-
ContentType contentType = (ContentType)type;
byte[] buffer = this.ReadRecordBuffer(type, record);
if (buffer == null)
private byte[] ReadRecordBuffer (int contentType, Stream record)
{
- switch (contentType)
- {
- case 0x80:
- return this.ReadClientHelloV2(record);
-
- default:
- if (!Enum.IsDefined(typeof(ContentType), (ContentType)contentType))
- {
- throw new TlsException(AlertDescription.DecodeError);
- }
- return this.ReadStandardRecordBuffer(record);
- }
- }
-
- private byte[] ReadClientHelloV2 (Stream record)
- {
- int msgLength = record.ReadByte ();
- // process further only if the whole record is available
- if (record.CanSeek && (msgLength + 1 > record.Length))
- {
- return null;
- }
-
- byte[] message = new byte[msgLength];
- record.Read (message, 0, msgLength);
-
- int msgType = message [0];
- if (msgType != 1)
+ if (!Enum.IsDefined(typeof(ContentType), (ContentType)contentType))
{
throw new TlsException(AlertDescription.DecodeError);
}
- int protocol = (message [1] << 8 | message [2]);
- int cipherSpecLength = (message [3] << 8 | message [4]);
- int sessionIdLength = (message [5] << 8 | message [6]);
- int challengeLength = (message [7] << 8 | message [8]);
- int length = (challengeLength > 32) ? 32 : challengeLength;
-
- // Read CipherSpecs
- byte[] cipherSpecV2 = new byte[cipherSpecLength];
- Buffer.BlockCopy (message, 9, cipherSpecV2, 0, cipherSpecLength);
-
- // Read session ID
- byte[] sessionId = new byte[sessionIdLength];
- Buffer.BlockCopy (message, 9 + cipherSpecLength, sessionId, 0, sessionIdLength);
-
- // Read challenge ID
- byte[] challenge = new byte[challengeLength];
- Buffer.BlockCopy (message, 9 + cipherSpecLength + sessionIdLength, challenge, 0, challengeLength);
-
- if (challengeLength < 16 || cipherSpecLength == 0 || (cipherSpecLength % 3) != 0)
- {
- throw new TlsException(AlertDescription.DecodeError);
- }
-
- // Updated the Session ID
- if (sessionId.Length > 0)
- {
- this.context.SessionId = sessionId;
- }
-
- // Update the protocol version
- this.Context.ChangeProtocol((short)protocol);
-
- // Select the Cipher suite
- this.ProcessCipherSpecV2Buffer(this.Context.SecurityProtocol, cipherSpecV2);
-
- // Updated the Client Random
- this.context.ClientRandom = new byte [32]; // Always 32
- // 1. if challenge is bigger than 32 bytes only use the last 32 bytes
- // 2. right justify (0) challenge in ClientRandom if less than 32
- Buffer.BlockCopy (challenge, challenge.Length - length, this.context.ClientRandom, 32 - length, length);
- // Set
- this.context.LastHandshakeMsg = HandshakeType.ClientHello;
- this.context.ProtocolNegotiated = true;
-
- return message;
- }
-
- private byte[] ReadStandardRecordBuffer (Stream record)
- {
byte[] header = new byte[4];
if (record.Read (header, 0, 4) != 4)
throw new TlsException ("buffer underrun");
}
#endregion
-
- #region CipherSpecV2 processing
-
- private void ProcessCipherSpecV2Buffer (SecurityProtocolType protocol, byte[] buffer)
- {
- TlsStream codes = new TlsStream(buffer);
-
- string prefix = (protocol == SecurityProtocolType.Ssl3) ? "SSL_" : "TLS_";
-
- while (codes.Position < codes.Length)
- {
- byte check = codes.ReadByte();
-
- if (check == 0)
- {
- // SSL/TLS cipher spec
- short code = codes.ReadInt16();
- int index = this.Context.SupportedCiphers.IndexOf(code);
- if (index != -1)
- {
- this.Context.Negotiating.Cipher = this.Context.SupportedCiphers[index];
- break;
- }
- }
- else
- {
- byte[] tmp = new byte[2];
- codes.Read(tmp, 0, tmp.Length);
-
- int tmpCode = ((check & 0xff) << 16) | ((tmp[0] & 0xff) << 8) | (tmp[1] & 0xff);
- CipherSuite cipher = this.MapV2CipherCode(prefix, tmpCode);
-
- if (cipher != null)
- {
- this.Context.Negotiating.Cipher = cipher;
- break;
- }
- }
- }
-
- if (this.Context.Negotiating == null)
- {
- throw new TlsException(AlertDescription.InsuficientSecurity, "Insuficient Security");
- }
- }
-
- private CipherSuite MapV2CipherCode(string prefix, int code)
- {
- try
- {
- switch (code)
- {
- case 65664:
- // TLS_RC4_128_WITH_MD5
- return this.Context.SupportedCiphers[prefix + "RSA_WITH_RC4_128_MD5"];
-
- case 131200:
- // TLS_RC4_128_EXPORT40_WITH_MD5
- return this.Context.SupportedCiphers[prefix + "RSA_EXPORT_WITH_RC4_40_MD5"];
-
- case 196736:
- // TLS_RC2_CBC_128_CBC_WITH_MD5
- return this.Context.SupportedCiphers[prefix + "RSA_EXPORT_WITH_RC2_CBC_40_MD5"];
-
- case 262272:
- // TLS_RC2_CBC_128_CBC_EXPORT40_WITH_MD5
- return this.Context.SupportedCiphers[prefix + "RSA_EXPORT_WITH_RC2_CBC_40_MD5"];
-
- case 327808:
- // TLS_IDEA_128_CBC_WITH_MD5
- return null;
-
- case 393280:
- // TLS_DES_64_CBC_WITH_MD5
- return null;
-
- case 458944:
- // TLS_DES_192_EDE3_CBC_WITH_MD5
- return null;
-
- default:
- return null;
- }
- }
- catch
- {
- return null;
- }
- }
-
- #endregion
}
}
{
internal class ServerRecordProtocol : RecordProtocol
{
+ TlsClientCertificate cert;
+
#region Constructors
public ServerRecordProtocol(
private HandshakeMessage createClientHandshakeMessage(
HandshakeType type, byte[] buffer)
{
+ var last = context.LastHandshakeMsg;
switch (type)
{
case HandshakeType.ClientHello:
return new TlsClientHello(this.context, buffer);
case HandshakeType.Certificate:
- return new TlsClientCertificate(this.context, buffer);
+ if (last != HandshakeType.ClientHello)
+ break;
+ cert = new TlsClientCertificate(this.context, buffer);
+ return cert;
case HandshakeType.ClientKeyExchange:
- return new TlsClientKeyExchange(this.context, buffer);
+ if (last == HandshakeType.ClientHello || last == HandshakeType.Certificate)
+ return new TlsClientKeyExchange(this.context, buffer);
+ break;
case HandshakeType.CertificateVerify:
- return new TlsClientCertificateVerify(this.context, buffer);
+ if (last == HandshakeType.ClientKeyExchange && cert != null)
+ return new TlsClientCertificateVerify(this.context, buffer);
+ break;
case HandshakeType.Finished:
- return new TlsClientFinished(this.context, buffer);
-
+ // Certificates are optional, but if provided, they should send a CertificateVerify
+ bool check = (cert == null) ? (last == HandshakeType.ClientKeyExchange) : (last == HandshakeType.CertificateVerify);
+ // ChangeCipherSpecDone is not an handshake message (it's a content type) but still needs to be happens before finished
+ if (check && context.ChangeCipherSpecDone) {
+ context.ChangeCipherSpecDone = false;
+ return new TlsClientFinished(this.context, buffer);
+ }
+ break;
+
default:
- throw new TlsException(
- AlertDescription.UnexpectedMessage,
- String.Format(CultureInfo.CurrentUICulture,
- "Unknown server handshake message received ({0})",
- type.ToString()));
+ throw new TlsException(AlertDescription.UnexpectedMessage, String.Format(CultureInfo.CurrentUICulture,
+ "Unknown server handshake message received ({0})",
+ type.ToString()));
+ break;
}
+ throw new TlsException (AlertDescription.HandshakeFailiure, String.Format ("Protocol error, unexpected protocol transition from {0} to {1}", last, type));
}
private HandshakeMessage createServerHandshakeMessage(
this.Context.ClientWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize);
this.Context.ServerWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize);
- if (!this.IsExportable)
+ if (this.IvSize != 0)
{
- if (this.IvSize != 0)
- {
- this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize);
- this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize);
- }
- else
- {
- this.Context.ClientWriteIV = CipherSuite.EmptyArray;
- this.Context.ServerWriteIV = CipherSuite.EmptyArray;
- }
+ this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize);
+ this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize);
}
else
{
- HashAlgorithm md5 = MD5.Create();
-
- int keySize = (md5.HashSize >> 3); //in bytes not bits
- byte[] temp = new byte [keySize];
-
- // Generate final write keys
- md5.TransformBlock(this.Context.ClientWriteKey, 0, this.Context.ClientWriteKey.Length, temp, 0);
- md5.TransformFinalBlock(this.Context.RandomCS, 0, this.Context.RandomCS.Length);
- byte[] finalClientWriteKey = new byte[this.ExpandedKeyMaterialSize];
- Buffer.BlockCopy(md5.Hash, 0, finalClientWriteKey, 0, this.ExpandedKeyMaterialSize);
-
- md5.Initialize();
- md5.TransformBlock(this.Context.ServerWriteKey, 0, this.Context.ServerWriteKey.Length, temp, 0);
- md5.TransformFinalBlock(this.Context.RandomSC, 0, this.Context.RandomSC.Length);
- byte[] finalServerWriteKey = new byte[this.ExpandedKeyMaterialSize];
- Buffer.BlockCopy(md5.Hash, 0, finalServerWriteKey, 0, this.ExpandedKeyMaterialSize);
-
- this.Context.ClientWriteKey = finalClientWriteKey;
- this.Context.ServerWriteKey = finalServerWriteKey;
-
- // Generate IV keys
- if (this.IvSize > 0)
- {
- md5.Initialize();
- temp = md5.ComputeHash(this.Context.RandomCS, 0, this.Context.RandomCS.Length);
- this.Context.ClientWriteIV = new byte[this.IvSize];
- Buffer.BlockCopy(temp, 0, this.Context.ClientWriteIV, 0, this.IvSize);
-
- md5.Initialize();
- temp = md5.ComputeHash(this.Context.RandomSC, 0, this.Context.RandomSC.Length);
- this.Context.ServerWriteIV = new byte[this.IvSize];
- Buffer.BlockCopy(temp, 0, this.Context.ServerWriteIV, 0, this.IvSize);
- }
- else
- {
- this.Context.ClientWriteIV = CipherSuite.EmptyArray;
- this.Context.ServerWriteIV = CipherSuite.EmptyArray;
- }
+ this.Context.ClientWriteIV = CipherSuite.EmptyArray;
+ this.Context.ServerWriteIV = CipherSuite.EmptyArray;
}
DebugHelper.WriteLine(">>>> KeyBlock", keyBlock.ToArray());
// Send ServerCertificate message
this.protocol.SendRecord(HandshakeType.Certificate);
- // If the negotiated cipher is a KeyEx cipher send ServerKeyExchange
- if (this.context.Negotiating.Cipher.IsExportable)
- {
- this.protocol.SendRecord(HandshakeType.ServerKeyExchange);
- }
-
- // If the negotiated cipher is a KeyEx cipher or
- // the client certificate is required send the CertificateRequest message
- if (this.context.Negotiating.Cipher.IsExportable ||
- ((ServerContext)this.context).ClientCertificateRequired ||
+ // If the client certificate is required send the CertificateRequest message
+ if (((ServerContext)this.context).ClientCertificateRequired ||
((ServerContext)this.context).RequestClientCertificate)
{
this.protocol.SendRecord(HandshakeType.CertificateRequest);
this.Context.ClientWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize);
this.Context.ServerWriteKey = keyBlock.ReadBytes(this.KeyMaterialSize);
- if (!this.IsExportable)
+ if (this.IvSize != 0)
{
- if (this.IvSize != 0)
- {
- this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize);
- this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize);
- }
- else
- {
- this.Context.ClientWriteIV = CipherSuite.EmptyArray;
- this.Context.ServerWriteIV = CipherSuite.EmptyArray;
- }
+ this.Context.ClientWriteIV = keyBlock.ReadBytes(this.IvSize);
+ this.Context.ServerWriteIV = keyBlock.ReadBytes(this.IvSize);
}
else
{
- // Generate final write keys
- byte[] finalClientWriteKey = PRF(this.Context.ClientWriteKey, "client write key", this.Context.RandomCS, this.ExpandedKeyMaterialSize);
- byte[] finalServerWriteKey = PRF(this.Context.ServerWriteKey, "server write key", this.Context.RandomCS, this.ExpandedKeyMaterialSize);
-
- this.Context.ClientWriteKey = finalClientWriteKey;
- this.Context.ServerWriteKey = finalServerWriteKey;
-
- if (this.IvSize > 0)
- {
- // Generate IV block
- byte[] ivBlock = PRF(CipherSuite.EmptyArray, "IV block", this.Context.RandomCS, this.IvSize*2);
-
- // Generate IV keys
- this.Context.ClientWriteIV = new byte[this.IvSize];
- Buffer.BlockCopy(ivBlock, 0, this.Context.ClientWriteIV, 0, this.Context.ClientWriteIV.Length);
-
- this.Context.ServerWriteIV = new byte[this.IvSize];
- Buffer.BlockCopy(ivBlock, this.IvSize, this.Context.ServerWriteIV, 0, this.Context.ServerWriteIV.Length);
- }
- else
- {
- this.Context.ClientWriteIV = CipherSuite.EmptyArray;
- this.Context.ServerWriteIV = CipherSuite.EmptyArray;
- }
+ this.Context.ClientWriteIV = CipherSuite.EmptyArray;
+ this.Context.ServerWriteIV = CipherSuite.EmptyArray;
}
DebugHelper.WriteLine(">>>> KeyBlock", keyBlock.ToArray());
namespace MonoTests.System.ComponentModel.DataAnnotations
{
-#if NET_4_0
[TestFixture]
public class CustomValidationAttributeTest
{
attr.IsValid ("test");
}, "#A12");
}
+ }
class PrivateValidatorMethodContainer
{
throw new ApplicationException ("SNAFU");
}
}
- }
-#endif
}
{
public class JsonObject : JsonValue, IDictionary<string, JsonValue>, ICollection<JsonPair>
{
- Dictionary<string, JsonValue> map;
+ // Use SortedDictionary to make result of ToString() deterministic
+ SortedDictionary<string, JsonValue> map;
public JsonObject (params JsonPair [] items)
{
- map = new Dictionary<string, JsonValue> ();
+ map = new SortedDictionary<string, JsonValue> (StringComparer.Ordinal);
if (items != null)
AddRange (items);
if (items == null)
throw new ArgumentNullException ("items");
- map = new Dictionary<string, JsonValue> ();
+ map = new SortedDictionary<string, JsonValue> (StringComparer.Ordinal);
AddRange (items);
}
case JsonType.String:
if (value is string || value == null)
return (string) value;
+ if (value is char)
+ return value.ToString ();
throw new NotImplementedException ("GetFormattedString from value type " + value.GetType ());
case JsonType.Number:
string s;
throw new InvalidOperationException ();
}
+ // Characters which have to be escaped:
+ // - Required by JSON Spec: Control characters, '"' and '\\'
+ // - Broken surrogates to make sure the JSON string is valid Unicode
+ // (and can be encoded as UTF8)
+ // - JSON does not require U+2028 and U+2029 to be escaped, but
+ // JavaScript does require this:
+ // http://stackoverflow.com/questions/2965293/javascript-parse-error-on-u2028-unicode-character/9168133#9168133
+ // - '/' also does not have to be escaped, but escaping it when
+ // preceeded by a '<' avoids problems with JSON in HTML <script> tags
+ bool NeedEscape (string src, int i) {
+ char c = src [i];
+ return c < 32 || c == '"' || c == '\\'
+ // Broken lead surrogate
+ || (c >= '\uD800' && c <= '\uDBFF' &&
+ (i == src.Length - 1 || src [i + 1] < '\uDC00' || src [i + 1] > '\uDFFF'))
+ // Broken tail surrogate
+ || (c >= '\uDC00' && c <= '\uDFFF' &&
+ (i == 0 || src [i - 1] < '\uD800' || src [i - 1] > '\uDBFF'))
+ // To produce valid JavaScript
+ || c == '\u2028' || c == '\u2029'
+ // Escape "</" for <script> tags
+ || (c == '/' && i > 0 && src [i - 1] == '<');
+ }
+
internal string EscapeString (string src)
{
if (src == null)
return null;
for (int i = 0; i < src.Length; i++)
- if (src [i] == '"' || src [i] == '\\') {
+ if (NeedEscape (src, i)) {
var sb = new StringBuilder ();
if (i > 0)
sb.Append (src, 0, i);
{
int start = cur;
for (int i = cur; i < src.Length; i++)
- if (src [i] == '"' || src [i] == '\\') {
+ if (NeedEscape (src, i)) {
sb.Append (src, start, i - start);
- sb.Append ('\\');
- sb.Append (src [i]);
+ switch (src [i]) {
+ case '\b': sb.Append ("\\b"); break;
+ case '\f': sb.Append ("\\f"); break;
+ case '\n': sb.Append ("\\n"); break;
+ case '\r': sb.Append ("\\r"); break;
+ case '\t': sb.Append ("\\t"); break;
+ case '\"': sb.Append ("\\\""); break;
+ case '\\': sb.Append ("\\\\"); break;
+ case '/': sb.Append ("\\/"); break;
+ default:
+ sb.Append ("\\u");
+ sb.Append (((int) src [i]).ToString ("x04"));
+ break;
+ }
start = i + 1;
}
sb.Append (src, start, src.Length - start);
Assert.AreEqual (str, "[1, 2, 3, null]");
}
+ // Test that we correctly serialize JsonObject with null elements.
+ [Test]
+ public void ToStringOnJsonObjectWithNulls () {
+ var j = JsonValue.Load (new StringReader ("{\"a\":null,\"b\":2}"));
+ Assert.AreEqual (2, j.Count, "itemcount");
+ Assert.AreEqual (JsonType.Object, j.JsonType, "type");
+ var str = j.ToString ();
+ Assert.AreEqual (str, "{\"a\": null, \"b\": 2}");
+ }
+
+ [Test]
+ public void JsonObjectOrder () {
+ var obj = new JsonObject ();
+ obj["a"] = 1;
+ obj["c"] = 3;
+ obj["b"] = 2;
+ var str = obj.ToString ();
+ Assert.AreEqual (str, "{\"a\": 1, \"b\": 2, \"c\": 3}");
+ }
+
[Test]
public void QuoteEscapeBug_20869 ()
{
Thread.CurrentThread.CurrentCulture = old;
}
}
+
+ // Convert a string to json and parse the string, then compare the result to the original value
+ void CheckString (string str)
+ {
+ var json = new JsonPrimitive (str).ToString ();
+ // Check whether the string is valid Unicode (will throw for broken surrogate pairs)
+ new UTF8Encoding (false, true).GetBytes (json);
+ string jvalue = (string) JsonValue.Parse (json);
+ Assert.AreEqual (str, jvalue);
+ }
+
+ // String handling: http://tools.ietf.org/html/rfc7159#section-7
+ [Test]
+ public void CheckStrings ()
+ {
+ Assert.AreEqual ("\"test\"", new JsonPrimitive ("test").ToString ());
+ // Handling of characters
+ Assert.AreEqual ("\"f\"", new JsonPrimitive ('f').ToString ());
+ Assert.AreEqual ('f', (char) JsonValue.Parse ("\"f\""));
+
+ // Control characters with special escape sequence
+ Assert.AreEqual ("\"\\b\\f\\n\\r\\t\"", new JsonPrimitive ("\b\f\n\r\t").ToString ());
+ // Other characters which must be escaped
+ Assert.AreEqual (@"""\""\\""", new JsonPrimitive ("\"\\").ToString ());
+ // Control characters without special escape sequence
+ for (int i = 0; i < 32; i++)
+ if (i != '\b' && i != '\f' && i != '\n' && i != '\r' && i != '\t')
+ Assert.AreEqual ("\"\\u" + i.ToString ("x04") + "\"", new JsonPrimitive ("" + (char) i).ToString ());
+
+ // JSON does not require U+2028 and U+2029 to be escaped, but
+ // JavaScript does require this:
+ // http://stackoverflow.com/questions/2965293/javascript-parse-error-on-u2028-unicode-character/9168133#9168133
+ Assert.AreEqual ("\"\\u2028\\u2029\"", new JsonPrimitive ("\u2028\u2029").ToString ());
+
+ // '/' also does not have to be escaped, but escaping it when
+ // preceeded by a '<' avoids problems with JSON in HTML <script> tags
+ Assert.AreEqual ("\"<\\/\"", new JsonPrimitive ("</").ToString ());
+ // Don't escape '/' in other cases as this makes the JSON hard to read
+ Assert.AreEqual ("\"/bar\"", new JsonPrimitive ("/bar").ToString ());
+ Assert.AreEqual ("\"foo/bar\"", new JsonPrimitive ("foo/bar").ToString ());
+
+ CheckString ("test\b\f\n\r\t\"\\/</\0x");
+ for (int i = 0; i < 65536; i++)
+ CheckString ("x" + ((char) i));
+
+ // Check broken surrogate pairs
+ CheckString ("\ud800");
+ CheckString ("x\ud800");
+ CheckString ("\udfff\ud800");
+ CheckString ("\ude03\ud912");
+ CheckString ("\uc000\ubfff");
+ CheckString ("\udfffx");
+ // Valid strings should not be escaped:
+ Assert.AreEqual ("\"\ud7ff\"", new JsonPrimitive ("\ud7ff").ToString ());
+ Assert.AreEqual ("\"\ue000\"", new JsonPrimitive ("\ue000").ToString ());
+ Assert.AreEqual ("\"\ud800\udc00\"", new JsonPrimitive ("\ud800\udc00").ToString ());
+ Assert.AreEqual ("\"\ud912\ude03\"", new JsonPrimitive ("\ud912\ude03").ToString ());
+ Assert.AreEqual ("\"\udbff\udfff\"", new JsonPrimitive ("\udbff\udfff").ToString ());
+ }
}
}
{
var sb = new StringBuilder ();
- bool negative = false;
if (PeekChar () == '-') {
- negative = true;
sb.Append ((char) ReadChar ());
}
for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
if (!reader.IsStartElement ("item"))
throw SerializationError (String.Format ("Expected element 'item', but found '{0}' in namespace '{1}'", reader.LocalName, reader.NamespaceURI));
- Type et = elementType == typeof (object) || elementType.IsAbstract ? null : elementType;
- object elem = ReadObject (et ?? typeof (object));
+ object elem = ReadObject (elementType);
c.Add (elem);
}
#if NET_2_1
void WriteObject (XmlObjectSerializer serializer, XmlDictionaryWriter writer, object value)
{
+ if (serializer != null){
#if NET_2_1
if (serializer is DataContractJsonSerializer)
((DataContractJsonSerializer) serializer).WriteObject (writer, value);
#else
serializer.WriteObject (writer, value);
#endif
+ }
}
}
using System.ServiceModel.Web;\r
using System.ServiceModel.Description;\r
using System.ServiceModel.Dispatcher;\r
+using System.Net;\r
\r
namespace MonoTests.System.ServiceModel.Web\r
{\r
}\r
}\r
\r
+ [Test]\r
+ public void Connect ()\r
+ {\r
+ var host = new WebServiceHost (typeof (DemoService), new Uri\r
+ ("http://localhost:30158/"));\r
+ try {\r
+ host.Open ();\r
+ var wc = new WebClient();\r
+ wc.DownloadString("http://localhost:30158/testData");\r
+ Console.WriteLine();\r
+ } finally {\r
+ host.Close();\r
+ }\r
+ }\r
+ \r
+ [ServiceContract]\r
+ interface IDemoService {\r
+ [OperationContract]\r
+ [WebInvoke(UriTemplate = "/{testData}",\r
+ Method = "GET",\r
+ RequestFormat = WebMessageFormat.Json,\r
+ ResponseFormat = WebMessageFormat.Json)]\r
+ void UpdateAttribute(string testData);\r
+ }\r
+\r
+ public class DemoService : IDemoService {\r
+ public void UpdateAttribute(string testData)\r
+ {\r
+ Console.WriteLine ("got it: "+testData);\r
+ }\r
+ }\r
}\r
}\r
#endif\r
}
[Test]
+ [Ignore ("This test is flaky: https://bugzilla.xamarin.com/show_bug.cgi?id=27757")]
public void FaultExecutingConsume ()
{
var evt = new ManualResetEventSlim ();
/*colon CO*/ {CO,CO,__,__,__,__,CA,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__},
/*value VA*/ {VA,VA,OS,__,AB,__,__,__,SB,__,__,PX,MX,__,ZX,IX,__,__,__,__,__,FA,__,NU,__,__,TR,__,__,__,__,__,I1,__,__,V1},
/*array AR*/ {AR,AR,OS,__,AB,AE,__,__,SB,__,__,PX,MX,__,ZX,IX,__,__,__,__,__,FA,__,NU,__,__,TR,__,__,__,__,__,I1,__,__,V1},
- /*string ST*/ {ST,__,ST,ST,ST,ST,ST,ST,SE,EX,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST},
+ /*string ST*/ {ST,ST,ST,ST,ST,ST,ST,ST,SE,EX,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST,ST},
/*escape ES*/ {__,__,__,__,__,__,__,__,ST,ST,ST,__,__,__,__,__,__,ST,__,__,__,ST,__,ST,ST,__,ST,U1,__,__,__,__,__,__,__,__},
/*u1 U1*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U2,U2,U2,U2,U2,U2,U2,U2,__,__,__,__,__,__,U2,U2,__,__,__,__,__,__},
/*u2 U2*/ {__,__,__,__,__,__,__,__,__,__,__,__,__,__,U3,U3,U3,U3,U3,U3,U3,U3,__,__,__,__,__,__,U3,U3,__,__,__,__,__,__},
Assert.AreEqual (kv.Value, obj.Value);
}
}
+
+ [Test]
+ public void DeserializeStringWithNewline ()
+ {
+ JavaScriptSerializer serializer = new JavaScriptSerializer ();
+ string json_with_newline = @"
+ [
+ {
+ content:""
+<div id=\""calendar\""><div>
+ ""
+ }
+ ]
+ ";
+ serializer.DeserializeObject (json_with_newline);
+ }
}
}
private string fileName;
private Stream stream;
private TextReader reader;
- private Hashtable hasht;
+ private OrderedDictionary hasht;
private ITypeResolutionService typeresolver;
private XmlTextReader xmlReader;
private string basepath;
private bool useResXDataNodes;
private AssemblyName [] assemblyNames;
- private Hashtable hashtm;
+ private OrderedDictionary hashtm;
#endregion // Local Variables
#region Constructors & Destructor
#region Private Methods
private void LoadData ()
{
- hasht = new Hashtable ();
- hashtm = new Hashtable ();
+ hasht = new OrderedDictionary ();
+ hashtm = new OrderedDictionary ();
if (fileName != null) {
stream = File.OpenRead (fileName);
}
private void ParseDataNode (bool meta)
{
- Hashtable hashtable = ((meta && ! useResXDataNodes) ? hashtm : hasht);
+ OrderedDictionary hashtable = ((meta && ! useResXDataNodes) ? hashtm : hasht);
Point pos = new Point (xmlReader.LineNumber, xmlReader.LinePosition);
string name = GetAttribute ("name");
string type_name = GetAttribute ("type");
}
}
+ [Test]
+ public void EnumeratorOrderSameAsResx ()
+ {
+ string resXContent = string.Format (CultureInfo.CurrentCulture,
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
+ "<root>" +
+ " <resheader name=\"resmimetype\">" +
+ " <value>{0}</value>" +
+ " </resheader>" +
+ " <resheader name=\"reader\">" +
+ " <value>System.Resources.ResXResourceReader, {1}</value>" +
+ " </resheader>" +
+ " <resheader name=\"writer\">" +
+ " <value>System.Resources.ResXResourceWriter, {1}</value>" +
+ " </resheader>" +
+ " <data name=\"name2\">" +
+ " <value> value5 </value>" +
+ " </data>" +
+ " <data name=\"name1\">" +
+ " <value> value4 </value>" +
+ " </data>" +
+ " <data name=\"aaa\">" +
+ " <value> value3 </value>" +
+ " </data>" +
+ " <data name=\"zzzz\">" +
+ " <value> value2 </value>" +
+ " </data>" +
+ " <data name=\"bbbbbb\">" +
+ " <value> value1 </value>" +
+ " </data>" +
+ "</root>",
+ ResXResourceWriter.ResMimeType, Consts.AssemblySystem_Windows_Forms);
+
+ using (StringReader sr = new StringReader (resXContent)) {
+ using (ResXResourceReader r = new ResXResourceReader (sr)) {
+
+ IDictionaryEnumerator enumerator = r.GetEnumerator ();
+ enumerator.MoveNext ();
+ Assert.AreEqual ("name2", enumerator.Key, "#1");
+ enumerator.MoveNext ();
+ Assert.AreEqual ("name1", enumerator.Key, "#2");
+ enumerator.MoveNext ();
+ Assert.AreEqual ("aaa", enumerator.Key, "#3");
+ enumerator.MoveNext ();
+ Assert.AreEqual ("zzzz", enumerator.Key, "#4");
+ enumerator.MoveNext ();
+ Assert.AreEqual ("bbbbbb", enumerator.Key, "#5");
+ }
+ }
+ }
+
[Test]
public void UseResXDataNodes ()
{
else
{
if (memberValue == null)
- return (XmlTypeMapElementInfo) _elementInfo[0];
- foreach (XmlTypeMapElementInfo elem in _elementInfo)
- if (elem.TypeData.Type.IsInstanceOfType (memberValue)) return elem;
+ return (XmlTypeMapElementInfo) _elementInfo [0];
+ else
+ {
+ XmlTypeMapElementInfo bestTypeElem = null;
+ // Select the most-specific type for the given memberValue
+ foreach (XmlTypeMapElementInfo elem in _elementInfo)
+ {
+ if (elem.TypeData.Type.IsInstanceOfType (memberValue))
+ {
+ if (bestTypeElem == null || elem.TypeData.Type.IsSubclassOf (bestTypeElem.TypeData.Type))
+ {
+ bestTypeElem = elem;
+ }
+ }
+ }
+ return bestTypeElem;
+ }
}
return null;
}
#endregion //GenericsSeralizationTests
+ #region XmlInclude on abstract class tests (Bug #18558)
+ [Test]
+ public void TestSerializeIntermediateType ()
+ {
+ string expectedXml = "<ContainerTypeForTest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><XmlIntermediateType intermediate=\"false\"/></ContainerTypeForTest>";
+ var obj = new ContainerTypeForTest();
+ obj.MemberToUseInclude = new IntermediateTypeForTest ();
+ Serialize (obj);
+ Assert.AreEqual (Infoset (expectedXml), WriterText, "Serialized Output : " + WriterText);
+ }
+ [Test]
+ public void TestSerializeSecondType ()
+ {
+ string expectedXml = "<ContainerTypeForTest xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><XmlSecondType intermediate=\"false\"/></ContainerTypeForTest>";
+ var obj = new ContainerTypeForTest();
+ obj.MemberToUseInclude = new SecondDerivedTypeForTest ();
+ Serialize (obj);
+ Assert.AreEqual (Infoset (expectedXml), WriterText, "Serialized Output : " + WriterText);
+ }
+ #endregion
public class XmlArrayOnInt
{
[XmlArray]
generatorFallback.SetValue (null, generatorFallbackOld);
}
}
+
+#region XmlInclude on abstract class test classes
+
+ [XmlType]
+ public class ContainerTypeForTest
+ {
+ [XmlElement ("XmlFirstType", typeof (FirstDerivedTypeForTest))]
+ [XmlElement ("XmlIntermediateType", typeof (IntermediateTypeForTest))]
+ [XmlElement ("XmlSecondType", typeof (SecondDerivedTypeForTest))]
+ public AbstractTypeForTest MemberToUseInclude { get; set; }
+ }
+
+ [XmlInclude (typeof (FirstDerivedTypeForTest))]
+ [XmlInclude (typeof (IntermediateTypeForTest))]
+ [XmlInclude (typeof (SecondDerivedTypeForTest))]
+ public abstract class AbstractTypeForTest
+ {
+ }
+
+ public class IntermediateTypeForTest : AbstractTypeForTest
+ {
+ [XmlAttribute (AttributeName = "intermediate")]
+ public bool IntermediateMember { get; set; }
+ }
+
+ public class FirstDerivedTypeForTest : AbstractTypeForTest
+ {
+ public string FirstMember { get; set; }
+ }
+
+ public class SecondDerivedTypeForTest : IntermediateTypeForTest
+ {
+ public string SecondMember { get; set; }
+ }
+#endregion
+
}
<h2>Performance Considerations</h2>
</format>
<para>If you use a Web.config file that contains URIs to initialize your application, additional time is required to process the URIs if their scheme identifiers are nonstandard. In such a case, initialize the affected parts of your application when the URIs are needed, not at start time.</para>
+ <para>Starting with Mono 3.10, Mono adopted the International Resource Identifier ("IRI") for parsing urls, just like .NET 4.5 does (https://msdn.microsoft.com/en-us/library/bb968786%28v=vs.110%29.aspx).</para>
+ <para>It is possible to disable IRI-based parsing by setting the MONO_URI_IRIPARSING environment variable to the string "false"</para>
+ <para>To help compatibility with third party software that disabled this behavior, we used the same internal field to turn this feature on or off by poking at the Uri internals.</para>
+ <example>
+ <code lang="c#">
+FieldInfo iriParsingField = typeof (Uri).GetField ("s_IriParsing",
+ BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic);
+if (iriParsingField != null)
+ iriParsingField.SetValue (null, false);
+ </code>
+ </example>
</remarks>
<summary>
<attribution license="cc4" from="Microsoft" modified="false" />
if (fd.ToInt64 () == -1)
return false;
- nl_sock = new Socket (0, SocketType.Raw, ProtocolType.Udp, fd);
+ var safeHandle = new SafeSocketHandle (fd, true);
+
+ nl_sock = new Socket (0, SocketType.Raw, ProtocolType.Udp, safeHandle);
nl_args = new SocketAsyncEventArgs ();
nl_args.SetBuffer (new byte [8192], 0, 8192);
nl_args.Completed += OnDataAvailable;
--- /dev/null
+//
+// System.Net.Sockets.SafeSocketHandle
+//
+// Authors:
+// Marcos Henrich <marcos.henrich@xamarin.com>
+//
+
+using System;
+using System.IO;
+using System.Threading;
+using System.Collections.Generic;
+using Microsoft.Win32.SafeHandles;
+
+namespace System.Net.Sockets {
+
+ sealed class SafeSocketHandle : SafeHandleZeroOrMinusOneIsInvalid {
+
+ List<Thread> blocking_threads;
+
+ const int ABORT_RETRIES = 10;
+ static bool THROW_ON_ABORT_RETRIES = Environment.GetEnvironmentVariable("MONO_TESTS_IN_PROGRESS") == "yes";
+
+ public SafeSocketHandle (IntPtr preexistingHandle, bool ownsHandle) : base (ownsHandle)
+ {
+ SetHandle (preexistingHandle);
+ }
+
+ // This is just for marshalling
+ internal SafeSocketHandle () : base (true)
+ {
+ }
+
+ bool closii;
+
+ /*protected override void Dispose (bool disposing)
+ {
+ lock (this) {
+ if (!closii) {
+
+ closii = true;
+ int error = 0;
+ Socket.Blocking_internal (handle, false, out error);
+ //AbortRegisteredThreads ();
+ Socket.Close_internal (handle, out error);
+ //Console.Error.WriteLine ("Closed "+ handle);
+ }
+ }
+ base.Dispose (disposing);
+ }*/
+
+ protected override bool ReleaseHandle ()
+ {
+ int error = 0;
+
+ Socket.Blocking_internal (handle, false, out error);
+
+ if (blocking_threads != null) {
+ int abort_attempts = 0;
+ while (blocking_threads.Count > 0) {
+ if (abort_attempts++ >= ABORT_RETRIES) {
+ if (THROW_ON_ABORT_RETRIES)
+ throw new Exception ("Could not abort registered blocking threads before closing socket.");
+
+ // Attempts to close the socket safely failed.
+ // We give up, and close the socket with pending blocking system calls.
+ // This should not occur, nonetheless if it does this avoids an endless loop.
+ break;
+ }
+
+ AbortRegisteredThreads ();
+ // Sleep so other threads can resume
+ Thread.Sleep (1);
+ }
+ }
+
+ Socket.Close_internal (handle, out error);
+
+ return error == 0;
+ }
+
+ public void RegisterForBlockingSyscall ()
+ {
+ if (blocking_threads == null)
+ Interlocked.CompareExchange (ref blocking_threads, new List<Thread> (), null);
+
+ bool release = false;
+ try {
+ DangerousAddRef (ref release);
+ } finally {
+ /* We must use a finally block here to make this atomic. */
+ lock (blocking_threads) {
+ blocking_threads.Add (Thread.CurrentThread);
+ }
+ if (release)
+ DangerousRelease ();
+ }
+ }
+
+ /* This must be called from a finally block! */
+ public void UnRegisterForBlockingSyscall ()
+ {
+ //If this NRE, we're in deep problems because Register Must have
+ lock (blocking_threads) {
+ blocking_threads.Remove (Thread.CurrentThread);
+ }
+ }
+
+ void AbortRegisteredThreads () {
+ if (blocking_threads == null)
+ return;
+
+ lock (blocking_threads) {
+ foreach (var t in blocking_threads)
+ Socket.cancel_blocking_socket_operation (t);
+ }
+ }
+ }
+}
+
// private constructor used by Accept, which already
// has a socket handle to use
internal Socket(AddressFamily family, SocketType type,
- ProtocolType proto, IntPtr sock)
+ ProtocolType proto, SafeSocketHandle sock)
{
address_family=family;
socket_type=type;
socket_type = (SocketType) (int) result [1];
protocol_type = (ProtocolType) (int) result [2];
isbound = (ProtocolType) (int) result [3] != 0;
- socket = (IntPtr) (long) result [4];
+ socket = new SafeSocketHandle ((IntPtr) (long) result [4], true);
SocketDefaults ();
}
#endif
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int Available_internal(IntPtr socket, out int error);
+ private static int Available_internal (SafeSocketHandle safeHandle, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ return Available_internal (safeHandle.DangerousGetHandle (), out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public int Available {
get {
if (disposed && closed)
public IntPtr Handle {
get {
- return(socket);
+ return(socket.DangerousGetHandle ());
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static SocketAddress LocalEndPoint_internal(IntPtr socket, int family, out int error);
+ private static SocketAddress LocalEndPoint_internal(SafeSocketHandle safeHandle, int family, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ return LocalEndPoint_internal (safeHandle.DangerousGetHandle (), family, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
// Wish: support non-IP endpoints.
public EndPoint LocalEndPoint {
get {
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static IntPtr Accept_internal(IntPtr sock, out int error, bool blocking);
+ private static SafeSocketHandle Accept_internal(SafeSocketHandle safeHandle, out int error, bool blocking)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ var ret = Accept_internal (safeHandle.DangerousGetHandle (), out error, blocking);
+ return new SafeSocketHandle (ret, true);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
public Socket Accept() {
if (disposed && closed)
throw new ObjectDisposedException (GetType ().ToString ());
int error = 0;
- IntPtr sock = (IntPtr) (-1);
- try {
- RegisterForBlockingSyscall ();
- sock = Accept_internal(socket, out error, blocking);
- } finally {
- UnRegisterForBlockingSyscall ();
- }
+ var sock = Accept_internal(socket, out error, blocking);
if (error != 0) {
if (closed)
throw new ObjectDisposedException (GetType ().ToString ());
int error = 0;
- IntPtr sock = (IntPtr)(-1);
-
- try {
- RegisterForBlockingSyscall ();
- sock = Accept_internal (socket, out error, blocking);
- } finally {
- UnRegisterForBlockingSyscall ();
- }
+ var sock = Accept_internal (socket, out error, blocking);
if (error != 0) {
if (closed)
SocketAddress sa,
out int error);
+ private static void Bind_internal (SafeSocketHandle safeHandle,
+ SocketAddress sa,
+ out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ Bind_internal (safeHandle.DangerousGetHandle (), sa, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public void Bind(EndPoint local_end) {
if (disposed && closed)
throw new ObjectDisposedException (GetType ().ToString ());
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static void Disconnect_internal(IntPtr sock, bool reuse, out int error);
+ private static void Disconnect_internal(SafeSocketHandle safeHandle, bool reuse, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ Disconnect_internal (safeHandle.DangerousGetHandle (), reuse, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
/* According to the docs, the MS runtime will throw
* PlatformNotSupportedException if the platform is
* newer than w2k. We should be able to cope...
(blocking ? 0 : SocketInformationOptions.NonBlocking) |
(useoverlappedIO ? SocketInformationOptions.UseOnlyOverlappedIO : 0);
- si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)address_family, (int)socket_type, (int)protocol_type, isbound ? 1 : 0, (long)socket);
- socket = (IntPtr) (-1);
+ si.ProtocolInformation = Mono.DataConverter.Pack ("iiiil", (int)address_family, (int)socket_type, (int)protocol_type, isbound ? 1 : 0, (long)Handle);
+ socket = null;
return si;
}
SocketOptionLevel level, SocketOptionName name, ref byte[] byte_val,
out int error);
+ private static void GetSocketOption_arr_internal (SafeSocketHandle safeHandle,
+ SocketOptionLevel level, SocketOptionName name, ref byte[] byte_val,
+ out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ GetSocketOption_arr_internal (safeHandle.DangerousGetHandle (), level, name, ref byte_val, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public void GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, byte [] optionValue)
{
if (disposed && closed)
extern static int WSAIoctl (IntPtr sock, int ioctl_code, byte [] input,
byte [] output, out int error);
+ private static int WSAIoctl (SafeSocketHandle safeHandle, int ioctl_code, byte [] input,
+ byte [] output, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ return WSAIoctl (safeHandle.DangerousGetHandle (), ioctl_code, input, output, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public int IOControl (int ioctl_code, byte [] in_value, byte [] out_value)
{
if (disposed)
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static void Listen_internal(IntPtr sock, int backlog, out int error);
+ private static void Listen_internal (SafeSocketHandle safeHandle, int backlog, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ Listen_internal (safeHandle.DangerousGetHandle (), backlog, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public void Listen (int backlog)
{
if (disposed && closed)
ref SocketAddress sockaddr,
out int error);
+ private static int RecvFrom_internal (SafeSocketHandle safeHandle,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ ref SocketAddress sockaddr,
+ out int error)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ return RecvFrom_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, ref sockaddr, out error);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags flags,
ref EndPoint remoteEP)
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static bool SendFile (IntPtr sock, string filename, byte [] pre_buffer, byte [] post_buffer, TransmitFileOptions flags);
+ private static bool SendFile (SafeSocketHandle safeHandle, string filename, byte [] pre_buffer, byte [] post_buffer, TransmitFileOptions flags)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ return SendFile (safeHandle.DangerousGetHandle (), filename, pre_buffer, post_buffer, flags);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
public void SendFile (string fileName)
{
if (disposed && closed)
SocketAddress sa,
out int error);
+ private static int SendTo_internal (SafeSocketHandle safeHandle,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ SocketAddress sa,
+ out int error)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ return SendTo_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, sa, out error);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
public int SendTo (byte [] buffer, int offset, int size, SocketFlags flags,
EndPoint remote_end)
{
SocketError = SocketError.OperationAborted;
} finally {
if (AcceptSocket == null)
- AcceptSocket = new Socket (curSocket.AddressFamily, curSocket.SocketType, curSocket.ProtocolType, (IntPtr)(-1));
+ AcceptSocket = new Socket (curSocket.AddressFamily, curSocket.SocketType, curSocket.ProtocolType, null);
OnCompleted (this);
}
}
this.Sock = sock;
if (sock != null) {
this.blocking = sock.blocking;
- this.handle = sock.socket;
+ this.handle = sock.Handle;
} else {
this.blocking = true;
this.handle = IntPtr.Zero;
{
this.Sock = sock;
this.blocking = sock.blocking;
- this.handle = sock.socket;
+ this.handle = sock.Handle;
this.state = state;
this.callback = callback;
GC.KeepAlive (this.callback);
#endif
/* the field "socket" is looked up by name by the runtime */
- private IntPtr socket;
+ private SafeSocketHandle socket;
private AddressFamily address_family;
private SocketType socket_type;
private ProtocolType protocol_type;
internal bool blocking=true;
- List<Thread> blocking_threads;
private bool isbound;
/* When true, the socket was connected at the time of
* the last IO operation
*/
internal EndPoint seed_endpoint = null;
- void RegisterForBlockingSyscall ()
- {
- while (blocking_threads == null) {
- //In the rare event this CAS fail, there's a good chance other thread won, so we're kosher.
- //In the VERY rare event of all CAS fail together, we pay the full price of of failure.
- Interlocked.CompareExchange (ref blocking_threads, new List<Thread> (), null);
- }
-
- try {
-
- } finally {
- /* We must use a finally block here to make this atomic. */
- lock (blocking_threads) {
- blocking_threads.Add (Thread.CurrentThread);
- }
- }
- }
-
- /* This must be called from a finally block! */
- void UnRegisterForBlockingSyscall ()
- {
- //If this NRE, we're in deep problems because Register Must have
- lock (blocking_threads) {
- blocking_threads.Remove (Thread.CurrentThread);
- }
- }
-
- void AbortRegisteredThreads () {
- if (blocking_threads == null)
- return;
-
- lock (blocking_threads) {
- foreach (var t in blocking_threads)
- cancel_blocking_socket_operation (t);
- blocking_threads.Clear ();
- }
- }
-
// Creates a new system socket, returning the handle
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern IntPtr Socket_internal(AddressFamily family,
int error;
- socket = Socket_internal (addressFamily, socketType, protocolType, out error);
+ var handle = Socket_internal (addressFamily, socketType, protocolType, out error);
+ socket = new SafeSocketHandle (handle, true);
+
if (error != 0)
throw new SocketException (error);
#if !NET_2_1 || MOBILE
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void Blocking_internal(IntPtr socket,
+ internal extern static void Blocking_internal(IntPtr socket,
bool block,
out int error);
+ private static void Blocking_internal (SafeSocketHandle safeHandle,
+ bool block,
+ out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ Blocking_internal (safeHandle.DangerousGetHandle (), block, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public bool Blocking {
get {
return(blocking);
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static SocketAddress RemoteEndPoint_internal(IntPtr socket, int family, out int error);
+ private static SocketAddress RemoteEndPoint_internal (SafeSocketHandle safeHandle, int family, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ return RemoteEndPoint_internal (safeHandle.DangerousGetHandle (), family, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public EndPoint RemoteEndPoint {
get {
if (disposed && closed)
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- static extern void cancel_blocking_socket_operation (Thread thread);
+ internal static extern void cancel_blocking_socket_operation (Thread thread);
protected virtual void Dispose (bool disposing)
{
disposed = true;
bool was_connected = connected;
connected = false;
- if ((int) socket != -1) {
- int error;
+
+ if (socket != null) {
closed = true;
- IntPtr x = socket;
- socket = (IntPtr) (-1);
-
- AbortRegisteredThreads ();
+ IntPtr x = Handle;
if (was_connected)
Linger (x);
- //DateTime start = DateTime.UtcNow;
- Close_internal (x, out error);
- //Console.WriteLine ("Time spent in Close_internal: {0}ms", (DateTime.UtcNow - start).TotalMilliseconds);
- if (error != 0)
- throw new SocketException (error);
+
+ socket.Dispose ();
}
}
// Closes the socket
[MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern static void Close_internal(IntPtr socket, out int error);
+ internal extern static void Close_internal(IntPtr socket, out int error);
public void Close ()
{
private extern static void Connect_internal(IntPtr sock,
SocketAddress sa,
out int error);
+
+ private static void Connect_internal (SafeSocketHandle safeHandle,
+ SocketAddress sa,
+ out int error)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ Connect_internal (safeHandle.DangerousGetHandle (), sa, out error);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
public void Connect (EndPoint remoteEP)
{
int error = 0;
- try {
- RegisterForBlockingSyscall ();
- Connect_internal (socket, serial, out error);
- } finally {
- UnRegisterForBlockingSyscall ();
- }
+ Connect_internal (socket, serial, out error);
if (error == 0 || error == 10035)
seed_endpoint = remoteEP; // Keep the ep around for non-blocking sockets
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static bool Poll_internal (IntPtr socket, SelectMode mode, int timeout, out int error);
+ private static bool Poll_internal (SafeSocketHandle safeHandle, SelectMode mode, int timeout, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ return Poll_internal (safeHandle.DangerousGetHandle (), mode, timeout, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int Receive_internal(IntPtr sock,
byte[] buffer,
SocketFlags flags,
out int error);
+ private static int Receive_internal (SafeSocketHandle safeHandle,
+ byte[] buffer,
+ int offset,
+ int count,
+ SocketFlags flags,
+ out int error)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ return Receive_internal (safeHandle.DangerousGetHandle (), buffer, offset, count, flags, out error);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
internal int Receive_nochecks (byte [] buf, int offset, int size, SocketFlags flags, out SocketError error)
{
int nativeError;
SocketOptionLevel level, SocketOptionName name, out object obj_val,
out int error);
+ private static void GetSocketOption_obj_internal (SafeSocketHandle safeHandle,
+ SocketOptionLevel level, SocketOptionName name, out object obj_val,
+ out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ GetSocketOption_obj_internal (safeHandle.DangerousGetHandle (), level, name, out obj_val, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern static int Send_internal(IntPtr sock,
byte[] buf, int offset,
SocketFlags flags,
out int error);
+ private static int Send_internal (SafeSocketHandle safeHandle,
+ byte[] buf, int offset,
+ int count,
+ SocketFlags flags,
+ out int error)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ return Send_internal (safeHandle.DangerousGetHandle (), buf, offset, count, flags, out error);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
internal int Send_nochecks (byte [] buf, int offset, int size, SocketFlags flags, out SocketError error)
{
if (size == 0) {
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static void Shutdown_internal (IntPtr socket, SocketShutdown how, out int error);
+ private static void Shutdown_internal (SafeSocketHandle safeHandle, SocketShutdown how, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ Shutdown_internal (safeHandle.DangerousGetHandle (), how, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public void Shutdown (SocketShutdown how)
{
if (disposed && closed)
byte [] byte_val, int int_val,
out int error);
+ private static void SetSocketOption_internal (SafeSocketHandle safeHandle, SocketOptionLevel level,
+ SocketOptionName name, object obj_val,
+ byte [] byte_val, int int_val,
+ out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ SetSocketOption_internal (safeHandle.DangerousGetHandle (), level, name, obj_val, byte_val, int_val, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public void SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int optionValue)
{
if (disposed && closed)
// Calling connect() again will reset the connection attempt and cause
// an error. Better to just close the socket and move on.
connect_in_progress = false;
- Close_internal (socket, out error);
- socket = Socket_internal (address_family, socket_type, protocol_type, out error);
+ socket.Dispose ();
+ var handle = Socket_internal (address_family, socket_type, protocol_type, out error);
+ socket = new SafeSocketHandle (handle, true);
if (error != 0)
throw new SocketException (error);
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int Receive_internal (IntPtr sock, WSABUF[] bufarray, SocketFlags flags, out int error);
+
+ private static int Receive_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error)
+ {
+ try {
+ safeHandle.RegisterForBlockingSyscall ();
+ return Receive_internal (safeHandle.DangerousGetHandle (), bufarray, flags, out error);
+ } finally {
+ safeHandle.UnRegisterForBlockingSyscall ();
+ }
+ }
+
public
int Receive (IList<ArraySegment<byte>> buffers)
{
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static int Send_internal (IntPtr sock, WSABUF[] bufarray, SocketFlags flags, out int error);
+
+ private static int Send_internal (SafeSocketHandle safeHandle, WSABUF[] bufarray, SocketFlags flags, out int error)
+ {
+ bool release = false;
+ try {
+ safeHandle.DangerousAddRef (ref release);
+ return Send_internal (safeHandle.DangerousGetHandle (), bufarray, flags, out error);
+ } finally {
+ if (release)
+ safeHandle.DangerousRelease ();
+ }
+ }
+
public
int Send (IList<ArraySegment<byte>> buffers)
{
string path;
Uri raw_uri = null;
- if (Uri.MaybeUri (raw_url) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
+ if (Uri.MaybeUri (raw_url.ToLowerInvariant ()) && Uri.TryCreate (raw_url, UriKind.Absolute, out raw_uri))
path = raw_uri.PathAndQuery;
else
path = raw_url;
WebConnectionGroup cncGroup = GetConnectionGroup (connectionGroupName);
if (cncGroup != null) {
cncGroup.Close ();
+ RemoveConnectionGroup (cncGroup);
return true;
}
}
int size;
public bool EndCalled;
public bool AsyncWriteAll;
+ public HttpWebRequest AsyncObject;
public WebAsyncResult (AsyncCallback cb, object state)
: base (cb, state)
public WebAsyncResult (HttpWebRequest request, AsyncCallback cb, object state)
: base (cb, state)
{
+ this.AsyncObject = request;
}
public WebAsyncResult (AsyncCallback cb, object state, byte [] buffer, int offset, int size)
System.Net.Sockets/NetworkStream.cs
System.Net.Sockets/ProtocolFamily.cs
System.Net.Sockets/ProtocolType.cs
+System.Net.Sockets/SafeSocketHandle.cs
System.Net.Sockets/SelectMode.cs
System.Net.Sockets/SendPacketsElement.cs
System.Net.Sockets/Socket.cs
IPAddressCollection dnsAddresses = adapterProperties.DnsAddresses;
numDnsAddresses += dnsAddresses.Count;
}
+ // reading /etc/resolve.conf does not work on iOS devices (but works on simulator)
+ // ref: https://bugzilla.xamarin.com/show_bug.cgi?id=27707
+#if !MONOTOUCH
Assert.IsTrue (numDnsAddresses > 0);
+#endif
}
}
System.Net.Sockets/NetworkStream.cs
System.Net.Sockets/ProtocolFamily.cs
System.Net.Sockets/ProtocolType.cs
+System.Net.Sockets/SafeSocketHandle.cs
System.Net.Sockets/SelectMode.cs
System.Net.Sockets/SendPacketsElement.cs
System.Net.Sockets/Socket.cs
isWritable = writable;
}
+ static internal bool IsEquals (RegistryKey a, RegistryKey b)
+ {
+ return a.hive == b.hive && a.handle == b.handle && a.qname == b.qname && a.isRemoteRoot == b.isRemoteRoot && a.isWritable == b.isWritable;
+ }
+
#region PublicAPI
/// <summary>
Close ();
}
-
- /// <summary>
- /// Final cleanup of registry key object. Close the
- /// key if it's still open.
- /// </summary>
- ~RegistryKey ()
- {
- Close ();
- }
-
-
/// <summary>
/// Get the fully qualified registry key name.
/// </summary>
}
}
+ class RegistryKeyComparer : IEqualityComparer {
+ public new bool Equals(object x, object y)
+ {
+ return RegistryKey.IsEquals ((RegistryKey) x, (RegistryKey) y);
+
+ }
+
+ public int GetHashCode(object obj)
+ {
+ var n = ((RegistryKey) obj).Name;
+ if (n == null)
+ return 0;
+ return n.GetHashCode ();
+ }
+ }
+
class KeyHandler
{
- static Hashtable key_to_handler = new Hashtable ();
+ static Hashtable key_to_handler = new Hashtable (new RegistryKeyComparer ());
static Hashtable dir_to_handler = new Hashtable (
new CaseInsensitiveHashCodeProvider (), new CaseInsensitiveComparer ());
const string VolatileDirectoryName = "volatile-keys";
{
if (name == null)
return RegistryValueKind.Unknown;
- object value = values [name];
+ object value;
+
+ lock (values)
+ value = values [name];
+
if (value == null)
return RegistryValueKind.Unknown;
if (name == null)
name = string.Empty;
- object value = values [name];
+ object value;
+ lock (values)
+ value = values [name];
ExpandString exp = value as ExpandString;
if (exp == null)
return value;
if (name == null)
name = string.Empty;
- // immediately convert non-native registry values to string to avoid
- // returning it unmodified in calls to UnixRegistryApi.GetValue
- if (value is int || value is string || value is byte[] || value is string[])
- values[name] = value;
- else
- values[name] = value.ToString ();
+ lock (values){
+ // immediately convert non-native registry values to string to avoid
+ // returning it unmodified in calls to UnixRegistryApi.GetValue
+ if (value is int || value is string || value is byte[] || value is string[])
+ values[name] = value;
+ else
+ values[name] = value.ToString ();
+ }
SetDirty ();
}
{
AssertNotMarkedForDeletion ();
- ICollection keys = values.Keys;
-
- string [] vals = new string [keys.Count];
- keys.CopyTo (vals, 0);
- return vals;
+ lock (values){
+ ICollection keys = values.Keys;
+
+ string [] vals = new string [keys.Count];
+ keys.CopyTo (vals, 0);
+ return vals;
+ }
}
public int GetSubKeyCount ()
if (name == null)
name = string.Empty;
- switch (valueKind){
- case RegistryValueKind.String:
- if (value is string){
- values [name] = value;
- return;
- }
- break;
- case RegistryValueKind.ExpandString:
- if (value is string){
- values [name] = new ExpandString ((string)value);
- return;
- }
- break;
-
- case RegistryValueKind.Binary:
- if (value is byte []){
- values [name] = value;
- return;
- }
- break;
-
- case RegistryValueKind.DWord:
- try {
- values [name] = Convert.ToInt32 (value);
- return;
- } catch (OverflowException) {
+ lock (values){
+ switch (valueKind){
+ case RegistryValueKind.String:
+ if (value is string){
+ values [name] = value;
+ return;
+ }
break;
- }
-
- case RegistryValueKind.MultiString:
- if (value is string []){
- values [name] = value;
- return;
- }
- break;
-
- case RegistryValueKind.QWord:
- try {
- values [name] = Convert.ToInt64 (value);
- return;
- } catch (OverflowException) {
+ case RegistryValueKind.ExpandString:
+ if (value is string){
+ values [name] = new ExpandString ((string)value);
+ return;
+ }
+ break;
+
+ case RegistryValueKind.Binary:
+ if (value is byte []){
+ values [name] = value;
+ return;
+ }
+ break;
+
+ case RegistryValueKind.DWord:
+ try {
+ values [name] = Convert.ToInt32 (value);
+ return;
+ } catch (OverflowException) {
+ break;
+ }
+
+ case RegistryValueKind.MultiString:
+ if (value is string []){
+ values [name] = value;
+ return;
+ }
break;
+
+ case RegistryValueKind.QWord:
+ try {
+ values [name] = Convert.ToInt64 (value);
+ return;
+ } catch (OverflowException) {
+ break;
+ }
+
+ default:
+ throw new ArgumentException ("unknown value", "valueKind");
}
-
- default:
- throw new ArgumentException ("unknown value", "valueKind");
}
throw new ArgumentException ("Value could not be converted to specified type", "valueKind");
}
if (name == null)
name = string.Empty;
- return values.Contains (name);
+ lock (values)
+ return values.Contains (name);
}
public int ValueCount {
get {
- return values.Keys.Count;
+ lock (values)
+ return values.Keys.Count;
}
}
{
AssertNotMarkedForDeletion ();
- values.Remove (name);
+ lock (values)
+ values.Remove (name);
SetDirty ();
}
if (IsMarkedForDeletion)
return;
- if (!File.Exists (file) && values.Count == 0)
- return;
-
SecurityElement se = new SecurityElement ("values");
-
- // With SecurityElement.Text = value, and SecurityElement.AddAttribute(key, value)
- // the values must be escaped prior to being assigned.
- foreach (DictionaryEntry de in values){
- object val = de.Value;
- SecurityElement value = new SecurityElement ("value");
- value.AddAttribute ("name", SecurityElement.Escape ((string) de.Key));
- if (val is string){
- value.AddAttribute ("type", "string");
- value.Text = SecurityElement.Escape ((string) val);
- } else if (val is int){
- value.AddAttribute ("type", "int");
- value.Text = val.ToString ();
- } else if (val is long) {
- value.AddAttribute ("type", "qword");
- value.Text = val.ToString ();
- } else if (val is byte []){
- value.AddAttribute ("type", "bytearray");
- value.Text = Convert.ToBase64String ((byte[]) val);
- } else if (val is ExpandString){
- value.AddAttribute ("type", "expand");
- value.Text = SecurityElement.Escape (val.ToString ());
- } else if (val is string []){
- value.AddAttribute ("type", "string-array");
-
- foreach (string ss in (string[]) val){
- SecurityElement str = new SecurityElement ("string");
- str.Text = SecurityElement.Escape (ss);
- value.AddChild (str);
+ lock (values){
+ if (!File.Exists (file) && values.Count == 0)
+ return;
+
+ // With SecurityElement.Text = value, and SecurityElement.AddAttribute(key, value)
+ // the values must be escaped prior to being assigned.
+ foreach (DictionaryEntry de in values){
+ object val = de.Value;
+ SecurityElement value = new SecurityElement ("value");
+ value.AddAttribute ("name", SecurityElement.Escape ((string) de.Key));
+
+ if (val is string){
+ value.AddAttribute ("type", "string");
+ value.Text = SecurityElement.Escape ((string) val);
+ } else if (val is int){
+ value.AddAttribute ("type", "int");
+ value.Text = val.ToString ();
+ } else if (val is long) {
+ value.AddAttribute ("type", "qword");
+ value.Text = val.ToString ();
+ } else if (val is byte []){
+ value.AddAttribute ("type", "bytearray");
+ value.Text = Convert.ToBase64String ((byte[]) val);
+ } else if (val is ExpandString){
+ value.AddAttribute ("type", "expand");
+ value.Text = SecurityElement.Escape (val.ToString ());
+ } else if (val is string []){
+ value.AddAttribute ("type", "string-array");
+
+ foreach (string ss in (string[]) val){
+ SecurityElement str = new SecurityElement ("string");
+ str.Text = SecurityElement.Escape (ss);
+ value.AddChild (str);
+ }
}
+ se.AddChild (value);
}
- se.AddChild (value);
}
-
+
using (FileStream fs = File.Create (file)){
StreamWriter sw = new StreamWriter (fs);
private RegistryKey CreateSubKey (RegistryKey rkey, string keyname, bool writable, bool is_volatile)
{
KeyHandler self = KeyHandler.Lookup (rkey, true);
- if (self == null)
+ if (self == null){
throw RegistryKey.CreateMarkedForDeletionException ();
+ }
if (KeyHandler.VolatileKeyExists (self.Dir) && !is_volatile)
throw new IOException ("Cannot create a non volatile subkey under a volatile key.");
+++ /dev/null
-namespace System
-{
- // this is the introspection only type. This type overrides all the functions with runtime semantics
- // and throws an exception.
- // The idea behind this type is that it relieves RuntimeType from doing honerous checks about ReflectionOnly
- // context.
- // This type should not derive from RuntimeType but it's doing so for convinience.
- // That should not present a security threat though it is risky as a direct call to one of the base method
- // method (RuntimeType) and an instance of this type will work around the reason to have this type in the
- // first place. However given RuntimeType is not public all its methods are protected and require full trust
- // to be accessed
- [Serializable]
- internal class ReflectionOnlyType : MonoType {
-
- private ReflectionOnlyType() : base (null)
- {}
-
- // always throw
- public override RuntimeTypeHandle TypeHandle
- {
- get
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
- }
- }
-
- }
-}
\ No newline at end of file
--- /dev/null
+//
+// RuntimeType.cs
+//
+// Authors:
+// Marek Safar <marek.safar@gmail.com>
+//
+// Copyright (C) 2015 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Threading;
+using System.Collections.Generic;
+using System.Runtime.InteropServices;
+using System.Globalization;
+#if MONO_COM
+using System.Reflection.Emit;
+#endif
+using System.Diagnostics.Contracts;
+using System.Security;
+
+namespace System
+{
+ partial class RuntimeType
+ {
+ internal virtual MonoCMethod GetDefaultConstructor ()
+ {
+ // TODO: Requires MonoType
+ throw new NotSupportedException ();
+ }
+
+ string GetDefaultMemberName ()
+ {
+ object [] att = GetCustomAttributes (typeof (DefaultMemberAttribute), true);
+ return att.Length != 0 ? ((DefaultMemberAttribute) att [0]).MemberName : null;
+ }
+
+ internal Object CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
+ {
+ bool bNeedSecurityCheck = true;
+ bool bCanBeCached = false;
+ bool bSecurityCheckOff = false;
+
+ if (!skipCheckThis)
+ CreateInstanceCheckThis();
+
+ if (!fillCache)
+ bSecurityCheckOff = true;
+
+ return CreateInstanceMono (!publicOnly);
+ }
+
+ object CreateInstanceMono (bool nonPublic)
+ {
+ var ctor = GetDefaultConstructor ();
+ if (!nonPublic && ctor != null && !ctor.IsPublic) {
+ ctor = null;
+ }
+
+ if (ctor == null) {
+ Type elementType = this.GetRootElementType();
+ if (ReferenceEquals (elementType, typeof (TypedReference)) || ReferenceEquals (elementType, typeof (RuntimeArgumentHandle)))
+ throw new NotSupportedException (Environment.GetResourceString ("NotSupported_ContainsStackPtr"));
+
+ if (IsValueType)
+ return CreateInstanceInternal (this);
+
+ throw new MissingMethodException (Locale.GetText ("Default constructor not found for type " + FullName));
+ }
+
+ // TODO: .net does more checks in unmanaged land in RuntimeTypeHandle::CreateInstance
+ if (IsAbstract) {
+ throw new MissingMethodException (Locale.GetText ("Cannot create an abstract class '{0}'.", FullName));
+ }
+
+ return ctor.InternalInvoke (null, null);
+ }
+
+ internal Object CheckValue (Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
+ {
+ bool failed = false;
+ var res = TryConvertToType (value, ref failed);
+ if (!failed)
+ return res;
+
+ if ((invokeAttr & BindingFlags.ExactBinding) == BindingFlags.ExactBinding)
+ throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value.GetType(), this));
+
+ if (binder != null && binder != Type.DefaultBinder)
+ return binder.ChangeType (value, this, culture);
+
+ throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value.GetType(), this));
+ }
+
+ object TryConvertToType (object value, ref bool failed)
+ {
+ if (IsInstanceOfType (value)) {
+ return value;
+ }
+
+ if (IsByRef) {
+ var elementType = GetElementType ();
+ if (value == null || elementType.IsInstanceOfType (value)) {
+ return value;
+ }
+ }
+
+ if (value == null)
+ return value;
+
+ if (IsEnum) {
+ var type = Enum.GetUnderlyingType (this);
+ if (type == value.GetType ())
+ return value;
+ var res = IsConvertibleToPrimitiveType (value, this);
+ if (res != null)
+ return res;
+ } else if (IsPrimitive) {
+ var res = IsConvertibleToPrimitiveType (value, this);
+ if (res != null)
+ return res;
+ } else if (IsPointer) {
+ var vtype = value.GetType ();
+ if (vtype == typeof (IntPtr) || vtype == typeof (UIntPtr))
+ return value;
+ }
+
+ failed = true;
+ return null;
+ }
+
+ // Binder uses some incompatible conversion rules. For example
+ // int value cannot be used with decimal parameter but in other
+ // ways it's more flexible than normal convertor, for example
+ // long value can be used with int based enum
+ static object IsConvertibleToPrimitiveType (object value, Type targetType)
+ {
+ var type = value.GetType ();
+ if (type.IsEnum) {
+ type = Enum.GetUnderlyingType (type);
+ if (type == targetType)
+ return value;
+ }
+
+ var from = Type.GetTypeCode (type);
+ var to = Type.GetTypeCode (targetType);
+
+ switch (to) {
+ case TypeCode.Char:
+ switch (from) {
+ case TypeCode.Byte:
+ return (Char) (Byte) value;
+ case TypeCode.UInt16:
+ return value;
+ }
+ break;
+ case TypeCode.Int16:
+ switch (from) {
+ case TypeCode.Byte:
+ return (Int16) (Byte) value;
+ case TypeCode.SByte:
+ return (Int16) (SByte) value;
+ }
+ break;
+ case TypeCode.UInt16:
+ switch (from) {
+ case TypeCode.Byte:
+ return (UInt16) (Byte) value;
+ case TypeCode.Char:
+ return value;
+ }
+ break;
+ case TypeCode.Int32:
+ switch (from) {
+ case TypeCode.Byte:
+ return (Int32) (Byte) value;
+ case TypeCode.SByte:
+ return (Int32) (SByte) value;
+ case TypeCode.Char:
+ return (Int32) (Char) value;
+ case TypeCode.Int16:
+ return (Int32) (Int16) value;
+ case TypeCode.UInt16:
+ return (Int32) (UInt16) value;
+ }
+ break;
+ case TypeCode.UInt32:
+ switch (from) {
+ case TypeCode.Byte:
+ return (UInt32) (Byte) value;
+ case TypeCode.Char:
+ return (UInt32) (Char) value;
+ case TypeCode.UInt16:
+ return (UInt32) (UInt16) value;
+ }
+ break;
+ case TypeCode.Int64:
+ switch (from) {
+ case TypeCode.Byte:
+ return (Int64) (Byte) value;
+ case TypeCode.SByte:
+ return (Int64) (SByte) value;
+ case TypeCode.Int16:
+ return (Int64) (Int16) value;
+ case TypeCode.Char:
+ return (Int64) (Char) value;
+ case TypeCode.UInt16:
+ return (Int64) (UInt16) value;
+ case TypeCode.Int32:
+ return (Int64) (Int32) value;
+ case TypeCode.UInt32:
+ return (Int64) (UInt32) value;
+ }
+ break;
+ case TypeCode.UInt64:
+ switch (from) {
+ case TypeCode.Byte:
+ return (UInt64) (Byte) value;
+ case TypeCode.Char:
+ return (UInt64) (Char) value;
+ case TypeCode.UInt16:
+ return (UInt64) (UInt16) value;
+ case TypeCode.UInt32:
+ return (UInt64) (UInt32) value;
+ }
+ break;
+ case TypeCode.Single:
+ switch (from) {
+ case TypeCode.Byte:
+ return (Single) (Byte) value;
+ case TypeCode.SByte:
+ return (Single) (SByte) value;
+ case TypeCode.Int16:
+ return (Single) (Int16) value;
+ case TypeCode.Char:
+ return (Single) (Char) value;
+ case TypeCode.UInt16:
+ return (Single) (UInt16) value;
+ case TypeCode.Int32:
+ return (Single) (Int32) value;
+ case TypeCode.UInt32:
+ return (Single) (UInt32) value;
+ case TypeCode.Int64:
+ return (Single) (Int64) value;
+ case TypeCode.UInt64:
+ return (Single) (UInt64) value;
+ }
+ break;
+ case TypeCode.Double:
+ switch (from) {
+ case TypeCode.Byte:
+ return (Double) (Byte) value;
+ case TypeCode.SByte:
+ return (Double) (SByte) value;
+ case TypeCode.Char:
+ return (Double) (Char) value;
+ case TypeCode.Int16:
+ return (Double) (Int16) value;
+ case TypeCode.UInt16:
+ return (Double) (UInt16) value;
+ case TypeCode.Int32:
+ return (Double) (Int32) value;
+ case TypeCode.UInt32:
+ return (Double) (UInt32) value;
+ case TypeCode.Int64:
+ return (Double) (Int64) value;
+ case TypeCode.UInt64:
+ return (Double) (UInt64) value;
+ case TypeCode.Single:
+ return (Double) (Single) value;
+ }
+ break;
+ }
+
+ // Everything else is rejected
+ return null;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern Type make_array_type (int rank);
+
+ public override Type MakeArrayType ()
+ {
+ return make_array_type (0);
+ }
+
+ public override Type MakeArrayType (int rank)
+ {
+ if (rank < 1 || rank > 255)
+ throw new IndexOutOfRangeException ();
+ return make_array_type (rank);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern Type make_byref_type ();
+
+ public override Type MakeByRefType ()
+ {
+ if (IsByRef)
+ throw new TypeLoadException ("Can not call MakeByRefType on a ByRef type");
+ return make_byref_type ();
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern Type MakePointerType (Type type);
+
+ public override Type MakePointerType ()
+ {
+ return MakePointerType (this);
+ }
+
+ public override StructLayoutAttribute StructLayoutAttribute {
+ get {
+ return GetStructLayoutAttribute ();
+ }
+ }
+
+ public override bool ContainsGenericParameters {
+ get {
+ if (IsGenericParameter)
+ return true;
+
+ if (IsGenericType) {
+ foreach (Type arg in GetGenericArguments ())
+ if (arg.ContainsGenericParameters)
+ return true;
+ }
+
+ if (HasElementType)
+ return GetElementType ().ContainsGenericParameters;
+
+ return false;
+ }
+ }
+
+ public override Type[] GetGenericParameterConstraints()
+ {
+ if (!IsGenericParameter)
+ throw new InvalidOperationException(Environment.GetResourceString("Arg_NotGenericParameter"));
+ Contract.EndContractBlock();
+
+ Type[] constraints = GetGenericParameterConstraints_impl ();
+
+ if (constraints == null)
+ constraints = EmptyArray<Type>.Value;
+
+ return constraints;
+ }
+
+ public override Type MakeGenericType (params Type[] typeArguments)
+ {
+ if (IsUserType)
+ throw new NotSupportedException ();
+ if (!IsGenericTypeDefinition)
+ throw new InvalidOperationException ("not a generic type definition");
+ if (typeArguments == null)
+ throw new ArgumentNullException ("typeArguments");
+ if (GetGenericArguments().Length != typeArguments.Length)
+ throw new ArgumentException (String.Format ("The type or method has {0} generic parameter(s) but {1} generic argument(s) where provided. A generic argument must be provided for each generic parameter.", GetGenericArguments ().Length, typeArguments.Length), "typeArguments");
+
+ bool hasUserType = false;
+
+ Type[] systemTypes = new Type[typeArguments.Length];
+ for (int i = 0; i < typeArguments.Length; ++i) {
+ Type t = typeArguments [i];
+ if (t == null)
+ throw new ArgumentNullException ("typeArguments");
+
+ if (!(t is MonoType))
+ hasUserType = true;
+ systemTypes [i] = t;
+ }
+
+ if (hasUserType) {
+#if FULL_AOT_RUNTIME
+ throw new NotSupportedException ("User types are not supported under full aot");
+#else
+ return new MonoGenericClass (this, typeArguments);
+#endif
+ }
+
+ Type res = MakeGenericType (this, systemTypes);
+ if (res == null)
+ throw new TypeLoadException ();
+ return res;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern Type MakeGenericType (Type gt, Type [] types);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern RuntimeMethodInfo[] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, Type reflected_type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern RuntimePropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, Type reflected_type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern RuntimeConstructorInfo[] GetConstructors_internal (BindingFlags bindingAttr, Type reflected_type);
+
+ public override InterfaceMapping GetInterfaceMap (Type ifaceType)
+ {
+ if (IsGenericParameter)
+ throw new InvalidOperationException(Environment.GetResourceString("Arg_GenericParameter"));
+
+ if ((object)ifaceType == null)
+ throw new ArgumentNullException("ifaceType");
+ Contract.EndContractBlock();
+
+ RuntimeType ifaceRtType = ifaceType as RuntimeType;
+
+ if (ifaceRtType == null)
+ throw new ArgumentException(Environment.GetResourceString("Argument_MustBeRuntimeType"), "ifaceType");
+
+ InterfaceMapping res;
+ if (!ifaceType.IsInterface)
+ throw new ArgumentException (Locale.GetText ("Argument must be an interface."), "ifaceType");
+ if (IsInterface)
+ throw new ArgumentException ("'this' type cannot be an interface itself");
+ res.TargetType = this;
+ res.InterfaceType = ifaceType;
+ GetInterfaceMapData (this, ifaceType, out res.TargetMethods, out res.InterfaceMethods);
+ if (res.TargetMethods == null)
+ throw new ArgumentException (Locale.GetText ("Interface not found"), "ifaceType");
+
+ return res;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern void GetInterfaceMapData (Type t, Type iface, out MethodInfo[] targets, out MethodInfo[] methods);
+
+ public override Guid GUID {
+ get {
+ object[] att = GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), true);
+ if (att.Length == 0)
+ return Guid.Empty;
+ return new Guid(((System.Runtime.InteropServices.GuidAttribute)att[0]).Value);
+ }
+ }
+
+ StructLayoutAttribute GetStructLayoutAttribute ()
+ {
+ LayoutKind kind;
+
+ if (IsLayoutSequential)
+ kind = LayoutKind.Sequential;
+ else if (IsExplicitLayout)
+ kind = LayoutKind.Explicit;
+ else
+ kind = LayoutKind.Auto;
+
+ StructLayoutAttribute attr = new StructLayoutAttribute (kind);
+
+ if (IsUnicodeClass)
+ attr.CharSet = CharSet.Unicode;
+ else if (IsAnsiClass)
+ attr.CharSet = CharSet.Ansi;
+ else
+ attr.CharSet = CharSet.Auto;
+
+ if (kind != LayoutKind.Auto) {
+ int packing;
+ GetPacking (out packing, out attr.Size);
+ // 0 means no data provided, we end up with default value
+ if (packing != 0)
+ attr.Pack = packing;
+ }
+
+ return attr;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern void GetPacking (out int packing, out int size);
+
+#if MONO_COM
+ private static Dictionary<Guid, Type> clsid_types;
+ private static AssemblyBuilder clsid_assemblybuilder;
+#endif
+
+ internal static Type GetTypeFromCLSIDImpl(Guid clsid, String server, bool throwOnError)
+ {
+#if MONO_COM
+ Type result;
+
+ if (clsid_types == null)
+ {
+ Dictionary<Guid, Type> new_clsid_types = new Dictionary<Guid, Type> ();
+ Interlocked.CompareExchange<Dictionary<Guid, Type>>(
+ ref clsid_types, new_clsid_types, null);
+ }
+
+ lock (clsid_types) {
+ if (clsid_types.TryGetValue(clsid, out result))
+ return result;
+
+ if (clsid_assemblybuilder == null)
+ {
+ AssemblyName assemblyname = new AssemblyName ();
+ assemblyname.Name = "GetTypeFromCLSIDDummyAssembly";
+ clsid_assemblybuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (
+ assemblyname, AssemblyBuilderAccess.Run);
+ }
+ ModuleBuilder modulebuilder = clsid_assemblybuilder.DefineDynamicModule (
+ clsid.ToString ());
+
+ TypeBuilder typebuilder = modulebuilder.DefineType ("System.__ComObject",
+ TypeAttributes.Public | TypeAttributes.Class, typeof(System.__ComObject));
+
+ Type[] guidattrtypes = new Type[] { typeof(string) };
+
+ CustomAttributeBuilder customattr = new CustomAttributeBuilder (
+ typeof(GuidAttribute).GetConstructor (guidattrtypes),
+ new object[] { clsid.ToString () });
+
+ typebuilder.SetCustomAttribute (customattr);
+
+ customattr = new CustomAttributeBuilder (
+ typeof(ComImportAttribute).GetConstructor (EmptyTypes),
+ new object[0] {});
+
+ typebuilder.SetCustomAttribute (customattr);
+
+ result = typebuilder.CreateType ();
+
+ clsid_types.Add(clsid, result);
+
+ return result;
+ }
+#else
+ throw new NotImplementedException ("Unmanaged activation removed");
+#endif
+ }
+
+ protected override TypeCode GetTypeCodeImpl ()
+ {
+ return GetTypeCodeImplInternal (this);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static TypeCode GetTypeCodeImplInternal (Type type);
+
+ internal static Type GetTypeFromProgIDImpl(String progID, String server, bool throwOnError)
+ {
+ throw new NotImplementedException ("Unmanaged activation is not supported");
+ }
+
+ public override string ToString()
+ {
+ return getFullName (false, false);
+ }
+
+ bool IsGenericCOMObjectImpl ()
+ {
+ return false;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ static extern object CreateInstanceInternal (Type type);
+
+ public extern override MethodBase DeclaringMethod {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern string getFullName(bool full_name, bool assembly_qualified);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type [] GetGenericArguments ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern GenericParameterAttributes GetGenericParameterAttributes ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern Type[] GetGenericParameterConstraints_impl ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern int GetGenericParameterPosition ();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern RuntimeEventInfo[] GetEvents_internal (string name, BindingFlags bindingAttr, Type reflected_type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern RuntimeFieldInfo[] GetFields_internal (string name, BindingFlags bindingAttr, Type reflected_type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern override Type[] GetInterfaces();
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern RuntimeType[] GetNestedTypes_internal (string name, BindingFlags bindingAttr);
+
+ public override string AssemblyQualifiedName {
+ get {
+ return getFullName (true, true);
+ }
+ }
+
+ public extern override Type DeclaringType {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public override string FullName {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public extern override string Name {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ public extern override string Namespace {
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ get;
+ }
+
+ //seclevel { transparent = 0, safe-critical = 1, critical = 2}
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ public extern int get_core_clr_security_level ();
+
+ public override bool IsSecurityTransparent {
+ get { return get_core_clr_security_level () == 0; }
+ }
+
+ public override bool IsSecurityCritical {
+ get { return get_core_clr_security_level () > 0; }
+ }
+
+ public override bool IsSecuritySafeCritical {
+ get { return get_core_clr_security_level () == 1; }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+//
+// Type.cs
+//
+// Authors:
+// Marek Safar <marek.safar@gmail.com>
+//
+// Copyright (C) 2015 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+namespace System
+{
+ partial class Type : MemberInfo
+ {
+ internal RuntimeTypeHandle _impl;
+
+ #region Requires stack backtracing fixes in unmanaged type_from_name
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern Type internal_from_name (string name, bool throwOnError, bool ignoreCase);
+
+ public static Type GetType(string typeName)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("TypeName");
+
+ return internal_from_name (typeName, false, false);
+ }
+
+ public static Type GetType(string typeName, bool throwOnError)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("TypeName");
+
+ Type type = internal_from_name (typeName, throwOnError, false);
+ if (throwOnError && type == null)
+ throw new TypeLoadException ("Error loading '" + typeName + "'");
+
+ return type;
+ }
+
+ public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("TypeName");
+
+ Type t = internal_from_name (typeName, throwOnError, ignoreCase);
+ if (throwOnError && t == null)
+ throw new TypeLoadException ("Error loading '" + typeName + "'");
+
+ return t;
+ }
+
+ #endregion
+
+ // TODO: Merge with internal_from_name
+ public static Type ReflectionOnlyGetType (string typeName,
+ bool throwIfNotFound,
+ bool ignoreCase)
+ {
+ if (typeName == null)
+ throw new ArgumentNullException ("typeName");
+ int idx = typeName.IndexOf (',');
+ if (idx < 0 || idx == 0 || idx == typeName.Length - 1)
+ throw new ArgumentException ("Assembly qualifed type name is required", "typeName");
+ string an = typeName.Substring (idx + 1);
+ Assembly a;
+ try {
+ a = Assembly.ReflectionOnlyLoad (an);
+ } catch {
+ if (throwIfNotFound)
+ throw;
+ return null;
+ }
+ return a.GetType (typeName.Substring (0, idx), throwIfNotFound, ignoreCase);
+ }
+
+ internal virtual Type InternalResolve ()
+ {
+ return UnderlyingSystemType;
+ }
+
+ internal virtual bool IsUserType {
+ get {
+ return true;
+ }
+ }
+
+ internal virtual MethodInfo GetMethod (MethodInfo fromNoninstanciated)
+ {
+ throw new System.InvalidOperationException ("can only be called in generic type");
+ }
+
+ internal virtual ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
+ {
+ throw new System.InvalidOperationException ("can only be called in generic type");
+ }
+
+ internal virtual FieldInfo GetField (FieldInfo fromNoninstanciated)
+ {
+ throw new System.InvalidOperationException ("can only be called in generic type");
+ }
+
+ internal static bool ShouldPrintFullName (Type type)
+ {
+ while (type.HasElementType)
+ type = type.GetElementType ();
+
+ if (type == typeof (void) || type.IsNested)
+ return false;
+
+ return !type.IsPrimitive;
+ }
+
+ public static Type GetTypeFromHandle (RuntimeTypeHandle handle)
+ {
+ if (handle.Value == IntPtr.Zero)
+ // This is not consistent with the other GetXXXFromHandle methods, but
+ // MS.NET seems to do this
+ return null;
+
+ return internal_from_handle (handle.Value);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern Type internal_from_handle (IntPtr handle);
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Reflection;
+using System.Threading;
+
+namespace System
+{
+ internal sealed class TypeNameParser
+ {
+ internal static Type GetType(
+ string typeName,
+ Func<AssemblyName, Assembly> assemblyResolver,
+ Func<Assembly, string, bool, Type> typeResolver,
+ bool throwOnError,
+ bool ignoreCase,
+ ref StackCrawlMark stackMark)
+ {
+ TypeSpec spec = TypeSpec.Parse (typeName);
+ return spec.Resolve (assemblyResolver, typeResolver, throwOnError, ignoreCase);
+ }
+ }
+}
\ No newline at end of file
#pragma warning restore 649
#endregion
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ extern static int GetILOffsetFromFile (string path, int methodToken, int nativeOffset);
+
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static bool get_frame_info (int skip, bool needFileInfo, out MethodBase method,
out int iloffset, out int native_offset,
return new ByRefType (this);
}
- [MonoTODO]
- public override Type MakeGenericType (params Type [] typeArguments)
+ public override Type MakeGenericType (params Type[] typeArguments)
{
- return base.MakeGenericType (typeArguments);
+ throw new InvalidOperationException (Environment.GetResourceString ("Arg_NotGenericTypeDefinition"));
}
public override Type MakePointerType ()
/* Needed to keep signature compatibility with MS.NET */
public override EventInfo[] GetEvents ()
{
+ const BindingFlags DefaultBindingFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
return GetEvents (DefaultBindingFlags);
}
return res;
}
- internal TypeCode GetTypeCodeInternal () {
- if (parent == pmodule.assemblyb.corlib_enum_type) {
- for (int i = 0; i < num_fields; ++i) {
- FieldBuilder f = fields [i];
- if (!f.IsStatic)
- return Type.GetTypeCode (f.FieldType);
- }
- throw new InvalidOperationException ("Enum basetype field not defined");
- } else {
- return Type.GetTypeCodeInternal (this);
- }
- }
-
void _TypeBuilder.GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
return MonoCustomAttrs.GetCustomAttributesData (target);
}
+ internal static IList<CustomAttributeData> GetCustomAttributesInternal (RuntimeType target) {
+ return MonoCustomAttrs.GetCustomAttributesData (target);
+ }
+
public static IList<CustomAttributeData> GetCustomAttributes (Module target) {
return MonoCustomAttrs.GetCustomAttributesData (target);
}
}
}
+ abstract class RuntimeEventInfo : EventInfo
+ {
+ internal BindingFlags BindingFlags {
+ get {
+ return 0;
+ }
+ }
+ }
+
[Serializable]
[StructLayout (LayoutKind.Sequential)]
- internal sealed class MonoEvent: EventInfo, ISerializable
+ internal sealed class MonoEvent: RuntimeEventInfo, ISerializable
{
#pragma warning disable 169
IntPtr klass;
namespace System.Reflection {
- abstract class RtFieldInfo : FieldInfo
+ abstract class RuntimeFieldInfo : FieldInfo
+ {
+ internal BindingFlags BindingFlags {
+ get {
+ return 0;
+ }
+ }
+ }
+
+ abstract class RtFieldInfo : RuntimeFieldInfo
{
[MethodImplAttribute(MethodImplOptions.InternalCall)]
internal extern object UnsafeGetValue (object obj);
abstract class RuntimeMethodInfo : MethodInfo
{
+ internal BindingFlags BindingFlags {
+ get {
+ return 0;
+ }
+ }
}
/*
var arg = args [i];
var pi = pinfo [i];
if (arg == Type.Missing) {
+ if (pi.DefaultValue == System.DBNull.Value)
+ throw new ArgumentException(Environment.GetResourceString("Arg_VarMissNull"),"parameters");
+
args [i] = pi.DefaultValue;
continue;
}
abstract class RuntimeConstructorInfo : ConstructorInfo
{
+ internal BindingFlags BindingFlags {
+ get {
+ return 0;
+ }
+ }
}
[Serializable()]
namespace System.Reflection {
+ abstract class RuntimeModule : Module
+ {
+
+ }
+
[ComVisible (true)]
[ComDefaultInterfaceAttribute (typeof (_Module))]
[Serializable]
[ClassInterface(ClassInterfaceType.None)]
- class MonoModule : Module {
-
+ class MonoModule : RuntimeModule
+ {
public
override
Assembly Assembly {
public override
FieldInfo GetField (string name, BindingFlags bindingAttr)
{
+ if (name == null)
+ throw new ArgumentNullException("name");
+
if (IsResource ())
return null;
internal delegate object GetterAdapter (object _this);
internal delegate R Getter<T,R> (T _this);
+ abstract class RuntimePropertyInfo : PropertyInfo
+ {
+ internal BindingFlags BindingFlags {
+ get {
+ return 0;
+ }
+ }
+ }
+
[Serializable]
[StructLayout (LayoutKind.Sequential)]
- internal class MonoProperty : PropertyInfo, ISerializable {
+ internal class MonoProperty : RuntimePropertyInfo, ISerializable {
#pragma warning disable 649
internal IntPtr klass;
internal IntPtr prop;
+++ /dev/null
-// System.Reflection/TypeDelegator.cs
-//
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2002 Ximian, Inc.
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Reflection;
-using System.Globalization;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection {
-
- [ComVisible (true)]
- [Serializable]
- public class TypeDelegator :
- TypeInfo, IReflectableType
- {
- protected Type typeImpl;
-
- protected TypeDelegator () {
- }
-
- public TypeDelegator( Type delegatingType)
- {
- if (delegatingType == null)
- throw new ArgumentNullException ("delegatingType must be non-null");
- typeImpl = delegatingType;
- }
-
- public override Assembly Assembly {
- get { return typeImpl.Assembly; }
- }
-
- public override string AssemblyQualifiedName {
- get { return typeImpl.AssemblyQualifiedName; }
- }
-
- public override Type BaseType {
- get { return typeImpl.BaseType; }
- }
-
- public override string FullName {
- get { return typeImpl.FullName; }
- }
-
- public override Guid GUID {
- get { return typeImpl.GUID; }
- }
-
- public override Module Module {
- get { return typeImpl.Module; }
- }
-
- public override string Name {
- get { return typeImpl.Name; }
- }
-
- public override string Namespace {
- get { return typeImpl.Namespace; }
- }
-
- public override RuntimeTypeHandle TypeHandle {
- get { return typeImpl.TypeHandle; }
- }
-
- public override Type UnderlyingSystemType {
- get { return typeImpl.UnderlyingSystemType; }
- }
-
- protected override TypeAttributes GetAttributeFlagsImpl ()
- {
- return typeImpl.Attributes;
- }
-
- protected override ConstructorInfo GetConstructorImpl (
- BindingFlags bindingAttr, Binder binder, CallingConventions callConvention,
- Type[] types, ParameterModifier[] modifiers)
- {
- return typeImpl.GetConstructor (bindingAttr, binder, callConvention, types, modifiers);
- }
-
- [ComVisible (true)]
- public override ConstructorInfo[] GetConstructors( BindingFlags bindingAttr)
- {
- return typeImpl.GetConstructors (bindingAttr);
- }
-
- public override object[] GetCustomAttributes (bool inherit)
- {
- return typeImpl.GetCustomAttributes (inherit);
- }
-
- public override object[] GetCustomAttributes (Type attributeType, bool inherit)
- {
- return typeImpl.GetCustomAttributes (attributeType, inherit);
- }
-
- public override Type GetElementType()
- {
- return typeImpl.GetElementType ();
- }
-
- public override EventInfo GetEvent( string name, BindingFlags bindingAttr)
- {
- return typeImpl.GetEvent (name, bindingAttr);
- }
-
- public override EventInfo[] GetEvents()
- {
- return GetEvents (BindingFlags.Public);
- }
-
- public override EventInfo[] GetEvents (BindingFlags bindingAttr)
- {
- return typeImpl.GetEvents (bindingAttr);
- }
-
- public override FieldInfo GetField (string name, BindingFlags bindingAttr)
- {
- return typeImpl.GetField (name, bindingAttr);
- }
-
- public override FieldInfo[] GetFields( BindingFlags bindingAttr)
- {
- return typeImpl.GetFields (bindingAttr);
- }
-
- public override Type GetInterface( string name, bool ignoreCase)
- {
- return typeImpl.GetInterface (name, ignoreCase);
- }
-
- [ComVisible (true)]
- public override InterfaceMapping GetInterfaceMap( Type interfaceType)
- {
- return typeImpl.GetInterfaceMap (interfaceType);
- }
-
- public override Type[] GetInterfaces ()
- {
- return typeImpl.GetInterfaces ();
- }
-
- public override MemberInfo[] GetMember( string name, MemberTypes type, BindingFlags bindingAttr)
- {
- return typeImpl.GetMember (name, type, bindingAttr);
- }
-
- public override MemberInfo[] GetMembers( BindingFlags bindingAttr)
- {
- return typeImpl.GetMembers (bindingAttr);
- }
-
- protected override MethodInfo GetMethodImpl( string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- // Can't call GetMethod since it makes restrictive argument checks
- return typeImpl.GetMethodImplInternal (name, bindingAttr, binder, callConvention, types, modifiers);
- }
-
- public override MethodInfo[] GetMethods( BindingFlags bindingAttr)
- {
- return typeImpl.GetMethods (bindingAttr);
- }
-
- public override Type GetNestedType( string name, BindingFlags bindingAttr)
- {
- return typeImpl.GetNestedType (name, bindingAttr);
- }
-
- public override Type[] GetNestedTypes( BindingFlags bindingAttr)
- {
- return typeImpl.GetNestedTypes (bindingAttr);
- }
-
- public override PropertyInfo[] GetProperties( BindingFlags bindingAttr)
- {
- return typeImpl.GetProperties (bindingAttr);
- }
-
- protected override PropertyInfo GetPropertyImpl( string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- // Can't call GetProperty since it makes restrictive argument checks
- return typeImpl.GetPropertyImplInternal (name, bindingAttr, binder, returnType, types, modifiers);
- }
-
- protected override bool HasElementTypeImpl()
- {
- return typeImpl.HasElementType;
- }
-
- public override object InvokeMember( string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) {
- return typeImpl.InvokeMember (name, invokeAttr, binder, target, args, modifiers, culture, namedParameters);
- }
-
- protected override bool IsArrayImpl()
- {
- return typeImpl.IsArray;
- }
-
- protected override bool IsByRefImpl()
- {
- return typeImpl.IsByRef;
- }
-
- protected override bool IsCOMObjectImpl()
- {
- return typeImpl.IsCOMObject;
- }
-
- public override bool IsDefined( Type attributeType, bool inherit) {
- return typeImpl.IsDefined (attributeType, inherit);
- }
-
- protected override bool IsPointerImpl()
- {
- return typeImpl.IsPointer;
- }
-
- protected override bool IsPrimitiveImpl()
- {
- return typeImpl.IsPrimitive;
- }
-
- protected override bool IsValueTypeImpl()
- {
- return typeImpl.IsValueType;
- }
-
- public override int MetadataToken {
- get {
- return typeImpl.MetadataToken;
- }
- }
-
- public override bool IsConstructedGenericType {
- get { return typeImpl.IsConstructedGenericType; }
- }
-
- public override bool IsAssignableFrom (TypeInfo typeInfo)
- {
- if (typeInfo == null)
- throw new ArgumentNullException ("typeInfo");
-
- return IsAssignableFrom (typeInfo.AsType ());
- }
-
- }
-}
protected byte [] _serializedArgs = null;
protected int _propertyCount = 0;
protected CADArgHolder _callContext;
-
+ internal RuntimeMethodHandle MethodHandle;
+ internal string FullTypeName;
+ internal MethodBase _method;
+
+ public CADMessageBase (IMethodMessage msg) {
+ MethodHandle = msg.MethodBase.MethodHandle;
+ FullTypeName = msg.MethodBase.DeclaringType.AssemblyQualifiedName;
+ }
+
+ internal MethodBase method {
+ get {
+ if (_method == null) {
+ _method = GetMethod();
+ }
+ return _method;
+ }
+ }
+
+ internal MethodBase GetMethod ()
+ {
+ Type tt = Type.GetType (FullTypeName, true);
+ if (tt.IsGenericType || tt.IsGenericTypeDefinition) {
+ _method = MethodBase.GetMethodFromHandleNoGenericCheck (MethodHandle);
+ } else {
+ _method = MethodBase.GetMethodFromHandle (MethodHandle);
+ }
+
+ if (tt != _method.DeclaringType) {
+ // The target domain has loaded the type from a different assembly.
+ // We need to locate the correct type and get the method from it
+ Type [] signature = GetSignature (_method, true);
+ if (_method.IsGenericMethod) {
+ MethodBase [] methods = tt.GetMethods (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance);
+ Type [] base_args = _method.GetGenericArguments ();
+ foreach (MethodBase method in methods) {
+ if (!method.IsGenericMethod || method.Name != _method.Name)
+ continue;
+ Type [] method_args = method.GetGenericArguments ();
+ if (base_args.Length != method_args.Length)
+ continue;
+
+ MethodInfo method_instance = ((MethodInfo) method).MakeGenericMethod (base_args);
+ Type [] base_sig = GetSignature (method_instance, false);
+ if (base_sig.Length != signature.Length) {
+ continue;
+ }
+ bool dont = false;
+ for (int i = base_sig.Length - 1; i >= 0; i--) {
+ if (base_sig [i] != signature [i]) {
+ dont = true;
+ break;
+ }
+ }
+ if (dont)
+ continue;
+ return method_instance;
+ }
+ return _method;
+ }
+
+ MethodBase mb = tt.GetMethod (_method.Name, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, signature, null);
+ if (mb == null)
+ throw new RemotingException ("Method '" + _method.Name + "' not found in type '" + tt + "'");
+ return mb;
+ }
+ return _method;
+ }
+
+ static protected Type [] GetSignature (MethodBase methodBase, bool load)
+ {
+ ParameterInfo[] pars = methodBase.GetParameters ();
+ Type[] signature = new Type [pars.Length];
+ for (int n=0; n<pars.Length; n++) {
+ // The parameter types may also be loaded from a different assembly, so we need
+ // to load them again
+ if (load)
+ signature [n] = Type.GetType (pars [n].ParameterType.AssemblyQualifiedName, true);
+ else
+ signature [n] = pars [n].ParameterType;
+ }
+ return signature;
+ }
// Helper to marshal properties
internal static int MarshalProperties (IDictionary dict, ref ArrayList args) {
IDictionary serDict = dict;
return new CADArgHolder(args.Count - 1);
}
- protected object UnmarshalArgument (object arg, ArrayList args) {
+ protected object UnmarshalArgument (object arg, ArrayList args, Type argType) {
if (arg == null) return null;
// Check if argument is an holder (then we know that it's a serialized argument)
CADObjRef objref = arg as CADObjRef;
if (null != objref) {
- string typeName = string.Copy (objref.TypeName);
+ string typeName;
+
+ if (argType != null) {
+ typeName = string.Copy (argType.AssemblyQualifiedName);
+ } else {
+ typeName = string.Copy (objref.TypeName);
+ }
+
string uri = string.Copy (objref.URI);
int domid = objref.SourceDomain;
return marshalledArgs;
}
- internal object [] UnmarshalArguments (object [] arguments, ArrayList args) {
+ internal object [] UnmarshalArguments (object [] arguments, ArrayList args, Type [] sig) {
object [] unmarshalledArgs = new object [arguments.Length];
int total = arguments.Length;
for (int i = 0; i < total; i++)
- unmarshalledArgs [i] = UnmarshalArgument (arguments [i], args);
+ unmarshalledArgs [i] = UnmarshalArgument (arguments [i], args, sig [i]);
return unmarshalledArgs;
}
-
+
protected void SaveLogicalCallContext (IMethodMessage msg, ref ArrayList serializeList)
{
if (msg.LogicalCallContext != null && msg.LogicalCallContext.HasInfo)
// Used when passing a IMethodCallMessage between appdomains
internal class CADMethodCallMessage : CADMessageBase {
string _uri;
-
- internal RuntimeMethodHandle MethodHandle;
- internal string FullTypeName;
-
+
internal string Uri {
get {
return _uri;
return new CADMethodCallMessage (msg);
}
- internal CADMethodCallMessage (IMethodCallMessage callMsg) {
+ internal CADMethodCallMessage (IMethodCallMessage callMsg): base (callMsg) {
_uri = callMsg.Uri;
- MethodHandle = callMsg.MethodBase.MethodHandle;
- FullTypeName = callMsg.MethodBase.DeclaringType.AssemblyQualifiedName;
ArrayList serializeList = null;
}
internal object [] GetArgs (ArrayList args) {
- return UnmarshalArguments (_args, args);
+ Type [] sigs = GetSignature (method, true);
+ return UnmarshalArguments (_args, args, sigs);
}
internal int PropertiesCount {
}
}
- static Type [] GetSignature (MethodBase methodBase, bool load)
- {
- ParameterInfo[] pars = methodBase.GetParameters ();
- Type[] signature = new Type [pars.Length];
- for (int n=0; n<pars.Length; n++) {
- // The parameter types may also be loaded from a different assembly, so we need
- // to load them again
- if (load)
- signature [n] = Type.GetType (pars [n].ParameterType.AssemblyQualifiedName, true);
- else
- signature [n] = pars [n].ParameterType;
- }
- return signature;
- }
-
- internal MethodBase GetMethod ()
- {
- MethodBase methodBase = null;
- Type tt = Type.GetType (FullTypeName, true);
- if (tt.IsGenericType || tt.IsGenericTypeDefinition) {
- methodBase = MethodBase.GetMethodFromHandleNoGenericCheck (MethodHandle);
- } else {
- methodBase = MethodBase.GetMethodFromHandle (MethodHandle);
- }
-
- if (tt != methodBase.DeclaringType) {
- // The target domain has loaded the type from a different assembly.
- // We need to locate the correct type and get the method from it
- Type [] signature = GetSignature (methodBase, true);
- if (methodBase.IsGenericMethod) {
- MethodBase [] methods = tt.GetMethods (BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance);
- Type [] base_args = methodBase.GetGenericArguments ();
- foreach (MethodBase method in methods) {
- if (!method.IsGenericMethod || method.Name != methodBase.Name)
- continue;
- Type [] method_args = method.GetGenericArguments ();
- if (base_args.Length != method_args.Length)
- continue;
-
- MethodInfo method_instance = ((MethodInfo) method).MakeGenericMethod (base_args);
- Type [] base_sig = GetSignature (method_instance, false);
- if (base_sig.Length != signature.Length) {
- continue;
- }
- bool dont = false;
- for (int i = base_sig.Length - 1; i >= 0; i--) {
- if (base_sig [i] != signature [i]) {
- dont = true;
- break;
- }
- }
- if (dont)
- continue;
- return method_instance;
- }
- return methodBase;
- }
-
- MethodBase mb = tt.GetMethod (methodBase.Name, BindingFlags.Public|BindingFlags.NonPublic|BindingFlags.Instance, null, signature, null);
- if (mb == null)
- throw new RemotingException ("Method '" + methodBase.Name + "' not found in type '" + tt + "'");
- return mb;
- }
- return methodBase;
- }
}
// Used when passing a IMethodReturnMessage between appdomains
internal class CADMethodReturnMessage : CADMessageBase {
object _returnValue;
CADArgHolder _exception = null;
+ Type [] _sig;
static internal CADMethodReturnMessage Create (IMessage callMsg) {
IMethodReturnMessage msg = callMsg as IMethodReturnMessage;
return new CADMethodReturnMessage (msg);
}
- internal CADMethodReturnMessage(IMethodReturnMessage retMsg) {
+ internal CADMethodReturnMessage(IMethodReturnMessage retMsg): base (retMsg) {
ArrayList serializeList = null;
_propertyCount = MarshalProperties (retMsg.Properties, ref serializeList);
_returnValue = MarshalArgument ( retMsg.ReturnValue, ref serializeList);
_args = MarshalArguments ( retMsg.Args, ref serializeList);
+ _sig = GetSignature (method, true);
+
if (null != retMsg.Exception) {
if (null == serializeList)
serializeList = new ArrayList();
}
internal object [] GetArgs (ArrayList args) {
- return UnmarshalArguments (_args, args);
+ return UnmarshalArguments (_args, args, _sig);
}
-
+
internal object GetReturnValue (ArrayList args) {
- return UnmarshalArgument (_returnValue, args);
+ MethodInfo minfo = method as MethodInfo;
+
+ Type returnType = null;
+ if (minfo != null)
+ returnType = minfo.ReturnType;
+
+ return UnmarshalArgument (_returnValue, args, returnType);
}
internal Exception GetException(ArrayList args) {
static public ArrayList GetStack (int skipFrames)
{
+ /* _GetSecurityFrame () creates cross-domain references, leading to gc crashes */
+ return new ArrayList ();
+ /*
Array stack = _GetSecurityStack (skipFrames+2);
ArrayList al = new ArrayList ();
for (int i = 0; i < stack.Length; i++) {
al.Add (new SecurityFrame ((RuntimeSecurityFrame)o));
}
return al;
+ */
}
}
}
int[] bounds = null;
- elementType = elementType.UnderlyingSystemType;
- if (!elementType.IsSystemType)
+ elementType = elementType.UnderlyingSystemType as RuntimeType;
+ if (elementType == null)
throw new ArgumentException ("Type must be a type provided by the runtime.", "elementType");
if (elementType.Equals (typeof (void)))
throw new NotSupportedException ("Array type can not be void");
if (lowerBounds == null)
throw new ArgumentNullException ("lowerBounds");
- elementType = elementType.UnderlyingSystemType;
- if (!elementType.IsSystemType)
+ elementType = elementType.UnderlyingSystemType as RuntimeType;
+ if (elementType == null)
throw new ArgumentException ("Type must be a type provided by the runtime.", "elementType");
if (elementType.Equals (typeof (void)))
throw new NotSupportedException ("Array type can not be void");
* of icalls, do not require an increment.
*/
#pragma warning disable 169
- private const int mono_corlib_version = 119;
+ private const int mono_corlib_version = 120;
#pragma warning restore 169
[ComVisible (true)]
using System.Reflection;
using System.Collections;
using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
#endif
else if (obj is ParameterInfo)
pseudoAttrs = ((ParameterInfo)obj).GetPseudoCustomAttributes ();
else if (obj is Type)
- pseudoAttrs = ((Type)obj).GetPseudoCustomAttributes ();
+ pseudoAttrs = GetPseudoCustomAttributes (((Type)obj));
if ((attributeType != null) && (pseudoAttrs != null)) {
for (int i = 0; i < pseudoAttrs.Length; ++i)
return pseudoAttrs;
}
+ static object[] GetPseudoCustomAttributes (Type type)
+ {
+ int count = 0;
+ var Attributes = type.Attributes;
+
+ /* IsSerializable returns true for delegates/enums as well */
+ if ((Attributes & TypeAttributes.Serializable) != 0)
+ count ++;
+ if ((Attributes & TypeAttributes.Import) != 0)
+ count ++;
+
+ if (count == 0)
+ return null;
+ object[] attrs = new object [count];
+ count = 0;
+
+ if ((Attributes & TypeAttributes.Serializable) != 0)
+ attrs [count ++] = new SerializableAttribute ();
+ if ((Attributes & TypeAttributes.Import) != 0)
+ attrs [count ++] = new ComImportAttribute ();
+
+ return attrs;
+ }
+
internal static object[] GetCustomAttributesBase (ICustomAttributeProvider obj, Type attributeType, bool inheritedOnly)
{
object[] attrs;
using System.Diagnostics;
using System.Security.Permissions;
using System.Runtime.Remoting.Activation;
+using System.Runtime;
namespace System
{
public string full_name;
public MonoCMethod default_ctor;
}
-
- abstract class RuntimeType : TypeInfo
- {
- private static readonly RuntimeType StringType = (RuntimeType)typeof(System.String);
-
- private static readonly RuntimeType DelegateType = (RuntimeType)typeof(System.Delegate);
-
- internal RuntimeAssembly GetRuntimeAssembly ()
- {
- return (RuntimeAssembly) Assembly;
- }
-
- internal virtual bool IsSzArray {
- get {
- return IsArrayImpl () && GetArrayRank () == 1;
- }
- }
-
- bool IsGenericCOMObjectImpl ()
- {
- return false;
- }
-
- internal Object CheckValue (Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
- {
- bool failed = false;
- var res = TryConvertToType (value, ref failed);
- if (!failed)
- return res;
-
- if ((invokeAttr & BindingFlags.ExactBinding) == BindingFlags.ExactBinding)
- throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value.GetType(), this));
-
- if (binder != null && binder != Type.DefaultBinder)
- return binder.ChangeType (value, this, culture);
-
- throw new ArgumentException(String.Format(CultureInfo.CurrentUICulture, Environment.GetResourceString("Arg_ObjObjEx"), value.GetType(), this));
- }
-
- object TryConvertToType (object value, ref bool failed)
- {
- if (IsInstanceOfType (value)) {
- return value;
- }
-
- if (IsByRef) {
- var elementType = GetElementType ();
- if (value == null || elementType.IsInstanceOfType (value)) {
- return value;
- }
- }
-
- if (value == null)
- return value;
-
- if (IsEnum) {
- var type = Enum.GetUnderlyingType (this);
- if (type == value.GetType ())
- return value;
- var res = IsConvertibleToPrimitiveType (value, this);
- if (res != null)
- return res;
- } else if (IsPrimitive) {
- var res = IsConvertibleToPrimitiveType (value, this);
- if (res != null)
- return res;
- } else if (IsPointer) {
- var vtype = value.GetType ();
- if (vtype == typeof (IntPtr) || vtype == typeof (UIntPtr))
- return value;
- }
-
- failed = true;
- return null;
- }
-
- // Binder uses some incompatible conversion rules. For example
- // int value cannot be used with decimal parameter but in other
- // ways it's more flexible than normal convertor, for example
- // long value can be used with int based enum
- static object IsConvertibleToPrimitiveType (object value, Type targetType)
- {
- var type = value.GetType ();
- if (type.IsEnum) {
- type = Enum.GetUnderlyingType (type);
- if (type == targetType)
- return value;
- }
-
- var from = Type.GetTypeCode (type);
- var to = Type.GetTypeCode (targetType);
-
- switch (to) {
- case TypeCode.Char:
- switch (from) {
- case TypeCode.Byte:
- return (Char) (Byte) value;
- case TypeCode.UInt16:
- return value;
- }
- break;
- case TypeCode.Int16:
- switch (from) {
- case TypeCode.Byte:
- return (Int16) (Byte) value;
- case TypeCode.SByte:
- return (Int16) (SByte) value;
- }
- break;
- case TypeCode.UInt16:
- switch (from) {
- case TypeCode.Byte:
- return (UInt16) (Byte) value;
- case TypeCode.Char:
- return value;
- }
- break;
- case TypeCode.Int32:
- switch (from) {
- case TypeCode.Byte:
- return (Int32) (Byte) value;
- case TypeCode.SByte:
- return (Int32) (SByte) value;
- case TypeCode.Char:
- return (Int32) (Char) value;
- case TypeCode.Int16:
- return (Int32) (Int16) value;
- case TypeCode.UInt16:
- return (Int32) (UInt16) value;
- }
- break;
- case TypeCode.UInt32:
- switch (from) {
- case TypeCode.Byte:
- return (UInt32) (Byte) value;
- case TypeCode.Char:
- return (UInt32) (Char) value;
- case TypeCode.UInt16:
- return (UInt32) (UInt16) value;
- }
- break;
- case TypeCode.Int64:
- switch (from) {
- case TypeCode.Byte:
- return (Int64) (Byte) value;
- case TypeCode.SByte:
- return (Int64) (SByte) value;
- case TypeCode.Int16:
- return (Int64) (Int16) value;
- case TypeCode.Char:
- return (Int64) (Char) value;
- case TypeCode.UInt16:
- return (Int64) (UInt16) value;
- case TypeCode.Int32:
- return (Int64) (Int32) value;
- case TypeCode.UInt32:
- return (Int64) (UInt32) value;
- }
- break;
- case TypeCode.UInt64:
- switch (from) {
- case TypeCode.Byte:
- return (UInt64) (Byte) value;
- case TypeCode.Char:
- return (UInt64) (Char) value;
- case TypeCode.UInt16:
- return (UInt64) (UInt16) value;
- case TypeCode.UInt32:
- return (UInt64) (UInt32) value;
- }
- break;
- case TypeCode.Single:
- switch (from) {
- case TypeCode.Byte:
- return (Single) (Byte) value;
- case TypeCode.SByte:
- return (Single) (SByte) value;
- case TypeCode.Int16:
- return (Single) (Int16) value;
- case TypeCode.Char:
- return (Single) (Char) value;
- case TypeCode.UInt16:
- return (Single) (UInt16) value;
- case TypeCode.Int32:
- return (Single) (Int32) value;
- case TypeCode.UInt32:
- return (Single) (UInt32) value;
- case TypeCode.Int64:
- return (Single) (Int64) value;
- case TypeCode.UInt64:
- return (Single) (UInt64) value;
- }
- break;
- case TypeCode.Double:
- switch (from) {
- case TypeCode.Byte:
- return (Double) (Byte) value;
- case TypeCode.SByte:
- return (Double) (SByte) value;
- case TypeCode.Char:
- return (Double) (Char) value;
- case TypeCode.Int16:
- return (Double) (Int16) value;
- case TypeCode.UInt16:
- return (Double) (UInt16) value;
- case TypeCode.Int32:
- return (Double) (Int32) value;
- case TypeCode.UInt32:
- return (Double) (UInt32) value;
- case TypeCode.Int64:
- return (Double) (Int64) value;
- case TypeCode.UInt64:
- return (Double) (UInt64) value;
- case TypeCode.Single:
- return (Double) (Single) value;
- }
- break;
- }
-
- // Everything else is rejected
- return null;
- }
-
- protected ListBuilder<MethodInfo> GetMethodCandidates (MethodInfo[] cache, BindingFlags bindingAttr, CallingConventions callConv, Type[] types)
- {
- var candidates = new ListBuilder<MethodInfo> ();
-
- for (int i = 0; i < cache.Length; i++) {
- var methodInfo = cache[i];
- if (FilterApplyMethodBase(methodInfo, /*methodInfo.BindingFlags,*/ bindingAttr, callConv, types)) {
- candidates.Add (methodInfo);
- }
- }
-
- return candidates;
- }
-
- private static bool FilterApplyConstructorInfo(
- RuntimeConstructorInfo constructor, BindingFlags bindingFlags, CallingConventions callConv, Type[] argumentTypes)
- {
- // Optimization: Pre-Calculate the method binding flags to avoid casting.
- return FilterApplyMethodBase(constructor, /*constructor.BindingFlags,*/ bindingFlags, callConv, argumentTypes);
- }
-
- private static bool FilterApplyMethodBase(
- MethodBase methodBase, /*BindingFlags methodFlags,*/ BindingFlags bindingFlags, CallingConventions callConv, Type[] argumentTypes)
- {
- Contract.Requires(methodBase != null);
-
- bindingFlags ^= BindingFlags.DeclaredOnly;
-/*
- #region Apply Base Filter
- if ((bindingFlags & methodFlags) != methodFlags)
- return false;
- #endregion
-*/
- #region Check CallingConvention
- if ((callConv & CallingConventions.Any) == 0)
- {
- if ((callConv & CallingConventions.VarArgs) != 0 &&
- (methodBase.CallingConvention & CallingConventions.VarArgs) == 0)
- return false;
-
- if ((callConv & CallingConventions.Standard) != 0 &&
- (methodBase.CallingConvention & CallingConventions.Standard) == 0)
- return false;
- }
- #endregion
-
- #region If argumentTypes supplied
- if (argumentTypes != null)
- {
- ParameterInfo[] parameterInfos = methodBase.GetParametersNoCopy();
-
- if (argumentTypes.Length != parameterInfos.Length)
- {
- #region Invoke Member, Get\Set & Create Instance specific case
- // If the number of supplied arguments differs than the number in the signature AND
- // we are not filtering for a dynamic call -- InvokeMethod or CreateInstance -- filter out the method.
- if ((bindingFlags &
- (BindingFlags.InvokeMethod | BindingFlags.CreateInstance | BindingFlags.GetProperty | BindingFlags.SetProperty)) == 0)
- return false;
-
- bool testForParamArray = false;
- bool excessSuppliedArguments = argumentTypes.Length > parameterInfos.Length;
-
- if (excessSuppliedArguments)
- { // more supplied arguments than parameters, additional arguments could be vararg
- #region Varargs
- // If method is not vararg, additional arguments can not be passed as vararg
- if ((methodBase.CallingConvention & CallingConventions.VarArgs) == 0)
- {
- testForParamArray = true;
- }
- else
- {
- // If Binding flags did not include varargs we would have filtered this vararg method.
- // This Invariant established during callConv check.
- Contract.Assert((callConv & CallingConventions.VarArgs) != 0);
- }
- #endregion
- }
- else
- {// fewer supplied arguments than parameters, missing arguments could be optional
- #region OptionalParamBinding
- if ((bindingFlags & BindingFlags.OptionalParamBinding) == 0)
- {
- testForParamArray = true;
- }
- else
- {
- // From our existing code, our policy here is that if a parameterInfo
- // is optional then all subsequent parameterInfos shall be optional.
-
- // Thus, iff the first parameterInfo is not optional then this MethodInfo is no longer a canidate.
- if (!parameterInfos[argumentTypes.Length].IsOptional)
- testForParamArray = true;
- }
- #endregion
- }
-
- #region ParamArray
- if (testForParamArray)
- {
- if (parameterInfos.Length == 0)
- return false;
-
- // The last argument of the signature could be a param array.
- bool shortByMoreThanOneSuppliedArgument = argumentTypes.Length < parameterInfos.Length - 1;
-
- if (shortByMoreThanOneSuppliedArgument)
- return false;
-
- ParameterInfo lastParameter = parameterInfos[parameterInfos.Length - 1];
-
- if (!lastParameter.ParameterType.IsArray)
- return false;
-
- if (!lastParameter.IsDefined(typeof(ParamArrayAttribute), false))
- return false;
- }
- #endregion
-
- #endregion
- }
- else
- {
- #region Exact Binding
- if ((bindingFlags & BindingFlags.ExactBinding) != 0)
- {
- // Legacy behavior is to ignore ExactBinding when InvokeMember is specified.
- // Why filter by InvokeMember? If the answer is we leave this to the binder then why not leave
- // all the rest of this to the binder too? Further, what other semanitc would the binder
- // use for BindingFlags.ExactBinding besides this one? Further, why not include CreateInstance
- // in this if statement? That's just InvokeMethod with a constructor, right?
- if ((bindingFlags & (BindingFlags.InvokeMethod)) == 0)
- {
- for(int i = 0; i < parameterInfos.Length; i ++)
- {
- // a null argument type implies a null arg which is always a perfect match
- if ((object)argumentTypes[i] != null && !Object.ReferenceEquals(parameterInfos[i].ParameterType, argumentTypes[i]))
- return false;
- }
- }
- }
- #endregion
- }
- }
- #endregion
-
- return true;
- }
-
- [System.Security.SecurityCritical] // auto-generated
- internal Object CreateInstanceImpl(
- BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, ref StackCrawlMark stackMark)
- {
- CreateInstanceCheckThis();
-
- Object server = null;
-
- try
- {
- try
- {
- // Store the activation attributes in thread local storage.
- // These attributes are later picked up by specialized
- // activation services like remote activation services to
- // influence the activation.
-#if FEATURE_REMOTING
- if(null != activationAttributes)
- {
- ActivationServices.PushActivationAttributes(this, activationAttributes);
- }
-#endif
-
- if (args == null)
- args = EmptyArray<Object>.Value;
-
- int argCnt = args.Length;
-
- // Without a binder we need to do use the default binder...
- if (binder == null)
- binder = DefaultBinder;
-
- // deal with the __COMObject case first. It is very special because from a reflection point of view it has no ctors
- // so a call to GetMemberCons would fail
- if (argCnt == 0 && (bindingAttr & BindingFlags.Public) != 0 && (bindingAttr & BindingFlags.Instance) != 0
- && (IsGenericCOMObjectImpl() || IsValueType))
- {
- server = CreateInstanceDefaultCtor((bindingAttr & BindingFlags.NonPublic) == 0 , false, true, ref stackMark);
- }
- else
- {
- ConstructorInfo[] candidates = GetConstructors(bindingAttr);
- List<MethodBase> matches = new List<MethodBase>(candidates.Length);
-
- // We cannot use Type.GetTypeArray here because some of the args might be null
- Type[] argsType = new Type[argCnt];
- for (int i = 0; i < argCnt; i++)
- {
- if (args[i] != null)
- {
- argsType[i] = args[i].GetType();
- }
- }
-
- for(int i = 0; i < candidates.Length; i ++)
- {
- if (FilterApplyConstructorInfo((RuntimeConstructorInfo)candidates[i], bindingAttr, CallingConventions.Any, argsType))
- matches.Add(candidates[i]);
- }
-
- MethodBase[] cons = new MethodBase[matches.Count];
- matches.CopyTo(cons);
- if (cons != null && cons.Length == 0)
- cons = null;
-
- if (cons == null)
- {
- // Null out activation attributes before throwing exception
-#if FEATURE_REMOTING
- if(null != activationAttributes)
- {
- ActivationServices.PopActivationAttributes(this);
- activationAttributes = null;
- }
-#endif
- throw new MissingMethodException(Environment.GetResourceString("MissingConstructor_Name", FullName));
- }
-
- MethodBase invokeMethod;
- Object state = null;
-
- try
- {
- invokeMethod = binder.BindToMethod(bindingAttr, cons, ref args, null, culture, null, out state);
- }
- catch (MissingMethodException) { invokeMethod = null; }
-
- if (invokeMethod == null)
- {
-#if FEATURE_REMOTING
- // Null out activation attributes before throwing exception
- if(null != activationAttributes)
- {
- ActivationServices.PopActivationAttributes(this);
- activationAttributes = null;
- }
-#endif
- throw new MissingMethodException(Environment.GetResourceString("MissingConstructor_Name", FullName));
- }
-
- // If we're creating a delegate, we're about to call a
- // constructor taking an integer to represent a target
- // method. Since this is very difficult (and expensive)
- // to verify, we're just going to demand UnmanagedCode
- // permission before allowing this. Partially trusted
- // clients can instead use Delegate.CreateDelegate,
- // which allows specification of the target method via
- // name or MethodInfo.
- //if (isDelegate)
- if (RuntimeType.DelegateType.IsAssignableFrom(invokeMethod.DeclaringType))
- {
-#if FEATURE_CORECLR
- // In CoreCLR, CAS is not exposed externally. So what we really are looking
- // for is to see if the external caller of this API is transparent or not.
- // We get that information from the fact that a Demand will succeed only if
- // the external caller is not transparent.
- try
- {
-#pragma warning disable 618
- new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
-#pragma warning restore 618
- }
- catch
- {
- throw new NotSupportedException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("NotSupported_DelegateCreationFromPT")));
- }
-#else // FEATURE_CORECLR
- new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
-#endif // FEATURE_CORECLR
- }
-
- if (invokeMethod.GetParametersNoCopy().Length == 0)
- {
- if (args.Length != 0)
- {
-
- Contract.Assert((invokeMethod.CallingConvention & CallingConventions.VarArgs) ==
- CallingConventions.VarArgs);
- throw new NotSupportedException(String.Format(CultureInfo.CurrentCulture,
- Environment.GetResourceString("NotSupported_CallToVarArg")));
- }
-
- // fast path??
- server = Activator.CreateInstance(this, true);
- }
- else
- {
- server = ((ConstructorInfo)invokeMethod).Invoke(bindingAttr, binder, args, culture);
- if (state != null)
- binder.ReorderArgumentArray(ref args, state);
- }
- }
- }
- finally
- {
-#if FEATURE_REMOTING
- // Reset the TLS to null
- if(null != activationAttributes)
- {
- ActivationServices.PopActivationAttributes(this);
- activationAttributes = null;
- }
-#endif
- }
- }
- catch (Exception)
- {
- throw;
- }
-
- //Console.WriteLine(server);
- return server;
- }
-
- // Helper to invoke the default (parameterless) ctor.
- // fillCache is set in the SL2/3 compat mode or when called from Marshal.PtrToStructure.
- [System.Security.SecuritySafeCritical] // auto-generated
- [DebuggerStepThroughAttribute]
- [Diagnostics.DebuggerHidden]
- internal Object CreateInstanceDefaultCtor(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
- {
- if (GetType() == typeof(ReflectionOnlyType))
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInReflectionOnly"));
-
-/*
- ActivatorCache activatorCache = s_ActivatorCache;
- if (activatorCache != null)
- {
- ActivatorCacheEntry ace = activatorCache.GetEntry(this);
- if (ace != null)
- {
- if (publicOnly)
- {
- if (ace.m_ctor != null &&
- (ace.m_ctorAttributes & MethodAttributes.MemberAccessMask) != MethodAttributes.Public)
- {
- throw new MissingMethodException(Environment.GetResourceString("Arg_NoDefCTor"));
- }
- }
-
- // Allocate empty object
- Object instance = RuntimeTypeHandle.Allocate(this);
-
- // if m_ctor is null, this type doesn't have a default ctor
- Contract.Assert(ace.m_ctor != null || this.IsValueType);
-
- if (ace.m_ctor != null)
- {
- // Perform security checks if needed
- if (ace.m_bNeedSecurityCheck)
- RuntimeMethodHandle.PerformSecurityCheck(instance, ace.m_hCtorMethodHandle, this, (uint)INVOCATION_FLAGS.INVOCATION_FLAGS_CONSTRUCTOR_INVOKE);
-
- // Call ctor (value types wont have any)
- try
- {
- ace.m_ctor(instance);
- }
- catch (Exception e)
- {
- throw new TargetInvocationException(e);
- }
- }
- return instance;
- }
- }
-*/
- return CreateInstanceSlow(publicOnly, skipCheckThis, fillCache, ref stackMark);
- }
-
- // the slow path of CreateInstanceDefaultCtor
- internal Object CreateInstanceSlow(bool publicOnly, bool skipCheckThis, bool fillCache, ref StackCrawlMark stackMark)
- {
- bool bNeedSecurityCheck = true;
- bool bCanBeCached = false;
- bool bSecurityCheckOff = false;
-
- if (!skipCheckThis)
- CreateInstanceCheckThis();
-
- if (!fillCache)
- bSecurityCheckOff = true;
-
- return CreateInstanceMono (!publicOnly);
- }
-
- private void CreateInstanceCheckThis()
- {
- if (this is ReflectionOnlyType)
- throw new ArgumentException(Environment.GetResourceString("Arg_ReflectionOnlyInvoke"));
-
- if (ContainsGenericParameters)
- throw new ArgumentException(
- Environment.GetResourceString("Acc_CreateGenericEx", this));
- Contract.EndContractBlock();
-
- Type elementType = this.GetRootElementType();
-
- if (Object.ReferenceEquals(elementType, typeof(ArgIterator)))
- throw new NotSupportedException(Environment.GetResourceString("Acc_CreateArgIterator"));
-
- if (Object.ReferenceEquals(elementType, typeof(void)))
- throw new NotSupportedException(Environment.GetResourceString("Acc_CreateVoid"));
- }
-
- object CreateInstanceMono (bool nonPublic)
- {
- var ctor = GetDefaultConstructor ();
- if (!nonPublic && ctor != null && !ctor.IsPublic) {
- ctor = null;
- }
-
- if (ctor == null) {
- Type elementType = this.GetRootElementType();
- if (ReferenceEquals (elementType, typeof (TypedReference)) || ReferenceEquals (elementType, typeof (RuntimeArgumentHandle)))
- throw new NotSupportedException (Environment.GetResourceString ("NotSupported_ContainsStackPtr"));
-
- if (IsValueType)
- return CreateInstanceInternal (this);
-
- throw new MissingMethodException (Locale.GetText ("Default constructor not found for type " + FullName));
- }
-
- // TODO: .net does more checks in unmanaged land in RuntimeTypeHandle::CreateInstance
- if (IsAbstract) {
- throw new MissingMethodException (Locale.GetText ("Cannot create an abstract class '{0}'.", FullName));
- }
-
- return ctor.InternalInvoke (null, null);
- }
-
- #region Enums
- public override string[] GetEnumNames()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- String[] ret = Enum.InternalGetNames(this);
-
- // Make a copy since we can't hand out the same array since users can modify them
- String[] retVal = new String[ret.Length];
-
- Array.Copy(ret, retVal, ret.Length);
-
- return retVal;
- }
-
- [SecuritySafeCritical]
- public override Array GetEnumValues()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- // Get all of the values
- ulong[] values = Enum.InternalGetValues(this);
-
- // Create a generic Array
- Array ret = Array.UnsafeCreateInstance(this, values.Length);
-
- for (int i = 0; i < values.Length; i++)
- {
- Object val = Enum.ToObject(this, values[i]);
- ret.SetValue(val, i);
- }
-
- return ret;
- }
-
- public override Type GetEnumUnderlyingType()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- return Enum.InternalGetUnderlyingType(this);
- }
-
- public override bool IsEnumDefined(object value)
- {
- if (value == null)
- throw new ArgumentNullException("value");
- Contract.EndContractBlock();
-
- // Check if both of them are of the same type
- RuntimeType valueType = (RuntimeType)value.GetType();
-
- // If the value is an Enum then we need to extract the underlying value from it
- if (valueType.IsEnum)
- {
- if (!valueType.IsEquivalentTo(this))
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumAndObjectMustBeSameType", valueType.ToString(), this.ToString()));
-
- valueType = (RuntimeType)valueType.GetEnumUnderlyingType();
- }
-
- // If a string is passed in
- if (valueType == RuntimeType.StringType)
- {
- // Get all of the Fields, calling GetHashEntry directly to avoid copying
- string[] names = Enum.InternalGetNames(this);
- if (Array.IndexOf(names, value) >= 0)
- return true;
- else
- return false;
- }
-
- // If an enum or integer value is passed in
- if (Type.IsIntegerType(valueType))
- {
- RuntimeType underlyingType = Enum.InternalGetUnderlyingType(this);
- if (underlyingType != valueType)
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), underlyingType.ToString()));
-
- ulong[] ulValues = Enum.InternalGetValues(this);
- ulong ulValue = Enum.ToUInt64(value);
-
- return (Array.BinarySearch(ulValues, ulValue) >= 0);
- }
- else if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
- {
- // if at this point the value type is not an integer type, then its type doesn't match the enum type
- // NetCF used to throw an argument exception in this case
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), GetEnumUnderlyingType()));
- }
- else
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
- }
- }
-
- public override string GetEnumName(object value)
- {
- if (value == null)
- throw new ArgumentNullException("value");
- Contract.EndContractBlock();
-
- Type valueType = value.GetType();
-
- if (!(valueType.IsEnum || IsIntegerType(valueType)))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), "value");
-
- ulong[] ulValues = Enum.InternalGetValues(this);
- ulong ulValue = Enum.ToUInt64(value);
- int index = Array.BinarySearch(ulValues, ulValue);
-
- if (index >= 0)
- {
- string[] names = Enum.InternalGetNames(this);
- return names[index];
- }
-
- return null;
- }
- #endregion
-
- internal abstract MonoCMethod GetDefaultConstructor ();
-
- // Helper to build lists of MemberInfos. Special cased to avoid allocations for lists of one element.
- protected struct ListBuilder<T> where T : class
- {
- T[] _items;
- T _item;
- int _count;
- int _capacity;
-
- public ListBuilder(int capacity)
- {
- _items = null;
- _item = null;
- _count = 0;
- _capacity = capacity;
- }
-
- public T this[int index]
- {
- get
- {
- Contract.Requires(index < Count);
- return (_items != null) ? _items[index] : _item;
- }
-#if FEATURE_LEGACYNETCF
- // added for Dev11 466969 quirk
- set
- {
- Contract.Requires(index < Count);
- if (_items != null)
- _items[index] = value;
- else
- _item = value;
- }
-#endif
- }
-
- public T[] ToArray()
- {
- if (_count == 0)
- return EmptyArray<T>.Value;
- if (_count == 1)
- return new T[1] { _item };
-
- Array.Resize(ref _items, _count);
- _capacity = _count;
- return _items;
- }
-
- public void CopyTo(Object[] array, int index)
- {
- if (_count == 0)
- return;
-
- if (_count == 1)
- {
- array[index] = _item;
- return;
- }
-
- Array.Copy(_items, 0, array, index, _count);
- }
-
- public int Count
- {
- get
- {
- return _count;
- }
- }
-
- public void Add(T item)
- {
- if (_count == 0)
- {
- _item = item;
- }
- else
- {
- if (_count == 1)
- {
- if (_capacity < 2)
- _capacity = 4;
- _items = new T[_capacity];
- _items[0] = _item;
- }
- else
- if (_capacity == _count)
- {
- int newCapacity = 2 * _capacity;
- Array.Resize(ref _items, newCapacity);
- _capacity = newCapacity;
- }
-
- _items[_count] = item;
- }
- _count++;
- }
- }
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- static extern object CreateInstanceInternal (Type type);
- }
[Serializable]
[StructLayout (LayoutKind.Sequential)]
throw new NotImplementedException ();
}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern TypeAttributes get_attributes (Type type);
-
internal override MonoCMethod GetDefaultConstructor ()
{
MonoCMethod ctor = null;
return ctor;
}
- protected override TypeAttributes GetAttributeFlagsImpl ()
- {
- return get_attributes (this);
- }
-
- protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types,
- ParameterModifier[] modifiers)
- {
- ConstructorInfo[] candidates = GetConstructors (bindingAttr);
-
- if (candidates.Length == 0)
- return null;
-
- if (types.Length == 0 && candidates.Length == 1) {
- ConstructorInfo firstCandidate = candidates [0];
- var parameters = firstCandidate.GetParametersNoCopy ();
- if (parameters == null || parameters.Length == 0)
- return firstCandidate;
- }
-
- if ((bindingAttr & BindingFlags.ExactBinding) != 0)
- return (ConstructorInfo) System.DefaultBinder.ExactBinding (candidates, types, modifiers);
-
- if (binder == null)
- binder = DefaultBinder;
-
- return (ConstructorInfo) CheckMethodSecurity (binder.SelectMethod (bindingAttr, candidates, types, modifiers));
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern ConstructorInfo[] GetConstructors_internal (BindingFlags bindingAttr, Type reflected_type);
-
- public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr)
- {
- return GetConstructors_internal (bindingAttr, this);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern EventInfo InternalGetEvent (string name, BindingFlags bindingAttr);
-
- public override EventInfo GetEvent (string name, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
-
- return InternalGetEvent (name, bindingAttr);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern EventInfo[] GetEvents_internal (BindingFlags bindingAttr, Type reflected_type);
-
- public override EventInfo[] GetEvents (BindingFlags bindingAttr)
- {
- return GetEvents_internal (bindingAttr, this);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override FieldInfo GetField (string name, BindingFlags bindingAttr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern FieldInfo[] GetFields_internal (BindingFlags bindingAttr, Type reflected_type);
-
- public override FieldInfo[] GetFields (BindingFlags bindingAttr)
- {
- return GetFields_internal (bindingAttr, this);
- }
-
- public override Type GetInterface (string name, bool ignoreCase)
- {
- if (name == null)
- throw new ArgumentNullException ();
-
- Type[] interfaces = GetInterfaces();
-
- foreach (Type type in interfaces) {
- /*We must compare against the generic type definition*/
- Type t = type.IsGenericType ? type.GetGenericTypeDefinition () : type;
-
- if (String.Compare (t.Name, name, ignoreCase, CultureInfo.InvariantCulture) == 0)
- return type;
- if (String.Compare (t.FullName, name, ignoreCase, CultureInfo.InvariantCulture) == 0)
- return type;
- }
-
- return null;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override Type[] GetInterfaces();
-
- public override InterfaceMapping GetInterfaceMap (Type interfaceType)
- {
- if (!IsSystemType)
- throw new NotSupportedException ("Derived classes must provide an implementation.");
- if (interfaceType == null)
- throw new ArgumentNullException ("interfaceType");
- if (!interfaceType.IsSystemType)
- throw new ArgumentException ("interfaceType", "Type is an user type");
- InterfaceMapping res;
- if (!interfaceType.IsInterface)
- throw new ArgumentException (Locale.GetText ("Argument must be an interface."), "interfaceType");
- if (IsInterface)
- throw new ArgumentException ("'this' type cannot be an interface itself");
- res.TargetType = this;
- res.InterfaceType = interfaceType;
- GetInterfaceMapData (this, interfaceType, out res.TargetMethods, out res.InterfaceMethods);
- if (res.TargetMethods == null)
- throw new ArgumentException (Locale.GetText ("Interface not found"), "interfaceType");
-
- return res;
- }
-
- public override MemberInfo[] GetMembers( BindingFlags bindingAttr)
- {
- return FindMembers (MemberTypes.All, bindingAttr, null, null);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern MethodInfo [] GetMethodsByName (string name, BindingFlags bindingAttr, bool ignoreCase, Type reflected_type);
-
- public override MethodInfo [] GetMethods (BindingFlags bindingAttr)
- {
- return GetMethodsByName (null, bindingAttr, false, this);
- }
-
- protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types, ParameterModifier[] modifiers)
- {
- bool ignoreCase = ((bindingAttr & BindingFlags.IgnoreCase) != 0);
- var candidates = GetMethodCandidates (GetMethodsByName (name, bindingAttr, ignoreCase, this), bindingAttr, callConvention, types);
-
- if (candidates.Count == 0)
- return null;
-
- if (types == null || types.Length == 0) {
- var firstCandidate = candidates [0];
- if (candidates.Count == 1)
- return firstCandidate;
-
- if (types == null) {
- for (int j = 1; j < candidates.Count; j++) {
- MethodInfo methodInfo = candidates [j];
- if (!System.DefaultBinder.CompareMethodSigAndName (methodInfo, firstCandidate))
- throw new AmbiguousMatchException(Environment.GetResourceString("Arg_AmbiguousMatchException"));
- }
-
- // All the methods have the exact same name and sig so return the most derived one.
- return (MethodInfo) System.DefaultBinder.FindMostDerivedNewSlotMeth (candidates.ToArray (), candidates.Count);
- }
- }
-
- if (binder == null)
- binder = DefaultBinder;
-
- return (MethodInfo) CheckMethodSecurity (binder.SelectMethod (bindingAttr, candidates.ToArray (), types, modifiers));
- }
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern MethodInfo GetCorrespondingInflatedMethod (MethodInfo generic);
return GetField (fromNoninstanciated.Name, flags);
}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override Type GetNestedType (string name, BindingFlags bindingAttr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override Type[] GetNestedTypes (BindingFlags bindingAttr);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern PropertyInfo[] GetPropertiesByName (string name, BindingFlags bindingAttr, bool icase, Type reflected_type);
-
- public override PropertyInfo [] GetProperties (BindingFlags bindingAttr)
- {
- return GetPropertiesByName (null, bindingAttr, false, this);
- }
-
- protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr,
- Binder binder, Type returnType,
- Type[] types,
- ParameterModifier[] modifiers)
+ public override int GetHashCode()
{
- bool ignoreCase = ((bindingAttr & BindingFlags.IgnoreCase) != 0);
- PropertyInfo [] props = GetPropertiesByName (name, bindingAttr, ignoreCase, this);
- int count = props.Length;
- if (count == 0)
- return null;
-
- if (types == null || types.Length == 0) {
- if (count == 1) {
- var firstCandidate = props [0];
-
- if ((object)returnType != null && !returnType.IsEquivalentTo (firstCandidate.PropertyType))
- return null;
-
- return firstCandidate;
- }
-
- throw new AmbiguousMatchException (Environment.GetResourceString("Arg_AmbiguousMatchException"));
- }
-
- if ((bindingAttr & BindingFlags.ExactBinding) != 0)
- return System.DefaultBinder.ExactPropertyBinding (props, returnType, types, modifiers);
-
- if (binder == null)
- binder = DefaultBinder;
-
- return binder.SelectProperty (bindingAttr, props, returnType, types, modifiers);
- }
-
- protected override bool HasElementTypeImpl ()
- {
- return IsArrayImpl() || IsByRefImpl() || IsPointerImpl ();
- }
-
- protected override bool IsArrayImpl ()
- {
- return Type.IsArrayImpl (this);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- protected extern override bool IsByRefImpl ();
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- protected extern override bool IsCOMObjectImpl ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- protected extern override bool IsPointerImpl ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- protected extern override bool IsPrimitiveImpl ();
-
- public override bool IsSubclassOf (Type type)
- {
- if (type == null)
- throw new ArgumentNullException ("type");
-
- return base.IsSubclassOf (type);
- }
-
- public override object InvokeMember (string name, BindingFlags invokeAttr,
- Binder binder, object target, object[] args,
- ParameterModifier[] modifiers,
- CultureInfo culture, string[] namedParameters)
- {
- const string bindingflags_arg = "bindingFlags";
-
-
- if ((invokeAttr & BindingFlags.CreateInstance) != 0) {
- if ((invokeAttr & (BindingFlags.GetField |
- BindingFlags.GetField | BindingFlags.GetProperty |
- BindingFlags.SetProperty)) != 0)
- throw new ArgumentException (bindingflags_arg);
- } else if (name == null)
- throw new ArgumentNullException ("name");
- if ((invokeAttr & BindingFlags.GetField) != 0 && (invokeAttr & BindingFlags.SetField) != 0)
- throw new ArgumentException ("Cannot specify both Get and Set on a field.", bindingflags_arg);
- if ((invokeAttr & BindingFlags.GetProperty) != 0 && (invokeAttr & BindingFlags.SetProperty) != 0)
- throw new ArgumentException ("Cannot specify both Get and Set on a property.", bindingflags_arg);
- if ((invokeAttr & BindingFlags.InvokeMethod) != 0) {
- if ((invokeAttr & BindingFlags.SetField) != 0)
- throw new ArgumentException ("Cannot specify Set on a field and Invoke on a method.", bindingflags_arg);
- if ((invokeAttr & BindingFlags.SetProperty) != 0)
- throw new ArgumentException ("Cannot specify Set on a property and Invoke on a method.", bindingflags_arg);
- }
- if ((namedParameters != null) && ((args == null) || args.Length < namedParameters.Length))
- throw new ArgumentException ("namedParameters cannot be more than named arguments in number");
- if ((invokeAttr & (BindingFlags.InvokeMethod|BindingFlags.CreateInstance|BindingFlags.GetField|BindingFlags.SetField|BindingFlags.GetProperty|BindingFlags.SetProperty)) == 0)
- throw new ArgumentException ("Must specify binding flags describing the invoke operation required.", bindingflags_arg);
-
- /* set some defaults if none are provided :-( */
- if ((invokeAttr & (BindingFlags.Public|BindingFlags.NonPublic)) == 0)
- invokeAttr |= BindingFlags.Public;
- if ((invokeAttr & (BindingFlags.Static|BindingFlags.Instance)) == 0)
- invokeAttr |= BindingFlags.Static|BindingFlags.Instance;
-
- if (binder == null)
- binder = DefaultBinder;
-
- if ((invokeAttr & BindingFlags.CreateInstance) != 0) {
- return Activator.CreateInstance (this, invokeAttr, binder, args, culture);
- }
- if (name == String.Empty && Attribute.IsDefined (this, typeof (DefaultMemberAttribute))) {
- DefaultMemberAttribute attr = (DefaultMemberAttribute) Attribute.GetCustomAttribute (this, typeof (DefaultMemberAttribute));
- name = attr.MemberName;
- }
- bool ignoreCase = (invokeAttr & BindingFlags.IgnoreCase) != 0;
- string throwMissingMethodDescription = null;
- bool throwMissingFieldException = false;
-
- if ((invokeAttr & BindingFlags.InvokeMethod) != 0) {
- MethodInfo[] methods = GetMethodsByName (name, invokeAttr, ignoreCase, this);
- object state = null;
- if (args == null)
- args = EmptyArray<object>.Value;
- MethodBase m = binder.BindToMethod (invokeAttr, methods, ref args, modifiers, culture, namedParameters, out state);
- if (m == null) {
- if (methods.Length > 0)
- throwMissingMethodDescription = "The best match for method " + name + " has some invalid parameter.";
- else
- throwMissingMethodDescription = "Cannot find method " + name + ".";
- } else {
- ParameterInfo[] parameters = m.GetParametersInternal();
- for (int i = 0; i < parameters.Length; ++i) {
- if (System.Reflection.Missing.Value == args [i] && (parameters [i].Attributes & ParameterAttributes.HasDefault) != ParameterAttributes.HasDefault)
- throw new ArgumentException ("Used Missing.Value for argument without default value", "parameters");
- }
- object result = m.Invoke (target, invokeAttr, binder, args, culture);
- if (state != null)
- binder.ReorderArgumentArray (ref args, state);
- return result;
- }
- }
- if ((invokeAttr & BindingFlags.GetField) != 0) {
- FieldInfo f = GetField (name, invokeAttr);
- if (f != null) {
- return f.GetValue (target);
- } else if ((invokeAttr & BindingFlags.GetProperty) == 0) {
- throwMissingFieldException = true;
- }
- /* try GetProperty */
- } else if ((invokeAttr & BindingFlags.SetField) != 0) {
- FieldInfo f = GetField (name, invokeAttr);
- if (f != null) {
- if (args == null)
- throw new ArgumentNullException ("providedArgs");
- if ((args == null) || args.Length != 1)
- throw new ArgumentException ("Only the field value can be specified to set a field value.", bindingflags_arg);
- f.SetValue (target, args [0]);
- return null;
- } else if ((invokeAttr & BindingFlags.SetProperty) == 0) {
- throwMissingFieldException = true;
- }
- /* try SetProperty */
- }
- if ((invokeAttr & BindingFlags.GetProperty) != 0) {
- PropertyInfo[] properties = GetPropertiesByName (name, invokeAttr, ignoreCase, this);
- object state = null;
- if (args == null)
- args = EmptyArray<object>.Value;
- int i, count = 0;
- for (i = 0; i < properties.Length; ++i) {
- if ((properties [i].GetGetMethod (true) != null))
- count++;
- }
- MethodBase[] smethods = new MethodBase [count];
- count = 0;
- for (i = 0; i < properties.Length; ++i) {
- MethodBase mb = properties [i].GetGetMethod (true);
- if (mb != null)
- smethods [count++] = mb;
- }
- MethodBase m = count > 0 ? binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state) : null;
- if (m == null) {
- throwMissingMethodDescription = "Cannot find method `" + name + "'.";
- } else {
- object result = m.Invoke (target, invokeAttr, binder, args, culture);
- if (state != null)
- binder.ReorderArgumentArray (ref args, state);
- return result;
- }
- } else if ((invokeAttr & BindingFlags.SetProperty) != 0) {
- PropertyInfo[] properties = GetPropertiesByName (name, invokeAttr, ignoreCase, this);
- object state = null;
- int i, count = 0;
- for (i = 0; i < properties.Length; ++i) {
- if (properties [i].GetSetMethod (true) != null)
- count++;
- }
- MethodBase[] smethods = new MethodBase [count];
- count = 0;
- for (i = 0; i < properties.Length; ++i) {
- MethodBase mb = properties [i].GetSetMethod (true);
- if (mb != null)
- smethods [count++] = mb;
- }
- MethodBase m = count > 0 ? binder.BindToMethod (invokeAttr, smethods, ref args, modifiers, culture, namedParameters, out state) : null;
- if (m == null) {
- throwMissingMethodDescription = "Cannot find method `" + name + "'.";
- } else {
- object result = m.Invoke (target, invokeAttr, binder, args, culture);
- if (state != null)
- binder.ReorderArgumentArray (ref args, state);
- return result;
- }
- }
- if (throwMissingMethodDescription != null)
- throw new MissingMethodException(throwMissingMethodDescription);
- if (throwMissingFieldException)
- throw new MissingFieldException("Cannot find variable " + name + ".");
-
- return null;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override Type GetElementType ();
-
- public override Type UnderlyingSystemType {
- get {
- // This has _nothing_ to do with getting the base type of an enum etc.
- return this;
- }
- }
-
- public extern override Assembly Assembly {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public override string AssemblyQualifiedName {
- get {
- return getFullName (true, true);
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern string getFullName(bool full_name, bool assembly_qualified);
-
- public extern override Type BaseType {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
+ Type t = UnderlyingSystemType;
+ if (t != null && t != this)
+ return t.GetHashCode ();
+ return (int)_impl.Value;
}
public override string FullName {
}
}
- public override Guid GUID {
- get {
- object[] att = GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), true);
- if (att.Length == 0)
- return Guid.Empty;
- return new Guid(((System.Runtime.InteropServices.GuidAttribute)att[0]).Value);
- }
- }
-
- public override bool IsDefined (Type attributeType, bool inherit)
- {
- return MonoCustomAttrs.IsDefined (this, attributeType, inherit);
- }
-
- public override object[] GetCustomAttributes (bool inherit)
- {
- return MonoCustomAttrs.GetCustomAttributes (this, inherit);
- }
-
- public override object[] GetCustomAttributes (Type attributeType, bool inherit)
- {
- if (attributeType == null)
- {
- throw new ArgumentNullException("attributeType");
- }
-
- return MonoCustomAttrs.GetCustomAttributes (this, attributeType, inherit);
- }
-
- public override MemberTypes MemberType {
- get {
- if (DeclaringType != null && !IsGenericParameter)
- return MemberTypes.NestedType;
- else
- return MemberTypes.TypeInfo;
- }
- }
-
- public extern override string Name {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public extern override string Namespace {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public extern override Module Module {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public extern override Type DeclaringType {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public override Type ReflectedType {
- get {
- return DeclaringType;
- }
- }
-
- public override RuntimeTypeHandle TypeHandle {
- get {
- return _impl;
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override int GetArrayRank ();
-
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- UnitySerializationHolder.GetUnitySerializationInfo(info, this);
- }
-
- public override string ToString()
- {
- return getFullName (false, false);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern override Type [] GetGenericArguments ();
-
- public override bool ContainsGenericParameters {
- get {
- if (IsGenericParameter)
- return true;
-
- if (IsGenericType) {
- foreach (Type arg in GetGenericArguments ())
- if (arg.ContainsGenericParameters)
- return true;
- }
-
- if (HasElementType)
- return GetElementType ().ContainsGenericParameters;
-
- return false;
- }
- }
-
- public extern override bool IsGenericParameter {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public extern override MethodBase DeclaringMethod {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- public override Type GetGenericTypeDefinition () {
- Type res = GetGenericTypeDefinition_impl ();
- if (res == null)
- throw new InvalidOperationException ();
-
- return res;
- }
-
- public override IList<CustomAttributeData> GetCustomAttributesData () {
- return CustomAttributeData.GetCustomAttributes (this);
- }
-
-
- public override Array GetEnumValues ()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- // Get all of the values
- ulong[] values = Enum.InternalGetValues(this);
-
- // Create a generic Array
- Array ret = Array.UnsafeCreateInstance(this, values.Length);
-
- for (int i = 0; i < values.Length; i++)
- {
- Object val = Enum.ToObject(this, values[i]);
- ret.SetValue(val, i);
- }
-
- return ret;
- }
-
- static MethodBase CheckMethodSecurity (MethodBase mb)
- {
-#if NET_2_1
- return mb;
-#else
- if (!SecurityManager.SecurityEnabled || (mb == null))
- return mb;
-
- // Sadly we have no way to know which kind of security action this is
- // so we must do it the hard way. Actually this isn't so bad
- // because we can skip the (mb.Attributes & MethodAttributes.HasSecurity)
- // icall required (and do it ourselves)
-
- // this (unlike the Invoke step) is _and stays_ a LinkDemand (caller)
- return SecurityManager.ReflectedLinkDemandQuery (mb) ? mb : null;
-#endif
- }
-
- //seclevel { transparent = 0, safe-critical = 1, critical = 2}
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- public extern int get_core_clr_security_level ();
-
- public override bool IsSecurityTransparent
- {
- get { return get_core_clr_security_level () == 0; }
- }
-
- public override bool IsSecurityCritical
- {
- get { return get_core_clr_security_level () > 0; }
- }
-
- public override bool IsSecuritySafeCritical
- {
- get { return get_core_clr_security_level () == 1; }
- }
-
- public override StructLayoutAttribute StructLayoutAttribute {
- get {
- return GetStructLayoutAttribute ();
- }
- }
-
internal override bool IsUserType {
get {
return false;
}
}
-
- public override bool IsConstructedGenericType {
- get {
- return IsGenericType && !ContainsGenericParameters;
- }
- }
}
}
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Runtime.ConstrainedExecution;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Reflection;
+using System.Diagnostics.Contracts;
namespace System
{
value = val;
}
+ internal RuntimeTypeHandle (RuntimeType type)
+ : this (type._impl.value)
+ {
+ }
+
RuntimeTypeHandle (SerializationInfo info, StreamingContext context)
{
if (info == null)
return (left == null) || !(left is RuntimeTypeHandle) || !((RuntimeTypeHandle)left).Equals (right);
}
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal static extern TypeAttributes GetAttributes (RuntimeType type);
+
[CLSCompliant (false)]
[ReliabilityContractAttribute (Consistency.WillNotCorruptState, Cer.Success)]
public ModuleHandle GetModuleHandle ()
return Type.GetTypeFromHandle (this).Module.ModuleHandle;
}
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern int GetMetadataToken (RuntimeType type);
+
+ internal static int GetToken (RuntimeType type)
+ {
+ return GetMetadataToken (type);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ extern static Type GetGenericTypeDefinition_impl (RuntimeType type);
+
+ internal static Type GetGenericTypeDefinition (RuntimeType type)
+ {
+ return GetGenericTypeDefinition_impl (type);
+ }
+
+ internal static bool HasElementType (RuntimeType type)
+ {
+ return IsArray (type) || IsByRef (type) || IsPointer (type);
+ }
+
+ internal static bool HasProxyAttribute (RuntimeType type)
+ {
+ throw new NotImplementedException ("HasProxyAttribute");
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool HasInstantiation (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsArray(RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsByRef (RuntimeType type);
+
+ [MethodImplAttribute (MethodImplOptions.InternalCall)]
+ internal extern static bool IsComObject (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsInstanceOfType (RuntimeType type, Object o);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsPointer (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsPrimitive (RuntimeType type);
+
+ internal static bool IsComObject (RuntimeType type, bool isGenericCOM)
+ {
+ return isGenericCOM ? false : IsComObject (type);
+ }
+
+ internal static bool IsContextful (RuntimeType type)
+ {
+ return typeof (ContextBoundObject).IsAssignableFrom (type);
+ }
+
+ internal static bool IsEquivalentTo (RuntimeType rtType1, RuntimeType rtType2)
+ {
+ // refence check is done earlier and we don't recognize anything else
+ return false;
+ }
+
+ internal static bool IsSzArray(RuntimeType type)
+ {
+ // TODO: Better check
+ return IsArray (type) && type.GetArrayRank () == 1;
+ }
+
+ internal static bool IsVisible (RuntimeType type)
+ {
+ return type.IsPublic;
+ }
+
+ internal static bool IsInterface (RuntimeType type)
+ {
+ return (type.Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface;
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static int GetArrayRank(RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static RuntimeAssembly GetAssembly (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static RuntimeType GetElementType (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static RuntimeModule GetModule (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsGenericVariable (RuntimeType type);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static RuntimeType GetBaseType (RuntimeType type);
+
+ internal static bool CanCastTo (RuntimeType type, RuntimeType target)
+ {
+ return type_is_assignable_from (target, type);
+ }
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ static extern bool type_is_assignable_from (Type a, Type b);
+
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ internal extern static bool IsGenericTypeDefinition (RuntimeType type);
}
}
//Transitions are in UTC
DateTime date = dateTime;
- if (dateTime.Kind == DateTimeKind.Local && this != TimeZoneInfo.Local)
- date = date.ToUniversalTime () + BaseUtcOffset;
+ if (dateTime.Kind == DateTimeKind.Local && this != TimeZoneInfo.Local) {
+ var ticks = date.ToUniversalTime ().Ticks + BaseUtcOffset.Ticks;
+ if (ticks < DateTime.MinValue.Ticks || ticks > DateTime.MaxValue.Ticks)
+ return false;
+
+ date = new DateTime (ticks, DateTimeKind.Utc);
+ }
if (dateTime.Kind != DateTimeKind.Utc) {
- if (date.Ticks < BaseUtcOffset.Ticks)
+ var ticks = date.Ticks - BaseUtcOffset.Ticks;
+ if (ticks < DateTime.MinValue.Ticks || ticks > DateTime.MaxValue.Ticks)
return false;
- date = date - BaseUtcOffset;
+
+ date = new DateTime (ticks, DateTimeKind.Utc);
}
for (var i = transitions.Count - 1; i >= 0; i--) {
+++ /dev/null
-//
-// System.Type.cs
-//
-// Authors:
-// Miguel de Icaza (miguel@ximian.com)
-// Marek Safar (marek.safar@gmail.com)
-//
-// (C) Ximian, Inc. http://www.ximian.com
-//
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System.Diagnostics;
-using System.Reflection;
-#if !FULL_AOT_RUNTIME
-using System.Reflection.Emit;
-#endif
-using System.Collections;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Threading;
-using System.Globalization;
-using System.Diagnostics.Contracts;
-
-namespace System {
-
- [Serializable]
- [ClassInterface (ClassInterfaceType.None)]
- [ComVisible (true)]
- [ComDefaultInterface (typeof (_Type))]
- [StructLayout (LayoutKind.Sequential)]
-#if MOBILE
- public abstract class Type : MemberInfo, IReflect {
-#else
- public abstract class Type : MemberInfo, IReflect, _Type {
-#endif
-
- internal RuntimeTypeHandle _impl;
-
- public static readonly char Delimiter = '.';
- public static readonly Type[] EmptyTypes = {};
- public static readonly MemberFilter FilterAttribute = new MemberFilter (FilterAttribute_impl);
- public static readonly MemberFilter FilterName = new MemberFilter (FilterName_impl);
- public static readonly MemberFilter FilterNameIgnoreCase = new MemberFilter (FilterNameIgnoreCase_impl);
- public static readonly object Missing = System.Reflection.Missing.Value;
-
- internal const BindingFlags DefaultBindingFlags =
- BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance;
-
- /* implementation of the delegates for MemberFilter */
- static bool FilterName_impl (MemberInfo m, object filterCriteria)
- {
- string name = (string) filterCriteria;
- if (name == null || name.Length == 0 )
- return false; // because m.Name cannot be null or empty
-
- if (name [name.Length - 1] == '*')
- return m.Name.StartsWithOrdinalUnchecked (name.Substring (0, name.Length - 1));
-
- return m.Name == name;
- }
-
- static bool FilterNameIgnoreCase_impl (MemberInfo m, object filterCriteria)
- {
- string name = (string) filterCriteria;
- if (name == null || name.Length == 0 )
- return false; // because m.Name cannot be null or empty
-
- if (name [name.Length - 1] == '*')
- return m.Name.StartsWithOrdinalCaseInsensitiveUnchecked (name.Substring (0, name.Length - 1));
-
- return string.CompareOrdinalCaseInsensitiveUnchecked (m.Name, name) == 0;
- }
-
- static bool FilterAttribute_impl (MemberInfo m, object filterCriteria)
- {
- if (!(filterCriteria is int))
- throw new InvalidFilterCriteriaException ("Int32 value is expected for filter criteria");
-
- int flags = (int) filterCriteria;
- if (m is MethodInfo)
- return ((int)((MethodInfo)m).Attributes & flags) != 0;
- if (m is FieldInfo)
- return ((int)((FieldInfo)m).Attributes & flags) != 0;
- if (m is PropertyInfo)
- return ((int)((PropertyInfo)m).Attributes & flags) != 0;
- if (m is EventInfo)
- return ((int)((EventInfo)m).Attributes & flags) != 0;
- return false;
- }
-
- protected Type ()
- {
- }
-
- /// <summary>
- /// The assembly where the type is defined.
- /// </summary>
- public abstract Assembly Assembly {
- get;
- }
-
- /// <summary>
- /// Gets the fully qualified name for the type including the
- /// assembly name where the type is defined.
- /// </summary>
- public abstract string AssemblyQualifiedName {
- get;
- }
-
- /// <summary>
- /// Returns the Attributes associated with the type.
- /// </summary>
- public TypeAttributes Attributes {
- get {
- return GetAttributeFlagsImpl ();
- }
- }
-
- /// <summary>
- /// Returns the basetype for this type
- /// </summary>
- public abstract Type BaseType {
- get;
- }
-
- /// <summary>
- /// Returns the class that declares the member.
- /// </summary>
- public override Type DeclaringType {
- get {
- return null;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public static Binder DefaultBinder {
- get {
- if (defaultBinder == null)
- Interlocked.CompareExchange<Binder> (ref defaultBinder, new DefaultBinder (), null);
-
- return defaultBinder;
- }
- }
-
- static Binder defaultBinder;
-
- /// <summary>
- /// The full name of the type including its namespace
- /// </summary>
- public abstract string FullName {
- get;
- }
-
- public abstract Guid GUID {
- get;
- }
-
- public bool HasElementType {
- get {
- return HasElementTypeImpl ();
- }
- }
-
- public bool IsAbstract {
- get {
- return (Attributes & TypeAttributes.Abstract) != 0;
- }
- }
-
- public bool IsAnsiClass {
- get {
- return (Attributes & TypeAttributes.StringFormatMask)
- == TypeAttributes.AnsiClass;
- }
- }
-
- public bool IsArray {
- get {
- return IsArrayImpl ();
- }
- }
-
- public bool IsAutoClass {
- get {
- return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.AutoClass;
- }
- }
-
- public bool IsAutoLayout {
- get {
- return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.AutoLayout;
- }
- }
-
- public bool IsByRef {
- get {
- return IsByRefImpl ();
- }
- }
-
- public bool IsClass {
- get {
- if (IsInterface)
- return false;
-
- return !IsValueType;
- }
- }
-
- public bool IsCOMObject {
- get {
- return IsCOMObjectImpl ();
- }
- }
-
- public virtual bool IsConstructedGenericType {
- get {
- throw new NotImplementedException ();
- }
- }
-
- public bool IsContextful {
- get {
- return IsContextfulImpl ();
- }
- }
-
- public
- virtual
- bool IsEnum {
- get {
- return IsSubclassOf (typeof (Enum));
- }
- }
-
- public bool IsExplicitLayout {
- get {
- return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.ExplicitLayout;
- }
- }
-
- public bool IsImport {
- get {
- return (Attributes & TypeAttributes.Import) != 0;
- }
- }
-
- public bool IsInterface {
- get {
- return (Attributes & TypeAttributes.ClassSemanticsMask) == TypeAttributes.Interface;
- }
- }
-
- public bool IsLayoutSequential {
- get {
- return (Attributes & TypeAttributes.LayoutMask) == TypeAttributes.SequentialLayout;
- }
- }
-
- public bool IsMarshalByRef {
- get {
- return IsMarshalByRefImpl ();
- }
- }
-
- public bool IsNestedAssembly {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedAssembly;
- }
- }
-
- public bool IsNestedFamANDAssem {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamANDAssem;
- }
- }
-
- public bool IsNestedFamily {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamily;
- }
- }
-
- public bool IsNestedFamORAssem {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedFamORAssem;
- }
- }
-
- public bool IsNestedPrivate {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPrivate;
- }
- }
-
- public bool IsNestedPublic {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NestedPublic;
- }
- }
-
- public bool IsNotPublic {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.NotPublic;
- }
- }
-
- public bool IsPointer {
- get {
- return IsPointerImpl ();
- }
- }
-
- public bool IsPrimitive {
- get {
- return IsPrimitiveImpl ();
- }
- }
-
- public bool IsPublic {
- get {
- return (Attributes & TypeAttributes.VisibilityMask) == TypeAttributes.Public;
- }
- }
-
- public bool IsSealed {
- get {
- return (Attributes & TypeAttributes.Sealed) != 0;
- }
- }
-
- public
- virtual
- bool IsSerializable {
- get {
- if ((Attributes & TypeAttributes.Serializable) != 0)
- return true;
-
- // Enums and delegates are always serializable
-
- Type type = UnderlyingSystemType;
- if (type == null)
- return false;
-
- // Fast check for system types
- if (type.IsSystemType)
- return type_is_subtype_of (type, typeof (Enum), false) || type_is_subtype_of (type, typeof (Delegate), false);
-
- // User defined types depend on this behavior
- do {
- if ((type == typeof (Enum)) || (type == typeof (Delegate)))
- return true;
-
- type = type.BaseType;
- } while (type != null);
-
- return false;
- }
- }
-
- public bool IsSpecialName {
- get {
- return (Attributes & TypeAttributes.SpecialName) != 0;
- }
- }
-
- public bool IsUnicodeClass {
- get {
- return (Attributes & TypeAttributes.StringFormatMask) == TypeAttributes.UnicodeClass;
- }
- }
-
- public bool IsValueType {
- get {
- return IsValueTypeImpl ();
- }
- }
-
- public override MemberTypes MemberType {
- get {
- return MemberTypes.TypeInfo;
- }
- }
-
- public abstract override Module Module {
- get;
- }
-
- public abstract string Namespace {get;}
-
- public override Type ReflectedType {
- get {
- return null;
- }
- }
-
- public virtual RuntimeTypeHandle TypeHandle {
- get { throw new ArgumentException ("Derived class must provide implementation."); }
- }
-
- [ComVisible (true)]
- public ConstructorInfo TypeInitializer {
- get {
- return GetConstructorImpl (
- BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static,
- null,
- CallingConventions.Any,
- EmptyTypes,
- null);
- }
- }
-
- /*
- * This has NOTHING to do with getting the base type of an enum. Use
- * Enum.GetUnderlyingType () for that.
- */
- public abstract Type UnderlyingSystemType {get;}
-
- public override bool Equals (object o)
- {
- return Equals (o as Type);
- }
-
- public virtual bool Equals (Type o)
- {
- if ((object)o == (object)this)
- return true;
- if ((object)o == null)
- return false;
- Type me = UnderlyingSystemType;
- if ((object)me == null)
- return false;
-
- o = o.UnderlyingSystemType;
- if ((object)o == null)
- return false;
- if ((object)o == (object)this)
- return true;
- return me.EqualsInternal (o);
- }
- [MonoTODO ("Implement it properly once 4.0 impl details are known.")]
- public static bool operator == (Type left, Type right)
- {
- return Object.ReferenceEquals (left, right);
- }
-
- [MonoTODO ("Implement it properly once 4.0 impl details are known.")]
- public static bool operator != (Type left, Type right)
- {
- return !Object.ReferenceEquals (left, right);
- }
-
- static NotImplementedException CreateNIE () {
- return new NotImplementedException ();
- }
-
- public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver)
- {
- return GetType (typeName, assemblyResolver, typeResolver, false, false);
- }
-
- public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver, bool throwOnError)
- {
- return GetType (typeName, assemblyResolver, typeResolver, throwOnError, false);
- }
-
- public static Type GetType (string typeName, Func<AssemblyName,Assembly> assemblyResolver, Func<Assembly,string,bool,Type> typeResolver, bool throwOnError, bool ignoreCase)
- {
- TypeSpec spec = TypeSpec.Parse (typeName);
- return spec.Resolve (assemblyResolver, typeResolver, throwOnError, ignoreCase);
- }
-
- public virtual bool IsSecurityTransparent
- {
- get { throw CreateNIE (); }
- }
-
- public virtual bool IsSecurityCritical
- {
- get { throw CreateNIE (); }
- }
-
- public virtual bool IsSecuritySafeCritical
- {
- get { throw CreateNIE (); }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern bool EqualsInternal (Type type);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern Type internal_from_handle (IntPtr handle);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private static extern Type internal_from_name (string name, bool throwOnError, bool ignoreCase);
-
- public static Type GetType(string typeName)
- {
- if (typeName == null)
- throw new ArgumentNullException ("TypeName");
-
- return internal_from_name (typeName, false, false);
- }
-
- public static Type GetType(string typeName, bool throwOnError)
- {
- if (typeName == null)
- throw new ArgumentNullException ("TypeName");
-
- Type type = internal_from_name (typeName, throwOnError, false);
- if (throwOnError && type == null)
- throw new TypeLoadException ("Error loading '" + typeName + "'");
-
- return type;
- }
-
- public static Type GetType(string typeName, bool throwOnError, bool ignoreCase)
- {
- if (typeName == null)
- throw new ArgumentNullException ("TypeName");
-
- Type t = internal_from_name (typeName, throwOnError, ignoreCase);
- if (throwOnError && t == null)
- throw new TypeLoadException ("Error loading '" + typeName + "'");
-
- return t;
- }
-
- public static Type[] GetTypeArray (object[] args) {
- if (args == null)
- throw new ArgumentNullException ("args");
-
- Type[] ret;
- ret = new Type [args.Length];
- for (int i = 0; i < args.Length; ++i)
- ret [i] = args[i].GetType ();
- return ret;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern static TypeCode GetTypeCodeInternal (Type type);
-
- protected virtual
- TypeCode GetTypeCodeImpl () {
- Type type = this;
- if (type is MonoType)
- return GetTypeCodeInternal (type);
-#if !FULL_AOT_RUNTIME
- if (type is TypeBuilder)
- return ((TypeBuilder)type).GetTypeCodeInternal ();
-#endif
-
- type = type.UnderlyingSystemType;
-
- if (!type.IsSystemType)
- return TypeCode.Object;
- else
- return GetTypeCodeInternal (type);
- }
-
- public static TypeCode GetTypeCode (Type type) {
- if (type == null)
- /* MS.NET returns this */
- return TypeCode.Empty;
- return type.GetTypeCodeImpl ();
- }
-
-#if !FULL_AOT_RUNTIME
- private static Dictionary<Guid, Type> clsid_types;
- private static AssemblyBuilder clsid_assemblybuilder;
-#endif
-
- [MonoTODO("COM servers only work on Windows")]
- public static Type GetTypeFromCLSID (Guid clsid)
- {
- return GetTypeFromCLSID (clsid, null, true);
- }
-
- [MonoTODO("COM servers only work on Windows")]
- public static Type GetTypeFromCLSID (Guid clsid, bool throwOnError)
- {
- return GetTypeFromCLSID (clsid, null, throwOnError);
- }
-
- [MonoTODO("COM servers only work on Windows")]
- public static Type GetTypeFromCLSID (Guid clsid, string server)
- {
- return GetTypeFromCLSID (clsid, server, true);
- }
-
- [MonoTODO("COM servers only work on Windows")]
- public static Type GetTypeFromCLSID (Guid clsid, string server, bool throwOnError)
- {
-#if !FULL_AOT_RUNTIME
- Type result;
-
- if (clsid_types == null)
- {
- Dictionary<Guid, Type> new_clsid_types = new Dictionary<Guid, Type> ();
- Interlocked.CompareExchange<Dictionary<Guid, Type>>(
- ref clsid_types, new_clsid_types, null);
- }
-
- lock (clsid_types) {
- if (clsid_types.TryGetValue(clsid, out result))
- return result;
-
- if (clsid_assemblybuilder == null)
- {
- AssemblyName assemblyname = new AssemblyName ();
- assemblyname.Name = "GetTypeFromCLSIDDummyAssembly";
- clsid_assemblybuilder = AppDomain.CurrentDomain.DefineDynamicAssembly (
- assemblyname, AssemblyBuilderAccess.Run);
- }
- ModuleBuilder modulebuilder = clsid_assemblybuilder.DefineDynamicModule (
- clsid.ToString ());
-
- TypeBuilder typebuilder = modulebuilder.DefineType ("System.__ComObject",
- TypeAttributes.Public | TypeAttributes.Class, typeof(System.__ComObject));
-
- Type[] guidattrtypes = new Type[] { typeof(string) };
-
- CustomAttributeBuilder customattr = new CustomAttributeBuilder (
- typeof(GuidAttribute).GetConstructor (guidattrtypes),
- new object[] { clsid.ToString () });
-
- typebuilder.SetCustomAttribute (customattr);
-
- customattr = new CustomAttributeBuilder (
- typeof(ComImportAttribute).GetConstructor (EmptyTypes),
- new object[0] {});
-
- typebuilder.SetCustomAttribute (customattr);
-
- result = typebuilder.CreateType ();
-
- clsid_types.Add(clsid, result);
-
- return result;
- }
-#else
- throw new NotImplementedException ();
-#endif
- }
-
- public static Type GetTypeFromHandle (RuntimeTypeHandle handle)
- {
- if (handle.Value == IntPtr.Zero)
- // This is not consistent with the other GetXXXFromHandle methods, but
- // MS.NET seems to do this
- return null;
-
- return internal_from_handle (handle.Value);
- }
-
- [MonoTODO("Mono does not support COM")]
- public static Type GetTypeFromProgID (string progID)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO("Mono does not support COM")]
- public static Type GetTypeFromProgID (string progID, bool throwOnError)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO("Mono does not support COM")]
- public static Type GetTypeFromProgID (string progID, string server)
- {
- throw new NotImplementedException ();
- }
-
- [MonoTODO("Mono does not support COM")]
- public static Type GetTypeFromProgID (string progID, string server, bool throwOnError)
- {
- throw new NotImplementedException ();
- }
-
- public static RuntimeTypeHandle GetTypeHandle (object o)
- {
- if (o == null)
- throw new ArgumentNullException ();
-
- return o.GetType().TypeHandle;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern bool type_is_subtype_of (Type a, Type b, bool check_interfaces);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern bool type_is_assignable_from (Type a, Type b);
-
- public new Type GetType ()
- {
- return base.GetType ();
- }
-
- [ComVisible (true)]
- public virtual bool IsSubclassOf (Type c)
- {
- if (c == null || c == this)
- return false;
-
- // Fast check for system types
- if (IsSystemType)
- return c.IsSystemType && type_is_subtype_of (this, c, false);
-
- // User defined types depend on this behavior
- for (Type type = BaseType; type != null; type = type.BaseType)
- if (type == c)
- return true;
-
- return false;
- }
-
- public virtual Type[] FindInterfaces (TypeFilter filter, object filterCriteria)
- {
- if (filter == null)
- throw new ArgumentNullException ("filter");
-
- var ifaces = new List<Type> ();
- foreach (Type iface in GetInterfaces ()) {
- if (filter (iface, filterCriteria))
- ifaces.Add (iface);
- }
-
- return ifaces.ToArray ();
- }
-
- public Type GetInterface (string name) {
- return GetInterface (name, false);
- }
-
- public abstract Type GetInterface (string name, bool ignoreCase);
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern void GetInterfaceMapData (Type t, Type iface, out MethodInfo[] targets, out MethodInfo[] methods);
-
- [ComVisible (true)]
- public virtual InterfaceMapping GetInterfaceMap (Type interfaceType)
- {
- throw new NotSupportedException ();
- }
-
- public abstract Type[] GetInterfaces ();
-
- public virtual bool IsAssignableFrom (Type c)
- {
- if (c == null)
- return false;
-
- if (Equals (c))
- return true;
-
-#if !FULL_AOT_RUNTIME
- if (c is TypeBuilder)
- return ((TypeBuilder)c).IsAssignableTo (this);
-#endif
-
- /* Handle user defined type classes */
- if (!IsSystemType) {
- Type systemType = UnderlyingSystemType;
- if (!systemType.IsSystemType)
- return false;
-
- Type other = c.UnderlyingSystemType;
- if (!other.IsSystemType)
- return false;
-
- return systemType.IsAssignableFrom (other);
- }
-
- if (!c.IsSystemType) {
- Type underlyingType = c.UnderlyingSystemType;
- if (!underlyingType.IsSystemType)
- return false;
- return IsAssignableFrom (underlyingType);
- }
-
- return type_is_assignable_from (this, c);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern static bool IsInstanceOfType (Type type, object o);
-
- public virtual bool IsInstanceOfType (object o)
- {
- Type type = UnderlyingSystemType;
- if (!type.IsSystemType)
- return false;
- return IsInstanceOfType (type, o);
- }
-
- public virtual int GetArrayRank ()
- {
- throw new NotSupportedException (); // according to MSDN
- }
-
- public abstract Type GetElementType ();
-
- public EventInfo GetEvent (string name)
- {
- return GetEvent (name, DefaultBindingFlags);
- }
-
- public abstract EventInfo GetEvent (string name, BindingFlags bindingAttr);
-
- public virtual EventInfo[] GetEvents ()
- {
- return GetEvents (DefaultBindingFlags);
- }
-
- public abstract EventInfo[] GetEvents (BindingFlags bindingAttr);
-
- public FieldInfo GetField( string name)
- {
- return GetField (name, DefaultBindingFlags);
- }
-
- public abstract FieldInfo GetField( string name, BindingFlags bindingAttr);
-
- public FieldInfo[] GetFields ()
- {
- return GetFields (DefaultBindingFlags);
- }
-
- public abstract FieldInfo[] GetFields (BindingFlags bindingAttr);
-
- public override int GetHashCode()
- {
- Type t = UnderlyingSystemType;
- if (t != null && t != this)
- return t.GetHashCode ();
- return (int)_impl.Value;
- }
-
- public MemberInfo[] GetMember (string name)
- {
- return GetMember (name, MemberTypes.All, DefaultBindingFlags);
- }
-
- public virtual MemberInfo[] GetMember (string name, BindingFlags bindingAttr)
- {
- return GetMember (name, MemberTypes.All, bindingAttr);
- }
-
- public virtual MemberInfo[] GetMember (string name, MemberTypes type, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
- if ((bindingAttr & BindingFlags.IgnoreCase) != 0)
- return FindMembers (type, bindingAttr, FilterNameIgnoreCase, name);
- else
- return FindMembers (type, bindingAttr, FilterName, name);
- }
-
- public MemberInfo[] GetMembers ()
- {
- return GetMembers (DefaultBindingFlags);
- }
-
- public abstract MemberInfo[] GetMembers (BindingFlags bindingAttr);
-
- public MethodInfo GetMethod (string name)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
- return GetMethodImpl (name, DefaultBindingFlags, null, CallingConventions.Any, null, null);
- }
-
- public MethodInfo GetMethod (string name, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
-
- return GetMethodImpl (name, bindingAttr, null, CallingConventions.Any, null, null);
- }
-
- public MethodInfo GetMethod (string name, Type[] types)
- {
- return GetMethod (name, DefaultBindingFlags, null, CallingConventions.Any, types, null);
- }
-
- public MethodInfo GetMethod (string name, Type[] types, ParameterModifier[] modifiers)
- {
- return GetMethod (name, DefaultBindingFlags, null, CallingConventions.Any, types, modifiers);
- }
-
- public MethodInfo GetMethod (string name, BindingFlags bindingAttr, Binder binder,
- Type[] types, ParameterModifier[] modifiers)
- {
- return GetMethod (name, bindingAttr, binder, CallingConventions.Any, types, modifiers);
- }
-
- public MethodInfo GetMethod (string name, BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
- if (types == null)
- throw new ArgumentNullException ("types");
-
- for (int i = 0; i < types.Length; i++)
- if (types[i] == null)
- throw new ArgumentNullException ("types");
-
- return GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
- }
-
- protected abstract MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention, Type[] types,
- ParameterModifier[] modifiers);
-
- internal MethodInfo GetMethodImplInternal (string name, BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention, Type[] types,
- ParameterModifier[] modifiers)
- {
- return GetMethodImpl (name, bindingAttr, binder, callConvention, types, modifiers);
- }
-
- internal virtual MethodInfo GetMethod (MethodInfo fromNoninstanciated)
- {
- throw new System.InvalidOperationException ("can only be called in generic type");
- }
-
- internal virtual ConstructorInfo GetConstructor (ConstructorInfo fromNoninstanciated)
- {
- throw new System.InvalidOperationException ("can only be called in generic type");
- }
-
- internal virtual FieldInfo GetField (FieldInfo fromNoninstanciated)
- {
- throw new System.InvalidOperationException ("can only be called in generic type");
- }
-
-
- public MethodInfo[] GetMethods ()
- {
- return GetMethods (DefaultBindingFlags);
- }
-
- public abstract MethodInfo[] GetMethods (BindingFlags bindingAttr);
-
- public Type GetNestedType (string name)
- {
- return GetNestedType (name, DefaultBindingFlags);
- }
-
- public abstract Type GetNestedType (string name, BindingFlags bindingAttr);
-
- public Type[] GetNestedTypes ()
- {
- return GetNestedTypes (DefaultBindingFlags);
- }
-
- public abstract Type[] GetNestedTypes (BindingFlags bindingAttr);
-
-
- public PropertyInfo[] GetProperties ()
- {
- return GetProperties (DefaultBindingFlags);
- }
-
- public abstract PropertyInfo[] GetProperties (BindingFlags bindingAttr);
-
-
- public PropertyInfo GetProperty (string name)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
-
- return GetPropertyImpl (name, DefaultBindingFlags, null, null, null, null);
- }
-
- public PropertyInfo GetProperty (string name, BindingFlags bindingAttr)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
- return GetPropertyImpl (name, bindingAttr, null, null, null, null);
- }
-
- public PropertyInfo GetProperty (string name, Type returnType)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
- return GetPropertyImpl (name, DefaultBindingFlags, null, returnType, null, null);
- }
-
- public PropertyInfo GetProperty (string name, Type[] types)
- {
- return GetProperty (name, DefaultBindingFlags, null, null, types, null);
- }
-
- public PropertyInfo GetProperty (string name, Type returnType, Type[] types)
- {
- return GetProperty (name, DefaultBindingFlags, null, returnType, types, null);
- }
-
- public PropertyInfo GetProperty( string name, Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- return GetProperty (name, DefaultBindingFlags, null, returnType, types, modifiers);
- }
-
- public PropertyInfo GetProperty (string name, BindingFlags bindingAttr, Binder binder, Type returnType,
- Type[] types, ParameterModifier[] modifiers)
- {
- if (name == null)
- throw new ArgumentNullException ("name");
- if (types == null)
- throw new ArgumentNullException ("types");
-
- foreach (Type t in types) {
- if (t == null)
- throw new ArgumentNullException ("types");
- }
-
- return GetPropertyImpl (name, bindingAttr, binder, returnType, types, modifiers);
- }
-
- internal PropertyInfo GetProperty(String name, BindingFlags bindingAttr, Type returnType)
- {
- if (name == null)
- throw new ArgumentNullException("name");
- if (returnType == null)
- throw new ArgumentNullException("returnType");
- Contract.EndContractBlock();
- return GetPropertyImpl(name, bindingAttr, null, returnType, null, null);
- }
-
- protected abstract PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder,
- Type returnType, Type[] types, ParameterModifier[] modifiers);
-
- internal PropertyInfo GetPropertyImplInternal (string name, BindingFlags bindingAttr, Binder binder,
- Type returnType, Type[] types, ParameterModifier[] modifiers)
- {
- return GetPropertyImpl (name, bindingAttr, binder, returnType, types, modifiers);
- }
-
- protected abstract ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr,
- Binder binder,
- CallingConventions callConvention,
- Type[] types,
- ParameterModifier[] modifiers);
-
- protected abstract TypeAttributes GetAttributeFlagsImpl ();
- protected abstract bool HasElementTypeImpl ();
- protected abstract bool IsArrayImpl ();
- protected abstract bool IsByRefImpl ();
- protected abstract bool IsCOMObjectImpl ();
- protected abstract bool IsPointerImpl ();
- protected abstract bool IsPrimitiveImpl ();
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal static extern bool IsArrayImpl (Type type);
-
- protected virtual bool IsValueTypeImpl ()
- {
- if (this == typeof (ValueType) || this == typeof (Enum))
- return false;
-
- return IsSubclassOf (typeof (ValueType));
- }
-
- protected virtual bool IsContextfulImpl ()
- {
- return typeof (ContextBoundObject).IsAssignableFrom (this);
- }
-
- protected virtual bool IsMarshalByRefImpl ()
- {
- return typeof (MarshalByRefObject).IsAssignableFrom (this);
- }
-
- [ComVisible (true)]
- public ConstructorInfo GetConstructor (Type[] types)
- {
- return GetConstructor (BindingFlags.Public|BindingFlags.Instance, null, CallingConventions.Any, types, null);
- }
-
- [ComVisible (true)]
- public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder,
- Type[] types, ParameterModifier[] modifiers)
- {
- return GetConstructor (bindingAttr, binder, CallingConventions.Any, types, modifiers);
- }
-
- [ComVisible (true)]
- public ConstructorInfo GetConstructor (BindingFlags bindingAttr, Binder binder,
- CallingConventions callConvention,
- Type[] types, ParameterModifier[] modifiers)
- {
- if (types == null)
- throw new ArgumentNullException ("types");
-
- foreach (Type t in types) {
- if (t == null)
- throw new ArgumentNullException ("types");
- }
-
- return GetConstructorImpl (bindingAttr, binder, callConvention, types, modifiers);
- }
-
- [ComVisible (true)]
- public ConstructorInfo[] GetConstructors ()
- {
- return GetConstructors (BindingFlags.Public | BindingFlags.Instance);
- }
-
- [ComVisible (true)]
- public abstract ConstructorInfo[] GetConstructors (BindingFlags bindingAttr);
-
- public virtual MemberInfo[] GetDefaultMembers ()
- {
- object [] att = GetCustomAttributes (typeof (DefaultMemberAttribute), true);
- if (att.Length == 0)
- return EmptyArray<MemberInfo>.Value;
-
- MemberInfo [] member = GetMember (((DefaultMemberAttribute) att [0]).MemberName);
- return (member != null) ? member : EmptyArray<MemberInfo>.Value;
- }
-
- public virtual MemberInfo[] FindMembers (MemberTypes memberType, BindingFlags bindingAttr,
- MemberFilter filter, object filterCriteria)
- {
- MemberInfo[] result;
- ArrayList l = new ArrayList ();
-
- if ((memberType & MemberTypes.Method) != 0) {
- MethodInfo[] c = GetMethods (bindingAttr);
- if (filter != null) {
- foreach (MemberInfo m in c) {
- if (filter (m, filterCriteria))
- l.Add (m);
- }
- } else {
- l.AddRange (c);
- }
- }
- if ((memberType & MemberTypes.Constructor) != 0) {
- ConstructorInfo[] c = GetConstructors (bindingAttr);
- if (filter != null) {
- foreach (MemberInfo m in c) {
- if (filter (m, filterCriteria))
- l.Add (m);
- }
- } else {
- l.AddRange (c);
- }
- }
- if ((memberType & MemberTypes.Property) != 0) {
- PropertyInfo[] c = GetProperties (bindingAttr);
-
-
- if (filter != null) {
- foreach (MemberInfo m in c) {
- if (filter (m, filterCriteria))
- l.Add (m);
- }
- } else {
- l.AddRange (c);
- }
-
- }
- if ((memberType & MemberTypes.Event) != 0) {
- EventInfo[] c = GetEvents (bindingAttr);
- if (filter != null) {
- foreach (MemberInfo m in c) {
- if (filter (m, filterCriteria))
- l.Add (m);
- }
- } else {
- l.AddRange (c);
- }
- }
- if ((memberType & MemberTypes.Field) != 0) {
- FieldInfo[] c = GetFields (bindingAttr);
- if (filter != null) {
- foreach (MemberInfo m in c) {
- if (filter (m, filterCriteria))
- l.Add (m);
- }
- } else {
- l.AddRange (c);
- }
- }
- if ((memberType & MemberTypes.NestedType) != 0) {
- Type[] c = GetNestedTypes (bindingAttr);
- if (filter != null) {
- foreach (MemberInfo m in c) {
- if (filter (m, filterCriteria)) {
- l.Add (m);
- }
- }
- } else {
- l.AddRange (c);
- }
- }
-
- switch (memberType) {
- case MemberTypes.Constructor :
- result = new ConstructorInfo [l.Count];
- break;
- case MemberTypes.Event :
- result = new EventInfo [l.Count];
- break;
- case MemberTypes.Field :
- result = new FieldInfo [l.Count];
- break;
- case MemberTypes.Method :
- result = new MethodInfo [l.Count];
- break;
- case MemberTypes.NestedType :
- case MemberTypes.TypeInfo :
- result = new Type [l.Count];
- break;
- case MemberTypes.Property :
- result = new PropertyInfo [l.Count];
- break;
- default :
- result = new MemberInfo [l.Count];
- break;
- }
- l.CopyTo (result);
- return result;
- }
-
- [DebuggerHidden]
- [DebuggerStepThrough]
- public object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args)
- {
- return InvokeMember (name, invokeAttr, binder, target, args, null, null, null);
- }
-
- [DebuggerHidden]
- [DebuggerStepThrough]
- public object InvokeMember (string name, BindingFlags invokeAttr, Binder binder,
- object target, object[] args, CultureInfo culture)
- {
- return InvokeMember (name, invokeAttr, binder, target, args, null, culture, null);
- }
-
- public abstract object InvokeMember (string name, BindingFlags invokeAttr,
- Binder binder, object target, object[] args,
- ParameterModifier[] modifiers,
- CultureInfo culture, string[] namedParameters);
-
- public override string ToString()
- {
- return FullName;
- }
-
- internal static bool ShouldPrintFullName (Type type)
- {
- while (type.HasElementType)
- type = type.GetElementType ();
-
- if (type == typeof (void) || type.IsNested)
- return false;
-
- return !type.IsPrimitive;
- }
-
- internal virtual Type InternalResolve ()
- {
- return UnderlyingSystemType;
- }
-
- internal bool IsSystemType {
- get {
- return _impl.Value != IntPtr.Zero;
- }
- }
-
- public virtual Type[] GenericTypeArguments {
- get {
- return IsGenericType ? GetGenericArguments () : EmptyTypes;
- }
- }
-
- public virtual Type[] GetGenericArguments ()
- {
- throw new NotSupportedException ();
- }
-
- public virtual bool ContainsGenericParameters {
- get { return false; }
- }
-
- public virtual extern bool IsGenericTypeDefinition {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- internal extern Type GetGenericTypeDefinition_impl ();
-
- public virtual Type GetGenericTypeDefinition ()
- {
- throw new NotSupportedException ("Derived classes must provide an implementation.");
- }
-
- public virtual extern bool IsGenericType {
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- get;
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static extern Type MakeGenericType (Type gt, Type [] types);
-
- public virtual Type MakeGenericType (params Type[] typeArguments)
- {
- if (IsUserType)
- throw new NotSupportedException ();
- if (!IsGenericTypeDefinition)
- throw new InvalidOperationException ("not a generic type definition");
- if (typeArguments == null)
- throw new ArgumentNullException ("typeArguments");
- if (GetGenericArguments().Length != typeArguments.Length)
- throw new ArgumentException (String.Format ("The type or method has {0} generic parameter(s) but {1} generic argument(s) where provided. A generic argument must be provided for each generic parameter.", GetGenericArguments ().Length, typeArguments.Length), "typeArguments");
-
- bool hasUserType = false;
-
- Type[] systemTypes = new Type[typeArguments.Length];
- for (int i = 0; i < typeArguments.Length; ++i) {
- Type t = typeArguments [i];
- if (t == null)
- throw new ArgumentNullException ("typeArguments");
-
- if (!(t is MonoType))
- hasUserType = true;
- systemTypes [i] = t;
- }
-
- if (hasUserType) {
-#if FULL_AOT_RUNTIME
- throw new NotSupportedException ("User types are not supported under full aot");
-#else
- return new MonoGenericClass (this, typeArguments);
-#endif
- }
-
- Type res = MakeGenericType (this, systemTypes);
- if (res == null)
- throw new TypeLoadException ();
- return res;
- }
-
- public virtual bool IsGenericParameter {
- get {
- return false;
- }
- }
-
- public bool IsNested {
- get {
- return DeclaringType != null;
- }
- }
-
- public bool IsVisible {
- get {
- if (IsNestedPublic)
- return DeclaringType.IsVisible;
-
- return IsPublic;
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern int GetGenericParameterPosition ();
-
- public virtual int GenericParameterPosition {
- get {
- int res = GetGenericParameterPosition ();
- if (res < 0)
- throw new InvalidOperationException ();
- return res;
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern GenericParameterAttributes GetGenericParameterAttributes ();
-
- public virtual GenericParameterAttributes GenericParameterAttributes {
- get {
- if (!IsSystemType)
- throw new NotSupportedException ("Derived classes must provide an implementation.");
-
- if (!IsGenericParameter)
- throw new InvalidOperationException ();
-
- return GetGenericParameterAttributes ();
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern Type[] GetGenericParameterConstraints_impl ();
-
- public virtual Type[] GetGenericParameterConstraints ()
- {
- if (!IsSystemType)
- throw new InvalidOperationException ();
-
- if (!IsGenericParameter)
- throw new InvalidOperationException ();
-
- return GetGenericParameterConstraints_impl ();
- }
-
- public virtual MethodBase DeclaringMethod {
- get {
- return null;
- }
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern Type make_array_type (int rank);
-
- public virtual Type MakeArrayType ()
- {
- if (!IsSystemType)
- throw new NotSupportedException ("Derived classes must provide an implementation.");
- return make_array_type (0);
- }
-
- public virtual Type MakeArrayType (int rank)
- {
- if (!IsSystemType)
- throw new NotSupportedException ("Derived classes must provide an implementation.");
- if (rank < 1 || rank > 255)
- throw new IndexOutOfRangeException ();
- return make_array_type (rank);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern Type make_byref_type ();
-
- public virtual Type MakeByRefType ()
- {
- if (!IsSystemType)
- throw new NotSupportedException ("Derived classes must provide an implementation.");
- if (IsByRef)
- throw new TypeLoadException ("Can not call MakeByRefType on a ByRef type");
- return make_byref_type ();
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- static extern Type MakePointerType (Type type);
-
- public virtual Type MakePointerType ()
- {
- if (!IsSystemType)
- throw new NotSupportedException ("Derived classes must provide an implementation.");
- return MakePointerType (this);
- }
-
- public static Type ReflectionOnlyGetType (string typeName,
- bool throwIfNotFound,
- bool ignoreCase)
- {
- if (typeName == null)
- throw new ArgumentNullException ("typeName");
- int idx = typeName.IndexOf (',');
- if (idx < 0 || idx == 0 || idx == typeName.Length - 1)
- throw new ArgumentException ("Assembly qualifed type name is required", "typeName");
- string an = typeName.Substring (idx + 1);
- Assembly a;
- try {
- a = Assembly.ReflectionOnlyLoad (an);
- } catch {
- if (throwIfNotFound)
- throw;
- return null;
- }
- return a.GetType (typeName.Substring (0, idx), throwIfNotFound, ignoreCase);
- }
-
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- extern void GetPacking (out int packing, out int size);
-
- public virtual StructLayoutAttribute StructLayoutAttribute {
- get {
- throw new NotSupportedException ();
- }
- }
-
- internal StructLayoutAttribute GetStructLayoutAttribute ()
- {
- LayoutKind kind;
-
- if (IsLayoutSequential)
- kind = LayoutKind.Sequential;
- else if (IsExplicitLayout)
- kind = LayoutKind.Explicit;
- else
- kind = LayoutKind.Auto;
-
- StructLayoutAttribute attr = new StructLayoutAttribute (kind);
-
- if (IsUnicodeClass)
- attr.CharSet = CharSet.Unicode;
- else if (IsAnsiClass)
- attr.CharSet = CharSet.Ansi;
- else
- attr.CharSet = CharSet.Auto;
-
- if (kind != LayoutKind.Auto) {
- int packing;
- GetPacking (out packing, out attr.Size);
- // 0 means no data provided, we end up with default value
- if (packing != 0)
- attr.Pack = packing;
- }
-
- return attr;
- }
-
- internal object[] GetPseudoCustomAttributes ()
- {
- int count = 0;
-
- /* IsSerializable returns true for delegates/enums as well */
- if ((Attributes & TypeAttributes.Serializable) != 0)
- count ++;
- if ((Attributes & TypeAttributes.Import) != 0)
- count ++;
-
- if (count == 0)
- return null;
- object[] attrs = new object [count];
- count = 0;
-
- if ((Attributes & TypeAttributes.Serializable) != 0)
- attrs [count ++] = new SerializableAttribute ();
- if ((Attributes & TypeAttributes.Import) != 0)
- attrs [count ++] = new ComImportAttribute ();
-
- return attrs;
- }
-
-
- public virtual bool IsEquivalentTo (Type other)
- {
- return this == other;
- }
-
- /*
- * Return whenever this object is an instance of a user defined subclass
- * of System.Type or an instance of TypeDelegator.
- * A user defined type is not simply the opposite of a system type.
- * It's any class that's neither a SRE or runtime baked type.
- */
- internal virtual bool IsUserType {
- get {
- return true;
- }
- }
-
- internal Type GetRootElementType()
- {
- Type rootElementType = this;
-
- while (rootElementType.HasElementType)
- rootElementType = rootElementType.GetElementType();
-
- return rootElementType;
- }
-
- #region Enum methods
-
- // Default implementations of GetEnumNames, GetEnumValues, and GetEnumUnderlyingType
- // Subclass of types can override these methods.
-
- public virtual string[] GetEnumNames()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.Ensures(Contract.Result<String[]>() != null);
-
- string[] names;
- Array values;
- GetEnumData(out names, out values);
- return names;
- }
-
- // We don't support GetEnumValues in the default implementation because we cannot create an array of
- // a non-runtime type. If there is strong need we can consider returning an object or int64 array.
- public virtual Array GetEnumValues()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.Ensures(Contract.Result<Array>() != null);
-
- throw new NotImplementedException();
- }
-
- // Returns the enum values as an object array.
- private Array GetEnumRawConstantValues()
- {
- string[] names;
- Array values;
- GetEnumData(out names, out values);
- return values;
- }
-
- // This will return enumValues and enumNames sorted by the values.
- private void GetEnumData(out string[] enumNames, out Array enumValues)
- {
- Contract.Ensures(Contract.ValueAtReturn<String[]>(out enumNames) != null);
- Contract.Ensures(Contract.ValueAtReturn<Array>(out enumValues) != null);
-
- FieldInfo[] flds = GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
-
- object[] values = new object[flds.Length];
- string[] names = new string[flds.Length];
-
- for (int i = 0; i < flds.Length; i++)
- {
- names[i] = flds[i].Name;
- values[i] = flds[i].GetRawConstantValue();
- }
-
- // Insertion Sort these values in ascending order.
- // We use this O(n^2) algorithm, but it turns out that most of the time the elements are already in sorted order and
- // the common case performance will be faster than quick sorting this.
- IComparer comparer = Comparer.Default;
- for (int i = 1; i < values.Length; i++)
- {
- int j = i;
- string tempStr = names[i];
- object val = values[i];
- bool exchanged = false;
-
- // Since the elements are sorted we only need to do one comparision, we keep the check for j inside the loop.
- while (comparer.Compare(values[j - 1], val) > 0)
- {
- names[j] = names[j - 1];
- values[j] = values[j - 1];
- j--;
- exchanged = true;
- if (j == 0)
- break;
- }
-
- if (exchanged)
- {
- names[j] = tempStr;
- values[j] = val;
- }
- }
-
- enumNames = names;
- enumValues = values;
- }
-
- public virtual Type GetEnumUnderlyingType()
- {
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.Ensures(Contract.Result<Type>() != null);
-
- FieldInfo[] fields = GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
- if (fields == null || fields.Length != 1)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidEnum"), "enumType");
-
- return fields[0].FieldType;
- }
-
- public virtual bool IsEnumDefined(object value)
- {
- if (value == null)
- throw new ArgumentNullException("value");
-
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- // Check if both of them are of the same type
- Type valueType = value.GetType();
-
- // If the value is an Enum then we need to extract the underlying value from it
- if (valueType.IsEnum)
- {
- if (!valueType.IsEquivalentTo(this))
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumAndObjectMustBeSameType", valueType.ToString(), this.ToString()));
-
- valueType = valueType.GetEnumUnderlyingType();
- }
-
- // If a string is passed in
- if (valueType == typeof(string))
- {
- string[] names = GetEnumNames();
- if (Array.IndexOf(names, value) >= 0)
- return true;
- else
- return false;
- }
-
- // If an enum or integer value is passed in
- if (Type.IsIntegerType(valueType))
- {
- Type underlyingType = GetEnumUnderlyingType();
- // We cannot compare the types directly because valueType is always a runtime type but underlyingType might not be.
- if (underlyingType.GetTypeCodeImpl() != valueType.GetTypeCodeImpl())
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), underlyingType.ToString()));
-
- Array values = GetEnumRawConstantValues();
- return (BinarySearch(values, value) >= 0);
- }
- else if (CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
- {
- // if at this point the value type is not an integer type, then its type doesn't match the enum type
- // NetCF used to throw an argument exception in this case
- throw new ArgumentException(Environment.GetResourceString("Arg_EnumUnderlyingTypeAndObjectMustBeSameType", valueType.ToString(), GetEnumUnderlyingType()));
- }
- else
- {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_UnknownEnumType"));
- }
- }
-
- public virtual string GetEnumName(object value)
- {
- if (value == null)
- throw new ArgumentNullException("value");
-
- if (!IsEnum)
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnum"), "enumType");
- Contract.EndContractBlock();
-
- Type valueType = value.GetType();
-
- if (!(valueType.IsEnum || Type.IsIntegerType(valueType)))
- throw new ArgumentException(Environment.GetResourceString("Arg_MustBeEnumBaseTypeOrEnum"), "value");
-
- Array values = GetEnumRawConstantValues();
- int index = BinarySearch(values, value);
-
- if (index >= 0)
- {
- string[] names = GetEnumNames();
- return names[index];
- }
-
- return null;
- }
-
- // Convert everything to ulong then perform a binary search.
- private static int BinarySearch(Array array, object value)
- {
- ulong[] ulArray = new ulong[array.Length];
- for (int i = 0; i < array.Length; ++i)
- ulArray[i] = Enum.ToUInt64(array.GetValue(i));
-
- ulong ulValue = Enum.ToUInt64(value);
-
- return Array.BinarySearch(ulArray, ulValue);
- }
-
- internal static bool IsIntegerType(Type t)
- {
- return (t == typeof(int) ||
- t == typeof(short) ||
- t == typeof(ushort) ||
- t == typeof(byte) ||
- t == typeof(sbyte) ||
- t == typeof(uint) ||
- t == typeof(long) ||
- t == typeof(ulong) ||
- t == typeof(char) ||
- t == typeof(bool));
- }
-
- #endregion
-
-#if !MOBILE
- void _Type.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException ();
- }
-
- void _Type.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException ();
- }
-
- void _Type.GetTypeInfoCount (out uint pcTInfo)
- {
- throw new NotImplementedException ();
- }
-
- void _Type.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException ();
- }
-#endif
- }
-}
Assert.IsFalse (tb.IsAssignableFrom (typeof (FileStream)), "#C6");
Assert.IsTrue (typeof (object).IsAssignableFrom (tb), "#C7");
Assert.IsFalse (tb.IsAssignableFrom (typeof (object)), "#C8");
- Assert.IsFalse (typeof (IDisposable).IsAssignableFrom (tb), "#C9");
+ Assert.IsTrue (typeof (IDisposable).IsAssignableFrom (tb), "#C9");
Assert.IsFalse (tb.IsAssignableFrom (typeof (IDisposable)), "#C10");
Assert.IsTrue (tb.IsAssignableFrom (tb), "#D1");
TypeBuilder tb2 = module.DefineType (genTypeName (),
TypeAttributes.Public, tb,
- new Type [] { typeof (IAir) });
+ new Type[] { typeof (IAir) });
- Assert.IsFalse (typeof (IThrowable).IsAssignableFrom (tb2), "#E1");
+ Assert.IsTrue (typeof (IThrowable).IsAssignableFrom (tb2), "#E1");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (IThrowable)), "#E2");
- Assert.IsFalse (typeof (IMoveable).IsAssignableFrom (tb2), "#E3");
+ Assert.IsTrue (typeof (IMoveable).IsAssignableFrom (tb2), "#E3");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (IMoveable)), "#E4");
- Assert.IsFalse (typeof (IComparable).IsAssignableFrom (tb2), "#E5");
+ Assert.IsTrue (typeof (IComparable).IsAssignableFrom (tb2), "#E5");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (IComparable)), "#E6");
Assert.IsTrue (typeof (IAir).IsAssignableFrom (tb2), "#E7");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (IAir)), "#E8");
Assert.IsFalse (typeof (ILiquid).IsAssignableFrom (tb2), "#E11");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (ILiquid)), "#E12");
- Assert.IsFalse (typeof (Foo).IsAssignableFrom (tb2), "#F1");
+ Assert.IsTrue (typeof (Foo).IsAssignableFrom (tb2), "#F1");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (Foo)), "#F2");
- Assert.IsFalse (typeof (Bar).IsAssignableFrom (tb2), "#F3");
+ Assert.IsTrue (typeof (Bar).IsAssignableFrom (tb2), "#F3");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (Bar)), "#F4");
Assert.IsFalse (typeof (Baz).IsAssignableFrom (tb2), "#F5");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (Baz)), "#F6");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (FileStream)), "#G6");
Assert.IsTrue (typeof (object).IsAssignableFrom (tb2), "#G7");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (object)), "#G8");
- Assert.IsFalse (typeof (IDisposable).IsAssignableFrom (tb2), "#G9");
+ Assert.IsTrue (typeof (IDisposable).IsAssignableFrom (tb2), "#G9");
Assert.IsFalse (tb2.IsAssignableFrom (typeof (IDisposable)), "#G10");
Assert.IsTrue (tb2.IsAssignableFrom (tb2), "#H1");
TypeBuilder tb3 = module.DefineType (genTypeName (),
TypeAttributes.Public, tb2,
- new Type [] { typeof (IWater) });
+ new Type[] { typeof (IWater) });
- Assert.IsFalse (typeof (IThrowable).IsAssignableFrom (tb3), "#I1");
+ Assert.IsTrue (typeof (IThrowable).IsAssignableFrom (tb3), "#I1");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (IThrowable)), "#I2");
- Assert.IsFalse (typeof (IMoveable).IsAssignableFrom (tb3), "#I3");
+ Assert.IsTrue (typeof (IMoveable).IsAssignableFrom (tb3), "#I3");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (IMoveable)), "#I4");
- Assert.IsFalse (typeof (IComparable).IsAssignableFrom (tb3), "#I5");
+ Assert.IsTrue (typeof (IComparable).IsAssignableFrom (tb3), "#I5");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (IComparable)), "#I6");
- Assert.IsFalse (typeof (IAir).IsAssignableFrom (tb3), "#I7");
+ Assert.IsTrue (typeof (IAir).IsAssignableFrom (tb3), "#I7");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (IAir)), "#I8");
Assert.IsTrue (typeof (IWater).IsAssignableFrom (tb3), "#I9");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (IWater)), "#I10");
//Assert.IsFalse (typeof (ILiquid).IsAssignableFrom (tb3), "#I11");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (ILiquid)), "#I12");
- Assert.IsFalse (typeof (Foo).IsAssignableFrom (tb3), "#J1");
+ Assert.IsTrue (typeof (Foo).IsAssignableFrom (tb3), "#J1");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (Foo)), "#J2");
- Assert.IsFalse (typeof (Bar).IsAssignableFrom (tb3), "#J3");
+ Assert.IsTrue (typeof (Bar).IsAssignableFrom (tb3), "#J3");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (Bar)), "#J4");
Assert.IsFalse (typeof (Baz).IsAssignableFrom (tb3), "#J5");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (Baz)), "#J6");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (FileStream)), "#K6");
Assert.IsTrue (typeof (object).IsAssignableFrom (tb3), "#K7");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (object)), "#K8");
- Assert.IsFalse (typeof (IDisposable).IsAssignableFrom (tb3), "#K9");
+ Assert.IsTrue (typeof (IDisposable).IsAssignableFrom (tb3), "#K9");
Assert.IsFalse (tb3.IsAssignableFrom (typeof (IDisposable)), "#K10");
Assert.IsTrue (tb3.IsAssignableFrom (tb3), "#L1");
TypeBuilder tb = module.DefineType (genTypeName (), TypeAttributes.Public, typeof (EmptyIfaceImpl));
TypeBuilder tb2 = module.DefineType (genTypeName (), TypeAttributes.Public, tb);
- Assert.IsFalse (typeof (EmptyInterface).IsAssignableFrom (tb));
+ Assert.IsTrue (typeof (EmptyInterface).IsAssignableFrom (tb));
Type t = tb.CreateType ();
Assert.IsTrue (typeof (EmptyInterface).IsAssignableFrom (tb));
Assert.IsTrue (typeof (EmptyInterface).IsAssignableFrom (t));
- Assert.IsFalse (typeof (EmptyInterface).IsAssignableFrom (tb2));
+ Assert.IsTrue (typeof (EmptyInterface).IsAssignableFrom (tb2));
Type t2 = tb2.CreateType ();
Assert.IsTrue (typeof (EmptyInterface).IsAssignableFrom (tb2));
Assert.IsTrue (typeof (EmptyInterface).IsAssignableFrom (t2));
[Test]
public void ParseExactCustomFormat ()
{
- var dt = DateTimeOffset.ParseExact ("Sunday, 06-Nov-94 08:49:37 GMT", "dddd, dd'-'MMM'-'yy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture);
- Assert.AreEqual (new DateTimeOffset (1994, 11, 6, 8, 49, 37, TimeZone.CurrentTimeZone.GetUtcOffset (DateTime.Now)), dt);
+ var dt = DateTimeOffset.ParseExact ("Sunday, 06-Nov-94 08:49:37 GMT", "dddd, dd'-'MMM'-'yy HH:mm:ss 'GMT'", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal);
+ Assert.AreEqual (new DateTimeOffset (1994, 11, 6, 8, 49, 37, TimeSpan.Zero), dt);
}
[Test]
// Tests for byref types
Type paramType = typeof (TypeTest).GetMethod ("ByrefMethod", BindingFlags.Instance|BindingFlags.NonPublic).GetParameters () [0].ParameterType;
- Assert.IsTrue (!paramType.IsSubclassOf (typeof (ValueType)), "#02");
- //Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
- Assert.IsTrue (!paramType.IsSubclassOf (paramType), "#04");
+ Assert.IsFalse (paramType.IsSubclassOf (typeof(ValueType)), "#02");
+ Assert.IsNull (paramType.BaseType, "#02-b");
+ Assert.IsTrue (paramType.IsSubclassOf (typeof (Object)), "#03");
+ Assert.IsFalse (paramType.IsSubclassOf (paramType), "#04");
}
[Test]
Assert.AreEqual (ut, arg, "#B3");
}
- [Category ("NotWorking")]
- //We dont support instantiating a user type
+ [Test]
public void MakeGenericType_NestedUserDefinedType ()
{
Type ut = new UserType (new UserType (typeof (int)));
}
[Test]
- [Category ("NotWorking")]
public void TestMakeGenericType_UserDefinedType_DotNet20SP1 ()
{
Type ut = new UserType(typeof(int));
obj = GetType ().GetMember ("DummyMember", memtype,
BindingFlags.Public | BindingFlags.Instance);
Assert.AreEqual (testtype.GetHashCode (), obj.GetType ().GetHashCode (),
- "Expected " + testtype.FullName);
+ "Expected #" + i + " " + testtype.FullName);
}
}
a.Equals (a);
Assert.AreEqual (1, ta.eq, "#1");
- Assert.AreEqual (0, ta.ust, "#2");
+ Assert.AreEqual (2, ta.ust, "#2");
a.Equals (b);
Assert.AreEqual (2, ta.eq, "#3");
- Assert.AreEqual (1, ta.ust, "#4");
+ Assert.AreEqual (3, ta.ust, "#4");
Assert.AreEqual (0, tb.eq, "#5");
Assert.AreEqual (1, tb.ust, "#6");
}
System/TimeZoneNotFoundException.cs
System/TimeoutException.cs
../../build/common/MonoTODOAttribute.cs
-System/Type.cs
System/TypeSpec.cs
System/TypeAccessException.cs
System/TypeCode.cs
System.Reflection/TargetInvocationException.cs
System.Reflection/TargetParameterCountException.cs
System.Reflection/TypeAttributes.cs
-System.Reflection/TypeDelegator.cs
System.Reflection/TypeFilter.cs
System.Reflection/TypeInfo.cs
System.Reflection.Emit/AssemblyBuilder.cs
ReferenceSources/JitHelpers.cs
ReferenceSources/EncodingDataItem.cs
ReferenceSources/EncodingTable.cs
-ReferenceSources/ReflectionOnlyType.cs
+ReferenceSources/TypeNameParser.cs
+ReferenceSources/RuntimeType.cs
+../../../external/referencesource/mscorlib/system/__filters.cs
../../../external/referencesource/mscorlib/system/__hresults.cs
../../../external/referencesource/mscorlib/system/activator.cs
../../../external/referencesource/mscorlib/system/AggregateException.cs
../../../external/referencesource/mscorlib/system/sbyte.cs
../../../external/referencesource/mscorlib/system/stringcomparer.cs
../../../external/referencesource/mscorlib/system/stringfreezingattribute.cs
+../../../external/referencesource/mscorlib/system/rttype.cs
../../../external/referencesource/mscorlib/system/timespan.cs
../../../external/referencesource/mscorlib/system/throwhelper.cs
../../../external/referencesource/mscorlib/system/tuple.cs
+../../../external/referencesource/mscorlib/system/type.cs
../../../external/referencesource/mscorlib/system/uint16.cs
../../../external/referencesource/mscorlib/system/uint32.cs
../../../external/referencesource/mscorlib/system/uint64.cs
../../../external/referencesource/mscorlib/system/unityserializationholder.cs
../../../external/referencesource/mscorlib/system/version.cs
-
../../../external/referencesource/mscorlib/system/collections/arraylist.cs
../../../external/referencesource/mscorlib/system/collections/bitarray.cs
../../../external/referencesource/mscorlib/system/collections/caseinsensitivecomparer.cs
../../../external/referencesource/mscorlib/system/io/unmanagedmemorystream.cs
../../../external/referencesource/mscorlib/system/reflection/binder.cs
+../../../external/referencesource/mscorlib/system/reflection/typedelegator.cs
../../../external/referencesource/mscorlib/system/runtime/versioning/binarycompatibility.cs
../../../external/referencesource/mscorlib/system/runtime/versioning/targetframeworkid.cs
../../../external/referencesource/mscorlib/system/threading/Tasks/ProducerConsumerQueues.cs
../../../external/referencesource/mscorlib/system/threading/Tasks/TaskToApm.cs
-
+ReferenceSources/Type.cs
--- /dev/null
+// CS0246: The type or namespace name `wrong' could not be found. Are you missing an assembly reference?
+// Line: 15
+
+using System;
+
+class X
+{
+ static void Foo<T> () where T : class
+ {
+ }
+
+ public static void Main ()
+ {
+ Action a = () => {
+ Foo<wrong> ();
+ };
+ }
+}
\ No newline at end of file
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>MultiByte</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
//
public bool CheckAll (MemberSpec context, TypeSpec[] targs, TypeParameterSpec[] tparams, Location loc)
{
+ if (targs == null)
+ return true;
+
for (int i = 0; i < tparams.Length; i++) {
var targ = targs[i];
if (!CheckConstraint (context, targ, tparams [i], loc))
else if (OperatorType == OpType.Implicit)
Parent.MemberCache.CheckExistingMembersOverloads (this, GetMetadataName (OpType.Explicit), parameters);
- TypeSpec declaring_type = Parent.CurrentType;
+ TypeSpec declaring_type = Parent.PartialContainer.CurrentType;
TypeSpec return_type = MemberType;
TypeSpec first_arg_type = ParameterTypes [0];
public class MulticastDelegate {}
public class Array {}
public class Exception {}
- public class Type {}
+ public partial class Type {}
public class ValueType {}
public class Enum {}
public class Attribute {}
public struct RuntimeFieldHandle {}
public interface IDisposable {}
+
+ partial class Type
+ {
+ public static bool operator == (Type left, Type right)
+ {
+ return false;
+ }
+
+ public static bool operator != (Type left, Type right)
+ {
+ return true;
+ }
+ }
}
namespace System.Runtime.InteropServices
security \
mdbrebase \
ikdasm \
- symbolicate
+ mono-symbolicate
build_SUBDIRS = gacutil security culevel
net_4_5_SUBDIRS = gacutil
Output.WriteLine ("</pre>");
}
+ string RenderGenericParameter (XElement gp)
+ {
+ var sb = new StringBuilder ();
+ sb.Append (gp.GetTypeName ("name"));
+
+ var constraints = gp.DescendantList ("generic-parameter-constraints", "generic-parameter-constraint");
+ if (constraints != null && constraints.Count > 0) {
+ sb.Append (" : ");
+ for (int i = 0; i < constraints.Count; i++) {
+ if (i > 0)
+ sb.Append (", ");
+ sb.Append (constraints [i].GetTypeName ("name"));
+ }
+ }
+ return sb.ToString ();
+ }
+
protected void RenderGenericParameters (XElement source, XElement target, ApiChange change)
{
var src = source.DescendantList ("generic-parameters", "generic-parameter");
if (i > 0)
change.Append (", ");
if (i >= srcCount) {
- change.AppendAdded (tgt [i].GetTypeName ("name"), true);
+ change.AppendAdded (RenderGenericParameter (tgt [i]), true);
} else if (i >= tgtCount) {
- change.AppendRemoved (src [i].GetTypeName ("name"), true);
+ change.AppendRemoved (RenderGenericParameter (src [i]), true);
} else {
- var srcName = src [i].GetTypeName ("name");
- var tgtName = tgt [i].GetTypeName ("name");
+ var srcName = RenderGenericParameter (src [i]);
+ var tgtName = RenderGenericParameter (tgt [i]);
if (srcName != tgtName) {
change.AppendModified (srcName, tgtName, true);
--- /dev/null
+/Test/out
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Diagnostics;
+using System.Collections.Generic;
+using Mono.Cecil;
+using Mono.CompilerServices.SymbolWriter;
+
+namespace Symbolicate
+{
+ struct Location {
+ public string FileName;
+ public int Line;
+ }
+
+ class LocationProvider {
+ class AssemblyLocationProvider {
+ AssemblyDefinition assembly;
+ MonoSymbolFile symbolFile;
+ string seqPointDataPath;
+
+ public AssemblyLocationProvider (AssemblyDefinition assembly, MonoSymbolFile symbolFile, string seqPointDataPath)
+ {
+ this.assembly = assembly;
+ this.symbolFile = symbolFile;
+ this.seqPointDataPath = seqPointDataPath;
+ }
+
+ public bool TryGetLocation (string methodFullName, string[] methodParamsTypes, int offset, bool isOffsetIL, out Location location)
+ {
+ location = default (Location);
+ if (symbolFile == null)
+ return false;
+
+ var typeNameEnd = methodFullName.LastIndexOf (".");
+ var typeName = methodFullName.Substring (0, typeNameEnd);
+ var methodName = methodFullName.Substring (typeNameEnd + 1, methodFullName.Length - typeNameEnd - 1);
+
+ var type = assembly.MainModule.Types.FirstOrDefault (t => t.FullName == typeName);
+ if (type == null)
+ return false;
+
+ var method = type.Methods.FirstOrDefault (m => {
+ if (m.Name != methodName)
+ return false;
+
+ if (m.Parameters.Count != methodParamsTypes.Length)
+ return false;
+
+ for (var i = 0; i < methodParamsTypes.Length; i++) {
+ var paramType = m.Parameters[i].ParameterType;
+ if (paramType.Name != methodParamsTypes[i])
+ return false;
+ }
+
+ return true;
+ });
+
+ if (method == null)
+ return false;
+
+ int ilOffset = (isOffsetIL)? offset : GetILOffsetFromFile (method.MetadataToken.ToInt32 (), offset);
+ if (ilOffset < 0)
+ return false;
+
+ var methodSymbol = symbolFile.Methods [method.MetadataToken.RID-1];
+
+ foreach (var lineNumber in methodSymbol.GetLineNumberTable ().LineNumbers) {
+ if (lineNumber.Offset < ilOffset)
+ continue;
+
+ location.FileName = symbolFile.Sources [lineNumber.File-1].FileName;
+ location.Line = lineNumber.Row;
+ return true;
+ }
+
+ return false;
+ }
+
+ static MethodInfo methodGetIL;
+ private int GetILOffsetFromFile (int methodToken, int nativeOffset)
+ {
+ if (string.IsNullOrEmpty (seqPointDataPath))
+ return -1;
+
+ if (methodGetIL == null)
+ methodGetIL = typeof (StackFrame).GetMethod ("GetILOffsetFromFile", BindingFlags.NonPublic | BindingFlags.Static);
+
+ if (methodGetIL == null)
+ throw new Exception ("System.Diagnostics.StackFrame.GetILOffsetFromFile could not be found, make sure you have an updated mono installed.");
+
+ return (int) methodGetIL.Invoke (null, new object[] {seqPointDataPath, methodToken, nativeOffset});
+ }
+ }
+
+ Dictionary<string, AssemblyLocationProvider> assemblies;
+ HashSet<string> directories;
+
+ public LocationProvider () {
+ assemblies = new Dictionary<string, AssemblyLocationProvider> ();
+ directories = new HashSet<string> ();
+ }
+
+ public void AddAssembly (string assemblyPath)
+ {
+ assemblyPath = Path.GetFullPath (assemblyPath);
+ if (assemblies.ContainsKey (assemblyPath))
+ return;
+
+ if (!File.Exists (assemblyPath))
+ throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
+
+ var assembly = AssemblyDefinition.ReadAssembly (assemblyPath);
+ MonoSymbolFile symbolFile = null;
+
+ var symbolPath = assemblyPath + ".mdb";
+ if (!File.Exists (symbolPath))
+ Debug.WriteLine (".mdb file was not found for " + assemblyPath);
+ else
+ symbolFile = MonoSymbolFile.ReadSymbolFile (assemblyPath + ".mdb");
+
+ var seqPointDataPath = assemblyPath + ".msym";
+ if (!File.Exists (seqPointDataPath))
+ seqPointDataPath = null;
+
+ assemblies.Add (assemblyPath, new AssemblyLocationProvider (assembly, symbolFile, seqPointDataPath));
+
+ directories.Add (Path.GetDirectoryName (assemblyPath));
+
+ foreach (var assemblyRef in assembly.MainModule.AssemblyReferences) {
+ string refPath = null;
+ foreach (var dir in directories) {
+ refPath = Path.Combine (dir, assemblyRef.Name);
+ if (File.Exists (refPath))
+ break;
+ refPath = Path.Combine (dir, assemblyRef.Name + ".dll");
+ if (File.Exists (refPath))
+ break;
+ refPath = Path.Combine (dir, assemblyRef.Name + ".exe");
+ if (File.Exists (refPath))
+ break;
+ refPath = null;
+ }
+ if (refPath != null)
+ AddAssembly (refPath);
+ }
+ }
+
+ public void AddDirectory (string directory)
+ {
+ directory = Path.GetFullPath (directory);
+ if (!Directory.Exists (directory)) {
+ Console.Error.WriteLine ("Directory " + directory + " does not exist.");
+ return;
+ }
+
+ directories.Add (directory);
+ }
+
+ public bool TryGetLocation (string methodName, string[] methodParams, int offset, bool isOffsetIL, out Location location)
+ {
+ location = default (Location);
+ foreach (var assembly in assemblies.Values) {
+ if (assembly.TryGetLocation (methodName, methodParams, offset, isOffsetIL, out location))
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
+
--- /dev/null
+thisdir = tools/mono-symbolicate
+SUBDIRS =
+include ../../build/rules.make
+
+PROGRAM = mono-symbolicate.exe
+
+LOCAL_MCS_FLAGS = \
+ /r:Mono.Cecil.dll \
+ /r:Mono.CompilerServices.SymbolWriter.dll \
+ /r:System.Xml
+
+include ../../build/executable.make
+
+LIB_PATH = $(topdir)/class/lib/$(PROFILE)
+
+MONO = MONO_PATH=$(LIB_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH $(RUNTIME)
+
+OUT_DIR = Test/out
+TEST_CS = Test/StackTraceDumper.cs
+TEST_EXE = $(OUT_DIR)/StackTraceDumper.exe
+RELEASE_FILE = $(OUT_DIR)/release.out
+SYMBOLICATE_FILE = $(OUT_DIR)/symbolicate.out
+SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
+
+CHECK_DIFF = @\
+ MONO_DEBUG=gen-compact-seq-points $(MONO) $(TEST_EXE) > $(RELEASE_FILE); \
+ $(MONO) $(LIB_PATH)/$(PROGRAM) $(TEST_EXE) $(RELEASE_FILE) | sed "s/).*Test\//) in /" > $(SYMBOLICATE_FILE); \
+ DIFF=$$(diff $(SYMBOLICATE_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
+ if [ ! -z "$$DIFF" ]; then \
+ echo "Symbolicate tests failed."; \
+ echo "If $(SYMBOLICATE_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
+ echo "Otherwise runtime sequence points need to be fixed."; \
+ echo "$$DIFF"; \
+ exit 1; \
+ fi
+
+BUILD_TEST_EXE = @\
+ rm -rf $(OUT_DIR); \
+ mkdir -p $(OUT_DIR); \
+ $(MCS) -debug $(TEST_CS) -out:$(TEST_EXE)
+
+check: all
+ $(BUILD_TEST_EXE)
+ @echo "Checking $(PROGRAM) without AOT"
+ $(CHECK_DIFF)
+ @echo "Checking $(PROGRAM) with AOT"
+ @MONO_DEBUG=gen-compact-seq-points $(MONO) --aot $(TEST_EXE) > /dev/null
+ $(CHECK_DIFF)
+ @echo "Checking $(PROGRAM) with AOT (using .msym)"
+ $(BUILD_TEST_EXE)
+ @MONO_DEBUG=gen-compact-seq-points $(MONO) --aot=gen-seq-points-file $(TEST_EXE) > /dev/null
+ $(CHECK_DIFF)
--- /dev/null
+Mono Symbolicate Tool - README
+
+Usage
+-----------------------------
+
+mono-symbolicate exefile stacktracesfile [directories...]
+
+Description
+-----------------------------
+
+mono-symbolicate is a tool that converts a stack trace with `<filename unknown>:0`
+into one with file names and line numbers.
+
+The output of calling this tool will be the provided stacktracesfile where
+`<filename unknown>:0` parts are replaced by a file name and a line number.
+
+For the tool to work it needs to load referenced assemblies, it will first look
+in the same folder as exefile then from one of the provided directories.
+
+The tool assumes that the folder with a referenced assembly called for example
+name.dll will also include name.dll.mdb, if the referenced assembly is AOT
+compiled then the tool is also expecting to find name.dll.msym.
\ No newline at end of file
--- /dev/null
+using System;
+
+class StackTraceDumper {
+ public static void Main () {
+ // Stacktrace with no depth
+ try {
+ throw new Exception ();
+ } catch (Exception e) {
+ Console.WriteLine (e);
+ }
+ // Stacktrace with depth of 1
+ try {
+ ThrowException ();
+ } catch (Exception e) {
+ Console.WriteLine (e);
+ }
+ // Stacktrace with depth of 2
+ try {
+ ThrowException2 ();
+ } catch (Exception e) {
+ Console.WriteLine (e);
+ }
+ }
+
+ public static void ThrowException () {
+ Console.WriteLine ("Exception is not in the first line!");
+ throw new Exception ();
+ }
+
+ public static void ThrowException2 () {
+ ThrowException ();
+ }
+
+}
\ No newline at end of file
--- /dev/null
+System.Exception: Exception of type 'System.Exception' was thrown.
+ at StackTraceDumper.Main () in StackTraceDumper.cs:7
+Exception is not in the first line!
+System.Exception: Exception of type 'System.Exception' was thrown.
+ at StackTraceDumper.ThrowException () in StackTraceDumper.cs:27
+ at StackTraceDumper.Main () in StackTraceDumper.cs:13
+Exception is not in the first line!
+System.Exception: Exception of type 'System.Exception' was thrown.
+ at StackTraceDumper.ThrowException () in StackTraceDumper.cs:27
+ at StackTraceDumper.ThrowException2 () in StackTraceDumper.cs:31
+ at StackTraceDumper.Main () in StackTraceDumper.cs:19
--- /dev/null
+symbolicate.cs
+LocationProvider.cs
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using System.Globalization;
+using System.Text.RegularExpressions;
+
+namespace Symbolicate
+{
+ public class Program
+ {
+ static Regex regex = new Regex (@"\w*at (?<MethodName>.+) \((?<MethodParams>.*)\) *(\[0x(?<IL>.+)\]|<0x.* \+ 0x(?<NativeOffset>.+)>) in <filename unknown>:0");
+
+ public static int Main (String[] args)
+ {
+ if (args.Length < 2) {
+ Console.Error.WriteLine ("Usage: symbolicate <assembly path> <input file> [lookup directories]");
+ return 1;
+ }
+
+ var assemblyPath = args [0];
+ var inputFile = args [1];
+
+ var locProvider = new LocationProvider ();
+
+ for (var i = 2; i < args.Length; i++)
+ locProvider.AddDirectory (args [i]);
+
+ locProvider.AddAssembly (assemblyPath);
+
+ using (StreamReader r = new StreamReader (inputFile)) {
+ for (var line = r.ReadLine (); line != null; line = r.ReadLine ()) {
+ line = SymbolicateLine (line, locProvider);
+ Console.WriteLine (line);
+ }
+ }
+
+ return 0;
+ }
+
+ static string SymbolicateLine (string line, LocationProvider locProvider)
+ {
+ var match = regex.Match (line);
+ if (!match.Success)
+ return line;
+
+ var methodName = match.Groups ["MethodName"].Value;
+ var methodParams = ParseParametersTypes (match.Groups ["MethodParams"].Value);
+
+ var isOffsetIL = !string.IsNullOrEmpty (match.Groups ["IL"].Value);
+ var offsetVarName = (isOffsetIL)? "IL" : "NativeOffset";
+ var offset = int.Parse (match.Groups [offsetVarName].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
+
+ Location location;
+ if (!locProvider.TryGetLocation (methodName, methodParams, offset, isOffsetIL, out location))
+ return line;
+
+ return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", location.FileName, location.Line));
+ }
+
+ static string[] ParseParametersTypes (string parameters)
+ {
+ if (string.IsNullOrEmpty (parameters))
+ return new string [0];
+
+ var paramsArray = parameters.Split (',');
+ var paramsTypes = new string [paramsArray.Length];
+ for (var i = 0; i < paramsArray.Length; i++)
+ paramsTypes [i] = paramsArray [i].Trim ().Split (new char[]{' '}, 2)[0];
+
+ return paramsTypes;
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-/Test/out
\ No newline at end of file
+++ /dev/null
-using System;
-using System.IO;
-using System.Linq;
-using System.Diagnostics;
-using System.Collections.Generic;
-using Mono.Cecil;
-using Mono.CompilerServices.SymbolWriter;
-
-namespace Symbolicate
-{
- struct Location {
- public string FileName;
- public int Line;
- }
-
- class LocationProvider {
- class AssemblyLocationProvider {
- AssemblyDefinition assembly;
- MonoSymbolFile symbolFile;
-
- public AssemblyLocationProvider (AssemblyDefinition assembly, MonoSymbolFile symbolFile)
- {
- this.assembly = assembly;
- this.symbolFile = symbolFile;
- }
-
- public bool TryGetLocation (string methodFullName, string[] methodParamsTypes, int ilOffset, out Location location)
- {
- location = default (Location);
- if (symbolFile == null)
- return false;
-
- var typeNameEnd = methodFullName.LastIndexOf (".");
- var typeName = methodFullName.Substring (0, typeNameEnd);
- var methodName = methodFullName.Substring (typeNameEnd + 1, methodFullName.Length - typeNameEnd - 1);
-
- var type = assembly.MainModule.Types.FirstOrDefault (t => t.FullName == typeName);
- if (type == null)
- return false;
-
- var method = type.Methods.FirstOrDefault (m => {
- if (m.Name != methodName)
- return false;
-
- if (m.Parameters.Count != methodParamsTypes.Length)
- return false;
-
- for (var i = 0; i < methodParamsTypes.Length; i++) {
- var paramType = m.Parameters[i].ParameterType;
- if (paramType.Name != methodParamsTypes[i])
- return false;
- }
-
- return true;
- });
-
- if (method == null)
- return false;
-
- var methodSymbol = symbolFile.Methods [method.MetadataToken.RID-1];
-
- foreach (var lineNumber in methodSymbol.GetLineNumberTable ().LineNumbers) {
- if (lineNumber.Offset < ilOffset)
- continue;
-
- location.FileName = symbolFile.Sources [lineNumber.File-1].FileName;
- location.Line = lineNumber.Row;
- return true;
- }
-
- return false;
- }
- }
-
- Dictionary<string, AssemblyLocationProvider> assemblies;
- HashSet<string> directories;
-
- public LocationProvider () {
- assemblies = new Dictionary<string, AssemblyLocationProvider> ();
- directories = new HashSet<string> ();
- }
-
- public void AddAssembly (string assemblyPath)
- {
- assemblyPath = Path.GetFullPath (assemblyPath);
- if (assemblies.ContainsKey (assemblyPath))
- return;
-
- if (!File.Exists (assemblyPath))
- throw new ArgumentException ("assemblyPath does not exist: "+ assemblyPath);
-
- var assembly = AssemblyDefinition.ReadAssembly (assemblyPath);
- MonoSymbolFile symbolFile = null;
-
- var symbolPath = assemblyPath + ".mdb";
- if (!File.Exists (symbolPath))
- Debug.WriteLine (".mdb file was not found for " + assemblyPath);
- else
- symbolFile = MonoSymbolFile.ReadSymbolFile (assemblyPath + ".mdb");
-
- assemblies.Add (assemblyPath, new AssemblyLocationProvider (assembly, symbolFile));
-
- directories.Add (Path.GetDirectoryName (assemblyPath));
-
- foreach (var assemblyRef in assembly.MainModule.AssemblyReferences) {
- string refPath = null;
- foreach (var dir in directories) {
- refPath = Path.Combine (dir, assemblyRef.Name);
- if (File.Exists (refPath))
- break;
- refPath = Path.Combine (dir, assemblyRef.Name + ".dll");
- if (File.Exists (refPath))
- break;
- refPath = Path.Combine (dir, assemblyRef.Name + ".exe");
- if (File.Exists (refPath))
- break;
- refPath = null;
- }
- if (refPath != null)
- AddAssembly (refPath);
- }
- }
-
- public void AddDirectory (string directory)
- {
- if (Directory.Exists (directory))
- throw new ArgumentException ("Directory " + directory + " does not exist.");
-
- directories.Add (directory);
- }
-
- public bool TryGetLocation (string methodName, string[] methodParams, int ilOffset, out Location location)
- {
- location = default (Location);
- foreach (var assembly in assemblies.Values) {
- if (assembly.TryGetLocation (methodName, methodParams, ilOffset, out location))
- return true;
- }
-
- return false;
- }
- }
-}
-
+++ /dev/null
-thisdir = tools/symbolicate
-SUBDIRS =
-include ../../build/rules.make
-
-PROGRAM = symbolicate.exe
-
-LOCAL_MCS_FLAGS = \
- /r:Mono.Cecil.dll \
- /r:Mono.CompilerServices.SymbolWriter.dll \
- /r:System.Xml
-
-include ../../build/executable.make
-
-LIB_PATH = $(topdir)/class/lib/$(PROFILE)
-
-MONO = MONO_PATH=$(LIB_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH $(RUNTIME)
-
-OUT_DIR = Test/out
-TEST_CS = Test/StackTraceDumper.cs
-TEST_EXE = $(OUT_DIR)/StackTraceDumper.exe
-RELEASE_FILE = $(OUT_DIR)/release.out
-SYMBOLICATE_FILE = $(OUT_DIR)/symbolicate.out
-SYMBOLICATE_EXPECTED_FILE = Test/symbolicate.expected
-
-build-test:
- @mkdir -p $(OUT_DIR)
- @$(MCS) -debug $(TEST_CS) -out:$(TEST_EXE)
-
-check: all build-test
- @MONO_DEBUG=gen-compact-seq-points $(MONO) $(TEST_EXE) > $(RELEASE_FILE)
- @$(MONO) $(LIB_PATH)/symbolicate.exe $(TEST_EXE) $(RELEASE_FILE) | sed "s/\[.*Test\//in /" > $(SYMBOLICATE_FILE)
- @DIFF=$$(diff $(SYMBOLICATE_FILE) $(SYMBOLICATE_EXPECTED_FILE)); \
- if [ ! -z "$$DIFF" ]; then \
- echo "Symbolicate tests failed."; \
- echo "If $(SYMBOLICATE_FILE) is correct copy it to $(SYMBOLICATE_EXPECTED_FILE)."; \
- echo "Otherwise runtime sequence points need to be fixed."; \
- echo "$$DIFF"; \
- exit 1; \
- fi
+++ /dev/null
-Mono Symbolicate Tool - README
-
-symbolicate is a tool that converts a stack trace with `<filename unknown>:0`
-into one with file names and line numbers.
-
-Usage
------------------------------
-
-The tool takes as input an exe, a file with stack traces and optionaly one or
-more directories where referenced assemblies mdb files are located.
-
-The output of calling this tool will be the provided file with
-stack traces where `<filename unknown>:0` parts are replaced by
-a file name and a line number.
-
-To use the tool, run the following command:
-
- mono symbolicate.exe your.exe filewithstacktraces [mdbfolders]
\ No newline at end of file
+++ /dev/null
-using System;
-
-class StackTraceDumper {
- public static void Main () {
- // Stacktrace with no depth
- try {
- throw new Exception ();
- } catch (Exception e) {
- Console.WriteLine (e);
- }
- // Stacktrace with depth of 1
- try {
- ThrowException ();
- } catch (Exception e) {
- Console.WriteLine (e);
- }
- // Stacktrace with depth of 2
- try {
- ThrowException2 ();
- } catch (Exception e) {
- Console.WriteLine (e);
- }
- }
-
- public static void ThrowException () {
- Console.WriteLine ("Exception is not in the first line!");
- throw new Exception ();
- }
-
- public static void ThrowException2 () {
- ThrowException ();
- }
-
-}
\ No newline at end of file
+++ /dev/null
-System.Exception: Exception of type 'System.Exception' was thrown.
- at StackTraceDumper.Main () in StackTraceDumper.cs:7
-Exception is not in the first line!
-System.Exception: Exception of type 'System.Exception' was thrown.
- at StackTraceDumper.ThrowException () in StackTraceDumper.cs:27
- at StackTraceDumper.Main () in StackTraceDumper.cs:13
-Exception is not in the first line!
-System.Exception: Exception of type 'System.Exception' was thrown.
- at StackTraceDumper.ThrowException () in StackTraceDumper.cs:27
- at StackTraceDumper.ThrowException2 () in StackTraceDumper.cs:31
- at StackTraceDumper.Main () in StackTraceDumper.cs:19
+++ /dev/null
-using System;
-using System.IO;
-using System.Globalization;
-using System.Text.RegularExpressions;
-
-namespace Symbolicate
-{
- public class Program
- {
- static Regex regex = new Regex (@"\w*at (?<MethodName>.+) \((?<MethodParams>.*)\) \[0x(?<IL>.+)\] in <filename unknown>:0");
-
- public static int Main (String[] args)
- {
- if (args.Length < 2) {
- Console.Error.WriteLine ("Usage: symbolicate <assembly path> <input file> [lookup directories]");
- return 1;
- }
-
- var assemblyPath = args [0];
- var inputFile = args [1];
-
- var locProvider = new LocationProvider ();
-
- for (var i = 2; i < args.Length; i++)
- locProvider.AddDirectory (args [i]);
-
- locProvider.AddAssembly (assemblyPath);
-
- using (StreamReader r = new StreamReader (inputFile)) {
- for (var line = r.ReadLine (); line != null; line = r.ReadLine ()) {
- line = SymbolicateLine (line, locProvider);
- Console.WriteLine (line);
- }
- }
-
- return 0;
- }
-
- static string SymbolicateLine (string line, LocationProvider locProvider)
- {
- var match = regex.Match (line);
- if (!match.Success)
- return line;
-
- var methodName = match.Groups ["MethodName"].Value;
- var methodParams = ParseParametersTypes (match.Groups ["MethodParams"].Value);
- var ilOffset = int.Parse (match.Groups ["IL"].Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture);
-
- Location location;
- if (!locProvider.TryGetLocation (methodName, methodParams, ilOffset, out location))
- return line;
-
- return line.Replace ("<filename unknown>:0", string.Format ("{0}:{1}", location.FileName, location.Line));
- }
-
- static string[] ParseParametersTypes (string parameters)
- {
- if (string.IsNullOrEmpty (parameters))
- return new string [0];
-
- var paramsArray = parameters.Split (',');
- var paramsTypes = new string [paramsArray.Length];
- for (var i = 0; i < paramsArray.Length; i++)
- paramsTypes [i] = paramsArray [i].Trim ().Split (new char[]{' '}, 2)[0];
-
- return paramsTypes;
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-symbolicate.cs
-LocationProvider.cs
\ No newline at end of file
for (i = 0; i < t->rows; i++){
guint32 cols [MONO_PROPERTY_SIZE];
char *type;
- int bsize;
int prop_flags;
mono_metadata_decode_row (t, i, cols, MONO_PROPERTY_SIZE);
strcat (flags, "hasdefault ");
ptr = mono_metadata_blob_heap (m, cols [MONO_PROPERTY_TYPE]);
- bsize = mono_metadata_decode_blob_size (ptr, &ptr);
+ /* bsize = */ mono_metadata_decode_blob_size (ptr, &ptr);
/* ECMA claims 0x08 ... */
if (*ptr != 0x28 && *ptr != 0x08)
g_warning("incorrect signature in propert blob: 0x%x", *ptr);
const char *ptr;
char *s, *result;
GString *res = g_string_new ("");
- int len;
MonoMethodSignature *sig;
mono_metadata_decode_row (&m->tables [MONO_TABLE_TYPESPEC], idx-1, cols, MONO_TYPESPEC_SIZE);
ptr = mono_metadata_blob_heap (m, cols [MONO_TYPESPEC_SIGNATURE]);
- len = mono_metadata_decode_value (ptr, &ptr);
+ /* len = */ mono_metadata_decode_value (ptr, &ptr);
switch (*ptr++){
case MONO_TYPE_PTR:
{
char *allocated_modifier_string, *allocated_type_string;
const char *ptr = mono_metadata_blob_heap (m, blob_signature);
- const char *base;
char *res;
int len;
len = mono_metadata_decode_value (ptr, &ptr);
- base = ptr;
/* FIELD is 0x06 */
g_assert (*ptr == 0x06);
/* hex_dump (ptr, 0, len); */
char *allocated_ret_type, *s;
const char *cconv_str;
gboolean seen_vararg = 0;
- int param_count, signature_len;
+ int param_count;
int i, gen_count = 0;
int cconv;
- signature_len = mono_metadata_decode_value (ptr, &ptr);
+ /* signature_len = */ mono_metadata_decode_value (ptr, &ptr);
if (*ptr & 0x20){
if (*ptr & 0x40)
char*
get_marshal_info (MonoImage *m, const char *blob) {
- int len, size = 0;
+ int size = 0;
- len = mono_metadata_decode_blob_size (blob, &blob);
+ /* len = */ mono_metadata_decode_blob_size (blob, &blob);
switch (*blob) {
case MONO_NATIVE_BOOLEAN:
unsigned char flags = *(const unsigned char *) ptr;
unsigned char format = flags & METHOD_HEADER_FORMAT_MASK;
guint16 fat_flags;
- guint32 local_var_sig_tok, max_stack, code_size, init_locals;
- int hsize;
+ guint32 local_var_sig_tok, init_locals;
g_assert (format == METHOD_HEADER_FAT_FORMAT);
fat_flags = read16 (ptr);
ptr += 2;
- hsize = (fat_flags >> 12) & 0xf;
- max_stack = read16 (ptr);
+ /* max_stack = read16 (ptr); */
ptr += 2;
- code_size = read32 (ptr);
+ /* code_size = read32 (ptr); */
ptr += 4;
local_var_sig_tok = read32 (ptr);
ptr += 4;
{
MonoImageOpenStatus status;
MonoImage *img;
- MonoAssembly *assembly;
-
img = mono_image_open (file, &status);
if (!img) {
fprintf (stderr, "Error while trying to process %s\n", file);
return;
} else {
- assembly = mono_assembly_load_from_full (img, file, &status, FALSE);
+ /* FIXME: is this call necessary? */
+ mono_assembly_load_from_full (img, file, &status, FALSE);
}
setup_filter (img);
struct _WapiHandle_file *file_handle;
gboolean ok;
struct stat statbuf;
- off_t size, pos;
+ off_t pos;
int ret, fd;
ok=_wapi_lookup_handle (handle, WAPI_HANDLE_FILE,
_wapi_set_last_error_from_errno ();
return(FALSE);
}
- size=statbuf.st_size;
pos=lseek(fd, (off_t)0, SEEK_CUR);
if(pos==-1) {
}
#ifdef FTRUNCATE_DOESNT_EXTEND
+ off_t size = statbuf.st_size;
/* I haven't bothered to write the configure.ac stuff for this
* because I don't know if any platform needs it. I'm leaving
* this code just in case though
static void process_close (gpointer handle, gpointer data);
static gboolean is_pid_valid (pid_t pid);
-#if !defined(__OpenBSD__)
+#if !(defined(PLATFORM_MACOSX) || defined(__OpenBSD__) || defined(__HAIKU__))
static FILE *
open_process_map (int pid, const char *mode);
#endif
}
static gboolean
-is_readable (const char *prog)
+is_readable_or_executable (const char *prog)
{
struct stat buf;
- if (access (prog, R_OK) != 0)
+ int a = access (prog, R_OK);
+ int b = access (prog, X_OK);
+ if (a != 0 && b != 0)
return FALSE;
if (stat (prog, &buf))
return FALSE;
prog = g_strdup (unquoted);
/* Executable existing ? */
- if (!is_readable (prog)) {
+ if (!is_readable_or_executable (prog)) {
DEBUG ("%s: Couldn't find executable %s",
__func__, prog);
g_free (unquoted);
g_free (curdir);
/* And make sure it's readable */
- if (!is_readable (prog)) {
+ if (!is_readable_or_executable (prog)) {
DEBUG ("%s: Couldn't find executable %s",
__func__, prog);
g_free (unquoted);
prog = g_strdup (token);
/* Executable existing ? */
- if (!is_readable (prog)) {
+ if (!is_readable_or_executable (prog)) {
DEBUG ("%s: Couldn't find executable %s",
__func__, token);
g_free (token);
*
* X_OK is too strict *if* the target is a CLR binary
*/
- if (!is_readable (prog)) {
+ if (!is_readable_or_executable (prog)) {
g_free (prog);
prog = g_find_program_in_path (token);
if (prog == NULL) {
return result;
}
-#if !defined(__OpenBSD__)
+#if !(defined(PLATFORM_MACOSX) || defined(__OpenBSD__) || defined(__HAIKU__))
static FILE *
open_process_map (int pid, const char *mode)
{
process_wait (gpointer handle, guint32 timeout, gboolean alertable)
{
WapiHandle_process *process_handle;
- pid_t pid, ret;
+ pid_t pid G_GNUC_UNUSED, ret;
int status;
guint32 start;
guint32 now;
}
#ifndef PLATFORM_PORT_PROVIDES_IOCTLSOCKET
-int ioctlsocket(guint32 fd, gint32 command, gpointer arg)
+int ioctlsocket(guint32 fd, unsigned long command, gpointer arg)
{
gpointer handle = GUINT_TO_POINTER (fd);
int ret;
extern int WSAGetLastError(void);
extern int closesocket(guint32 handle);
-extern int ioctlsocket(guint32 handle, gint32 command, gpointer arg);
+extern int ioctlsocket(guint32 handle, unsigned long command, gpointer arg);
extern int WSAIoctl (guint32 handle, gint32 command,
gchar *input, gint i_len,
gchar *output, gint o_len, glong *written,
get_fixedfileinfo_block (gconstpointer data, version_data *block)
{
gconstpointer data_ptr;
- gint32 data_len; /* signed to guard against underflow */
WapiFixedFileInfo *ffi;
data_ptr = get_versioninfo_block (data, block);
- data_len = block->data_len;
if (block->value_len != sizeof(WapiFixedFileInfo)) {
DEBUG ("%s: FIXEDFILEINFO size mismatch", __func__);
guint32
SleepEx (guint32 ms, gboolean alertable)
{
- struct timespec req;
int ms_quot, ms_rem;
int ret;
gpointer current_thread = NULL;
ms_quot = ms / 1000;
ms_rem = ms % 1000;
- req.tv_sec=ms_quot;
- req.tv_nsec=ms_rem*1000000;
-
#if defined (__linux__) && !defined(PLATFORM_ANDROID)
/* Use clock_nanosleep () to prevent time drifting problems when nanosleep () is interrupted by signals */
ret = clock_gettime (CLOCK_MONOTONIC, &start);
}
#else
+ struct timespec req;
+
+ req.tv_sec=ms_quot;
+ req.tv_nsec=ms_rem*1000000;
again:
memset (&rem, 0, sizeof (rem));
WapiHandle_thread *thread;
gpointer prev_handle, wait_handle;
- thread = lookup_thread (thread_handle);
+ thread = lookup_thread (thread_handle); /* FIXME this is wrong, move this whole thing to MonoThreads where it can be done lockfree */
while (TRUE) {
wait_handle = thread->wait_handle;
file-mmap.h \
object-offsets.h \
abi-details.h \
- metadata-cross-helpers.c
+ metadata-cross-helpers.c \
+ seq-points-data.h \
+ seq-points-data.c
# These source files have compile time dependencies on GC code
* of classes the runtime knows about, changing icall signature or
* semantics etc), increment this variable. Also increment the
* pair of this variable in mscorlib in:
- * mcs/class/mscorlib/System/Environment.cs
+ * mcs/class/corlib/System/Environment.cs
*
* Changes which are already detected at runtime, like the addition
* of icalls, do not require an increment.
*/
-#define MONO_CORLIB_VERSION 119
+#define MONO_CORLIB_VERSION 120
typedef struct
{
MonoCustomAttrEntry *attr = &attrs->attrs [i];
MonoAssemblyName *aname;
const gchar *data;
- guint slen;
/* Do some sanity checking */
if (!attr->ctor || attr->ctor->klass != mono_defaults.internals_visible_class)
continue;
/* 0xFF means null string, see custom attr format */
if (data [0] != 1 || data [1] != 0 || (data [2] & 0xFF) == 0xFF)
continue;
- slen = mono_metadata_decode_value (data + 2, &data);
+ mono_metadata_decode_value (data + 2, &data);
aname = g_new0 (MonoAssemblyName, 1);
/*g_print ("friend ass: %s\n", data);*/
if (mono_assembly_name_parse_full (data, aname, TRUE, NULL, NULL)) {
return (((int)buf [0]) << 0) | (((int)buf [1]) << 8) | (((int)buf [2]) << 16) | (((int)buf [3]) << 24);
}
-static inline int
-decode_short (guint8 *buf, guint8 **endbuf, guint8 *limit)
-{
- *endbuf = buf + 2;
- g_assert (*endbuf <= limit);
-
- return (((int)buf [0]) << 0) | (((int)buf [1]) << 8);
-}
-
static char*
decode_string_value (guint8 *buf, guint8 **endbuf, guint8 *limit)
{
G_BEGIN_DECLS
void
-mono_attach_parse_options (char *options) MONO_INTERNAL;
+mono_attach_parse_options (char *options);
void
-mono_attach_init (void) MONO_INTERNAL;
+mono_attach_init (void);
gboolean
-mono_attach_start (void) MONO_INTERNAL;
+mono_attach_start (void);
void
-mono_attach_maybe_start (void) MONO_INTERNAL;
+mono_attach_maybe_start (void);
void
-mono_attach_cleanup (void) MONO_INTERNAL;
+mono_attach_cleanup (void);
G_END_DECLS
/* If GC_no_dls is set to true, GC_find_limit is not called. This causes a seg fault on Android. */
GC_no_dls = TRUE;
#endif
+ {
+ if ((env = g_getenv ("MONO_GC_DEBUG"))) {
+ char **opts = g_strsplit (env, ",", -1);
+ for (char **ptr = opts; ptr && *ptr; ptr ++) {
+ char *opt = *ptr;
+ if (!strcmp (opt, "do-not-finalize")) {
+ do_not_finalize = 1;
+ } else if (!strcmp (opt, "log-finalizers")) {
+ log_finalizers = 1;
+ }
+ }
+ }
+ }
+
GC_init ();
+
GC_oom_fn = mono_gc_out_of_memory;
GC_set_warn_proc (mono_gc_warning);
GC_finalize_on_demand = 1;
gc_stats.major_gc_time += mono_100ns_ticks () - gc_start_time;
mono_trace_message (MONO_TRACE_GC, "gc took %d usecs", (mono_100ns_ticks () - gc_start_time) / 10);
break;
+ default:
+ break;
}
mono_profiler_gc_event (e, 0);
};
#ifdef COMPRESSED_INTERFACE_BITMAP
-int mono_compress_bitmap (uint8_t *dest, const uint8_t *bitmap, int size) MONO_INTERNAL;
-int mono_class_interface_match (const uint8_t *bitmap, int id) MONO_INTERNAL;
+int mono_compress_bitmap (uint8_t *dest, const uint8_t *bitmap, int size);
+int mono_class_interface_match (const uint8_t *bitmap, int id);
#else
#define mono_class_interface_match(bmap,uiid) ((bmap) [(uiid) >> 3] & (1 << ((uiid)&7)))
#endif
MONO_API int mono_class_interface_offset (MonoClass *klass, MonoClass *itf);
-int mono_class_interface_offset_with_variance (MonoClass *klass, MonoClass *itf, gboolean *non_exact_match) MONO_INTERNAL;
+int mono_class_interface_offset_with_variance (MonoClass *klass, MonoClass *itf, gboolean *non_exact_match);
typedef gpointer MonoRuntimeGenericContext;
struct _MonoGenericParam {
/*
* Type or method this parameter was defined in.
- * If this is non-null, this is a MonoGenericParamFull structure.
*/
MonoGenericContainer *owner;
guint16 num;
- /* For internal runtime use, used to make different versions of the same param */
- guint16 serial;
+ /*
+ * If != 0, this is a generated generic param used by the JIT to implement generic
+ * sharing.
+ */
+ MonoTypeEnum gshared_constraint;
/*
* If owner is NULL, or owner is 'owned' by this gparam,
* then this is the image whose mempool this struct was allocated from.
#define mono_generic_param_owner(p) ((p)->owner)
#define mono_generic_param_num(p) ((p)->num)
#define mono_generic_param_info(p) (mono_generic_param_owner (p) ? &((MonoGenericParamFull *) p)->info : NULL)
+#define mono_generic_param_name(p) (((mono_generic_param_owner (p) || (p)->gshared_constraint)) ? ((MonoGenericParamFull *) p)->info.name : NULL)
#define mono_type_get_generic_param_owner(t) (mono_generic_param_owner ((t)->data.generic_param))
#define mono_type_get_generic_param_num(t) (mono_generic_param_num ((t)->data.generic_param))
} MonoLoaderError;
void
-mono_class_setup_supertypes (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_supertypes (MonoClass *klass);
void
-mono_class_setup_fields_locking (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_fields_locking (MonoClass *klass);
/* WARNING
* Only call this function if you can ensure both @klass and @parent
guint threadpool_iothreads;
} MonoPerfCounters;
-extern MonoPerfCounters *mono_perfcounters MONO_INTERNAL;
+extern MonoPerfCounters *mono_perfcounters;
MONO_API void mono_perfcounters_init (void);
#define MONO_GENERIC_CONTEXT_USED_BOTH (MONO_GENERIC_CONTEXT_USED_CLASS | MONO_GENERIC_CONTEXT_USED_METHOD)
-extern MonoStats mono_stats MONO_INTERNAL;
+extern MonoStats mono_stats;
typedef gpointer (*MonoTrampoline) (MonoMethod *method);
typedef gpointer (*MonoJumpTrampoline) (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper);
}
void
-mono_classes_init (void) MONO_INTERNAL;
+mono_classes_init (void);
void
-mono_classes_cleanup (void) MONO_INTERNAL;
+mono_classes_cleanup (void);
void
-mono_class_layout_fields (MonoClass *klass) MONO_INTERNAL;
+mono_class_layout_fields (MonoClass *klass);
void
-mono_class_setup_interface_offsets (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_interface_offsets (MonoClass *klass);
void
-mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int onum, GList *in_setup) MONO_INTERNAL;
+mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int onum, GList *in_setup);
void
-mono_class_setup_vtable (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_vtable (MonoClass *klass);
void
-mono_class_setup_methods (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_methods (MonoClass *klass);
void
-mono_class_setup_mono_type (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_mono_type (MonoClass *klass);
void
-mono_class_setup_parent (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
+mono_class_setup_parent (MonoClass *klass, MonoClass *parent);
MonoMethod*
-mono_class_get_method_by_index (MonoClass *klass, int index) MONO_INTERNAL;
+mono_class_get_method_by_index (MonoClass *klass, int index);
MonoMethod*
-mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method) MONO_INTERNAL;
+mono_class_get_inflated_method (MonoClass *klass, MonoMethod *method);
MonoMethod*
-mono_class_get_vtable_entry (MonoClass *klass, int offset) MONO_INTERNAL;
+mono_class_get_vtable_entry (MonoClass *klass, int offset);
GPtrArray*
-mono_class_get_implemented_interfaces (MonoClass *klass, MonoError *error) MONO_INTERNAL;
+mono_class_get_implemented_interfaces (MonoClass *klass, MonoError *error);
int
-mono_class_get_vtable_size (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_vtable_size (MonoClass *klass);
gboolean
-mono_class_is_open_constructed_type (MonoType *t) MONO_INTERNAL;
+mono_class_is_open_constructed_type (MonoType *t);
gboolean
mono_class_get_overrides_full (MonoImage *image, guint32 type_token, MonoMethod ***overrides, gint32 *num_overrides,
- MonoGenericContext *generic_context) MONO_INTERNAL;
+ MonoGenericContext *generic_context);
MonoMethod*
-mono_class_get_cctor (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_cctor (MonoClass *klass);
MonoMethod*
-mono_class_get_finalizer (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_finalizer (MonoClass *klass);
gboolean
-mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller) MONO_INTERNAL;
+mono_class_needs_cctor_run (MonoClass *klass, MonoMethod *caller);
gboolean
-mono_class_field_is_special_static (MonoClassField *field) MONO_INTERNAL;
+mono_class_field_is_special_static (MonoClassField *field);
guint32
-mono_class_field_get_special_static_type (MonoClassField *field) MONO_INTERNAL;
+mono_class_field_get_special_static_type (MonoClassField *field);
gboolean
-mono_class_has_special_static_fields (MonoClass *klass) MONO_INTERNAL;
+mono_class_has_special_static_fields (MonoClass *klass);
const char*
-mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_type) MONO_INTERNAL;
+mono_class_get_field_default_value (MonoClassField *field, MonoTypeEnum *def_type);
const char*
-mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type) MONO_INTERNAL;
+mono_class_get_property_default_value (MonoProperty *property, MonoTypeEnum *def_type);
void
-mono_install_trampoline (MonoTrampoline func) MONO_INTERNAL;
+mono_install_trampoline (MonoTrampoline func);
void
-mono_install_jump_trampoline (MonoJumpTrampoline func) MONO_INTERNAL;
+mono_install_jump_trampoline (MonoJumpTrampoline func);
void
-mono_install_delegate_trampoline (MonoDelegateTrampoline func) MONO_INTERNAL;
+mono_install_delegate_trampoline (MonoDelegateTrampoline func);
gpointer
-mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context) MONO_INTERNAL;
+mono_lookup_dynamic_token (MonoImage *image, guint32 token, MonoGenericContext *context);
gpointer
-mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, gboolean check_token, MonoClass **handle_class, MonoGenericContext *context) MONO_INTERNAL;
+mono_lookup_dynamic_token_class (MonoImage *image, guint32 token, gboolean check_token, MonoClass **handle_class, MonoGenericContext *context);
void
-mono_install_lookup_dynamic_token (MonoLookupDynamicToken func) MONO_INTERNAL;
+mono_install_lookup_dynamic_token (MonoLookupDynamicToken func);
gpointer
-mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper) MONO_INTERNAL;
+mono_runtime_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper);
gpointer
-mono_runtime_create_delegate_trampoline (MonoClass *klass) MONO_INTERNAL;
+mono_runtime_create_delegate_trampoline (MonoClass *klass);
void
-mono_install_get_cached_class_info (MonoGetCachedClassInfo func) MONO_INTERNAL;
+mono_install_get_cached_class_info (MonoGetCachedClassInfo func);
void
-mono_install_get_class_from_name (MonoGetClassFromName func) MONO_INTERNAL;
+mono_install_get_class_from_name (MonoGetClassFromName func);
MonoGenericContext*
-mono_class_get_context (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_context (MonoClass *klass);
MonoMethodSignature*
-mono_method_signature_checked (MonoMethod *m, MonoError *err) MONO_INTERNAL;
+mono_method_signature_checked (MonoMethod *m, MonoError *err);
MonoGenericContext*
-mono_method_get_context_general (MonoMethod *method, gboolean uninflated) MONO_INTERNAL;
+mono_method_get_context_general (MonoMethod *method, gboolean uninflated);
MonoGenericContext*
-mono_method_get_context (MonoMethod *method) MONO_INTERNAL;
+mono_method_get_context (MonoMethod *method);
/* Used by monodis, thus cannot be MONO_INTERNAL */
MONO_API MonoGenericContainer*
mono_method_get_generic_container (MonoMethod *method);
MonoGenericContext*
-mono_generic_class_get_context (MonoGenericClass *gclass) MONO_INTERNAL;
+mono_generic_class_get_context (MonoGenericClass *gclass);
MonoClass*
-mono_generic_class_get_class (MonoGenericClass *gclass) MONO_INTERNAL;
+mono_generic_class_get_class (MonoGenericClass *gclass);
void
-mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container) MONO_INTERNAL;
+mono_method_set_generic_container (MonoMethod *method, MonoGenericContainer* container);
MonoMethod*
-mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context) MONO_INTERNAL;
+mono_class_inflate_generic_method_full (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context);
MonoMethod*
-mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_class_inflate_generic_method_full_checked (MonoMethod *method, MonoClass *klass_hint, MonoGenericContext *context, MonoError *error);
MonoMethod *
-mono_class_inflate_generic_method_checked (MonoMethod *method, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_class_inflate_generic_method_checked (MonoMethod *method, MonoGenericContext *context, MonoError *error);
MonoMethodInflated*
-mono_method_inflated_lookup (MonoMethodInflated* method, gboolean cache) MONO_INTERNAL;
+mono_method_inflated_lookup (MonoMethodInflated* method, gboolean cache);
MONO_API MonoMethodSignature *
mono_metadata_get_inflated_signature (MonoMethodSignature *sig, MonoGenericContext *context);
MonoType*
-mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_class_inflate_generic_type_with_mempool (MonoImage *image, MonoType *type, MonoGenericContext *context, MonoError *error);
MonoClass*
-mono_class_inflate_generic_class (MonoClass *gklass, MonoGenericContext *context) MONO_INTERNAL;
+mono_class_inflate_generic_class (MonoClass *gklass, MonoGenericContext *context);
MonoType*
-mono_class_inflate_generic_type_checked (MonoType *type, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_class_inflate_generic_type_checked (MonoType *type, MonoGenericContext *context, MonoError *error);
MONO_API void
mono_metadata_free_inflated_signature (MonoMethodSignature *sig);
MonoMethodSignature*
-mono_inflate_generic_signature (MonoMethodSignature *sig, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_inflate_generic_signature (MonoMethodSignature *sig, MonoGenericContext *context, MonoError *error);
typedef struct {
MonoImage *corlib;
#define mono_object_is_transparent_proxy(object) (FALSE)
#else
MonoRemoteClass*
-mono_remote_class (MonoDomain *domain, MonoString *class_name, MonoClass *proxy_class) MONO_INTERNAL;
+mono_remote_class (MonoDomain *domain, MonoString *class_name, MonoClass *proxy_class);
void
-mono_install_remoting_trampoline (MonoRemotingTrampoline func) MONO_INTERNAL;
+mono_install_remoting_trampoline (MonoRemotingTrampoline func);
#define mono_class_is_transparent_proxy(klass) ((klass) == mono_defaults.transparent_proxy_class)
#define mono_class_is_real_proxy(klass) ((klass) == mono_defaults.real_proxy_class)
#endif
-extern MonoDefaults mono_defaults MONO_INTERNAL;
+extern MonoDefaults mono_defaults;
void
-mono_loader_init (void) MONO_INTERNAL;
+mono_loader_init (void);
void
-mono_loader_cleanup (void) MONO_INTERNAL;
+mono_loader_cleanup (void);
void
mono_loader_lock (void) MONO_LLVM_INTERNAL;
mono_loader_unlock (void) MONO_LLVM_INTERNAL;
void
-mono_loader_lock_track_ownership (gboolean track) MONO_INTERNAL;
+mono_loader_lock_track_ownership (gboolean track);
gboolean
-mono_loader_lock_is_owned_by_self (void) MONO_INTERNAL;
+mono_loader_lock_is_owned_by_self (void);
void
-mono_loader_lock_if_inited (void) MONO_INTERNAL;
+mono_loader_lock_if_inited (void);
void
-mono_loader_unlock_if_inited (void) MONO_INTERNAL;
+mono_loader_unlock_if_inited (void);
void
-mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only) MONO_INTERNAL;
+mono_loader_set_error_assembly_load (const char *assembly_name, gboolean ref_only);
void
-mono_loader_set_error_type_load (const char *class_name, const char *assembly_name) MONO_INTERNAL;
+mono_loader_set_error_type_load (const char *class_name, const char *assembly_name);
void
-mono_loader_set_error_method_load (const char *class_name, const char *member_name) MONO_INTERNAL;
+mono_loader_set_error_method_load (const char *class_name, const char *member_name);
void
-mono_loader_set_error_field_load (MonoClass *klass, const char *member_name) MONO_INTERNAL;
+mono_loader_set_error_field_load (MonoClass *klass, const char *member_name);
void
-mono_loader_set_error_bad_image (char *msg) MONO_INTERNAL;
+mono_loader_set_error_bad_image (char *msg);
MonoException *
-mono_loader_error_prepare_exception (MonoLoaderError *error) MONO_INTERNAL;
+mono_loader_error_prepare_exception (MonoLoaderError *error);
MonoLoaderError *
-mono_loader_get_last_error (void) MONO_INTERNAL;
+mono_loader_get_last_error (void);
void
-mono_loader_clear_error (void) MONO_INTERNAL;
+mono_loader_clear_error (void);
void
-mono_reflection_init (void) MONO_INTERNAL;
+mono_reflection_init (void);
void
-mono_icall_init (void) MONO_INTERNAL;
+mono_icall_init (void);
void
-mono_icall_cleanup (void) MONO_INTERNAL;
+mono_icall_cleanup (void);
gpointer
-mono_method_get_wrapper_data (MonoMethod *method, guint32 id) MONO_INTERNAL;
+mono_method_get_wrapper_data (MonoMethod *method, guint32 id);
gboolean
-mono_metadata_has_generic_params (MonoImage *image, guint32 token) MONO_INTERNAL;
+mono_metadata_has_generic_params (MonoImage *image, guint32 token);
MONO_API MonoGenericContainer *
mono_metadata_load_generic_params (MonoImage *image, guint32 token,
MonoGenericContainer *container, MonoError *error);
MonoMethodSignature*
-mono_create_icall_signature (const char *sigstr) MONO_INTERNAL;
+mono_create_icall_signature (const char *sigstr);
MonoJitICallInfo *
-mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save) MONO_INTERNAL;
+mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
MonoJitICallInfo *
-mono_register_jit_icall_full (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save, gboolean no_raise, const char *c_symbol) MONO_INTERNAL;
+mono_register_jit_icall_full (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save, gboolean no_raise, const char *c_symbol);
void
-mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper) MONO_INTERNAL;
+mono_register_jit_icall_wrapper (MonoJitICallInfo *info, gconstpointer wrapper);
MonoJitICallInfo *
mono_find_jit_icall_by_name (const char *name) MONO_LLVM_INTERNAL;
mono_find_jit_icall_by_addr (gconstpointer addr) MONO_LLVM_INTERNAL;
GHashTable*
-mono_get_jit_icall_info (void) MONO_INTERNAL;
+mono_get_jit_icall_info (void);
const char*
-mono_lookup_jit_icall_symbol (const char *name) MONO_INTERNAL;
+mono_lookup_jit_icall_symbol (const char *name);
gboolean
-mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data) MONO_INTERNAL;
+mono_class_set_failure (MonoClass *klass, guint32 ex_type, void *ex_data);
gpointer
-mono_class_get_exception_data (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_exception_data (MonoClass *klass);
MonoException*
-mono_class_get_exception_for_failure (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_exception_for_failure (MonoClass *klass);
char*
-mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format) MONO_INTERNAL;
+mono_type_get_name_full (MonoType *type, MonoTypeNameFormat format);
char*
-mono_type_get_full_name (MonoClass *klass) MONO_INTERNAL;
+mono_type_get_full_name (MonoClass *klass);
-MonoArrayType *mono_dup_array_type (MonoImage *image, MonoArrayType *a) MONO_INTERNAL;
-MonoMethodSignature *mono_metadata_signature_deep_dup (MonoImage *image, MonoMethodSignature *sig) MONO_INTERNAL;
+MonoArrayType *mono_dup_array_type (MonoImage *image, MonoArrayType *a);
+MonoMethodSignature *mono_metadata_signature_deep_dup (MonoImage *image, MonoMethodSignature *sig);
MONO_API void
mono_image_init_name_cache (MonoImage *image);
-gboolean mono_class_is_nullable (MonoClass *klass) MONO_INTERNAL;
-MonoClass *mono_class_get_nullable_param (MonoClass *klass) MONO_INTERNAL;
+gboolean mono_class_is_nullable (MonoClass *klass);
+MonoClass *mono_class_get_nullable_param (MonoClass *klass);
/* object debugging functions, for use inside gdb */
MONO_API void mono_object_describe (MonoObject *obj);
mono_class_is_valid_enum (MonoClass *klass);
MonoType *
-mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_type_get_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
gboolean
-mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass) MONO_INTERNAL;
+mono_generic_class_is_generic_type_definition (MonoGenericClass *gklass);
MonoMethod*
-mono_class_get_method_generic (MonoClass *klass, MonoMethod *method) MONO_INTERNAL;
+mono_class_get_method_generic (MonoClass *klass, MonoMethod *method);
MonoType*
-mono_type_get_basic_type_from_generic (MonoType *type) MONO_INTERNAL;
+mono_type_get_basic_type_from_generic (MonoType *type);
gboolean
-mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass) MONO_INTERNAL;
+mono_method_can_access_method_full (MonoMethod *method, MonoMethod *called, MonoClass *context_klass);
gboolean
-mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass) MONO_INTERNAL;
+mono_method_can_access_field_full (MonoMethod *method, MonoClassField *field, MonoClass *context_klass);
gboolean
-mono_class_can_access_class (MonoClass *access_class, MonoClass *target_class) MONO_INTERNAL;
+mono_class_can_access_class (MonoClass *access_class, MonoClass *target_class);
MonoClass *
-mono_class_get_generic_type_definition (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_generic_type_definition (MonoClass *klass);
gboolean
-mono_class_has_parent_and_ignore_generics (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
+mono_class_has_parent_and_ignore_generics (MonoClass *klass, MonoClass *parent);
int
-mono_method_get_vtable_slot (MonoMethod *method) MONO_INTERNAL;
+mono_method_get_vtable_slot (MonoMethod *method);
int
-mono_method_get_vtable_index (MonoMethod *method) MONO_INTERNAL;
+mono_method_get_vtable_index (MonoMethod *method);
MonoMethod*
-mono_method_search_in_array_class (MonoClass *klass, const char *name, MonoMethodSignature *sig) MONO_INTERNAL;
+mono_method_search_in_array_class (MonoClass *klass, const char *name, MonoMethodSignature *sig);
void
-mono_class_setup_interface_id (MonoClass *klass) MONO_INTERNAL;
+mono_class_setup_interface_id (MonoClass *klass);
MonoGenericContainer*
-mono_class_get_generic_container (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_generic_container (MonoClass *klass);
MonoGenericClass*
-mono_class_get_generic_class (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_generic_class (MonoClass *klass);
void
-mono_class_alloc_ext (MonoClass *klass) MONO_INTERNAL;
+mono_class_alloc_ext (MonoClass *klass);
void
-mono_class_setup_interfaces (MonoClass *klass, MonoError *error) MONO_INTERNAL;
+mono_class_setup_interfaces (MonoClass *klass, MonoError *error);
MonoClassField*
-mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoType *type) MONO_INTERNAL;
+mono_class_get_field_from_name_full (MonoClass *klass, const char *name, MonoType *type);
MonoVTable*
-mono_class_vtable_full (MonoDomain *domain, MonoClass *klass, gboolean raise_on_error) MONO_INTERNAL;
+mono_class_vtable_full (MonoDomain *domain, MonoClass *klass, gboolean raise_on_error);
gboolean
-mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate) MONO_INTERNAL;
+mono_class_is_assignable_from_slow (MonoClass *target, MonoClass *candidate);
gboolean
-mono_class_has_variant_generic_params (MonoClass *klass) MONO_INTERNAL;
+mono_class_has_variant_generic_params (MonoClass *klass);
gboolean
-mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean check_for_reference_conv) MONO_INTERNAL;
+mono_class_is_variant_compatible (MonoClass *klass, MonoClass *oklass, gboolean check_for_reference_conv);
-gboolean mono_is_corlib_image (MonoImage *image) MONO_INTERNAL;
+gboolean mono_is_corlib_image (MonoImage *image);
MonoType*
-mono_field_get_type_checked (MonoClassField *field, MonoError *error) MONO_INTERNAL;
+mono_field_get_type_checked (MonoClassField *field, MonoError *error);
MonoClassField*
-mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter) MONO_INTERNAL;
+mono_class_get_fields_lazy (MonoClass* klass, gpointer *iter);
gboolean
-mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup) MONO_INTERNAL;
+mono_class_check_vtable_constraints (MonoClass *klass, GList *in_setup);
gboolean
-mono_class_has_finalizer (MonoClass *klass) MONO_INTERNAL;
+mono_class_has_finalizer (MonoClass *klass);
void
-mono_unload_interface_id (MonoClass *klass) MONO_INTERNAL;
+mono_unload_interface_id (MonoClass *klass);
GPtrArray*
-mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex) MONO_INTERNAL;
+mono_class_get_methods_by_name (MonoClass *klass, const char *name, guint32 bflags, gboolean ignore_case, gboolean allow_ctors, MonoException **ex);
char*
-mono_class_full_name (MonoClass *klass) MONO_INTERNAL;
+mono_class_full_name (MonoClass *klass);
MonoClass*
-mono_class_inflate_generic_class_checked (MonoClass *gklass, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_class_inflate_generic_class_checked (MonoClass *gklass, MonoGenericContext *context, MonoError *error);
MonoClass *
-mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error) MONO_INTERNAL;
+mono_class_get_checked (MonoImage *image, guint32 type_token, MonoError *error);
MonoClass *
-mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_class_get_and_inflate_typespec_checked (MonoImage *image, guint32 type_token, MonoGenericContext *context, MonoError *error);
MonoClass *
-mono_class_from_name_case_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error) MONO_INTERNAL;
+mono_class_from_name_case_checked (MonoImage *image, const char* name_space, const char *name, MonoError *error);
MonoClassField*
-mono_field_from_token_checked (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_field_from_token_checked (MonoImage *image, uint32_t token, MonoClass **retklass, MonoGenericContext *context, MonoError *error);
gpointer
-mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_ldtoken_checked (MonoImage *image, guint32 token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error);
#endif /* __MONO_METADATA_CLASS_INTERBALS_H__ */
case MONO_TYPE_VOID:
//case MONO_TYPE_TYPEDBYREF:
return FALSE;
+ default:
+ return TRUE;
}
- return TRUE;
}
static MonoType*
return type->data.array->eklass->exception_type;
case MONO_TYPE_GENERICINST:
return mono_generic_class_get_class (type->data.generic_class)->exception_type;
+ default:
+ return FALSE;
}
- return FALSE;
}
/*
MonoType*
mono_type_get_basic_type_from_generic (MonoType *type)
{
- /* When we do generic sharing we let type variables stand for reference types. */
- if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR))
+ /* When we do generic sharing we let type variables stand for reference/primitive types. */
+ if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && !type->data.generic_param->gshared_constraint)
return &mono_defaults.object_class->byval_arg;
return type;
}
GHashTable *override_map = NULL;
gboolean security_enabled = mono_security_enabled ();
MonoMethod *cm;
- gpointer class_iter;
#if (DEBUG_INTERFACE_VTABLE_CODE|TRACE_INTERFACE_VTABLE_CODE)
int first_non_interface_slot;
#endif
// otherwise look for a matching method
if (override_im == NULL) {
int cm_index;
- gpointer iter;
MonoMethod *cm;
// First look for a suitable method among the class methods
- iter = NULL;
for (l = virt_methods; l; l = l->next) {
cm = l->data;
TRACE_INTERFACE_VTABLE (printf (" For slot %d ('%s'.'%s':'%s'), trying method '%s'.'%s':'%s'... [EXPLICIT IMPLEMENTATION = %d][SLOT IS NULL = %d]", im_slot, ic->name_space, ic->name, im->name, cm->klass->name_space, cm->klass->name, cm->name, interface_is_explicitly_implemented_by_class, (vtable [im_slot] == NULL)));
}
TRACE_INTERFACE_VTABLE (print_vtable_full (class, vtable, cur_slot, first_non_interface_slot, "AFTER SETTING UP INTERFACE METHODS", FALSE));
- class_iter = NULL;
for (l = virt_methods; l; l = l->next) {
cm = l->data;
/*
/*Init these fields to sane values*/
klass->min_align = 1;
- klass->instance_size = sizeof (gpointer);
+ /*
+ * This makes sure the the value size of this class is equal to the size of the types the gparam is
+ * constrained to, the JIT depends on this.
+ */
+ klass->instance_size = sizeof (MonoObject) + mono_type_stack_size_internal (&klass->byval_arg, NULL, TRUE);
mono_memory_barrier ();
klass->size_inited = 1;
+ klass->setup_fields_called = 1;
mono_class_setup_supertypes (klass);
static MonoClass *
get_anon_gparam_class (MonoGenericParam *param, gboolean is_mvar, gboolean take_lock)
{
- int n = mono_generic_param_num (param) | ((guint32)param->serial << 16);
+ int n = mono_generic_param_num (param) | ((guint32)param->gshared_constraint << 16);
MonoImage *image = param->image;
GHashTable *ht;
static void
set_anon_gparam_class (MonoGenericParam *param, gboolean is_mvar, MonoClass *klass)
{
- int n = mono_generic_param_num (param) | ((guint32)param->serial << 16);
+ int n = mono_generic_param_num (param) | ((guint32)param->gshared_constraint << 16);
MonoImage *image = param->image;
g_assert (image);
#endif
class->cast_class = mono_defaults.int64_class;
break;
+ default:
+ break;
}
class->element_class = eclass;
case MONO_TYPE_OBJECT:
case MONO_TYPE_SZARRAY:
case MONO_TYPE_ARRAY:
- case MONO_TYPE_VAR:
- case MONO_TYPE_MVAR:
return sizeof (gpointer);
case MONO_TYPE_I8:
case MONO_TYPE_U8:
case MONO_TYPE_GENERICINST:
type = &type->data.generic_class->container_class->byval_arg;
goto handle_enum;
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR: {
+ int align;
+ return mono_type_size (type, &align);
+ }
case MONO_TYPE_VOID:
return 0;
case MONO_TYPE_GENERICINST:
if (!can_access_type (access_klass, mono_class_from_mono_type (type)))
return FALSE;
+ default:
+ break;
}
}
return TRUE;
case MONO_TYPE_I:
case MONO_TYPE_U:
return TRUE;
+ default:
+ return FALSE;
}
- return FALSE;
}
/**
static MonoClass* com_interop_proxy_class = NULL;
static MonoMethod* com_interop_proxy_get_proxy = NULL;
static MonoMethod* get_transparent_proxy = NULL;
- int real_proxy;
guint32 pos_null = 0, pos_ccw = 0, pos_end = 0;
MonoClass *klass = NULL;
get_transparent_proxy = mono_class_get_method_from_name (mono_defaults.real_proxy_class, "GetTransparentProxy", 0);
#endif
- real_proxy = mono_mb_add_local (mb, &com_interop_proxy_class->byval_arg);
+ mono_mb_add_local (mb, &com_interop_proxy_class->byval_arg);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_I);
MonoMethodSignature *sig;
MonoMethodBuilder *mb;
MonoMethod *res;
- int i, temp_obj;
+ int i;
GHashTable* cache = mono_marshal_get_cache (&method->klass->image->cominterop_invoke_cache, mono_aligned_addr_hash, NULL);
g_assert (method);
mb = mono_mb_new (method->klass, method->name, MONO_WRAPPER_COMINTEROP_INVOKE);
/* get real proxy object, which is a ComInteropProxy in this case*/
- temp_obj = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
+ mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_ldflda (mb, MONO_STRUCT_OFFSET (MonoTransparentProxy, rp));
mono_mb_emit_byte (mb, CEE_LDIND_REF);
#include <mono/metadata/marshal.h>
void
-mono_cominterop_init (void) MONO_INTERNAL;
+mono_cominterop_init (void);
void
-mono_cominterop_cleanup (void) MONO_INTERNAL;
+mono_cominterop_cleanup (void);
void
-mono_mb_emit_cominterop_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethod* method) MONO_INTERNAL;
+mono_mb_emit_cominterop_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethod* method);
void
-mono_cominterop_emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv conv, MonoMarshalSpec *mspec) MONO_INTERNAL;
+mono_cominterop_emit_ptr_to_object_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv conv, MonoMarshalSpec *mspec);
void
-mono_cominterop_emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv conv, MonoMarshalSpec *mspec) MONO_INTERNAL;
+mono_cominterop_emit_object_to_ptr_conv (MonoMethodBuilder *mb, MonoType *type, MonoMarshalConv conv, MonoMarshalSpec *mspec);
MonoMethod *
-mono_cominterop_get_native_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_cominterop_get_native_wrapper (MonoMethod *method);
MonoMethod *
-mono_cominterop_get_invoke (MonoMethod *method) MONO_INTERNAL;
+mono_cominterop_get_invoke (MonoMethod *method);
int
mono_cominterop_emit_marshal_com_interface (EmitMarshalContext *m, int argnum,
MonoType *t,
MonoMarshalSpec *spec,
int conv_arg, MonoType **conv_arg_type,
- MarshalAction action) MONO_INTERNAL;
+ MarshalAction action);
int
mono_cominterop_emit_marshal_safearray (EmitMarshalContext *m, int argnum,
MonoType *t,
MonoMarshalSpec *spec,
int conv_arg, MonoType **conv_arg_type,
- MarshalAction action) MONO_INTERNAL;
+ MarshalAction action);
MONO_API MonoString *
mono_string_from_bstr (gpointer bstr);
G_BEGIN_DECLS
-void mono_console_init (void) MONO_INTERNAL;
-void mono_console_handle_async_ops (void) MONO_INTERNAL;
-MonoBoolean ves_icall_System_ConsoleDriver_Isatty (HANDLE handle) MONO_INTERNAL;
-gint32 ves_icall_System_ConsoleDriver_InternalKeyAvailable (gint32 timeout) MONO_INTERNAL;
-MonoBoolean ves_icall_System_ConsoleDriver_SetEcho (MonoBoolean echo) MONO_INTERNAL;
-MonoBoolean ves_icall_System_ConsoleDriver_SetBreak (MonoBoolean want_break) MONO_INTERNAL;
-MonoBoolean ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardown, MonoArray **control_characters, int **size) MONO_INTERNAL;
-void ves_icall_System_ConsoleDriver_Suspend (void) MONO_INTERNAL;
+void mono_console_init (void);
+void mono_console_handle_async_ops (void);
+MonoBoolean ves_icall_System_ConsoleDriver_Isatty (HANDLE handle);
+gint32 ves_icall_System_ConsoleDriver_InternalKeyAvailable (gint32 timeout);
+MonoBoolean ves_icall_System_ConsoleDriver_SetEcho (MonoBoolean echo);
+MonoBoolean ves_icall_System_ConsoleDriver_SetBreak (MonoBoolean want_break);
+MonoBoolean ves_icall_System_ConsoleDriver_TtySetup (MonoString *keypad, MonoString *teardown, MonoArray **control_characters, int **size);
+void ves_icall_System_ConsoleDriver_Suspend (void);
G_END_DECLS
static void
tty_teardown (void)
{
- int unused;
+ int unused G_GNUC_UNUSED;
if (!setup_finished)
return;
MONO_SIG_HANDLER_FUNC (static, sigcont_handler)
{
- int unused;
+ int unused G_GNUC_UNUSED;
// Ignore error, there is not much we can do in the sigcont handler.
tcsetattr (STDIN_FILENO, TCSANOW, &mono_attr);
#define __ImageBase _image_base__
#endif
#endif
-extern IMAGE_DOS_HEADER __ImageBase MONO_INTERNAL;
+extern IMAGE_DOS_HEADER __ImageBase;
-extern HMODULE coree_module_handle MONO_INTERNAL;
+extern HMODULE coree_module_handle;
-HMODULE WINAPI MonoLoadImage(LPCWSTR FileName) MONO_INTERNAL;
-STDAPI MonoFixupExe(HMODULE ModuleHandle) MONO_INTERNAL;
+HMODULE WINAPI MonoLoadImage(LPCWSTR FileName);
+STDAPI MonoFixupExe(HMODULE ModuleHandle);
-gchar* mono_get_module_file_name (HMODULE module_handle) MONO_INTERNAL;
-void mono_load_coree (const char* file_name) MONO_INTERNAL;
-void mono_fixup_exe_image (MonoImage* image) MONO_INTERNAL;
+gchar* mono_get_module_file_name (HMODULE module_handle);
+void mono_load_coree (const char* file_name);
+void mono_fixup_exe_image (MonoImage* image);
/* Declared in image.c. */
-MonoImage* mono_image_open_from_module_handle (HMODULE module_handle, char* fname, gboolean has_entry_point, MonoImageOpenStatus* status) MONO_INTERNAL;
+MonoImage* mono_image_open_from_module_handle (HMODULE module_handle, char* fname, gboolean has_entry_point, MonoImageOpenStatus* status);
#endif /* HOST_WIN32 */
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
if (type->data.generic_param) {
- MonoGenericParamInfo *info = mono_generic_param_info (type->data.generic_param);
- if (info)
- g_string_append (res, info->name);
+ const char *name = mono_generic_param_name (type->data.generic_param);
+ if (name)
+ g_string_append (res, name);
else
g_string_append_printf (res, "%s%d", type->type == MONO_TYPE_VAR ? "!" : "!!", mono_generic_param_num (type->data.generic_param));
} else {
mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
{
MonoClass *klass;
- const MonoTableInfo *tdef;
const MonoTableInfo *methods;
MonoMethod *method;
int i;
return mono_method_desc_search_in_class (desc, klass);
}
- tdef = mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
+ /* FIXME: Is this call necessary? We don't use its result. */
+ mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
methods = mono_image_get_table_info (image, MONO_TABLE_METHOD);
for (i = 0; i < mono_table_info_get_rows (methods); ++i) {
guint32 token = mono_metadata_decode_row_col (methods, i, MONO_METHOD_NAME);
{
MonoSymbolFile *symfile = minfo->handle->symfile;
const uint8_t *p;
- int i, len, compile_unit_index, locals_offset, num_locals, block_index;
- int namespace_id, code_block_table_offset;
+ int i, len, locals_offset, num_locals, block_index;
+ int code_block_table_offset;
MonoDebugLocalsInfo *res;
if (!symfile)
p = symfile->raw_contents + minfo->data_offset;
- compile_unit_index = read_leb128 (p, &p);
+ /* compile_unit_index = */ read_leb128 (p, &p);
locals_offset = read_leb128 (p, &p);
- namespace_id = read_leb128 (p, &p);
+ /* namespace_id = */ read_leb128 (p, &p);
code_block_table_offset = read_leb128 (p, &p);
res = g_new0 (MonoDebugLocalsInfo, 1);
}
// Decimal addition
-static MonoDecimalStatus
+static MonoDecimalStatus G_GNUC_UNUSED
mono_decimal_add(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result)
{
return DecAddSub (left, right, result, 0);
}
// Decimal subtraction
-static MonoDecimalStatus
+static MonoDecimalStatus G_GNUC_UNUSED
mono_decimal_sub(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result)
{
return DecAddSub (left, right, result, DECIMAL_NEG);
}
// mono_decimal_divide - Decimal divide
-static MonoDecimalStatus
+static MonoDecimalStatus G_GNUC_UNUSED
mono_decimal_divide_result(MonoDecimal *left, MonoDecimal *right, MonoDecimal *result)
{
uint32_t quo[3];
}
// mono_decimal_absolute - Decimal Absolute Value
-static void
+static void G_GNUC_UNUSED
mono_decimal_absolute (MonoDecimal *pdecOprd, MonoDecimal *result)
{
COPYDEC(*result, *pdecOprd);
}
// mono_decimal_negate - Decimal Negate
-static void
+static void G_GNUC_UNUSED
mono_decimal_negate (MonoDecimal *pdecOprd, MonoDecimal *result)
{
COPYDEC(*result, *pdecOprd);
} MonoDecimalCompareResult;
MonoDecimalCompareResult
- mono_decimal_compare (MonoDecimal *left, MonoDecimal *right) MONO_INTERNAL;
+ mono_decimal_compare (MonoDecimal *left, MonoDecimal *right);
-void mono_decimal_init_single (MonoDecimal *_this, float value) MONO_INTERNAL;
-void mono_decimal_init_double (MonoDecimal *_this, double value) MONO_INTERNAL;
-void mono_decimal_floor (MonoDecimal *d) MONO_INTERNAL;
-int32_t mono_decimal_get_hash_code (MonoDecimal *d) MONO_INTERNAL;
-void mono_decimal_multiply (MonoDecimal *d1, MonoDecimal *d2) MONO_INTERNAL;
-void mono_decimal_round (MonoDecimal *d, int32_t decimals) MONO_INTERNAL;
-void mono_decimal_tocurrency (MonoDecimal *decimal) MONO_INTERNAL;
-double mono_decimal_to_double (MonoDecimal d) MONO_INTERNAL;
-int32_t mono_decimal_to_int32 (MonoDecimal d) MONO_INTERNAL;
-float mono_decimal_to_float (MonoDecimal d) MONO_INTERNAL;
-void mono_decimal_truncate (MonoDecimal *d) MONO_INTERNAL;
+void mono_decimal_init_single (MonoDecimal *_this, float value);
+void mono_decimal_init_double (MonoDecimal *_this, double value);
+void mono_decimal_floor (MonoDecimal *d);
+int32_t mono_decimal_get_hash_code (MonoDecimal *d);
+void mono_decimal_multiply (MonoDecimal *d1, MonoDecimal *d2);
+void mono_decimal_round (MonoDecimal *d, int32_t decimals);
+void mono_decimal_tocurrency (MonoDecimal *decimal);
+double mono_decimal_to_double (MonoDecimal d);
+int32_t mono_decimal_to_int32 (MonoDecimal d);
+float mono_decimal_to_float (MonoDecimal d);
+void mono_decimal_truncate (MonoDecimal *d);
void mono_decimal_addsub (MonoDecimal *left, MonoDecimal *right, uint8_t sign);
void mono_decimal_divide (MonoDecimal *left, MonoDecimal *right);
int mono_decimal_from_number (void *from, MonoDecimal *target);
typedef MonoDomain* (*MonoLoadFunc) (const char *filename, const char *runtime_version);
void
-mono_install_runtime_load (MonoLoadFunc func) MONO_INTERNAL;
+mono_install_runtime_load (MonoLoadFunc func);
MonoDomain*
-mono_runtime_load (const char *filename, const char *runtime_version) MONO_INTERNAL;
+mono_runtime_load (const char *filename, const char *runtime_version);
typedef void (*MonoCreateDomainFunc) (MonoDomain *domain);
void
-mono_install_create_domain_hook (MonoCreateDomainFunc func) MONO_INTERNAL;
+mono_install_create_domain_hook (MonoCreateDomainFunc func);
typedef void (*MonoFreeDomainFunc) (MonoDomain *domain);
void
-mono_install_free_domain_hook (MonoFreeDomainFunc func) MONO_INTERNAL;
+mono_install_free_domain_hook (MonoFreeDomainFunc func);
void
-mono_cleanup (void) MONO_INTERNAL;
+mono_cleanup (void);
void
-mono_close_exe_image (void) MONO_INTERNAL;
+mono_close_exe_image (void);
int
-mono_jit_info_size (MonoJitInfoFlags flags, int num_clauses, int num_holes) MONO_INTERNAL;
+mono_jit_info_size (MonoJitInfoFlags flags, int num_clauses, int num_holes);
void
mono_jit_info_init (MonoJitInfo *ji, MonoMethod *method, guint8 *code, int code_size,
- MonoJitInfoFlags flags, int num_clauses, int num_holes) MONO_INTERNAL;
+ MonoJitInfoFlags flags, int num_clauses, int num_holes);
MonoJitInfoTable *
-mono_jit_info_table_new (MonoDomain *domain) MONO_INTERNAL;
+mono_jit_info_table_new (MonoDomain *domain);
void
-mono_jit_info_table_free (MonoJitInfoTable *table) MONO_INTERNAL;
+mono_jit_info_table_free (MonoJitInfoTable *table);
void
-mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_table_add (MonoDomain *domain, MonoJitInfo *ji);
void
-mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_table_remove (MonoDomain *domain, MonoJitInfo *ji);
void
-mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end) MONO_INTERNAL;
+mono_jit_info_add_aot_module (MonoImage *image, gpointer start, gpointer end);
MonoGenericJitInfo*
-mono_jit_info_get_generic_jit_info (MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_get_generic_jit_info (MonoJitInfo *ji);
MonoGenericSharingContext*
-mono_jit_info_get_generic_sharing_context (MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_get_generic_sharing_context (MonoJitInfo *ji);
void
-mono_jit_info_set_generic_sharing_context (MonoJitInfo *ji, MonoGenericSharingContext *gsctx) MONO_INTERNAL;
+mono_jit_info_set_generic_sharing_context (MonoJitInfo *ji, MonoGenericSharingContext *gsctx);
char *
-mono_make_shadow_copy (const char *filename) MONO_INTERNAL;
+mono_make_shadow_copy (const char *filename);
gboolean
-mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name) MONO_INTERNAL;
+mono_is_shadow_copy_enabled (MonoDomain *domain, const gchar *dir_name);
gpointer
-mono_domain_alloc (MonoDomain *domain, guint size) MONO_INTERNAL;
+mono_domain_alloc (MonoDomain *domain, guint size);
gpointer
-mono_domain_alloc0 (MonoDomain *domain, guint size) MONO_INTERNAL;
+mono_domain_alloc0 (MonoDomain *domain, guint size);
gpointer
-mono_domain_alloc0_lock_free (MonoDomain *domain, guint size) MONO_INTERNAL;
+mono_domain_alloc0_lock_free (MonoDomain *domain, guint size);
void*
mono_domain_code_reserve (MonoDomain *domain, int size) MONO_LLVM_INTERNAL;
void*
-mono_domain_code_reserve_align (MonoDomain *domain, int size, int alignment) MONO_INTERNAL;
+mono_domain_code_reserve_align (MonoDomain *domain, int size, int alignment);
void
-mono_domain_code_commit (MonoDomain *domain, void *data, int size, int newsize) MONO_INTERNAL;
+mono_domain_code_commit (MonoDomain *domain, void *data, int size, int newsize);
void *
-nacl_domain_get_code_dest (MonoDomain *domain, void *data) MONO_INTERNAL;
+nacl_domain_get_code_dest (MonoDomain *domain, void *data);
void
-nacl_domain_code_validate (MonoDomain *domain, guint8 **buf_base, int buf_size, guint8 **code_end) MONO_INTERNAL;
+nacl_domain_code_validate (MonoDomain *domain, guint8 **buf_base, int buf_size, guint8 **code_end);
void
-mono_domain_code_foreach (MonoDomain *domain, MonoCodeManagerFunc func, void *user_data) MONO_INTERNAL;
+mono_domain_code_foreach (MonoDomain *domain, MonoCodeManagerFunc func, void *user_data);
void
-mono_domain_unset (void) MONO_INTERNAL;
+mono_domain_unset (void);
void
-mono_domain_set_internal_with_options (MonoDomain *domain, gboolean migrate_exception) MONO_INTERNAL;
+mono_domain_set_internal_with_options (MonoDomain *domain, gboolean migrate_exception);
MonoTryBlockHoleTableJitInfo*
-mono_jit_info_get_try_block_hole_table_info (MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_get_try_block_hole_table_info (MonoJitInfo *ji);
MonoArchEHJitInfo*
-mono_jit_info_get_arch_eh_info (MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_get_arch_eh_info (MonoJitInfo *ji);
MonoMethodCasInfo*
-mono_jit_info_get_cas_info (MonoJitInfo *ji) MONO_INTERNAL;
+mono_jit_info_get_cas_info (MonoJitInfo *ji);
/*
* Installs a new function which is used to return a MonoJitInfo for a method inside
* an AOT module.
*/
typedef MonoJitInfo *(*MonoJitInfoFindInAot) (MonoDomain *domain, MonoImage *image, gpointer addr);
-void mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func) MONO_INTERNAL;
+void mono_install_jit_info_find_in_aot (MonoJitInfoFindInAot func);
void
-mono_jit_code_hash_init (MonoInternalHashTable *jit_code_hash) MONO_INTERNAL;
+mono_jit_code_hash_init (MonoInternalHashTable *jit_code_hash);
MonoAppDomain *
-ves_icall_System_AppDomain_getCurDomain (void) MONO_INTERNAL;
+ves_icall_System_AppDomain_getCurDomain (void);
MonoAppDomain *
-ves_icall_System_AppDomain_getRootDomain (void) MONO_INTERNAL;
+ves_icall_System_AppDomain_getRootDomain (void);
MonoAppDomain *
ves_icall_System_AppDomain_createDomain (MonoString *friendly_name,
- MonoAppDomainSetup *setup) MONO_INTERNAL;
+ MonoAppDomainSetup *setup);
MonoObject *
ves_icall_System_AppDomain_GetData (MonoAppDomain *ad,
- MonoString *name) MONO_INTERNAL;
+ MonoString *name);
MonoReflectionAssembly *
ves_icall_System_AppDomain_LoadAssemblyRaw (MonoAppDomain *ad,
MonoArray *raw_assembly,
MonoArray *raw_symbol_store,
MonoObject *evidence,
- MonoBoolean refonly) MONO_INTERNAL;
+ MonoBoolean refonly);
void
ves_icall_System_AppDomain_SetData (MonoAppDomain *ad,
MonoString *name,
- MonoObject *data) MONO_INTERNAL;
+ MonoObject *data);
MonoAppDomainSetup *
-ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad) MONO_INTERNAL;
+ves_icall_System_AppDomain_getSetup (MonoAppDomain *ad);
MonoString *
-ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad) MONO_INTERNAL;
+ves_icall_System_AppDomain_getFriendlyName (MonoAppDomain *ad);
MonoArray *
ves_icall_System_AppDomain_GetAssemblies (MonoAppDomain *ad,
- MonoBoolean refonly) MONO_INTERNAL;
+ MonoBoolean refonly);
MonoReflectionAssembly *
ves_icall_System_Reflection_Assembly_LoadFrom (MonoString *fname,
- MonoBoolean refonly) MONO_INTERNAL;
+ MonoBoolean refonly);
MonoReflectionAssembly *
ves_icall_System_AppDomain_LoadAssembly (MonoAppDomain *ad,
MonoString *assRef,
MonoObject *evidence,
- MonoBoolean refonly) MONO_INTERNAL;
+ MonoBoolean refonly);
gboolean
-ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalIsFinalizingForUnload (gint32 domain_id);
void
-ves_icall_System_AppDomain_InternalUnload (gint32 domain_id) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalUnload (gint32 domain_id);
gint32
ves_icall_System_AppDomain_ExecuteAssembly (MonoAppDomain *ad,
MonoReflectionAssembly *refass,
- MonoArray *args) MONO_INTERNAL;
+ MonoArray *args);
MonoAppDomain *
-ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalSetDomain (MonoAppDomain *ad);
MonoAppDomain *
-ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalSetDomainByID (gint32 domainid);
void
-ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalPushDomainRef (MonoAppDomain *ad);
void
-ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalPushDomainRefByID (gint32 domain_id);
void
-ves_icall_System_AppDomain_InternalPopDomainRef (void) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalPopDomainRef (void);
MonoAppContext *
-ves_icall_System_AppDomain_InternalGetContext (void) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalGetContext (void);
MonoAppContext *
-ves_icall_System_AppDomain_InternalGetDefaultContext (void) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalGetDefaultContext (void);
MonoAppContext *
-ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalSetContext (MonoAppContext *mc);
gint32
-ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad) MONO_INTERNAL;
+ves_icall_System_AppDomain_GetIDFromDomain (MonoAppDomain * ad);
MonoString *
-ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid) MONO_INTERNAL;
+ves_icall_System_AppDomain_InternalGetProcessGuid (MonoString* newguid);
MonoAssembly *
-mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *status) MONO_INTERNAL;
+mono_assembly_load_corlib (const MonoRuntimeInfo *runtime, MonoImageOpenStatus *status);
const MonoRuntimeInfo*
-mono_get_runtime_info (void) MONO_INTERNAL;
+mono_get_runtime_info (void);
void
-mono_runtime_set_no_exec (gboolean val) MONO_INTERNAL;
+mono_runtime_set_no_exec (gboolean val);
gboolean
-mono_runtime_get_no_exec (void) MONO_INTERNAL;
+mono_runtime_get_no_exec (void);
gboolean
-mono_assembly_name_parse (const char *name, MonoAssemblyName *aname) MONO_INTERNAL;
+mono_assembly_name_parse (const char *name, MonoAssemblyName *aname);
MonoImage *mono_assembly_open_from_bundle (const char *filename,
MonoImageOpenStatus *status,
- gboolean refonly) MONO_INTERNAL;
+ gboolean refonly);
MONO_API void
mono_domain_add_class_static_data (MonoDomain *domain, MonoClass *klass, gpointer data, guint32 *bitmap);
MonoReflectionAssembly *
-mono_try_assembly_resolve (MonoDomain *domain, MonoString *fname, MonoAssembly *requesting, gboolean refonly) MONO_INTERNAL;
+mono_try_assembly_resolve (MonoDomain *domain, MonoString *fname, MonoAssembly *requesting, gboolean refonly);
MonoAssembly *
-mono_domain_assembly_postload_search (MonoAssemblyName *aname, MonoAssembly *requesting, gboolean refonly) MONO_INTERNAL;
+mono_domain_assembly_postload_search (MonoAssemblyName *aname, MonoAssembly *requesting, gboolean refonly);
MonoAssembly* mono_assembly_load_full_nosearch (MonoAssemblyName *aname,
const char *basedir,
MonoImageOpenStatus *status,
- gboolean refonly) MONO_INTERNAL;
+ gboolean refonly);
-void mono_set_private_bin_path_from_config (MonoDomain *domain) MONO_INTERNAL;
+void mono_set_private_bin_path_from_config (MonoDomain *domain);
-int mono_framework_version (void) MONO_INTERNAL;
+int mono_framework_version (void);
-void mono_reflection_cleanup_domain (MonoDomain *domain) MONO_INTERNAL;
+void mono_reflection_cleanup_domain (MonoDomain *domain);
-void mono_assembly_cleanup_domain_bindings (guint32 domain_id) MONO_INTERNAL;
+void mono_assembly_cleanup_domain_bindings (guint32 domain_id);
-MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot) MONO_INTERNAL;
+MonoJitInfo* mono_jit_info_table_find_internal (MonoDomain *domain, char *addr, gboolean try_aot);
void mono_enable_debug_domain_unload (gboolean enable);
#include <mono/utils/mono-compiler.h>
#include <mono/io-layer/io-layer.h>
-extern MonoString* ves_icall_System_Environment_GetOSVersionString (void) MONO_INTERNAL;
+extern MonoString* ves_icall_System_Environment_GetOSVersionString (void);
#if !defined(HOST_WIN32) && defined(HAVE_SYS_UTSNAME_H)
#include <sys/utsname.h>
/* System.IO.MonoIO */
extern MonoBoolean
-ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_CreateDirectory (MonoString *path, gint32 *error);
extern MonoBoolean
-ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_RemoveDirectory (MonoString *path, gint32 *error);
MonoArray *
ves_icall_System_IO_MonoIO_GetFileSystemEntries (MonoString *path,
MonoString *path_with_pattern,
gint mask, gint attrs,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern MonoString *
ves_icall_System_IO_MonoIO_FindFirst (MonoString *path,
MonoString *path_with_pattern,
gint32 *result_mask,
gint32 *error,
- gpointer *handle) MONO_INTERNAL;
+ gpointer *handle);
extern MonoString *
-ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_FindNext (gpointer handle, gint32 *result_mask, gint32 *error);
extern int
-ves_icall_System_IO_MonoIO_FindClose (gpointer handle) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_FindClose (gpointer handle);
extern MonoString *
-ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetCurrentDirectory (gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_SetCurrentDirectory (MonoString *path,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_MoveFile (MonoString *path, MonoString *dest,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_CopyFile (MonoString *path, MonoString *dest,
- MonoBoolean overwrite, gint32 *error) MONO_INTERNAL;
+ MonoBoolean overwrite, gint32 *error);
extern MonoBoolean
-ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_DeleteFile (MonoString *path, gint32 *error);
extern gint32
-ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetFileAttributes (MonoString *path, gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_SetFileAttributes (MonoString *path, gint32 attrs,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern gint32
-ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetFileType (HANDLE handle, gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_GetFileStat (MonoString *path, MonoIOStat *stat,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern HANDLE
ves_icall_System_IO_MonoIO_Open (MonoString *filename, gint32 mode,
gint32 access_mode, gint32 share, gint32 options,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern MonoBoolean
-ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_Close (HANDLE handle, gint32 *error);
extern gint32
ves_icall_System_IO_MonoIO_Read (HANDLE handle, MonoArray *dest,
gint32 dest_offset, gint32 count,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern gint32
ves_icall_System_IO_MonoIO_Write (HANDLE handle, MonoArray *src,
gint32 src_offset, gint32 count,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern gint64
ves_icall_System_IO_MonoIO_Seek (HANDLE handle, gint64 offset, gint32 origin,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern MonoBoolean
-ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_Flush (HANDLE handle, gint32 *error);
extern gint64
-ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetLength (HANDLE handle, gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_SetLength (HANDLE handle, gint64 length,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_SetFileTime (HANDLE handle, gint64 creation_time,
gint64 last_access_time,
- gint64 last_write_time, gint32 *error) MONO_INTERNAL;
+ gint64 last_write_time, gint32 *error);
extern HANDLE
-ves_icall_System_IO_MonoIO_get_ConsoleOutput (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_ConsoleOutput (void);
extern HANDLE
-ves_icall_System_IO_MonoIO_get_ConsoleInput (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_ConsoleInput (void);
extern HANDLE
-ves_icall_System_IO_MonoIO_get_ConsoleError (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_ConsoleError (void);
extern MonoBoolean
ves_icall_System_IO_MonoIO_CreatePipe (HANDLE *read_handle,
- HANDLE *write_handle) MONO_INTERNAL;
+ HANDLE *write_handle);
extern MonoBoolean ves_icall_System_IO_MonoIO_DuplicateHandle (HANDLE source_process_handle,
HANDLE source_handle, HANDLE target_process_handle, HANDLE *target_handle,
- gint32 access, gint32 inherit, gint32 options) MONO_INTERNAL;
+ gint32 access, gint32 inherit, gint32 options);
extern gunichar2
-ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_VolumeSeparatorChar (void);
extern gunichar2
-ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_DirectorySeparatorChar (void);
extern gunichar2
-ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_AltDirectorySeparatorChar (void);
extern gunichar2
-ves_icall_System_IO_MonoIO_get_PathSeparator (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_PathSeparator (void);
extern MonoArray *
-ves_icall_System_IO_MonoIO_get_InvalidPathChars (void) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_get_InvalidPathChars (void);
extern gint32
-ves_icall_System_IO_MonoIO_GetTempPath (MonoString **mono_name) MONO_INTERNAL;
+ves_icall_System_IO_MonoIO_GetTempPath (MonoString **mono_name);
extern void ves_icall_System_IO_MonoIO_Lock (HANDLE handle, gint64 position,
- gint64 length, gint32 *error) MONO_INTERNAL;
+ gint64 length, gint32 *error);
extern void ves_icall_System_IO_MonoIO_Unlock (HANDLE handle, gint64 position,
- gint64 length, gint32 *error) MONO_INTERNAL;
+ gint64 length, gint32 *error);
extern MonoBoolean
ves_icall_System_IO_MonoIO_ReplaceFile (MonoString *sourceFileName, MonoString *destinationFileName,
MonoString *destinationBackupFileName, MonoBoolean ignoreMetadataErrors,
- gint32 *error) MONO_INTERNAL;
+ gint32 *error);
extern gint64
mono_filesize_from_path (MonoString *path);
#include <mono/io-layer/io-layer.h>
#include <mono/utils/mono-compiler.h>
-extern void mono_mmap_close (void *mmap_handle) MONO_INTERNAL;
+extern void mono_mmap_close (void *mmap_handle);
-extern void mono_mmap_configure_inheritability (void *mmap_handle, gboolean inheritability) MONO_INTERNAL;
+extern void mono_mmap_configure_inheritability (void *mmap_handle, gboolean inheritability);
-extern void mono_mmap_flush (void *mmap_handle) MONO_INTERNAL;
+extern void mono_mmap_flush (void *mmap_handle);
-extern void *mono_mmap_open_file (MonoString *string, int mode, MonoString *mapName, gint64 *capacity, int access, int options, int *error) MONO_INTERNAL;
+extern void *mono_mmap_open_file (MonoString *string, int mode, MonoString *mapName, gint64 *capacity, int access, int options, int *error);
-extern void *mono_mmap_open_handle (void *handle, MonoString *mapName, gint64 *capacity, int access, int options, int *error) MONO_INTERNAL;
+extern void *mono_mmap_open_handle (void *handle, MonoString *mapName, gint64 *capacity, int access, int options, int *error);
-extern int mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mmap_handle, void **base_address) MONO_INTERNAL;
+extern int mono_mmap_map (void *handle, gint64 offset, gint64 *size, int access, void **mmap_handle, void **base_address);
-extern gboolean mono_mmap_unmap (void *base_address) MONO_INTERNAL;
+extern gboolean mono_mmap_unmap (void *base_address);
#endif /* _MONO_METADATA_FILE_MMAP_H_ */
MonoDl *fam_module;
int lib_used = 4; /* gamin */
int inotify_instance;
- void *iter;
char *err;
inotify_instance = ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ();
return 5; /* inotify */
}
- iter = NULL;
fam_module = mono_dl_open ("libgamin-1.so", MONO_DL_LAZY, NULL);
if (fam_module == NULL) {
lib_used = 2; /* FAM */
- iter = NULL;
fam_module = mono_dl_open ("libfam.so", MONO_DL_LAZY, NULL);
}
G_BEGIN_DECLS
-gint ves_icall_System_IO_FSW_SupportsFSW (void) MONO_INTERNAL;
+gint ves_icall_System_IO_FSW_SupportsFSW (void);
gboolean ves_icall_System_IO_FAMW_InternalFAMNextEvent (gpointer conn,
MonoString **filename,
gint *code,
- gint *reqnum) MONO_INTERNAL;
+ gint *reqnum);
-int ves_icall_System_IO_InotifyWatcher_GetInotifyInstance (void) MONO_INTERNAL;
-int ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString *directory, gint32 mask) MONO_INTERNAL;
-int ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor) MONO_INTERNAL;
+int ves_icall_System_IO_InotifyWatcher_GetInotifyInstance (void);
+int ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, MonoString *directory, gint32 mask);
+int ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor);
G_END_DECLS
/* useful until we keep track of gc-references in corlib etc. */
#define IS_GC_REFERENCE(t) (mono_gc_is_moving () ? FALSE : ((t)->type == MONO_TYPE_U && class->image == mono_defaults.corlib))
-extern GCStats gc_stats MONO_INTERNAL;
+extern GCStats gc_stats;
-void mono_object_register_finalizer (MonoObject *obj) MONO_INTERNAL;
-void ves_icall_System_GC_InternalCollect (int generation) MONO_INTERNAL;
-gint64 ves_icall_System_GC_GetTotalMemory (MonoBoolean forceCollection) MONO_INTERNAL;
-void ves_icall_System_GC_KeepAlive (MonoObject *obj) MONO_INTERNAL;
-void ves_icall_System_GC_ReRegisterForFinalize (MonoObject *obj) MONO_INTERNAL;
-void ves_icall_System_GC_SuppressFinalize (MonoObject *obj) MONO_INTERNAL;
-void ves_icall_System_GC_WaitForPendingFinalizers (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
-guint32 ves_icall_System_GCHandle_GetTargetHandle (MonoObject *obj, guint32 handle, gint32 type) MONO_INTERNAL;
-void ves_icall_System_GCHandle_FreeHandle (guint32 handle) MONO_INTERNAL;
-gpointer ves_icall_System_GCHandle_GetAddrOfPinnedObject (guint32 handle) MONO_INTERNAL;
-void ves_icall_System_GC_register_ephemeron_array (MonoObject *array) MONO_INTERNAL;
-MonoObject *ves_icall_System_GC_get_ephemeron_tombstone (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+MonoBoolean ves_icall_Mono_Runtime_SetGCAllowSynchronousMajor (MonoBoolean flag);
-extern void mono_gc_init (void) MONO_INTERNAL;
-extern void mono_gc_base_init (void) MONO_INTERNAL;
-extern void mono_gc_cleanup (void) MONO_INTERNAL;
+extern void mono_gc_init (void);
+extern void mono_gc_base_init (void);
+extern void mono_gc_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) MONO_INTERNAL;
+extern gboolean mono_gc_is_gc_thread (void);
/*
* Try to register a foreign thread with the GC, if we fail or the backend
* can't cope with this concept - we return FALSE.
*/
-extern gboolean mono_gc_register_thread (void *baseptr) MONO_INTERNAL;
+extern gboolean mono_gc_register_thread (void *baseptr);
-extern gboolean mono_gc_is_finalizer_internal_thread (MonoInternalThread *thread) MONO_INTERNAL;
+extern gboolean mono_gc_is_finalizer_internal_thread (MonoInternalThread *thread);
-extern void mono_gc_set_stack_end (void *stack_end) MONO_INTERNAL;
+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).
extern MONO_API void mono_gc_enable_events (void);
/* disappearing link functionality */
-void mono_gc_weak_link_add (void **link_addr, MonoObject *obj, gboolean track) MONO_INTERNAL;
-void mono_gc_weak_link_remove (void **link_addr, gboolean track) MONO_INTERNAL;
-MonoObject *mono_gc_weak_link_get (void **link_addr) MONO_INTERNAL;
+void mono_gc_weak_link_add (void **link_addr, MonoObject *obj, gboolean track);
+void mono_gc_weak_link_remove (void **link_addr, gboolean track);
+MonoObject *mono_gc_weak_link_get (void **link_addr);
/*Ephemeron functionality. Sgen only*/
-gboolean mono_gc_ephemeron_array_add (MonoObject *obj) MONO_INTERNAL;
+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) MONO_INTERNAL;
+gboolean mono_gc_set_allow_synchronous_major (gboolean flag);
MonoBoolean
-GCHandle_CheckCurrentDomain (guint32 gchandle) MONO_INTERNAL;
+GCHandle_CheckCurrentDomain (guint32 gchandle);
/* simple interface for data structures needed in the runtime */
-void* mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits) MONO_INTERNAL;
+void* mono_gc_make_descr_from_bitmap (gsize *bitmap, int numbits);
/* Return a root descriptor for a root with all refs */
-void* mono_gc_make_root_descr_all_refs (int numbits) MONO_INTERNAL;
+void* mono_gc_make_root_descr_all_refs (int numbits);
/* User defined marking function */
/* It should work like this:
MONO_API void *mono_gc_make_root_descr_user (MonoGCRootMarkFunc marker);
/* Return whenever user defined marking functions are supported */
-gboolean mono_gc_user_markers_supported (void) MONO_INTERNAL;
+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.
* 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, void *descr) MONO_INTERNAL;
-void mono_gc_free_fixed (void* addr) MONO_INTERNAL;
+void* mono_gc_alloc_fixed (size_t size, void *descr);
+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) MONO_INTERNAL;
-void mono_gchandle_free_domain (MonoDomain *domain) MONO_INTERNAL;
+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) MONO_INTERNAL;
-void mono_gc_finalize_notify (void) MONO_INTERNAL;
-
-void* mono_gc_alloc_pinned_obj (MonoVTable *vtable, size_t size) MONO_INTERNAL;
-void* mono_gc_alloc_obj (MonoVTable *vtable, size_t size) MONO_INTERNAL;
-void* mono_gc_alloc_vector (MonoVTable *vtable, size_t size, uintptr_t max_length) MONO_INTERNAL;
-void* mono_gc_alloc_array (MonoVTable *vtable, size_t size, uintptr_t max_length, uintptr_t bounds_size) MONO_INTERNAL;
-void* mono_gc_alloc_string (MonoVTable *vtable, size_t size, gint32 len) MONO_INTERNAL;
-void* mono_gc_make_descr_for_string (gsize *bitmap, int numbits) MONO_INTERNAL;
-void* mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size) MONO_INTERNAL;
-void* mono_gc_make_descr_for_array (int vector, gsize *elem_bitmap, int numbits, size_t elem_size) MONO_INTERNAL;
-
-void mono_gc_register_for_finalization (MonoObject *obj, void *user_data) MONO_INTERNAL;
-void mono_gc_add_memory_pressure (gint64 value) MONO_INTERNAL;
+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);
+void* mono_gc_make_descr_for_string (gsize *bitmap, int numbits);
+void* mono_gc_make_descr_for_object (gsize *bitmap, int numbits, size_t obj_size);
+void* mono_gc_make_descr_for_array (int vector, gsize *elem_bitmap, int numbits, size_t elem_size);
+
+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, void *descr);
-void mono_gc_deregister_root (char* addr) MONO_INTERNAL;
-int mono_gc_finalizers_for_domain (MonoDomain *domain, MonoObject **out_array, int out_size) MONO_INTERNAL;
-void mono_gc_run_finalize (void *obj, void *data) MONO_INTERNAL;
-void mono_gc_clear_domain (MonoDomain * domain) MONO_INTERNAL;
-void* mono_gc_alloc_mature (MonoVTable *vtable) MONO_INTERNAL;
+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.
* 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, void *descr) MONO_INTERNAL;
+int mono_gc_register_root_wbarrier (char *start, size_t size, void *descr);
-void mono_gc_wbarrier_set_root (gpointer ptr, MonoObject *value) MONO_INTERNAL;
+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) MONO_INTERNAL;
+void mono_gc_finalize_threadpool_threads (void);
/* fast allocation support */
int alloc_type;
} AllocatorWrapperInfo;
-int mono_gc_get_aligned_size_for_allocator (int size) MONO_INTERNAL;
-MonoMethod* mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box, gboolean known_instance_size) MONO_INTERNAL;
-MonoMethod* mono_gc_get_managed_array_allocator (MonoClass *klass) MONO_INTERNAL;
-MonoMethod *mono_gc_get_managed_allocator_by_type (int atype) MONO_INTERNAL;
+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);
-guint32 mono_gc_get_managed_allocator_types (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+const char *mono_gc_get_gc_name (void);
/* Fast write barriers */
-MonoMethod* mono_gc_get_write_barrier (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+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) MONO_INTERNAL;
+MonoString *mono_string_alloc (int length);
/*
* Functions supplied by the runtime and called by the GC. Currently only used
} MonoGCCallbacks;
/* Set the callback functions callable by the GC */
-void mono_gc_set_gc_callbacks (MonoGCCallbacks *callbacks) MONO_INTERNAL;
-MonoGCCallbacks *mono_gc_get_gc_callbacks (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+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) MONO_INTERNAL;
+void *mono_gc_scan_object (void *obj, void *gc_data);
/* Return the bitmap encoded by a descriptor */
-gsize* mono_gc_get_bitmap_for_descr (void *descr, int *numbits) MONO_INTERNAL;
+gsize* mono_gc_get_bitmap_for_descr (void *descr, int *numbits);
/* Return the suspend signal number used by the GC to suspend threads,
or -1 if not applicable. */
-int mono_gc_get_suspend_signal (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+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) MONO_INTERNAL;
+char* mono_gc_get_description (void);
/*
* Configure the GC to desktop mode
*/
-void mono_gc_set_desktop_mode (void) MONO_INTERNAL;
+void mono_gc_set_desktop_mode (void);
/*
* Return whenever this GC can move objects
*/
-gboolean mono_gc_is_moving (void) MONO_INTERNAL;
+gboolean mono_gc_is_moving (void);
typedef void* (*MonoGCLockedCallbackFunc) (void *data);
-void* mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data) MONO_INTERNAL;
+void* mono_gc_invoke_with_gc_lock (MonoGCLockedCallbackFunc func, void *data);
-int mono_gc_get_los_limit (void) MONO_INTERNAL;
+int mono_gc_get_los_limit (void);
-guint8* mono_gc_get_card_table (int *shift_bits, gpointer *card_mask) MONO_INTERNAL;
-gboolean mono_gc_card_table_nursery_check (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+void* mono_gc_get_nursery (int *shift_bits, size_t *size);
-void mono_gc_set_current_thread_appdomain (MonoDomain *domain) MONO_INTERNAL;
+void mono_gc_set_current_thread_appdomain (MonoDomain *domain);
-void mono_gc_set_skip_thread (gboolean skip) MONO_INTERNAL;
+void mono_gc_set_skip_thread (gboolean skip);
/*
* Return whenever GC is disabled
*/
-gboolean mono_gc_is_disabled (void) MONO_INTERNAL;
+gboolean mono_gc_is_disabled (void);
-void mono_gc_set_string_length (MonoString *str, gint32 new_length) MONO_INTERNAL;
+void mono_gc_set_string_length (MonoString *str, gint32 new_length);
#if defined(__MACH__)
-void mono_gc_register_mach_exception_thread (pthread_t thread) MONO_INTERNAL;
-pthread_t mono_gc_get_mach_exception_thread (void) MONO_INTERNAL;
+void mono_gc_register_mach_exception_thread (pthread_t thread);
+pthread_t mono_gc_get_mach_exception_thread (void);
#endif
-gboolean mono_gc_parse_environment_string_extract_number (const char *str, size_t *out) MONO_INTERNAL;
+gboolean mono_gc_parse_environment_string_extract_number (const char *str, size_t *out);
-gboolean mono_gc_precise_stack_mark_enabled (void) MONO_INTERNAL;
+gboolean mono_gc_precise_stack_mark_enabled (void);
-FILE *mono_gc_get_logfile (void) MONO_INTERNAL;
+FILE *mono_gc_get_logfile (void);
typedef struct _RefQueueEntry RefQueueEntry;
#ifdef HOST_WIN32
-BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved) MONO_INTERNAL;
+BOOL APIENTRY mono_gc_dllmain (HMODULE module_handle, DWORD reason, LPVOID reserved);
#endif
/*
Those functions must be used when it's possible that either destination is not
word aligned or size is not a multiple of word size.
*/
-void mono_gc_bzero_atomic (void *dest, size_t size) MONO_INTERNAL;
-void mono_gc_bzero_aligned (void *dest, size_t size) MONO_INTERNAL;
-void mono_gc_memmove_atomic (void *dest, const void *src, size_t size) MONO_INTERNAL;
-void mono_gc_memmove_aligned (void *dest, const void *src, size_t size) MONO_INTERNAL;
+void mono_gc_bzero_atomic (void *dest, size_t size);
+void mono_gc_bzero_aligned (void *dest, size_t size);
+void mono_gc_memmove_atomic (void *dest, const void *src, size_t size);
+void mono_gc_memmove_aligned (void *dest, const void *src, size_t size);
-guint mono_gc_get_vtable_bits (MonoClass *klass) MONO_INTERNAL;
+guint mono_gc_get_vtable_bits (MonoClass *klass);
-void mono_gc_register_altstack (gpointer stack, gint32 stack_size, gpointer altstack, gint32 altstack_size) MONO_INTERNAL;
+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 do_not_finalize;
#endif /* __MONO_METADATA_GC_INTERNAL_H__ */
static gboolean finalizing_root_domain = FALSE;
+gboolean log_finalizers = FALSE;
+gboolean do_not_finalize = FALSE;
+
#define mono_finalizer_lock() mono_mutex_lock (&finalizer_mutex)
#define mono_finalizer_unlock() mono_mutex_unlock (&finalizer_mutex)
static mono_mutex_t finalizer_mutex;
void
mono_gc_run_finalize (void *obj, void *data)
{
+ if (do_not_finalize)
+ return;
+
MonoObject *exc = NULL;
MonoObject *o;
#ifndef HAVE_SGEN_GC
o = (MonoObject*)((char*)obj + GPOINTER_TO_UINT (data));
+ if (log_finalizers)
+ g_log ("mono-gc-finalizers", G_LOG_LEVEL_DEBUG, "<%s at %p> Starting finalizer checks.", o->vtable->klass->name, o);
+
if (suspend_finalizers)
return;
/* make sure the finalizer is not called again if the object is resurrected */
object_register_finalizer (obj, NULL);
+ if (log_finalizers)
+ g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Registered finalizer as processed.", o->vtable->klass->name, o);
+
if (o->vtable->klass == mono_defaults.internal_thread_class) {
MonoInternalThread *t = (MonoInternalThread*)o;
* create and precompile a wrapper which calls the finalize method using
* a CALLVIRT.
*/
+ if (log_finalizers)
+ g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Compiling finalizer.", o->vtable->klass->name, o);
+
if (!domain->finalize_runtime_invoke) {
MonoMethod *invoke = mono_marshal_get_runtime_invoke (mono_class_get_method_from_name_flags (mono_defaults.object_class, "Finalize", 0, 0), TRUE);
o->vtable->klass->name_space, o->vtable->klass->name);
}
+ if (log_finalizers)
+ g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Calling finalizer.", o->vtable->klass->name, o);
+
runtime_invoke (o, NULL, &exc, NULL);
+ if (log_finalizers)
+ g_log ("mono-gc-finalizers", G_LOG_LEVEL_MESSAGE, "<%s at %p> Returned from finalizer.", o->vtable->klass->name, o);
+
if (exc)
mono_internal_thread_unhandled_exception (exc);
guint slot = gchandle >> 3;
guint type = (gchandle & 7) - 1;
HandleData *handles = &gc_handles [type];
- MonoObject *old_obj = NULL;
if (type > 3)
return;
lock_handles (handles);
if (slot < handles->size && (handles->bitmap [slot / 32] & (1 << (slot % 32)))) {
if (handles->type <= HANDLE_WEAK_TRACK) {
- old_obj = handles->entries [slot];
if (handles->entries [slot])
mono_gc_weak_link_remove (&handles->entries [slot], handles->type == HANDLE_WEAK_TRACK);
if (obj)
ICALL (PROCESSHANDLE_2, "ProcessHandle_duplicate(intptr)", ves_icall_System_Diagnostics_Process_ProcessHandle_duplicate)
#endif /* !DISABLE_PROCESS_HANDLING */
+ICALL_TYPE(SFRAME, "System.Diagnostics.StackFrame", SFRAME_1)
+ICALL(SFRAME_1, "GetILOffsetFromFile", ves_icall_System_StackFrame_GetILOffsetFromFile)
+
ICALL_TYPE(STOPWATCH, "System.Diagnostics.Stopwatch", STOPWATCH_1)
ICALL(STOPWATCH_1, "GetTimestamp", mono_100ns_ticks)
ICALL(MCATTR_3, "IsDefinedInternal", custom_attrs_defined_internal)
ICALL_TYPE(MTYPE, "System.MonoType", MTYPE_1)
-ICALL(MTYPE_1, "GetArrayRank", ves_icall_MonoType_GetArrayRank)
-ICALL(MTYPE_2, "GetConstructors", ves_icall_Type_GetConstructors_internal)
-ICALL(MTYPE_3, "GetConstructors_internal", ves_icall_Type_GetConstructors_internal)
-ICALL(MTYPE_4, "GetCorrespondingInflatedConstructor", ves_icall_MonoType_GetCorrespondingInflatedMethod)
-ICALL(MTYPE_5, "GetCorrespondingInflatedMethod", ves_icall_MonoType_GetCorrespondingInflatedMethod)
-ICALL(MTYPE_6, "GetElementType", ves_icall_MonoType_GetElementType)
-ICALL(MTYPE_7, "GetEvents_internal", ves_icall_Type_GetEvents_internal)
-ICALL(MTYPE_8, "GetField", ves_icall_Type_GetField)
-ICALL(MTYPE_9, "GetFields_internal", ves_icall_Type_GetFields_internal)
-ICALL(MTYPE_10, "GetGenericArguments", ves_icall_MonoType_GetGenericArguments)
-ICALL(MTYPE_11, "GetInterfaces", ves_icall_Type_GetInterfaces)
-ICALL(MTYPE_12, "GetMethodsByName", ves_icall_Type_GetMethodsByName)
-ICALL(MTYPE_13, "GetNestedType", ves_icall_Type_GetNestedType)
-ICALL(MTYPE_14, "GetNestedTypes", ves_icall_Type_GetNestedTypes)
-ICALL(MTYPE_15, "GetPropertiesByName", ves_icall_Type_GetPropertiesByName)
-ICALL(MTYPE_16, "InternalGetEvent", ves_icall_MonoType_GetEvent)
-ICALL(MTYPE_17, "IsByRefImpl", ves_icall_type_isbyref)
-ICALL(MTYPE_18, "IsCOMObjectImpl", ves_icall_type_iscomobject)
-ICALL(MTYPE_19, "IsPointerImpl", ves_icall_type_ispointer)
-ICALL(MTYPE_20, "IsPrimitiveImpl", ves_icall_type_isprimitive)
-ICALL(MTYPE_21, "getFullName", ves_icall_System_MonoType_getFullName)
-ICALL(MTYPE_22, "get_Assembly", ves_icall_MonoType_get_Assembly)
-ICALL(MTYPE_23, "get_BaseType", ves_icall_get_type_parent)
-ICALL(MTYPE_24, "get_DeclaringMethod", ves_icall_MonoType_get_DeclaringMethod)
-ICALL(MTYPE_25, "get_DeclaringType", ves_icall_MonoType_get_DeclaringType)
-ICALL(MTYPE_26, "get_IsGenericParameter", ves_icall_MonoType_get_IsGenericParameter)
-ICALL(MTYPE_27, "get_Module", ves_icall_MonoType_get_Module)
-ICALL(MTYPE_28, "get_Name", ves_icall_MonoType_get_Name)
-ICALL(MTYPE_29, "get_Namespace", ves_icall_MonoType_get_Namespace)
-ICALL(MTYPE_31, "get_attributes", ves_icall_get_attributes)
-ICALL(MTYPE_33, "get_core_clr_security_level", vell_icall_MonoType_get_core_clr_security_level)
-ICALL(MTYPE_32, "type_from_obj", mono_type_type_from_obj)
+ICALL(MTYPE_1, "GetCorrespondingInflatedConstructor", ves_icall_MonoType_GetCorrespondingInflatedMethod)
+ICALL(MTYPE_2, "GetCorrespondingInflatedMethod", ves_icall_MonoType_GetCorrespondingInflatedMethod)
+ICALL(MTYPE_3, "type_from_obj", mono_type_type_from_obj)
#ifndef DISABLE_SOCKETS
ICALL_TYPE(NDNS, "System.Net.Dns", NDNS_1)
ICALL_TYPE(RT, "System.RuntimeType", RT_1)
ICALL(RT_1, "CreateInstanceInternal", ves_icall_System_Activator_CreateInstanceInternal)
+ICALL(RT_2, "GetConstructors_internal", ves_icall_Type_GetConstructors_internal)
+ICALL(RT_3, "GetEvents_internal", ves_icall_Type_GetEvents_internal)
+ICALL(RT_5, "GetFields_internal", ves_icall_Type_GetFields_internal)
+ICALL(RT_6, "GetGenericArguments", ves_icall_MonoType_GetGenericArguments)
+ICALL(RT_7, "GetGenericParameterAttributes", ves_icall_Type_GetGenericParameterAttributes)
+ICALL(RT_8, "GetGenericParameterConstraints_impl", ves_icall_Type_GetGenericParameterConstraints)
+ICALL(RT_9, "GetGenericParameterPosition", ves_icall_Type_GetGenericParameterPosition)
+ICALL(RT_10, "GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData)
+ICALL(RT_11, "GetInterfaces", ves_icall_Type_GetInterfaces)
+ICALL(RT_12, "GetMethodsByName", ves_icall_Type_GetMethodsByName)
+ICALL(RT_13, "GetNestedTypes_internal", ves_icall_Type_GetNestedTypes)
+ICALL(RT_14, "GetPacking", ves_icall_Type_GetPacking)
+ICALL(RT_15, "GetPropertiesByName", ves_icall_Type_GetPropertiesByName)
+ICALL(RT_16, "GetTypeCodeImplInternal", ves_icall_type_GetTypeCodeInternal)
+ICALL(RT_17, "MakeGenericType", ves_icall_Type_MakeGenericType)
+ICALL(RT_18, "MakePointerType", ves_icall_Type_MakePointerType)
+ICALL(RT_19, "getFullName", ves_icall_System_MonoType_getFullName)
+ICALL(RT_21, "get_DeclaringMethod", ves_icall_MonoType_get_DeclaringMethod)
+ICALL(RT_22, "get_DeclaringType", ves_icall_MonoType_get_DeclaringType)
+ICALL(RT_23, "get_Name", ves_icall_MonoType_get_Name)
+ICALL(RT_24, "get_Namespace", ves_icall_MonoType_get_Namespace)
+ICALL(RT_25, "get_core_clr_security_level", vell_icall_MonoType_get_core_clr_security_level)
+ICALL(RT_26, "make_array_type", ves_icall_Type_make_array_type)
+ICALL(RT_27, "make_byref_type", ves_icall_Type_make_byref_type)
+
+ICALL_TYPE(RTH, "System.RuntimeTypeHandle", RTH_1)
+ICALL(RTH_1, "GetArrayRank", ves_icall_MonoType_GetArrayRank)
+ICALL(RTH_2, "GetAssembly", ves_icall_MonoType_get_Assembly)
+ICALL(RTH_3, "GetAttributes", ves_icall_get_attributes)
+ICALL(RTH_4, "GetBaseType", ves_icall_get_type_parent)
+ICALL(RTH_5, "GetElementType", ves_icall_MonoType_GetElementType)
+ICALL(RTH_6, "GetGenericTypeDefinition_impl", ves_icall_Type_GetGenericTypeDefinition_impl)
+ICALL(RTH_7, "GetMetadataToken", mono_reflection_get_token)
+ICALL(RTH_8, "GetModule", ves_icall_MonoType_get_Module)
+ICALL(RTH_9, "HasInstantiation", ves_icall_Type_get_IsGenericType)
+ICALL(RTH_10, "IsArray", ves_icall_Type_IsArrayImpl)
+ICALL(RTH_11, "IsByRef", ves_icall_type_isbyref)
+ICALL(RTH_12, "IsComObject", ves_icall_type_iscomobject)
+ICALL(RTH_13, "IsGenericTypeDefinition", ves_icall_Type_get_IsGenericTypeDefinition)
+ICALL(RTH_14, "IsGenericVariable", ves_icall_MonoType_get_IsGenericParameter)
+ICALL(RTH_15, "IsInstanceOfType", ves_icall_type_IsInstanceOfType)
+ICALL(RTH_16, "IsPointer", ves_icall_type_ispointer)
+ICALL(RTH_17, "IsPrimitive", ves_icall_type_isprimitive)
+ICALL(RTH_18, "type_is_assignable_from", ves_icall_type_is_assignable_from)
ICALL_TYPE(RNG, "System.Security.Cryptography.RNGCryptoServiceProvider", RNG_1)
ICALL(RNG_1, "RngClose", ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose)
ICALL(WAITH_4, "WaitOne_internal", ves_icall_System_Threading_WaitHandle_WaitOne_internal)
ICALL_TYPE(TYPE, "System.Type", TYPE_1)
-ICALL(TYPE_1, "EqualsInternal", ves_icall_System_Type_EqualsInternal)
-ICALL(TYPE_2, "GetGenericParameterAttributes", ves_icall_Type_GetGenericParameterAttributes)
-ICALL(TYPE_3, "GetGenericParameterConstraints_impl", ves_icall_Type_GetGenericParameterConstraints)
-ICALL(TYPE_4, "GetGenericParameterPosition", ves_icall_Type_GetGenericParameterPosition)
-ICALL(TYPE_5, "GetGenericTypeDefinition_impl", ves_icall_Type_GetGenericTypeDefinition_impl)
-ICALL(TYPE_6, "GetInterfaceMapData", ves_icall_Type_GetInterfaceMapData)
-ICALL(TYPE_7, "GetPacking", ves_icall_Type_GetPacking)
-ICALL(TYPE_8, "GetTypeCode", ves_icall_type_GetTypeCodeInternal)
-ICALL(TYPE_9, "GetTypeCodeInternal", ves_icall_type_GetTypeCodeInternal)
-ICALL(TYPE_10, "IsArrayImpl", ves_icall_Type_IsArrayImpl)
-ICALL(TYPE_11, "IsInstanceOfType", ves_icall_type_IsInstanceOfType)
-ICALL(TYPE_12, "MakeGenericType", ves_icall_Type_MakeGenericType)
-ICALL(TYPE_13, "MakePointerType", ves_icall_Type_MakePointerType)
-ICALL(TYPE_14, "get_IsGenericInstance", ves_icall_Type_get_IsGenericInstance)
-ICALL(TYPE_15, "get_IsGenericType", ves_icall_Type_get_IsGenericType)
-ICALL(TYPE_16, "get_IsGenericTypeDefinition", ves_icall_Type_get_IsGenericTypeDefinition)
-ICALL(TYPE_17, "internal_from_handle", ves_icall_type_from_handle)
-ICALL(TYPE_18, "internal_from_name", ves_icall_type_from_name)
-ICALL(TYPE_19, "make_array_type", ves_icall_Type_make_array_type)
-ICALL(TYPE_20, "make_byref_type", ves_icall_Type_make_byref_type)
-ICALL(TYPE_21, "type_is_assignable_from", ves_icall_type_is_assignable_from)
-ICALL(TYPE_22, "type_is_subtype_of", ves_icall_type_is_subtype_of)
+ICALL(TYPE_1, "internal_from_handle", ves_icall_type_from_handle)
+ICALL(TYPE_2, "internal_from_name", ves_icall_type_from_name)
ICALL_TYPE(TYPEDR, "System.TypedReference", TYPEDR_1)
ICALL(TYPEDR_1, "ToObject", mono_TypedReference_ToObject)
#include <mono/metadata/verify-internals.h>
#include <mono/metadata/runtime.h>
#include <mono/metadata/file-mmap.h>
+#include <mono/metadata/seq-points-data.h>
#include <mono/io-layer/io-layer.h>
#include <mono/utils/strtod.h>
#include <mono/utils/monobitset.h>
#endif
#include "decimal-ms.h"
-extern MonoString* ves_icall_System_Environment_GetOSVersionString (void) MONO_INTERNAL;
+extern MonoString* ves_icall_System_Environment_GetOSVersionString (void);
ICALL_EXPORT MonoReflectionAssembly* ves_icall_System_Reflection_Assembly_GetCallingAssembly (void);
INVALID_CAST;
}
break;
+ default:
+ break;
}
if (!ec->valuetype) {
return mono_type_get_object (domain, handle);
}
-ICALL_EXPORT MonoBoolean
-ves_icall_System_Type_EqualsInternal (MonoReflectionType *type, MonoReflectionType *c)
-{
- if (c && type->type && c->type)
- return mono_metadata_type_equal (type->type, c->type);
- else
- return (type == c) ? TRUE : FALSE;
-}
-
/* System.TypeCode */
typedef enum {
TYPECODE_EMPTY,
return 0;
}
-ICALL_EXPORT guint32
-ves_icall_type_is_subtype_of (MonoReflectionType *type, MonoReflectionType *c, MonoBoolean check_interfaces)
-{
- MonoDomain *domain;
- MonoClass *klass;
- MonoClass *klassc;
-
- g_assert (type != NULL);
-
- domain = ((MonoObject *)type)->vtable->domain;
-
- if (!c) /* FIXME: dont know what do do here */
- return 0;
-
- klass = mono_class_from_mono_type (type->type);
- klassc = mono_class_from_mono_type (c->type);
-
- /* Interface check requires a more complex setup so we
- * only do for them. Otherwise we simply avoid mono_class_init.
- */
- if (check_interfaces) {
- mono_class_init_or_throw (klass);
- mono_class_init_or_throw (klassc);
- } else if (!klass->supertypes || !klassc->supertypes) {
- mono_class_setup_supertypes (klass);
- mono_class_setup_supertypes (klassc);
- }
-
- if (type->type->byref)
- return klassc == mono_defaults.object_class;
-
- return mono_class_is_subclass_of (klass, klassc, check_interfaces);
-}
-
static gboolean
mono_type_is_primitive (MonoType *type)
{
ICALL_EXPORT guint32
ves_icall_type_is_assignable_from (MonoReflectionType *type, MonoReflectionType *c)
{
- MonoDomain *domain;
MonoClass *klass;
MonoClass *klassc;
g_assert (type != NULL);
- domain = ((MonoObject *)type)->vtable->domain;
-
klass = mono_class_from_mono_type (type->type);
klassc = mono_class_from_mono_type (c->type);
ICALL_EXPORT MonoReflectionType*
ves_icall_get_type_parent (MonoReflectionType *type)
{
+ if (type->type->byref)
+ return NULL;
+
MonoClass *class = mono_class_from_mono_type (type->type);
return class->parent ? mono_type_get_object (mono_object_domain (type), &class->parent->byval_arg): NULL;
}
return mono_type_get_object (mono_object_domain (type), geninst);
}
-ICALL_EXPORT gboolean
-ves_icall_Type_get_IsGenericInstance (MonoReflectionType *type)
-{
- MonoClass *klass;
-
- if (type->type->byref)
- return FALSE;
-
- klass = mono_class_from_mono_type (type->type);
-
- return klass->generic_class != NULL;
-}
-
ICALL_EXPORT gboolean
ves_icall_Type_get_IsGenericType (MonoReflectionType *type)
{
return *(gint8*)mem;
case MONO_TYPE_CHAR:
case MONO_TYPE_U2:
- return *(guint16*)mem;
+ return read16 (mem);
case MONO_TYPE_I2:
- return *(gint16*)mem;
+ return (gint16) read16 (mem);
case MONO_TYPE_U4:
- return *(guint32*)mem;
+ return read32 (mem);
case MONO_TYPE_I4:
- return *(gint32*)mem;
+ return (gint32) read32 (mem);
case MONO_TYPE_U8:
- return *(guint64*)mem;
case MONO_TYPE_I8:
- return *(gint64*)mem;
+ return read64 (mem);
default:
g_assert_not_reached ();
}
COMPARE_ENUM_VALUES (guint64);
case MONO_TYPE_I8:
COMPARE_ENUM_VALUES (gint64);
+ default:
+ break;
}
#undef COMPARE_ENUM_VALUES
/* indicates that the enum was of an unsupported unerlying type */
{
MonoDomain *domain = mono_object_domain (type);
MonoClass *enumc = mono_class_from_mono_type (type->type);
- guint j = 0, nvalues, crow;
+ guint j = 0, nvalues;
gpointer iter;
MonoClassField *field;
int base_type;
*names = mono_array_new (domain, mono_defaults.string_class, nvalues);
*values = mono_array_new (domain, mono_defaults.uint64_class, nvalues);
- crow = -1;
iter = NULL;
while ((field = mono_class_get_fields (enumc, &iter))) {
const char *p;
- int len;
MonoTypeEnum def_type;
if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
mono_array_setref (*names, j, mono_string_new (domain, mono_field_get_name (field)));
p = mono_class_get_field_default_value (field, &def_type);
- len = mono_metadata_decode_blob_size (p, &p);
+ /* len = */ mono_metadata_decode_blob_size (p, &p);
field_value = read_enum_value (p, base_type);
mono_array_set (*values, guint64, j, field_value);
BFLAGS_OptionalParamBinding = 0x40000
};
-ICALL_EXPORT MonoReflectionField *
-ves_icall_Type_GetField (MonoReflectionType *type, MonoString *name, guint32 bflags)
-{
- MonoDomain *domain;
- MonoClass *startklass, *klass;
- int match;
- MonoClassField *field;
- gpointer iter;
- char *utf8_name;
- int (*compare_func) (const char *s1, const char *s2) = NULL;
- domain = ((MonoObject *)type)->vtable->domain;
- klass = startklass = mono_class_from_mono_type (type->type);
-
- if (!name) {
- mono_set_pending_exception (mono_get_exception_argument_null ("name"));
- return NULL;
- }
- if (type->type->byref)
- return NULL;
-
- compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
-
-handle_parent:
- if (klass->exception_type != MONO_EXCEPTION_NONE) {
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
- return NULL;
- }
-
- iter = NULL;
- while ((field = mono_class_get_fields_lazy (klass, &iter))) {
- guint32 flags = mono_field_get_flags (field);
- match = 0;
-
- if (mono_field_is_deleted_with_flags (field, flags))
- continue;
- if ((flags & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) == FIELD_ATTRIBUTE_PUBLIC) {
- if (bflags & BFLAGS_Public)
- match++;
- } else if ((klass == startklass) || (flags & FIELD_ATTRIBUTE_FIELD_ACCESS_MASK) != FIELD_ATTRIBUTE_PRIVATE) {
- if (bflags & BFLAGS_NonPublic) {
- match++;
- }
- }
- if (!match)
- continue;
- match = 0;
- if (flags & FIELD_ATTRIBUTE_STATIC) {
- if (bflags & BFLAGS_Static)
- if ((bflags & BFLAGS_FlattenHierarchy) || (klass == startklass))
- match++;
- } else {
- if (bflags & BFLAGS_Instance)
- match++;
- }
-
- if (!match)
- continue;
-
- utf8_name = mono_string_to_utf8 (name);
-
- if (compare_func (mono_field_get_name (field), utf8_name)) {
- g_free (utf8_name);
- continue;
- }
- g_free (utf8_name);
-
- return mono_field_get_object (domain, klass, field);
- }
- if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
- goto handle_parent;
-
- return NULL;
-}
-
ICALL_EXPORT MonoArray*
-ves_icall_Type_GetFields_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
+ves_icall_Type_GetFields_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
{
MonoDomain *domain;
MonoClass *startklass, *klass, *refklass;
MonoObject *member;
int i, match;
gpointer iter;
+ char *utf8_name = NULL;
+ int (*compare_func) (const char *s1, const char *s2) = NULL;
MonoClassField *field;
MonoPtrArray tmp_array;
domain = ((MonoObject *)type)->vtable->domain;
if (type->type->byref)
return mono_array_new (domain, mono_defaults.field_info_class, 0);
+
klass = startklass = mono_class_from_mono_type (type->type);
refklass = mono_class_from_mono_type (reftype->type);
if (!match)
continue;
+
+ if (name != NULL) {
+ if (utf8_name == NULL) {
+ utf8_name = mono_string_to_utf8 (name);
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+ }
+
+ if (compare_func (mono_field_get_name (field), utf8_name))
+ continue;
+ }
+
member = (MonoObject*)mono_field_get_object (domain, refklass, field);
mono_ptr_array_append (tmp_array, member);
}
mono_ptr_array_destroy (tmp_array);
+ if (utf8_name != NULL)
+ g_free (utf8_name);
+
return res;
}
MonoClass *startklass;
MonoMethod *method;
gpointer iter;
- int len, match, nslots;
+ int match, nslots;
/*FIXME, use MonoBitSet*/
guint32 method_slots_default [8];
guint32 *method_slots = NULL;
startklass = klass;
*ex = NULL;
- len = 0;
if (name != NULL)
compare_func = (ignore_case) ? mono_utf8_strcasecmp : strcmp;
return NULL;
}
-ICALL_EXPORT MonoReflectionEvent *
-ves_icall_MonoType_GetEvent (MonoReflectionType *type, MonoString *name, guint32 bflags)
-{
- MonoDomain *domain;
- MonoClass *klass, *startklass;
- gpointer iter;
- MonoEvent *event;
- MonoMethod *method;
- gchar *event_name;
- int (*compare_func) (const char *s1, const char *s2);
-
- event_name = mono_string_to_utf8 (name);
- if (type->type->byref)
- return NULL;
- klass = startklass = mono_class_from_mono_type (type->type);
- domain = mono_object_domain (type);
-
- mono_class_init_or_throw (klass);
-
- compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
-handle_parent:
- if (klass->exception_type != MONO_EXCEPTION_NONE) {
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
- return NULL;
- }
-
- iter = NULL;
- while ((event = mono_class_get_events (klass, &iter))) {
- if (compare_func (event->name, event_name))
- continue;
-
- method = event->add;
- if (!method)
- method = event->remove;
- if (!method)
- method = event->raise;
- if (method) {
- if ((method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PUBLIC) {
- if (!(bflags & BFLAGS_Public))
- continue;
- } else {
- if (!(bflags & BFLAGS_NonPublic))
- continue;
- if ((klass != startklass) && (method->flags & METHOD_ATTRIBUTE_MEMBER_ACCESS_MASK) == METHOD_ATTRIBUTE_PRIVATE)
- continue;
- }
-
- if (method->flags & METHOD_ATTRIBUTE_STATIC) {
- if (!(bflags & BFLAGS_Static))
- continue;
- if (!(bflags & BFLAGS_FlattenHierarchy) && (klass != startklass))
- continue;
- } else {
- if (!(bflags & BFLAGS_Instance))
- continue;
- }
- } else
- if (!(bflags & BFLAGS_NonPublic))
- continue;
-
- g_free (event_name);
- return mono_event_get_object (domain, startklass, event);
- }
-
- if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
- goto handle_parent;
-
- g_free (event_name);
- return NULL;
-}
-
static guint
event_hash (gconstpointer data)
{
}
ICALL_EXPORT MonoArray*
-ves_icall_Type_GetEvents_internal (MonoReflectionType *type, guint32 bflags, MonoReflectionType *reftype)
+ves_icall_Type_GetEvents_internal (MonoReflectionType *type, MonoString *name, guint32 bflags, MonoReflectionType *reftype)
{
MonoException *ex;
MonoDomain *domain;
MonoEvent *event;
int i, match;
gpointer iter;
+ char *utf8_name = NULL;
+ int (*compare_func) (const char *s1, const char *s2) = NULL;
GHashTable *events = NULL;
MonoPtrArray tmp_array;
if (!match)
continue;
+ if (name != NULL) {
+ if (utf8_name == NULL) {
+ utf8_name = mono_string_to_utf8 (name);
+ compare_func = (bflags & BFLAGS_IgnoreCase) ? mono_utf8_strcasecmp : strcmp;
+ }
+
+ if (compare_func (event->name, utf8_name))
+ continue;
+ }
+
if (g_hash_table_lookup (events, event))
continue;
mono_ptr_array_destroy (tmp_array);
+ if (utf8_name != NULL)
+ g_free (utf8_name);
+
return res;
loader_error:
return NULL;
}
-ICALL_EXPORT MonoReflectionType *
-ves_icall_Type_GetNestedType (MonoReflectionType *type, MonoString *name, guint32 bflags)
-{
- MonoDomain *domain;
- MonoClass *klass;
- MonoClass *nested;
- char *str;
- gpointer iter;
-
- if (name == NULL) {
- mono_set_pending_exception (mono_get_exception_argument_null ("name"));
- return NULL;
- }
-
- domain = ((MonoObject *)type)->vtable->domain;
- if (type->type->byref)
- return NULL;
- klass = mono_class_from_mono_type (type->type);
-
- str = mono_string_to_utf8 (name);
-
- handle_parent:
- if (klass->exception_type != MONO_EXCEPTION_NONE) {
- mono_set_pending_exception (mono_class_get_exception_for_failure (klass));
- return NULL;
- }
-
- /*
- * If a nested type is generic, return its generic type definition.
- * Note that this means that the return value is essentially a
- * nested type of the generic type definition of @klass.
- *
- * A note in MSDN claims that a generic type definition can have
- * nested types that aren't generic. In any case, the container of that
- * nested type would be the generic type definition.
- */
- if (klass->generic_class)
- klass = klass->generic_class->container_class;
-
- iter = NULL;
- while ((nested = mono_class_get_nested_types (klass, &iter))) {
- int match = 0;
- if ((nested->flags & TYPE_ATTRIBUTE_VISIBILITY_MASK) == TYPE_ATTRIBUTE_NESTED_PUBLIC) {
- if (bflags & BFLAGS_Public)
- match++;
- } else {
- if (bflags & BFLAGS_NonPublic)
- match++;
- }
- if (!match)
- continue;
- if (strcmp (nested->name, str) == 0){
- g_free (str);
- return mono_type_get_object (domain, &nested->byval_arg);
- }
- }
- if (!(bflags & BFLAGS_DeclaredOnly) && (klass = klass->parent))
- goto handle_parent;
- g_free (str);
- return NULL;
-}
-
ICALL_EXPORT MonoArray*
-ves_icall_Type_GetNestedTypes (MonoReflectionType *type, guint32 bflags)
+ves_icall_Type_GetNestedTypes (MonoReflectionType *type, MonoString *name, guint32 bflags)
{
MonoDomain *domain;
MonoClass *klass;
int i, match;
MonoClass *nested;
gpointer iter;
+ char *str = NULL;
MonoPtrArray tmp_array;
domain = ((MonoObject *)type)->vtable->domain;
}
if (!match)
continue;
+
+ if (name != NULL) {
+ if (str == NULL)
+ str = mono_string_to_utf8 (name);
+
+ if (strcmp (nested->name, str))
+ continue;
+ }
+
member = (MonoObject*)mono_type_get_object (domain, &nested->byval_arg);
mono_ptr_array_append (tmp_array, member);
}
mono_ptr_array_destroy (tmp_array);
+ if (!str)
+ g_free (str);
+
return res;
}
}
transitioned++;
} else {
- time_t te;
- te = mktime (&tt);
-
mono_array_setref ((*names), 0, mono_string_new (domain, tzone));
mono_array_set ((*data), gint64, 1, ((gint64)t1 + EPOCH_ADJUST) * 10000000L);
if (gmtoff_ds == 0) {
return message;
}
+ICALL_EXPORT int
+ves_icall_System_StackFrame_GetILOffsetFromFile (MonoString *path, int methodToken, int nativeOffset)
+{
+ guint32 il_offset;
+ char *path_str = mono_string_to_utf8 (path);
+
+ if (!seq_point_data_get_il_offset (path_str, methodToken, nativeOffset, &il_offset))
+ il_offset = -1;
+
+ g_free (path_str);
+
+ return il_offset;
+}
+
#ifndef DISABLE_ICALL_TABLES
#define ICALL_TYPE(id,name,first)
{
MonoCLIImageInfo *iinfo = image->image_info;
MonoSectionTable *sect;
- gboolean writable;
g_return_val_if_fail (section < iinfo->cli_section_count, FALSE);
sect = &iinfo->cli_section_tables [section];
- writable = sect->st_flags & SECT_FLAGS_MEM_WRITE;
-
if (sect->st_raw_data_ptr + sect->st_raw_data_size > image->raw_data_len)
return FALSE;
#ifdef HOST_WIN32
{
const char *heap_tables = image->heap_tables.data;
const guint32 *rows;
- guint64 valid_mask, sorted_mask;
+ guint64 valid_mask;
int valid = 0, table;
int heap_sizes;
image->idx_blob_wide = ((heap_sizes & 0x04) == 4);
valid_mask = read64 (heap_tables + 8);
- sorted_mask = read64 (heap_tables + 16);
rows = (const guint32 *) (heap_tables + 24);
for (table = 0; table < 64; table++){
} else {
image->tables [table].rows = read32 (rows);
}
- /*if ((sorted_mask & ((guint64) 1 << table)) == 0){
- g_print ("table %s (0x%02x) is sorted\n", mono_meta_table_name (table), table);
- }*/
rows++;
valid++;
}
mono_image_load_cli_data (MonoImage *image)
{
MonoCLIImageInfo *iinfo;
- MonoDotNetHeader *header;
iinfo = image->image_info;
- header = &iinfo->cli_header;
/* Load the CLI header */
if (!load_cli_header (image, iinfo))
do_mono_image_load (MonoImage *image, MonoImageOpenStatus *status,
gboolean care_about_cli, gboolean care_about_pecoff)
{
- MonoCLIImageInfo *iinfo;
- MonoDotNetHeader *header;
GSList *errors = NULL;
mono_profiler_module_event (image, MONO_PROFILE_START_LOAD);
mono_image_init (image);
- iinfo = image->image_info;
- header = &iinfo->cli_header;
-
if (status)
*status = MONO_IMAGE_IMAGE_INVALID;
free_hash (image->native_wrapper_aot_cache);
free_hash (image->pinvoke_scopes);
free_hash (image->pinvoke_scope_filenames);
- free_hash (image->gsharedvt_types);
+ for (i = 0; i < image->gshared_types_len; ++i)
+ free_hash (image->gshared_types [i]);
+ g_free (image->gshared_types);
/* The ownership of signatures is not well defined */
g_hash_table_destroy (image->memberref_signatures);
MonoTableInfo *tables = image->tables;
MonoType *sig_type;
guint32 cols[6];
- guint32 nindex, class, class_table;
+ guint32 nindex, class;
const char *fname;
const char *ptr;
guint32 idx = mono_metadata_token_index (token);
switch (class) {
case MONO_MEMBERREF_PARENT_TYPEDEF:
- class_table = MONO_TOKEN_TYPE_DEF;
klass = mono_class_get_checked (image, MONO_TOKEN_TYPE_DEF | nindex, error);
break;
case MONO_MEMBERREF_PARENT_TYPEREF:
- class_table = MONO_TOKEN_TYPE_REF;
klass = mono_class_from_typeref_checked (image, MONO_TOKEN_TYPE_REF | nindex, error);
break;
case MONO_MEMBERREF_PARENT_TYPESPEC:
- class_table = MONO_TOKEN_TYPE_SPEC;
klass = mono_class_get_and_inflate_typespec_checked (image, MONO_TOKEN_TYPE_SPEC | nindex, context, error);
break;
default:
"Probing '%s'.", mangled_name2);
error_msg = mono_dl_symbol (module, mangled_name2, &piinfo->addr);
- g_free (error_msg);
- error_msg = NULL;
if (piinfo->addr)
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
"Found as '%s'.", mangled_name2);
+ else
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_DLLIMPORT,
+ "Could not find '%s' due to '%s'.", mangled_name2, error_msg);
+
+ g_free (error_msg);
+ error_msg = NULL;
if (mangled_name != mangled_name2)
g_free (mangled_name2);
MonoTableInfo *tables = image->tables;
MonoGenericContainer *generic_container = NULL, *container = NULL;
const char *sig = NULL;
- int size;
guint32 cols [MONO_TYPEDEF_SIZE];
mono_error_init (error);
if (!sig) /* already taken from the methodref */
sig = mono_metadata_blob_heap (image, cols [4]);
- size = mono_metadata_decode_blob_size (sig, &sig);
+ /* size = */ mono_metadata_decode_blob_size (sig, &sig);
container = klass->generic_container;
mono_method_signature_checked (MonoMethod *m, MonoError *error)
{
int idx;
- int size;
MonoImage* img;
const char *sig;
gboolean can_cache_signature;
if (!mono_verifier_verify_method_signature (img, sig_offset, error))
return NULL;
- size = mono_metadata_decode_blob_size (sig, &sig_body);
+ /* size = */ mono_metadata_decode_blob_size (sig, &sig_body);
signature = mono_metadata_parse_method_signature_full (img, container, idx, sig_body, NULL, error);
if (!signature)
CompareOptions_Ordinal=0x40000000
} MonoCompareOptions;
-extern MonoBoolean ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData *this_obj, MonoString *name, gint32 calendar_index) MONO_INTERNAL;
-extern void ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *this_obj, gint32 datetime_index) MONO_INTERNAL;
-extern void ves_icall_System_Globalization_CultureInfo_construct_internal_locale (MonoCultureInfo *this_obj, MonoString *locale) MONO_INTERNAL;
-extern MonoString* ves_icall_System_Globalization_CultureInfo_get_current_locale_name (void) MONO_INTERNAL;
-extern MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_lcid (MonoCultureInfo *this_obj, gint lcid) MONO_INTERNAL;
-extern MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (MonoCultureInfo *this_obj, MonoString *name) MONO_INTERNAL;
-extern MonoArray *ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean neutral, MonoBoolean specific, MonoBoolean installed) MONO_INTERNAL;
-extern void ves_icall_System_Globalization_CultureInfo_construct_number_format (MonoCultureInfo *this_obj) MONO_INTERNAL;
-extern void ves_icall_System_Globalization_CompareInfo_construct_compareinfo (MonoCompareInfo *comp, MonoString *locale) MONO_INTERNAL;
-extern int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo *this_obj, MonoString *str1, gint32 off1, gint32 len1, MonoString *str2, gint32 off2, gint32 len2, gint32 options) MONO_INTERNAL;
-extern void ves_icall_System_Globalization_CompareInfo_free_internal_collator (MonoCompareInfo *this_obj) MONO_INTERNAL;
+extern MonoBoolean ves_icall_System_Globalization_CalendarData_fill_calendar_data (MonoCalendarData *this_obj, MonoString *name, gint32 calendar_index);
+extern void ves_icall_System_Globalization_CultureData_fill_culture_data (MonoCultureData *this_obj, gint32 datetime_index);
+extern void ves_icall_System_Globalization_CultureInfo_construct_internal_locale (MonoCultureInfo *this_obj, MonoString *locale);
+extern MonoString* ves_icall_System_Globalization_CultureInfo_get_current_locale_name (void);
+extern MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_lcid (MonoCultureInfo *this_obj, gint lcid);
+extern MonoBoolean ves_icall_System_Globalization_CultureInfo_construct_internal_locale_from_name (MonoCultureInfo *this_obj, MonoString *name);
+extern MonoArray *ves_icall_System_Globalization_CultureInfo_internal_get_cultures (MonoBoolean neutral, MonoBoolean specific, MonoBoolean installed);
+extern void ves_icall_System_Globalization_CultureInfo_construct_number_format (MonoCultureInfo *this_obj);
+extern void ves_icall_System_Globalization_CompareInfo_construct_compareinfo (MonoCompareInfo *comp, MonoString *locale);
+extern int ves_icall_System_Globalization_CompareInfo_internal_compare (MonoCompareInfo *this_obj, MonoString *str1, gint32 off1, gint32 len1, MonoString *str2, gint32 off2, gint32 len2, gint32 options);
+extern void ves_icall_System_Globalization_CompareInfo_free_internal_collator (MonoCompareInfo *this_obj);
extern MonoBoolean
-ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_lcid (MonoRegionInfo *this_obj, gint lcid) MONO_INTERNAL;
+ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_lcid (MonoRegionInfo *this_obj, gint lcid);
extern MonoBoolean
ves_icall_System_Globalization_RegionInfo_construct_internal_region_from_name (MonoRegionInfo *this_obj,
- MonoString *name) MONO_INTERNAL;
-extern void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this_obj, MonoSortKey *key, MonoString *source, gint32 options) MONO_INTERNAL;
-extern int ves_icall_System_Globalization_CompareInfo_internal_index (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, MonoString *value, gint32 options, MonoBoolean first) MONO_INTERNAL;
-extern int ves_icall_System_Globalization_CompareInfo_internal_index_char (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, gunichar2 value, gint32 options, MonoBoolean first) MONO_INTERNAL;
-extern int ves_icall_System_Threading_Thread_current_lcid (void) MONO_INTERNAL;
-extern MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this_obj, MonoString *old, MonoString *new_str, MonoCompareInfo *comp) MONO_INTERNAL;
-extern MonoString *ves_icall_System_String_InternalToLower_Comp (MonoString *this_obj, MonoCultureInfo *cult) MONO_INTERNAL;
-extern MonoString *ves_icall_System_String_InternalToUpper_Comp (MonoString *this_obj, MonoCultureInfo *cult) MONO_INTERNAL;
-extern gunichar2 ves_icall_System_Char_InternalToUpper_Comp (gunichar2 c, MonoCultureInfo *cult) MONO_INTERNAL;
-extern gunichar2 ves_icall_System_Char_InternalToLower_Comp (gunichar2 c, MonoCultureInfo *cult) MONO_INTERNAL;
-extern void load_normalization_resource (guint8 **argProps, guint8** argMappedChars, guint8** argCharMapIndex, guint8** argHelperIndex, guint8** argMapIdxToComposite, guint8** argCombiningClass) MONO_INTERNAL;
+ MonoString *name);
+extern void ves_icall_System_Globalization_CompareInfo_assign_sortkey (MonoCompareInfo *this_obj, MonoSortKey *key, MonoString *source, gint32 options);
+extern int ves_icall_System_Globalization_CompareInfo_internal_index (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, MonoString *value, gint32 options, MonoBoolean first);
+extern int ves_icall_System_Globalization_CompareInfo_internal_index_char (MonoCompareInfo *this_obj, MonoString *source, gint32 sindex, gint32 count, gunichar2 value, gint32 options, MonoBoolean first);
+extern int ves_icall_System_Threading_Thread_current_lcid (void);
+extern MonoString *ves_icall_System_String_InternalReplace_Str_Comp (MonoString *this_obj, MonoString *old, MonoString *new_str, MonoCompareInfo *comp);
+extern MonoString *ves_icall_System_String_InternalToLower_Comp (MonoString *this_obj, MonoCultureInfo *cult);
+extern MonoString *ves_icall_System_String_InternalToUpper_Comp (MonoString *this_obj, MonoCultureInfo *cult);
+extern gunichar2 ves_icall_System_Char_InternalToUpper_Comp (gunichar2 c, MonoCultureInfo *cult);
+extern gunichar2 ves_icall_System_Char_InternalToLower_Comp (gunichar2 c, MonoCultureInfo *cult);
+extern void load_normalization_resource (guint8 **argProps, guint8** argMappedChars, guint8** argCharMapIndex, guint8** argHelperIndex, guint8** argMapIdxToComposite, guint8** argCombiningClass);
#endif /* _MONO_METADATA_FILEIO_H_ */
#ifdef LOCK_TRACER
-void mono_locks_tracer_init (void) MONO_INTERNAL;
+void mono_locks_tracer_init (void);
-void mono_locks_lock_acquired (RuntimeLocks kind, gpointer lock) MONO_INTERNAL;
-void mono_locks_lock_released (RuntimeLocks kind, gpointer lock) MONO_INTERNAL;
+void mono_locks_lock_acquired (RuntimeLocks kind, gpointer lock);
+void mono_locks_lock_released (RuntimeLocks kind, gpointer lock);
#else
return;
klass = array->obj.vtable->klass;
- switch (klass->element_class->byval_arg.type) {
- case MONO_TYPE_CLASS:
- for(i = 0; i < array->max_length; ++i)
- mono_marshal_free_ccw (mono_array_get (array, MonoObject*, i));
- free(nativeArray);
- break;
- }
+ if (klass->element_class->byval_arg.type == MONO_TYPE_CLASS) {
+ for(i = 0; i < array->max_length; ++i)
+ mono_marshal_free_ccw (mono_array_get (array, MonoObject*, i));
+ free(nativeArray);
+ }
#endif
}
#endif /* DISABLE_COM */
case MONO_MARSHAL_CONV_SAFEHANDLE: {
- int dar_release_slot, pos;
+ int pos;
- dar_release_slot = mono_mb_add_local (mb, &mono_defaults.boolean_class->byval_arg);
-
- /*
- * The following is ifdefed-out, because I have no way of doing the
- * DangerousRelease when destroying the structure
- */
-#if 0
- /* set release = false */
- mono_mb_emit_icon (mb, 0);
- mono_mb_emit_stloc (mb, dar_release_slot);
- if (!sh_dangerous_add_ref)
- init_safe_handle ();
-
- /* safehandle.DangerousAddRef (ref release) */
- mono_mb_emit_ldloc (mb, 0); /* the source */
- mono_mb_emit_byte (mb, CEE_LDIND_I);
- mono_mb_emit_ldloc_addr (mb, dar_release_slot);
- mono_mb_emit_managed_call (mb, sh_dangerous_add_ref, NULL);
-#endif
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_I);
pos = mono_mb_emit_branch (mb, CEE_BRTRUE);
mono_marshal_need_free (MonoType *t, MonoMethodPInvoke *piinfo, MonoMarshalSpec *spec)
{
MonoMarshalNative encoding;
- MonoMarshalConv conv;
switch (t->type) {
case MONO_TYPE_VALUETYPE:
case MONO_TYPE_CLASS:
if (t->data.klass == mono_defaults.stringbuilder_class) {
gboolean need_free;
- conv = mono_marshal_get_ptr_to_stringbuilder_conv (piinfo, spec, &need_free);
+ mono_marshal_get_ptr_to_stringbuilder_conv (piinfo, spec, &need_free);
return need_free;
}
return FALSE;
MonoMethod *res;
MonoMethod *inst, *def;
MonoGenericContext *ctx;
- MonoMethod *def_method;
g_assert (orig_method->is_inflated);
- def_method = ((MonoMethodInflated*)orig_method)->declaring;
ctx = mono_method_get_context (orig_method);
/*
need_free = mono_marshal_need_free (&klass->element_class->byval_arg,
m->piinfo, spec);
+ if ((t->attrs & PARAM_ATTRIBUTE_OUT) && spec && spec->native == MONO_NATIVE_LPARRAY && spec->data.array_data.param_num != -1) {
+ int param_num = spec->data.array_data.param_num;
+ MonoType *param_type;
+
+ param_type = m->sig->params [param_num];
+
+ if (param_type->byref && param_type->type != MONO_TYPE_I4) {
+ char *msg = g_strdup ("Not implemented.");
+ mono_mb_emit_exception_marshal_directive (mb, msg);
+ break;
+ }
+
+ mono_mb_emit_ldarg (mb, argnum);
+
+ /* Create the managed array */
+ mono_mb_emit_ldarg (mb, param_num);
+ if (m->sig->params [param_num]->byref)
+ // FIXME: Support other types
+ mono_mb_emit_byte (mb, CEE_LDIND_I4);
+ mono_mb_emit_byte (mb, CEE_CONV_OVF_I);
+ mono_mb_emit_op (mb, CEE_NEWARR, klass->element_class);
+ /* Store into argument */
+ mono_mb_emit_byte (mb, CEE_STIND_I);
+ }
+
if (need_convert || need_free) {
/* FIXME: Optimize blittable case */
MonoClass *eklass;
/* free memory allocated (if any) by MONO_MARSHAL_CONV_ARRAY_LPARRAY */
mono_mb_emit_ldarg (mb, argnum);
+ if (t->byref)
+ mono_mb_emit_byte (mb, CEE_LDIND_REF);
mono_mb_emit_ldloc (mb, conv_arg);
mono_mb_emit_icall (mb, conv_to_icall (MONO_MARSHAL_FREE_LPARRAY));
}
case MARSHAL_ACTION_MANAGED_CONV_IN: {
MonoClass *eklass;
guint32 label1, label2, label3;
- int index_var, src_ptr, loc, esize, param_num, num_elem;
+ int index_var, src_ptr, esize, param_num, num_elem;
MonoMarshalConv conv;
gboolean is_string = FALSE;
else
esize = mono_class_native_size (eklass, NULL);
src_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
- loc = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
mono_mb_emit_byte (mb, CEE_LDNULL);
mono_mb_emit_stloc (mb, conv_arg);
case MARSHAL_ACTION_MANAGED_CONV_OUT: {
MonoClass *eklass;
guint32 label1, label2, label3;
- int index_var, dest_ptr, loc, esize, param_num, num_elem;
+ int index_var, dest_ptr, esize, param_num, num_elem;
MonoMarshalConv conv;
gboolean is_string = FALSE;
esize = mono_class_native_size (eklass, NULL);
dest_ptr = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
- loc = mono_mb_add_local (mb, &mono_defaults.int_class->byval_arg);
/* Check null */
mono_mb_emit_ldloc (mb, conv_arg);
return emit_marshal_vtype (m, argnum, t, spec, conv_arg, conv_arg_type, action);
else
return emit_marshal_object (m, argnum, t, spec, conv_arg, conv_arg_type, action);
+ default:
+ return conv_arg;
}
- return conv_arg;
}
#ifndef DISABLE_JIT
int type, param_shift = 0;
static MonoMethodSignature *get_last_error_sig = NULL;
+ memset (&m, 0, sizeof (m));
m.mb = mb;
+ m.sig = sig;
m.piinfo = piinfo;
/* we copy the signature, so that we can set pinvoke to 0 */
case MONO_TYPE_BOOLEAN:
emit_marshal (&m, argnum, t, spec, tmp_locals [i], NULL, MARSHAL_ACTION_CONV_OUT);
break;
+ default:
+ break;
}
}
case MONO_TYPE_BOOLEAN:
emit_marshal (m, i, t, mspecs [i + 1], tmp_locals [i], NULL, MARSHAL_ACTION_MANAGED_CONV_OUT);
break;
+ default:
+ break;
}
}
else if (invoke_sig->params [i]->attrs & PARAM_ATTRIBUTE_OUT) {
csig->hasthis = 0;
csig->pinvoke = 1;
+ memset (&m, 0, sizeof (m));
m.mb = mb;
m.sig = sig;
m.piinfo = NULL;
gint32 call_conv;
gint32 charset = 0;
MonoBoolean set_last_error = 0;
- MonoBoolean best_fit_mapping = 0;
- MonoBoolean throw_on_unmappable = 0;
MonoError error;
mono_reflection_create_custom_attr_data_args (mono_defaults.corlib, attr->ctor, attr->data, attr->data_size, &typed_args, &named_args, &arginfo, &error);
} else if (!strcmp (narg->field->name, "SetLastError")) {
set_last_error = *(MonoBoolean*)mono_object_unbox (o);
} else if (!strcmp (narg->field->name, "BestFitMapping")) {
- best_fit_mapping = *(MonoBoolean*)mono_object_unbox (o);
+ // best_fit_mapping = *(MonoBoolean*)mono_object_unbox (o);
} else if (!strcmp (narg->field->name, "ThrowOnUnmappableChar")) {
- throw_on_unmappable = *(MonoBoolean*)mono_object_unbox (o);
+ // throw_on_unmappable = *(MonoBoolean*)mono_object_unbox (o);
} else {
g_assert_not_reached ();
}
csig->hasthis = 0;
csig->pinvoke = 1;
+ memset (&m, 0, sizeof (m));
m.mb = mb;
m.sig = sig;
m.piinfo = NULL;
MonoMethodSignature *sig;
MonoMethod *res;
MonoGenericContext *ctx = NULL;
- MonoMethod *orig_method = NULL;
MonoGenericContainer *container = NULL;
if (method->is_inflated && !mono_method_get_context (method)->method_inst) {
- orig_method = method;
ctx = &((MonoMethodInflated*)method)->context;
method = ((MonoMethodInflated*)method)->declaring;
container = mono_method_get_generic_container (method);
info = mono_marshal_load_type_info (klass);
for (i = 0; i < info->num_fields; i++) {
- MonoMarshalNative ntype;
MonoMarshalConv conv;
MonoType *ftype = info->fields [i].field->type;
char *cpos;
if (ftype->attrs & FIELD_ATTRIBUTE_STATIC)
continue;
- ntype = mono_type_to_unmanaged (ftype, info->fields [i].mspec, TRUE,
- klass->unicode, &conv);
+ mono_type_to_unmanaged (ftype, info->fields [i].mspec, TRUE,
+ klass->unicode, &conv);
cpos = ptr + info->fields [i].offset;
return res;
}
+ default:
+ break;
}
-
mono_raise_exception (mono_get_exception_argument ("", "No PInvoke conversion exists for value passed to Object-typed parameter."));
-
return NULL;
}
/* marshaling helper functions */
void
-mono_marshal_init (void) MONO_INTERNAL;
+mono_marshal_init (void);
void
-mono_marshal_init_tls (void) MONO_INTERNAL;
+mono_marshal_init_tls (void);
void
-mono_marshal_cleanup (void) MONO_INTERNAL;
+mono_marshal_cleanup (void);
gint32
-mono_class_native_size (MonoClass *klass, guint32 *align) MONO_INTERNAL;
+mono_class_native_size (MonoClass *klass, guint32 *align);
MonoMarshalType *
-mono_marshal_load_type_info (MonoClass* klass) MONO_INTERNAL;
+mono_marshal_load_type_info (MonoClass* klass);
gint32
mono_marshal_type_size (MonoType *type, MonoMarshalSpec *mspec, guint32 *align,
- gboolean as_field, gboolean unicode) MONO_INTERNAL;
+ gboolean as_field, gboolean unicode);
int
-mono_type_native_stack_size (MonoType *type, guint32 *alignment) MONO_INTERNAL;
+mono_type_native_stack_size (MonoType *type, guint32 *alignment);
gpointer
-mono_array_to_savearray (MonoArray *array) MONO_INTERNAL;
+mono_array_to_savearray (MonoArray *array);
gpointer
-mono_array_to_lparray (MonoArray *array) MONO_INTERNAL;
+mono_array_to_lparray (MonoArray *array);
void
-mono_free_lparray (MonoArray *array, gpointer* nativeArray) MONO_INTERNAL;
+mono_free_lparray (MonoArray *array, gpointer* nativeArray);
void
-mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text) MONO_INTERNAL;
+mono_string_utf8_to_builder (MonoStringBuilder *sb, char *text);
void
-mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text) MONO_INTERNAL;
+mono_string_utf16_to_builder (MonoStringBuilder *sb, gunichar2 *text);
gpointer
-mono_string_builder_to_utf8 (MonoStringBuilder *sb) MONO_INTERNAL;
+mono_string_builder_to_utf8 (MonoStringBuilder *sb);
gpointer
-mono_string_builder_to_utf16 (MonoStringBuilder *sb) MONO_INTERNAL;
+mono_string_builder_to_utf16 (MonoStringBuilder *sb);
gpointer
-mono_string_to_ansibstr (MonoString *string_obj) MONO_INTERNAL;
+mono_string_to_ansibstr (MonoString *string_obj);
gpointer
-mono_string_to_bstr (MonoString *string_obj) MONO_INTERNAL;
+mono_string_to_bstr (MonoString *string_obj);
void
-mono_string_to_byvalstr (gpointer dst, MonoString *src, int size) MONO_INTERNAL;
+mono_string_to_byvalstr (gpointer dst, MonoString *src, int size);
void
-mono_string_to_byvalwstr (gpointer dst, MonoString *src, int size) MONO_INTERNAL;
+mono_string_to_byvalwstr (gpointer dst, MonoString *src, int size);
gpointer
-mono_delegate_to_ftnptr (MonoDelegate *delegate) MONO_INTERNAL;
+mono_delegate_to_ftnptr (MonoDelegate *delegate);
MonoDelegate*
-mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn) MONO_INTERNAL;
+mono_ftnptr_to_delegate (MonoClass *klass, gpointer ftn);
-void mono_delegate_free_ftnptr (MonoDelegate *delegate) MONO_INTERNAL;
+void mono_delegate_free_ftnptr (MonoDelegate *delegate);
void
-mono_marshal_set_last_error (void) MONO_INTERNAL;
+mono_marshal_set_last_error (void);
gpointer
-mono_marshal_asany (MonoObject *obj, MonoMarshalNative string_encoding, int param_attrs) MONO_INTERNAL;
+mono_marshal_asany (MonoObject *obj, MonoMarshalNative string_encoding, int param_attrs);
void
-mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_encoding, int param_attrs) MONO_INTERNAL;
+mono_marshal_free_asany (MonoObject *o, gpointer ptr, MonoMarshalNative string_encoding, int param_attrs);
guint
-mono_type_to_ldind (MonoType *type) MONO_INTERNAL;
+mono_type_to_ldind (MonoType *type);
guint
-mono_type_to_stind (MonoType *type) MONO_INTERNAL;
+mono_type_to_stind (MonoType *type);
/* functions to create various architecture independent helper functions */
MonoMethod *
-mono_marshal_method_from_wrapper (MonoMethod *wrapper) MONO_INTERNAL;
+mono_marshal_method_from_wrapper (MonoMethod *wrapper);
WrapperInfo*
-mono_wrapper_info_create (MonoMethodBuilder *mb, WrapperSubtype subtype) MONO_INTERNAL;
+mono_wrapper_info_create (MonoMethodBuilder *mb, WrapperSubtype subtype);
void
-mono_marshal_set_wrapper_info (MonoMethod *method, gpointer data) MONO_INTERNAL;
+mono_marshal_set_wrapper_info (MonoMethod *method, gpointer data);
gpointer
-mono_marshal_get_wrapper_info (MonoMethod *wrapper) MONO_INTERNAL;
+mono_marshal_get_wrapper_info (MonoMethod *wrapper);
MonoMethod *
-mono_marshal_get_delegate_begin_invoke (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_delegate_begin_invoke (MonoMethod *method);
MonoMethod *
-mono_marshal_get_delegate_end_invoke (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_delegate_end_invoke (MonoMethod *method);
MonoMethod *
-mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del) MONO_INTERNAL;
+mono_marshal_get_delegate_invoke (MonoMethod *method, MonoDelegate *del);
MonoMethod *
-mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean is_virtual) MONO_INTERNAL;
+mono_marshal_get_runtime_invoke (MonoMethod *method, gboolean is_virtual);
MonoMethod*
-mono_marshal_get_runtime_invoke_dynamic (void) MONO_INTERNAL;
+mono_marshal_get_runtime_invoke_dynamic (void);
MonoMethodSignature*
-mono_marshal_get_string_ctor_signature (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_string_ctor_signature (MonoMethod *method);
MonoMethod *
-mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc) MONO_INTERNAL;
+mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass, uint32_t this_loc);
gpointer
-mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type) MONO_INTERNAL;
+mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type);
MonoMethod *
-mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gconstpointer func, gboolean check_exceptions) MONO_INTERNAL;
+mono_marshal_get_icall_wrapper (MonoMethodSignature *sig, const char *name, gconstpointer func, gboolean check_exceptions);
MonoMethod *
-mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot) MONO_INTERNAL;
+mono_marshal_get_native_wrapper (MonoMethod *method, gboolean check_exceptions, gboolean aot);
MonoMethod *
-mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func) MONO_INTERNAL;
+mono_marshal_get_native_func_wrapper (MonoImage *image, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func);
MonoMethod*
-mono_marshal_get_native_func_wrapper_aot (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_native_func_wrapper_aot (MonoClass *klass);
MonoMethod *
-mono_marshal_get_struct_to_ptr (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_struct_to_ptr (MonoClass *klass);
MonoMethod *
-mono_marshal_get_ptr_to_struct (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_ptr_to_struct (MonoClass *klass);
MonoMethod *
-mono_marshal_get_synchronized_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_synchronized_wrapper (MonoMethod *method);
MonoMethod *
-mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_synchronized_inner_wrapper (MonoMethod *method);
MonoMethod *
-mono_marshal_get_unbox_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_unbox_wrapper (MonoMethod *method);
MonoMethod *
-mono_marshal_get_castclass_with_cache (void) MONO_INTERNAL;
+mono_marshal_get_castclass_with_cache (void);
MonoMethod *
-mono_marshal_get_isinst_with_cache (void) MONO_INTERNAL;
+mono_marshal_get_isinst_with_cache (void);
MonoMethod *
-mono_marshal_get_isinst (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_isinst (MonoClass *klass);
MonoMethod *
-mono_marshal_get_castclass (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_castclass (MonoClass *klass);
MonoMethod *
-mono_marshal_get_stelemref (void) MONO_INTERNAL;
+mono_marshal_get_stelemref (void);
MonoMethod*
-mono_marshal_get_virtual_stelemref (MonoClass *array_class) MONO_INTERNAL;
+mono_marshal_get_virtual_stelemref (MonoClass *array_class);
MonoMethod**
-mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers) MONO_INTERNAL;
+mono_marshal_get_virtual_stelemref_wrappers (int *nwrappers);
MonoMethod*
-mono_marshal_get_array_address (int rank, int elem_size) MONO_INTERNAL;
+mono_marshal_get_array_address (int rank, int elem_size);
MonoMethod *
-mono_marshal_get_array_accessor_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_array_accessor_wrapper (MonoMethod *method);
MonoMethod *
mono_marshal_get_generic_array_helper (MonoClass *klass, MonoClass *iface,
- gchar *name, MonoMethod *method) MONO_INTERNAL;
+ gchar *name, MonoMethod *method);
MonoMethod *
-mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_thunk_invoke_wrapper (MonoMethod *method);
MonoMethod*
-mono_marshal_get_gsharedvt_in_wrapper (void) MONO_INTERNAL;
+mono_marshal_get_gsharedvt_in_wrapper (void);
MonoMethod*
-mono_marshal_get_gsharedvt_out_wrapper (void) MONO_INTERNAL;
+mono_marshal_get_gsharedvt_out_wrapper (void);
void
-mono_marshal_free_dynamic_wrappers (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_free_dynamic_wrappers (MonoMethod *method);
void
-mono_marshal_free_inflated_wrappers (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_free_inflated_wrappers (MonoMethod *method);
void
-mono_marshal_lock_internal (void) MONO_INTERNAL;
+mono_marshal_lock_internal (void);
void
-mono_marshal_unlock_internal (void) MONO_INTERNAL;
+mono_marshal_unlock_internal (void);
/* marshaling internal calls */
void *
-mono_marshal_alloc (gulong size) MONO_INTERNAL;
+mono_marshal_alloc (gulong size);
void
-mono_marshal_free (gpointer ptr) MONO_INTERNAL;
+mono_marshal_free (gpointer ptr);
void
-mono_marshal_free_array (gpointer *ptr, int size) MONO_INTERNAL;
+mono_marshal_free_array (gpointer *ptr, int size);
gboolean
-mono_marshal_free_ccw (MonoObject* obj) MONO_INTERNAL;
+mono_marshal_free_ccw (MonoObject* obj);
void
-cominterop_release_all_rcws (void) MONO_INTERNAL;
+cominterop_release_all_rcws (void);
void
ves_icall_System_Runtime_InteropServices_Marshal_copy_to_unmanaged (MonoArray *src, gint32 start_index,
- gpointer dest, gint32 length) MONO_INTERNAL;
+ gpointer dest, gint32 length);
void
ves_icall_System_Runtime_InteropServices_Marshal_copy_from_unmanaged (gpointer src, gint32 start_index,
- MonoArray *dest, gint32 length) MONO_INTERNAL;
+ MonoArray *dest, gint32 length);
MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi (char *ptr);
MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringAnsi_len (char *ptr, gint32 len);
MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni (guint16 *ptr);
MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringUni_len (guint16 *ptr, gint32 len);
MonoString *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStringBSTR (gpointer ptr);
guint32
-ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethod *m) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetComSlotForMethodInfoInternal (MonoReflectionMethod *m);
guint32
-ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetLastWin32Error (void);
guint32
-ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_SizeOf (MonoReflectionType *rtype);
void
-ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_StructureToPtr (MonoObject *obj, gpointer dst, MonoBoolean delete_old);
void
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure (gpointer src, MonoObject *dst);
MonoObject *
-ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_PtrToStructure_type (gpointer src, MonoReflectionType *type);
int
-ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_OffsetOf (MonoReflectionType *type, MonoString *field_name);
gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_StringToBSTR (MonoString *string);
gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalAnsi (MonoString *string);
gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_StringToHGlobalUni (MonoString *string);
void
-ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_DestroyStructure (gpointer src, MonoReflectionType *type);
void*
-ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_AllocCoTaskMem (int size);
void
-ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_FreeCoTaskMem (void *ptr);
gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_ReAllocCoTaskMem (gpointer ptr, int size);
void*
-ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (int size) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_AllocHGlobal (int size);
gpointer
-ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, int size) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_ReAllocHGlobal (gpointer ptr, int size);
void
-ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_FreeHGlobal (void *ptr);
void
-ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void *ptr) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_FreeBSTR (void *ptr);
void*
-ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArray *arrayobj, int index) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_UnsafeAddrOfPinnedArrayElement (MonoArray *arrayobj, int index);
MonoDelegate*
-ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionType *type) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetDelegateForFunctionPointerInternal (void *ftn, MonoReflectionType *type);
int
-ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk);
int
-ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointer pUnk, gpointer riid, gpointer* ppv) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_QueryInterfaceInternal (gpointer pUnk, gpointer riid, gpointer* ppv);
int
-ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_ReleaseInternal (gpointer pUnk);
void*
-ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObject* object) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetIUnknownForObjectInternal (MonoObject* object);
MonoObject*
-ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetObjectForCCW (void* pUnk);
void*
-ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object);
void*
-ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObject* object, MonoReflectionType* type) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_GetCCW (MonoObject* object, MonoReflectionType* type);
MonoBoolean
-ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObject* object) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_IsComObject (MonoObject* object);
gint32
-ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObject* object) MONO_INTERNAL;
+ves_icall_System_Runtime_InteropServices_Marshal_ReleaseComObjectInternal (MonoObject* object);
MonoObject *
-ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type) MONO_INTERNAL;
+ves_icall_System_ComObject_CreateRCW (MonoReflectionType *type);
void
-ves_icall_System_ComObject_ReleaseInterfaces(MonoComObject* obj) MONO_INTERNAL;
+ves_icall_System_ComObject_ReleaseInterfaces(MonoComObject* obj);
gpointer
-ves_icall_System_ComObject_GetInterfaceInternal (MonoComObject* obj, MonoReflectionType* type, MonoBoolean throw_exception) MONO_INTERNAL;
+ves_icall_System_ComObject_GetInterfaceInternal (MonoComObject* obj, MonoReflectionType* type, MonoBoolean throw_exception);
void
-ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxy* proxy) MONO_INTERNAL;
+ves_icall_Mono_Interop_ComInteropProxy_AddProxy (gpointer pUnk, MonoComInteropProxy* proxy);
MonoComInteropProxy*
-ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk) MONO_INTERNAL;
+ves_icall_Mono_Interop_ComInteropProxy_FindProxy (gpointer pUnk);
MONO_API void
mono_win32_compat_CopyMemory (gpointer dest, gconstpointer source, gsize length);
mono_win32_compat_ZeroMemory (gpointer dest, gsize length);
void
-mono_marshal_find_nonzero_bit_offset (guint8 *buf, int len, int *byte_offset, guint8 *bitmask) MONO_INTERNAL;
+mono_marshal_find_nonzero_bit_offset (guint8 *buf, int len, int *byte_offset, guint8 *bitmask);
MonoMethodSignature*
-mono_signature_no_pinvoke (MonoMethod *method) MONO_INTERNAL;
+mono_signature_no_pinvoke (MonoMethod *method);
/* Called from cominterop.c/remoting.c */
void
-mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func, gboolean aot, gboolean check_exceptions, gboolean func_param) MONO_INTERNAL;
+mono_marshal_emit_native_wrapper (MonoImage *image, MonoMethodBuilder *mb, MonoMethodSignature *sig, MonoMethodPInvoke *piinfo, MonoMarshalSpec **mspecs, gpointer func, gboolean aot, gboolean check_exceptions, gboolean func_param);
void
-mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle) MONO_INTERNAL;
+mono_marshal_emit_managed_wrapper (MonoMethodBuilder *mb, MonoMethodSignature *invoke_sig, MonoMarshalSpec **mspecs, EmitMarshalContext* m, MonoMethod *method, uint32_t target_handle);
GHashTable*
-mono_marshal_get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func) MONO_INTERNAL;
+mono_marshal_get_cache (GHashTable **var, GHashFunc hash_func, GCompareFunc equal_func);
MonoMethod*
-mono_marshal_find_in_cache (GHashTable *cache, gpointer key) MONO_INTERNAL;
+mono_marshal_find_in_cache (GHashTable *cache, gpointer key);
MonoMethod*
mono_mb_create_and_cache (GHashTable *cache, gpointer key,
MonoMethodBuilder *mb, MonoMethodSignature *sig,
- int max_stack) MONO_INTERNAL;
+ int max_stack);
void
-mono_marshal_emit_thread_interrupt_checkpoint (MonoMethodBuilder *mb) MONO_INTERNAL;
+mono_marshal_emit_thread_interrupt_checkpoint (MonoMethodBuilder *mb);
void
-mono_marshal_emit_thread_force_interrupt_checkpoint (MonoMethodBuilder *mb) MONO_INTERNAL;
+mono_marshal_emit_thread_force_interrupt_checkpoint (MonoMethodBuilder *mb);
void
-mono_marshal_use_aot_wrappers (gboolean use) MONO_INTERNAL;
+mono_marshal_use_aot_wrappers (gboolean use);
MonoObject *
-mono_marshal_xdomain_copy_value (MonoObject *val) MONO_INTERNAL;
+mono_marshal_xdomain_copy_value (MonoObject *val);
int
-mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolean save_this) MONO_INTERNAL;
+mono_mb_emit_save_args (MonoMethodBuilder *mb, MonoMethodSignature *sig, gboolean save_this);
void
-mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type) MONO_INTERNAL;
+mono_mb_emit_restore_result (MonoMethodBuilder *mb, MonoType *return_type);
MonoMethod*
mono_mb_create (MonoMethodBuilder *mb, MonoMethodSignature *sig,
- int max_stack, WrapperInfo *info) MONO_INTERNAL;
+ int max_stack, WrapperInfo *info);
MonoMethod*
mono_mb_create_and_cache_full (GHashTable *cache, gpointer key,
MonoMethodBuilder *mb, MonoMethodSignature *sig,
- int max_stack, WrapperInfo *info, gboolean *out_found) MONO_INTERNAL;
+ int max_stack, WrapperInfo *info, gboolean *out_found);
G_END_DECLS
}
long
-mono_mempool_get_bytes_allocated (void) MONO_INTERNAL;
+mono_mempool_get_bytes_allocated (void);
#endif
GHashTable *pinvoke_scope_filenames;
/* Indexed by MonoGenericParam pointers */
- GHashTable *gsharedvt_types;
+ GHashTable **gshared_types;
+ /* The length of the above array */
+ int gshared_types_len;
/*
* No other runtime locks must be taken while holding this lock.
}
/* for use with allocated memory blocks (assumes alignment is to 8 bytes) */
-guint mono_aligned_addr_hash (gconstpointer ptr) MONO_INTERNAL;
+guint mono_aligned_addr_hash (gconstpointer ptr);
void
-mono_image_check_for_module_cctor (MonoImage *image) MONO_INTERNAL;
+mono_image_check_for_module_cctor (MonoImage *image);
gpointer
-mono_image_alloc (MonoImage *image, guint size) MONO_INTERNAL;
+mono_image_alloc (MonoImage *image, guint size);
gpointer
-mono_image_alloc0 (MonoImage *image, guint size) MONO_INTERNAL;
+mono_image_alloc0 (MonoImage *image, guint size);
#define mono_image_new0(image,type,size) ((type *) mono_image_alloc0 (image, sizeof (type)* (size)))
char*
-mono_image_strdup (MonoImage *image, const char *s) MONO_INTERNAL;
+mono_image_strdup (MonoImage *image, const char *s);
GList*
-g_list_prepend_image (MonoImage *image, GList *list, gpointer data) MONO_INTERNAL;
+g_list_prepend_image (MonoImage *image, GList *list, gpointer data);
GSList*
-g_slist_append_image (MonoImage *image, GSList *list, gpointer data) MONO_INTERNAL;
+g_slist_append_image (MonoImage *image, GSList *list, gpointer data);
void
-mono_image_lock (MonoImage *image) MONO_INTERNAL;
+mono_image_lock (MonoImage *image);
void
-mono_image_unlock (MonoImage *image) MONO_INTERNAL;
+mono_image_unlock (MonoImage *image);
gpointer
-mono_image_property_lookup (MonoImage *image, gpointer subject, guint32 property) MONO_INTERNAL;
+mono_image_property_lookup (MonoImage *image, gpointer subject, guint32 property);
void
-mono_image_property_insert (MonoImage *image, gpointer subject, guint32 property, gpointer value) MONO_INTERNAL;
+mono_image_property_insert (MonoImage *image, gpointer subject, guint32 property, gpointer value);
void
-mono_image_property_remove (MonoImage *image, gpointer subject) MONO_INTERNAL;
+mono_image_property_remove (MonoImage *image, gpointer subject);
gboolean
-mono_image_close_except_pools (MonoImage *image) MONO_INTERNAL;
+mono_image_close_except_pools (MonoImage *image);
void
-mono_image_close_finish (MonoImage *image) MONO_INTERNAL;
+mono_image_close_finish (MonoImage *image);
typedef void (*MonoImageUnloadFunc) (MonoImage *image, gpointer user_data);
void
-mono_install_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
+mono_install_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data);
void
-mono_remove_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data) MONO_INTERNAL;
+mono_remove_image_unload_hook (MonoImageUnloadFunc func, gpointer user_data);
void
-mono_image_append_class_to_reflection_info_set (MonoClass *klass) MONO_INTERNAL;
+mono_image_append_class_to_reflection_info_set (MonoClass *klass);
gpointer
-mono_image_set_alloc (MonoImageSet *set, guint size) MONO_INTERNAL;
+mono_image_set_alloc (MonoImageSet *set, guint size);
gpointer
-mono_image_set_alloc0 (MonoImageSet *set, guint size) MONO_INTERNAL;
+mono_image_set_alloc0 (MonoImageSet *set, guint size);
char*
-mono_image_set_strdup (MonoImageSet *set, const char *s) MONO_INTERNAL;
+mono_image_set_strdup (MonoImageSet *set, const char *s);
#define mono_image_set_new0(image,type,size) ((type *) mono_image_set_alloc0 (image, sizeof (type)* (size)))
MonoType*
-mono_metadata_get_shared_type (MonoType *type) MONO_INTERNAL;
+mono_metadata_get_shared_type (MonoType *type);
void
-mono_metadata_clean_for_image (MonoImage *image) MONO_INTERNAL;
+mono_metadata_clean_for_image (MonoImage *image);
void
-mono_metadata_clean_generic_classes_for_image (MonoImage *image) MONO_INTERNAL;
+mono_metadata_clean_generic_classes_for_image (MonoImage *image);
MONO_API void
mono_metadata_cleanup (void);
-const char * mono_meta_table_name (int table) MONO_INTERNAL;
-void mono_metadata_compute_table_bases (MonoImage *meta) MONO_INTERNAL;
+const char * mono_meta_table_name (int table);
+void mono_metadata_compute_table_bases (MonoImage *meta);
gboolean
mono_metadata_interfaces_from_typedef_full (MonoImage *image,
guint *count,
gboolean heap_alloc_result,
MonoGenericContext *context,
- MonoError *error) MONO_INTERNAL;
+ MonoError *error);
MonoArrayType *
mono_metadata_parse_array_full (MonoImage *image,
MonoGenericContainer *container,
const char *ptr,
- const char **rptr) MONO_INTERNAL;
+ const char **rptr);
MONO_API MonoType *
mono_metadata_parse_type_full (MonoImage *image,
MonoMethodSignature *
mono_metadata_parse_signature_full (MonoImage *image,
MonoGenericContainer *generic_container,
- guint32 token) MONO_INTERNAL;
+ guint32 token);
MONO_API MonoMethodSignature *
mono_metadata_parse_method_signature_full (MonoImage *image,
const char *ptr);
gboolean
-mono_method_get_header_summary (MonoMethod *method, MonoMethodHeaderSummary *summary) MONO_INTERNAL;
+mono_method_get_header_summary (MonoMethod *method, MonoMethodHeaderSummary *summary);
-int* mono_metadata_get_param_attrs (MonoImage *m, int def, int param_count) MONO_INTERNAL;
-gboolean mono_metadata_method_has_param_attrs (MonoImage *m, int def) MONO_INTERNAL;
+int* mono_metadata_get_param_attrs (MonoImage *m, int def, int param_count);
+gboolean mono_metadata_method_has_param_attrs (MonoImage *m, int def);
guint
-mono_metadata_generic_context_hash (const MonoGenericContext *context) MONO_INTERNAL;
+mono_metadata_generic_context_hash (const MonoGenericContext *context);
gboolean
mono_metadata_generic_context_equal (const MonoGenericContext *g1,
- const MonoGenericContext *g2) MONO_INTERNAL;
+ const MonoGenericContext *g2);
MonoGenericInst *
mono_metadata_parse_generic_inst (MonoImage *image,
MonoGenericContainer *container,
int count,
const char *ptr,
- const char **rptr) MONO_INTERNAL;
+ const char **rptr);
MonoGenericInst *
mono_metadata_get_generic_inst (int type_argc,
- MonoType **type_argv) MONO_INTERNAL;
+ MonoType **type_argv);
MonoGenericClass *
mono_metadata_lookup_generic_class (MonoClass *gclass,
MonoGenericInst *inst,
- gboolean is_dynamic) MONO_INTERNAL;
+ gboolean is_dynamic);
-MonoGenericInst * mono_metadata_inflate_generic_inst (MonoGenericInst *ginst, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+MonoGenericInst * mono_metadata_inflate_generic_inst (MonoGenericInst *ginst, MonoGenericContext *context, MonoError *error);
-void mono_dynamic_stream_reset (MonoDynamicStream* stream) MONO_INTERNAL;
-void mono_assembly_addref (MonoAssembly *assembly) MONO_INTERNAL;
-void mono_assembly_load_friends (MonoAssembly* ass) MONO_INTERNAL;
-gboolean mono_assembly_has_skip_verification (MonoAssembly* ass) MONO_INTERNAL;
+void mono_dynamic_stream_reset (MonoDynamicStream* stream);
+void mono_assembly_addref (MonoAssembly *assembly);
+void mono_assembly_load_friends (MonoAssembly* ass);
+gboolean mono_assembly_has_skip_verification (MonoAssembly* ass);
-void mono_assembly_release_gc_roots (MonoAssembly *assembly) MONO_INTERNAL;
-gboolean mono_assembly_close_except_image_pools (MonoAssembly *assembly) MONO_INTERNAL;
-void mono_assembly_close_finish (MonoAssembly *assembly) MONO_INTERNAL;
+void mono_assembly_release_gc_roots (MonoAssembly *assembly);
+gboolean mono_assembly_close_except_image_pools (MonoAssembly *assembly);
+void mono_assembly_close_finish (MonoAssembly *assembly);
-gboolean mono_public_tokens_are_equal (const unsigned char *pubt1, const unsigned char *pubt2) MONO_INTERNAL;
+gboolean mono_public_tokens_are_equal (const unsigned char *pubt1, const unsigned char *pubt2);
-void mono_config_parse_publisher_policy (const char *filename, MonoAssemblyBindingInfo *binding_info) MONO_INTERNAL;
+void mono_config_parse_publisher_policy (const char *filename, MonoAssemblyBindingInfo *binding_info);
void mono_config_parse_assembly_bindings (const char *filename, int major, int minor, void *user_data,
- void (*infocb)(MonoAssemblyBindingInfo *info, void *user_data)) MONO_INTERNAL;
+ void (*infocb)(MonoAssemblyBindingInfo *info, void *user_data));
gboolean
mono_assembly_name_parse_full (const char *name,
MonoAssemblyName *aname,
gboolean save_public_key,
gboolean *is_version_defined,
- gboolean *is_token_defined) MONO_INTERNAL;
+ gboolean *is_token_defined);
MONO_API guint32 mono_metadata_get_generic_param_row (MonoImage *image, guint32 token, guint32 *owner);
-void mono_unload_interface_ids (MonoBitSet *bitset) MONO_INTERNAL;
+void mono_unload_interface_ids (MonoBitSet *bitset);
-MonoType *mono_metadata_type_dup (MonoImage *image, const MonoType *original) MONO_INTERNAL;
-MonoMethodSignature *mono_metadata_signature_dup_full (MonoImage *image,MonoMethodSignature *sig) MONO_INTERNAL;
-MonoMethodSignature *mono_metadata_signature_dup_mempool (MonoMemPool *mp, MonoMethodSignature *sig) MONO_INTERNAL;
+MonoType *mono_metadata_type_dup (MonoImage *image, const MonoType *original);
+MonoMethodSignature *mono_metadata_signature_dup_full (MonoImage *image,MonoMethodSignature *sig);
+MonoMethodSignature *mono_metadata_signature_dup_mempool (MonoMemPool *mp, MonoMethodSignature *sig);
MonoGenericInst *
-mono_get_shared_generic_inst (MonoGenericContainer *container) MONO_INTERNAL;
+mono_get_shared_generic_inst (MonoGenericContainer *container);
int
-mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open) MONO_INTERNAL;
+mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open);
MONO_API void mono_type_get_desc (GString *res, MonoType *type, mono_bool include_namespace);
gboolean
-mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only) MONO_INTERNAL;
+mono_metadata_type_equal_full (MonoType *t1, MonoType *t2, gboolean signature_only);
MonoMarshalSpec *
-mono_metadata_parse_marshal_spec_full (MonoImage *image, MonoImage *parent_image, const char *ptr) MONO_INTERNAL;
+mono_metadata_parse_marshal_spec_full (MonoImage *image, MonoImage *parent_image, const char *ptr);
-guint mono_metadata_generic_inst_hash (gconstpointer data) MONO_INTERNAL;
-gboolean mono_metadata_generic_inst_equal (gconstpointer ka, gconstpointer kb) MONO_INTERNAL;
+guint mono_metadata_generic_inst_hash (gconstpointer data);
+gboolean mono_metadata_generic_inst_equal (gconstpointer ka, gconstpointer kb);
MONO_API void
mono_metadata_field_info_with_mempool (
MonoMarshalSpec **marshal_spec);
MonoClassField*
-mono_metadata_get_corresponding_field_from_generic_type_definition (MonoClassField *field) MONO_INTERNAL;
+mono_metadata_get_corresponding_field_from_generic_type_definition (MonoClassField *field);
MonoEvent*
-mono_metadata_get_corresponding_event_from_generic_type_definition (MonoEvent *event) MONO_INTERNAL;
+mono_metadata_get_corresponding_event_from_generic_type_definition (MonoEvent *event);
MonoProperty*
-mono_metadata_get_corresponding_property_from_generic_type_definition (MonoProperty *property) MONO_INTERNAL;
+mono_metadata_get_corresponding_property_from_generic_type_definition (MonoProperty *property);
guint32
-mono_metadata_signature_size (MonoMethodSignature *sig) MONO_INTERNAL;
+mono_metadata_signature_size (MonoMethodSignature *sig);
-guint mono_metadata_str_hash (gconstpointer v1) MONO_INTERNAL;
+guint mono_metadata_str_hash (gconstpointer v1);
-gboolean mono_image_load_pe_data (MonoImage *image) MONO_INTERNAL;
+gboolean mono_image_load_pe_data (MonoImage *image);
-gboolean mono_image_load_cli_data (MonoImage *image) MONO_INTERNAL;
+gboolean mono_image_load_cli_data (MonoImage *image);
-void mono_image_load_names (MonoImage *image) MONO_INTERNAL;
+void mono_image_load_names (MonoImage *image);
-MonoImage *mono_image_open_raw (const char *fname, MonoImageOpenStatus *status) MONO_INTERNAL;
+MonoImage *mono_image_open_raw (const char *fname, MonoImageOpenStatus *status);
-MonoException *mono_get_exception_field_access_msg (const char *msg) MONO_INTERNAL;
+MonoException *mono_get_exception_field_access_msg (const char *msg);
-MonoException *mono_get_exception_method_access_msg (const char *msg) MONO_INTERNAL;
+MonoException *mono_get_exception_method_access_msg (const char *msg);
-MonoMethod* method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+MonoMethod* method_from_method_def_or_ref (MonoImage *m, guint32 tok, MonoGenericContext *context, MonoError *error);
-MonoMethod *mono_get_method_constrained_with_method (MonoImage *image, MonoMethod *method, MonoClass *constrained_class, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
-MonoMethod *mono_get_method_constrained_checked (MonoImage *image, guint32 token, MonoClass *constrained_class, MonoGenericContext *context, MonoMethod **cil_method, MonoError *error) MONO_INTERNAL;
+MonoMethod *mono_get_method_constrained_with_method (MonoImage *image, MonoMethod *method, MonoClass *constrained_class, MonoGenericContext *context, MonoError *error);
+MonoMethod *mono_get_method_constrained_checked (MonoImage *image, guint32 token, MonoClass *constrained_class, MonoGenericContext *context, MonoMethod **cil_method, MonoError *error);
-void mono_type_set_alignment (MonoTypeEnum type, int align) MONO_INTERNAL;
+void mono_type_set_alignment (MonoTypeEnum type, int align);
-MonoAotCacheConfig *mono_get_aot_cache_config (void) MONO_INTERNAL;
+MonoAotCacheConfig *mono_get_aot_cache_config (void);
MonoType *
-mono_type_create_from_typespec_checked (MonoImage *image, guint32 type_spec, MonoError *error) MONO_INTERNAL;
+mono_type_create_from_typespec_checked (MonoImage *image, guint32 type_spec, MonoError *error);
MonoMethodSignature*
-mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32 token, MonoGenericContext *context, MonoError *error);
MonoMethod *
-mono_get_method_checked (MonoImage *image, guint32 token, MonoClass *klass, MonoGenericContext *context, MonoError *error) MONO_INTERNAL;
+mono_get_method_checked (MonoImage *image, guint32 token, MonoClass *klass, MonoGenericContext *context, MonoError *error);
#endif /* __MONO_METADATA_INTERNALS_H__ */
DataDirectory it = ctx->data_directories [RESOURCE_TABLE_IDX];
guint32 offset;
guint16 named_entries, id_entries;
- const char *ptr, *root, *end;
+ const char *ptr;
if (it.rva == 0)
return;
ADD_ERROR (ctx, g_strdup_printf ("Resource section is too small, must be at least 16 bytes long but it's %d long", it.size));
offset = it.translated_offset;
- root = ptr = ctx->data + offset;
- end = root + it.size;
+ ptr = ctx->data + offset;
g_assert (offset != INVALID_OFFSET);
if (type == &type->data.klass->this_arg)
return type;
break;
+ default:
+ break;
}
return NULL;
/* NET 1.1 assemblies might encode string and object in a denormalized way.
* See #675464.
*/
- if (type_type == MONO_TYPE_CLASS && (class_type == MONO_TYPE_STRING || class_type == MONO_TYPE_OBJECT))
+ if (class_type == type_type)
return TRUE;
- return class_type == type_type;
+
+ if (type_type == MONO_TYPE_CLASS)
+ return class_type == MONO_TYPE_STRING || class_type == MONO_TYPE_OBJECT;
+
+ g_assert (type_type == MONO_TYPE_VALUETYPE);
+ switch (class_type) {
+ case MONO_TYPE_BOOLEAN:
+ case MONO_TYPE_CHAR:
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I8:
+ case MONO_TYPE_U8:
+ case MONO_TYPE_R4:
+ case MONO_TYPE_R8:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ return TRUE;
+ default:
+ return FALSE;
+ }
}
/*
case MONO_TYPE_ARRAY:
mono_metadata_free_array (type->data.array);
break;
+ default:
+ break;
}
g_free (type);
parse_section_data (MonoImage *m, int *num_clauses, const unsigned char *ptr)
{
unsigned char sect_data_flags;
- const unsigned char *sptr;
int is_fat;
guint32 sect_data_len;
MonoExceptionClause* clauses = NULL;
while (1) {
/* align on 32-bit boundary */
- sptr = ptr = dword_align (ptr);
+ ptr = dword_align (ptr);
sect_data_flags = *ptr;
ptr++;
sect_data_len = ptr [0];
++ptr;
}
- /*
- g_print ("flags: %02x, len: %d\n", sect_data_flags, sect_data_len);
- hex_dump (sptr, 0, sect_data_len+8);
- g_print ("\nheader: ");
- hex_dump (sptr-4, 0, 4);
- g_print ("\n");
- */
-
+
if (sect_data_flags & METHOD_HEADER_SECTION_EHTABLE) {
const unsigned char *p = dword_align (ptr);
int i;
guint32 local_var_sig_tok, max_stack, code_size, init_locals;
const unsigned char *code;
MonoExceptionClause* clauses = NULL;
- int hsize, num_clauses = 0;
+ int num_clauses = 0;
MonoTableInfo *t = &m->tables [MONO_TABLE_STANDALONESIG];
guint32 cols [MONO_STAND_ALONE_SIGNATURE_SIZE];
case METHOD_HEADER_FAT_FORMAT:
fat_flags = read16 (ptr);
ptr += 2;
- hsize = (fat_flags >> 12) & 0xf;
max_stack = read16 (ptr);
ptr += 2;
code_size = read32 (ptr);
clauses = parse_section_data (m, &num_clauses, (const unsigned char*)ptr);
if (local_var_sig_tok) {
const char *locals_ptr;
- int len=0, i, bsize;
+ int len=0, i;
locals_ptr = mono_metadata_blob_heap (m, cols [MONO_STAND_ALONE_SIGNATURE]);
- bsize = mono_metadata_decode_blob_size (locals_ptr, &locals_ptr);
+ mono_metadata_decode_blob_size (locals_ptr, &locals_ptr);
if (*locals_ptr != 0x07)
g_warning ("wrong signature for locals blob");
locals_ptr++;
int
mono_type_size (MonoType *t, int *align)
{
+ MonoTypeEnum simple_type;
+
if (!t) {
*align = 1;
return 0;
return sizeof (gpointer);
}
- switch (t->type){
+ simple_type = t->type;
+ again:
+ switch (simple_type) {
case MONO_TYPE_VOID:
*align = 1;
return 0;
}
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
- /* FIXME: Martin, this is wrong. */
- *align = MONO_ABI_ALIGNOF (gpointer);
- return sizeof (gpointer);
+ if (t->data.generic_param->gshared_constraint == 0 || t->data.generic_param->gshared_constraint == MONO_TYPE_VALUETYPE) {
+ *align = MONO_ABI_ALIGNOF (gpointer);
+ return sizeof (gpointer);
+ } else {
+ /* The gparam can only match types given by gshared_constraint */
+ simple_type = t->data.generic_param->gshared_constraint;
+ goto again;
+ }
default:
g_error ("mono_type_size: type 0x%02x unknown", t->type);
}
mono_type_stack_size_internal (MonoType *t, int *align, gboolean allow_open)
{
int tmp;
+ MonoTypeEnum simple_type;
#if SIZEOF_VOID_P == SIZEOF_REGISTER
int stack_slot_size = sizeof (gpointer);
int stack_slot_align = MONO_ABI_ALIGNOF (gpointer);
return stack_slot_size;
}
- switch (t->type){
+ simple_type = t->type;
+ again:
+ switch (simple_type) {
case MONO_TYPE_BOOLEAN:
case MONO_TYPE_CHAR:
case MONO_TYPE_I1:
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
g_assert (allow_open);
- *align = stack_slot_align;
- return stack_slot_size;
+ if (t->data.generic_param->gshared_constraint == 0 || t->data.generic_param->gshared_constraint == MONO_TYPE_VALUETYPE) {
+ *align = stack_slot_align;
+ return stack_slot_size;
+ } else {
+ /* The gparam can only match types given by gshared_constraint */
+ simple_type = t->data.generic_param->gshared_constraint;
+ goto again;
+ }
case MONO_TYPE_TYPEDBYREF:
*align = stack_slot_align;
return stack_slot_size * 3;
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
return ((hash << 5) - hash) ^ mono_metadata_generic_param_hash (t1->data.generic_param);
+ default:
+ return hash;
}
- return hash;
}
static guint
guint hash;
MonoGenericParamInfo *info;
- hash = (mono_generic_param_num (p) << 2) | p->serial;
+ hash = (mono_generic_param_num (p) << 2) | p->gshared_constraint;
info = mono_generic_param_info (p);
/* Can't hash on the owner klass/method, since those might not be set when this is called */
if (info)
return TRUE;
if (mono_generic_param_num (p1) != mono_generic_param_num (p2))
return FALSE;
- if (p1->serial != p2->serial)
+ if (p1->gshared_constraint != p2->gshared_constraint)
return FALSE;
/*
MonoTableInfo *t;
guint32 cols [MONO_TYPESPEC_SIZE];
const char *ptr;
- guint32 len;
MonoType *type, *type2;
mono_error_init (error);
return NULL;
}
- len = mono_metadata_decode_value (ptr, &ptr);
+ mono_metadata_decode_value (ptr, &ptr);
type = mono_metadata_parse_type_internal (image, NULL, MONO_PARSE_TYPE, 0, TRUE, ptr, &ptr);
if (!type) {
} MonoMethodBuilder;
MonoMethodBuilder *
-mono_mb_new (MonoClass *klass, const char *name, MonoWrapperType type) MONO_INTERNAL;
+mono_mb_new (MonoClass *klass, const char *name, MonoWrapperType type);
MonoMethodBuilder *
-mono_mb_new_no_dup_name (MonoClass *klass, const char *name, MonoWrapperType type) MONO_INTERNAL;
+mono_mb_new_no_dup_name (MonoClass *klass, const char *name, MonoWrapperType type);
void
-mono_mb_free (MonoMethodBuilder *mb) MONO_INTERNAL;
+mono_mb_free (MonoMethodBuilder *mb);
MonoMethod *
-mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack) MONO_INTERNAL;
+mono_mb_create_method (MonoMethodBuilder *mb, MonoMethodSignature *signature, int max_stack);
guint32
-mono_mb_add_data (MonoMethodBuilder *mb, gpointer data) MONO_INTERNAL;
+mono_mb_add_data (MonoMethodBuilder *mb, gpointer data);
#ifndef DISABLE_JIT
void
-mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value) MONO_INTERNAL;
+mono_mb_patch_addr (MonoMethodBuilder *mb, int pos, int value);
void
-mono_mb_patch_addr_s (MonoMethodBuilder *mb, int pos, gint8 value) MONO_INTERNAL;
+mono_mb_patch_addr_s (MonoMethodBuilder *mb, int pos, gint8 value);
void
-mono_mb_patch_branch (MonoMethodBuilder *mb, guint32 pos) MONO_INTERNAL;
+mono_mb_patch_branch (MonoMethodBuilder *mb, guint32 pos);
void
-mono_mb_patch_short_branch (MonoMethodBuilder *mb, guint32 pos) MONO_INTERNAL;
+mono_mb_patch_short_branch (MonoMethodBuilder *mb, guint32 pos);
int
-mono_mb_get_label (MonoMethodBuilder *mb) MONO_INTERNAL;
+mono_mb_get_label (MonoMethodBuilder *mb);
int
-mono_mb_get_pos (MonoMethodBuilder *mb) MONO_INTERNAL;
+mono_mb_get_pos (MonoMethodBuilder *mb);
void
-mono_mb_emit_ptr (MonoMethodBuilder *mb, gpointer ptr) MONO_INTERNAL;
+mono_mb_emit_ptr (MonoMethodBuilder *mb, gpointer ptr);
void
-mono_mb_emit_calli (MonoMethodBuilder *mb, MonoMethodSignature *sig) MONO_INTERNAL;
+mono_mb_emit_calli (MonoMethodBuilder *mb, MonoMethodSignature *sig);
void
-mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpointer func) MONO_INTERNAL;
+mono_mb_emit_native_call (MonoMethodBuilder *mb, MonoMethodSignature *sig, gpointer func);
void
-mono_mb_emit_managed_call (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *opt_sig) MONO_INTERNAL;
+mono_mb_emit_managed_call (MonoMethodBuilder *mb, MonoMethod *method, MonoMethodSignature *opt_sig);
void
-mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func) MONO_INTERNAL;
+mono_mb_emit_icall (MonoMethodBuilder *mb, gpointer func);
int
-mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type) MONO_INTERNAL;
+mono_mb_add_local (MonoMethodBuilder *mb, MonoType *type);
void
-mono_mb_emit_ldarg (MonoMethodBuilder *mb, guint argnum) MONO_INTERNAL;
+mono_mb_emit_ldarg (MonoMethodBuilder *mb, guint argnum);
void
-mono_mb_emit_ldarg_addr (MonoMethodBuilder *mb, guint argnum) MONO_INTERNAL;
+mono_mb_emit_ldarg_addr (MonoMethodBuilder *mb, guint argnum);
void
-mono_mb_emit_ldloc (MonoMethodBuilder *mb, guint num) MONO_INTERNAL;
+mono_mb_emit_ldloc (MonoMethodBuilder *mb, guint num);
void
-mono_mb_emit_ldloc_addr (MonoMethodBuilder *mb, guint locnum) MONO_INTERNAL;
+mono_mb_emit_ldloc_addr (MonoMethodBuilder *mb, guint locnum);
void
-mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num) MONO_INTERNAL;
+mono_mb_emit_stloc (MonoMethodBuilder *mb, guint num);
void
-mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg) MONO_INTERNAL;
+mono_mb_emit_exception (MonoMethodBuilder *mb, const char *exc_name, const char *msg);
void
-mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg) MONO_INTERNAL;
+mono_mb_emit_exception_full (MonoMethodBuilder *mb, const char *exc_nspace, const char *exc_name, const char *msg);
void
-mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value) MONO_INTERNAL;
+mono_mb_emit_icon (MonoMethodBuilder *mb, gint32 value);
guint32
-mono_mb_emit_branch (MonoMethodBuilder *mb, guint8 op) MONO_INTERNAL;
+mono_mb_emit_branch (MonoMethodBuilder *mb, guint8 op);
guint32
-mono_mb_emit_short_branch (MonoMethodBuilder *mb, guint8 op) MONO_INTERNAL;
+mono_mb_emit_short_branch (MonoMethodBuilder *mb, guint8 op);
void
-mono_mb_emit_branch_label (MonoMethodBuilder *mb, guint8 op, guint32 label) MONO_INTERNAL;
+mono_mb_emit_branch_label (MonoMethodBuilder *mb, guint8 op, guint32 label);
void
-mono_mb_emit_add_to_local (MonoMethodBuilder *mb, guint16 local, gint32 incr) MONO_INTERNAL;
+mono_mb_emit_add_to_local (MonoMethodBuilder *mb, guint16 local, gint32 incr);
void
-mono_mb_emit_ldflda (MonoMethodBuilder *mb, gint32 offset) MONO_INTERNAL;
+mono_mb_emit_ldflda (MonoMethodBuilder *mb, gint32 offset);
void
-mono_mb_emit_byte (MonoMethodBuilder *mb, guint8 op) MONO_INTERNAL;
+mono_mb_emit_byte (MonoMethodBuilder *mb, guint8 op);
void
-mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data) MONO_INTERNAL;
+mono_mb_emit_i2 (MonoMethodBuilder *mb, gint16 data);
void
-mono_mb_emit_i4 (MonoMethodBuilder *mb, gint32 data) MONO_INTERNAL;
+mono_mb_emit_i4 (MonoMethodBuilder *mb, gint32 data);
void
-mono_mb_emit_op (MonoMethodBuilder *mb, guint8 op, gpointer data) MONO_INTERNAL;
+mono_mb_emit_op (MonoMethodBuilder *mb, guint8 op, gpointer data);
void
-mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str) MONO_INTERNAL;
+mono_mb_emit_ldstr (MonoMethodBuilder *mb, char *str);
void
-mono_mb_set_clauses (MonoMethodBuilder *mb, int num_clauses, MonoExceptionClause *clauses) MONO_INTERNAL;
+mono_mb_set_clauses (MonoMethodBuilder *mb, int num_clauses, MonoExceptionClause *clauses);
void
-mono_mb_set_param_names (MonoMethodBuilder *mb, const char **param_names) MONO_INTERNAL;
+mono_mb_set_param_names (MonoMethodBuilder *mb, const char **param_names);
#endif
MONO_API void mono_locks_dump (gboolean include_untaken);
-void mono_monitor_init (void) MONO_INTERNAL;
-void mono_monitor_cleanup (void) MONO_INTERNAL;
+void mono_monitor_init (void);
+void mono_monitor_cleanup (void);
-void** mono_monitor_get_object_monitor_weak_link (MonoObject *object) MONO_INTERNAL;
+void** mono_monitor_get_object_monitor_weak_link (MonoObject *object);
-void mono_monitor_threads_sync_members_offset (int *status_offset, int *nest_offset) MONO_INTERNAL;
+void mono_monitor_threads_sync_members_offset (int *status_offset, int *nest_offset);
#define MONO_THREADS_SYNC_MEMBER_OFFSET(o) ((o)>>8)
#define MONO_THREADS_SYNC_MEMBER_SIZE(o) ((o)&0xff)
-extern gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj, guint32 ms) MONO_INTERNAL;
-extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj) MONO_INTERNAL;
-extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj) MONO_INTERNAL;
-extern void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj) MONO_INTERNAL;
-extern void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj) MONO_INTERNAL;
-extern gboolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj, guint32 ms) MONO_INTERNAL;
-extern void ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, char *lockTaken) MONO_INTERNAL;
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_try_enter(MonoObject *obj, guint32 ms);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_owner(MonoObject *obj);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_test_synchronised(MonoObject *obj);
+extern void ves_icall_System_Threading_Monitor_Monitor_pulse(MonoObject *obj);
+extern void ves_icall_System_Threading_Monitor_Monitor_pulse_all(MonoObject *obj);
+extern gboolean ves_icall_System_Threading_Monitor_Monitor_wait(MonoObject *obj, guint32 ms);
+extern void ves_icall_System_Threading_Monitor_Monitor_try_enter_with_atomic_var (MonoObject *obj, guint32 ms, char *lockTaken);
G_END_DECLS
};
MonoSimpleBasicBlock*
-mono_basic_block_split (MonoMethod *method, MonoError *error) MONO_INTERNAL;
+mono_basic_block_split (MonoMethod *method, MonoError *error);
void
-mono_basic_block_free (MonoSimpleBasicBlock *bb) MONO_INTERNAL;
+mono_basic_block_free (MonoSimpleBasicBlock *bb);
/*This function is here because opcodes.h is a public header*/
int
-mono_opcode_value_and_size (const unsigned char **ip, const unsigned char *end, int *value) MONO_INTERNAL;
+mono_opcode_value_and_size (const unsigned char **ip, const unsigned char *end, int *value);
int
-mono_opcode_size (const unsigned char *ip, const unsigned char *end) MONO_INTERNAL;
+mono_opcode_size (const unsigned char *ip, const unsigned char *end);
G_END_DECLS
int got_it = 0, i;
char *aname, *cfg, *cfg_name;
const char *bundled_config;
- const char *home;
state.assembly = assembly;
cfg_name = g_strdup_printf ("%s.config", mono_image_get_name (assembly));
- home = g_get_home_dir ();
-
for (i = 0; (aname = get_assembly_filename (assembly, i)) != NULL; ++i) {
cfg = g_build_filename (mono_get_config_dir (), "mono", "assemblies", aname, cfg_name, NULL);
got_it += mono_config_parse_file_with_context (&state, cfg);
g_free (cfg);
#ifdef TARGET_WIN32
+ const char *home = g_get_home_dir ();
cfg = g_build_filename (home, ".mono", "assemblies", aname, cfg_name, NULL);
got_it += mono_config_parse_file_with_context (&state, cfg);
g_free (cfg);
typedef struct _MonoCQ MonoCQ;
-MonoCQ *mono_cq_create (void) MONO_INTERNAL;
-void mono_cq_destroy (MonoCQ *cq) MONO_INTERNAL;
-gint mono_cq_count (MonoCQ *cq) MONO_INTERNAL;
-void mono_cq_enqueue (MonoCQ *cq, MonoObject *obj) MONO_INTERNAL;
-gboolean mono_cq_dequeue (MonoCQ *cq, MonoObject **result) MONO_INTERNAL;
+MonoCQ *mono_cq_create (void);
+void mono_cq_destroy (MonoCQ *cq);
+gint mono_cq_count (MonoCQ *cq);
+void mono_cq_enqueue (MonoCQ *cq, MonoObject *obj);
+gboolean mono_cq_dequeue (MonoCQ *cq, MonoObject **result);
G_END_DECLS
#include <mono/utils/mono-compiler.h>
-void mono_debugger_initialize (void) MONO_INTERNAL;
+void mono_debugger_initialize (void);
-void mono_debugger_lock (void) MONO_INTERNAL;
-void mono_debugger_unlock (void) MONO_INTERNAL;
+void mono_debugger_lock (void);
+void mono_debugger_unlock (void);
gchar *
-mono_debugger_check_runtime_version (const char *filename) MONO_INTERNAL;
+mono_debugger_check_runtime_version (const char *filename);
#endif /* __MONO_DEBUG_DEBUGGER_H__ */
void
mono_debug_domain_create (MonoDomain *domain)
{
- MonoDebugDataTable *table;
-
if (!mono_debug_initialized)
return;
mono_debugger_lock ();
- table = create_data_table (domain);
+ create_data_table (domain);
mono_debugger_unlock ();
}
{
MonoDebugDataTable *table;
MonoDebugMethodAddress *address;
- MonoDebugMethodInfo *minfo;
- MonoDebugHandle *handle;
guint8 buffer [BUFSIZ];
guint8 *ptr, *oldptr;
guint32 i, size, total_size, max_size;
table = lookup_data_table (domain);
- handle = mono_debug_get_image (method->klass->image);
- minfo = mono_debug_lookup_method_internal (method);
-
max_size = (5 * 5) + 1 + (10 * jit->num_line_numbers) +
(25 + sizeof (gpointer)) * (1 + jit->num_params + jit->num_locals);
{
int diff = ABS (hash->last_rehash - hash->in_use);
RehashData data;
- void *old_table;
+ void *old_table G_GNUC_UNUSED; /* unused on Boehm */
/* These are the factors to play with to change the rehashing strategy */
/* I played with them with a large range, and could not really get */
{
SharedInstance* inst;
char *p;
- int size, data_offset;
+ int size;
inst = find_custom_instance (cat, name);
if (inst)
return inst;
size = sizeof (SharedInstance) + strlen (name);
size += 7;
size &= ~7;
- data_offset = size;
size += (sizeof (guint64) * cat->num_counters);
perfctr_lock ();
inst = (SharedInstance*) shared_data_reserve_room (size, FTYPE_INSTANCE);
mono_perfcounter_foreach_shared_item (SharedHeader *header, gpointer data)
{
int i;
- char *p, *name, *help;
+ char *p, *name;
unsigned char type;
- int seq_num;
void *addr;
SharedCategory *cat;
SharedCounter *counter;
for (i = 0; i < cat->num_counters; ++i) {
counter = (SharedCounter*) p;
type = (unsigned char)*p++;
- seq_num = (int)*p++;
+ /* seq_num = (int)* */ p++;
name = p;
p += strlen (p) + 1;
- help = p;
+ /* help = p; */
p += strlen (p) + 1;
inst = custom_get_instance (cat, counter, name);
typedef struct _MonoCounterSample MonoCounterSample;
void* mono_perfcounter_get_impl (MonoString* category, MonoString* counter, MonoString* instance,
- MonoString* machine, int *type, MonoBoolean *custom) MONO_INTERNAL;
+ MonoString* machine, int *type, MonoBoolean *custom);
-MonoBoolean mono_perfcounter_get_sample (void *impl, MonoBoolean only_value, MonoCounterSample *sample) MONO_INTERNAL;
+MonoBoolean mono_perfcounter_get_sample (void *impl, MonoBoolean only_value, MonoCounterSample *sample);
-gint64 mono_perfcounter_update_value (void *impl, MonoBoolean do_incr, gint64 value) MONO_INTERNAL;
-void mono_perfcounter_free_data (void *impl) MONO_INTERNAL;
+gint64 mono_perfcounter_update_value (void *impl, MonoBoolean do_incr, gint64 value);
+void mono_perfcounter_free_data (void *impl);
/* Category icalls */
-MonoBoolean mono_perfcounter_category_del (MonoString *name) MONO_INTERNAL;
-MonoString* mono_perfcounter_category_help (MonoString *category, MonoString *machine) MONO_INTERNAL;
-MonoBoolean mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine) MONO_INTERNAL;
-MonoBoolean mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items) MONO_INTERNAL;
-int mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine) MONO_INTERNAL;
-MonoArray* mono_perfcounter_category_names (MonoString *machine) MONO_INTERNAL;
-MonoArray* mono_perfcounter_counter_names (MonoString *category, MonoString *machine) MONO_INTERNAL;
-MonoArray* mono_perfcounter_instance_names (MonoString *category, MonoString *machine) MONO_INTERNAL;
+MonoBoolean mono_perfcounter_category_del (MonoString *name);
+MonoString* mono_perfcounter_category_help (MonoString *category, MonoString *machine);
+MonoBoolean mono_perfcounter_category_exists (MonoString *counter, MonoString *category, MonoString *machine);
+MonoBoolean mono_perfcounter_create (MonoString *category, MonoString *help, int type, MonoArray *items);
+int mono_perfcounter_instance_exists (MonoString *instance, MonoString *category, MonoString *machine);
+MonoArray* mono_perfcounter_category_names (MonoString *machine);
+MonoArray* mono_perfcounter_counter_names (MonoString *category, MonoString *machine);
+MonoArray* mono_perfcounter_instance_names (MonoString *category, MonoString *machine);
typedef gboolean (*PerfCounterEnumCallback) (char *category_name, char *name, unsigned char type, gint64 value, gpointer user_data);
MONO_API void mono_perfcounter_foreach (PerfCounterEnumCallback cb, gpointer user_data);
#include <mono/metadata/object-internals.h>
-in_addr_t gateway_from_rtm (struct rt_msghdr *rtm) MONO_INTERNAL;
+in_addr_t gateway_from_rtm (struct rt_msghdr *rtm);
/* Category icalls */
-extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list) MONO_INTERNAL;
+extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal (MonoString *iface, MonoArray **gw_addr_list);
#endif /* #if defined(PLATFORM_MACOSX) || defined(PLATFORM_BSD) */
#endif /* __MONO_ROUTE_H__ */
typedef struct _MonoWSQ MonoWSQ;
-void mono_wsq_init (void) MONO_INTERNAL;
-void mono_wsq_cleanup (void) MONO_INTERNAL;
+void mono_wsq_init (void);
+void mono_wsq_cleanup (void);
-MonoWSQ *mono_wsq_create (void) MONO_INTERNAL;
-void mono_wsq_destroy (MonoWSQ *wsq) MONO_INTERNAL;
-gboolean mono_wsq_local_push (void *obj) MONO_INTERNAL;
-gboolean mono_wsq_local_pop (void **ptr) MONO_INTERNAL;
-void mono_wsq_try_steal (MonoWSQ *wsq, void **ptr, guint32 ms_timeout) MONO_INTERNAL;
-gint mono_wsq_count (MonoWSQ *wsq) MONO_INTERNAL;
-gboolean mono_wsq_suspend (MonoWSQ *wsq) MONO_INTERNAL;
+MonoWSQ *mono_wsq_create (void);
+void mono_wsq_destroy (MonoWSQ *wsq);
+gboolean mono_wsq_local_push (void *obj);
+gboolean mono_wsq_local_pop (void **ptr);
+void mono_wsq_try_steal (MonoWSQ *wsq, void **ptr, guint32 ms_timeout);
+gint mono_wsq_count (MonoWSQ *wsq);
+gboolean mono_wsq_suspend (MonoWSQ *wsq);
G_END_DECLS
/* Used to initialize the method pointers inside vtables */
typedef gboolean (*MonoInitVTableFunc) (MonoVTable *vtable);
-MONO_COLD void mono_set_pending_exception (MonoException *exc) MONO_INTERNAL;
+MONO_COLD void mono_set_pending_exception (MonoException *exc);
/* remoting and async support */
MonoAsyncResult *
mono_async_result_new (MonoDomain *domain, HANDLE handle,
- MonoObject *state, gpointer data, MonoObject *object_data) MONO_INTERNAL;
+ MonoObject *state, gpointer data, MonoObject *object_data);
MonoWaitHandle *
-mono_wait_handle_new (MonoDomain *domain, HANDLE handle) MONO_INTERNAL;
+mono_wait_handle_new (MonoDomain *domain, HANDLE handle);
HANDLE
-mono_wait_handle_get_handle (MonoWaitHandle *handle) MONO_INTERNAL;
+mono_wait_handle_get_handle (MonoWaitHandle *handle);
void
mono_message_init (MonoDomain *domain, MonoMethodMessage *this_obj,
- MonoReflectionMethod *method, MonoArray *out_args) MONO_INTERNAL;
+ MonoReflectionMethod *method, MonoArray *out_args);
MonoObject *
mono_message_invoke (MonoObject *target, MonoMethodMessage *msg,
- MonoObject **exc, MonoArray **out_args) MONO_INTERNAL;
+ MonoObject **exc, MonoArray **out_args);
MonoMethodMessage *
mono_method_call_message_new (MonoMethod *method, gpointer *params, MonoMethod *invoke,
- MonoDelegate **cb, MonoObject **state) MONO_INTERNAL;
+ MonoDelegate **cb, MonoObject **state);
void
-mono_method_return_message_restore (MonoMethod *method, gpointer *params, MonoArray *out_args) MONO_INTERNAL;
+mono_method_return_message_restore (MonoMethod *method, gpointer *params, MonoArray *out_args);
void
-mono_delegate_ctor_with_method (MonoObject *this_obj, MonoObject *target, gpointer addr, MonoMethod *method) MONO_INTERNAL;
+mono_delegate_ctor_with_method (MonoObject *this_obj, MonoObject *target, gpointer addr, MonoMethod *method);
void
-mono_delegate_ctor (MonoObject *this_obj, MonoObject *target, gpointer addr) MONO_INTERNAL;
+mono_delegate_ctor (MonoObject *this_obj, MonoObject *target, gpointer addr);
void*
-mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words) MONO_INTERNAL;
+mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *pass_size_in_words);
void
-mono_runtime_free_method (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
+mono_runtime_free_method (MonoDomain *domain, MonoMethod *method);
void
-mono_install_runtime_invoke (MonoInvokeFunc func) MONO_INTERNAL;
+mono_install_runtime_invoke (MonoInvokeFunc func);
void
-mono_install_compile_method (MonoCompileFunc func) MONO_INTERNAL;
+mono_install_compile_method (MonoCompileFunc func);
void
-mono_install_free_method (MonoFreeMethodFunc func) MONO_INTERNAL;
+mono_install_free_method (MonoFreeMethodFunc func);
void
-mono_install_callbacks (MonoRuntimeCallbacks *cbs) MONO_INTERNAL;
+mono_install_callbacks (MonoRuntimeCallbacks *cbs);
MonoRuntimeCallbacks*
-mono_get_runtime_callbacks (void) MONO_INTERNAL;
+mono_get_runtime_callbacks (void);
void
-mono_install_eh_callbacks (MonoRuntimeExceptionHandlingCallbacks *cbs) MONO_INTERNAL;
+mono_install_eh_callbacks (MonoRuntimeExceptionHandlingCallbacks *cbs);
MonoRuntimeExceptionHandlingCallbacks *
-mono_get_eh_callbacks (void) MONO_INTERNAL;
+mono_get_eh_callbacks (void);
void
-mono_raise_exception_with_context (MonoException *ex, MonoContext *ctx) MONO_INTERNAL;
+mono_raise_exception_with_context (MonoException *ex, MonoContext *ctx);
void
-mono_type_initialization_init (void) MONO_INTERNAL;
+mono_type_initialization_init (void);
void
-mono_type_initialization_cleanup (void) MONO_INTERNAL;
+mono_type_initialization_cleanup (void);
int
-mono_thread_kill (MonoInternalThread *thread, int signal) MONO_INTERNAL;
+mono_thread_kill (MonoInternalThread *thread, int signal);
MonoNativeTlsKey
-mono_thread_get_tls_key (void) MONO_INTERNAL;
+mono_thread_get_tls_key (void);
gint32
-mono_thread_get_tls_offset (void) MONO_INTERNAL;
+mono_thread_get_tls_offset (void);
MonoNativeTlsKey
-mono_domain_get_tls_key (void) MONO_INTERNAL;
+mono_domain_get_tls_key (void);
gint32
-mono_domain_get_tls_offset (void) MONO_INTERNAL;
+mono_domain_get_tls_offset (void);
/* Reflection and Reflection.Emit support */
MonoProperty *prop;
} CattrNamedArg;
-void mono_image_create_pefile (MonoReflectionModuleBuilder *module, HANDLE file) MONO_INTERNAL;
-void mono_image_basic_init (MonoReflectionAssemblyBuilder *assembly) MONO_INTERNAL;
-MonoReflectionModule * mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *assembly, MonoString *file_name) MONO_INTERNAL;
-guint32 mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str) MONO_INTERNAL;
-guint32 mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, gboolean create_methodspec, gboolean register_token) MONO_INTERNAL;
-guint32 mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types) MONO_INTERNAL;
-void mono_image_module_basic_init (MonoReflectionModuleBuilder *module) MONO_INTERNAL;
-void mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj) MONO_INTERNAL;
-void mono_dynamic_image_free (MonoDynamicImage *image) MONO_INTERNAL;
-void mono_dynamic_image_free_image (MonoDynamicImage *image) MONO_INTERNAL;
-void mono_image_set_wrappers_type (MonoReflectionModuleBuilder *mb, MonoReflectionType *type) MONO_INTERNAL;
-void mono_dynamic_image_release_gc_roots (MonoDynamicImage *image) MONO_INTERNAL;
+void mono_image_create_pefile (MonoReflectionModuleBuilder *module, HANDLE file);
+void mono_image_basic_init (MonoReflectionAssemblyBuilder *assembly);
+MonoReflectionModule * mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *assembly, MonoString *file_name);
+guint32 mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str);
+guint32 mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, gboolean create_methodspec, gboolean register_token);
+guint32 mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types);
+void mono_image_module_basic_init (MonoReflectionModuleBuilder *module);
+void mono_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObject *obj);
+void mono_dynamic_image_free (MonoDynamicImage *image);
+void mono_dynamic_image_free_image (MonoDynamicImage *image);
+void mono_image_set_wrappers_type (MonoReflectionModuleBuilder *mb, MonoReflectionType *type);
+void mono_dynamic_image_release_gc_roots (MonoDynamicImage *image);
-void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
+void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb);
-void mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
+void mono_reflection_create_internal_class (MonoReflectionTypeBuilder *tb);
-void mono_reflection_setup_generic_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
+void mono_reflection_setup_generic_class (MonoReflectionTypeBuilder *tb);
-void mono_reflection_create_generic_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
+void mono_reflection_create_generic_class (MonoReflectionTypeBuilder *tb);
-MonoReflectionType* mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb) MONO_INTERNAL;
+MonoReflectionType* mono_reflection_create_runtime_class (MonoReflectionTypeBuilder *tb);
-void mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides) MONO_INTERNAL;
+void mono_reflection_get_dynamic_overrides (MonoClass *klass, MonoMethod ***overrides, int *num_overrides);
-void mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *m) MONO_INTERNAL;
-void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod *mb) MONO_INTERNAL;
+void mono_reflection_create_dynamic_method (MonoReflectionDynamicMethod *m);
+void mono_reflection_destroy_dynamic_method (MonoReflectionDynamicMethod *mb);
-void mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam *gparam) MONO_INTERNAL;
-void mono_reflection_create_unmanaged_type (MonoReflectionType *type) MONO_INTERNAL;
-void mono_reflection_register_with_runtime (MonoReflectionType *type) MONO_INTERNAL;
+void mono_reflection_initialize_generic_parameter (MonoReflectionGenericParam *gparam);
+void mono_reflection_create_unmanaged_type (MonoReflectionType *type);
+void mono_reflection_register_with_runtime (MonoReflectionType *type);
-void mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info, MonoError *error) MONO_INTERNAL;
-MonoMethodSignature * mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32 token, MonoError *error) MONO_INTERNAL;
+void mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info, MonoError *error);
+MonoMethodSignature * mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32 token, MonoError *error);
-MonoArray* mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass) MONO_INTERNAL;
+MonoArray* mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass);
MonoClass*
-mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic) MONO_INTERNAL;
+mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic);
MonoType*
-mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_argc, MonoType **types) MONO_INTERNAL;
+mono_reflection_bind_generic_parameters (MonoReflectionType *type, int type_argc, MonoType **types);
MonoReflectionMethod*
-mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *method, MonoArray *types) MONO_INTERNAL;
+mono_reflection_bind_generic_method_parameters (MonoReflectionMethod *method, MonoArray *types);
void
-mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields) MONO_INTERNAL;
+mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields);
MonoReflectionEvent *
-mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb) MONO_INTERNAL;
+mono_reflection_event_builder_get_event_info (MonoReflectionTypeBuilder *tb, MonoReflectionEventBuilder *eb);
-MonoArray *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig) MONO_INTERNAL;
+MonoArray *mono_reflection_sighelper_get_signature_local (MonoReflectionSigHelper *sig);
-MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig) MONO_INTERNAL;
+MonoArray *mono_reflection_sighelper_get_signature_field (MonoReflectionSigHelper *sig);
-MonoReflectionMarshalAsAttribute* mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec) MONO_INTERNAL;
+MonoReflectionMarshalAsAttribute* mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec);
gpointer
-mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context) MONO_INTERNAL;
+mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context);
gboolean
-mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass) MONO_INTERNAL;
+mono_reflection_call_is_assignable_to (MonoClass *klass, MonoClass *oklass);
gboolean
-mono_reflection_is_valid_dynamic_token (MonoDynamicImage *image, guint32 token) MONO_INTERNAL;
+mono_reflection_is_valid_dynamic_token (MonoDynamicImage *image, guint32 token);
void
-mono_reflection_resolve_custom_attribute_data (MonoReflectionMethod *method, MonoReflectionAssembly *assembly, gpointer data, guint32 data_length, MonoArray **ctor_args, MonoArray ** named_args) MONO_INTERNAL;
+mono_reflection_resolve_custom_attribute_data (MonoReflectionMethod *method, MonoReflectionAssembly *assembly, gpointer data, guint32 data_length, MonoArray **ctor_args, MonoArray ** named_args);
MonoType*
-mono_reflection_type_get_handle (MonoReflectionType *ref) MONO_INTERNAL;
+mono_reflection_type_get_handle (MonoReflectionType *ref);
void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass) MONO_INTERNAL;
+mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass);
void
-mono_image_build_metadata (MonoReflectionModuleBuilder *module) MONO_INTERNAL;
+mono_image_build_metadata (MonoReflectionModuleBuilder *module);
int
-mono_get_constant_value_from_blob (MonoDomain* domain, MonoTypeEnum type, const char *blob, void *value) MONO_INTERNAL;
+mono_get_constant_value_from_blob (MonoDomain* domain, MonoTypeEnum type, const char *blob, void *value);
void
-mono_release_type_locks (MonoInternalThread *thread) MONO_INTERNAL;
+mono_release_type_locks (MonoInternalThread *thread);
char *
-mono_string_to_utf8_mp (MonoMemPool *mp, MonoString *s, MonoError *error) MONO_INTERNAL;
+mono_string_to_utf8_mp (MonoMemPool *mp, MonoString *s, MonoError *error);
char *
-mono_string_to_utf8_image (MonoImage *image, MonoString *s, MonoError *error) MONO_INTERNAL;
+mono_string_to_utf8_image (MonoImage *image, MonoString *s, MonoError *error);
MonoArray*
-mono_array_clone_in_domain (MonoDomain *domain, MonoArray *array) MONO_INTERNAL;
+mono_array_clone_in_domain (MonoDomain *domain, MonoArray *array);
void
-mono_array_full_copy (MonoArray *src, MonoArray *dest) MONO_INTERNAL;
+mono_array_full_copy (MonoArray *src, MonoArray *dest);
gboolean
-mono_array_calc_byte_len (MonoClass *klass, uintptr_t len, uintptr_t *res) MONO_INTERNAL;
+mono_array_calc_byte_len (MonoClass *klass, uintptr_t len, uintptr_t *res);
#ifndef DISABLE_REMOTING
MonoObject *
mono_remoting_invoke (MonoObject *real_proxy, MonoMethodMessage *msg,
- MonoObject **exc, MonoArray **out_args) MONO_INTERNAL;
+ MonoObject **exc, MonoArray **out_args);
gpointer
-mono_remote_class_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, MonoRealProxy *real_proxy) MONO_INTERNAL;
+mono_remote_class_vtable (MonoDomain *domain, MonoRemoteClass *remote_class, MonoRealProxy *real_proxy);
void
-mono_upgrade_remote_class (MonoDomain *domain, MonoObject *tproxy, MonoClass *klass) MONO_INTERNAL;
+mono_upgrade_remote_class (MonoDomain *domain, MonoObject *tproxy, MonoClass *klass);
#endif
gpointer
-mono_create_ftnptr (MonoDomain *domain, gpointer addr) MONO_INTERNAL;
+mono_create_ftnptr (MonoDomain *domain, gpointer addr);
gpointer
-mono_get_addr_from_ftnptr (gpointer descr) MONO_INTERNAL;
+mono_get_addr_from_ftnptr (gpointer descr);
void
-mono_nullable_init (guint8 *buf, MonoObject *value, MonoClass *klass) MONO_INTERNAL;
+mono_nullable_init (guint8 *buf, MonoObject *value, MonoClass *klass);
MonoObject*
-mono_nullable_box (guint8 *buf, MonoClass *klass) MONO_INTERNAL;
+mono_nullable_box (guint8 *buf, MonoClass *klass);
#ifdef MONO_SMALL_CONFIG
#define MONO_IMT_SIZE 9
MonoIMTCheckItem **imt_entries, int count, gpointer fail_trunk);
void
-mono_install_imt_thunk_builder (MonoImtThunkBuilder func) MONO_INTERNAL;
+mono_install_imt_thunk_builder (MonoImtThunkBuilder func);
void
-mono_vtable_build_imt_slot (MonoVTable* vtable, int imt_slot) MONO_INTERNAL;
+mono_vtable_build_imt_slot (MonoVTable* vtable, int imt_slot);
guint32
-mono_method_get_imt_slot (MonoMethod *method) MONO_INTERNAL;
+mono_method_get_imt_slot (MonoMethod *method);
void
mono_method_add_generic_virtual_invocation (MonoDomain *domain, MonoVTable *vtable,
gpointer *vtable_slot,
- MonoMethod *method, gpointer code) MONO_INTERNAL;
+ MonoMethod *method, gpointer code);
gpointer
-mono_method_alloc_generic_virtual_thunk (MonoDomain *domain, int size) MONO_INTERNAL;
+mono_method_alloc_generic_virtual_thunk (MonoDomain *domain, int size);
typedef enum {
MONO_UNHANDLED_POLICY_LEGACY,
} MonoRuntimeUnhandledExceptionPolicy;
MonoRuntimeUnhandledExceptionPolicy
-mono_runtime_unhandled_exception_policy_get (void) MONO_INTERNAL;
+mono_runtime_unhandled_exception_policy_get (void);
void
-mono_runtime_unhandled_exception_policy_set (MonoRuntimeUnhandledExceptionPolicy policy) MONO_INTERNAL;
+mono_runtime_unhandled_exception_policy_set (MonoRuntimeUnhandledExceptionPolicy policy);
MonoVTable *
-mono_class_try_get_vtable (MonoDomain *domain, MonoClass *klass) MONO_INTERNAL;
+mono_class_try_get_vtable (MonoDomain *domain, MonoClass *klass);
MonoException *
-mono_runtime_class_init_full (MonoVTable *vtable, gboolean raise_exception) MONO_INTERNAL;
+mono_runtime_class_init_full (MonoVTable *vtable, gboolean raise_exception);
void
-mono_method_clear_object (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
+mono_method_clear_object (MonoDomain *domain, MonoMethod *method);
void
-mono_class_compute_gc_descriptor (MonoClass *klass) MONO_INTERNAL;
+mono_class_compute_gc_descriptor (MonoClass *klass);
gsize*
-mono_class_compute_bitmap (MonoClass *klass, gsize *bitmap, int size, int offset, int *max_set, gboolean static_fields) MONO_INTERNAL;
+mono_class_compute_bitmap (MonoClass *klass, gsize *bitmap, int size, int offset, int *max_set, gboolean static_fields);
MonoObject*
-mono_object_xdomain_representation (MonoObject *obj, MonoDomain *target_domain, MonoObject **exc) MONO_INTERNAL;
+mono_object_xdomain_representation (MonoObject *obj, MonoDomain *target_domain, MonoObject **exc);
gboolean
-mono_class_is_reflection_method_or_constructor (MonoClass *klass) MONO_INTERNAL;
+mono_class_is_reflection_method_or_constructor (MonoClass *klass);
MonoObject *
-mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob) MONO_INTERNAL;
+mono_get_object_from_blob (MonoDomain *domain, MonoType *type, const char *blob);
gpointer
-mono_class_get_ref_info (MonoClass *klass) MONO_INTERNAL;
+mono_class_get_ref_info (MonoClass *klass);
void
-mono_class_set_ref_info (MonoClass *klass, gpointer obj) MONO_INTERNAL;
+mono_class_set_ref_info (MonoClass *klass, gpointer obj);
void
-mono_class_free_ref_info (MonoClass *klass) MONO_INTERNAL;
+mono_class_free_ref_info (MonoClass *klass);
MonoObject *
-mono_object_new_pinned (MonoDomain *domain, MonoClass *klass) MONO_INTERNAL;
+mono_object_new_pinned (MonoDomain *domain, MonoClass *klass);
void
-mono_field_static_get_value_for_thread (MonoInternalThread *thread, MonoVTable *vt, MonoClassField *field, void *value) MONO_INTERNAL;
+mono_field_static_get_value_for_thread (MonoInternalThread *thread, MonoVTable *vt, MonoClassField *field, void *value);
/* exported, used by the debugger */
MONO_API void *
mono_vtable_get_static_field_data (MonoVTable *vt);
char *
-mono_string_to_utf8_ignore (MonoString *s) MONO_INTERNAL;
+mono_string_to_utf8_ignore (MonoString *s);
char *
-mono_string_to_utf8_image_ignore (MonoImage *image, MonoString *s) MONO_INTERNAL;
+mono_string_to_utf8_image_ignore (MonoImage *image, MonoString *s);
char *
-mono_string_to_utf8_mp_ignore (MonoMemPool *mp, MonoString *s) MONO_INTERNAL;
+mono_string_to_utf8_mp_ignore (MonoMemPool *mp, MonoString *s);
gboolean
-mono_monitor_is_il_fastpath_wrapper (MonoMethod *method) MONO_INTERNAL;
+mono_monitor_is_il_fastpath_wrapper (MonoMethod *method);
char *
-mono_exception_get_native_backtrace (MonoException *exc) MONO_INTERNAL;
+mono_exception_get_native_backtrace (MonoException *exc);
MonoString *
-ves_icall_Mono_Runtime_GetNativeStackTrace (MonoException *exc) MONO_INTERNAL;
+ves_icall_Mono_Runtime_GetNativeStackTrace (MonoException *exc);
char *
-mono_exception_get_managed_backtrace (MonoException *exc) MONO_INTERNAL;
+mono_exception_get_managed_backtrace (MonoException *exc);
#endif /* __MONO_OBJECT_INTERNALS_H__ */
size_t imt_table_bytes;
int gc_bits;
guint32 vtable_size, class_size;
- guint32 cindex;
gpointer iter;
gpointer *interface_offsets;
mono_stats.class_static_data_size += class_size;
}
- cindex = -1;
iter = NULL;
while ((field = mono_class_get_fields (class, &iter))) {
if (!(field->type->attrs & FIELD_ATTRIBUTE_STATIC))
return o;
}
+#ifndef HAVE_SGEN_GC
/**
* mono_object_allocate_ptrfree:
* @size: number of bytes to allocate
ALLOC_PTRFREE (o, vtable, size);
return o;
}
+#endif
static inline void *
mono_object_allocate_spec (size_t size, MonoVTable *vtable)
mono_delegate_ctor_with_method (MonoObject *this, MonoObject *target, gpointer addr, MonoMethod *method)
{
MonoDelegate *delegate = (MonoDelegate *)this;
- MonoClass *class;
g_assert (this);
g_assert (addr);
if (method)
delegate->method = method;
- class = this->vtable->klass;
mono_stats.delegate_creations++;
#ifndef DISABLE_REMOTING
MonoDomain *domain = mono_domain_get ();
MonoMethodSignature *sig = mono_method_signature (method);
MonoMethodMessage *msg;
- int i, count, type;
+ int i, count;
msg = (MonoMethodMessage *)mono_object_new (domain, mono_defaults.mono_method_message_class);
else
vpos = params [i];
- type = sig->params [i]->type;
class = mono_class_from_mono_type (sig->params [i]);
if (class->valuetype)
G_BEGIN_DECLS
-HANDLE ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid) MONO_INTERNAL;
-MonoArray *ves_icall_System_Diagnostics_Process_GetProcesses_internal (void) MONO_INTERNAL;
-guint32 ves_icall_System_Diagnostics_Process_GetPid_internal (void) MONO_INTERNAL;
-void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *this_obj, HANDLE process) MONO_INTERNAL;
-MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process) MONO_INTERNAL;
-void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_handle) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoProcessStartInfo *proc_start_info, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoProcInfo *process_handle) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObject *this_obj, HANDLE process, gint32 ms) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_WaitForInputIdle_internal (MonoObject *this_obj, HANDLE process, gint32 ms) MONO_INTERNAL;
-gint64 ves_icall_System_Diagnostics_Process_ExitTime_internal (HANDLE process) MONO_INTERNAL;
-gint64 ves_icall_System_Diagnostics_Process_StartTime_internal (HANDLE process) MONO_INTERNAL;
-gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE process) MONO_INTERNAL;
-MonoString *ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_GetWorkingSet_internal (HANDLE process, guint32 *min, guint32 *max) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_SetWorkingSet_internal (HANDLE process, guint32 min, guint32 max, MonoBoolean use_min) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_Kill_internal (HANDLE process, gint32 sig) MONO_INTERNAL;
-gint64 ves_icall_System_Diagnostics_Process_Times (HANDLE process, gint32 type) MONO_INTERNAL;
-gint32 ves_icall_System_Diagnostics_Process_GetPriorityClass (HANDLE process, gint32 *error) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Diagnostics_Process_SetPriorityClass (HANDLE process, gint32 priority_class, gint32 *error) MONO_INTERNAL;
-gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error) MONO_INTERNAL;
+HANDLE ves_icall_System_Diagnostics_Process_GetProcess_internal (guint32 pid);
+MonoArray *ves_icall_System_Diagnostics_Process_GetProcesses_internal (void);
+guint32 ves_icall_System_Diagnostics_Process_GetPid_internal (void);
+void ves_icall_System_Diagnostics_Process_Process_free_internal (MonoObject *this_obj, HANDLE process);
+MonoArray *ves_icall_System_Diagnostics_Process_GetModules_internal (MonoObject *this_obj, HANDLE process);
+void ves_icall_System_Diagnostics_FileVersionInfo_GetVersionInfo_internal (MonoObject *this_obj, MonoString *filename);
+MonoBoolean ves_icall_System_Diagnostics_Process_ShellExecuteEx_internal (MonoProcessStartInfo *proc_start_info, MonoProcInfo *process_handle);
+MonoBoolean ves_icall_System_Diagnostics_Process_CreateProcess_internal (MonoProcessStartInfo *proc_start_info, HANDLE stdin_handle, HANDLE stdout_handle, HANDLE stderr_handle, MonoProcInfo *process_handle);
+MonoBoolean ves_icall_System_Diagnostics_Process_WaitForExit_internal (MonoObject *this_obj, HANDLE process, gint32 ms);
+MonoBoolean ves_icall_System_Diagnostics_Process_WaitForInputIdle_internal (MonoObject *this_obj, HANDLE process, gint32 ms);
+gint64 ves_icall_System_Diagnostics_Process_ExitTime_internal (HANDLE process);
+gint64 ves_icall_System_Diagnostics_Process_StartTime_internal (HANDLE process);
+gint32 ves_icall_System_Diagnostics_Process_ExitCode_internal (HANDLE process);
+MonoString *ves_icall_System_Diagnostics_Process_ProcessName_internal (HANDLE process);
+MonoBoolean ves_icall_System_Diagnostics_Process_GetWorkingSet_internal (HANDLE process, guint32 *min, guint32 *max);
+MonoBoolean ves_icall_System_Diagnostics_Process_SetWorkingSet_internal (HANDLE process, guint32 min, guint32 max, MonoBoolean use_min);
+MonoBoolean ves_icall_System_Diagnostics_Process_Kill_internal (HANDLE process, gint32 sig);
+gint64 ves_icall_System_Diagnostics_Process_Times (HANDLE process, gint32 type);
+gint32 ves_icall_System_Diagnostics_Process_GetPriorityClass (HANDLE process, gint32 *error);
+MonoBoolean ves_icall_System_Diagnostics_Process_SetPriorityClass (HANDLE process, gint32 priority_class, gint32 *error);
+gint64 ves_icall_System_Diagnostics_Process_GetProcessData (int pid, gint32 data_type, gint32 *error);
HANDLE ves_icall_System_Diagnostics_Process_ProcessHandle_duplicate (HANDLE process);
void ves_icall_System_Diagnostics_Process_ProcessHandle_close (HANDLE process);
} data [1];
} MonoProfileCoverageInfo;
-void mono_profiler_shutdown (void) MONO_INTERNAL;
-
-void mono_profiler_method_enter (MonoMethod *method) MONO_INTERNAL;
-void mono_profiler_method_leave (MonoMethod *method) MONO_INTERNAL;
-void mono_profiler_method_jit (MonoMethod *method) MONO_INTERNAL;
-void mono_profiler_method_end_jit (MonoMethod *method, MonoJitInfo* jinfo, int result) MONO_INTERNAL;
-void mono_profiler_method_free (MonoMethod *method) MONO_INTERNAL;
-void mono_profiler_method_start_invoke (MonoMethod *method) MONO_INTERNAL;
-void mono_profiler_method_end_invoke (MonoMethod *method) MONO_INTERNAL;
-
-void mono_profiler_code_transition (MonoMethod *method, int result) MONO_INTERNAL;
-void mono_profiler_allocation (MonoObject *obj, MonoClass *klass) MONO_INTERNAL;
-void mono_profiler_monitor_event (MonoObject *obj, MonoProfilerMonitorEvent event) MONO_INTERNAL;
-void mono_profiler_stat_hit (guchar *ip, void *context) MONO_INTERNAL;
-void mono_profiler_stat_call_chain (int call_chain_depth, guchar **ips, void *context) MONO_INTERNAL;
-int mono_profiler_stat_get_call_chain_depth (void) MONO_INTERNAL;
-MonoProfilerCallChainStrategy mono_profiler_stat_get_call_chain_strategy (void) MONO_INTERNAL;
-void mono_profiler_thread_start (gsize tid) MONO_INTERNAL;
-void mono_profiler_thread_end (gsize tid) MONO_INTERNAL;
-void mono_profiler_thread_name (gsize tid, const char *name) MONO_INTERNAL;
-
-void mono_profiler_exception_thrown (MonoObject *exception) MONO_INTERNAL;
-void mono_profiler_exception_method_leave (MonoMethod *method) MONO_INTERNAL;
-void mono_profiler_exception_clause_handler (MonoMethod *method, int clause_type, int clause_num) MONO_INTERNAL;
-
-void mono_profiler_assembly_event (MonoAssembly *assembly, int code) MONO_INTERNAL;
-void mono_profiler_assembly_loaded (MonoAssembly *assembly, int result) MONO_INTERNAL;
-
-void mono_profiler_module_event (MonoImage *image, int code) MONO_INTERNAL;
-void mono_profiler_module_loaded (MonoImage *image, int result) MONO_INTERNAL;
-
-void mono_profiler_class_event (MonoClass *klass, int code) MONO_INTERNAL;
-void mono_profiler_class_loaded (MonoClass *klass, int result) MONO_INTERNAL;
-
-void mono_profiler_appdomain_event (MonoDomain *domain, int code) MONO_INTERNAL;
-void mono_profiler_appdomain_loaded (MonoDomain *domain, int result) MONO_INTERNAL;
-
-void mono_profiler_iomap (char *report, const char *pathname, const char *new_pathname) MONO_INTERNAL;
-
-MonoProfileCoverageInfo* mono_profiler_coverage_alloc (MonoMethod *method, int entries) MONO_INTERNAL;
-void mono_profiler_coverage_free (MonoMethod *method) MONO_INTERNAL;
-
-void mono_profiler_gc_event (MonoGCEvent e, int generation) MONO_INTERNAL;
-void mono_profiler_gc_heap_resize (gint64 new_size) MONO_INTERNAL;
-void mono_profiler_gc_moves (void **objects, int num) MONO_INTERNAL;
-void mono_profiler_gc_handle (int op, int type, uintptr_t handle, MonoObject *obj) MONO_INTERNAL;
-void mono_profiler_gc_roots (int num, void **objects, int *root_types, uintptr_t *extra_info) MONO_INTERNAL;
-
-void mono_profiler_code_chunk_new (gpointer chunk, int size) MONO_INTERNAL;
-void mono_profiler_code_chunk_destroy (gpointer chunk) MONO_INTERNAL;
-void mono_profiler_code_buffer_new (gpointer buffer, int size, MonoProfilerCodeBufferType type, gconstpointer data) MONO_INTERNAL;
-
-void mono_profiler_runtime_initialized (void) MONO_INTERNAL;
-
-int64_t mono_profiler_get_sampling_rate (void) MONO_INTERNAL;
-MonoProfileSamplingMode mono_profiler_get_sampling_mode (void) MONO_INTERNAL;
+void mono_profiler_shutdown (void);
+
+void mono_profiler_method_enter (MonoMethod *method);
+void mono_profiler_method_leave (MonoMethod *method);
+void mono_profiler_method_jit (MonoMethod *method);
+void mono_profiler_method_end_jit (MonoMethod *method, MonoJitInfo* jinfo, int result);
+void mono_profiler_method_free (MonoMethod *method);
+void mono_profiler_method_start_invoke (MonoMethod *method);
+void mono_profiler_method_end_invoke (MonoMethod *method);
+
+void mono_profiler_code_transition (MonoMethod *method, int result);
+void mono_profiler_allocation (MonoObject *obj, MonoClass *klass);
+void mono_profiler_monitor_event (MonoObject *obj, MonoProfilerMonitorEvent event);
+void mono_profiler_stat_hit (guchar *ip, void *context);
+void mono_profiler_stat_call_chain (int call_chain_depth, guchar **ips, void *context);
+int mono_profiler_stat_get_call_chain_depth (void);
+MonoProfilerCallChainStrategy mono_profiler_stat_get_call_chain_strategy (void);
+void mono_profiler_thread_start (gsize tid);
+void mono_profiler_thread_end (gsize tid);
+void mono_profiler_thread_name (gsize tid, const char *name);
+
+void mono_profiler_exception_thrown (MonoObject *exception);
+void mono_profiler_exception_method_leave (MonoMethod *method);
+void mono_profiler_exception_clause_handler (MonoMethod *method, int clause_type, int clause_num);
+
+void mono_profiler_assembly_event (MonoAssembly *assembly, int code);
+void mono_profiler_assembly_loaded (MonoAssembly *assembly, int result);
+
+void mono_profiler_module_event (MonoImage *image, int code);
+void mono_profiler_module_loaded (MonoImage *image, int result);
+
+void mono_profiler_class_event (MonoClass *klass, int code);
+void mono_profiler_class_loaded (MonoClass *klass, int result);
+
+void mono_profiler_appdomain_event (MonoDomain *domain, int code);
+void mono_profiler_appdomain_loaded (MonoDomain *domain, int result);
+
+void mono_profiler_iomap (char *report, const char *pathname, const char *new_pathname);
+
+MonoProfileCoverageInfo* mono_profiler_coverage_alloc (MonoMethod *method, int entries);
+void mono_profiler_coverage_free (MonoMethod *method);
+
+void mono_profiler_gc_event (MonoGCEvent e, int generation);
+void mono_profiler_gc_heap_resize (gint64 new_size);
+void mono_profiler_gc_moves (void **objects, int num);
+void mono_profiler_gc_handle (int op, int type, uintptr_t handle, MonoObject *obj);
+void mono_profiler_gc_roots (int num, void **objects, int *root_types, uintptr_t *extra_info);
+
+void mono_profiler_code_chunk_new (gpointer chunk, int size);
+void mono_profiler_code_chunk_destroy (gpointer chunk);
+void mono_profiler_code_buffer_new (gpointer buffer, int size, MonoProfilerCodeBufferType type, gconstpointer data);
+
+void mono_profiler_runtime_initialized (void);
+
+int64_t mono_profiler_get_sampling_rate (void);
+MonoProfileSamplingMode mono_profiler_get_sampling_mode (void);
#endif /* __MONO_PROFILER_PRIVATE_H__ */
#include <mono/metadata/object.h>
#include "mono/utils/mono-compiler.h"
-MonoBoolean ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (void) MONO_INTERNAL;
-gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (MonoArray *seed) MONO_INTERNAL;
-gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry) MONO_INTERNAL;
-void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle) MONO_INTERNAL;
+MonoBoolean ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngOpen (void);
+gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngInitialize (MonoArray *seed);
+gpointer ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngGetBytes (gpointer handle, MonoArray *arry);
+void ves_icall_System_Security_Cryptography_RNGCryptoServiceProvider_RngClose (gpointer handle);
#endif
#include <mono/utils/mono-error.h>
MonoObject*
-mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error) MONO_INTERNAL;
+mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error);
#endif
encode_constant (MonoDynamicImage *assembly, MonoObject *val, guint32 *ret_type) {
char blob_size [64];
char *b = blob_size;
- char *p, *box_val;
+ char *box_val;
char* buf;
guint32 idx = 0, len = 0, dummy = 0;
- p = buf = g_malloc (64);
+ buf = g_malloc (64);
if (!val) {
*ret_type = MONO_TYPE_CLASS;
len = 4;
guint32 token;
MonoClass *klass;
MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
MonoType *type;
char *name;
klass = mono_class_from_mono_type (type);
gclass = type->data.generic_class;
g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
name = mono_string_to_utf8 (fb->name);
token = mono_image_get_memberref_token (assembly, &klass->byval_arg, name,
if (is_sre_ctor_builder (mono_object_class (c->cb))) {
MonoReflectionCtorBuilder *cb = (MonoReflectionCtorBuilder *)c->cb;
- MonoDynamicGenericClass *dgclass;
ReflectionMethodBuilder rmb;
char *name;
gclass = type->data.generic_class;
g_assert (gclass->is_dynamic);
- dgclass = (MonoDynamicGenericClass *) gclass;
reflection_methodbuilder_from_ctor_builder (&rmb, cb);
mono_image_get_generic_field_token (MonoDynamicImage *assembly, MonoReflectionFieldBuilder *fb)
{
MonoDynamicTable *table;
- MonoClass *klass;
MonoType *custom = NULL, *type;
guint32 *values;
guint32 token, pclass, parent, sig;
if (token)
return token;
- klass = mono_class_from_mono_type (mono_reflection_type_get_handle (fb->typeb));
+ /* FIXME: is this call necessary? */
+ mono_class_from_mono_type (mono_reflection_type_get_handle (fb->typeb));
name = mono_string_to_utf8 (fb->name);
/*FIXME this is one more layer of ugliness due how types are created.*/
{
SigBuffer buf;
guint32 nargs;
- guint32 size;
guint32 i, idx;
if (!assembly->save)
else
nargs = 0;
- size = 10 + (nargs * 10);
-
sigbuffer_init (&buf, 32);
/* Encode calling convention */
for (i = 0; i < inst->type_argc; ++i)
if (!verify_safe_for_managed_space (inst->type_argv [i]))
return FALSE;
- break;
+ return TRUE;
}
#endif
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
return TRUE;
+ default:
+ return TRUE;
}
- return TRUE;
}
static MonoType*
MonoClass *klass;
MonoReflectionTypeBuilder *tb = NULL;
gboolean is_dynamic = FALSE;
- MonoDomain *domain;
MonoClass *geninst;
mono_loader_lock ();
- domain = mono_object_domain (type);
-
if (is_sre_type_builder (mono_object_class (type))) {
tb = (MonoReflectionTypeBuilder *) type;
}
return;
}
+ default:
+ break;
}
if (mono_object_class (src) == mono_defaults.stringbuilder_class) {
return MONO_MARSHAL_COPY;
break;
}
+ default:
+ break;
}
-
return MONO_MARSHAL_SERIALIZE;
}
}
return (MonoObject *) acopy;
}
+ default:
+ break;
}
if (mono_object_class (val) == mono_defaults.stringbuilder_class) {
#include <mono/metadata/object-internals.h>
#include <mono/metadata/class-internals.h>
-void mono_remoting_init (void) MONO_INTERNAL;
+void mono_remoting_init (void);
#ifndef DISABLE_REMOTING
MonoMethod *
-mono_marshal_get_remoting_invoke (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_remoting_invoke (MonoMethod *method);
MonoMethod *
-mono_marshal_get_xappdomain_invoke (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_xappdomain_invoke (MonoMethod *method);
MonoMethod *
-mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type) MONO_INTERNAL;
+mono_marshal_get_remoting_invoke_for_target (MonoMethod *method, MonoRemotingTarget target_type);
MonoMethod *
-mono_marshal_get_remoting_invoke_with_check (MonoMethod *method) MONO_INTERNAL;
+mono_marshal_get_remoting_invoke_with_check (MonoMethod *method);
MonoMethod *
-mono_marshal_get_stfld_wrapper (MonoType *type) MONO_INTERNAL;
+mono_marshal_get_stfld_wrapper (MonoType *type);
MonoMethod *
-mono_marshal_get_ldfld_wrapper (MonoType *type) MONO_INTERNAL;
+mono_marshal_get_ldfld_wrapper (MonoType *type);
MonoMethod *
-mono_marshal_get_ldflda_wrapper (MonoType *type) MONO_INTERNAL;
+mono_marshal_get_ldflda_wrapper (MonoType *type);
MonoMethod *
-mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_ldfld_remote_wrapper (MonoClass *klass);
MonoMethod *
-mono_marshal_get_stfld_remote_wrapper (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_stfld_remote_wrapper (MonoClass *klass);
MonoMethod *
-mono_marshal_get_proxy_cancast (MonoClass *klass) MONO_INTERNAL;
+mono_marshal_get_proxy_cancast (MonoClass *klass);
#endif
MONO_BEGIN_DECLS
-gboolean mono_runtime_is_critical_method (MonoMethod *method) MONO_INTERNAL;
-gboolean mono_runtime_try_shutdown (void) MONO_INTERNAL;
+gboolean mono_runtime_is_critical_method (MonoMethod *method);
+gboolean mono_runtime_try_shutdown (void);
-void mono_runtime_init_tls (void) MONO_INTERNAL;
+void mono_runtime_init_tls (void);
MONO_END_DECLS
#endif /* _MONO_METADATA_RUNTIME_H_ */
extern gboolean mono_security_core_clr_test;
-extern void mono_security_core_clr_check_inheritance (MonoClass *klass) MONO_INTERNAL;
-extern void mono_security_core_clr_check_override (MonoClass *klass, MonoMethod *override, MonoMethod *base) MONO_INTERNAL;
+extern void mono_security_core_clr_check_inheritance (MonoClass *klass);
+extern void mono_security_core_clr_check_override (MonoClass *klass, MonoMethod *override, MonoMethod *base);
-extern void mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field) MONO_INTERNAL;
-extern void mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method) MONO_INTERNAL;
-extern gboolean mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, gboolean throwOnBindFailure) MONO_INTERNAL;
-extern MonoException* mono_security_core_clr_ensure_dynamic_method_resolved_object (gpointer ref, MonoClass *handle_class) MONO_INTERNAL;
+extern void mono_security_core_clr_ensure_reflection_access_field (MonoClassField *field);
+extern void mono_security_core_clr_ensure_reflection_access_method (MonoMethod *method);
+extern gboolean mono_security_core_clr_ensure_delegate_creation (MonoMethod *method, gboolean throwOnBindFailure);
+extern MonoException* mono_security_core_clr_ensure_dynamic_method_resolved_object (gpointer ref, MonoClass *handle_class);
-extern gboolean mono_security_core_clr_can_access_internals (MonoImage *accessing, MonoImage* accessed) MONO_INTERNAL;
+extern gboolean mono_security_core_clr_can_access_internals (MonoImage *accessing, MonoImage* accessed);
-extern MonoException* mono_security_core_clr_is_field_access_allowed (MonoMethod *caller, MonoClassField *field) MONO_INTERNAL;
-extern MonoException* mono_security_core_clr_is_call_allowed (MonoMethod *caller, MonoMethod *callee) MONO_INTERNAL;
+extern MonoException* mono_security_core_clr_is_field_access_allowed (MonoMethod *caller, MonoClassField *field);
+extern MonoException* mono_security_core_clr_is_call_allowed (MonoMethod *caller, MonoMethod *callee);
-extern MonoSecurityCoreCLRLevel mono_security_core_clr_class_level (MonoClass *klass) MONO_INTERNAL;
-extern MonoSecurityCoreCLRLevel mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level) MONO_INTERNAL;
+extern MonoSecurityCoreCLRLevel mono_security_core_clr_class_level (MonoClass *klass);
+extern MonoSecurityCoreCLRLevel mono_security_core_clr_method_level (MonoMethod *method, gboolean with_class_level);
-extern gboolean mono_security_core_clr_is_platform_image (MonoImage *image) MONO_INTERNAL;
-extern gboolean mono_security_core_clr_determine_platform_image (MonoImage *image) MONO_INTERNAL;
+extern gboolean mono_security_core_clr_is_platform_image (MonoImage *image);
+extern gboolean mono_security_core_clr_determine_platform_image (MonoImage *image);
extern MONO_API gboolean mono_security_core_clr_require_elevated_permissions (void);
MonoClass *suppressunmanagedcodesecurity; /* System.Security.SuppressUnmanagedCodeSecurityAttribute */
} MonoSecurityManager;
-gboolean mono_is_ecma_key (const char *publickey, int size) MONO_INTERNAL;
-MonoMethod* mono_get_context_capture_method (void) MONO_INTERNAL;
+gboolean mono_is_ecma_key (const char *publickey, int size);
+MonoMethod* mono_get_context_capture_method (void);
-void mono_secman_inheritancedemand_class (MonoClass *klass, MonoClass *parent) MONO_INTERNAL;
-void mono_secman_inheritancedemand_method (MonoMethod *override, MonoMethod *base) MONO_INTERNAL;
+void mono_secman_inheritancedemand_class (MonoClass *klass, MonoClass *parent);
+void mono_secman_inheritancedemand_method (MonoMethod *override, MonoMethod *base);
/* Initialization/utility functions */
-void mono_activate_security_manager (void) MONO_INTERNAL;
-MonoSecurityManager* mono_security_manager_get_methods (void) MONO_INTERNAL;
+void mono_activate_security_manager (void);
+MonoSecurityManager* mono_security_manager_get_methods (void);
/* Security mode */
-gboolean mono_is_security_manager_active (void) MONO_INTERNAL;
-void mono_security_set_mode (MonoSecurityMode mode) MONO_INTERNAL;
-MonoSecurityMode mono_security_get_mode (void) MONO_INTERNAL;
+gboolean mono_is_security_manager_active (void);
+void mono_security_set_mode (MonoSecurityMode mode);
+MonoSecurityMode mono_security_get_mode (void);
/* internal calls */
-MonoBoolean ves_icall_System_Security_SecurityManager_get_SecurityEnabled (void) MONO_INTERNAL;
-void ves_icall_System_Security_SecurityManager_set_SecurityEnabled (MonoBoolean value) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Security_SecurityManager_get_CheckExecutionRights (void) MONO_INTERNAL;
-void ves_icall_System_Security_SecurityManager_set_CheckExecutionRights (MonoBoolean value) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Security_SecurityManager_GetLinkDemandSecurity (MonoReflectionMethod *m, MonoDeclSecurityActions *kactions, MonoDeclSecurityActions *mactions) MONO_INTERNAL;
+MonoBoolean ves_icall_System_Security_SecurityManager_get_SecurityEnabled (void);
+void ves_icall_System_Security_SecurityManager_set_SecurityEnabled (MonoBoolean value);
+MonoBoolean ves_icall_System_Security_SecurityManager_get_CheckExecutionRights (void);
+void ves_icall_System_Security_SecurityManager_set_CheckExecutionRights (MonoBoolean value);
+MonoBoolean ves_icall_System_Security_SecurityManager_GetLinkDemandSecurity (MonoReflectionMethod *m, MonoDeclSecurityActions *kactions, MonoDeclSecurityActions *mactions);
#ifndef DISABLE_SECURITY
#define mono_security_enabled() (mono_is_security_manager_active ())
G_BEGIN_DECLS
/* System.Environment */
-extern MonoString* ves_icall_System_Environment_get_UserName (void) MONO_INTERNAL;
+extern MonoString* ves_icall_System_Environment_get_UserName (void);
/* System.Security.Principal.WindowsIdentity */
-extern MonoArray* ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token) MONO_INTERNAL;
-extern gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void) MONO_INTERNAL;
-extern MonoString* ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token) MONO_INTERNAL;
-extern gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *username) MONO_INTERNAL;
+extern MonoArray* ves_icall_System_Security_Principal_WindowsIdentity_GetRoles (gpointer token);
+extern gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetCurrentToken (void);
+extern MonoString* ves_icall_System_Security_Principal_WindowsIdentity_GetTokenName (gpointer token);
+extern gpointer ves_icall_System_Security_Principal_WindowsIdentity_GetUserToken (MonoString *username);
/* System.Security.Principal.WindowsImpersonationContext */
-extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token) MONO_INTERNAL;
-extern gpointer ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token) MONO_INTERNAL;
-extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token) MONO_INTERNAL;
-extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void) MONO_INTERNAL;
+extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_CloseToken (gpointer token);
+extern gpointer ves_icall_System_Security_Principal_WindowsImpersonationContext_DuplicateToken (gpointer token);
+extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_SetCurrentToken (gpointer token);
+extern gboolean ves_icall_System_Security_Principal_WindowsImpersonationContext_RevertToSelf (void);
/* System.Security.Principal.WindowsPrincipal */
-extern gboolean ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group) MONO_INTERNAL;
-extern gboolean ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group) MONO_INTERNAL;
+extern gboolean ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupId (gpointer user, gpointer group);
+extern gboolean ves_icall_System_Security_Principal_WindowsPrincipal_IsMemberOfGroupName (gpointer user, MonoString *group);
/* Mono.Security.Cryptography.KeyPairPersistance */
-extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root) MONO_INTERNAL;
-extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path) MONO_INTERNAL;
-extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path) MONO_INTERNAL;
-extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path) MONO_INTERNAL;
-extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path) MONO_INTERNAL;
+extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_CanSecure (MonoString *root);
+extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsMachineProtected (MonoString *path);
+extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_IsUserProtected (MonoString *path);
+extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectMachine (MonoString *path);
+extern MonoBoolean ves_icall_Mono_Security_Cryptography_KeyPairPersistence_ProtectUser (MonoString *path);
/* System.Security.Policy.Evidence */
-MonoBoolean ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionAssembly *refass) MONO_INTERNAL;
+MonoBoolean ves_icall_System_Security_Policy_Evidence_IsAuthenticodePresent (MonoReflectionAssembly *refass);
/* System.Security.SecureString */
-extern void ves_icall_System_Security_SecureString_DecryptInternal (MonoArray *data, MonoObject *scope) MONO_INTERNAL;
-extern void ves_icall_System_Security_SecureString_EncryptInternal (MonoArray *data, MonoObject *scope) MONO_INTERNAL;
-void invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gboolean encrypt) MONO_INTERNAL;
+extern void ves_icall_System_Security_SecureString_DecryptInternal (MonoArray *data, MonoObject *scope);
+extern void ves_icall_System_Security_SecureString_EncryptInternal (MonoArray *data, MonoObject *scope);
+void invoke_protected_memory_method (MonoArray *data, MonoObject *scope, gboolean encrypt);
G_END_DECLS
--- /dev/null
+/*
+ * seq-points-data.c: Sequence Points functions
+ *
+ * Authors:
+ * Marcos Henrich (marcos.henrich@xamarin.com)
+ *
+ * Copyright 2015 Xamarin, Inc (http://www.xamarin.com)
+ */
+
+#include "seq-points-data.h"
+
+typedef struct {
+ guint8 *data;
+ int len;
+ /* When has_debug_data is set to false only il and native deltas are saved */
+ gboolean has_debug_data;
+ /* When alloc_data is set to true data allocation/deallocation is managed by this structure */
+ gboolean alloc_data;
+} SeqPointInfoInflated;
+
+static int
+encode_var_int (guint8 *buf, guint8 **out_buf, int val)
+{
+ guint8 size = 0;
+
+ do {
+ guint8 byte = val & 0x7f;
+ g_assert (size < 4 && "value has more than 28 bits");
+ val >>= 7;
+ if(val) byte |= 0x80;
+ *(buf++) = byte;
+ size++;
+ } while (val);
+
+ if (out_buf)
+ *out_buf = buf;
+
+ return size;
+}
+
+static int
+decode_var_int (guint8* buf, guint8 **out_buf)
+{
+ guint8* p = buf;
+
+ int low;
+ int b;
+ b = *(p++); low = (b & 0x7f) ; if(!(b & 0x80)) goto done;
+ b = *(p++); low |= (b & 0x7f) << 7; if(!(b & 0x80)) goto done;
+ b = *(p++); low |= (b & 0x7f) << 14; if(!(b & 0x80)) goto done;
+ b = *(p++); low |= (b & 0x7f) << 21; if(!(b & 0x80)) goto done;
+
+ g_assert (FALSE && "value has more than 28 bits");
+
+done:
+
+ if (out_buf)
+ *out_buf = p;
+
+ return low;
+}
+
+static guint32
+encode_zig_zag (int val)
+{
+ return (val << 1) ^ (val >> 31);
+}
+
+static int
+decode_zig_zag (guint32 val)
+{
+ int n = val;
+ return (n >> 1) ^ (-(n & 1));
+}
+
+static SeqPointInfoInflated
+seq_point_info_inflate (MonoSeqPointInfo *info)
+{
+ SeqPointInfoInflated info_inflated;
+ guint8 *ptr = (guint8*) info;
+ int value;
+
+ value = decode_var_int (ptr, &ptr);
+
+ info_inflated.len = value >> 2;
+ info_inflated.has_debug_data = (value & 1) != 0;
+ info_inflated.alloc_data = (value & 2) != 0;
+
+ if (info_inflated.alloc_data)
+ info_inflated.data = ptr;
+ else
+ memcpy (&info_inflated.data, ptr, sizeof (guint8*));
+
+ return info_inflated;
+}
+
+MonoSeqPointInfo*
+seq_point_info_new (int len, gboolean alloc_data, guint8 *data, gboolean has_debug_data, int *out_size)
+{
+ MonoSeqPointInfo *info;
+ guint8 *info_ptr;
+ guint8 buffer[4];
+ int buffer_len;
+ int value;
+ int data_size;
+
+ value = len << 2;
+ if (has_debug_data)
+ value |= 1;
+ if (alloc_data)
+ value |= 2;
+
+ buffer_len = encode_var_int (buffer, NULL, value);
+
+ *out_size = data_size = buffer_len + (alloc_data? len : sizeof (guint8*));
+ info_ptr = g_new0 (guint8, data_size);
+ info = (MonoSeqPointInfo*) info_ptr;
+
+ memcpy (info_ptr, buffer, buffer_len);
+ info_ptr += buffer_len;
+
+ if (alloc_data)
+ memcpy (info_ptr, data, len);
+ else
+ memcpy (info_ptr, &data, sizeof (guint8*));
+
+ return info;
+}
+
+void
+seq_point_info_free (gpointer ptr)
+{
+ MonoSeqPointInfo* info = (MonoSeqPointInfo*) ptr;
+ g_free (info);
+}
+
+static int
+seq_point_read (SeqPoint* seq_point, guint8* ptr, guint8* buffer_ptr, gboolean has_debug_data)
+{
+ int value, i;
+ guint8* ptr0 = ptr;
+
+ value = decode_var_int (ptr, &ptr);
+ seq_point->il_offset += decode_zig_zag (value);
+
+ value = decode_var_int (ptr, &ptr);
+ seq_point->native_offset += decode_zig_zag (value);
+
+ if (has_debug_data) {
+ value = decode_var_int (ptr, &ptr);
+ seq_point->flags = value;
+
+ if (seq_point->flags & MONO_SEQ_POINT_FLAG_EXIT_IL)
+ seq_point->il_offset = METHOD_EXIT_IL_OFFSET;
+
+ value = decode_var_int (ptr, &ptr);
+ seq_point->next_len = value;
+
+ if (seq_point->next_len) {
+ // store next offset and skip it
+ seq_point->next_offset = ptr - buffer_ptr;
+ for (i = 0; i < seq_point->next_len; ++i)
+ decode_var_int (ptr, &ptr);
+ }
+ }
+
+ return ptr - ptr0;
+}
+
+gboolean
+seq_point_info_add_seq_point (GByteArray* array, SeqPoint *sp, SeqPoint *last_seq_point, GSList *next, gboolean has_debug_data)
+{
+ int il_delta, native_delta;
+ GSList *l;
+ guint8 buffer[4];
+ guint8 len;
+ int flags;
+
+ if (!has_debug_data &&
+ (sp->il_offset == METHOD_ENTRY_IL_OFFSET || sp->il_offset == METHOD_EXIT_IL_OFFSET))
+ return FALSE;
+
+ il_delta = sp->il_offset - last_seq_point->il_offset;
+ native_delta = sp->native_offset - last_seq_point->native_offset;
+
+ flags = sp->flags;
+
+ if (has_debug_data && sp->il_offset == METHOD_EXIT_IL_OFFSET) {
+ il_delta = 0;
+ flags |= MONO_SEQ_POINT_FLAG_EXIT_IL;
+ }
+
+ len = encode_var_int (buffer, NULL, encode_zig_zag (il_delta));
+ g_byte_array_append (array, buffer, len);
+
+ len = encode_var_int (buffer, NULL, encode_zig_zag (native_delta));
+ g_byte_array_append (array, buffer, len);
+
+ if (has_debug_data) {
+ sp->next_offset = array->len;
+ sp->next_len = g_slist_length (next);
+
+ len = encode_var_int (buffer, NULL, flags);
+ g_byte_array_append (array, buffer, len);
+
+ len = encode_var_int (buffer, NULL, sp->next_len);
+ g_byte_array_append (array, buffer, len);
+
+ for (l = next; l; l = l->next) {
+ int next_index = GPOINTER_TO_UINT (l->data);
+ guint8 buffer[4];
+ int len = encode_var_int (buffer, NULL, next_index);
+ g_byte_array_append (array, buffer, len);
+ }
+ }
+
+ return TRUE;
+}
+
+gboolean
+seq_point_find_next_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point)
+{
+ SeqPointIterator it;
+ seq_point_iterator_init (&it, info);
+ while (seq_point_iterator_next (&it)) {
+ if (it.seq_point.native_offset >= native_offset) {
+ memcpy (seq_point, &it.seq_point, sizeof (SeqPoint));
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+gboolean
+seq_point_find_prev_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point)
+{
+ SeqPoint prev_seq_point;
+ gboolean is_first = TRUE;
+ SeqPointIterator it;
+ seq_point_iterator_init (&it, info);
+ while (seq_point_iterator_next (&it) && it.seq_point.native_offset <= native_offset) {
+ memcpy (&prev_seq_point, &it.seq_point, sizeof (SeqPoint));
+ is_first = FALSE;
+ }
+
+ if (!is_first && prev_seq_point.native_offset <= native_offset) {
+ memcpy (seq_point, &prev_seq_point, sizeof (SeqPoint));
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+gboolean
+seq_point_find_by_il_offset (MonoSeqPointInfo* info, int il_offset, SeqPoint* seq_point)
+{
+ SeqPointIterator it;
+ seq_point_iterator_init (&it, info);
+ while (seq_point_iterator_next (&it)) {
+ if (it.seq_point.il_offset == il_offset) {
+ memcpy (seq_point, &it.seq_point, sizeof (SeqPoint));
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+void
+seq_point_init_next (MonoSeqPointInfo* info, SeqPoint sp, SeqPoint* next)
+{
+ int i;
+ guint8* ptr;
+ SeqPointIterator it;
+ GArray* seq_points = g_array_new (FALSE, TRUE, sizeof (SeqPoint));
+ SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
+
+ g_assert (info_inflated.has_debug_data);
+
+ seq_point_iterator_init (&it, info);
+ while (seq_point_iterator_next (&it))
+ g_array_append_vals (seq_points, &it.seq_point, 1);
+
+ ptr = info_inflated.data + sp.next_offset;
+ for (i = 0; i < sp.next_len; i++) {
+ int next_index;
+ next_index = decode_var_int (ptr, &ptr);
+ g_assert (next_index < seq_points->len);
+ memcpy (&next[i], seq_points->data + next_index * sizeof (SeqPoint), sizeof (SeqPoint));
+ }
+
+ g_array_free (seq_points, TRUE);
+}
+
+gboolean
+seq_point_iterator_next (SeqPointIterator* it)
+{
+ if (it->ptr >= it->end)
+ return FALSE;
+
+ it->ptr += seq_point_read (&it->seq_point, it->ptr, it->begin, it->has_debug_data);
+
+ return TRUE;
+}
+
+void
+seq_point_iterator_init (SeqPointIterator* it, MonoSeqPointInfo* info)
+{
+ SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
+ it->ptr = info_inflated.data;
+ it->begin = info_inflated.data;
+ it->end = it->begin + info_inflated.len;
+ it->has_debug_data = info_inflated.has_debug_data;
+ memset(&it->seq_point, 0, sizeof(SeqPoint));
+}
+
+int
+seq_point_info_write (MonoSeqPointInfo* info, guint8* buffer)
+{
+ guint8* buffer0 = buffer;
+ SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
+
+ encode_var_int (buffer, &buffer, info_inflated.has_debug_data);
+
+ //Write sequence points
+ encode_var_int (buffer, &buffer, info_inflated.len);
+ memcpy (buffer, info_inflated.data, info_inflated.len);
+ buffer += info_inflated.len;
+
+ return buffer - buffer0;
+}
+
+int
+seq_point_info_read (MonoSeqPointInfo** info, guint8* buffer, gboolean copy)
+{
+ guint8* buffer0 = buffer;
+ int size, info_size;
+ gboolean has_debug_data;
+
+ has_debug_data = decode_var_int (buffer, &buffer);
+
+ size = decode_var_int (buffer, &buffer);
+ (*info) = seq_point_info_new (size, copy, buffer, has_debug_data, &info_size);
+ buffer += size;
+
+ return buffer - buffer0;
+}
+
+/*
+ * Returns the maximum size of mono_seq_point_info_write.
+ */
+int
+seq_point_info_get_write_size (MonoSeqPointInfo* info)
+{
+ SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
+
+ //4 is the maximum size required to store the size of the data.
+ //1 is the byte used to store has_debug_data.
+ int size = 4 + 1 + info_inflated.len;
+
+ return size;
+}
+
+/*
+ * SeqPointData struct and functions
+ * This is used to store/load/use sequence point from a file
+ */
+
+void
+seq_point_data_init (SeqPointData *data, int entry_capacity)
+{
+ data->entry_count = 0;
+ data->entry_capacity = entry_capacity;
+ data->entries = g_malloc (sizeof (SeqPointDataEntry) * entry_capacity);
+}
+
+void
+seq_point_data_free (SeqPointData *data)
+{
+ int i;
+ for (i=0; i<data->entry_count; i++) {
+ if (data->entries [i].free_seq_points)
+ g_free (data->entries [i].seq_points);
+ }
+ g_free (data->entries);
+}
+
+gboolean
+seq_point_data_read (SeqPointData *data, char *path)
+{
+ guint8 *buffer, *buffer_orig;
+ int entry_count, i;
+ long fsize;
+ FILE *f;
+
+ f = fopen (path, "r");
+ if (!f)
+ return FALSE;
+
+ fseek(f, 0, SEEK_END);
+ fsize = ftell(f);
+ fseek(f, 0, SEEK_SET);
+
+ buffer_orig = buffer = g_malloc(fsize + 1);
+ fread(buffer_orig, fsize, 1, f);
+ fclose(f);
+
+ entry_count = decode_var_int (buffer, &buffer);
+ seq_point_data_init (data, entry_count);
+ data->entry_count = entry_count;
+
+ for (i=0; i<entry_count; i++) {
+ data->entries [i].token = decode_var_int (buffer, &buffer);
+ buffer += seq_point_info_read (&data->entries [i].seq_points, buffer, TRUE);
+ data->entries [i].free_seq_points = TRUE;
+ }
+
+ g_free (buffer_orig);
+ return TRUE;
+}
+
+gboolean
+seq_point_data_write (SeqPointData *data, char *path)
+{
+ guint8 *buffer, *buffer_orig;
+ FILE *f;
+ int i, size = 0;
+
+ f = fopen (path, "w+");
+ if (!f)
+ return FALSE;
+
+ for (i=0; i<data->entry_count; i++) {
+ size += seq_point_info_get_write_size (data->entries [i].seq_points);
+ }
+ // Add size of entry_count and native_base_offsets
+ size += 4 + data->entry_count * 4;
+
+ buffer_orig = buffer = g_malloc (size);
+
+ encode_var_int (buffer, &buffer, data->entry_count);
+
+ for (i=0; i<data->entry_count; i++) {
+ encode_var_int (buffer, &buffer, data->entries [i].token);
+ buffer += seq_point_info_write (data->entries [i].seq_points, buffer);
+ }
+
+ fwrite (buffer_orig, 1, buffer - buffer_orig, f);
+ g_free (buffer_orig);
+
+ return TRUE;
+}
+
+void
+seq_point_data_add (SeqPointData *data, guint32 token, MonoSeqPointInfo* info)
+{
+ int i;
+
+ g_assert (data->entry_count < data->entry_capacity);
+ i = data->entry_count++;
+ data->entries [i].seq_points = info;
+ data->entries [i].token = token;
+ data->entries [i].free_seq_points = FALSE;
+}
+
+gboolean
+seq_point_data_get (SeqPointData *data, guint32 token, MonoSeqPointInfo** info)
+{
+ int i;
+
+ for (i=0; i<data->entry_count; i++) {
+ if (data->entries [i].token == token) {
+ (*info) = data->entries [i].seq_points;
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+gboolean
+seq_point_data_get_il_offset (char *path, guint32 token, guint32 native_offset, guint32 *il_offset)
+{
+ SeqPointData sp_data;
+ MonoSeqPointInfo *seq_points;
+ SeqPoint sp;
+
+ if (!seq_point_data_read (&sp_data, path))
+ return FALSE;
+
+ if (!seq_point_data_get (&sp_data, token, &seq_points))
+ return FALSE;
+
+ if (!seq_point_find_prev_by_native_offset (seq_points, native_offset, &sp))
+ return FALSE;
+
+ *il_offset = sp.il_offset;
+
+ return TRUE;
+}
--- /dev/null
+/*
+ * Copyright 2015 Xamarin Inc
+ */
+
+#ifndef __MONO_SEQ_POINTS_DATA_H__
+#define __MONO_SEQ_POINTS_DATA_H__
+
+#include <glib.h>
+
+#define MONO_SEQ_POINT_FLAG_NONEMPTY_STACK 1
+#define MONO_SEQ_POINT_FLAG_EXIT_IL 2
+
+/* IL offsets used to mark the sequence points belonging to method entry/exit events */
+#define METHOD_ENTRY_IL_OFFSET -1
+#define METHOD_EXIT_IL_OFFSET 0xffffff
+
+#define SEQ_POINT_AOT_EXT ".msym"
+
+/* Native offset used to mark seq points in dead code */
+#define SEQ_POINT_NATIVE_OFFSET_DEAD_CODE -1
+
+typedef struct {
+ int il_offset, native_offset, flags;
+ /* Offset of indexes of successor sequence points on the compressed buffer */
+ int next_offset;
+ /* Number of entries in next */
+ int next_len;
+} SeqPoint;
+
+typedef struct MonoSeqPointInfo {
+ int dummy[0];
+} MonoSeqPointInfo;
+
+typedef struct {
+ SeqPoint seq_point;
+ guint8* ptr;
+ guint8* begin;
+ guint8* end;
+ gboolean has_debug_data;
+} SeqPointIterator;
+
+void
+seq_point_info_free (gpointer info);
+
+gboolean
+seq_point_iterator_next (SeqPointIterator* it);
+
+void
+seq_point_iterator_init (SeqPointIterator* it, MonoSeqPointInfo* info);
+
+void
+seq_point_init_next (MonoSeqPointInfo* info, SeqPoint sp, SeqPoint* next);
+
+int
+seq_point_info_write (MonoSeqPointInfo* info, guint8* buffer);
+
+int
+seq_point_info_read (MonoSeqPointInfo** info, guint8* buffer, gboolean copy);
+
+int
+seq_point_info_get_write_size (MonoSeqPointInfo* info);
+
+gboolean
+seq_point_info_add_seq_point (GByteArray* array, SeqPoint *sp, SeqPoint *last_seq_point, GSList *next, gboolean has_debug_data);
+
+MonoSeqPointInfo*
+seq_point_info_new (int len, gboolean alloc_data, guint8 *data, gboolean has_debug_data, int *out_size);
+
+gboolean
+seq_point_find_prev_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point);
+
+gboolean
+seq_point_find_next_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point);
+
+gboolean
+seq_point_find_by_il_offset (MonoSeqPointInfo* info, int il_offset, SeqPoint* seq_point);
+
+/*
+ * SeqPointData struct and functions
+ * This is used to store/load/use sequence point from a file
+ */
+
+typedef struct {
+ guint32 token;
+ MonoSeqPointInfo* seq_points;
+ gboolean free_seq_points;
+} SeqPointDataEntry;
+
+typedef struct {
+ SeqPointDataEntry* entries;
+ int entry_count;
+ int entry_capacity;
+} SeqPointData;
+
+void
+seq_point_data_init (SeqPointData *data, int entry_capacity);
+
+void
+seq_point_data_free (SeqPointData *data);
+
+gboolean
+seq_point_data_read (SeqPointData *data, char *path);
+
+gboolean
+seq_point_data_write (SeqPointData *data, char *path);
+
+void
+seq_point_data_add (SeqPointData *data, guint32 token, MonoSeqPointInfo* info);
+
+gboolean
+seq_point_data_get (SeqPointData *data, guint32 token, MonoSeqPointInfo** info);
+
+gboolean
+seq_point_data_get_il_offset (char *path, guint32 token, guint32 native_offset, guint32 *il_offset);
+
+#endif /* __MONO_SEQ_POINTS_DATA_H__ */
\ No newline at end of file
void
sgen_bridge_processing_finish (int generation)
{
- unsigned long step_8;
- SGEN_TV_DECLARE (atv);
- SGEN_TV_DECLARE (btv);
-
bridge_processor.processing_build_callback_data (generation);
if (compare_bridge_processors ())
compare_to_bridge_processor.processing_build_callback_data (generation);
if (compare_bridge_processors ())
sgen_compare_bridge_processor_results (&bridge_processor, &compare_to_bridge_processor);
- SGEN_TV_GETTIME (btv);
-
null_weak_links_to_dead_objects (&bridge_processor, generation);
free_callback_data (&bridge_processor);
if (compare_bridge_processors ())
free_callback_data (&compare_to_bridge_processor);
- SGEN_TV_GETTIME (atv);
- step_8 = SGEN_TV_ELAPSED (btv, atv);
-
after_callback:
bridge_processor.processing_after_callback (generation);
if (compare_bridge_processors ())
#define SGEN_CARDTABLE_END (sgen_cardtable + CARD_COUNT_IN_BYTES)
static gboolean
-sgen_card_table_region_begin_scanning (mword start, mword end)
+sgen_card_table_region_begin_scanning (mword start, mword size)
{
+ mword end = start + size;
/*XXX this can be improved to work on words and have a single loop induction var */
- while (start <= end) {
+ while (start < end) {
if (sgen_card_table_card_begin_scanning (start))
return TRUE;
start += CARD_SIZE_IN_BYTES;
#ifndef __MONO_SGEN_CARD_TABLE_INLINES_H__
#define __MONO_SGEN_CARD_TABLE_INLINES_H__
-void sgen_card_table_reset_region (mword start, mword end) MONO_INTERNAL;
-void* sgen_card_table_align_pointer (void *ptr) MONO_INTERNAL;
-void sgen_card_table_mark_range (mword address, mword size) MONO_INTERNAL;
+void sgen_card_table_reset_region (mword start, mword end);
+void* sgen_card_table_align_pointer (void *ptr);
+void sgen_card_table_mark_range (mword address, mword size);
void sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards,
- gboolean mod_union, SgenGrayQueue *queue) MONO_INTERNAL;
+ gboolean mod_union, SgenGrayQueue *queue);
-gboolean sgen_card_table_get_card_data (guint8 *dest, mword address, mword cards) MONO_INTERNAL;
+gboolean sgen_card_table_get_card_data (guint8 *dest, mword address, mword cards);
-guint8* sgen_card_table_update_mod_union_from_cards (guint8 *dest, guint8 *start_card, size_t num_cards) MONO_INTERNAL;
-guint8* sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, size_t *out_num_cards) MONO_INTERNAL;
+guint8* sgen_card_table_update_mod_union_from_cards (guint8 *dest, guint8 *start_card, size_t num_cards);
+guint8* sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, size_t *out_num_cards);
-void sgen_card_table_init (SgenRemeberedSet *remset) MONO_INTERNAL;
+void sgen_card_table_init (SgenRemeberedSet *remset);
/*How many bytes a single card covers*/
#define CARD_BITS 9
#define SGEN_HAVE_OVERLAPPING_CARDS 1
#endif
-extern guint8 *sgen_cardtable MONO_INTERNAL;
+extern guint8 *sgen_cardtable;
#ifdef SGEN_HAVE_OVERLAPPING_CARDS
return sgen_cardtable + ((address >> CARD_BITS) & CARD_MASK);
}
-extern guint8 *sgen_shadow_cardtable MONO_INTERNAL;
+extern guint8 *sgen_shadow_cardtable;
static inline guint8*
sgen_card_table_get_shadow_card_address (mword address)
ROOT_DESC_TYPE_SHIFT = 3,
};
-gsize* sgen_get_complex_descriptor (mword desc) MONO_INTERNAL;
-void* sgen_get_complex_descriptor_bitmap (mword desc) MONO_INTERNAL;
-MonoGCRootMarkFunc sgen_get_user_descriptor_func (mword desc) MONO_INTERNAL;
+gsize* sgen_get_complex_descriptor (mword desc);
+void* sgen_get_complex_descriptor_bitmap (mword desc);
+MonoGCRootMarkFunc sgen_get_user_descriptor_func (mword desc);
-void sgen_init_descriptors (void) MONO_INTERNAL;
+void sgen_init_descriptors (void);
#ifdef HEAVY_STATISTICS
-void sgen_descriptor_count_scanned_object (mword desc) MONO_INTERNAL;
-void sgen_descriptor_count_copied_object (mword desc) MONO_INTERNAL;
+void sgen_descriptor_count_scanned_object (mword desc);
+void sgen_descriptor_count_copied_object (mword desc);
#endif
static inline gboolean
GrayQueue *queue = ctx.queue;
SgenHashTable *hash_table = get_finalize_entry_hash_table (generation);
MonoObject *object;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
char *copy;
SgenPointerQueue moved_fin_objects;
GrayQueue *queue = ctx.queue;
SgenHashTable *hash_table = get_finalize_entry_hash_table (generation);
MonoObject *object;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
SgenPointerQueue moved_fin_objects;
sgen_pointer_queue_init (&moved_fin_objects, INTERNAL_MEM_TEMPORARY);
SgenHashTable *hash_table)
{
MonoObject *object;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
int count;
if (no_finalize || !out_size || !out_array)
CopyOrMarkObjectFunc copy_func = ctx.copy_func;
GrayQueue *queue = ctx.queue;
void **link;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
SgenHashTable *hash = get_dislink_hash_table (generation);
SGEN_HASH_TABLE_FOREACH (hash, link, dummy) {
sgen_null_links_for_domain (MonoDomain *domain, int generation)
{
void **link;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
SgenHashTable *hash = get_dislink_hash_table (generation);
SGEN_HASH_TABLE_FOREACH (hash, link, dummy) {
char *object = DISLINK_OBJECT (link);
sgen_null_links_with_predicate (int generation, WeakLinkAlivePredicateFunc predicate, void *data)
{
void **link;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
SgenHashTable *hash = get_dislink_hash_table (generation);
SGEN_HASH_TABLE_FOREACH (hash, link, dummy) {
char *object = DISLINK_OBJECT (link);
{
SgenHashTable *hash_table = get_finalize_entry_hash_table (generation);
MonoObject *object;
- gpointer dummy;
+ gpointer dummy G_GNUC_UNUSED;
SGEN_HASH_TABLE_FOREACH (hash_table, object, dummy) {
object = tagged_object_get_object (object);
/* If set, do a plausibility check on the scan_starts before and after
each collection */
static gboolean do_scan_starts_check = FALSE;
-/* If set, do not run finalizers. */
-static gboolean do_not_finalize = FALSE;
/*
* If the major collector is concurrent and this is FALSE, we will
* ######################################################################
*/
-inline static void*
-align_pointer (void *ptr)
-{
- mword p = (mword)ptr;
- p += sizeof (gpointer) - 1;
- p &= ~ (sizeof (gpointer) - 1);
- return (void*)p;
-}
-
typedef SgenGrayQueue GrayQueue;
/* forward declarations */
char *end = section->data + section->size;
char *occ_start = NULL;
GCVTable *vt;
- char *old_start = NULL; /* just for debugging */
+ char *old_start G_GNUC_UNUSED = NULL; /* just for debugging */
fprintf (heap_dump_file, "<section type=\"%s\" size=\"%lu\">\n", type, (unsigned long)section->size);
while (start < end) {
guint size;
- MonoClass *class;
+ MonoClass *class G_GNUC_UNUSED;
if (!*(void**)start) {
if (occ_start) {
static void
check_nursery_is_clean (void)
{
- char *start, *end, *cur;
+ char *end, *cur;
- start = cur = sgen_get_nursery_start ();
+ cur = sgen_get_nursery_start ();
end = sgen_get_nursery_end ();
while (cur < end) {
- size_t ss, size;
+ size_t size;
if (!*(void**)cur) {
cur += sizeof (void*);
g_assert (!object_is_forwarded (cur));
g_assert (!object_is_pinned (cur));
- ss = safe_object_get_size ((MonoObject*)cur);
size = ALIGN_UP (safe_object_get_size ((MonoObject*)cur));
verify_scan_starts (cur, cur + size);
count++;
/* the object is on the stack so it is pinned */
/*g_print ("Calling finalizer for object: %p (%s)\n", entry->object, safe_name (entry->object));*/
- if (!do_not_finalize)
- mono_gc_run_finalize (obj, NULL);
+ mono_gc_run_finalize (obj, NULL);
}
g_assert (!entry);
return count;
int dummy;
gboolean debug_print_allowance = FALSE;
double allowance_ratio = 0, save_target = 0;
- gboolean have_split_nursery = FALSE;
gboolean cement_enabled = TRUE;
mono_counters_init ();
sgen_simple_nursery_init (&sgen_minor_collector);
} else if (!strcmp (minor_collector_opt, "split")) {
sgen_split_nursery_init (&sgen_minor_collector);
- have_split_nursery = TRUE;
} else {
sgen_env_var_error (MONO_GC_PARAMS_NAME, "Using `simple` instead.", "Unknown minor collector `%s'.", minor_collector_opt);
goto use_simple_nursery;
enable_nursery_canaries = TRUE;
} else if (!strcmp (opt, "do-not-finalize")) {
do_not_finalize = TRUE;
+ } else if (!strcmp (opt, "log-finalizers")) {
+ log_finalizers = TRUE;
} else if (!sgen_bridge_handle_gc_debug (opt)) {
sgen_env_var_error (MONO_GC_DEBUG_NAME, "Ignoring.", "Unknown option `%s`.", opt);
fprintf (stderr, " binary-protocol=<filename>[:<file-size-limit>]\n");
fprintf (stderr, " nursery-canaries\n");
fprintf (stderr, " do-not-finalize\n");
+ fprintf (stderr, " log-finalizers\n");
sgen_bridge_print_gc_debug_usage ();
fprintf (stderr, "\n");
case GC_BRIDGE_OPAQUE_CLASS:
res = SGEN_GC_BIT_BRIDGE_OPAQUE_OBJECT;
break;
+ case GC_BRIDGE_TRANSPARENT_CLASS:
+ break;
}
}
if (fin_callbacks.is_class_finalization_aware) {
CLEAR_AT_TLAB_CREATION_DEBUG
} NurseryClearPolicy;
-NurseryClearPolicy sgen_get_nursery_clear_policy (void) MONO_INTERNAL;
+NurseryClearPolicy sgen_get_nursery_clear_policy (void);
#define SGEN_TV_DECLARE(name) gint64 name
#define SGEN_TV_GETTIME(tv) tv = mono_100ns_ticks ()
/* good sizes are 512KB-1MB: larger ones increase a lot memzeroing time */
#define DEFAULT_NURSERY_SIZE (sgen_nursery_size)
-extern size_t sgen_nursery_size MONO_INTERNAL;
+extern size_t sgen_nursery_size;
#ifdef SGEN_ALIGN_NURSERY
/* The number of trailing 0 bits in DEFAULT_NURSERY_SIZE */
#define DEFAULT_NURSERY_BITS (sgen_nursery_bits)
-extern int sgen_nursery_bits MONO_INTERNAL;
+extern int sgen_nursery_bits;
#endif
#else
#define DEFAULT_NURSERY_BITS -1
#endif
-extern char *sgen_nursery_start MONO_INTERNAL;
-extern char *sgen_nursery_end MONO_INTERNAL;
+extern char *sgen_nursery_start;
+extern char *sgen_nursery_end;
static inline MONO_ALWAYS_INLINE gboolean
sgen_ptr_in_nursery (void *p)
typedef void (*IterateObjectCallbackFunc) (char*, size_t, void*);
-int sgen_thread_handshake (BOOL suspend) MONO_INTERNAL;
-gboolean sgen_suspend_thread (SgenThreadInfo *info) MONO_INTERNAL;
-gboolean sgen_resume_thread (SgenThreadInfo *info) MONO_INTERNAL;
-void sgen_wait_for_suspend_ack (int count) MONO_INTERNAL;
-void sgen_os_init (void) MONO_INTERNAL;
+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);
+void sgen_os_init (void);
-gboolean sgen_is_worker_thread (MonoNativeThreadId thread) MONO_INTERNAL;
+gboolean sgen_is_worker_thread (MonoNativeThreadId thread);
-void sgen_update_heap_boundaries (mword low, mword high) MONO_INTERNAL;
+void sgen_update_heap_boundaries (mword low, mword high);
-void sgen_scan_area_with_callback (char *start, char *end, IterateObjectCallbackFunc callback, void *data, gboolean allow_flags) MONO_INTERNAL;
-void sgen_check_section_scan_starts (GCMemSection *section) MONO_INTERNAL;
+void sgen_scan_area_with_callback (char *start, char *end, IterateObjectCallbackFunc callback, void *data, gboolean allow_flags);
+void sgen_check_section_scan_starts (GCMemSection *section);
/* Keep in sync with description_for_type() in sgen-internal.c! */
enum {
#define BINARY_PROTOCOL_ARG(x)
#endif
-void sgen_init_internal_allocator (void) MONO_INTERNAL;
+void sgen_init_internal_allocator (void);
typedef struct _ObjectList ObjectList;
struct _ObjectList {
SgenGrayQueue *queue;
} ScanCopyContext;
-void sgen_report_internal_mem_usage (void) MONO_INTERNAL;
-void sgen_dump_internal_mem_usage (FILE *heap_dump_file) MONO_INTERNAL;
-void sgen_dump_section (GCMemSection *section, const char *type) MONO_INTERNAL;
-void sgen_dump_occupied (char *start, char *end, char *section_start) MONO_INTERNAL;
+void sgen_report_internal_mem_usage (void);
+void sgen_dump_internal_mem_usage (FILE *heap_dump_file);
+void sgen_dump_section (GCMemSection *section, const char *type);
+void sgen_dump_occupied (char *start, char *end, char *section_start);
-void sgen_register_moved_object (void *obj, void *destination) MONO_INTERNAL;
+void sgen_register_moved_object (void *obj, void *destination);
-void sgen_register_fixed_internal_mem_type (int type, size_t size) MONO_INTERNAL;
+void sgen_register_fixed_internal_mem_type (int type, size_t size);
-void* sgen_alloc_internal (int type) MONO_INTERNAL;
-void sgen_free_internal (void *addr, int type) MONO_INTERNAL;
+void* sgen_alloc_internal (int type);
+void sgen_free_internal (void *addr, int type);
-void* sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure) MONO_INTERNAL;
-void sgen_free_internal_dynamic (void *addr, size_t size, int type) MONO_INTERNAL;
+void* sgen_alloc_internal_dynamic (size_t size, int type, gboolean assert_on_failure);
+void sgen_free_internal_dynamic (void *addr, size_t size, int type);
void sgen_pin_stats_register_object (char *obj, size_t size);
void sgen_pin_stats_register_global_remset (char *obj);
void sgen_pin_stats_print_class_stats (void);
-void sgen_sort_addresses (void **array, size_t size) MONO_INTERNAL;
-void sgen_add_to_global_remset (gpointer ptr, gpointer obj) MONO_INTERNAL;
+void sgen_sort_addresses (void **array, size_t size);
+void sgen_add_to_global_remset (gpointer ptr, gpointer obj);
-int sgen_get_current_collection_generation (void) MONO_INTERNAL;
-gboolean sgen_collection_is_concurrent (void) MONO_INTERNAL;
-gboolean sgen_concurrent_collection_in_progress (void) MONO_INTERNAL;
+int sgen_get_current_collection_generation (void);
+gboolean sgen_collection_is_concurrent (void);
+gboolean sgen_concurrent_collection_in_progress (void);
typedef struct {
CopyOrMarkObjectFunc copy_or_mark_object;
/*FIXME add allocation function? */
} SgenObjectOperations;
-SgenObjectOperations *sgen_get_current_object_ops (void) MONO_INTERNAL;
+SgenObjectOperations *sgen_get_current_object_ops (void);
typedef struct _SgenFragment SgenFragment;
SgenFragment *region_head; /* List head of the region used by this allocator. Walk with next_in_order. */
} SgenFragmentAllocator;
-void sgen_fragment_allocator_add (SgenFragmentAllocator *allocator, char *start, char *end) MONO_INTERNAL;
-void sgen_fragment_allocator_release (SgenFragmentAllocator *allocator) MONO_INTERNAL;
-void* sgen_fragment_allocator_serial_alloc (SgenFragmentAllocator *allocator, size_t size) MONO_INTERNAL;
-void* sgen_fragment_allocator_par_alloc (SgenFragmentAllocator *allocator, size_t size) MONO_INTERNAL;
-void* sgen_fragment_allocator_serial_range_alloc (SgenFragmentAllocator *allocator, size_t desired_size, size_t minimum_size, size_t *out_alloc_size) MONO_INTERNAL;
-void* sgen_fragment_allocator_par_range_alloc (SgenFragmentAllocator *allocator, size_t desired_size, size_t minimum_size, size_t *out_alloc_size) MONO_INTERNAL;
-SgenFragment* sgen_fragment_allocator_alloc (void) MONO_INTERNAL;
-void sgen_clear_allocator_fragments (SgenFragmentAllocator *allocator) MONO_INTERNAL;
-void sgen_clear_range (char *start, char *end) MONO_INTERNAL;
+void sgen_fragment_allocator_add (SgenFragmentAllocator *allocator, char *start, char *end);
+void sgen_fragment_allocator_release (SgenFragmentAllocator *allocator);
+void* sgen_fragment_allocator_serial_alloc (SgenFragmentAllocator *allocator, size_t size);
+void* sgen_fragment_allocator_par_alloc (SgenFragmentAllocator *allocator, size_t size);
+void* sgen_fragment_allocator_serial_range_alloc (SgenFragmentAllocator *allocator, size_t desired_size, size_t minimum_size, size_t *out_alloc_size);
+void* sgen_fragment_allocator_par_range_alloc (SgenFragmentAllocator *allocator, size_t desired_size, size_t minimum_size, size_t *out_alloc_size);
+SgenFragment* sgen_fragment_allocator_alloc (void);
+void sgen_clear_allocator_fragments (SgenFragmentAllocator *allocator);
+void sgen_clear_range (char *start, char *end);
/*
#define SGEN_TO_SPACE_GRANULE_BITS 9
#define SGEN_TO_SPACE_GRANULE_IN_BYTES (1 << SGEN_TO_SPACE_GRANULE_BITS)
-extern char *sgen_space_bitmap MONO_INTERNAL;
-extern size_t sgen_space_bitmap_size MONO_INTERNAL;
+extern char *sgen_space_bitmap;
+extern size_t sgen_space_bitmap_size;
static inline gboolean
sgen_nursery_is_to_space (char *object)
extern SgenMinorCollector sgen_minor_collector;
-void sgen_simple_nursery_init (SgenMinorCollector *collector) MONO_INTERNAL;
-void sgen_split_nursery_init (SgenMinorCollector *collector) MONO_INTERNAL;
+void sgen_simple_nursery_init (SgenMinorCollector *collector);
+void sgen_split_nursery_init (SgenMinorCollector *collector);
/* Updating references */
/* Major collector */
typedef void (*sgen_cardtable_block_callback) (mword start, mword size);
-void sgen_major_collector_iterate_live_block_ranges (sgen_cardtable_block_callback callback) MONO_INTERNAL;
+void sgen_major_collector_iterate_live_block_ranges (sgen_cardtable_block_callback callback);
typedef enum {
ITERATE_OBJECTS_SWEEP = 1,
extern SgenMajorCollector major_collector;
-void sgen_marksweep_init (SgenMajorCollector *collector) MONO_INTERNAL;
-void sgen_marksweep_fixed_init (SgenMajorCollector *collector) MONO_INTERNAL;
-void sgen_marksweep_par_init (SgenMajorCollector *collector) MONO_INTERNAL;
-void sgen_marksweep_fixed_par_init (SgenMajorCollector *collector) MONO_INTERNAL;
-void sgen_marksweep_conc_init (SgenMajorCollector *collector) MONO_INTERNAL;
-SgenMajorCollector* sgen_get_major_collector (void) MONO_INTERNAL;
+void sgen_marksweep_init (SgenMajorCollector *collector);
+void sgen_marksweep_fixed_init (SgenMajorCollector *collector);
+void sgen_marksweep_par_init (SgenMajorCollector *collector);
+void sgen_marksweep_fixed_par_init (SgenMajorCollector *collector);
+void sgen_marksweep_conc_init (SgenMajorCollector *collector);
+SgenMajorCollector* sgen_get_major_collector (void);
typedef struct _SgenRemeberedSet {
gboolean (*find_address_with_cards) (char *cards_start, guint8 *cards, char *addr);
} SgenRemeberedSet;
-SgenRemeberedSet *sgen_get_remset (void) MONO_INTERNAL;
+SgenRemeberedSet *sgen_get_remset (void);
static mword /*__attribute__((noinline)) not sure if this hint is a good idea*/
slow_object_get_size (MonoVTable *vtable, MonoObject* o)
return slow_object_get_size ((MonoVTable*)SGEN_LOAD_VTABLE (obj), obj);
}
-const char* sgen_safe_name (void* obj) MONO_INTERNAL;
+const char* sgen_safe_name (void* obj);
-gboolean sgen_object_is_live (void *obj) MONO_INTERNAL;
+gboolean sgen_object_is_live (void *obj);
-void sgen_init_fin_weak_hash (void) MONO_INTERNAL;
+void sgen_init_fin_weak_hash (void);
-gboolean sgen_need_bridge_processing (void) MONO_INTERNAL;
-void sgen_bridge_reset_data (void) MONO_INTERNAL;
-void sgen_bridge_processing_stw_step (void) MONO_INTERNAL;
-void sgen_bridge_processing_finish (int generation) MONO_INTERNAL;
-void sgen_register_test_bridge_callbacks (const char *bridge_class_name) MONO_INTERNAL;
-gboolean sgen_is_bridge_object (MonoObject *obj) MONO_INTERNAL;
-MonoGCBridgeObjectKind sgen_bridge_class_kind (MonoClass *klass) MONO_INTERNAL;
-void sgen_mark_bridge_object (MonoObject *obj) MONO_INTERNAL;
-void sgen_bridge_register_finalized_object (MonoObject *object) MONO_INTERNAL;
-void sgen_bridge_describe_pointer (MonoObject *object) MONO_INTERNAL;
+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);
+void sgen_register_test_bridge_callbacks (const char *bridge_class_name);
+gboolean sgen_is_bridge_object (MonoObject *obj);
+MonoGCBridgeObjectKind sgen_bridge_class_kind (MonoClass *klass);
+void sgen_mark_bridge_object (MonoObject *obj);
+void sgen_bridge_register_finalized_object (MonoObject *object);
+void sgen_bridge_describe_pointer (MonoObject *object);
-void sgen_mark_togglerefs (char *start, char *end, ScanCopyContext ctx) MONO_INTERNAL;
-void sgen_clear_togglerefs (char *start, char *end, ScanCopyContext ctx) MONO_INTERNAL;
+void sgen_mark_togglerefs (char *start, char *end, ScanCopyContext ctx);
+void sgen_clear_togglerefs (char *start, char *end, ScanCopyContext ctx);
-void sgen_process_togglerefs (void) MONO_INTERNAL;
-void sgen_register_test_toggleref_callback (void) MONO_INTERNAL;
+void sgen_process_togglerefs (void);
+void sgen_register_test_toggleref_callback (void);
-gboolean sgen_is_bridge_object (MonoObject *obj) MONO_INTERNAL;
-void sgen_mark_bridge_object (MonoObject *obj) MONO_INTERNAL;
+gboolean sgen_is_bridge_object (MonoObject *obj);
+void sgen_mark_bridge_object (MonoObject *obj);
-gboolean sgen_bridge_handle_gc_debug (const char *opt) MONO_INTERNAL;
-void sgen_bridge_print_gc_debug_usage (void) MONO_INTERNAL;
+gboolean sgen_bridge_handle_gc_debug (const char *opt);
+void sgen_bridge_print_gc_debug_usage (void);
typedef struct {
void (*reset_data) (void);
MonoGCBridgeXRef *api_xrefs;
} SgenBridgeProcessor;
-void sgen_old_bridge_init (SgenBridgeProcessor *collector) MONO_INTERNAL;
-void sgen_new_bridge_init (SgenBridgeProcessor *collector) MONO_INTERNAL;
-void sgen_tarjan_bridge_init (SgenBridgeProcessor *collector) MONO_INTERNAL;
-void sgen_set_bridge_implementation (const char *name) MONO_INTERNAL;
-void sgen_bridge_set_dump_prefix (const char *prefix) MONO_INTERNAL;
+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);
-gboolean sgen_compare_bridge_processor_results (SgenBridgeProcessor *a, SgenBridgeProcessor *b) MONO_INTERNAL;
+gboolean sgen_compare_bridge_processor_results (SgenBridgeProcessor *a, SgenBridgeProcessor *b);
typedef mono_bool (*WeakLinkAlivePredicateFunc) (MonoObject*, void*);
-void sgen_null_links_with_predicate (int generation, WeakLinkAlivePredicateFunc predicate, void *data) MONO_INTERNAL;
+void sgen_null_links_with_predicate (int generation, WeakLinkAlivePredicateFunc predicate, void *data);
-gboolean sgen_gc_is_object_ready_for_finalization (void *object) MONO_INTERNAL;
-void sgen_gc_lock (void) MONO_INTERNAL;
-void sgen_gc_unlock (void) MONO_INTERNAL;
-void sgen_gc_event_moves (void) MONO_INTERNAL;
+gboolean sgen_gc_is_object_ready_for_finalization (void *object);
+void sgen_gc_lock (void);
+void sgen_gc_unlock (void);
+void sgen_gc_event_moves (void);
-void sgen_queue_finalization_entry (MonoObject *obj) MONO_INTERNAL;
-const char* sgen_generation_name (int generation) MONO_INTERNAL;
+void sgen_queue_finalization_entry (MonoObject *obj);
+const char* sgen_generation_name (int generation);
-void sgen_collect_bridge_objects (int generation, ScanCopyContext ctx) MONO_INTERNAL;
-void sgen_finalize_in_range (int generation, ScanCopyContext ctx) MONO_INTERNAL;
-void sgen_null_link_in_range (int generation, gboolean before_finalization, ScanCopyContext ctx) MONO_INTERNAL;
-void sgen_null_links_for_domain (MonoDomain *domain, int generation) MONO_INTERNAL;
-void sgen_remove_finalizers_for_domain (MonoDomain *domain, int generation) MONO_INTERNAL;
-void sgen_process_fin_stage_entries (void) MONO_INTERNAL;
-void sgen_process_dislink_stage_entries (void) MONO_INTERNAL;
-void sgen_register_disappearing_link (MonoObject *obj, void **link, gboolean track, gboolean in_gc) MONO_INTERNAL;
+void sgen_collect_bridge_objects (int generation, ScanCopyContext ctx);
+void sgen_finalize_in_range (int generation, ScanCopyContext ctx);
+void sgen_null_link_in_range (int generation, gboolean before_finalization, ScanCopyContext ctx);
+void sgen_null_links_for_domain (MonoDomain *domain, int generation);
+void sgen_remove_finalizers_for_domain (MonoDomain *domain, int generation);
+void sgen_process_fin_stage_entries (void);
+void sgen_process_dislink_stage_entries (void);
+void sgen_register_disappearing_link (MonoObject *obj, void **link, gboolean track, gboolean in_gc);
-gboolean sgen_drain_gray_stack (int max_objs, ScanCopyContext ctx) MONO_INTERNAL;
+gboolean sgen_drain_gray_stack (int max_objs, ScanCopyContext ctx);
enum {
SPACE_NURSERY,
SPACE_LOS
};
-void sgen_pin_object (void *object, SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_parallel_pin_or_update (void **ptr, void *obj, MonoVTable *vt, SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_set_pinned_from_failed_allocation (mword objsize) MONO_INTERNAL;
+void sgen_pin_object (void *object, SgenGrayQueue *queue);
+void sgen_parallel_pin_or_update (void **ptr, void *obj, MonoVTable *vt, SgenGrayQueue *queue);
+void sgen_set_pinned_from_failed_allocation (mword objsize);
-void sgen_ensure_free_space (size_t size) MONO_INTERNAL;
-void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish) MONO_INTERNAL;
-gboolean sgen_has_critical_method (void) MONO_INTERNAL;
-gboolean sgen_is_critical_method (MonoMethod *method) MONO_INTERNAL;
+void sgen_ensure_free_space (size_t size);
+void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish);
+gboolean sgen_has_critical_method (void);
+gboolean sgen_is_critical_method (MonoMethod *method);
/* STW */
SGEN_TV_DECLARE (bridge_time);
} GGTimingInfo;
-int sgen_stop_world (int generation) MONO_INTERNAL;
-int sgen_restart_world (int generation, GGTimingInfo *timing) MONO_INTERNAL;
-void sgen_init_stw (void) MONO_INTERNAL;
+int sgen_stop_world (int generation);
+int sgen_restart_world (int generation, GGTimingInfo *timing);
+void sgen_init_stw (void);
/* LOS */
extern LOSObject *los_object_list;
extern mword los_memory_usage;
-void sgen_los_free_object (LOSObject *obj) MONO_INTERNAL;
-void* sgen_los_alloc_large_inner (MonoVTable *vtable, size_t size) MONO_INTERNAL;
-void sgen_los_sweep (void) MONO_INTERNAL;
-gboolean sgen_ptr_is_in_los (char *ptr, char **start) MONO_INTERNAL;
-void sgen_los_iterate_objects (IterateObjectCallbackFunc cb, void *user_data) MONO_INTERNAL;
-void sgen_los_iterate_live_block_ranges (sgen_cardtable_block_callback callback) MONO_INTERNAL;
-void sgen_los_scan_card_table (gboolean mod_union, SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_los_update_cardtable_mod_union (void) MONO_INTERNAL;
-void sgen_los_count_cards (long long *num_total_cards, long long *num_marked_cards) MONO_INTERNAL;
-void sgen_major_collector_scan_card_table (SgenGrayQueue *queue) MONO_INTERNAL;
-gboolean sgen_los_is_valid_object (char *object) MONO_INTERNAL;
-gboolean mono_sgen_los_describe_pointer (char *ptr) MONO_INTERNAL;
-LOSObject* sgen_los_header_for_object (char *data) MONO_INTERNAL;
-mword sgen_los_object_size (LOSObject *obj) MONO_INTERNAL;
-void sgen_los_pin_object (char *obj) MONO_INTERNAL;
-void sgen_los_unpin_object (char *obj) MONO_INTERNAL;
-gboolean sgen_los_object_is_pinned (char *obj) MONO_INTERNAL;
+void sgen_los_free_object (LOSObject *obj);
+void* sgen_los_alloc_large_inner (MonoVTable *vtable, size_t size);
+void sgen_los_sweep (void);
+gboolean sgen_ptr_is_in_los (char *ptr, char **start);
+void sgen_los_iterate_objects (IterateObjectCallbackFunc cb, void *user_data);
+void sgen_los_iterate_live_block_ranges (sgen_cardtable_block_callback callback);
+void sgen_los_scan_card_table (gboolean mod_union, SgenGrayQueue *queue);
+void sgen_los_update_cardtable_mod_union (void);
+void sgen_los_count_cards (long long *num_total_cards, long long *num_marked_cards);
+void sgen_major_collector_scan_card_table (SgenGrayQueue *queue);
+gboolean sgen_los_is_valid_object (char *object);
+gboolean mono_sgen_los_describe_pointer (char *ptr);
+LOSObject* sgen_los_header_for_object (char *data);
+mword sgen_los_object_size (LOSObject *obj);
+void sgen_los_pin_object (char *obj);
+void sgen_los_unpin_object (char *obj);
+gboolean sgen_los_object_is_pinned (char *obj);
/* nursery allocator */
-void sgen_clear_nursery_fragments (void) MONO_INTERNAL;
-void sgen_nursery_allocator_prepare_for_pinning (void) MONO_INTERNAL;
-void sgen_nursery_allocator_set_nursery_bounds (char *nursery_start, char *nursery_end) MONO_INTERNAL;
-mword sgen_build_nursery_fragments (GCMemSection *nursery_section, SgenGrayQueue *unpin_queue) MONO_INTERNAL;
-void sgen_init_nursery_allocator (void) MONO_INTERNAL;
-void sgen_nursery_allocator_init_heavy_stats (void) MONO_INTERNAL;
-void sgen_alloc_init_heavy_stats (void) MONO_INTERNAL;
-char* sgen_nursery_alloc_get_upper_alloc_bound (void) MONO_INTERNAL;
-void* sgen_nursery_alloc (size_t size) MONO_INTERNAL;
-void* sgen_nursery_alloc_range (size_t size, size_t min_size, size_t *out_alloc_size) MONO_INTERNAL;
-MonoVTable* sgen_get_array_fill_vtable (void) MONO_INTERNAL;
-gboolean sgen_can_alloc_size (size_t size) MONO_INTERNAL;
-void sgen_nursery_retire_region (void *address, ptrdiff_t size) MONO_INTERNAL;
-
-void sgen_nursery_alloc_prepare_for_minor (void) MONO_INTERNAL;
-void sgen_nursery_alloc_prepare_for_major (void) MONO_INTERNAL;
-
-char* sgen_alloc_for_promotion (char *obj, size_t objsize, gboolean has_references) MONO_INTERNAL;
+void sgen_clear_nursery_fragments (void);
+void sgen_nursery_allocator_prepare_for_pinning (void);
+void sgen_nursery_allocator_set_nursery_bounds (char *nursery_start, char *nursery_end);
+mword sgen_build_nursery_fragments (GCMemSection *nursery_section, SgenGrayQueue *unpin_queue);
+void sgen_init_nursery_allocator (void);
+void sgen_nursery_allocator_init_heavy_stats (void);
+void sgen_alloc_init_heavy_stats (void);
+char* sgen_nursery_alloc_get_upper_alloc_bound (void);
+void* sgen_nursery_alloc (size_t size);
+void* sgen_nursery_alloc_range (size_t size, size_t min_size, size_t *out_alloc_size);
+MonoVTable* sgen_get_array_fill_vtable (void);
+gboolean sgen_can_alloc_size (size_t size);
+void sgen_nursery_retire_region (void *address, ptrdiff_t size);
+
+void sgen_nursery_alloc_prepare_for_minor (void);
+void sgen_nursery_alloc_prepare_for_major (void);
+
+char* sgen_alloc_for_promotion (char *obj, size_t objsize, gboolean has_references);
/* TLS Data */
void sgen_check_mod_union_consistency (void);
void sgen_check_major_refs (void);
void sgen_check_whole_heap (gboolean allow_missing_pinning);
-void sgen_check_whole_heap_stw (void) MONO_INTERNAL;
+void sgen_check_whole_heap_stw (void);
void sgen_check_objref (char *obj);
-void sgen_check_heap_marked (gboolean nursery_must_be_pinned) MONO_INTERNAL;
-void sgen_check_nursery_objects_pinned (gboolean pinned) MONO_INTERNAL;
-void sgen_scan_for_registered_roots_in_domain (MonoDomain *domain, int root_type) MONO_INTERNAL;
-void sgen_check_for_xdomain_refs (void) MONO_INTERNAL;
+void sgen_check_heap_marked (gboolean nursery_must_be_pinned);
+void sgen_check_nursery_objects_pinned (gboolean pinned);
+void sgen_scan_for_registered_roots_in_domain (MonoDomain *domain, int root_type);
+void sgen_check_for_xdomain_refs (void);
-void mono_gc_scan_for_specific_ref (MonoObject *key, gboolean precise) MONO_INTERNAL;
+void mono_gc_scan_for_specific_ref (MonoObject *key, gboolean precise);
/* Write barrier support */
#define MONO_GC_PARAMS_NAME "MONO_GC_PARAMS"
#define MONO_GC_DEBUG_NAME "MONO_GC_DEBUG"
-gboolean sgen_parse_environment_string_extract_number (const char *str, size_t *out) MONO_INTERNAL;
-void sgen_env_var_error (const char *env_var, const char *fallback, const char *description_format, ...) MONO_INTERNAL;
+gboolean sgen_parse_environment_string_extract_number (const char *str, size_t *out);
+void sgen_env_var_error (const char *env_var, const char *fallback, const char *description_format, ...);
/* Utilities */
-void sgen_qsort (void *base, size_t nel, size_t width, int (*compar) (const void*, const void*)) MONO_INTERNAL;
-gint64 sgen_timestamp (void) MONO_INTERNAL;
+void sgen_qsort (void *base, size_t nel, size_t width, int (*compar) (const void*, const void*));
+gint64 sgen_timestamp (void);
/*
* Canary (guard word) support
* - Canary space is not included on checks against SGEN_MAX_SMALL_OBJ_SIZE
*/
-gboolean nursery_canaries_enabled (void) MONO_INTERNAL;
+gboolean nursery_canaries_enabled (void);
#define CANARY_SIZE 8
#define CANARY_STRING "koupepia"
extern guint64 stat_gray_queue_dequeue_slow_path;
#endif
-void sgen_init_gray_queues (void) MONO_INTERNAL;
-
-void sgen_gray_object_enqueue (SgenGrayQueue *queue, char *obj, mword desc) MONO_INTERNAL;
-GrayQueueEntry sgen_gray_object_dequeue (SgenGrayQueue *queue) MONO_INTERNAL;
-GrayQueueSection* sgen_gray_object_dequeue_section (SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_gray_object_enqueue_section (SgenGrayQueue *queue, GrayQueueSection *section) MONO_INTERNAL;
-void sgen_gray_object_queue_trim_free_list (SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_gray_object_queue_init (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func) MONO_INTERNAL;
-void sgen_gray_object_queue_init_invalid (SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_gray_queue_set_alloc_prepare (SgenGrayQueue *queue, GrayQueueAllocPrepareFunc alloc_prepare_func, void *data) MONO_INTERNAL;
+void sgen_init_gray_queues (void);
+
+void sgen_gray_object_enqueue (SgenGrayQueue *queue, char *obj, mword desc);
+GrayQueueEntry sgen_gray_object_dequeue (SgenGrayQueue *queue);
+GrayQueueSection* sgen_gray_object_dequeue_section (SgenGrayQueue *queue);
+void sgen_gray_object_enqueue_section (SgenGrayQueue *queue, GrayQueueSection *section);
+void sgen_gray_object_queue_trim_free_list (SgenGrayQueue *queue);
+void sgen_gray_object_queue_init (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func);
+void sgen_gray_object_queue_init_invalid (SgenGrayQueue *queue);
+void sgen_gray_queue_set_alloc_prepare (SgenGrayQueue *queue, GrayQueueAllocPrepareFunc alloc_prepare_func, void *data);
void sgen_gray_object_queue_init_with_alloc_prepare (SgenGrayQueue *queue, GrayQueueEnqueueCheckFunc enqueue_check_func,
- GrayQueueAllocPrepareFunc func, void *data) MONO_INTERNAL;
-void sgen_gray_object_queue_deinit (SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_gray_object_queue_disable_alloc_prepare (SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_gray_object_alloc_queue_section (SgenGrayQueue *queue) MONO_INTERNAL;
-void sgen_gray_object_free_queue_section (GrayQueueSection *section) MONO_INTERNAL;
+ GrayQueueAllocPrepareFunc func, void *data);
+void sgen_gray_object_queue_deinit (SgenGrayQueue *queue);
+void sgen_gray_object_queue_disable_alloc_prepare (SgenGrayQueue *queue);
+void sgen_gray_object_alloc_queue_section (SgenGrayQueue *queue);
+void sgen_gray_object_free_queue_section (GrayQueueSection *section);
void sgen_section_gray_queue_init (SgenSectionGrayQueue *queue, gboolean locked,
- GrayQueueEnqueueCheckFunc enqueue_check_func) MONO_INTERNAL;
-gboolean sgen_section_gray_queue_is_empty (SgenSectionGrayQueue *queue) MONO_INTERNAL;
-GrayQueueSection* sgen_section_gray_queue_dequeue (SgenSectionGrayQueue *queue) MONO_INTERNAL;
-void sgen_section_gray_queue_enqueue (SgenSectionGrayQueue *queue, GrayQueueSection *section) MONO_INTERNAL;
+ GrayQueueEnqueueCheckFunc enqueue_check_func);
+gboolean sgen_section_gray_queue_is_empty (SgenSectionGrayQueue *queue);
+GrayQueueSection* sgen_section_gray_queue_dequeue (SgenSectionGrayQueue *queue);
+void sgen_section_gray_queue_enqueue (SgenSectionGrayQueue *queue, GrayQueueSection *section);
gboolean sgen_gray_object_fill_prefetch (SgenGrayQueue *queue);
#define SGEN_HASH_TABLE_INIT(table_type,entry_type,data_size,hash_func,equal_func) { (table_type), (entry_type), (data_size), (hash_func), (equal_func), NULL, 0, 0 }
#define SGEN_HASH_TABLE_ENTRY_SIZE(data_size) ((data_size) + sizeof (SgenHashTableEntry*) + sizeof (gpointer))
-gpointer sgen_hash_table_lookup (SgenHashTable *table, gpointer key) MONO_INTERNAL;
-gboolean sgen_hash_table_replace (SgenHashTable *table, gpointer key, gpointer new_value, gpointer old_value) MONO_INTERNAL;
-gboolean sgen_hash_table_set_value (SgenHashTable *table, gpointer key, gpointer new_value, gpointer old_value) MONO_INTERNAL;
-gboolean sgen_hash_table_set_key (SgenHashTable *hash_table, gpointer old_key, gpointer new_key) MONO_INTERNAL;
-gboolean sgen_hash_table_remove (SgenHashTable *table, gpointer key, gpointer data_return) MONO_INTERNAL;
+gpointer sgen_hash_table_lookup (SgenHashTable *table, gpointer key);
+gboolean sgen_hash_table_replace (SgenHashTable *table, gpointer key, gpointer new_value, gpointer old_value);
+gboolean sgen_hash_table_set_value (SgenHashTable *table, gpointer key, gpointer new_value, gpointer old_value);
+gboolean sgen_hash_table_set_key (SgenHashTable *hash_table, gpointer old_key, gpointer new_key);
+gboolean sgen_hash_table_remove (SgenHashTable *table, gpointer key, gpointer data_return);
-void sgen_hash_table_clean (SgenHashTable *table) MONO_INTERNAL;
+void sgen_hash_table_clean (SgenHashTable *table);
-void sgen_init_hash_table (void) MONO_INTERNAL;
+void sgen_init_hash_table (void);
#define sgen_hash_table_num_entries(h) ((h)->num_entries)
#define SGEN_OBJECT_LAYOUT_BITMAP_BITS 16
-void sgen_object_layout_scanned_bitmap (unsigned int bitmap) MONO_INTERNAL;
-void sgen_object_layout_scanned_bitmap_overflow (void) MONO_INTERNAL;
-void sgen_object_layout_scanned_ref_array (void) MONO_INTERNAL;
-void sgen_object_layout_scanned_vtype_array (void) MONO_INTERNAL;
+void sgen_object_layout_scanned_bitmap (unsigned int bitmap);
+void sgen_object_layout_scanned_bitmap_overflow (void);
+void sgen_object_layout_scanned_ref_array (void);
+void sgen_object_layout_scanned_vtype_array (void);
-void sgen_object_layout_dump (FILE *out) MONO_INTERNAL;
+void sgen_object_layout_dump (FILE *out);
#define SGEN_OBJECT_LAYOUT_STATISTICS_DECLARE_BITMAP unsigned int __object_layout_bitmap = 0
#define SGEN_OBJECT_LAYOUT_STATISTICS_MARK_BITMAP(o,p) do { \
LOSObject *obj;
for (obj = los_object_list; obj; obj = obj->next) {
- MonoVTable *vtable;
const char *los_kind;
mword size;
gboolean pinned;
else
los_kind = "los-ptr";
- vtable = (MonoVTable*)SGEN_LOAD_VTABLE (obj->data);
-
if (obj->data == ptr) {
SGEN_LOG (0, "%s (size %d pin %d)\n", los_kind, (int)size, pinned ? 1 : 0);
} else {
#define __MONO_SGEN_MEMORY_GOVERNOR_H__
/* Heap limits */
-void sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance, double min_allowance_ratio, double save_target) MONO_INTERNAL;
-void sgen_memgov_release_space (mword size, int space) MONO_INTERNAL;
-gboolean sgen_memgov_try_alloc_space (mword size, int space) MONO_INTERNAL;
+void sgen_memgov_init (size_t max_heap, size_t soft_limit, gboolean debug_allowance, double min_allowance_ratio, double save_target);
+void sgen_memgov_release_space (mword size, int space);
+gboolean sgen_memgov_try_alloc_space (mword size, int space);
/* GC trigger heuristics */
-void sgen_memgov_minor_collection_start (void) MONO_INTERNAL;
-void sgen_memgov_minor_collection_end (void) MONO_INTERNAL;
+void sgen_memgov_minor_collection_start (void);
+void sgen_memgov_minor_collection_end (void);
-void sgen_memgov_major_collection_start (void) MONO_INTERNAL;
-void sgen_memgov_major_collection_end (void) MONO_INTERNAL;
+void sgen_memgov_major_collection_start (void);
+void sgen_memgov_major_collection_end (void);
-void sgen_memgov_collection_start (int generation) MONO_INTERNAL;
-void sgen_memgov_collection_end (int generation, GGTimingInfo* info, int info_count) MONO_INTERNAL;
+void sgen_memgov_collection_start (int generation);
+void sgen_memgov_collection_end (int generation, GGTimingInfo* info, int info_count);
-void sgen_register_major_sections_alloced (size_t num_sections) MONO_INTERNAL;
-mword sgen_get_minor_collection_allowance (void) MONO_INTERNAL;
-gboolean sgen_need_major_collection (mword space_needed) MONO_INTERNAL;
+void sgen_register_major_sections_alloced (size_t num_sections);
+mword sgen_get_minor_collection_allowance (void);
+gboolean sgen_need_major_collection (mword space_needed);
typedef enum {
} SgenAllocFlags;
/* OS memory allocation */
-void* sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description) MONO_INTERNAL;
-void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description) MONO_INTERNAL;
-void sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags) MONO_INTERNAL;
+void* sgen_alloc_os_memory (size_t size, SgenAllocFlags flags, const char *assert_description);
+void* sgen_alloc_os_memory_aligned (size_t size, mword alignment, SgenAllocFlags flags, const char *assert_description);
+void sgen_free_os_memory (void *addr, size_t size, SgenAllocFlags flags);
/* Error handling */
-void sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_description) MONO_INTERNAL;
+void sgen_assert_memory_alloc (void *ptr, size_t requested_size, const char *assert_description);
#endif
static void
free_data (void)
{
- MonoObject *obj;
+ MonoObject *obj G_GNUC_UNUSED;
HashEntry *entry;
int total_srcs = 0;
int max_srcs = 0;
{
int i;
int bridge_count;
- MonoObject *obj;
+ MonoObject *obj G_GNUC_UNUSED;
HashEntry *entry;
SGEN_TV_DECLARE (atv);
SGEN_TV_DECLARE (btv);
int i, j;
int num_sccs, num_xrefs;
int max_entries, max_xrefs;
- int sccs_size;
- MonoObject *obj;
+ MonoObject *obj G_GNUC_UNUSED;
HashEntry *entry;
HashEntry **all_entries;
MonoGCBridgeSCC **api_sccs;
}
}
- sccs_size = dyn_array_scc_size (&sccs);
-
for (i = 0; i < hash_table.num_entries; ++i) {
HashEntry *entry = all_entries [i];
second_pass_links += dyn_array_ptr_size (&entry->srcs);
#endif
#endif
-char *sgen_space_bitmap MONO_INTERNAL;
-size_t sgen_space_bitmap_size MONO_INTERNAL;
+char *sgen_space_bitmap;
+size_t sgen_space_bitmap_size;
#ifdef HEAVY_STATISTICS
while (pin_entry < pin_end || frags_ranges) {
char *addr0, *addr1;
size_t size;
- SgenFragment *last_frag = NULL;
addr0 = addr1 = sgen_nursery_end;
if (pin_entry < pin_end)
} else {
frag_end = addr1;
size = frags_ranges->fragment_next - addr1;
- last_frag = frags_ranges;
frags_ranges = frags_ranges->next_in_order;
}
static void
free_data (void)
{
- MonoObject *obj;
+ MonoObject *obj G_GNUC_UNUSED;
HashEntry *entry;
int total_srcs = 0;
int max_srcs = 0;
int i, j;
int num_sccs, num_xrefs;
int max_entries, max_xrefs;
- int sccs_size;
- MonoObject *obj;
+ MonoObject *obj G_GNUC_UNUSED;
HashEntry *entry;
HashEntry **all_entries;
MonoGCBridgeSCC **api_sccs;
}
}
- sccs_size = dyn_array_scc_size (&sccs);
-
for (i = 0; i < hash_table.num_entries; ++i) {
HashEntry *entry = all_entries [i];
second_pass_links += dyn_array_ptr_size (&entry->srcs);
{
struct sigaction sinfo;
+ if (mono_thread_info_unified_management_enabled ())
+ return;
+
suspend_ack_semaphore_ptr = &suspend_ack_semaphore;
MONO_SEM_INIT (&suspend_ack_semaphore, 0);
PIN_TYPE_MAX
};
-void sgen_pin_stage_ptr (void *ptr) MONO_INTERNAL;
-void sgen_optimize_pin_queue (void) MONO_INTERNAL;
-void sgen_init_pinning (void) MONO_INTERNAL;
-void sgen_finish_pinning (void) MONO_INTERNAL;
-void sgen_pin_queue_clear_discarded_entries (GCMemSection *section, size_t max_pin_slot) MONO_INTERNAL;
-size_t sgen_get_pinned_count (void) MONO_INTERNAL;
-void sgen_pinning_setup_section (GCMemSection *section) MONO_INTERNAL;
-void sgen_pinning_trim_queue_to_section (GCMemSection *section) MONO_INTERNAL;
+void sgen_pin_stage_ptr (void *ptr);
+void sgen_optimize_pin_queue (void);
+void sgen_init_pinning (void);
+void sgen_finish_pinning (void);
+void sgen_pin_queue_clear_discarded_entries (GCMemSection *section, size_t max_pin_slot);
+size_t sgen_get_pinned_count (void);
+void sgen_pinning_setup_section (GCMemSection *section);
+void sgen_pinning_trim_queue_to_section (GCMemSection *section);
-void sgen_dump_pin_queue (void) MONO_INTERNAL;
+void sgen_dump_pin_queue (void);
-gboolean sgen_find_optimized_pin_queue_area (void *start, void *end, size_t *first_out, size_t *last_out) MONO_INTERNAL;
-void sgen_find_section_pin_queue_start_end (GCMemSection *section) MONO_INTERNAL;
-void** sgen_pinning_get_entry (size_t index) MONO_INTERNAL;
-void sgen_pin_objects_in_section (GCMemSection *section, ScanCopyContext ctx) MONO_INTERNAL;
+gboolean sgen_find_optimized_pin_queue_area (void *start, void *end, size_t *first_out, size_t *last_out);
+void sgen_find_section_pin_queue_start_end (GCMemSection *section);
+void** sgen_pinning_get_entry (size_t index);
+void sgen_pin_objects_in_section (GCMemSection *section, ScanCopyContext ctx);
/* Pinning stats */
-void sgen_pin_stats_register_address (char *addr, int pin_type) MONO_INTERNAL;
-size_t sgen_pin_stats_get_pinned_byte_count (int pin_type) MONO_INTERNAL;
-ObjectList *sgen_pin_stats_get_object_list (void) MONO_INTERNAL;
-void sgen_pin_stats_reset (void) MONO_INTERNAL;
+void sgen_pin_stats_register_address (char *addr, int pin_type);
+size_t sgen_pin_stats_get_pinned_byte_count (int pin_type);
+ObjectList *sgen_pin_stats_get_object_list (void);
+void sgen_pin_stats_reset (void);
/* Perpetual pinning, aka cementing */
-void sgen_cement_init (gboolean enabled) MONO_INTERNAL;
-void sgen_cement_reset (void) MONO_INTERNAL;
-void sgen_cement_concurrent_start (void) MONO_INTERNAL;
-void sgen_cement_concurrent_finish (void) MONO_INTERNAL;
-gboolean sgen_cement_lookup (char *obj) MONO_INTERNAL;
-gboolean sgen_cement_lookup_or_register (char *obj) MONO_INTERNAL;
-void sgen_pin_cemented_objects (void) MONO_INTERNAL;
-void sgen_cement_clear_below_threshold (void) MONO_INTERNAL;
+void sgen_cement_init (gboolean enabled);
+void sgen_cement_reset (void);
+void sgen_cement_concurrent_start (void);
+void sgen_cement_concurrent_finish (void);
+gboolean sgen_cement_lookup (char *obj);
+gboolean sgen_cement_lookup_or_register (char *obj);
+void sgen_pin_cemented_objects (void);
+void sgen_cement_clear_below_threshold (void);
#endif
int mem_type;
} SgenPointerQueue;
-void sgen_pointer_queue_add (SgenPointerQueue *queue, void *ptr) MONO_INTERNAL;
-void sgen_pointer_queue_clear (SgenPointerQueue *queue) MONO_INTERNAL;
-void sgen_pointer_queue_remove_nulls (SgenPointerQueue *queue) MONO_INTERNAL;
-void sgen_pointer_queue_sort_uniq (SgenPointerQueue *queue) MONO_INTERNAL;
-size_t sgen_pointer_queue_search (SgenPointerQueue *queue, void *addr) MONO_INTERNAL;
-size_t sgen_pointer_queue_find (SgenPointerQueue *queue, void *ptr) MONO_INTERNAL;
-void sgen_pointer_queue_init (SgenPointerQueue *queue, int mem_type) MONO_INTERNAL;
-void* sgen_pointer_queue_pop (SgenPointerQueue *queue) MONO_INTERNAL;
-gboolean sgen_pointer_queue_is_empty (SgenPointerQueue *queue) MONO_INTERNAL;
-void sgen_pointer_queue_free (SgenPointerQueue *queue) MONO_INTERNAL;
+void sgen_pointer_queue_add (SgenPointerQueue *queue, void *ptr);
+void sgen_pointer_queue_clear (SgenPointerQueue *queue);
+void sgen_pointer_queue_remove_nulls (SgenPointerQueue *queue);
+void sgen_pointer_queue_sort_uniq (SgenPointerQueue *queue);
+size_t sgen_pointer_queue_search (SgenPointerQueue *queue, void *addr);
+size_t sgen_pointer_queue_find (SgenPointerQueue *queue, void *ptr);
+void sgen_pointer_queue_init (SgenPointerQueue *queue, int mem_type);
+void* sgen_pointer_queue_pop (SgenPointerQueue *queue);
+gboolean sgen_pointer_queue_is_empty (SgenPointerQueue *queue);
+void sgen_pointer_queue_free (SgenPointerQueue *queue);
#endif
/* missing: finalizers, roots, non-store wbarriers */
-void binary_protocol_init (const char *filename, long long limit) MONO_INTERNAL;
-gboolean binary_protocol_is_enabled (void) MONO_INTERNAL;
+void binary_protocol_init (const char *filename, long long limit);
+gboolean binary_protocol_is_enabled (void);
-void binary_protocol_flush_buffers (gboolean force) MONO_INTERNAL;
+void binary_protocol_flush_buffers (gboolean force);
#define BEGIN_PROTOCOL_ENTRY0(method) \
- void method (void) MONO_INTERNAL;
+ void method (void);
#define BEGIN_PROTOCOL_ENTRY1(method,t1,f1) \
- void method (t1 f1) MONO_INTERNAL;
+ void method (t1 f1);
#define BEGIN_PROTOCOL_ENTRY2(method,t1,f1,t2,f2) \
- void method (t1 f1, t2 f2) MONO_INTERNAL;
+ void method (t1 f1, t2 f2);
#define BEGIN_PROTOCOL_ENTRY3(method,t1,f1,t2,f2,t3,f3) \
- void method (t1 f1, t2 f2, t3 f3) MONO_INTERNAL;
+ void method (t1 f1, t2 f2, t3 f3);
#define BEGIN_PROTOCOL_ENTRY4(method,t1,f1,t2,f2,t3,f3,t4,f4) \
- void method (t1 f1, t2 f2, t3 f3, t4 f4) MONO_INTERNAL;
+ void method (t1 f1, t2 f2, t3 f3, t4 f4);
#define BEGIN_PROTOCOL_ENTRY5(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5) \
- void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5) MONO_INTERNAL;
+ void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5);
#define BEGIN_PROTOCOL_ENTRY6(method,t1,f1,t2,f2,t3,f3,t4,f4,t5,f5,t6,f6) \
- void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5, t6 f6) MONO_INTERNAL;
+ void method (t1 f1, t2 f2, t3 f3, t4 f4, t5 f5, t6 f6);
#ifdef SGEN_HEAVY_BINARY_PROTOCOL
#define binary_protocol_is_heavy_enabled() binary_protocol_is_enabled ()
return region_age [idx];
}
-static inline void
-set_object_age (char *object, int age)
-{
- size_t idx = (object - sgen_nursery_start) >> SGEN_TO_SPACE_GRANULE_BITS;
- region_age [idx] = age;
-}
-
static void
set_age_in_range (char *start, char *end, int age)
{
#include "utils/mono-time.h"
#include "utils/dtrace.h"
#include "utils/mono-counters.h"
+#include "utils/mono-threads.h"
#define TV_DECLARE SGEN_TV_DECLARE
#define TV_GETTIME SGEN_TV_GETTIME
#define TV_ELAPSED SGEN_TV_ELAPSED
+static int sgen_unified_suspend_restart_world (void);
+static int sgen_unified_suspend_stop_world (void);
+
inline static void*
align_pointer (void *ptr)
{
sgen_global_stop_count++;
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);
- 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);
- count -= dead;
+
+ if (mono_thread_info_unified_management_enabled ()) {
+ count = sgen_unified_suspend_stop_world ();
+ } else {
+ 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);
+ count -= dead;
+ }
SGEN_LOG (3, "world stopped %d thread(s)", count);
mono_profiler_gc_event (MONO_GC_EVENT_POST_STOP_WORLD, generation);
} END_FOREACH_THREAD
TV_GETTIME (start_handshake);
- count = sgen_thread_handshake (FALSE);
+
+ if (mono_thread_info_unified_management_enabled ())
+ count = sgen_unified_suspend_restart_world ();
+ else
+ count = sgen_thread_handshake (FALSE);
+
+
TV_GETTIME (end_sw);
time_restart_world += TV_ELAPSED (start_handshake, end_sw);
usec = TV_ELAPSED (stop_world_time, end_sw);
mono_counters_register ("World restart", MONO_COUNTER_GC | MONO_COUNTER_ULONG | MONO_COUNTER_TIME, &time_restart_world);
}
+/* Unified suspend code */
+
+static gboolean
+sgen_is_thread_in_current_stw (SgenThreadInfo *info)
+{
+ /*
+ A thread explicitly asked to be skiped because it holds no managed state.
+ This is used by TP and finalizer threads.
+ FIXME Use an atomic variable for this to avoid everyone taking the GC LOCK.
+ */
+ if (info->gc_disabled) {
+ return FALSE;
+ }
+
+ /*
+ We have detected that this thread is failing/dying, ignore it.
+ FIXME: can't we merge this with thread_is_dying?
+ */
+ if (info->skip) {
+ return FALSE;
+ }
+
+ /*
+ Suspending the current thread will deadlock us, bad idea.
+ */
+ if (info == mono_thread_info_current ()) {
+ return FALSE;
+ }
+
+ /*
+ We can't suspend the workers that will do all the heavy lifting.
+ FIXME Use some state bit in SgenThreadInfo for this.
+ */
+ if (sgen_is_worker_thread (mono_thread_info_get_tid (info))) {
+ return FALSE;
+ }
+
+ /*
+ The thread has signaled that it started to detach, ignore it.
+ FIXME: can't we merge this with skip
+ */
+ if (!mono_thread_info_is_live (info)) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+static void
+update_sgen_info (SgenThreadInfo *info)
+{
+ char *stack_start;
+
+ /* Once we remove the old suspend code, we should move sgen to directly access the state in MonoThread */
+ info->stopped_domain = mono_thread_info_tls_get (info, TLS_KEY_DOMAIN);
+ info->stopped_ip = (gpointer) MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx);
+ stack_start = (char*)MONO_CONTEXT_GET_SP (&mono_thread_info_get_suspend_state (info)->ctx) - REDZONE_SIZE;
+
+ /* altstack signal handler, sgen can't handle them, mono-threads should have handled this. */
+ if (stack_start < (char*)info->stack_start_limit || stack_start >= (char*)info->stack_end)
+ g_error ("BAD STACK");
+
+ info->stack_start = stack_start;
+ info->ctx = mono_thread_info_get_suspend_state (info)->ctx;
+}
+
+static int
+sgen_unified_suspend_stop_world (void)
+{
+ int restart_counter;
+ SgenThreadInfo *info;
+ int count = 0;
+ int sleep_duration = -1;
+
+ mono_threads_begin_global_suspend ();
+ THREADS_STW_DEBUG ("[GC-STW-BEGIN] *** BEGIN SUSPEND *** \n");
+
+ FOREACH_THREAD_SAFE (info) {
+ info->skip = FALSE;
+ info->suspend_done = FALSE;
+ if (sgen_is_thread_in_current_stw (info)) {
+ info->skip = !mono_thread_info_begin_suspend (info, FALSE);
+ THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] SUSPEND thread %p skip %d\n", info, info->skip);
+ if (!info->skip)
+ ++count;
+ } else {
+ THREADS_STW_DEBUG ("[GC-STW-BEGIN-SUSPEND] IGNORE thread %p skip %d\n", info, info->skip);
+ }
+ } END_FOREACH_THREAD_SAFE
+
+ mono_thread_info_current ()->suspend_done = TRUE;
+ mono_threads_wait_pending_operations ();
+
+ for (;;) {
+ restart_counter = 0;
+ FOREACH_THREAD_SAFE (info) {
+ if (info->suspend_done || !sgen_is_thread_in_current_stw (info)) {
+ THREADS_STW_DEBUG ("[GC-STW-RESTART] IGNORE thread %p not been processed done %d current %d\n", info, info->suspend_done, !sgen_is_thread_in_current_stw (info));
+ continue;
+ }
+
+ /*
+ All threads that reach here are pristine suspended. This means the following:
+
+ - We haven't accepted the previous suspend as good.
+ - We haven't gave up on it for this STW (it's either bad or asked not to)
+ */
+ if (!mono_threads_core_check_suspend_result (info)) {
+ THREADS_STW_DEBUG ("[GC-STW-RESTART] SKIP thread %p failed to finish to suspend\n", info);
+ info->skip = TRUE;
+ } else if (mono_thread_info_in_critical_location (info)) {
+ gboolean res;
+ g_assert (mono_thread_info_suspend_count (info) == 1);
+ res = mono_thread_info_begin_resume (info);
+ THREADS_STW_DEBUG ("[GC-STW-RESTART] RESTART thread %p skip %d\n", info, res);
+ if (res)
+ ++restart_counter;
+ else
+ info->skip = TRUE;
+ } else {
+ THREADS_STW_DEBUG ("[GC-STW-RESTART] DONE thread %p deemed fully suspended\n", info);
+ g_assert (!info->in_critical_region);
+ info->suspend_done = TRUE;
+ }
+ } END_FOREACH_THREAD_SAFE
+
+ if (restart_counter == 0)
+ break;
+ mono_threads_wait_pending_operations ();
+
+ if (sleep_duration < 0) {
+#ifdef HOST_WIN32
+ SwitchToThread ();
+#else
+ sched_yield ();
+#endif
+ sleep_duration = 0;
+ } else {
+ g_usleep (sleep_duration);
+ sleep_duration += 10;
+ }
+
+ FOREACH_THREAD_SAFE (info) {
+ if (sgen_is_thread_in_current_stw (info) && mono_thread_info_is_running (info)) {
+ gboolean res = mono_thread_info_begin_suspend (info, FALSE);
+ THREADS_STW_DEBUG ("[GC-STW-RESTART] SUSPEND thread %p skip %d\n", info, res);
+ if (!res)
+ info->skip = TRUE;
+ }
+ } END_FOREACH_THREAD_SAFE
+
+ mono_threads_wait_pending_operations ();
+ }
+
+ FOREACH_THREAD_SAFE (info) {
+ if (sgen_is_thread_in_current_stw (info)) {
+ THREADS_STW_DEBUG ("[GC-STW-SUSPEND-END] thread %p is suspended\n", info);
+ g_assert (info->suspend_done);
+ update_sgen_info (info);
+ } else {
+ g_assert (!info->suspend_done || info == mono_thread_info_current ());
+ }
+ } END_FOREACH_THREAD_SAFE
+
+ return count;
+}
+
+static int
+sgen_unified_suspend_restart_world (void)
+{
+ SgenThreadInfo *info;
+ int count = 0;
+
+ THREADS_STW_DEBUG ("[GC-STW-END] *** BEGIN RESUME ***\n");
+ FOREACH_THREAD_SAFE (info) {
+ if (sgen_is_thread_in_current_stw (info)) {
+ g_assert (mono_thread_info_begin_resume (info));
+ THREADS_STW_DEBUG ("[GC-STW-RESUME-WORLD] RESUME thread %p\n", info);
+ ++count;
+ } else {
+ THREADS_STW_DEBUG ("[GC-STW-RESUME-WORLD] IGNORE thread %p\n", info);
+ }
+ } END_FOREACH_THREAD_SAFE
+
+ mono_threads_wait_pending_operations ();
+ mono_threads_end_global_suspend ();
+ return count;
+}
#endif
volatile JobQueueEntry *next;
};
-void sgen_workers_init (int num_workers) MONO_INTERNAL;
-void sgen_workers_start_all_workers (void) MONO_INTERNAL;
-gboolean sgen_workers_have_started (void) MONO_INTERNAL;
-void sgen_workers_ensure_awake (void) MONO_INTERNAL;
-void sgen_workers_init_distribute_gray_queue (void) MONO_INTERNAL;
-void sgen_workers_enqueue_job (JobFunc func, void *data) MONO_INTERNAL;
-void sgen_workers_wait_for_jobs_finished (void) MONO_INTERNAL;
-void sgen_workers_distribute_gray_queue_sections (void) MONO_INTERNAL;
-void sgen_workers_reset_data (void) MONO_INTERNAL;
-void sgen_workers_join (void) MONO_INTERNAL;
-gboolean sgen_workers_all_done (void) MONO_INTERNAL;
-gboolean sgen_workers_are_working (void) MONO_INTERNAL;
-SgenSectionGrayQueue* sgen_workers_get_distribute_section_gray_queue (void) MONO_INTERNAL;
+void sgen_workers_init (int num_workers);
+void sgen_workers_start_all_workers (void);
+gboolean sgen_workers_have_started (void);
+void sgen_workers_ensure_awake (void);
+void sgen_workers_init_distribute_gray_queue (void);
+void sgen_workers_enqueue_job (JobFunc func, void *data);
+void sgen_workers_wait_for_jobs_finished (void);
+void sgen_workers_distribute_gray_queue_sections (void);
+void sgen_workers_reset_data (void);
+void sgen_workers_join (void);
+gboolean sgen_workers_all_done (void);
+gboolean sgen_workers_are_working (void);
+SgenSectionGrayQueue* sgen_workers_get_distribute_section_gray_queue (void);
-void sgen_workers_signal_start_nursery_collection_and_wait (void) MONO_INTERNAL;
-void sgen_workers_signal_finish_nursery_collection (void) MONO_INTERNAL;
+void sgen_workers_signal_start_nursery_collection_and_wait (void);
+void sgen_workers_signal_finish_nursery_collection (void);
#endif
static SOCKET Socket_to_SOCKET(MonoObject *sockobj)
{
- SOCKET sock;
+ MonoSafeHandle *safe_handle;
MonoClassField *field;
- field=mono_class_get_field_from_name(sockobj->vtable->klass, "socket");
- sock=GPOINTER_TO_INT (*(gpointer *)(((char *)sockobj)+field->offset));
+ field = mono_class_get_field_from_name (sockobj->vtable->klass, "socket");
+ safe_handle = ((MonoSafeHandle*) (*(gpointer *)(((char *)sockobj)+field->offset)));
+
+ if (safe_handle == NULL)
+ return -1;
- return(sock);
+ return (SOCKET) safe_handle->handle;
}
#define POLL_ERRORS (MONO_POLLERR | MONO_POLLHUP | MONO_POLLNVAL)
gint gid;
} MonoPeerCredData;
-extern gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this_obj, gint32 family, gint32 type, gint32 proto, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock, gboolean block, gint32 *error) MONO_INTERNAL;
-extern gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock, gint32 *error, gboolean blocking) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock, guint32 backlog, gint32 *error) MONO_INTERNAL;
-extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock, gint32 af, gint32 *error) MONO_INTERNAL;
-extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock, gint32 af, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_Send_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error) MONO_INTERNAL;
-extern gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **sockets, gint32 timeout, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock, gint32 how, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error) MONO_INTERNAL;
-extern int ves_icall_System_Net_Sockets_Socket_WSAIoctl (SOCKET sock, gint32 code, MonoArray *input, MonoArray *output, gint32 *error) MONO_INTERNAL;
-extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list) MONO_INTERNAL;
-extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list) MONO_INTERNAL;
-extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_name) MONO_INTERNAL;
-extern MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET sock, gint mode, gint timeout, gint32 *error) MONO_INTERNAL;
-extern void ves_icall_System_Net_Sockets_Socket_Disconnect_internal(SOCKET sock, MonoBoolean reuse, gint32 *error) MONO_INTERNAL;
-extern gboolean ves_icall_System_Net_Sockets_Socket_SendFile (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags) MONO_INTERNAL;
-void icall_cancel_blocking_socket_operation (MonoThread *thread) MONO_INTERNAL;
+extern gpointer ves_icall_System_Net_Sockets_Socket_Socket_internal(MonoObject *this_obj, gint32 family, gint32 type, gint32 proto, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Close_internal(SOCKET sock, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_SocketException_WSAGetLastError_internal(void);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Available_internal(SOCKET sock, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Blocking_internal(SOCKET sock, gboolean block, gint32 *error);
+extern gpointer ves_icall_System_Net_Sockets_Socket_Accept_internal(SOCKET sock, gint32 *error, gboolean blocking);
+extern void ves_icall_System_Net_Sockets_Socket_Listen_internal(SOCKET sock, guint32 backlog, gint32 *error);
+extern MonoObject *ves_icall_System_Net_Sockets_Socket_LocalEndPoint_internal(SOCKET sock, gint32 af, gint32 *error);
+extern MonoObject *ves_icall_System_Net_Sockets_Socket_RemoteEndPoint_internal(SOCKET sock, gint32 af, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Bind_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Connect_internal(SOCKET sock, MonoObject *sockaddr, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Receive_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_Socket_RecvFrom_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject **sockaddr, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Send_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_Socket_Send_array_internal(SOCKET sock, MonoArray *buffers, gint32 flags, gint32 *error);
+extern gint32 ves_icall_System_Net_Sockets_Socket_SendTo_internal(SOCKET sock, MonoArray *buffer, gint32 offset, gint32 count, gint32 flags, MonoObject *sockaddr, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Select_internal(MonoArray **sockets, gint32 timeout, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Shutdown_internal(SOCKET sock, gint32 how, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET sock, gint32 level, gint32 name, MonoObject **obj_val, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET sock, gint32 level, gint32 name, MonoArray **byte_val, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, gint32 level, gint32 name, MonoObject *obj_val, MonoArray *byte_val, gint32 int_val, gint32 *error);
+extern int ves_icall_System_Net_Sockets_Socket_WSAIoctl (SOCKET sock, gint32 code, MonoArray *input, MonoArray *output, gint32 *error);
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostByName_internal(MonoString *host, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list);
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostByAddr_internal(MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list);
+extern MonoBoolean ves_icall_System_Net_Dns_GetHostName_internal(MonoString **h_name);
+extern MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET sock, gint mode, gint timeout, gint32 *error);
+extern void ves_icall_System_Net_Sockets_Socket_Disconnect_internal(SOCKET sock, MonoBoolean reuse, gint32 *error);
+extern gboolean ves_icall_System_Net_Sockets_Socket_SendFile (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags);
+void icall_cancel_blocking_socket_operation (MonoThread *thread);
-extern void mono_network_init(void) MONO_INTERNAL;
-extern void mono_network_cleanup(void) MONO_INTERNAL;
+extern void mono_network_init(void);
+extern void mono_network_cleanup(void);
#endif /* _MONO_METADATA_SOCKET_H_ */
#include "mono/utils/mono-compiler.h"
void
-ves_icall_System_String_ctor_RedirectToCreateString (void) MONO_INTERNAL;
+ves_icall_System_String_ctor_RedirectToCreateString (void);
MonoString *
-ves_icall_System_String_InternalAllocateStr (gint32 length) MONO_INTERNAL;
+ves_icall_System_String_InternalAllocateStr (gint32 length);
MonoString *
-ves_icall_System_String_InternalIntern (MonoString *str) MONO_INTERNAL;
+ves_icall_System_String_InternalIntern (MonoString *str);
MonoString *
-ves_icall_System_String_InternalIsInterned (MonoString *str) MONO_INTERNAL;
+ves_icall_System_String_InternalIsInterned (MonoString *str);
int
-ves_icall_System_String_GetLOSLimit (void) MONO_INTERNAL;
+ves_icall_System_String_GetLOSLimit (void);
void
-ves_icall_System_String_InternalSetLength (MonoString *str, gint32 new_length) MONO_INTERNAL;
+ves_icall_System_String_InternalSetLength (MonoString *str, gint32 new_length);
#endif /* _MONO_CLI_STRING_ICALLS_H_ */
#include <glib.h>
#include "mono/utils/mono-compiler.h"
-extern gdouble ves_icall_System_Math_Floor (gdouble x) MONO_INTERNAL;
-extern gdouble ves_icall_System_Math_Round (gdouble x) MONO_INTERNAL;
-extern gdouble ves_icall_System_Math_Round2 (gdouble value, gint32 digits, gboolean away_from_zero) MONO_INTERNAL;
+extern gdouble ves_icall_System_Math_Floor (gdouble x);
+extern gdouble ves_icall_System_Math_Round (gdouble x);
+extern gdouble ves_icall_System_Math_Round2 (gdouble value, gint32 digits, gboolean away_from_zero);
extern gdouble
-ves_icall_System_Math_Sin (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Sin (gdouble x);
extern gdouble
-ves_icall_System_Math_Cos (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Cos (gdouble x);
extern gdouble
-ves_icall_System_Math_Tan (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Tan (gdouble x);
extern gdouble
-ves_icall_System_Math_Sinh (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Sinh (gdouble x);
extern gdouble
-ves_icall_System_Math_Cosh (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Cosh (gdouble x);
extern gdouble
-ves_icall_System_Math_Tanh (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Tanh (gdouble x);
extern gdouble
-ves_icall_System_Math_Acos (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Acos (gdouble x);
extern gdouble
-ves_icall_System_Math_Asin (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Asin (gdouble x);
extern gdouble
-ves_icall_System_Math_Atan (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Atan (gdouble x);
extern gdouble
-ves_icall_System_Math_Atan2 (gdouble y, gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Atan2 (gdouble y, gdouble x);
extern gdouble
-ves_icall_System_Math_Exp (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Exp (gdouble x);
extern gdouble
-ves_icall_System_Math_Log (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Log (gdouble x);
extern gdouble
-ves_icall_System_Math_Log10 (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Log10 (gdouble x);
extern gdouble
-ves_icall_System_Math_Pow (gdouble x, gdouble y) MONO_INTERNAL;
+ves_icall_System_Math_Pow (gdouble x, gdouble y);
extern gdouble
-ves_icall_System_Math_Sqrt (gdouble x) MONO_INTERNAL;
+ves_icall_System_Math_Sqrt (gdouble x);
#endif
void (*shutdown) (gpointer event_data);
} SocketIOData;
-void mono_thread_pool_remove_socket (int sock) MONO_INTERNAL;
-gboolean mono_thread_pool_is_queue_array (MonoArray *o) MONO_INTERNAL;
-void mono_internal_thread_unhandled_exception (MonoObject* exc) MONO_INTERNAL;
+void mono_thread_pool_remove_socket (int sock);
+gboolean mono_thread_pool_is_queue_array (MonoArray *o);
+void mono_internal_thread_unhandled_exception (MonoObject* exc);
//TP implementations
-gpointer tp_poll_init (SocketIOData *data) MONO_INTERNAL;
+gpointer tp_poll_init (SocketIOData *data);
//TP internals the impls use
-void check_for_interruption_critical (void) MONO_INTERNAL;
-void socket_io_cleanup (SocketIOData *data) MONO_INTERNAL;
-MonoObject *get_io_event (MonoMList **list, gint event) MONO_INTERNAL;
-int get_events_from_list (MonoMList *list) MONO_INTERNAL;
-void threadpool_append_async_io_jobs (MonoObject **jobs, gint njobs) MONO_INTERNAL;
+void check_for_interruption_critical (void);
+void socket_io_cleanup (SocketIOData *data);
+MonoObject *get_io_event (MonoMList **list, gint event);
+int get_events_from_list (MonoMList *list);
+void threadpool_append_async_io_jobs (MonoObject **jobs, gint njobs);
#endif
monitor_heuristic (gint16 *current, gint16 *history_size, SamplesHistory *history, ThreadPool *tp)
{
int i;
- gint8 decision;
+ gint8 decision G_GNUC_UNUSED;
gint16 cur, max = 0;
gboolean all_waitsleepjoin;
MonoInternalThread *thread;
#include <mono/metadata/socket-io.h>
/* No managed code here */
-void mono_thread_pool_init (void) MONO_INTERNAL;
-void mono_thread_pool_init_tls (void) MONO_INTERNAL;
+void mono_thread_pool_init (void);
+void mono_thread_pool_init_tls (void);
-void icall_append_job (MonoObject *ar) MONO_INTERNAL;
-void icall_append_io_job (MonoObject *target, MonoSocketAsyncResult *state) MONO_INTERNAL;
+void icall_append_job (MonoObject *ar);
+void icall_append_io_job (MonoObject *target, MonoSocketAsyncResult *state);
MonoAsyncResult *
mono_thread_pool_add (MonoObject *target, MonoMethodMessage *msg,
- MonoDelegate *async_callback, MonoObject *state) MONO_INTERNAL;
+ MonoDelegate *async_callback, MonoObject *state);
MonoObject *
mono_thread_pool_finish (MonoAsyncResult *ares, MonoArray **out_args,
- MonoObject **exc) MONO_INTERNAL;
+ MonoObject **exc);
-void mono_thread_pool_cleanup (void) MONO_INTERNAL;
+void mono_thread_pool_cleanup (void);
-gboolean mono_thread_pool_remove_domain_jobs (MonoDomain *domain, int timeout) MONO_INTERNAL;
+gboolean mono_thread_pool_remove_domain_jobs (MonoDomain *domain, int timeout);
-void mono_thread_pool_suspend (void) MONO_INTERNAL;
-void mono_thread_pool_resume (void) MONO_INTERNAL;
+void mono_thread_pool_suspend (void);
+void mono_thread_pool_resume (void);
void
ves_icall_System_Threading_ThreadPool_GetAvailableThreads (int *workerThreads,
- int *completionPortThreads) MONO_INTERNAL;
+ int *completionPortThreads);
void
ves_icall_System_Threading_ThreadPool_GetMaxThreads (int *workerThreads,
- int *completionPortThreads) MONO_INTERNAL;
+ int *completionPortThreads);
void
ves_icall_System_Threading_ThreadPool_GetMinThreads (gint *workerThreads,
- gint *completionPortThreads) MONO_INTERNAL;
+ gint *completionPortThreads);
MonoBoolean
ves_icall_System_Threading_ThreadPool_SetMinThreads (gint workerThreads,
- gint completionPortThreads) MONO_INTERNAL;
+ gint completionPortThreads);
MonoBoolean
ves_icall_System_Threading_ThreadPool_SetMaxThreads (gint workerThreads,
- gint completionPortThreads) MONO_INTERNAL;
+ gint completionPortThreads);
typedef void (*MonoThreadPoolFunc) (gpointer user_data);
MONO_API void mono_install_threadpool_thread_hooks (MonoThreadPoolFunc start_func, MonoThreadPoolFunc finish_func, gpointer user_data);
/* INFO has type MonoThreadInfo* */
typedef void (*MonoThreadNotifyPendingExcFunc) (gpointer info);
-MonoInternalThread* mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gboolean threadpool_thread, guint32 stack_size) MONO_INTERNAL;
-
-void mono_threads_install_cleanup (MonoThreadCleanupFunc func) MONO_INTERNAL;
-
-void ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThread *this_obj) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this_obj, MonoObject *start) MONO_INTERNAL;
-void ves_icall_System_Threading_InternalThread_Thread_free_internal(MonoInternalThread *this_obj, HANDLE thread) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms) MONO_INTERNAL;
-gboolean ves_icall_System_Threading_Thread_Join_internal(MonoInternalThread *this_obj, int ms, HANDLE thread) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_Thread_GetDomainID (void) MONO_INTERNAL;
-gboolean ves_icall_System_Threading_Thread_Yield (void) MONO_INTERNAL;
-MonoString* ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThread *this_obj) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_SetName_internal (MonoInternalThread *this_obj, MonoString *name) MONO_INTERNAL;
-int ves_icall_System_Threading_Thread_GetPriority (MonoInternalThread *thread) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_SetPriority (MonoInternalThread *thread, int priority) MONO_INTERNAL;
-MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentCulture (MonoInternalThread *this_obj) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_SetCachedCurrentCulture (MonoThread *this_obj, MonoObject *culture) MONO_INTERNAL;
-MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentUICulture (MonoInternalThread *this_obj) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_SetCachedCurrentUICulture (MonoThread *this_obj, MonoObject *culture) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal(MonoBoolean owned, MonoString *name, MonoBoolean *created) MONO_INTERNAL;
-MonoBoolean ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle ) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name, gint32 rights, gint32 *error) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, MonoBoolean *created) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (HANDLE handle, gint32 releaseCount, MonoBoolean *fail) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, MonoBoolean *created) MONO_INTERNAL;
-gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle) MONO_INTERNAL;
-gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle) MONO_INTERNAL;
-void ves_icall_System_Threading_Events_CloseEvent_internal (HANDLE handle) MONO_INTERNAL;
-HANDLE ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name, gint32 rights, gint32 *error) MONO_INTERNAL;
-
-gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext) MONO_INTERNAL;
-gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this_obj, HANDLE handle, gint32 ms, gboolean exitContext) MONO_INTERNAL;
-gboolean ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal (HANDLE toSignal, HANDLE toWait, gint32 ms, gboolean exitContext) MONO_INTERNAL;
-
-MonoArray* ves_icall_System_Threading_Thread_ByteArrayToRootDomain (MonoArray *arr) MONO_INTERNAL;
-MonoArray* ves_icall_System_Threading_Thread_ByteArrayToCurrentDomain (MonoArray *arr) MONO_INTERNAL;
-
-gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location) MONO_INTERNAL;
-
-gint32 ves_icall_System_Threading_Interlocked_Exchange_Int(gint32 *location, gint32 value) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Exchange_Long(gint64 *location, gint64 value) MONO_INTERNAL;
-MonoObject *ves_icall_System_Threading_Interlocked_Exchange_Object(MonoObject **location, MonoObject *value) MONO_INTERNAL;
-gpointer ves_icall_System_Threading_Interlocked_Exchange_IntPtr(gpointer *location, gpointer value) MONO_INTERNAL;
-gfloat ves_icall_System_Threading_Interlocked_Exchange_Single(gfloat *location, gfloat value) MONO_INTERNAL;
-gdouble ves_icall_System_Threading_Interlocked_Exchange_Double(gdouble *location, gdouble value) MONO_INTERNAL;
-
-gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location, gint32 value, gint32 comparand) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int_Success(gint32 *location, gint32 value, gint32 comparand, MonoBoolean *success) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_CompareExchange_Long(gint64 *location, gint64 value, gint64 comparand) MONO_INTERNAL;
-MonoObject *ves_icall_System_Threading_Interlocked_CompareExchange_Object(MonoObject **location, MonoObject *value, MonoObject *comparand) MONO_INTERNAL;
-gpointer ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr(gpointer *location, gpointer value, gpointer comparand) MONO_INTERNAL;
-gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single(gfloat *location, gfloat value, gfloat comparand) MONO_INTERNAL;
-gdouble ves_icall_System_Threading_Interlocked_CompareExchange_Double(gdouble *location, gdouble value, gdouble comparand) MONO_INTERNAL;
-MonoObject* ves_icall_System_Threading_Interlocked_CompareExchange_T(MonoObject **location, MonoObject *value, MonoObject *comparand) MONO_INTERNAL;
-MonoObject* ves_icall_System_Threading_Interlocked_Exchange_T(MonoObject **location, MonoObject *value) MONO_INTERNAL;
-
-gint32 ves_icall_System_Threading_Interlocked_Add_Int(gint32 *location, gint32 value) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Add_Long(gint64 *location, gint64 value) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Read_Long(gint64 *location) MONO_INTERNAL;
-
-gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location) MONO_INTERNAL;
-
-gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location) MONO_INTERNAL;
-
-void ves_icall_System_Threading_Thread_Abort (MonoInternalThread *thread, MonoObject *state) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_ResetAbort (void) MONO_INTERNAL;
-MonoObject* ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThread *thread) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_Suspend (MonoInternalThread *thread) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_Resume (MonoThread *thread) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_ClrState (MonoInternalThread *thread, guint32 state) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_SetState (MonoInternalThread *thread, guint32 state) MONO_INTERNAL;
-guint32 ves_icall_System_Threading_Thread_GetState (MonoInternalThread *thread) MONO_INTERNAL;
-
-gint8 ves_icall_System_Threading_Thread_VolatileRead1 (void *ptr) MONO_INTERNAL;
-gint16 ves_icall_System_Threading_Thread_VolatileRead2 (void *ptr) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_Thread_VolatileRead4 (void *ptr) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Thread_VolatileRead8 (void *ptr) MONO_INTERNAL;
-void * ves_icall_System_Threading_Thread_VolatileReadIntPtr (void *ptr) MONO_INTERNAL;
-void * ves_icall_System_Threading_Thread_VolatileReadObject (void *ptr) MONO_INTERNAL;
-double ves_icall_System_Threading_Thread_VolatileReadDouble (void *ptr) MONO_INTERNAL;
-float ves_icall_System_Threading_Thread_VolatileReadFloat (void *ptr) MONO_INTERNAL;
-
-void ves_icall_System_Threading_Thread_VolatileWrite1 (void *ptr, gint8) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWrite2 (void *ptr, gint16) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWrite4 (void *ptr, gint32) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWrite8 (void *ptr, gint64) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWriteIntPtr (void *ptr, void *) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWriteObject (void *ptr, MonoObject *) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWriteFloat (void *ptr, float) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_VolatileWriteDouble (void *ptr, double) MONO_INTERNAL;
-
-gint8 ves_icall_System_Threading_Volatile_Read1 (void *ptr) MONO_INTERNAL;
-gint16 ves_icall_System_Threading_Volatile_Read2 (void *ptr) MONO_INTERNAL;
-gint32 ves_icall_System_Threading_Volatile_Read4 (void *ptr) MONO_INTERNAL;
-gint64 ves_icall_System_Threading_Volatile_Read8 (void *ptr) MONO_INTERNAL;
-void * ves_icall_System_Threading_Volatile_ReadIntPtr (void *ptr) MONO_INTERNAL;
-double ves_icall_System_Threading_Volatile_ReadDouble (void *ptr) MONO_INTERNAL;
-float ves_icall_System_Threading_Volatile_ReadFloat (void *ptr) MONO_INTERNAL;
-MonoObject* ves_icall_System_Threading_Volatile_Read_T (void *ptr) MONO_INTERNAL;
-
-void ves_icall_System_Threading_Volatile_Write1 (void *ptr, gint8) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_Write2 (void *ptr, gint16) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_Write4 (void *ptr, gint32) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_Write8 (void *ptr, gint64) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_WriteIntPtr (void *ptr, void *) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_WriteFloat (void *ptr, float) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_WriteDouble (void *ptr, double) MONO_INTERNAL;
-void ves_icall_System_Threading_Volatile_Write_T (void *ptr, MonoObject *value) MONO_INTERNAL;
-
-void ves_icall_System_Threading_Thread_MemoryBarrier (void) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_Interrupt_internal (MonoInternalThread *this_obj) MONO_INTERNAL;
-void ves_icall_System_Threading_Thread_SpinWait_nop (void) MONO_INTERNAL;
-
-MonoInternalThread *mono_thread_internal_current (void) MONO_INTERNAL;
-
-void mono_thread_internal_stop (MonoInternalThread *thread) MONO_INTERNAL;
-
-gboolean mono_thread_internal_has_appdomain_ref (MonoInternalThread *thread, MonoDomain *domain) MONO_INTERNAL;
-
-void mono_thread_internal_reset_abort (MonoInternalThread *thread) MONO_INTERNAL;
-
-void mono_alloc_special_static_data_free (GHashTable *special_static_fields) MONO_INTERNAL;
-void mono_special_static_data_free_slot (guint32 offset, guint32 size) MONO_INTERNAL;
-uint32_t mono_thread_alloc_tls (MonoReflectionType *type) MONO_INTERNAL;
-void mono_thread_destroy_tls (uint32_t tls_offset) MONO_INTERNAL;
-void mono_thread_destroy_domain_tls (MonoDomain *domain) MONO_INTERNAL;
-void mono_thread_free_local_slot_values (int slot, MonoBoolean is_thread_local) MONO_INTERNAL;
-void mono_thread_current_check_pending_interrupt (void) MONO_INTERNAL;
-
-void mono_thread_set_state (MonoInternalThread *thread, MonoThreadState state) MONO_INTERNAL;
-void mono_thread_clr_state (MonoInternalThread *thread, MonoThreadState state) MONO_INTERNAL;
-gboolean mono_thread_test_state (MonoInternalThread *thread, MonoThreadState test) MONO_INTERNAL;
-
-void mono_thread_init_apartment_state (void) MONO_INTERNAL;
-void mono_thread_cleanup_apartment_state (void) MONO_INTERNAL;
-
-void mono_threads_set_shutting_down (void) MONO_INTERNAL;
-
-gunichar2* mono_thread_get_name (MonoInternalThread *this_obj, guint32 *name_len) MONO_INTERNAL;
+MonoInternalThread* mono_thread_create_internal (MonoDomain *domain, gpointer func, gpointer arg, gboolean threadpool_thread, guint32 stack_size);
+
+void mono_threads_install_cleanup (MonoThreadCleanupFunc func);
+
+void ves_icall_System_Threading_Thread_ConstructInternalThread (MonoThread *this_obj);
+HANDLE ves_icall_System_Threading_Thread_Thread_internal(MonoThread *this_obj, MonoObject *start);
+void ves_icall_System_Threading_InternalThread_Thread_free_internal(MonoInternalThread *this_obj, HANDLE thread);
+void ves_icall_System_Threading_Thread_Sleep_internal(gint32 ms);
+gboolean ves_icall_System_Threading_Thread_Join_internal(MonoInternalThread *this_obj, int ms, HANDLE thread);
+gint32 ves_icall_System_Threading_Thread_GetDomainID (void);
+gboolean ves_icall_System_Threading_Thread_Yield (void);
+MonoString* ves_icall_System_Threading_Thread_GetName_internal (MonoInternalThread *this_obj);
+void ves_icall_System_Threading_Thread_SetName_internal (MonoInternalThread *this_obj, MonoString *name);
+int ves_icall_System_Threading_Thread_GetPriority (MonoInternalThread *thread);
+void ves_icall_System_Threading_Thread_SetPriority (MonoInternalThread *thread, int priority);
+MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentCulture (MonoInternalThread *this_obj);
+void ves_icall_System_Threading_Thread_SetCachedCurrentCulture (MonoThread *this_obj, MonoObject *culture);
+MonoObject* ves_icall_System_Threading_Thread_GetCachedCurrentUICulture (MonoInternalThread *this_obj);
+void ves_icall_System_Threading_Thread_SetCachedCurrentUICulture (MonoThread *this_obj, MonoObject *culture);
+HANDLE ves_icall_System_Threading_Mutex_CreateMutex_internal(MonoBoolean owned, MonoString *name, MonoBoolean *created);
+MonoBoolean ves_icall_System_Threading_Mutex_ReleaseMutex_internal (HANDLE handle );
+HANDLE ves_icall_System_Threading_Mutex_OpenMutex_internal (MonoString *name, gint32 rights, gint32 *error);
+HANDLE ves_icall_System_Threading_Semaphore_CreateSemaphore_internal (gint32 initialCount, gint32 maximumCount, MonoString *name, MonoBoolean *created);
+gint32 ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (HANDLE handle, gint32 releaseCount, MonoBoolean *fail);
+HANDLE ves_icall_System_Threading_Semaphore_OpenSemaphore_internal (MonoString *name, gint32 rights, gint32 *error);
+HANDLE ves_icall_System_Threading_Events_CreateEvent_internal (MonoBoolean manual, MonoBoolean initial, MonoString *name, MonoBoolean *created);
+gboolean ves_icall_System_Threading_Events_SetEvent_internal (HANDLE handle);
+gboolean ves_icall_System_Threading_Events_ResetEvent_internal (HANDLE handle);
+void ves_icall_System_Threading_Events_CloseEvent_internal (HANDLE handle);
+HANDLE ves_icall_System_Threading_Events_OpenEvent_internal (MonoString *name, gint32 rights, gint32 *error);
+
+gboolean ves_icall_System_Threading_WaitHandle_WaitAll_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext);
+gint32 ves_icall_System_Threading_WaitHandle_WaitAny_internal(MonoArray *mono_handles, gint32 ms, gboolean exitContext);
+gboolean ves_icall_System_Threading_WaitHandle_WaitOne_internal(MonoObject *this_obj, HANDLE handle, gint32 ms, gboolean exitContext);
+gboolean ves_icall_System_Threading_WaitHandle_SignalAndWait_Internal (HANDLE toSignal, HANDLE toWait, gint32 ms, gboolean exitContext);
+
+MonoArray* ves_icall_System_Threading_Thread_ByteArrayToRootDomain (MonoArray *arr);
+MonoArray* ves_icall_System_Threading_Thread_ByteArrayToCurrentDomain (MonoArray *arr);
+
+gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location);
+gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location);
+gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location);
+gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location);
+
+gint32 ves_icall_System_Threading_Interlocked_Exchange_Int(gint32 *location, gint32 value);
+gint64 ves_icall_System_Threading_Interlocked_Exchange_Long(gint64 *location, gint64 value);
+MonoObject *ves_icall_System_Threading_Interlocked_Exchange_Object(MonoObject **location, MonoObject *value);
+gpointer ves_icall_System_Threading_Interlocked_Exchange_IntPtr(gpointer *location, gpointer value);
+gfloat ves_icall_System_Threading_Interlocked_Exchange_Single(gfloat *location, gfloat value);
+gdouble ves_icall_System_Threading_Interlocked_Exchange_Double(gdouble *location, gdouble value);
+
+gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int(gint32 *location, gint32 value, gint32 comparand);
+gint32 ves_icall_System_Threading_Interlocked_CompareExchange_Int_Success(gint32 *location, gint32 value, gint32 comparand, MonoBoolean *success);
+gint64 ves_icall_System_Threading_Interlocked_CompareExchange_Long(gint64 *location, gint64 value, gint64 comparand);
+MonoObject *ves_icall_System_Threading_Interlocked_CompareExchange_Object(MonoObject **location, MonoObject *value, MonoObject *comparand);
+gpointer ves_icall_System_Threading_Interlocked_CompareExchange_IntPtr(gpointer *location, gpointer value, gpointer comparand);
+gfloat ves_icall_System_Threading_Interlocked_CompareExchange_Single(gfloat *location, gfloat value, gfloat comparand);
+gdouble ves_icall_System_Threading_Interlocked_CompareExchange_Double(gdouble *location, gdouble value, gdouble comparand);
+MonoObject* ves_icall_System_Threading_Interlocked_CompareExchange_T(MonoObject **location, MonoObject *value, MonoObject *comparand);
+MonoObject* ves_icall_System_Threading_Interlocked_Exchange_T(MonoObject **location, MonoObject *value);
+
+gint32 ves_icall_System_Threading_Interlocked_Add_Int(gint32 *location, gint32 value);
+gint64 ves_icall_System_Threading_Interlocked_Add_Long(gint64 *location, gint64 value);
+gint64 ves_icall_System_Threading_Interlocked_Read_Long(gint64 *location);
+
+gint32 ves_icall_System_Threading_Interlocked_Increment_Int(gint32 *location);
+gint64 ves_icall_System_Threading_Interlocked_Increment_Long(gint64 *location);
+
+gint32 ves_icall_System_Threading_Interlocked_Decrement_Int(gint32 *location);
+gint64 ves_icall_System_Threading_Interlocked_Decrement_Long(gint64 * location);
+
+void ves_icall_System_Threading_Thread_Abort (MonoInternalThread *thread, MonoObject *state);
+void ves_icall_System_Threading_Thread_ResetAbort (void);
+MonoObject* ves_icall_System_Threading_Thread_GetAbortExceptionState (MonoThread *thread);
+void ves_icall_System_Threading_Thread_Suspend (MonoInternalThread *thread);
+void ves_icall_System_Threading_Thread_Resume (MonoThread *thread);
+void ves_icall_System_Threading_Thread_ClrState (MonoInternalThread *thread, guint32 state);
+void ves_icall_System_Threading_Thread_SetState (MonoInternalThread *thread, guint32 state);
+guint32 ves_icall_System_Threading_Thread_GetState (MonoInternalThread *thread);
+
+gint8 ves_icall_System_Threading_Thread_VolatileRead1 (void *ptr);
+gint16 ves_icall_System_Threading_Thread_VolatileRead2 (void *ptr);
+gint32 ves_icall_System_Threading_Thread_VolatileRead4 (void *ptr);
+gint64 ves_icall_System_Threading_Thread_VolatileRead8 (void *ptr);
+void * ves_icall_System_Threading_Thread_VolatileReadIntPtr (void *ptr);
+void * ves_icall_System_Threading_Thread_VolatileReadObject (void *ptr);
+double ves_icall_System_Threading_Thread_VolatileReadDouble (void *ptr);
+float ves_icall_System_Threading_Thread_VolatileReadFloat (void *ptr);
+
+void ves_icall_System_Threading_Thread_VolatileWrite1 (void *ptr, gint8);
+void ves_icall_System_Threading_Thread_VolatileWrite2 (void *ptr, gint16);
+void ves_icall_System_Threading_Thread_VolatileWrite4 (void *ptr, gint32);
+void ves_icall_System_Threading_Thread_VolatileWrite8 (void *ptr, gint64);
+void ves_icall_System_Threading_Thread_VolatileWriteIntPtr (void *ptr, void *);
+void ves_icall_System_Threading_Thread_VolatileWriteObject (void *ptr, MonoObject *);
+void ves_icall_System_Threading_Thread_VolatileWriteFloat (void *ptr, float);
+void ves_icall_System_Threading_Thread_VolatileWriteDouble (void *ptr, double);
+
+gint8 ves_icall_System_Threading_Volatile_Read1 (void *ptr);
+gint16 ves_icall_System_Threading_Volatile_Read2 (void *ptr);
+gint32 ves_icall_System_Threading_Volatile_Read4 (void *ptr);
+gint64 ves_icall_System_Threading_Volatile_Read8 (void *ptr);
+void * ves_icall_System_Threading_Volatile_ReadIntPtr (void *ptr);
+double ves_icall_System_Threading_Volatile_ReadDouble (void *ptr);
+float ves_icall_System_Threading_Volatile_ReadFloat (void *ptr);
+MonoObject* ves_icall_System_Threading_Volatile_Read_T (void *ptr);
+
+void ves_icall_System_Threading_Volatile_Write1 (void *ptr, gint8);
+void ves_icall_System_Threading_Volatile_Write2 (void *ptr, gint16);
+void ves_icall_System_Threading_Volatile_Write4 (void *ptr, gint32);
+void ves_icall_System_Threading_Volatile_Write8 (void *ptr, gint64);
+void ves_icall_System_Threading_Volatile_WriteIntPtr (void *ptr, void *);
+void ves_icall_System_Threading_Volatile_WriteFloat (void *ptr, float);
+void ves_icall_System_Threading_Volatile_WriteDouble (void *ptr, double);
+void ves_icall_System_Threading_Volatile_Write_T (void *ptr, MonoObject *value);
+
+void ves_icall_System_Threading_Thread_MemoryBarrier (void);
+void ves_icall_System_Threading_Thread_Interrupt_internal (MonoInternalThread *this_obj);
+void ves_icall_System_Threading_Thread_SpinWait_nop (void);
+
+MonoInternalThread *mono_thread_internal_current (void);
+
+void mono_thread_internal_stop (MonoInternalThread *thread);
+
+gboolean mono_thread_internal_has_appdomain_ref (MonoInternalThread *thread, MonoDomain *domain);
+
+void mono_thread_internal_reset_abort (MonoInternalThread *thread);
+
+void mono_alloc_special_static_data_free (GHashTable *special_static_fields);
+void mono_special_static_data_free_slot (guint32 offset, guint32 size);
+uint32_t mono_thread_alloc_tls (MonoReflectionType *type);
+void mono_thread_destroy_tls (uint32_t tls_offset);
+void mono_thread_destroy_domain_tls (MonoDomain *domain);
+void mono_thread_free_local_slot_values (int slot, MonoBoolean is_thread_local);
+void mono_thread_current_check_pending_interrupt (void);
+
+void mono_thread_set_state (MonoInternalThread *thread, MonoThreadState state);
+void mono_thread_clr_state (MonoInternalThread *thread, MonoThreadState state);
+gboolean mono_thread_test_state (MonoInternalThread *thread, MonoThreadState test);
+
+void mono_thread_init_apartment_state (void);
+void mono_thread_cleanup_apartment_state (void);
+
+void mono_threads_set_shutting_down (void);
+
+gunichar2* mono_thread_get_name (MonoInternalThread *this_obj, guint32 *name_len);
MONO_API MonoException* mono_thread_get_undeniable_exception (void);
-MonoException* mono_thread_get_and_clear_pending_exception (void) MONO_INTERNAL;
+MonoException* mono_thread_get_and_clear_pending_exception (void);
-void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed) MONO_INTERNAL;
+void mono_thread_set_name_internal (MonoInternalThread *this_obj, MonoString *name, gboolean managed);
-void mono_threads_install_notify_pending_exc (MonoThreadNotifyPendingExcFunc func) MONO_INTERNAL;
+void mono_threads_install_notify_pending_exc (MonoThreadNotifyPendingExcFunc func);
-MonoObject* mono_thread_get_execution_context (void) MONO_INTERNAL;
-void mono_thread_set_execution_context (MonoObject *ec) MONO_INTERNAL;
+MonoObject* mono_thread_get_execution_context (void);
+void mono_thread_set_execution_context (MonoObject *ec);
-void mono_runtime_set_has_tls_get (gboolean val) MONO_INTERNAL;
-gboolean mono_runtime_has_tls_get (void) MONO_INTERNAL;
+void mono_runtime_set_has_tls_get (gboolean val);
+gboolean mono_runtime_has_tls_get (void);
-int mono_thread_get_abort_signal (void) MONO_INTERNAL;
+int mono_thread_get_abort_signal (void);
-void mono_thread_abort_all_other_threads (void) MONO_INTERNAL;
-void mono_thread_suspend_all_other_threads (void) MONO_INTERNAL;
-gboolean mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout) MONO_INTERNAL;
+void mono_thread_abort_all_other_threads (void);
+void mono_thread_suspend_all_other_threads (void);
+gboolean mono_threads_abort_appdomain_threads (MonoDomain *domain, int timeout);
-void mono_thread_push_appdomain_ref (MonoDomain *domain) MONO_INTERNAL;
-void mono_thread_pop_appdomain_ref (void) MONO_INTERNAL;
-gboolean mono_thread_has_appdomain_ref (MonoThread *thread, MonoDomain *domain) MONO_INTERNAL;
+void mono_thread_push_appdomain_ref (MonoDomain *domain);
+void mono_thread_pop_appdomain_ref (void);
+gboolean mono_thread_has_appdomain_ref (MonoThread *thread, MonoDomain *domain);
-void mono_threads_clear_cached_culture (MonoDomain *domain) MONO_INTERNAL;
+void mono_threads_clear_cached_culture (MonoDomain *domain);
-MonoException* mono_thread_request_interruption (mono_bool running_managed) MONO_INTERNAL;
-gboolean mono_thread_interruption_requested (void) MONO_INTERNAL;
-MonoException* mono_thread_interruption_checkpoint (void) MONO_INTERNAL;
-MonoException* mono_thread_force_interruption_checkpoint_noraise (void) MONO_INTERNAL;
-void mono_thread_force_interruption_checkpoint (void) MONO_INTERNAL;
-gint32* mono_thread_interruption_request_flag (void) MONO_INTERNAL;
+MonoException* mono_thread_request_interruption (mono_bool running_managed);
+gboolean mono_thread_interruption_requested (void);
+MonoException* mono_thread_interruption_checkpoint (void);
+MonoException* mono_thread_force_interruption_checkpoint_noraise (void);
+void mono_thread_force_interruption_checkpoint (void);
+gint32* mono_thread_interruption_request_flag (void);
-uint32_t mono_alloc_special_static_data (uint32_t static_type, uint32_t size, uint32_t align, uintptr_t *bitmap, int numbits) MONO_INTERNAL;
-void* mono_get_special_static_data (uint32_t offset) MONO_INTERNAL;
-gpointer mono_get_special_static_data_for_thread (MonoInternalThread *thread, guint32 offset) MONO_INTERNAL;
+uint32_t mono_alloc_special_static_data (uint32_t static_type, uint32_t size, uint32_t align, uintptr_t *bitmap, int numbits);
+void* mono_get_special_static_data (uint32_t offset);
+gpointer mono_get_special_static_data_for_thread (MonoInternalThread *thread, guint32 offset);
-MonoException* mono_thread_resume_interruption (void) MONO_INTERNAL;
-void mono_threads_perform_thread_dump (void) MONO_INTERNAL;
-MonoThread *mono_thread_attach_full (MonoDomain *domain, gboolean force_attach) MONO_INTERNAL;
+MonoException* mono_thread_resume_interruption (void);
+void mono_threads_perform_thread_dump (void);
+MonoThread *mono_thread_attach_full (MonoDomain *domain, gboolean force_attach);
-void mono_thread_init_tls (void) MONO_INTERNAL;
+void mono_thread_init_tls (void);
/* Can't include utils/mono-threads.h because of the THREAD_INFO_TYPE wizardry */
-void mono_threads_add_joinable_thread (gpointer tid) MONO_INTERNAL;
-void mono_threads_join_threads (void) MONO_INTERNAL;
-void mono_thread_join (gpointer tid) MONO_INTERNAL;
+void mono_threads_add_joinable_thread (gpointer tid);
+void mono_threads_join_threads (void);
+void mono_thread_join (gpointer tid);
-void mono_thread_detach_internal (MonoInternalThread *thread) MONO_INTERNAL;
+void mono_thread_detach_internal (MonoInternalThread *thread);
#endif /* _MONO_METADATA_THREADS_TYPES_H_ */
return FALSE;
}
-static void
-print_thread_dump (MonoInternalThread *thread, MonoThreadInfo *info)
+static SuspendThreadResult
+print_thread_dump (MonoThreadInfo *info, gpointer ud)
{
+ MonoInternalThread *thread = ud;
GString* text = g_string_new (0);
char *name;
GError *error = NULL;
#endif
#endif
- mono_get_eh_callbacks ()->mono_walk_stack_with_state (print_stack_frame_to_string, &info->suspend_state, MONO_UNWIND_SIGNAL_SAFE, text);
- mono_thread_info_finish_suspend_and_resume (info);
+ mono_get_eh_callbacks ()->mono_walk_stack_with_state (print_stack_frame_to_string, mono_thread_info_get_suspend_state (info), MONO_UNWIND_SIGNAL_SAFE, text);
fprintf (stdout, "%s", text->str);
g_string_free (text, TRUE);
fflush (stdout);
+ return ResumeThread;
}
static void
dump_thread (gpointer key, gpointer value, gpointer user)
{
MonoInternalThread *thread = (MonoInternalThread *)value;
- MonoThreadInfo *info;
if (thread == mono_thread_internal_current ())
return;
We probably should loop a bit around trying to get it to either managed code
or WSJ state.
*/
- info = mono_thread_info_safe_suspend_sync ((MonoNativeThreadId)(gpointer)(gsize)thread->tid, FALSE);
-
- if (!info)
- return;
-
- print_thread_dump (thread, info);
+ mono_thread_info_safe_suspend_and_run ((MonoNativeThreadId)(gsize)thread->tid, FALSE, print_thread_dump, thread);
}
void
MonoThreadInfo *info = mono_thread_info_current ();
MonoException *exc = mono_thread_execute_interruption (mono_thread_internal_current ());
if (exc) /*We must use _with_context since we didn't trampoline into the runtime*/
- mono_raise_exception_with_context (exc, &info->suspend_state.ctx);
+ mono_raise_exception_with_context (exc, &info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx); /* FIXME using thread_saved_state [ASYNC_SUSPEND_STATE_INDEX] can race with another suspend coming in. */
g_assert_not_reached (); /*this MUST not happen since we can't resume from an async call*/
}
MonoJitInfo *ji = NULL;
if (!info)
return NULL;
- mono_get_eh_callbacks ()->mono_walk_stack_with_state (last_managed, &info->suspend_state, MONO_UNWIND_SIGNAL_SAFE, &ji);
+ mono_get_eh_callbacks ()->mono_walk_stack_with_state (last_managed, mono_thread_info_get_suspend_state (info), MONO_UNWIND_SIGNAL_SAFE, &ji);
return ji;
}
-static void
-abort_thread_internal (MonoInternalThread *thread, gboolean can_raise_exception, gboolean install_async_abort)
+typedef struct {
+ MonoInternalThread *thread;
+ gboolean install_async_abort;
+ gpointer interrupt_handle;
+} AbortThreadData;
+
+static SuspendThreadResult
+abort_thread_critical (MonoThreadInfo *info, gpointer ud)
{
- MonoJitInfo *ji;
- MonoThreadInfo *info = NULL;
+ AbortThreadData *data = ud;
+ MonoInternalThread *thread = data->thread;
+ MonoJitInfo *ji = NULL;
gboolean protected_wrapper;
gboolean running_managed;
- if (!mono_thread_info_new_interrupt_enabled ()) {
- signal_thread_state_change (thread);
- return;
- }
-
- /*
- FIXME this is insanely broken, it doesn't cause interruption to happen
- synchronously since passing FALSE to mono_thread_request_interruption makes sure it returns NULL
- */
- if (thread == mono_thread_internal_current ()) {
- /* Do it synchronously */
- MonoException *exc = mono_thread_request_interruption (can_raise_exception);
- if (exc)
- mono_raise_exception (exc);
- mono_thread_info_interrupt (thread->handle);
- return;
- }
-
- /*FIXME we need to check 2 conditions here, request to interrupt this thread or if the target died*/
- if (!(info = mono_thread_info_safe_suspend_sync ((MonoNativeThreadId)(gsize)thread->tid, TRUE))) {
- return;
- }
-
- if (mono_get_eh_callbacks ()->mono_install_handler_block_guard (&info->suspend_state)) {
- mono_thread_info_finish_suspend_and_resume (info);
- return;
- }
+ if (mono_get_eh_callbacks ()->mono_install_handler_block_guard (mono_thread_info_get_suspend_state (info)))
+ return ResumeThread;
/*someone is already interrupting it*/
- if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 1) {
- mono_thread_info_finish_suspend_and_resume (info);
- return;
- }
+ if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 1)
+ return ResumeThread;
+
InterlockedIncrement (&thread_interruption_requested);
ji = mono_thread_info_get_last_managed (info);
protected_wrapper = ji && mono_threads_is_critical_method (mono_jit_info_get_method (ji));
- running_managed = mono_jit_info_match (ji, MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
+ running_managed = mono_jit_info_match (ji, MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx));
if (!protected_wrapper && running_managed) {
/*We are in managed code*/
/*Set the thread to call */
- if (install_async_abort)
+ if (data->install_async_abort)
mono_thread_info_setup_async_call (info, self_interrupt_thread, NULL);
- mono_thread_info_finish_suspend_and_resume (info);
+ return ResumeThread;
} else {
+ if (mono_thread_notify_pending_exc_fn)
+ /* The JIT will notify the thread about the interruption */
+ mono_thread_notify_pending_exc_fn (info);
+
/*
* This will cause waits to be broken.
* It will also prevent the thread from entering a wait, so if the thread returns
* functions in the io-layer until the signal handler calls QueueUserAPC which will
* make it return.
*/
- gpointer interrupt_handle;
+ data->interrupt_handle = mono_thread_info_prepare_interrupt (thread->handle);
+ return ResumeThread;
+ }
+}
- if (mono_thread_notify_pending_exc_fn)
- /* The JIT will notify the thread about the interruption */
- mono_thread_notify_pending_exc_fn (info);
+static void
+abort_thread_internal (MonoInternalThread *thread, gboolean can_raise_exception, gboolean install_async_abort)
+{
+ AbortThreadData data = { 0 };
+ data.thread = thread;
+ data.install_async_abort = install_async_abort;
- interrupt_handle = mono_thread_info_prepare_interrupt (thread->handle);
- mono_thread_info_finish_suspend_and_resume (info);
- mono_thread_info_finish_interrupt (interrupt_handle);
+ if (!mono_thread_info_new_interrupt_enabled ()) {
+ signal_thread_state_change (thread);
+ return;
}
+
+ /*
+ FIXME this is insanely broken, it doesn't cause interruption to happen
+ synchronously since passing FALSE to mono_thread_request_interruption makes sure it returns NULL
+ */
+ if (thread == mono_thread_internal_current ()) {
+ /* Do it synchronously */
+ MonoException *exc = mono_thread_request_interruption (can_raise_exception);
+ if (exc)
+ mono_raise_exception (exc);
+ mono_thread_info_interrupt (thread->handle);
+ return;
+ }
+
+ mono_thread_info_safe_suspend_and_run ((MonoNativeThreadId)(gsize)thread->tid, TRUE, abort_thread_critical, &data);
+ if (data.interrupt_handle)
+ mono_thread_info_finish_interrupt (data.interrupt_handle);
/*FIXME we need to wait for interruption to complete -- figure out how much into interruption we should wait for here*/
}
-static void
-transition_to_suspended (MonoInternalThread *thread, MonoThreadInfo *info)
+typedef struct{
+ MonoInternalThread *thread;
+ gboolean interrupt;
+ gpointer interrupt_handle;
+} SuspendThreadData;
+
+static SuspendThreadResult
+suspend_thread_critical (MonoThreadInfo *info, gpointer ud)
{
- if ((thread->state & ThreadState_SuspendRequested) == 0) {
- g_assert (0); /*FIXME we should not reach this */
- /*Make sure we balance the suspend count.*/
- if (info)
- mono_thread_info_finish_suspend_and_resume (info);
- } else {
+ SuspendThreadData *data = ud;
+ MonoInternalThread *thread = data->thread;
+ MonoJitInfo *ji = NULL;
+ gboolean protected_wrapper;
+ gboolean running_managed;
+
+ ji = mono_thread_info_get_last_managed (info);
+ protected_wrapper = ji && !ji->async && mono_threads_is_critical_method (mono_jit_info_get_method (ji));
+ running_managed = mono_jit_info_match (ji, MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx));
+
+ if (running_managed && !protected_wrapper) {
thread->state &= ~ThreadState_SuspendRequested;
thread->state |= ThreadState_Suspended;
- if (info)
- mono_thread_info_finish_suspend (info);
+ return KeepSuspended;
+ } else {
+ if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 0)
+ InterlockedIncrement (&thread_interruption_requested);
+ if (data->interrupt)
+ data->interrupt_handle = mono_thread_info_prepare_interrupt (thread->handle);
+
+ if (mono_thread_notify_pending_exc_fn && !running_managed)
+ /* The JIT will notify the thread about the interruption */
+ mono_thread_notify_pending_exc_fn (info);
+ return ResumeThread;
}
- UNLOCK_THREAD (thread);
}
-
+
static void
suspend_thread_internal (MonoInternalThread *thread, gboolean interrupt)
{
LOCK_THREAD (thread);
if (thread == mono_thread_internal_current ()) {
- transition_to_suspended (thread, NULL);
- mono_thread_info_self_suspend ();
+ mono_thread_info_begin_self_suspend ();
+ //XXX replace this with better named functions
+ thread->state &= ~ThreadState_SuspendRequested;
+ thread->state |= ThreadState_Suspended;
+ UNLOCK_THREAD (thread);
+ mono_thread_info_end_self_suspend ();
} else {
- MonoThreadInfo *info;
- MonoJitInfo *ji;
- gboolean protected_wrapper;
- gboolean running_managed;
-
- /*A null info usually means the thread is already dead. */
- if (!(info = mono_thread_info_safe_suspend_sync ((MonoNativeThreadId)(gsize)thread->tid, interrupt))) {
- UNLOCK_THREAD (thread);
- return;
- }
+ SuspendThreadData data = { 0 };
+ data.thread = thread;
+ data.interrupt = interrupt;
- ji = mono_thread_info_get_last_managed (info);
- protected_wrapper = ji && mono_threads_is_critical_method (mono_jit_info_get_method (ji));
- running_managed = mono_jit_info_match (ji, MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
-
- if (running_managed && !protected_wrapper) {
- transition_to_suspended (thread, info);
- } else {
- gpointer interrupt_handle;
-
- if (InterlockedCompareExchange (&thread->interruption_requested, 1, 0) == 0)
- InterlockedIncrement (&thread_interruption_requested);
- if (interrupt)
- interrupt_handle = mono_thread_info_prepare_interrupt (thread->handle);
- if (mono_thread_notify_pending_exc_fn && !running_managed)
- /* The JIT will notify the thread about the interruption */
- mono_thread_notify_pending_exc_fn (info);
- mono_thread_info_finish_suspend_and_resume (info);
- if (interrupt)
- mono_thread_info_finish_interrupt (interrupt_handle);
- UNLOCK_THREAD (thread);
- }
+ mono_thread_info_safe_suspend_and_run ((MonoNativeThreadId)(gsize)thread->tid, interrupt, suspend_thread_critical, &data);
+ if (data.interrupt_handle)
+ mono_thread_info_finish_interrupt (data.interrupt_handle);
+ UNLOCK_THREAD (thread);
}
}
return;
}
- transition_to_suspended (thread, NULL);
- mono_thread_info_self_suspend ();
+ mono_thread_info_begin_self_suspend ();
+ thread->state &= ~ThreadState_SuspendRequested;
+ thread->state |= ThreadState_Suspended;
+ UNLOCK_THREAD (thread);
+ mono_thread_info_end_self_suspend ();
}
/*This is called with @thread synch_cs held and it must release it*/
SocketIOData *socket_io_data;
tp_poll_data *data;
char msg [1];
- int unused;
+ int unused G_GNUC_UNUSED;
socket_io_data = p;
data = socket_io_data->event_data;
MONO_VERIFIER_MODE_STRICT
} MiniVerifierMode;
-void mono_verifier_set_mode (MiniVerifierMode mode) MONO_INTERNAL;
-void mono_verifier_enable_verify_all (void) MONO_INTERNAL;
-
-gboolean mono_verifier_is_enabled_for_image (MonoImage *image) MONO_INTERNAL;
-gboolean mono_verifier_is_enabled_for_method (MonoMethod *method) MONO_INTERNAL;
-gboolean mono_verifier_is_enabled_for_class (MonoClass *klass) MONO_INTERNAL;
-
-gboolean mono_verifier_is_method_full_trust (MonoMethod *method) MONO_INTERNAL;
-gboolean mono_verifier_is_class_full_trust (MonoClass *klass) MONO_INTERNAL;
-gboolean mono_verifier_class_is_valid_generic_instantiation (MonoClass *klass) MONO_INTERNAL;
-gboolean mono_verifier_is_method_valid_generic_instantiation (MonoMethod *method) MONO_INTERNAL;
-
-gboolean mono_verifier_verify_class (MonoClass *klass) MONO_INTERNAL;
-
-GSList* mono_method_verify_with_current_settings (MonoMethod *method, gboolean skip_visibility, gboolean is_fulltrust) MONO_INTERNAL;
-
-gboolean mono_verifier_verify_pe_data (MonoImage *image, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_cli_data (MonoImage *image, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_table_data (MonoImage *image, GSList **error_list) MONO_INTERNAL;
-
-gboolean mono_verifier_verify_full_table_data (MonoImage *image, GSList **error_list) MONO_INTERNAL;
-
-gboolean mono_verifier_verify_field_signature (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_method_header (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_method_signature (MonoImage *image, guint32 offset, MonoError *error) MONO_INTERNAL;
-gboolean mono_verifier_verify_standalone_signature (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_typespec_signature (MonoImage *image, guint32 offset, guint32 token, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_methodspec_signature (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_string_signature (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_cattr_blob (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_cattr_content (MonoImage *image, MonoMethod *ctor, const guchar *data, guint32 size, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_is_sig_compatible (MonoImage *image, MonoMethod *method, MonoMethodSignature *signature) MONO_INTERNAL;
-gboolean mono_verifier_verify_memberref_method_signature (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-gboolean mono_verifier_verify_memberref_field_signature (MonoImage *image, guint32 offset, GSList **error_list) MONO_INTERNAL;
-
-gboolean mono_verifier_verify_typeref_row (MonoImage *image, guint32 row, MonoError *error) MONO_INTERNAL;
-gboolean mono_verifier_verify_methodimpl_row (MonoImage *image, guint32 row, MonoError *error) MONO_INTERNAL;
-gboolean mono_verifier_is_signature_compatible (MonoMethodSignature *target, MonoMethodSignature *candidate) MONO_INTERNAL;
+void mono_verifier_set_mode (MiniVerifierMode mode);
+void mono_verifier_enable_verify_all (void);
+
+gboolean mono_verifier_is_enabled_for_image (MonoImage *image);
+gboolean mono_verifier_is_enabled_for_method (MonoMethod *method);
+gboolean mono_verifier_is_enabled_for_class (MonoClass *klass);
+
+gboolean mono_verifier_is_method_full_trust (MonoMethod *method);
+gboolean mono_verifier_is_class_full_trust (MonoClass *klass);
+gboolean mono_verifier_class_is_valid_generic_instantiation (MonoClass *klass);
+gboolean mono_verifier_is_method_valid_generic_instantiation (MonoMethod *method);
+
+gboolean mono_verifier_verify_class (MonoClass *klass);
+
+GSList* mono_method_verify_with_current_settings (MonoMethod *method, gboolean skip_visibility, gboolean is_fulltrust);
+
+gboolean mono_verifier_verify_pe_data (MonoImage *image, GSList **error_list);
+gboolean mono_verifier_verify_cli_data (MonoImage *image, GSList **error_list);
+gboolean mono_verifier_verify_table_data (MonoImage *image, GSList **error_list);
+
+gboolean mono_verifier_verify_full_table_data (MonoImage *image, GSList **error_list);
+
+gboolean mono_verifier_verify_field_signature (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_method_header (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_method_signature (MonoImage *image, guint32 offset, MonoError *error);
+gboolean mono_verifier_verify_standalone_signature (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_typespec_signature (MonoImage *image, guint32 offset, guint32 token, GSList **error_list);
+gboolean mono_verifier_verify_methodspec_signature (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_string_signature (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_cattr_blob (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_cattr_content (MonoImage *image, MonoMethod *ctor, const guchar *data, guint32 size, GSList **error_list);
+gboolean mono_verifier_is_sig_compatible (MonoImage *image, MonoMethod *method, MonoMethodSignature *signature);
+gboolean mono_verifier_verify_memberref_method_signature (MonoImage *image, guint32 offset, GSList **error_list);
+gboolean mono_verifier_verify_memberref_field_signature (MonoImage *image, guint32 offset, GSList **error_list);
+
+gboolean mono_verifier_verify_typeref_row (MonoImage *image, guint32 row, MonoError *error);
+gboolean mono_verifier_verify_methodimpl_row (MonoImage *image, guint32 row, MonoError *error);
+gboolean mono_verifier_is_signature_compatible (MonoMethodSignature *target, MonoMethodSignature *candidate);
G_END_DECLS
#endif /* __MONO_METADATA_VERIFY_INTERNAL_H__ */
return FALSE;
break;
}
+ default:
+ break;
}
return TRUE;
}
* is it a "class Foo<T>" or a "struct Foo<T>"?
*/
return !arg->type->data.generic_class->container_class->valuetype;
+ default:
+ return FALSE;
}
default:
return FALSE;
case MONO_TYPE_PTR:
case MONO_TYPE_TYPEDBYREF:
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Invalid value for %s at 0x%04x", opcode, ctx->ip_offset));
+ default:
+ break;
}
do_box = is_boxed || mono_type_is_generic_argument(type) || mono_class_from_mono_type (type)->valuetype;
static void
do_localloc (VerifyContext *ctx)
{
- ILStackDesc *top;
-
if (ctx->eval.size != 1) {
ADD_VERIFY_ERROR (ctx, g_strdup_printf ("Stack must have only size item in localloc at 0x%04x", ctx->ip_offset));
return;
}
/*TODO verify top type*/
- top = stack_pop (ctx);
+ /* top = */ stack_pop (ctx);
set_stack_value (ctx, stack_push (ctx), &mono_defaults.int_class->byval_arg, FALSE);
CODE_NOT_VERIFIABLE (ctx, g_strdup_printf ("Instruction localloc in never verifiable at 0x%04x", ctx->ip_offset));
MonoSimpleBasicBlock *bb = NULL, *original_bb = NULL;
int i, n, need_merge = 0, start = 0;
- guint token, ip_offset = 0, prefix = 0;
+ guint ip_offset = 0, prefix = 0;
MonoGenericContext *generic_context = NULL;
MonoImage *image;
VerifyContext ctx;
code_bounds_check (5);
if (ctx.eval.size)
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Eval stack must be empty in jmp at 0x%04x", ip_offset));
- token = read32 (ip + 1);
+ /* token = read32 (ip + 1); */
if (in_any_block (ctx.header, ip_offset))
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("jmp cannot escape exception blocks at 0x%04x", ip_offset));
case CEE_CALLI:
code_bounds_check (5);
- token = read32 (ip + 1);
+ /* token = read32 (ip + 1); */
/*
* FIXME: check signature, retval, arguments etc.
* FIXME: check requirements for tail call
# hack for automake to have the same source file in a library and a bin
genmdesc_CFLAGS = $(AM_CFLAGS)
-if NO_VERSION_SCRIPT
monoldflags=$(export_ldflags)
monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
-else
-monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
-monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags) $(extra_runtime_ldflags)
-endif
if HOST_WIN32
libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
exit $$(cat regressionexitcode.out)
endif
+rcheck2: mono $(regtests)
+ $(RUNTIME) --regression $(regtests)
+
check-seq-points: mono $(regtests)
rm -f TestResults_op_il_seq_point.xml
for i in $(regtests); do ./test_op_il_seq_point.sh $$i || (./test_op_il_seq_point_headerfooter.sh; exit 1) || exit 1; done
BUILT_SOURCES = version.h $(arch_built)
CLEANFILES= $(BUILT_SOURCES) *.exe *.dll
-EXTRA_DIST = TestDriver.cs ldscript ldscript.mono \
+EXTRA_DIST = TestDriver.cs \
genmdesc.pl \
$(test_sources) \
$(x86_sources) cpu-x86.md \
gboolean soft_debug;
gboolean log_generics;
gboolean log_instances;
+ gboolean gen_seq_points_file;
gboolean direct_pinvoke;
gboolean direct_icalls;
gboolean no_direct_calls;
va_end (args);
}
-/* Wrappers around the image writer functions */
-
-static inline void
-emit_section_change (MonoAotCompile *acfg, const char *section_name, int subsection_index)
+static void
+report_loader_error (MonoAotCompile *acfg, MonoError *error, const char *format, ...)
{
- img_writer_emit_section_change (acfg->w, section_name, subsection_index);
-}
+ FILE *output;
+ va_list args;
-static inline void
-emit_push_section (MonoAotCompile *acfg, const char *section_name, int subsection)
-{
- img_writer_emit_push_section (acfg->w, section_name, subsection);
+ if (mono_error_ok (error))
+ return;
+
+ if (acfg->logfile)
+ output = acfg->logfile;
+ else
+ output = stderr;
+
+ va_start (args, format);
+ vfprintf (output, format, args);
+ va_end (args);
+ mono_error_cleanup (error);
+
+ g_error ("FullAOT cannot continue if there are loader errors");
}
+/* Wrappers around the image writer functions */
+
static inline void
-emit_pop_section (MonoAotCompile *acfg)
+emit_section_change (MonoAotCompile *acfg, const char *section_name, int subsection_index)
{
- img_writer_emit_pop_section (acfg->w);
+ img_writer_emit_section_change (acfg->w, section_name, subsection_index);
}
static inline void
}
}
-static inline void
-emit_pointer_unaligned (MonoAotCompile *acfg, const char *target)
-{
- img_writer_emit_pointer_unaligned (acfg->w, target);
-}
-
static inline void
emit_pointer (MonoAotCompile *acfg, const char *target)
{
encode_value (container ? 1 : 0, p, &p);
if (container) {
encode_value (container->is_method, p, &p);
- g_assert (par->serial == 0);
+ g_assert (par->gshared_constraint == 0);
if (container->is_method)
encode_method_ref (acfg, container->owner.method, p, &p);
else
encode_klass_ref (acfg, container->owner.klass, p, &p);
} else {
- encode_value (par->serial, p, &p);
+ encode_value (par->gshared_constraint, p, &p);
}
} else if (klass->byval_arg.type == MONO_TYPE_PTR) {
encode_value (MONO_AOT_TYPEREF_PTR, p, &p);
* callers.
*/
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
+ MonoError error;
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
gboolean skip = FALSE;
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
+ report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
(method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
/* Synchronized wrappers */
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
+ MonoError error;
token = MONO_TOKEN_METHOD_DEF | (i + 1);
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
+ report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
if (method->is_generic) {
/* pinvoke wrappers */
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
+ MonoError error;
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
+ report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
(method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL)) {
/* native-to-managed wrappers */
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
+ MonoError error;
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
MonoCustomAttrInfo *cattr;
int j;
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
+ report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
/*
* Only generate native-to-managed wrappers for methods which have an
MonoMethodSignature *sig = mono_method_signature (e->ctor);
const char *p = (const char*)e->data;
const char *named;
- int slen, num_named, named_type, data_type;
+ int slen, num_named, named_type;
char *n;
MonoType *t;
MonoClass *klass;
if (num_named == 1) {
int name_len;
char *name;
- MonoType *prop_type;
/* parse ExportSymbol attribute */
named = p;
named_type = *named;
named += 1;
- data_type = *named;
+ /* data_type = *named; */
named += 1;
name_len = mono_metadata_decode_blob_size (named, &named);
g_assert (named_type == 0x54);
g_assert (!strcmp (name, "ExportSymbol"));
- prop_type = &mono_defaults.string_class->byval_arg;
-
/* load_cattr_value (), string case */
g_assert (*named != (char)0xff);
slen = mono_metadata_decode_value (named, &named);
return;
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHODSPEC].rows; ++i) {
+ MonoError error;
token = MONO_TOKEN_METHOD_SPEC | (i + 1);
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
- if (!method)
+ if (!method) {
+ aot_printerrf (acfg, "Failed to load methodspec 0x%x due to %s.\n", token, mono_error_get_message (&error));
+ aot_printerrf (acfg, "Run with MONO_LOG_LEVEL=debug for more information.\n");
+ mono_error_cleanup (&error);
continue;
+ }
if (method->klass->image != acfg->image)
continue;
static void
emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, guint32 code_len, MonoJumpInfo *relocs, gboolean got_only, MonoDebugMethodJitInfo *debug_info)
{
- int i, pindex, start_index, method_index;
+ int i, pindex, start_index;
GPtrArray *patches;
MonoJumpInfo *patch_info;
- MonoMethodHeader *header;
MonoDebugSourceLocation **locs = NULL;
gboolean skip;
#ifdef MONO_ARCH_AOT_SUPPORTED
const char *direct_pinvoke;
#endif
- if (method) {
- header = mono_method_get_header (method);
-
- method_index = get_method_index (acfg, method);
- }
-
if (acfg->gas_line_numbers && method && debug_info) {
locs = compute_line_numbers (method, code_len, debug_info);
if (!locs) {
char *debug_sym = NULL;
char *symbol = NULL;
int func_alignment = AOT_FUNC_ALIGNMENT;
- MonoMethodHeader *header;
char *export_name;
method = cfg->orig_method;
code = cfg->native_code;
- header = cfg->header;
method_index = get_method_index (acfg, method);
symbol = g_strdup_printf ("%sme_%x", acfg->temp_prefix, method_index);
}
case MONO_PATCH_INFO_LDSTR_LIT: {
const char *s = patch_info->data.target;
+ int len = strlen (s);
- encode_value (strlen (s), p, &p);
- memcpy (p, s, strlen (s) + 1);
+ encode_value (len, p, &p);
+ memcpy (p, s, len + 1);
+ p += len + 1;
break;
}
default:
int pindex, buf_size, n_patches;
GPtrArray *patches;
MonoJumpInfo *patch_info;
- MonoMethodHeader *header;
guint32 method_index;
guint8 *p, *buf;
guint32 first_got_offset;
method = cfg->orig_method;
- header = mono_method_get_header (method);
method_index = get_method_index (acfg, method);
}
static void
-emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg)
+emit_exception_debug_info (MonoAotCompile *acfg, MonoCompile *cfg, gboolean store_seq_points)
{
- MonoMethod *method;
- int i, k, buf_size, method_index;
+ int i, k, buf_size;
guint32 debug_info_size, seq_points_size;
guint8 *code;
MonoMethodHeader *header;
gboolean use_unwind_ops = FALSE;
MonoSeqPointInfo *seq_points;
- method = cfg->orig_method;
code = cfg->native_code;
header = cfg->header;
- method_index = get_method_index (acfg, method);
-
if (!acfg->aot_opts.nodebug) {
mono_debug_serialize_debug_info (cfg, &debug_info, &debug_info_size);
} else {
}
seq_points = cfg->seq_point_info;
-
- seq_points_size = (cfg->gen_seq_points)? seq_point_info_get_write_size (seq_points) : 0;
+ seq_points_size = (store_seq_points)? seq_point_info_get_write_size (seq_points) : 0;
buf_size = header->num_clauses * 256 + debug_info_size + 2048 + seq_points_size + cfg->gc_map_size;
+
p = buf = g_malloc (buf_size);
use_unwind_ops = cfg->unwind_ops != NULL;
- flags = (jinfo->has_generic_jit_info ? 1 : 0) | (use_unwind_ops ? 2 : 0) | (header->num_clauses ? 4 : 0) | (seq_points ? 8 : 0) | (cfg->compile_llvm ? 16 : 0) | (jinfo->has_try_block_holes ? 32 : 0) | (cfg->gc_map ? 64 : 0) | (jinfo->has_arch_eh_info ? 128 : 0);
+ flags = (jinfo->has_generic_jit_info ? 1 : 0) | (use_unwind_ops ? 2 : 0) | (header->num_clauses ? 4 : 0) | (seq_points_size ? 8 : 0) | (cfg->compile_llvm ? 16 : 0) | (jinfo->has_try_block_holes ? 32 : 0) | (cfg->gc_map ? 64 : 0) | (jinfo->has_arch_eh_info ? 128 : 0);
encode_value (flags, p, &p);
if (jinfo->has_generic_jit_info) {
MonoGenericJitInfo *gi = mono_jit_info_get_generic_jit_info (jinfo);
MonoGenericSharingContext* gsctx = gi->generic_sharing_context;
- guint8 *p1;
guint8 *buf2, *p2;
int len;
- p1 = p;
encode_value (gi->nlocs, p, &p);
if (gi->nlocs) {
for (i = 0; i < gi->nlocs; ++i) {
}
}
- if (seq_points)
+ if (seq_points_size)
p += seq_point_info_write (seq_points, p);
g_assert (debug_info_size < buf_size);
for (i = 0; i < acfg->plt_offset; ++i) {
char *debug_sym = NULL;
MonoPltEntry *plt_entry = NULL;
- MonoJumpInfo *ji;
if (i == 0)
/*
continue;
plt_entry = g_hash_table_lookup (acfg->plt_offset_to_entry, GUINT_TO_POINTER (i));
- ji = plt_entry->ji;
debug_sym = plt_entry->debug_sym;
for (i = 0; i < acfg->plt_offset; ++i) {
char *debug_sym = NULL;
MonoPltEntry *plt_entry = NULL;
- MonoJumpInfo *ji;
if (i == 0)
continue;
plt_entry = g_hash_table_lookup (acfg->plt_offset_to_entry, GUINT_TO_POINTER (i));
- ji = plt_entry->ji;
/* Skip plt entries not actually called by LLVM code */
if (!plt_entry->llvm_used)
opts->ld_flags = g_strdup (arg + strlen ("ld-flags="));
} else if (str_begins_with (arg, "soft-debug")) {
opts->soft_debug = TRUE;
+ } else if (str_begins_with (arg, "gen-seq-points-file")) {
+ opts->gen_seq_points_file = TRUE;
} else if (str_begins_with (arg, "direct-pinvoke")) {
opts->direct_pinvoke = TRUE;
} else if (str_begins_with (arg, "direct-icalls")) {
opts->mtriple = g_strdup (arg + strlen ("mtriple="));
} else if (str_begins_with (arg, "llvm-path=")) {
opts->llvm_path = g_strdup (arg + strlen ("llvm-path="));
+ if (!g_str_has_suffix (opts->llvm_path, G_DIR_SEPARATOR_S)) {
+ gchar *old = opts->llvm_path;
+ opts->llvm_path = g_strconcat (opts->llvm_path, G_DIR_SEPARATOR_S, NULL);
+ g_free (old);
+ }
} else if (!strcmp (arg, "llvm")) {
opts->llvm = TRUE;
} else if (str_begins_with (arg, "readonly-value=")) {
printf (" tool-prefix=\n");
printf (" readonly-value=\n");
printf (" soft-debug\n");
+ printf (" gen-seq-points-file\n");
printf (" gc-maps\n");
printf (" print-skipped\n");
printf (" no-instances\n");
return res;
}
+static int
+execute_system (const char * command)
+{
+ int status;
+
+#if _WIN32
+ // We need an extra set of quotes around the whole command to properly handle commands
+ // with spaces since internally the command is called through "cmd /c.
+ command = g_strdup_printf ("\"%s\"", command);
+
+ int size = MultiByteToWideChar (CP_UTF8, 0 , command , -1, NULL , 0);
+ wchar_t* wstr = g_malloc (sizeof (wchar_t) * size);
+ MultiByteToWideChar (CP_UTF8, 0, command, -1, wstr , size);
+ status = _wsystem (wstr);
+ g_free (wstr);
+
+ g_free (command);
+#else
+ status = system (command);
+#endif
+
+ return status;
+}
+
#ifdef ENABLE_LLVM
/*
*/
opts = g_strdup ("-targetlibinfo -no-aa -basicaa -notti -instcombine -simplifycfg -inline-cost -inline -sroa -domtree -early-cse -lazy-value-info -correlated-propagation -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -indvars -loop-idiom -loop-deletion -loop-unroll -memdep -gvn -memdep -memcpyopt -sccp -instcombine -lazy-value-info -correlated-propagation -domtree -memdep -adce -simplifycfg -instcombine -strip-dead-prototypes -domtree -verify");
#if 1
- command = g_strdup_printf ("%sopt -f %s -o \"%s.opt.bc\" \"%s.bc\"", acfg->aot_opts.llvm_path, opts, acfg->tmpbasename, acfg->tmpbasename);
+ command = g_strdup_printf ("\"%sopt\" -f %s -o \"%s.opt.bc\" \"%s.bc\"", acfg->aot_opts.llvm_path, opts, acfg->tmpbasename, acfg->tmpbasename);
aot_printf (acfg, "Executing opt: %s\n", command);
- if (system (command) != 0)
+ if (execute_system (command) != 0)
return FALSE;
#endif
g_free (opts);
} else {
output_fname = g_strdup (acfg->tmpfname);
}
- command = g_strdup_printf ("%sllc %s -o \"%s\" \"%s.opt.bc\"", acfg->aot_opts.llvm_path, acfg->llc_args->str, output_fname, acfg->tmpbasename);
+ command = g_strdup_printf ("\"%sllc\" %s -o \"%s\" \"%s.opt.bc\"", acfg->aot_opts.llvm_path, acfg->llc_args->str, output_fname, acfg->tmpbasename);
aot_printf (acfg, "Executing llc: %s\n", command);
- if (system (command) != 0)
+ if (execute_system (command) != 0)
return FALSE;
return TRUE;
}
int i;
char symbol [256];
gint32 *offsets;
+ SeqPointData sp_data;
+ gboolean seq_points_to_file = FALSE;
offsets = g_new0 (gint32, acfg->nmethods);
for (i = 0; i < acfg->nmethods; ++i) {
if (acfg->cfgs [i]) {
- emit_exception_debug_info (acfg, acfg->cfgs [i]);
- offsets [i] = acfg->cfgs [i]->ex_info_offset;
+ MonoCompile *cfg = acfg->cfgs [i];
+
+ // By design aot-runtime decode_exception_debug_info is not able to load sequence point debug data from a file.
+ // As it is not possible to load debug data from a file its is also not possible to store it in a file.
+ gboolean method_seq_points_to_file = acfg->aot_opts.gen_seq_points_file &&
+ cfg->gen_seq_points && !cfg->gen_seq_points_debug_data;
+ gboolean method_seq_points_to_binary = cfg->gen_seq_points && !method_seq_points_to_file;
+
+ emit_exception_debug_info (acfg, cfg, method_seq_points_to_binary);
+ offsets [i] = cfg->ex_info_offset;
+
+ if (method_seq_points_to_file) {
+ if (!seq_points_to_file) {
+ seq_point_data_init (&sp_data, acfg->nmethods);
+ seq_points_to_file = TRUE;
+ }
+ seq_point_data_add (&sp_data, cfg->method->token, cfg->seq_point_info);
+ }
} else {
offsets [i] = 0;
}
}
+ if (seq_points_to_file) {
+ char *seq_points_aot_file;
+ mono_image_get_aot_seq_point_path (acfg->image, &seq_points_aot_file);
+ seq_point_data_write (&sp_data, seq_points_aot_file);
+ seq_point_data_free (&sp_data);
+ g_free (seq_points_aot_file);
+ }
+
sprintf (symbol, "ex_info_offsets");
emit_section_change (acfg, RODATA_SECT, 1);
emit_alignment (acfg, 8);
/* Collect methods */
for (i = 0; i < image->tables [MONO_TABLE_METHOD].rows; ++i) {
+ MonoError error;
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
if (!method) {
- aot_printerrf (acfg, "Failed to load method 0x%x from '%s'.\n", token, image->name);
+ aot_printerrf (acfg, "Failed to load method 0x%x from '%s' due to %s.\n", token, image->name, mono_error_get_message (&error));
aot_printerrf (acfg, "Run with MONO_LOG_LEVEL=debug for more information.\n");
+ mono_error_cleanup (&error);
return FALSE;
}
/* gsharedvt methods */
for (mindex = 0; mindex < image->tables [MONO_TABLE_METHOD].rows; ++mindex) {
+ MonoError error;
MonoMethod *method;
guint32 token = MONO_TOKEN_METHOD_DEF | (mindex + 1);
if (!(acfg->opts & MONO_OPT_GSHAREDVT))
continue;
- method = mono_get_method (acfg->image, token, NULL);
- if (!method)
- continue;
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
+ report_loader_error (acfg, &error, "Failed to load method token 0x%x due to %s\n", i, mono_error_get_message (&error));
+
/*
if (strcmp (method->name, "gshared2"))
continue;
#define AS_NAME "nacl-as"
#endif
#elif defined(TARGET_OSX)
-#define AS_NAME "clang -c -x assembler"
+#define AS_NAME "clang"
#else
#define AS_NAME "as"
#endif
#define LD_NAME "gcc -dynamiclib"
#elif defined(TARGET_AMD64) && defined(TARGET_MACH)
#define LD_NAME "clang --shared"
-#elif defined(HOST_WIN32)
+#elif defined(TARGET_WIN32) && !defined(TARGET_ANDROID)
#define LD_NAME "gcc -shared --dll"
#elif defined(TARGET_X86) && defined(TARGET_MACH) && !defined(__native_client_codegen__)
#define LD_NAME "clang -m32 -dynamiclib"
} else {
objfile = g_strdup_printf ("%s.o", acfg->tmpfname);
}
- command = g_strdup_printf ("%s%s %s %s -o %s %s", tool_prefix, AS_NAME, AS_OPTIONS, acfg->as_args ? acfg->as_args->str : "", objfile, acfg->tmpfname);
+
+#ifdef TARGET_OSX
+ g_string_append (acfg->as_args, "-c -x assembler");
+#endif
+
+ command = g_strdup_printf ("\"%s%s\" %s %s -o %s %s", tool_prefix, AS_NAME, AS_OPTIONS, acfg->as_args ? acfg->as_args->str : "", objfile, acfg->tmpfname);
aot_printf (acfg, "Executing the native assembler: %s\n", command);
- if (system (command) != 0) {
+ if (execute_system (command) != 0) {
g_free (command);
g_free (objfile);
return 1;
}
if (acfg->llvm_separate && !acfg->llvm_owriter) {
- command = g_strdup_printf ("%s%s %s %s -o %s %s", tool_prefix, AS_NAME, AS_OPTIONS, acfg->as_args ? acfg->as_args->str : "", acfg->llvm_ofile, acfg->llvm_sfile);
+ command = g_strdup_printf ("\"%s%s\" %s %s -o %s %s", tool_prefix, AS_NAME, AS_OPTIONS, acfg->as_args ? acfg->as_args->str : "", acfg->llvm_ofile, acfg->llvm_sfile);
aot_printf (acfg, "Executing the native assembler: %s\n", command);
- if (system (command) != 0) {
+ if (execute_system (command) != 0) {
g_free (command);
g_free (objfile);
return 1;
#ifdef LD_NAME
command = g_strdup_printf ("%s -o %s %s %s.o %s", LD_NAME, tmp_outfile_name, llvm_ofile, acfg->tmpfname, ld_flags);
#else
- command = g_strdup_printf ("%sld %s -shared -o %s %s %s.o %s", tool_prefix, LD_OPTIONS, tmp_outfile_name, llvm_ofile,
+ command = g_strdup_printf ("\"%sld\" %s -shared -o %s %s %s.o %s", tool_prefix, LD_OPTIONS, tmp_outfile_name, llvm_ofile,
acfg->tmpfname, ld_flags);
#endif
aot_printf (acfg, "Executing the native linker: %s\n", command);
- if (system (command) != 0) {
+ if (execute_system (command) != 0) {
g_free (tmp_outfile_name);
g_free (outfile_name);
g_free (command);
/*com = g_strdup_printf ("strip --strip-unneeded %s%s", acfg->image->name, MONO_SOLIB_EXT);
printf ("Stripping the binary: %s\n", com);
- system (com);
+ execute_system (com);
g_free (com);*/
#if defined(TARGET_ARM) && !defined(TARGET_MACH)
*/
command = g_strdup_printf ("%sstrip --strip-symbol=\\$a --strip-symbol=\\$d %s", tool_prefix, tmp_outfile_name);
aot_printf (acfg, "Stripping the binary: %s\n", command);
- if (system (command) != 0) {
+ if (execute_system (command) != 0) {
g_free (tmp_outfile_name);
g_free (outfile_name);
g_free (command);
#if defined(TARGET_MACH)
command = g_strdup_printf ("dsymutil %s", outfile_name);
aot_printf (acfg, "Executing dsymutil: %s\n", command);
- if (system (command) != 0) {
+ if (execute_system (command) != 0) {
return 1;
}
#endif
mono_aot_get_offset (guint32 *table, int index)
{
int i, group, ngroups, index_entry_size;
- int start_offset, offset, noffsets, group_size;
+ int start_offset, offset, group_size;
guint8 *data_start, *p;
guint32 *index32 = NULL;
guint16 *index16 = NULL;
- noffsets = table [0];
+ /* noffsets = table [0]; */
group_size = table [1];
ngroups = table [2];
index_entry_size = table [3];
int type = decode_value (p, &p);
int num = decode_value (p, &p);
gboolean has_container = decode_value (p, &p);
- int serial = 0;
+ MonoTypeEnum gshared_constraint = 0;
if (has_container) {
gboolean is_method = decode_value (p, &p);
container = class_def->generic_container;
}
} else {
- serial = decode_value (p, &p);
+ gshared_constraint = decode_value (p, &p);
}
t = g_new0 (MonoType, 1);
t->type = type;
if (container) {
t->data.generic_param = mono_generic_container_get_param (container, num);
- g_assert (serial == 0);
+ g_assert (gshared_constraint == 0);
} else {
/* Anonymous */
MonoGenericParam *par = (MonoGenericParam*)mono_image_alloc0 (module->assembly->image, sizeof (MonoGenericParamFull));
par->num = num;
- par->serial = serial;
+ par->gshared_constraint = gshared_constraint;
// FIXME:
par->image = mono_defaults.corlib;
t->data.generic_param = par;
{
MonoMethodSignature *sig;
guint32 flags;
- int i, param_count, call_conv, gen_param_count = 0;
+ int i, param_count, call_conv;
guint8 *p = buf;
gboolean hasthis, explicit_this, has_gen_params;
call_conv = flags & 0x0F;
if (has_gen_params)
- gen_param_count = decode_value (p, &p);
+ /* gen_param_count = */ decode_value (p, &p);
param_count = decode_value (p, &p);
if (target && param_count != target->param_count)
return NULL;
guint8 *fde, *cie, *code_start, *code_end;
int version, fde_count;
gint32 *table;
- int i, j, pos, left, right, offset, offset1, offset2, code_len, func_encoding;
+ int i, j, pos, left, right, offset, offset1, offset2, code_len;
MonoJitExceptionInfo *ei;
guint32 fde_len, ei_len, nested_len, nindex;
gpointer *type_info;
version = *p;
g_assert (version == 3);
p ++;
- func_encoding = *p;
+ /* func_encoding = *p; */
p ++;
p = ALIGN_PTR_TO (p, 4);
gboolean has_generic_jit_info, has_dwarf_unwind_info, has_clauses, has_seq_points, has_try_block_holes, has_arch_eh_jit_info;
gboolean from_llvm, has_gc_map;
guint8 *p;
- int generic_info_size, try_holes_info_size, num_holes, arch_eh_jit_info_size;
+ int try_holes_info_size, num_holes;
int this_reg = 0, this_offset = 0;
gboolean async;
} else {
unwind_info = decode_value (p, &p);
}
- if (has_generic_jit_info) {
+ if (has_generic_jit_info)
flags |= JIT_INFO_HAS_GENERIC_JIT_INFO;
- generic_info_size = sizeof (MonoGenericJitInfo);
- } else {
- generic_info_size = 0;
- }
if (has_try_block_holes) {
num_holes = decode_value (p, &p);
if (has_arch_eh_jit_info) {
flags |= JIT_INFO_HAS_ARCH_EH_INFO;
- arch_eh_jit_info_size = sizeof (MonoArchEHJitInfo);
/* Overwrite the original code_len which includes alignment padding */
code_len = decode_value (p, &p);
- } else {
- arch_eh_jit_info_size = 0;
}
/* Exception table */
MonoAotModule *amodule = image->aot_module;
MonoMethod *method = NULL;
MonoJitInfo *jinfo;
- guint8 *code, *code_end, *ex_info, *p;
+ guint8 *code, *ex_info, *p;
guint32 *table;
int nmethods;
gint32 *code_offsets;
code_offsets = amodule->sorted_code_offsets;
offsets_len = amodule->sorted_code_offsets_len;
- code_end = amodule->jit_code_end > amodule->llvm_code_end ? amodule->jit_code_end : amodule->llvm_code_end;
-
/* Binary search in the sorted_code_offsets table */
left = 0;
right = offsets_len;
int len = decode_value (p, &p);
char *s;
- s = mono_mempool_alloc0 (mp, len + 1);
+ s = mono_mempool_alloc0 (mp, len + 1);
memcpy (s, p, len + 1);
p += len + 1;
}
static guint32
-find_extra_method_in_amodule (MonoAotModule *amodule, MonoMethod *method)
+find_aot_method_in_amodule (MonoAotModule *amodule, MonoMethod *method)
{
guint32 table_size, entry_size, hash;
guint32 *table, *entry;
}
/*
- * find_extra_method:
+ * find_aot_method:
*
* Try finding METHOD in the extra_method table in all AOT images.
* Return its method index, or 0xffffff if not found. Set OUT_AMODULE to the AOT
* module where the method was found.
*/
static guint32
-find_extra_method (MonoMethod *method, MonoAotModule **out_amodule)
+find_aot_method (MonoMethod *method, MonoAotModule **out_amodule)
{
guint32 index;
GPtrArray *modules;
/* Try the method's module first */
*out_amodule = method->klass->image->aot_module;
- index = find_extra_method_in_amodule (method->klass->image->aot_module, method);
+ index = find_aot_method_in_amodule (method->klass->image->aot_module, method);
if (index != 0xffffff)
return index;
MonoAotModule *amodule = g_ptr_array_index (modules, i);
if (amodule != method->klass->image->aot_module)
- index = find_extra_method_in_amodule (amodule, method);
+ index = find_aot_method_in_amodule (amodule, method);
if (index != 0xffffff) {
*out_amodule = amodule;
break;
if (code)
return code;
- method_index = find_extra_method (method, &amodule);
+ method_index = find_aot_method (method, &amodule);
/*
* Special case the ICollection<T> wrappers for arrays, as they cannot
* be statically enumerated, and each wrapper ends up calling the same
MonoMethod *shared;
shared = mini_get_shared_method (method);
- method_index = find_extra_method (shared, &amodule);
+ method_index = find_aot_method (shared, &amodule);
if (method_index != 0xffffff)
method = shared;
}
if (method_index == 0xffffff && method->is_inflated && mono_method_is_generic_sharable_full (method, FALSE, FALSE, TRUE)) {
/* gsharedvt */
/* Use the all-vt shared method since this is what was AOTed */
- method_index = find_extra_method (mini_get_shared_method_full (method, TRUE, TRUE), &amodule);
+ method_index = find_aot_method (mini_get_shared_method_full (method, TRUE, TRUE), &amodule);
if (method_index != 0xffffff)
method = mini_get_shared_method_full (method, TRUE, FALSE);
}
int low, high, entry_index = 0;
if (method->is_inflated && !mono_method_is_generic_sharable_full (method, FALSE, FALSE, FALSE)) {
- method_index = find_extra_method (method, &amodule);
+ method_index = find_aot_method (method, &amodule);
if (method_index == 0xffffff && mono_method_is_generic_sharable_full (method, FALSE, FALSE, TRUE)) {
MonoMethod *shared = mini_get_shared_method_full (method, TRUE, TRUE);
- method_index = find_extra_method (shared, &amodule);
+ method_index = find_aot_method (shared, &amodule);
}
g_assert (method_index != 0xffffff);
} else {
public static T Get_T (double d, T t) {
return t;
}
+ public static T Get_T2 (double d, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, T t) {
+ return t;
+ }
}
class Foo3<T> {
interface IFaceFoo4<T> {
T Get_T (double d, T t);
+ T Get_T2 (double d, T t);
}
class Foo4<T> : IFaceFoo4<T> {
public T Get_T (double d, T t) {
return Foo2<T>.Get_T (d, t);
}
+ public T Get_T2 (double d, T t) {
+ return Foo2<T>.Get_T2 (d, 1, 2, 3, 4, 5, 6, 7, 8, t);
+ }
}
struct VTypeByRefStruct {
public long o1, o2, o3;
}
-#if FALSE
[Category ("GSHAREDVT")]
public static int test_0_arm64_gsharedvt_out_vtypebyref () {
/* gsharedvt out trampoline with vtypebyref argument */
var s_res = o.Get_T (1.0f, s);
if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3)
return 1;
+ // Same with the byref argument passed on the stack
+ s_res = o.Get_T2 (1.0f, s);
+ if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3)
+ return 2;
return 0;
}
-#endif
class Foo5<T> {
public static T Get_T (object o) {
* optimize_branches () since the IR is already optimized.
*/
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
- MonoBasicBlock *bb1, *bb2, *true_bb, *false_bb, *next_bb;
+ MonoBasicBlock *bb1, *bb2, *next_bb;
MonoInst *branch1, *branch2, *compare1, *ins, *next;
/* Look for the IR code generated from if (<var> < 0 || v > <limit>)
if (!(branch1 && ((branch1->opcode == OP_IBLT) || (branch1->opcode == OP_LBLT)) && (branch1->inst_false_bb == next_bb)))
continue;
- true_bb = branch1->inst_true_bb;
-
/* Check second branch */
branch2 = mono_bb_last_inst (next_bb, filter);
if (!branch2)
/* mcs sometimes generates inverted branches */
if (((branch2->opcode == OP_IBGT) || (branch2->opcode == OP_LBGT)) && branch2->inst_true_bb == branch1->inst_true_bb)
- false_bb = branch2->inst_false_bb;
+ ;
else if (((branch2->opcode == OP_IBLE) || (branch2->opcode == OP_LBLE)) && branch2->inst_false_bb == branch1->inst_true_bb)
- false_bb = branch2->inst_true_bb;
+ ;
else
continue;
MonoDebugMethodJitInfo *jit;
MonoMethodHeader *header;
MonoMethodSignature *sig;
- MonoDebugMethodAddress *debug_info;
MonoMethod *method;
int i;
for (i = 0; i < jit->num_line_numbers; i++)
jit->line_numbers [i] = g_array_index (info->line_numbers, MonoDebugLineNumberEntry, i);
- debug_info = mono_debug_add_method (cfg->method_to_register, jit, cfg->domain);
+ mono_debug_add_method (cfg->method_to_register, jit, cfg->domain);
mono_debug_add_vg_method (method, jit);
if (sigctx)
ip = mono_arch_ip_from_context (sigctx);
else if (info)
- ip = MONO_CONTEXT_GET_IP (&info->suspend_state.ctx);
+ ip = MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx);
else
ip = NULL;
*/
mono_walk_stack_with_ctx (get_last_frame, &ctx, MONO_UNWIND_NONE, &data);
} else if (info) {
- mono_get_eh_callbacks ()->mono_walk_stack_with_state (get_last_frame, &info->suspend_state, MONO_UNWIND_SIGNAL_SAFE, &data);
+ mono_get_eh_callbacks ()->mono_walk_stack_with_state (get_last_frame, mono_thread_info_get_suspend_state (info), MONO_UNWIND_SIGNAL_SAFE, &data);
}
if (data.last_frame_set) {
memcpy (&tls->async_last_frame, &data.last_frame, sizeof (StackFrameInfo));
}
}
+typedef struct {
+ DebuggerTlsData *tls;
+ gboolean valid_info;
+} InterruptData;
+
+static SuspendThreadResult
+debugger_interrupt_critical (MonoThreadInfo *info, gpointer user_data)
+{
+ InterruptData *data = user_data;
+ MonoJitInfo *ji;
+
+ data->valid_info = TRUE;
+ ji = mono_jit_info_table_find (mono_thread_info_get_suspend_state (info)->unwind_data [MONO_UNWIND_DATA_DOMAIN], MONO_CONTEXT_GET_IP (&mono_thread_info_get_suspend_state (info)->ctx));
+
+ thread_interrupt (data->tls, info, NULL, ji);
+ return ResumeThread;
+}
+
/*
* notify_thread:
*
/* This is _not_ equivalent to ves_icall_System_Threading_Thread_Abort () */
if (mono_thread_info_new_interrupt_enabled ()) {
- MonoThreadInfo *info;
- MonoJitInfo *ji;
+ InterruptData interrupt_data = { 0 };
+ interrupt_data.tls = tls;
- info = mono_thread_info_safe_suspend_sync ((MonoNativeThreadId)(gpointer)(gsize)thread->tid, FALSE);
- if (!info) {
+ mono_thread_info_safe_suspend_and_run ((MonoNativeThreadId)(gpointer)(gsize)thread->tid, FALSE, debugger_interrupt_critical, &interrupt_data);
+ if (!interrupt_data.valid_info) {
DEBUG_PRINTF (1, "[%p] mono_thread_info_suspend_sync () failed for %p...\n", (gpointer)GetCurrentThreadId (), (gpointer)tid);
/*
* Attached thread which died without detaching.
*/
tls->terminated = TRUE;
- } else {
- ji = mono_jit_info_table_find (info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN], MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
-
- thread_interrupt (tls, info, NULL, ji);
-
- mono_thread_info_finish_suspend_and_resume (info);
}
} else {
#ifdef HOST_WIN32
/* We might be called for threads started before we registered the start callback */
if (thread) {
DEBUG_PRINTF (1, "[%p] Thread terminated, obj=%p, tls=%p.\n", (gpointer)tid, thread, tls);
+
+ if (GetCurrentThreadId () == tid && !mono_native_tls_get_value (debugger_tls_id)) {
+ /*
+ * This can happen on darwin since we deregister threads using pthread dtors.
+ * process_profiler_event () and the code it calls cannot handle a null TLS value.
+ */
+ return;
+ }
+
process_profiler_event (EVENT_KIND_THREAD_DEATH, thread);
}
}
DebuggerTlsData *tls;
StackFrame *frame;
MonoDebugMethodJitInfo *jit;
- MonoDebugVarInfo *var;
MonoMethodSignature *sig;
gssize id;
MonoMethodHeader *header;
g_assert (pos >= 0 && pos < jit->num_params);
- var = &jit->params [pos];
-
add_var (buf, jit, sig->params [pos], &jit->params [pos], &frame->ctx, frame->domain, FALSE);
} else {
g_assert (pos >= 0 && pos < jit->num_locals);
- var = &jit->locals [pos];
-
add_var (buf, jit, header->locals [pos], &jit->locals [pos], &frame->ctx, frame->domain, FALSE);
}
}
mono_debugger_agent_parse_options (char *options);
void
-mono_debugger_agent_init (void) MONO_INTERNAL;
+mono_debugger_agent_init (void);
void
-mono_debugger_agent_breakpoint_hit (void *sigctx) MONO_INTERNAL;
+mono_debugger_agent_breakpoint_hit (void *sigctx);
void
-mono_debugger_agent_single_step_event (void *sigctx) MONO_INTERNAL;
+mono_debugger_agent_single_step_event (void *sigctx);
void
-debugger_agent_single_step_from_context (MonoContext *ctx) MONO_INTERNAL;
+debugger_agent_single_step_from_context (MonoContext *ctx);
void
-debugger_agent_breakpoint_from_context (MonoContext *ctx) MONO_INTERNAL;
+debugger_agent_breakpoint_from_context (MonoContext *ctx);
void
-mono_debugger_agent_free_domain_info (MonoDomain *domain) MONO_INTERNAL;
+mono_debugger_agent_free_domain_info (MonoDomain *domain);
-gboolean mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji) MONO_INTERNAL;
+gboolean mono_debugger_agent_thread_interrupt (void *sigctx, MonoJitInfo *ji);
#if defined(PLATFORM_ANDROID) || defined(TARGET_ANDROID)
void
#endif
void
-mono_debugger_agent_handle_exception (MonoException *ext, MonoContext *throw_ctx, MonoContext *catch_ctx) MONO_INTERNAL;
+mono_debugger_agent_handle_exception (MonoException *ext, MonoContext *throw_ctx, MonoContext *catch_ctx);
void
-mono_debugger_agent_begin_exception_filter (MonoException *exc, MonoContext *ctx, MonoContext *orig_ctx) MONO_INTERNAL;
+mono_debugger_agent_begin_exception_filter (MonoException *exc, MonoContext *ctx, MonoContext *orig_ctx);
void
-mono_debugger_agent_end_exception_filter (MonoException *exc, MonoContext *ctx, MonoContext *orig_ctx) MONO_INTERNAL;
+mono_debugger_agent_end_exception_filter (MonoException *exc, MonoContext *ctx, MonoContext *orig_ctx);
void
-mono_debugger_agent_user_break (void) MONO_INTERNAL;
+mono_debugger_agent_user_break (void);
void
-mono_debugger_agent_debug_log (int level, MonoString *category, MonoString *message) MONO_INTERNAL;
+mono_debugger_agent_debug_log (int level, MonoString *category, MonoString *message);
gboolean
-mono_debugger_agent_debug_log_is_enabled (void) MONO_INTERNAL;
+mono_debugger_agent_debug_log_is_enabled (void);
MONO_API gboolean
mono_debugger_agent_transport_handshake (void);
};
/* Prototypes */
-MonoBoolean mono_method_has_declsec (MonoMethod *method) MONO_INTERNAL;
-void mono_declsec_cache_stack_modifiers (MonoJitInfo *jinfo) MONO_INTERNAL;
-MonoSecurityFrame* mono_declsec_create_frame (MonoDomain *domain, MonoJitInfo *jinfo) MONO_INTERNAL;
+MonoBoolean mono_method_has_declsec (MonoMethod *method);
+void mono_declsec_cache_stack_modifiers (MonoJitInfo *jinfo);
+MonoSecurityFrame* mono_declsec_create_frame (MonoDomain *domain, MonoJitInfo *jinfo);
-guint32 mono_declsec_linkdemand (MonoDomain *domain, MonoMethod *caller, MonoMethod *callee) MONO_INTERNAL;
+guint32 mono_declsec_linkdemand (MonoDomain *domain, MonoMethod *caller, MonoMethod *callee);
#ifndef DISABLE_SECURITY
#define mono_security_method_has_declsec(method) (mono_method_has_declsec(method))
MONO_EMIT_NEW_UNALU (cfg, OP_ICEQ, reg2, -1);
MONO_EMIT_NEW_BIALU (cfg, OP_IAND, reg1, reg1, reg2);
MONO_EMIT_NEW_ICOMPARE_IMM (cfg, reg1, 1);
- MONO_EMIT_NEW_COND_EXC (cfg, IEQ, "DivideByZeroException");
+ MONO_EMIT_NEW_COND_EXC (cfg, IEQ, "OverflowException");
}
#endif
MONO_EMIT_NEW_BIALU (cfg, ins->opcode, ins->dreg, ins->sreg1, ins->sreg2);
img_writer_emit_pop_section (w->w);
}
-static inline void
-emit_local_symbol (MonoDwarfWriter *w, const char *name, const char *end_label, gboolean func)
-{
- img_writer_emit_local_symbol (w->w, name, end_label, func);
-}
-
static inline void
emit_label (MonoDwarfWriter *w, const char *name)
{
img_writer_emit_symbol_diff (w->w, end, start, offset);
}
-static inline void
-emit_zero_bytes (MonoDwarfWriter *w, int num)
-{
- img_writer_emit_zero_bytes (w->w, num);
-}
-
static inline void
emit_byte (MonoDwarfWriter *w, guint8 val)
{
iter = NULL;
while ((field = mono_class_get_fields (klass, &iter))) {
const char *p;
- int len;
MonoTypeEnum def_type;
if (strcmp ("value__", mono_field_get_name (field)) == 0)
emit_string (w, mono_field_get_name (field));
p = mono_class_get_field_default_value (field, &def_type);
- len = mono_metadata_decode_blob_size (p, &p);
+ /* len = */ mono_metadata_decode_blob_size (p, &p);
switch (mono_class_enum_basetype (klass)->type) {
case MONO_TYPE_U1:
case MONO_TYPE_I1:
typedef struct _MonoDwarfWriter MonoDwarfWriter;
-MonoDwarfWriter* mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_start_line, gboolean appending, gboolean emit_line_numbers) MONO_INTERNAL;
+MonoDwarfWriter* mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_start_line, gboolean appending, gboolean emit_line_numbers);
-void mono_dwarf_writer_destroy (MonoDwarfWriter *w) MONO_INTERNAL;
+void mono_dwarf_writer_destroy (MonoDwarfWriter *w);
-void mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSList *base_unwind_program) MONO_INTERNAL;
+void mono_dwarf_writer_emit_base_info (MonoDwarfWriter *w, const char *cu_name, GSList *base_unwind_program);
-void mono_dwarf_writer_close (MonoDwarfWriter *w) MONO_INTERNAL;
+void mono_dwarf_writer_close (MonoDwarfWriter *w);
-int mono_dwarf_writer_get_il_file_line_index (MonoDwarfWriter *w) MONO_INTERNAL;
+int mono_dwarf_writer_get_il_file_line_index (MonoDwarfWriter *w);
-void mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, GSList *unwind_info) MONO_INTERNAL;
+void mono_dwarf_writer_emit_trampoline (MonoDwarfWriter *w, const char *tramp_name, char *start_symbol, char *end_symbol, guint8 *code, guint32 code_size, GSList *unwind_info);
void
mono_dwarf_writer_emit_method (MonoDwarfWriter *w, MonoCompile *cfg, MonoMethod *method, char *start_symbol, char *end_symbol, char *linkage_name,
- guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info) MONO_INTERNAL;
+ guint8 *code, guint32 code_size, MonoInst **args, MonoInst **locals, GSList *unwind_info, MonoDebugMethodJitInfo *debug_info);
char *
mono_dwarf_escape_path (const char *name);
if (!info) {
lmf = mono_get_lmf ();
} else {
- g_assert (info->suspend_state.valid);
- lmf = info->suspend_state.unwind_data [MONO_UNWIND_DATA_LMF];
+ g_assert (info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].valid);
+ lmf = info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].unwind_data [MONO_UNWIND_DATA_LMF];
}
if (!lmf)
static gpointer signal_exception_trampoline;
gpointer
-mono_x86_get_signal_exception_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
+mono_x86_get_signal_exception_trampoline (MonoTrampInfo **info, gboolean aot);
#ifdef TARGET_WIN32
static void (*restore_stack) (void *);
char *as_file;
char *o_file;
char *cmd;
- int unused;
+ int unused G_GNUC_UNUSED;
#ifdef HOST_WIN32
as_file = g_strdup_printf ("%s/test.s", tmp);
static int
bin_writer_emit_writeout (MonoImageWriter *acfg)
{
- FILE *file;
ElfHeader header;
ElfProgHeader progh [4];
ElfSectHeader secth [SECT_NUM];
ElfSymbol *symtab;
ElfDynamic dynamic [14];
int *hash;
- int i, num_sections, file_offset, virt_offset, size, num_symtab;
+ int i, num_sections, file_offset, virt_offset, size;
int num_local_syms;
- file = acfg->fp;
-
/* Section headers */
memset (§h, 0, sizeof (secth));
memset (&dynamic, 0, sizeof (dynamic));
num_sections = collect_sections (acfg, secth, all_sections, 16);
hash = build_hash (acfg, num_sections, &dyn_str_table);
- num_symtab = hash [1]; /* FIXME */
#if 0
g_print ("num_sections: %d\n", num_sections);
g_print ("dynsym: %d, dynstr size: %d\n", hash [1], (int)dyn_str_table.data->len);
#define R_ARM_JUMP24 29
#define R_ARM_ALU_PC_G0_NC 59
-gboolean bin_writer_supported (void) MONO_INTERNAL;
+gboolean bin_writer_supported (void);
-MonoImageWriter* img_writer_create (FILE *fp, gboolean use_bin_writer) MONO_INTERNAL;
+MonoImageWriter* img_writer_create (FILE *fp, gboolean use_bin_writer);
-void img_writer_destroy (MonoImageWriter *w) MONO_INTERNAL;
+void img_writer_destroy (MonoImageWriter *w);
-void img_writer_emit_start (MonoImageWriter *w) MONO_INTERNAL;
+void img_writer_emit_start (MonoImageWriter *w);
-int img_writer_emit_writeout (MonoImageWriter *w) MONO_INTERNAL;
+int img_writer_emit_writeout (MonoImageWriter *w);
-guint8* img_writer_get_output (MonoImageWriter *acfg, guint32 *size) MONO_INTERNAL;
+guint8* img_writer_get_output (MonoImageWriter *acfg, guint32 *size);
-void img_writer_emit_section_change (MonoImageWriter *w, const char *section_name, int subsection_index) MONO_INTERNAL;
+void img_writer_emit_section_change (MonoImageWriter *w, const char *section_name, int subsection_index);
-void img_writer_emit_push_section (MonoImageWriter *w, const char *section_name, int subsection) MONO_INTERNAL;
+void img_writer_emit_push_section (MonoImageWriter *w, const char *section_name, int subsection);
-void img_writer_emit_pop_section (MonoImageWriter *w) MONO_INTERNAL;
+void img_writer_emit_pop_section (MonoImageWriter *w);
-void img_writer_set_section_addr (MonoImageWriter *acfg, guint64 addr) MONO_INTERNAL;
+void img_writer_set_section_addr (MonoImageWriter *acfg, guint64 addr);
-void img_writer_emit_global (MonoImageWriter *w, const char *name, gboolean func) MONO_INTERNAL;
+void img_writer_emit_global (MonoImageWriter *w, const char *name, gboolean func);
-void img_writer_emit_local_symbol (MonoImageWriter *w, const char *name, const char *end_label, gboolean func) MONO_INTERNAL;
+void img_writer_emit_local_symbol (MonoImageWriter *w, const char *name, const char *end_label, gboolean func);
void img_writer_emit_symbol_size (MonoImageWriter *w, const char *start, const char *end_label);
-void img_writer_emit_label (MonoImageWriter *w, const char *name) MONO_INTERNAL;
+void img_writer_emit_label (MonoImageWriter *w, const char *name);
-void img_writer_emit_bytes (MonoImageWriter *w, const guint8* buf, int size) MONO_INTERNAL;
+void img_writer_emit_bytes (MonoImageWriter *w, const guint8* buf, int size);
-void img_writer_emit_string (MonoImageWriter *w, const char *value) MONO_INTERNAL;
+void img_writer_emit_string (MonoImageWriter *w, const char *value);
-void img_writer_emit_line (MonoImageWriter *w) MONO_INTERNAL;
+void img_writer_emit_line (MonoImageWriter *w);
-void img_writer_emit_alignment (MonoImageWriter *w, int size) MONO_INTERNAL;
+void img_writer_emit_alignment (MonoImageWriter *w, int size);
-void img_writer_emit_alignment_fill (MonoImageWriter *w, int size, int fill) MONO_INTERNAL;
+void img_writer_emit_alignment_fill (MonoImageWriter *w, int size, int fill);
#ifdef __native_client_codegen__
-void img_writer_emit_nacl_call_alignment (MonoImageWriter *w) MONO_INTERNAL;
+void img_writer_emit_nacl_call_alignment (MonoImageWriter *w);
#endif
-void img_writer_emit_pointer_unaligned (MonoImageWriter *w, const char *target) MONO_INTERNAL;
+void img_writer_emit_pointer_unaligned (MonoImageWriter *w, const char *target);
-void img_writer_emit_pointer (MonoImageWriter *w, const char *target) MONO_INTERNAL;
+void img_writer_emit_pointer (MonoImageWriter *w, const char *target);
-void img_writer_emit_int16 (MonoImageWriter *w, int value) MONO_INTERNAL;
+void img_writer_emit_int16 (MonoImageWriter *w, int value);
-void img_writer_emit_int32 (MonoImageWriter *w, int value) MONO_INTERNAL;
+void img_writer_emit_int32 (MonoImageWriter *w, int value);
-void img_writer_emit_symbol_diff (MonoImageWriter *w, const char *end, const char* start, int offset) MONO_INTERNAL;
+void img_writer_emit_symbol_diff (MonoImageWriter *w, const char *end, const char* start, int offset);
-void img_writer_emit_zero_bytes (MonoImageWriter *w, int num) MONO_INTERNAL;
+void img_writer_emit_zero_bytes (MonoImageWriter *w, int num);
-void img_writer_emit_global (MonoImageWriter *w, const char *name, gboolean func) MONO_INTERNAL;
+void img_writer_emit_global (MonoImageWriter *w, const char *name, gboolean func);
-void img_writer_emit_byte (MonoImageWriter *w, guint8 val) MONO_INTERNAL;
+void img_writer_emit_byte (MonoImageWriter *w, guint8 val);
-void img_writer_emit_reloc (MonoImageWriter *acfg, int reloc_type, const char *symbol, int addend) MONO_INTERNAL;
+void img_writer_emit_reloc (MonoImageWriter *acfg, int reloc_type, const char *symbol, int addend);
-void img_writer_emit_unset_mode (MonoImageWriter *acfg) MONO_INTERNAL;
+void img_writer_emit_unset_mode (MonoImageWriter *acfg);
-gboolean img_writer_subsections_supported (MonoImageWriter *acfg) MONO_INTERNAL;
+gboolean img_writer_subsections_supported (MonoImageWriter *acfg);
-FILE * img_writer_get_fp (MonoImageWriter *acfg) MONO_INTERNAL;
+FILE * img_writer_get_fp (MonoImageWriter *acfg);
-const char *img_writer_get_temp_label_prefix (MonoImageWriter *acfg) MONO_INTERNAL;
+const char *img_writer_get_temp_label_prefix (MonoImageWriter *acfg);
#endif
#include "mini.h"
-void* mono_ldftn (MonoMethod *method) MONO_INTERNAL;
+void* mono_ldftn (MonoMethod *method);
-void* mono_ldvirtfn (MonoObject *obj, MonoMethod *method) MONO_INTERNAL;
+void* mono_ldvirtfn (MonoObject *obj, MonoMethod *method);
-void* mono_ldvirtfn_gshared (MonoObject *obj, MonoMethod *method) MONO_INTERNAL;
+void* mono_ldvirtfn_gshared (MonoObject *obj, MonoMethod *method);
-void mono_helper_stelem_ref_check (MonoArray *array, MonoObject *val) MONO_INTERNAL;
+void mono_helper_stelem_ref_check (MonoArray *array, MonoObject *val);
-gint64 mono_llmult (gint64 a, gint64 b) MONO_INTERNAL;
+gint64 mono_llmult (gint64 a, gint64 b);
-guint64 mono_llmult_ovf_un (guint64 a, guint64 b) MONO_INTERNAL;
+guint64 mono_llmult_ovf_un (guint64 a, guint64 b);
-guint64 mono_llmult_ovf (gint64 a, gint64 b) MONO_INTERNAL;
+guint64 mono_llmult_ovf (gint64 a, gint64 b);
-gint32 mono_idiv (gint32 a, gint32 b) MONO_INTERNAL;
+gint32 mono_idiv (gint32 a, gint32 b);
-guint32 mono_idiv_un (guint32 a, guint32 b) MONO_INTERNAL;
+guint32 mono_idiv_un (guint32 a, guint32 b);
-gint32 mono_irem (gint32 a, gint32 b) MONO_INTERNAL;
+gint32 mono_irem (gint32 a, gint32 b);
-guint32 mono_irem_un (guint32 a, guint32 b) MONO_INTERNAL;
+guint32 mono_irem_un (guint32 a, guint32 b);
-gint32 mono_imul (gint32 a, gint32 b) MONO_INTERNAL;
+gint32 mono_imul (gint32 a, gint32 b);
-gint32 mono_imul_ovf (gint32 a, gint32 b) MONO_INTERNAL;
+gint32 mono_imul_ovf (gint32 a, gint32 b);
-gint32 mono_imul_ovf_un (guint32 a, guint32 b) MONO_INTERNAL;
+gint32 mono_imul_ovf_un (guint32 a, guint32 b);
-double mono_fdiv (double a, double b) MONO_INTERNAL;
+double mono_fdiv (double a, double b);
-gint64 mono_lldiv (gint64 a, gint64 b) MONO_INTERNAL;
+gint64 mono_lldiv (gint64 a, gint64 b);
-gint64 mono_llrem (gint64 a, gint64 b) MONO_INTERNAL;
+gint64 mono_llrem (gint64 a, gint64 b);
-guint64 mono_lldiv_un (guint64 a, guint64 b) MONO_INTERNAL;
+guint64 mono_lldiv_un (guint64 a, guint64 b);
-guint64 mono_llrem_un (guint64 a, guint64 b) MONO_INTERNAL;
+guint64 mono_llrem_un (guint64 a, guint64 b);
-guint64 mono_lshl (guint64 a, gint32 shamt) MONO_INTERNAL;
+guint64 mono_lshl (guint64 a, gint32 shamt);
-guint64 mono_lshr_un (guint64 a, gint32 shamt) MONO_INTERNAL;
+guint64 mono_lshr_un (guint64 a, gint32 shamt);
-gint64 mono_lshr (gint64 a, gint32 shamt) MONO_INTERNAL;
+gint64 mono_lshr (gint64 a, gint32 shamt);
-MonoArray *mono_array_new_va (MonoMethod *cm, ...) MONO_INTERNAL;
+MonoArray *mono_array_new_va (MonoMethod *cm, ...);
-MonoArray *mono_array_new_1 (MonoMethod *cm, guint32 length) MONO_INTERNAL;
+MonoArray *mono_array_new_1 (MonoMethod *cm, guint32 length);
-MonoArray *mono_array_new_2 (MonoMethod *cm, guint32 length1, guint32 length2) MONO_INTERNAL;
+MonoArray *mono_array_new_2 (MonoMethod *cm, guint32 length1, guint32 length2);
-MonoArray *mono_array_new_3 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3) MONO_INTERNAL;
+MonoArray *mono_array_new_3 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3);
-MonoArray *mono_array_new_4 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3, guint32 length4) MONO_INTERNAL;
+MonoArray *mono_array_new_4 (MonoMethod *cm, guint32 length1, guint32 length2, guint32 length3, guint32 length4);
-gpointer mono_class_static_field_address (MonoDomain *domain, MonoClassField *field) MONO_INTERNAL;
+gpointer mono_class_static_field_address (MonoDomain *domain, MonoClassField *field);
-gpointer mono_ldtoken_wrapper (MonoImage *image, int token, MonoGenericContext *context) MONO_INTERNAL;
+gpointer mono_ldtoken_wrapper (MonoImage *image, int token, MonoGenericContext *context);
-gpointer mono_ldtoken_wrapper_generic_shared (MonoImage *image, int token, MonoMethod *method) MONO_INTERNAL;
+gpointer mono_ldtoken_wrapper_generic_shared (MonoImage *image, int token, MonoMethod *method);
-guint64 mono_fconv_u8 (double v) MONO_INTERNAL;
+guint64 mono_fconv_u8 (double v);
-gint64 mono_fconv_i8 (double v) MONO_INTERNAL;
+gint64 mono_fconv_i8 (double v);
-guint32 mono_fconv_u4 (double v) MONO_INTERNAL;
+guint32 mono_fconv_u4 (double v);
-gint64 mono_fconv_ovf_i8 (double v) MONO_INTERNAL;
+gint64 mono_fconv_ovf_i8 (double v);
-guint64 mono_fconv_ovf_u8 (double v) MONO_INTERNAL;
+guint64 mono_fconv_ovf_u8 (double v);
-gint64 mono_rconv_i8 (float v) MONO_INTERNAL;
+gint64 mono_rconv_i8 (float v);
-gint64 mono_rconv_ovf_i8 (float v) MONO_INTERNAL;
+gint64 mono_rconv_ovf_i8 (float v);
-guint64 mono_rconv_ovf_u8 (float v) MONO_INTERNAL;
+guint64 mono_rconv_ovf_u8 (float v);
-double mono_lconv_to_r8 (gint64 a) MONO_INTERNAL;
+double mono_lconv_to_r8 (gint64 a);
-double mono_conv_to_r8 (gint32 a) MONO_INTERNAL;
+double mono_conv_to_r8 (gint32 a);
-double mono_conv_to_r4 (gint32 a) MONO_INTERNAL;
+double mono_conv_to_r4 (gint32 a);
-float mono_lconv_to_r4 (gint64 a) MONO_INTERNAL;
+float mono_lconv_to_r4 (gint64 a);
-double mono_conv_to_r8_un (guint32 a) MONO_INTERNAL;
+double mono_conv_to_r8_un (guint32 a);
-double mono_lconv_to_r8_un (guint64 a) MONO_INTERNAL;
+double mono_lconv_to_r8_un (guint64 a);
#if defined(__native_client_codegen__) || defined(__native_client__)
-double mono_fmod(double a, double b) MONO_INTERNAL;
+double mono_fmod(double a, double b);
#endif
-gpointer mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg) MONO_INTERNAL;
+gpointer mono_helper_compile_generic_method (MonoObject *obj, MonoMethod *method, gpointer *this_arg);
-MonoString *mono_helper_ldstr (MonoImage *image, guint32 idx) MONO_INTERNAL;
+MonoString *mono_helper_ldstr (MonoImage *image, guint32 idx);
-MonoString *mono_helper_ldstr_mscorlib (guint32 idx) MONO_INTERNAL;
+MonoString *mono_helper_ldstr_mscorlib (guint32 idx);
-MonoObject *mono_helper_newobj_mscorlib (guint32 idx) MONO_INTERNAL;
+MonoObject *mono_helper_newobj_mscorlib (guint32 idx);
-double mono_fsub (double a, double b) MONO_INTERNAL;
+double mono_fsub (double a, double b);
-double mono_fadd (double a, double b) MONO_INTERNAL;
+double mono_fadd (double a, double b);
-double mono_fmul (double a, double b) MONO_INTERNAL;
+double mono_fmul (double a, double b);
-double mono_fneg (double a) MONO_INTERNAL;
+double mono_fneg (double a);
-double mono_fconv_r4 (double a) MONO_INTERNAL;
+double mono_fconv_r4 (double a);
-gint8 mono_fconv_i1 (double a) MONO_INTERNAL;
+gint8 mono_fconv_i1 (double a);
-gint16 mono_fconv_i2 (double a) MONO_INTERNAL;
+gint16 mono_fconv_i2 (double a);
-gint32 mono_fconv_i4 (double a) MONO_INTERNAL;
+gint32 mono_fconv_i4 (double a);
-guint8 mono_fconv_u1 (double a) MONO_INTERNAL;
+guint8 mono_fconv_u1 (double a);
-guint16 mono_fconv_u2 (double a) MONO_INTERNAL;
+guint16 mono_fconv_u2 (double a);
-gboolean mono_fcmp_eq (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_eq (double a, double b);
-gboolean mono_fcmp_ge (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_ge (double a, double b);
-gboolean mono_fcmp_gt (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_gt (double a, double b);
-gboolean mono_fcmp_le (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_le (double a, double b);
-gboolean mono_fcmp_lt (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_lt (double a, double b);
-gboolean mono_fcmp_ne_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_ne_un (double a, double b);
-gboolean mono_fcmp_ge_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_ge_un (double a, double b);
-gboolean mono_fcmp_gt_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_gt_un (double a, double b);
-gboolean mono_fcmp_le_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_le_un (double a, double b);
-gboolean mono_fcmp_lt_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fcmp_lt_un (double a, double b);
-gboolean mono_fceq (double a, double b) MONO_INTERNAL;
+gboolean mono_fceq (double a, double b);
-gboolean mono_fcgt (double a, double b) MONO_INTERNAL;
+gboolean mono_fcgt (double a, double b);
-gboolean mono_fcgt_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fcgt_un (double a, double b);
-gboolean mono_fclt (double a, double b) MONO_INTERNAL;
+gboolean mono_fclt (double a, double b);
-gboolean mono_fclt_un (double a, double b) MONO_INTERNAL;
+gboolean mono_fclt_un (double a, double b);
-gboolean mono_isfinite (double a) MONO_INTERNAL;
+gboolean mono_isfinite (double a);
-double mono_fload_r4 (float *ptr) MONO_INTERNAL;
+double mono_fload_r4 (float *ptr);
-void mono_fstore_r4 (double val, float *ptr) MONO_INTERNAL;
+void mono_fstore_r4 (double val, float *ptr);
-guint32 mono_fload_r4_arg (double val) MONO_INTERNAL;
+guint32 mono_fload_r4_arg (double val);
-void mono_break (void) MONO_INTERNAL;
+void mono_break (void);
-MonoException *mono_create_corlib_exception_0 (guint32 token) MONO_INTERNAL;
+MonoException *mono_create_corlib_exception_0 (guint32 token);
-MonoException *mono_create_corlib_exception_1 (guint32 token, MonoString *arg) MONO_INTERNAL;
+MonoException *mono_create_corlib_exception_1 (guint32 token, MonoString *arg);
-MonoException *mono_create_corlib_exception_2 (guint32 token, MonoString *arg1, MonoString *arg2) MONO_INTERNAL;
+MonoException *mono_create_corlib_exception_2 (guint32 token, MonoString *arg1, MonoString *arg2);
-MonoObject* mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass) MONO_INTERNAL;
+MonoObject* mono_object_castclass_unbox (MonoObject *obj, MonoClass *klass);
-gpointer mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpointer func) MONO_INTERNAL;
+gpointer mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpointer func);
MonoObject*
mono_object_isinst_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cache);
mono_object_castclass_with_cache (MonoObject *obj, MonoClass *klass, gpointer *cache);
MonoObject*
-mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gboolean deref_arg, gpointer *args) MONO_INTERNAL;
+mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gboolean deref_arg, gpointer *args);
-void mono_gsharedvt_value_copy (gpointer dest, gpointer src, MonoClass *klass) MONO_INTERNAL;
+void mono_gsharedvt_value_copy (gpointer dest, gpointer src, MonoClass *klass);
#endif /* __MONO_JIT_ICALLS_H__ */
+++ /dev/null
-VER_1 {
- global:
- mono_*;
- GC_push_all_stack;
- GC_start_blocking;
- GC_end_blocking;
- gc_thread_vtable;
- __nacl_suspend_thread_if_needed;
- __nacl_thread_suspension_needed;
- nacl_mono_path;
- local:
- *;
-};
+++ /dev/null
-{
- global:
- mono_*;
- GC_push_all_stack;
- GC_start_blocking;
- GC_end_blocking;
- gc_thread_vtable;
- mini_type_is_vtype;
- mini_is_gsharedvt_klass;
- local:
- *;
-};
num_sregs = mono_inst_get_src_registers (ins, sregs);
for (srcindex = 0; srcindex < num_sregs; ++srcindex) {
MonoInst *def;
- int nregs;
- nregs = mono_inst_get_src_registers (ins, sregs);
+ mono_inst_get_src_registers (ins, sregs);
regtype = spec [MONO_INST_SRC1 + srcindex];
sreg = sregs [srcindex];
switch (type->type) {
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
return OP_MOVE;
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
return OP_MOVE;
case MONO_TYPE_I4:
case MONO_TYPE_U4:
if (mini_type_var_is_vt (cfg, type))
return OP_VMOVE;
else
- return OP_MOVE;
+ return mono_type_to_regmove (cfg, mini_get_underlying_type (cfg, type));
default:
g_error ("unknown type 0x%02x in type_to_regstore", type->type);
}
return;
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
inst->type = STACK_I4;
g_assert (cfg->gsharedvt);
inst->type = STACK_VTYPE;
} else {
- inst->type = STACK_OBJ;
+ type_to_eval_stack_type (cfg, mini_get_underlying_type (cfg, type), inst);
}
return;
default:
switch (t->type) {
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
return STACK_I4;
return calli? OP_VOIDCALL_REG: virt? OP_VOIDCALL_MEMBASE: OP_VOIDCALL;
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
return calli? OP_CALL_REG: virt? OP_CALL_MEMBASE: OP_CALL;
return 1;
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
if (arg->type != STACK_I4 && arg->type != STACK_PTR)
return 1;
continue;
}
- simple_type = sig->params [i];
- simple_type = mini_get_basic_type_from_generic (cfg->generic_sharing_context, simple_type);
+ simple_type = mini_get_underlying_type (cfg, sig->params [i]);
handle_enum:
switch (simple_type->type) {
case MONO_TYPE_VOID:
continue;
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
if (args [i]->type != STACK_I4 && args [i]->type != STACK_PTR)
mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *klass, gboolean native)
{
MonoInst *iargs [4];
- int context_used, n;
+ int n;
guint32 align = 0;
MonoMethod *memcpy_method;
MonoInst *size_ins = NULL;
MonoInst *memcpy_ins = NULL;
g_assert (klass);
+ if (cfg->generic_sharing_context)
+ klass = mono_class_from_mono_type (mini_get_underlying_type (cfg, &klass->byval_arg));
+
/*
* This check breaks with spilled vars... need to handle it during verification anyway.
* g_assert (klass && klass == src->klass && klass == dest->klass);
if (mini_is_gsharedvt_klass (cfg, klass)) {
g_assert (!native);
- context_used = mini_class_check_context_used (cfg, klass);
size_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_VALUE_SIZE);
memcpy_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_MEMCPY);
}
mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, MonoClass *klass)
{
MonoInst *iargs [3];
- int n, context_used;
+ int n;
guint32 align;
MonoMethod *memset_method;
MonoInst *size_ins = NULL;
static MonoMethod *bzero_method;
/* FIXME: Optimize this for the case when dest is an LDADDR */
-
mono_class_init (klass);
if (mini_is_gsharedvt_klass (cfg, klass)) {
- context_used = mini_class_check_context_used (cfg, klass);
size_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_VALUE_SIZE);
bzero_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_BZERO);
if (!bzero_method)
g_assert (klass->rank == 0);
element_class = emit_get_rgctx_klass (cfg, context_used,
- klass->element_class, MONO_RGCTX_INFO_KLASS);
+ klass, MONO_RGCTX_INFO_ELEMENT_KLASS);
MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, -1, eclass_reg, element_class->dreg);
MONO_EMIT_NEW_COND_EXC (cfg, NE_UN, "InvalidCastException");
MonoInst *addr = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX);
MonoInst *unbox_call;
MonoMethodSignature *unbox_sig;
- MonoInst *var;
-
- var = mono_compile_create_var (cfg, &klass->byval_arg, OP_LOCAL);
unbox_sig = mono_mempool_alloc0 (cfg->mempool, MONO_SIZEOF_METHOD_SIGNATURE + (1 * sizeof (MonoType *)));
unbox_sig->ret = &klass->byval_arg;
}
if (managed_alloc && !(cfg->opt & MONO_OPT_SHARED)) {
- if (known_instance_size)
- EMIT_NEW_ICONST (cfg, iargs [1], mono_gc_get_aligned_size_for_allocator (klass->instance_size));
+ if (known_instance_size) {
+ int size = mono_class_instance_size (klass);
+
+ EMIT_NEW_ICONST (cfg, iargs [1], mono_gc_get_aligned_size_for_allocator (size));
+ }
return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
}
#endif
if (managed_alloc) {
+ int size = mono_class_instance_size (klass);
+
EMIT_NEW_VTABLECONST (cfg, iargs [0], vtable);
- EMIT_NEW_ICONST (cfg, iargs [1], mono_gc_get_aligned_size_for_allocator (klass->instance_size));
+ EMIT_NEW_ICONST (cfg, iargs [1], mono_gc_get_aligned_size_for_allocator (size));
return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
}
alloc_ftn = mono_class_get_allocation_ftn (vtable, for_box, &pass_lw);
if (mini_is_gsharedvt_klass (cfg, klass)) {
MonoBasicBlock *is_ref_bb, *is_nullable_bb, *end_bb;
MonoInst *res, *is_ref, *src_var, *addr;
- int addr_reg, dreg;
+ int dreg;
dreg = alloc_ireg (cfg);
/* Ref case */
MONO_START_BB (cfg, is_ref_bb);
- addr_reg = alloc_ireg (cfg);
/* val is a vtype, so has to load the value manually */
src_var = get_vreg_to_inst (cfg, val->dreg);
{
MonoType *enum_type = mono_type_get_underlying_type (&klass->byval_arg);
guint32 load_opc = mono_type_to_load_membase (cfg, enum_type);
- gboolean is_i4 = TRUE;
+ gboolean is_i4;
switch (enum_type->type) {
case MONO_TYPE_I8:
#endif
is_i4 = FALSE;
break;
+ default:
+ is_i4 = TRUE;
+ break;
}
{
* Return the instruction representing the call. Set the cfg exception on failure.
*/
static MonoInst*
-handle_constrained_gsharedvt_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **sp, MonoClass *constrained_call,
+handle_constrained_gsharedvt_call (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **sp, MonoClass *constrained_class,
gboolean *ref_emit_widen, MonoBasicBlock **ref_bblock)
{
MonoInst *ins = NULL;
args [1] = emit_get_rgctx_method (cfg, mono_method_check_context_used (cmethod), cmethod, MONO_RGCTX_INFO_METHOD);
else
EMIT_NEW_METHODCONST (cfg, args [1], cmethod);
- args [2] = emit_get_rgctx_klass (cfg, mono_class_check_context_used (constrained_call), constrained_call, MONO_RGCTX_INFO_KLASS);
+ args [2] = emit_get_rgctx_klass (cfg, mono_class_check_context_used (constrained_class), constrained_class, MONO_RGCTX_INFO_KLASS);
/* !fsig->hasthis is for the wrapper for the Object.GetType () icall */
if (fsig->hasthis && fsig->param_count) {
if (strcmp (cmethod->name, "get_Chars") == 0 && fsig->param_count == 2) {
int dreg = alloc_ireg (cfg);
int index_reg = alloc_preg (cfg);
- int mult_reg = alloc_preg (cfg);
int add_reg = alloc_preg (cfg);
#if SIZEOF_REGISTER == 8
#if defined(TARGET_X86) || defined(TARGET_AMD64)
EMIT_NEW_X86_LEA (cfg, ins, args [0]->dreg, index_reg, 1, MONO_STRUCT_OFFSET (MonoString, chars));
add_reg = ins->dreg;
- /* Avoid a warning */
- mult_reg = 0;
EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOADU2_MEMBASE, dreg,
add_reg, 0);
#else
+ int mult_reg = alloc_preg (cfg);
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_SHL_IMM, mult_reg, index_reg, 1);
MONO_EMIT_NEW_BIALU (cfg, OP_PADD, add_reg, mult_reg, args [0]->dreg);
EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOADU2_MEMBASE, dreg,
ins->sreg3 = is_float ? f2i_cmp->dreg : args [2]->dreg;
MONO_ADD_INS (cfg->cbb, ins);
- switch (fsig->params [0]->type) {
+ switch (fsig->params [1]->type) {
case MONO_TYPE_I4:
ins->type = STACK_I4;
break;
ins->type = STACK_R8;
break;
default:
- g_assert (mini_type_is_reference (cfg, fsig->params [0]));
+ g_assert (mini_type_is_reference (cfg, fsig->params [1]));
ins->type = STACK_OBJ;
break;
}
for (i = 0; i < attrs->num_attrs; ++i) {
MonoCustomAttrEntry *attr = &attrs->attrs [i];
const gchar *p;
- int len;
MonoMethodSignature *sig;
if (!attr->ctor || attr->ctor->klass != klass)
continue;
/* Decode the attribute. See reflection.c */
- len = attr->data_size;
p = (const char*)attr->data;
g_assert (read16 (p) == 0x0001);
p += 2;
MonoImage *image;
guint32 token, ins_flag;
MonoClass *klass;
- MonoClass *constrained_call = NULL;
+ MonoClass *constrained_class = NULL;
unsigned char *ip, *end, *target, *err_pos;
MonoMethodSignature *sig;
MonoGenericContext *generic_context = NULL;
cmethod = mini_get_method (cfg, method, token, NULL, generic_context);
cil_method = cmethod;
- if (constrained_call) {
+ if (constrained_class) {
+ if ((constrained_class->byval_arg.type == MONO_TYPE_VAR || constrained_class->byval_arg.type == MONO_TYPE_MVAR) && cfg->generic_sharing_context) {
+ if (!mini_is_gsharedvt_klass (cfg, constrained_class)) {
+ g_assert (!cmethod->klass->valuetype);
+ if (!mini_type_is_reference (cfg, &constrained_class->byval_arg)) {
+ /* FIXME: gshared type constrained to a primitive type */
+ GENERIC_SHARING_FAILURE (CEE_CALL);
+ }
+ }
+ }
+
if (method->wrapper_type != MONO_WRAPPER_NONE) {
if (cfg->verbose_level > 2)
- printf ("DM Constrained call to %s\n", mono_type_get_full_name (constrained_call));
- if (!((constrained_call->byval_arg.type == MONO_TYPE_VAR ||
- constrained_call->byval_arg.type == MONO_TYPE_MVAR) &&
+ printf ("DM Constrained call to %s\n", mono_type_get_full_name (constrained_class));
+ if (!((constrained_class->byval_arg.type == MONO_TYPE_VAR ||
+ constrained_class->byval_arg.type == MONO_TYPE_MVAR) &&
cfg->generic_sharing_context)) {
- cmethod = mono_get_method_constrained_with_method (image, cil_method, constrained_call, generic_context, &cfg->error);
+ cmethod = mono_get_method_constrained_with_method (image, cil_method, constrained_class, generic_context, &cfg->error);
CHECK_CFG_ERROR;
}
} else {
if (cfg->verbose_level > 2)
- printf ("Constrained call to %s\n", mono_type_get_full_name (constrained_call));
+ printf ("Constrained call to %s\n", mono_type_get_full_name (constrained_class));
- if ((constrained_call->byval_arg.type == MONO_TYPE_VAR || constrained_call->byval_arg.type == MONO_TYPE_MVAR) && cfg->generic_sharing_context) {
+ if ((constrained_class->byval_arg.type == MONO_TYPE_VAR || constrained_class->byval_arg.type == MONO_TYPE_MVAR) && cfg->generic_sharing_context) {
/*
* This is needed since get_method_constrained can't find
* the method in klass representing a type var.
* The type var is guaranteed to be a reference type in this
* case.
*/
- if (!mini_is_gsharedvt_klass (cfg, constrained_call))
+ if (!mini_is_gsharedvt_klass (cfg, constrained_class))
g_assert (!cmethod->klass->valuetype);
} else {
- cmethod = mono_get_method_constrained_checked (image, token, constrained_call, generic_context, &cil_method, &cfg->error);
+ cmethod = mono_get_method_constrained_checked (image, token, constrained_class, generic_context, &cil_method, &cfg->error);
CHECK_CFG_ERROR;
}
}
MonoMethod *wrapper = mono_marshal_get_native_wrapper (cmethod,
check_for_pending_exc, cfg->compile_aot);
fsig = mono_method_signature (wrapper);
- } else if (constrained_call) {
+ } else if (constrained_class) {
fsig = mono_method_signature (cmethod);
} else {
fsig = mono_method_get_signature_checked (cmethod, image, token, generic_context, &cfg->error);
sp -= n;
- if (constrained_call) {
- if (mini_is_gsharedvt_klass (cfg, constrained_call)) {
- if ((cmethod->klass != mono_defaults.object_class) && constrained_call->valuetype && cmethod->klass->valuetype) {
+ if (constrained_class) {
+ if (mini_is_gsharedvt_klass (cfg, constrained_class)) {
+ if ((cmethod->klass != mono_defaults.object_class) && constrained_class->valuetype && cmethod->klass->valuetype) {
/* The 'Own method' case below */
} else if (cmethod->klass->image != mono_defaults.corlib && !(cmethod->klass->flags & TYPE_ATTRIBUTE_INTERFACE) && !cmethod->klass->valuetype) {
/* 'The type parameter is instantiated as a reference type' case below. */
} else {
- ins = handle_constrained_gsharedvt_call (cfg, cmethod, fsig, sp, constrained_call, &emit_widen, &bblock);
+ ins = handle_constrained_gsharedvt_call (cfg, cmethod, fsig, sp, constrained_class, &emit_widen, &bblock);
CHECK_CFG_EXCEPTION;
g_assert (ins);
goto call_end;
/*
* We have the `constrained.' prefix opcode.
*/
- if (constrained_call->valuetype && (cmethod->klass == mono_defaults.object_class || cmethod->klass == mono_defaults.enum_class->parent || cmethod->klass == mono_defaults.enum_class)) {
+ if (constrained_class->valuetype && (cmethod->klass == mono_defaults.object_class || cmethod->klass == mono_defaults.enum_class->parent || cmethod->klass == mono_defaults.enum_class)) {
/*
* The type parameter is instantiated as a valuetype,
* but that type doesn't override the method we're
* calling, so we need to box `this'.
*/
- EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &constrained_call->byval_arg, sp [0]->dreg, 0);
- ins->klass = constrained_call;
- sp [0] = handle_box (cfg, ins, constrained_call, mono_class_check_context_used (constrained_call), &bblock);
+ EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &constrained_class->byval_arg, sp [0]->dreg, 0);
+ ins->klass = constrained_class;
+ sp [0] = handle_box (cfg, ins, constrained_class, mono_class_check_context_used (constrained_class), &bblock);
CHECK_CFG_EXCEPTION;
- } else if (!constrained_call->valuetype) {
+ } else if (!constrained_class->valuetype) {
int dreg = alloc_ireg_ref (cfg);
/*
/* Interface method */
int ioffset, slot;
- mono_class_setup_vtable (constrained_call);
- CHECK_TYPELOAD (constrained_call);
- ioffset = mono_class_interface_offset (constrained_call, cmethod->klass);
+ mono_class_setup_vtable (constrained_class);
+ CHECK_TYPELOAD (constrained_class);
+ ioffset = mono_class_interface_offset (constrained_class, cmethod->klass);
if (ioffset == -1)
- TYPE_LOAD_ERROR (constrained_call);
+ TYPE_LOAD_ERROR (constrained_class);
slot = mono_method_get_vtable_slot (cmethod);
if (slot == -1)
TYPE_LOAD_ERROR (cmethod->klass);
- cmethod = constrained_call->vtable [ioffset + slot];
+ cmethod = constrained_class->vtable [ioffset + slot];
if (cmethod->klass == mono_defaults.enum_class) {
/* Enum implements some interfaces, so treat this as the first case */
- EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &constrained_call->byval_arg, sp [0]->dreg, 0);
- ins->klass = constrained_call;
- sp [0] = handle_box (cfg, ins, constrained_call, mono_class_check_context_used (constrained_call), &bblock);
+ EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &constrained_class->byval_arg, sp [0]->dreg, 0);
+ ins->klass = constrained_class;
+ sp [0] = handle_box (cfg, ins, constrained_class, mono_class_check_context_used (constrained_class), &bblock);
CHECK_CFG_EXCEPTION;
}
}
virtual = 0;
}
- constrained_call = NULL;
+ constrained_class = NULL;
}
if (!calli && check_call_signature (cfg, fsig, sp))
ip += 1;
}
ins_flag = 0;
- constrained_call = NULL;
+ constrained_class = NULL;
if (need_seq_point)
emit_seq_point (cfg, method, ip, FALSE, TRUE);
break;
token = read32 (ip + 1);
klass = mini_get_class (method, token, generic_context);
CHECK_TYPELOAD (klass);
-
+
mono_save_token_info (cfg, image, token, klass);
context_used = mini_class_check_context_used (cfg, klass);
break;
case CEE_ENDFILTER: {
MonoExceptionClause *clause, *nearest;
- int cc, nearest_num;
+ int cc;
CHECK_STACK (1);
--sp;
ip += 2;
nearest = NULL;
- nearest_num = 0;
for (cc = 0; cc < header->num_clauses; ++cc) {
clause = &header->clauses [cc];
if ((clause->flags & MONO_EXCEPTION_CLAUSE_FILTER) &&
((ip - header->code) > clause->data.filter_offset && (ip - header->code) <= clause->handler_offset) &&
- (!nearest || (clause->data.filter_offset < nearest->data.filter_offset))) {
+ (!nearest || (clause->data.filter_offset < nearest->data.filter_offset)))
nearest = clause;
- nearest_num = cc;
- }
}
g_assert (nearest);
if ((ip - header->code) != nearest->handler_offset)
case CEE_CONSTRAINED_:
CHECK_OPSIZE (6);
token = read32 (ip + 2);
- constrained_call = mini_get_class (method, token, generic_context);
- CHECK_TYPELOAD (constrained_call);
+ constrained_class = mini_get_class (method, token, generic_context);
+ CHECK_TYPELOAD (constrained_class);
ip += 6;
break;
case CEE_CPBLK:
ptype = mini_type_get_underlying_type (gsctx, type);
switch (ptype->type) {
- case MONO_TYPE_BOOLEAN:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
case MONO_TYPE_I2:
#endif
/* return value */
- {
- ret_type = mini_type_get_underlying_type (gsctx, sig->ret);
- switch (ret_type->type) {
- case MONO_TYPE_BOOLEAN:
- case MONO_TYPE_I1:
- case MONO_TYPE_U1:
- case MONO_TYPE_I2:
- case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
- case MONO_TYPE_I4:
- case MONO_TYPE_U4:
- case MONO_TYPE_I:
- case MONO_TYPE_U:
- case MONO_TYPE_PTR:
- case MONO_TYPE_FNPTR:
- case MONO_TYPE_CLASS:
- case MONO_TYPE_OBJECT:
- case MONO_TYPE_SZARRAY:
- case MONO_TYPE_ARRAY:
- case MONO_TYPE_STRING:
- cinfo->ret.storage = ArgInIReg;
- cinfo->ret.reg = AMD64_RAX;
- break;
- case MONO_TYPE_U8:
- case MONO_TYPE_I8:
+ ret_type = mini_type_get_underlying_type (gsctx, sig->ret);
+ switch (ret_type->type) {
+ case MONO_TYPE_I1:
+ case MONO_TYPE_U1:
+ case MONO_TYPE_I2:
+ case MONO_TYPE_U2:
+ case MONO_TYPE_I4:
+ case MONO_TYPE_U4:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_FNPTR:
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_STRING:
+ cinfo->ret.storage = ArgInIReg;
+ cinfo->ret.reg = AMD64_RAX;
+ break;
+ case MONO_TYPE_U8:
+ case MONO_TYPE_I8:
+ cinfo->ret.storage = ArgInIReg;
+ cinfo->ret.reg = AMD64_RAX;
+ break;
+ case MONO_TYPE_R4:
+ cinfo->ret.storage = ArgInFloatSSEReg;
+ cinfo->ret.reg = AMD64_XMM0;
+ break;
+ case MONO_TYPE_R8:
+ cinfo->ret.storage = ArgInDoubleSSEReg;
+ cinfo->ret.reg = AMD64_XMM0;
+ break;
+ case MONO_TYPE_GENERICINST:
+ if (!mono_type_generic_inst_is_valuetype (ret_type)) {
cinfo->ret.storage = ArgInIReg;
cinfo->ret.reg = AMD64_RAX;
break;
- case MONO_TYPE_R4:
- cinfo->ret.storage = ArgInFloatSSEReg;
- cinfo->ret.reg = AMD64_XMM0;
- break;
- case MONO_TYPE_R8:
- cinfo->ret.storage = ArgInDoubleSSEReg;
- cinfo->ret.reg = AMD64_XMM0;
- break;
- case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (ret_type)) {
- cinfo->ret.storage = ArgInIReg;
- cinfo->ret.reg = AMD64_RAX;
- break;
- }
- /* fall through */
+ }
+ /* fall through */
#if defined( __native_client_codegen__ )
- case MONO_TYPE_TYPEDBYREF:
+ case MONO_TYPE_TYPEDBYREF:
#endif
- case MONO_TYPE_VALUETYPE: {
- guint32 tmp_gr = 0, tmp_fr = 0, tmp_stacksize = 0;
+ case MONO_TYPE_VALUETYPE: {
+ guint32 tmp_gr = 0, tmp_fr = 0, tmp_stacksize = 0;
- add_valuetype (gsctx, sig, &cinfo->ret, ret_type, TRUE, &tmp_gr, &tmp_fr, &tmp_stacksize);
- if (cinfo->ret.storage == ArgOnStack) {
- cinfo->vtype_retaddr = TRUE;
- /* The caller passes the address where the value is stored */
- }
- break;
+ add_valuetype (gsctx, sig, &cinfo->ret, ret_type, TRUE, &tmp_gr, &tmp_fr, &tmp_stacksize);
+ if (cinfo->ret.storage == ArgOnStack) {
+ cinfo->vtype_retaddr = TRUE;
+ /* The caller passes the address where the value is stored */
}
+ break;
+ }
#if !defined( __native_client_codegen__ )
- case MONO_TYPE_TYPEDBYREF:
- /* Same as a valuetype with size 24 */
- cinfo->vtype_retaddr = TRUE;
- break;
+ case MONO_TYPE_TYPEDBYREF:
+ /* Same as a valuetype with size 24 */
+ cinfo->vtype_retaddr = TRUE;
+ break;
#endif
- case MONO_TYPE_VOID:
- break;
- default:
- g_error ("Can't handle as return value 0x%x", ret_type->type);
- }
+ case MONO_TYPE_VOID:
+ break;
+ default:
+ g_error ("Can't handle as return value 0x%x", ret_type->type);
}
pstart = 0;
ptype = mini_type_get_underlying_type (gsctx, sig->params [i]);
switch (ptype->type) {
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
add_general (&gr, &stack_size, ainfo);
break;
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
add_general (&gr, &stack_size, ainfo);
break;
case MONO_TYPE_I4:
{
MonoType *sig_ret;
MonoMethodSignature *sig;
- MonoMethodHeader *header;
MonoInst *ins;
int i;
CallInfo *cinfo;
- header = cfg->header;
-
sig = mono_method_signature (cfg->method);
cinfo = cfg->arch.cinfo;
for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
ArgInfo *ainfo = &cinfo->args [i];
- MonoType *arg_type;
ins = cfg->args [i];
- if (sig->hasthis && (i == 0))
- arg_type = &mono_defaults.object_class->byval_arg;
- else
- arg_type = sig->params [i - sig->hasthis];
-
switch (ainfo->storage) {
case ArgInIReg:
case ArgInFloatSSEReg:
{
MonoType *sig_ret;
MonoMethodSignature *sig;
- MonoMethodHeader *header;
MonoInst *ins;
int i, offset;
guint32 locals_stack_size, locals_stack_align;
gint32 *offsets;
CallInfo *cinfo;
- header = cfg->header;
-
sig = mono_method_signature (cfg->method);
cinfo = cfg->arch.cinfo;
if (ins->opcode != OP_REGVAR) {
ArgInfo *ainfo = &cinfo->args [i];
gboolean inreg = TRUE;
- MonoType *arg_type;
-
- if (sig->hasthis && (i == 0))
- arg_type = &mono_defaults.object_class->byval_arg;
- else
- arg_type = sig->params [i - sig->hasthis];
if (cfg->globalra) {
/* The new allocator needs info about the original locations of the arguments */
MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, AMD64_RSP, cinfo->sig_cookie.offset, sig_reg);
}
+#ifdef ENABLE_LLVM
static inline LLVMArgStorage
arg_storage_to_llvm_arg_storage (MonoCompile *cfg, ArgStorage storage)
{
}
}
-#ifdef ENABLE_LLVM
LLVMCallInfo*
mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig)
{
MonoInst *arg, *in;
MonoMethodSignature *sig;
MonoType *sig_ret;
- int i, n, stack_size;
+ int i, n;
CallInfo *cinfo;
ArgInfo *ainfo;
- stack_size = 0;
-
sig = call->signature;
n = sig->param_count + sig->hasthis;
else
t = sig->params [i - sig->hasthis];
+ t = mini_get_underlying_type (cfg, t);
if (ainfo->storage == ArgOnStack && !MONO_TYPE_ISSTRUCT (t) && !call->tail_call) {
if (!t->byref) {
if (t->type == MONO_TYPE_R4)
p->regs [greg ++] = PTR_TO_GREG(ret);
for (i = pindex; i < sig->param_count; i++) {
- MonoType *t = mono_type_get_underlying_type (sig->params [i]);
+ MonoType *t = mini_type_get_underlying_type (NULL, sig->params [i]);
gpointer *arg = args [arg_index ++];
if (t->byref) {
p->regs [greg ++] = *(guint64*)(arg);
break;
#endif
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_U1:
p->regs [greg ++] = *(guint8*)(arg);
break;
p->regs [greg ++] = *(gint16*)(arg);
break;
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
p->regs [greg ++] = *(guint16*)(arg);
break;
case MONO_TYPE_I4:
MonoMethodSignature *sig = dinfo->sig;
guint8 *ret = ((DynCallArgs*)buf)->ret;
mgreg_t res = ((DynCallArgs*)buf)->res;
- MonoType *sig_ret = mono_type_get_underlying_type (sig->ret);
+ MonoType *sig_ret = mini_type_get_underlying_type (NULL, sig->ret);
switch (sig_ret->type) {
case MONO_TYPE_VOID:
*(gint8*)ret = res;
break;
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
*(guint8*)ret = res;
break;
case MONO_TYPE_I2:
*(gint16*)ret = res;
break;
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
*(guint16*)ret = res;
break;
case MONO_TYPE_I4:
break;
case OP_FCALL:
case OP_FCALL_REG:
- case OP_FCALL_MEMBASE:
- if (((MonoCallInst*)ins)->signature->ret->type == MONO_TYPE_R4) {
+ case OP_FCALL_MEMBASE: {
+ MonoType *rtype = mini_get_underlying_type (cfg, ((MonoCallInst*)ins)->signature->ret);
+ if (rtype->type == MONO_TYPE_R4) {
amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, AMD64_XMM0);
}
else {
amd64_sse_movsd_reg_reg (code, ins->dreg, AMD64_XMM0);
}
break;
+ }
case OP_RCALL:
case OP_RCALL_REG:
case OP_RCALL_MEMBASE:
MonoCallInst *call;
guint offset;
guint8 *code = cfg->native_code + cfg->code_len;
- MonoInst *last_ins = NULL;
- guint last_offset = 0;
int max_len;
/* Fix max_offset estimate for each successor bb */
g_assert_not_reached ();
#endif
}
-
- last_ins = ins;
- last_offset = offset;
}
cfg->code_len = code - cfg->native_code;
/* Keep this in sync with emit_load_volatile_arguments */
for (i = 0; i < sig->param_count + sig->hasthis; ++i) {
ArgInfo *ainfo = cinfo->args + i;
- gint32 stack_offset;
- MonoType *arg_type;
ins = cfg->args [i];
/* Unused arguments */
continue;
- if (sig->hasthis && (i == 0))
- arg_type = &mono_defaults.object_class->byval_arg;
- else
- arg_type = sig->params [i - sig->hasthis];
-
- stack_offset = ainfo->offset + ARGS_OFFSET;
-
if (cfg->globalra) {
/* All the other moves are done by the register allocator */
switch (ainfo->storage) {
mono_arch_emit_epilog (MonoCompile *cfg)
{
MonoMethod *method = cfg->method;
- int quad, pos, i;
+ int quad, i;
guint8 *code;
int max_epilog_size;
CallInfo *cinfo;
code = mono_arch_instrument_epilog (cfg, mono_trace_leave_method, code, TRUE);
/* the code restoring the registers must be kept in sync with OP_TAILCALL */
- pos = 0;
if (method->save_lmf) {
/* check if we need to restore protection of the stack after a stack overflow */
mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments)
{
guchar *code = p;
- CallInfo *cinfo = NULL;
MonoMethodSignature *sig;
MonoInst *inst;
int i, n, stack_area = 0;
/* Allocate a new area on the stack and save arguments there */
sig = mono_method_signature (cfg->method);
- cinfo = get_call_info (cfg->generic_sharing_context, cfg->mempool, sig);
-
n = sig->param_count + sig->hasthis;
stack_area = ALIGN_TO (n * 8, 16);
} while (0)
void
-mono_amd64_patch (unsigned char* code, gpointer target) MONO_INTERNAL;
+mono_amd64_patch (unsigned char* code, gpointer target);
void
mono_amd64_throw_exception (guint64 dummy1, guint64 dummy2, guint64 dummy3, guint64 dummy4,
guint64 dummy5, guint64 dummy6,
mgreg_t *regs, mgreg_t rip,
- MonoObject *exc, gboolean rethrow) MONO_INTERNAL;
+ MonoObject *exc, gboolean rethrow);
void
mono_amd64_throw_corlib_exception (guint64 dummy1, guint64 dummy2, guint64 dummy3, guint64 dummy4,
guint64 dummy5, guint64 dummy6,
mgreg_t *regs, mgreg_t rip,
- guint32 ex_token_index, gint64 pc_offset) MONO_INTERNAL;
+ guint32 ex_token_index, gint64 pc_offset);
guint64
-mono_amd64_get_original_ip (void) MONO_INTERNAL;
+mono_amd64_get_original_ip (void);
guint8*
-mono_amd64_emit_tls_get (guint8* code, int dreg, int tls_offset) MONO_INTERNAL;
+mono_amd64_emit_tls_get (guint8* code, int dreg, int tls_offset);
gboolean
-mono_amd64_have_tls_get (void) MONO_INTERNAL;
+mono_amd64_have_tls_get (void);
GSList*
-mono_amd64_get_exception_trampolines (gboolean aot) MONO_INTERNAL;
+mono_amd64_get_exception_trampolines (gboolean aot);
int
mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL;
}
simpletype = mini_type_get_underlying_type (gsctx, sig->params [i]);
switch (simpletype->type) {
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
cinfo->args [n].size = 1;
add_general (&gr, &stack_size, ainfo, TRUE);
n++;
break;
- case MONO_TYPE_CHAR:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
cinfo->args [n].size = 2;
{
simpletype = mini_type_get_underlying_type (gsctx, sig->ret);
switch (simpletype->type) {
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
case MONO_TYPE_I:
// FIXME: Preprocess the info to speed up start_dyn_call ()
info->sig = sig;
info->cinfo = cinfo;
- info->rtype = mini_replace_type (sig->ret);
+ info->rtype = mini_type_get_underlying_type (NULL, sig->ret);
info->param_types = g_new0 (MonoType*, sig->param_count);
for (i = 0; i < sig->param_count; ++i)
- info->param_types [i] = mini_replace_type (sig->params [i]);
+ info->param_types [i] = mini_type_get_underlying_type (NULL, sig->params [i]);
return (MonoDynCallInfo*)info;
}
case MONO_TYPE_U:
p->regs [slot] = (mgreg_t)*arg;
break;
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_U1:
p->regs [slot] = *(guint8*)arg;
break;
p->regs [slot] = *(gint16*)arg;
break;
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
p->regs [slot] = *(guint16*)arg;
break;
case MONO_TYPE_I4:
*(gint8*)ret = res;
break;
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
*(guint8*)ret = res;
break;
case MONO_TYPE_I2:
*(gint16*)ret = res;
break;
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
*(guint16*)ret = res;
break;
case MONO_TYPE_I4:
mono_arm_throw_exception_by_token (guint32 type_token, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs);
gpointer
-mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg) MONO_INTERNAL;
+mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg);
typedef enum {
MONO_ARM_FPU_NONE = 0,
mono_arm_thumb_supported (void);
GSList*
-mono_arm_get_exception_trampolines (gboolean aot) MONO_INTERNAL;
+mono_arm_get_exception_trampolines (gboolean aot);
guint8*
-mono_arm_get_thumb_plt_entry (guint8 *code) MONO_INTERNAL;
+mono_arm_get_thumb_plt_entry (guint8 *code);
guint8*
mono_arm_patchable_b (guint8 *code, int cond);
#ifdef USE_JUMP_TABLES
guint8*
-mono_arm_load_jumptable_entry_addr (guint8 *code, gpointer *jte, ARMReg reg) MONO_INTERNAL;
+mono_arm_load_jumptable_entry_addr (guint8 *code, gpointer *jte, ARMReg reg);
guint8*
-mono_arm_load_jumptable_entry (guint8 *code, gpointer *jte, ARMReg reg) MONO_INTERNAL;
+mono_arm_load_jumptable_entry (guint8 *code, gpointer *jte, ARMReg reg);
#endif
gboolean
-mono_arm_is_hard_float (void) MONO_INTERNAL;
+mono_arm_is_hard_float (void);
#endif /* __MONO_MINI_ARM_H__ */
{
MonoInst *load;
int i, sel, spill;
- int *symbolic;
MonoRegState *rs = cfg->rs;
- symbolic = rs->symbolic [bank];
sel = rs->vassign [reg];
/* the vreg we need to spill lives in another logical reg bank */
MonoInst *load;
int i, sel, spill, num_sregs;
int sregs [MONO_MAX_SRC_REGS];
- int *symbolic;
MonoRegState *rs = cfg->rs;
- symbolic = rs->symbolic [bank];
-
g_assert (bank < MONO_NUM_REGBANKS);
DEBUG (printf ("\tstart regmask to assign R%d: 0x%08llu (R%d <- R%d R%d R%d)\n", reg, (unsigned long long)regmask, ins->dreg, ins->sreg1, ins->sreg2, ins->sreg3));
ins->dreg = -1;
}
- if (spec [MONO_INST_CLOB] == 'c' && MONO_IS_CALL (ins)) {
- /* A call instruction implicitly uses all registers in call->out_ireg_args */
-
- MonoCallInst *call = (MonoCallInst*)ins;
- GSList *list;
-
- list = call->out_ireg_args;
- if (list) {
- while (list) {
- guint32 regpair;
- int reg, hreg;
-
- regpair = (guint32)(gssize)(list->data);
- hreg = regpair >> 24;
- reg = regpair & 0xffffff;
-
- //reginfo [reg].prev_use = reginfo [reg].last_use;
- //reginfo [reg].last_use = i;
-
- list = g_slist_next (list);
- }
- }
-
- list = call->out_freg_args;
- if (list) {
- while (list) {
- guint32 regpair;
- int reg, hreg;
-
- regpair = (guint32)(gssize)(list->data);
- hreg = regpair >> 24;
- reg = regpair & 0xffffff;
-
- list = g_slist_next (list);
- }
- }
- }
-
++i;
}
DEBUG (print_regtrack (reginfo, rs->next_vreg));
MONO_BB_FOR_EACH_INS_REVERSE_SAFE (bb, prev, ins) {
- int prev_dreg, clob_dreg;
+ int prev_dreg;
int dest_dreg, clob_reg;
int dest_sregs [MONO_MAX_SRC_REGS], prev_sregs [MONO_MAX_SRC_REGS];
int dreg_high, sreg1_high;
spec_src1 = spec [MONO_INST_SRC1];
spec_dest = spec [MONO_INST_DEST];
prev_dreg = -1;
- clob_dreg = -1;
clob_reg = -1;
dest_dreg = -1;
dreg_high = -1;
prev_dreg = ins->dreg;
assign_reg (cfg, rs, ins->dreg, new_dest, 0);
- clob_dreg = ins->dreg;
create_copy_ins (cfg, bb, tmp, dest_sreg, new_dest, ins, ip, 0);
mono_regstate_free_int (rs, dest_sreg);
need_spill = FALSE;
gboolean
mono_is_regsize_var (MonoType *t)
{
- if (t->byref)
- return TRUE;
- t = mono_type_get_underlying_type (t);
+ t = mini_type_get_underlying_type (NULL, t);
switch (t->type) {
- case MONO_TYPE_BOOLEAN:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
case MONO_TYPE_I2:
if (find_prev_seq_point_for_native_offset (domain, jinfo_get_method (ji), sf->native_offset, NULL, &sp))
sf->il_offset = sp.il_offset;
else
- sf->il_offset = 0;
+ sf->il_offset = -1;
}
if (need_file_info) {
for (i = 0; i < attrs->num_attrs; ++i) {
MonoCustomAttrEntry *attr = &attrs->attrs [i];
const gchar *p;
- int len, num_named, named_type, data_type, name_len;
+ int num_named, named_type, name_len;
char *name;
if (!attr->ctor || attr->ctor->klass != klass)
continue;
/* Decode the RuntimeCompatibilityAttribute. See reflection.c */
- len = attr->data_size;
p = (const char*)attr->data;
g_assert (read16 (p) == 0x0001);
p += 2;
p += 2;
named_type = *p;
p ++;
- data_type = *p;
+ /* data_type = *p; */
p ++;
/* Property */
if (named_type != 0x54)
SLOT_PIN = 2
} GCSlotType;
-void mini_gc_init (void) MONO_INTERNAL;
+void mini_gc_init (void);
-void mini_gc_init_cfg (MonoCompile *cfg) MONO_INTERNAL;
+void mini_gc_init_cfg (MonoCompile *cfg);
-void mini_gc_enable_gc_maps_for_aot (void) MONO_INTERNAL;
+void mini_gc_enable_gc_maps_for_aot (void);
-void mini_gc_create_gc_map (MonoCompile *cfg) MONO_INTERNAL;
+void mini_gc_create_gc_map (MonoCompile *cfg);
-void mini_gc_set_slot_type_from_fp (MonoCompile *cfg, int slot_offset, GCSlotType type) MONO_INTERNAL;
+void mini_gc_set_slot_type_from_fp (MonoCompile *cfg, int slot_offset, GCSlotType type);
-void mini_gc_set_slot_type_from_cfa (MonoCompile *cfg, int slot_offset, GCSlotType type) MONO_INTERNAL;
+void mini_gc_set_slot_type_from_cfa (MonoCompile *cfg, int slot_offset, GCSlotType type);
#endif
#include "mini.h"
-#define ALLOW_PARTIAL_SHARING TRUE
-//#define ALLOW_PARTIAL_SHARING FALSE
+//#define ALLOW_PARTIAL_SHARING TRUE
+#define ALLOW_PARTIAL_SHARING FALSE
#if 0
#define DEBUG(...) __VA_ARGS__
{
case MONO_RGCTX_INFO_STATIC_DATA:
case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
case MONO_RGCTX_INFO_VTABLE:
case MONO_RGCTX_INFO_TYPE:
case MONO_RGCTX_INFO_REFLECTION_TYPE:
switch (info_type) {
case MONO_RGCTX_INFO_STATIC_DATA:
case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
case MONO_RGCTX_INFO_VTABLE:
case MONO_RGCTX_INFO_TYPE:
case MONO_RGCTX_INFO_REFLECTION_TYPE:
gboolean allow_partial)
{
int i;
- gboolean has_ref = FALSE;
for (i = 0; i < inst->type_argc; ++i) {
MonoType *type = inst->type_argv [i];
- if (MONO_TYPE_IS_REFERENCE (type) || (allow_type_vars && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR))) {
- has_ref = TRUE;
+ if (MONO_TYPE_IS_REFERENCE (type) || (allow_type_vars && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR)))
continue;
- }
- /*
- * Allow non ref arguments, if there is at least one ref argument
- * (partial sharing).
- * FIXME: Allow more types
- */
- if (allow_partial && !type->byref && (((type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8)) || (type->type == MONO_TYPE_I) || (type->type == MONO_TYPE_U)))
+ /* Allow non ref arguments if they are primitive types or enums (partial sharing). */
+ if (allow_partial && !type->byref && (((type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8)) || (type->type == MONO_TYPE_I) || (type->type == MONO_TYPE_U) || (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype)))
continue;
return FALSE;
}
- if (allow_partial)
- return has_ref;
- else
- return TRUE;
+ return TRUE;
}
/*
}
case MONO_RGCTX_INFO_KLASS:
return class;
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
+ return class->element_class;
case MONO_RGCTX_INFO_VTABLE: {
MonoVTable *vtable = mono_class_vtable (domain, class);
if (!vtable)
switch (oti->info_type) {
case MONO_RGCTX_INFO_STATIC_DATA:
case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
case MONO_RGCTX_INFO_VTABLE:
case MONO_RGCTX_INFO_CAST_CACHE:
temporary = TRUE;
switch (oti->info_type) {
case MONO_RGCTX_INFO_STATIC_DATA:
case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
case MONO_RGCTX_INFO_VTABLE:
case MONO_RGCTX_INFO_CAST_CACHE:
case MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE:
switch (type) {
case MONO_RGCTX_INFO_STATIC_DATA: return "STATIC_DATA";
case MONO_RGCTX_INFO_KLASS: return "KLASS";
+ case MONO_RGCTX_INFO_ELEMENT_KLASS: return "ELEMENT_KLASS";
case MONO_RGCTX_INFO_VTABLE: return "VTABLE";
case MONO_RGCTX_INFO_TYPE: return "TYPE";
case MONO_RGCTX_INFO_REFLECTION_TYPE: return "REFLECTION_TYPE";
switch (info_type) {
case MONO_RGCTX_INFO_STATIC_DATA:
case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
case MONO_RGCTX_INFO_VTABLE:
case MONO_RGCTX_INFO_TYPE:
case MONO_RGCTX_INFO_REFLECTION_TYPE:
switch (info_type) {
case MONO_RGCTX_INFO_STATIC_DATA:
case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_ELEMENT_KLASS:
case MONO_RGCTX_INFO_VTABLE:
case MONO_RGCTX_INFO_TYPE:
case MONO_RGCTX_INFO_REFLECTION_TYPE:
/* Do less expensive checks first */
sig = mono_method_signature (method);
if (attr_class && sig && ((sig->ret->type == MONO_TYPE_VOID) ||
- (sig->ret->type == MONO_TYPE_CLASS && (sig->ret->data.generic_class->container_class->name, "Task")) ||
+ (sig->ret->type == MONO_TYPE_CLASS && !strcmp (sig->ret->data.generic_class->container_class->name, "Task")) ||
(sig->ret->type == MONO_TYPE_GENERICINST && !strcmp (sig->ret->data.generic_class->container_class->name, "Task`1")))) {
//printf ("X: %s\n", mono_method_full_name (method, TRUE));
cattr = mono_custom_attrs_from_method (method);
if (!partial_sharing_supported ())
allow_partial = FALSE;
+ if (method->klass->image->dynamic)
+ /*
+ * Enabling this causes corlib test failures because the JIT encounters generic instances whose
+ * instance_size is 0.
+ */
+ allow_partial = FALSE;
+
/*
* Generic async methods have an associated state machine class which is a generic struct. This struct
* is too large to be handled by gsharedvt so we make it visible to the AOT compiler by disabling sharing
*/
if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && mini_is_gsharedvt_type_gsctx (gsctx, type))
return type;
- else
+ else if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR)) {
+ MonoTypeEnum constraint = type->data.generic_param->gshared_constraint;
+ /* The gparam serial encodes the type this gparam can represent */
+ if (constraint == 0) {
+ return &mono_defaults.object_class->byval_arg;
+ } else {
+ MonoType t;
+ MonoClass *klass;
+
+ g_assert (constraint != MONO_TYPE_VALUETYPE);
+ memset (&t, 0, sizeof (t));
+ t.type = constraint;
+ klass = mono_class_from_mono_type (&t);
+ return &klass->byval_arg;
+ }
+ } else {
return mini_native_type_replace_type (mono_type_get_basic_type_from_generic (type));
+ }
}
/*
* mini_type_get_underlying_type:
*
- * Return the underlying type of TYPE, taking into account enums, byref and generic
+ * Return the underlying type of TYPE, taking into account enums, byref, bool, char and generic
* sharing.
*/
MonoType*
return &mono_defaults.int_class->byval_arg;
if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && mini_is_gsharedvt_type_gsctx (gsctx, type))
return type;
- return mini_get_basic_type_from_generic (gsctx, mono_type_get_underlying_type (type));
+ type = mini_get_basic_type_from_generic (gsctx, mono_type_get_underlying_type (type));
+ switch (type->type) {
+ case MONO_TYPE_BOOLEAN:
+ return &mono_defaults.byte_class->byval_arg;
+ case MONO_TYPE_CHAR:
+ return &mono_defaults.uint16_class->byval_arg;
+ default:
+ return type;
+ }
}
/*
gboolean
mini_type_is_reference (MonoCompile *cfg, MonoType *type)
{
- if (mono_type_is_reference (type))
- return TRUE;
- if (!cfg->generic_sharing_context)
- return FALSE;
- /*FIXME the probably needs better handle under partial sharing*/
- return ((type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && !mini_type_var_is_vt (cfg, type));
+ if (cfg->generic_sharing_context)
+ type = mini_get_underlying_type (cfg, type);
+ return mono_type_is_reference (type);
}
/*
return mini_is_gsharedvt_variable_type (cfg, &klass->byval_arg);
}
+static char*
+get_shared_gparam_name (MonoTypeEnum constraint, const char *name)
+{
+ if (constraint == MONO_TYPE_VALUETYPE)
+ return g_strdup_printf ("%s_GSHAREDVT", name);
+ else {
+ MonoType t;
+ char *tname, *tname2, *res;
+
+ memset (&t, 0, sizeof (t));
+ t.type = constraint;
+ tname = mono_type_full_name (&t);
+ tname2 = g_utf8_strup (tname, strlen (tname));
+ res = g_strdup_printf ("%s_%s", name, tname2);
+ g_free (tname);
+ g_free (tname2);
+ return res;
+ }
+}
+
+/*
+ * get_shared_gparam:
+ *
+ * Create an anonymous gparam with a type variable with a constraint which encodes which types can match it.
+ */
+static MonoType*
+get_shared_gparam (MonoType *t, MonoTypeEnum constraint)
+{
+ MonoGenericParam *par = t->data.generic_param;
+ MonoGenericParam *copy;
+ MonoType *res;
+ MonoImage *image = NULL;
+ char *name;
+
+ g_assert (mono_generic_param_info (par));
+ /* image might not be set for sre */
+ if (par->owner && par->owner->image) {
+ image = par->owner->image;
+
+ mono_image_lock (image);
+ if (!image->gshared_types) {
+ image->gshared_types_len = MONO_TYPE_INTERNAL;
+ image->gshared_types = g_new0 (GHashTable*, image->gshared_types_len);
+ }
+ if (!image->gshared_types [constraint])
+ image->gshared_types [constraint] = g_hash_table_new (NULL, NULL);
+ res = g_hash_table_lookup (image->gshared_types [constraint], par);
+ mono_image_unlock (image);
+ if (res)
+ return res;
+ copy = mono_image_alloc0 (image, sizeof (MonoGenericParamFull));
+ memcpy (copy, par, sizeof (MonoGenericParamFull));
+ name = get_shared_gparam_name (constraint, ((MonoGenericParamFull*)copy)->info.name);
+ ((MonoGenericParamFull*)copy)->info.name = mono_image_strdup (image, name);
+ g_free (name);
+ } else {
+ /* mono_generic_param_name () expects this to be a MonoGenericParamFull */
+ copy = (MonoGenericParam*)g_new0 (MonoGenericParamFull, 1);
+ memcpy (copy, par, sizeof (MonoGenericParam));
+ }
+ copy->owner = NULL;
+ // FIXME:
+ copy->image = mono_defaults.corlib;
+ copy->gshared_constraint = constraint;
+ res = mono_metadata_type_dup (NULL, t);
+ res->data.generic_param = copy;
+
+ if (image) {
+ mono_image_lock (image);
+ /* Duplicates are ok */
+ g_hash_table_insert (image->gshared_types [constraint], par, res);
+ mono_image_unlock (image);
+ }
+
+ return res;
+}
+
+static MonoType*
+get_shared_type (MonoType *t, MonoType *type)
+{
+ MonoTypeEnum ttype;
+
+ g_assert (!type->byref && (((type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8)) || (type->type == MONO_TYPE_I) || (type->type == MONO_TYPE_U) || (type->type == MONO_TYPE_VALUETYPE && type->data.klass->enumtype)));
+
+ /* Create a type variable with a constraint which encodes which types can match it */
+ ttype = type->type;
+ if (type->type == MONO_TYPE_VALUETYPE)
+ ttype = mono_class_enum_basetype (type->data.klass)->type;
+ return get_shared_gparam (t, ttype);
+}
+
+static MonoType*
+get_gsharedvt_type (MonoType *t)
+{
+ return get_shared_gparam (t, MONO_TYPE_VALUETYPE);
+}
+
+static MonoGenericInst*
+get_shared_inst (MonoGenericInst *inst, MonoGenericInst *shared_inst, MonoGenericContainer *container, gboolean all_vt, gboolean gsharedvt, gboolean partial)
+{
+ MonoGenericInst *res;
+ MonoType **type_argv;
+ int i;
+
+ type_argv = g_new0 (MonoType*, inst->type_argc);
+ for (i = 0; i < inst->type_argc; ++i) {
+ if (!all_vt && (MONO_TYPE_IS_REFERENCE (inst->type_argv [i]) || inst->type_argv [i]->type == MONO_TYPE_VAR || inst->type_argv [i]->type == MONO_TYPE_MVAR)) {
+ type_argv [i] = shared_inst->type_argv [i];
+ } else if (partial) {
+ /* These types match the ones in generic_inst_is_sharable () */
+ type_argv [i] = get_shared_type (shared_inst->type_argv [i], inst->type_argv [i]);
+ } else if (all_vt) {
+ type_argv [i] = get_gsharedvt_type (shared_inst->type_argv [i]);
+ } else if (gsharedvt) {
+ type_argv [i] = get_gsharedvt_type (shared_inst->type_argv [i]);
+ } else {
+ type_argv [i] = inst->type_argv [i];
+ }
+ }
+
+ res = mono_metadata_get_generic_inst (inst->type_argc, type_argv);
+ g_free (type_argv);
+ return res;
+}
+
+/*
+ * mini_get_shared_method_full:
+ *
+ * Return the method which is actually compiled/registered when doing generic sharing.
+ * If ALL_VT is true, return the shared method belonging to an all-vtype instantiation.
+ * If IS_GSHAREDVT is true, treat METHOD as a gsharedvt method even if it fails some constraints.
+ * METHOD can be a non-inflated generic method.
+ */
+MonoMethod*
+mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gsharedvt)
+{
+ MonoError error;
+ MonoGenericContext shared_context;
+ MonoMethod *declaring_method, *res;
+ gboolean partial = FALSE;
+ gboolean gsharedvt = FALSE;
+ MonoGenericContainer *class_container, *method_container = NULL;
+
+ if (method->is_generic || (method->klass->generic_container && !method->is_inflated)) {
+ declaring_method = method;
+ } else {
+ declaring_method = mono_method_get_declaring_generic_method (method);
+ }
+
+ if (declaring_method->is_generic)
+ shared_context = mono_method_get_generic_container (declaring_method)->context;
+ else
+ shared_context = declaring_method->klass->generic_container->context;
+
+ /* Handle gsharedvt/partial sharing */
+ if ((method != declaring_method && method->is_inflated && !mono_method_is_generic_sharable_full (method, FALSE, FALSE, TRUE)) ||
+ is_gsharedvt || mini_is_gsharedvt_sharable_method (method)) {
+ MonoGenericContext *context = mono_method_get_context (method);
+ MonoGenericInst *inst;
+
+ partial = mono_method_is_generic_sharable_full (method, FALSE, TRUE, FALSE);
+
+ gsharedvt = is_gsharedvt || (!partial && mini_is_gsharedvt_sharable_method (method));
+
+ class_container = declaring_method->klass->generic_container;
+ method_container = mono_method_get_generic_container (declaring_method);
+
+ /*
+ * Create the shared context by replacing the ref type arguments with
+ * type parameters, and keeping the rest.
+ */
+ if (context)
+ inst = context->class_inst;
+ else
+ inst = shared_context.class_inst;
+ if (inst)
+ shared_context.class_inst = get_shared_inst (inst, shared_context.class_inst, class_container, all_vt, gsharedvt, partial);
+
+ if (context)
+ inst = context->method_inst;
+ else
+ inst = shared_context.method_inst;
+ if (inst)
+ shared_context.method_inst = get_shared_inst (inst, shared_context.method_inst, method_container, all_vt, gsharedvt, partial);
+
+ partial = TRUE;
+ }
+
+ res = mono_class_inflate_generic_method_checked (declaring_method, &shared_context, &error);
+ g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+
+ if (!partial) {
+ /* The result should be an inflated method whose parent is not inflated */
+ g_assert (!res->klass->is_inflated);
+ }
+ return res;
+}
+
+MonoMethod*
+mini_get_shared_method (MonoMethod *method)
+{
+ return mini_get_shared_method_full (method, FALSE, FALSE);
+}
+
#if defined(ENABLE_GSHAREDVT)
#include "../../../mono-extensions/mono/mini/mini-generic-sharing-gsharedvt.c"
} MonoPPCFunctionDescriptor;
#define PPC_FTNPTR_SIZE sizeof (MonoPPCFunctionDescriptor)
-extern guint8* mono_ppc_create_pre_code_ftnptr (guint8 *code) MONO_INTERNAL;
+extern guint8* mono_ppc_create_pre_code_ftnptr (guint8 *code);
#else
#define PPC_FTNPTR_SIZE 0
#define mono_ppc_create_pre_code_ftnptr(c) c
#endif
gboolean
-mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
+mono_ppc_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig);
void
-mono_ppc_patch (guchar *code, const guchar *target) MONO_INTERNAL;
+mono_ppc_patch (guchar *code, const guchar *target);
void
-mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow) MONO_INTERNAL;
+mono_ppc_throw_exception (MonoObject *exc, unsigned long eip, unsigned long esp, mgreg_t *int_regs, gdouble *fp_regs, gboolean rethrow);
#ifdef __mono_ppc64__
#define MONO_PPC_32_64_CASE(c32,c64) c64
#define MONO_PPC_32_64_CASE(c32,c64) c32
#endif
-gboolean mono_ppc_is_direct_call_sequence (guint32 *code) MONO_INTERNAL;
+gboolean mono_ppc_is_direct_call_sequence (guint32 *code);
-void mono_ppc_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) MONO_INTERNAL;
+void mono_ppc_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr);
-void mono_ppc_set_func_into_sigctx (void *sigctx, void *func) MONO_INTERNAL;
+void mono_ppc_set_func_into_sigctx (void *sigctx, void *func);
#endif /* __MONO_MINI_PPC_H__ */
return mono_icall_get_wrapper_full (callinfo, FALSE);
}
-static void
-mono_dynamic_code_hash_insert (MonoDomain *domain, MonoMethod *method, MonoJitDynamicMethodInfo *ji)
-{
- if (!domain_jit_info (domain)->dynamic_code_hash)
- domain_jit_info (domain)->dynamic_code_hash = g_hash_table_new (NULL, NULL);
- g_hash_table_insert (domain_jit_info (domain)->dynamic_code_hash, method, ji);
-}
-
static MonoJitDynamicMethodInfo*
mono_dynamic_code_hash_lookup (MonoDomain *domain, MonoMethod *method)
{
mono_register_jit_icall_full (func, name, sig, save, FALSE, save ? name : NULL);
}
-/* Register a jit icall which doesn't throw exceptions through mono_raise_exception () */
-static void
-register_icall_noraise (gpointer func, const char *name, const char *sigstr)
-{
- MonoMethodSignature *sig;
-
- if (sigstr)
- sig = mono_create_icall_signature (sigstr);
- else
- sig = NULL;
-
- mono_register_jit_icall_full (func, name, sig, TRUE, TRUE, name);
-}
-
static void
register_dyn_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
{
break;
}
case MONO_PATCH_INFO_LDSTR_LIT: {
- target = mono_string_new (domain, patch_info->data.target);
+ int len;
+ char *s;
+
+ len = strlen (patch_info->data.target);
+ s = mono_domain_alloc0 (domain, len + 1);
+ memcpy (s, patch_info->data.target, len);
+ target = s;
+
break;
}
default:
return (gpointer)target;
}
-static MonoType*
-get_gsharedvt_type (MonoType *t)
-{
- MonoGenericParam *par = t->data.generic_param;
- MonoGenericParam *copy;
- MonoType *res;
- MonoImage *image = NULL;
-
- /*
- * Create an anonymous gparam with a different serial so normal gshared and gsharedvt methods have
- * a different instantiation.
- */
- g_assert (mono_generic_param_info (par));
- if (par->owner) {
- image = par->owner->image;
-
- mono_image_lock (image);
- if (!image->gsharedvt_types)
- image->gsharedvt_types = g_hash_table_new (NULL, NULL);
- res = g_hash_table_lookup (image->gsharedvt_types, par);
- mono_image_unlock (image);
- if (res)
- return res;
- copy = mono_image_alloc0 (image, sizeof (MonoGenericParamFull));
- memcpy (copy, par, sizeof (MonoGenericParamFull));
- } else {
- copy = g_memdup (par, sizeof (MonoGenericParam));
- }
- copy->owner = NULL;
- // FIXME:
- copy->image = mono_defaults.corlib;
- copy->serial = 1;
- res = mono_metadata_type_dup (NULL, t);
- res->data.generic_param = copy;
-
- if (par->owner) {
- mono_image_lock (image);
- /* Duplicates are ok */
- g_hash_table_insert (image->gsharedvt_types, par, res);
- mono_image_unlock (image);
- }
-
- return res;
-}
-
static gboolean
is_gsharedvt_type (MonoType *t)
{
- return (t->type == MONO_TYPE_VAR || t->type == MONO_TYPE_MVAR) && t->data.generic_param->serial == 1;
-}
-
-/* Return whenever METHOD is a gsharedvt method */
-static gboolean
-is_gsharedvt_method (MonoMethod *method)
-{
- MonoGenericContext *context;
- MonoGenericInst *inst;
- int i;
-
- if (!method->is_inflated)
- return FALSE;
- context = mono_method_get_context (method);
- inst = context->class_inst;
- if (inst) {
- for (i = 0; i < inst->type_argc; ++i)
- if (is_gsharedvt_type (inst->type_argv [i]))
- return TRUE;
- }
- inst = context->method_inst;
- if (inst) {
- for (i = 0; i < inst->type_argc; ++i)
- if (is_gsharedvt_type (inst->type_argv [i]))
- return TRUE;
- }
- return FALSE;
-}
-
-static gboolean
-is_open_method (MonoMethod *method)
-{
- MonoGenericContext *context;
-
- if (!method->is_inflated)
- return FALSE;
- context = mono_method_get_context (method);
- if (context->class_inst && context->class_inst->is_open)
- return TRUE;
- if (context->method_inst && context->method_inst->is_open)
- return TRUE;
- return FALSE;
-}
-
-static MonoGenericInst*
-get_shared_inst (MonoGenericInst *inst, MonoGenericInst *shared_inst, MonoGenericContainer *container, gboolean all_vt, gboolean gsharedvt)
-{
- MonoGenericInst *res;
- MonoType **type_argv;
- int i;
-
- type_argv = g_new0 (MonoType*, inst->type_argc);
- for (i = 0; i < inst->type_argc; ++i) {
- if (!all_vt && (MONO_TYPE_IS_REFERENCE (inst->type_argv [i]) || inst->type_argv [i]->type == MONO_TYPE_VAR || inst->type_argv [i]->type == MONO_TYPE_MVAR)) {
- type_argv [i] = shared_inst->type_argv [i];
- } else if (all_vt) {
- type_argv [i] = get_gsharedvt_type (shared_inst->type_argv [i]);
- } else if (gsharedvt) {
- type_argv [i] = get_gsharedvt_type (shared_inst->type_argv [i]);
- } else {
- type_argv [i] = inst->type_argv [i];
- }
- }
-
- res = mono_metadata_get_generic_inst (inst->type_argc, type_argv);
- g_free (type_argv);
- return res;
-}
-
-/*
- * mini_get_shared_method_full:
- *
- * Return the method which is actually compiled/registered when doing generic sharing.
- * If ALL_VT is true, return the shared method belonging to an all-vtype instantiation.
- * If IS_GSHAREDVT is true, treat METHOD as a gsharedvt method even if it fails some constraints.
- * METHOD can be a non-inflated generic method.
- */
-MonoMethod*
-mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gsharedvt)
-{
- MonoError error;
- MonoGenericContext shared_context;
- MonoMethod *declaring_method, *res;
- gboolean partial = FALSE;
- gboolean gsharedvt = FALSE;
- MonoGenericContainer *class_container, *method_container = NULL;
-
- if (method->is_generic || (method->klass->generic_container && !method->is_inflated)) {
- declaring_method = method;
- } else {
- declaring_method = mono_method_get_declaring_generic_method (method);
- }
-
- if (declaring_method->is_generic)
- shared_context = mono_method_get_generic_container (declaring_method)->context;
- else
- shared_context = declaring_method->klass->generic_container->context;
-
- /* Handle gsharedvt/partial sharing */
- if ((method != declaring_method && method->is_inflated && !mono_method_is_generic_sharable_full (method, FALSE, FALSE, TRUE)) ||
- is_gsharedvt || mini_is_gsharedvt_sharable_method (method)) {
- MonoGenericContext *context = mono_method_get_context (method);
- MonoGenericInst *inst;
-
- partial = mono_method_is_generic_sharable_full (method, FALSE, TRUE, FALSE);
-
- gsharedvt = is_gsharedvt || (!partial && mini_is_gsharedvt_sharable_method (method));
-
- class_container = declaring_method->klass->generic_container;
- method_container = mono_method_get_generic_container (declaring_method);
-
- /*
- * Create the shared context by replacing the ref type arguments with
- * type parameters, and keeping the rest.
- */
- if (context)
- inst = context->class_inst;
- else
- inst = shared_context.class_inst;
- if (inst)
- shared_context.class_inst = get_shared_inst (inst, shared_context.class_inst, class_container, all_vt, gsharedvt);
-
- if (context)
- inst = context->method_inst;
- else
- inst = shared_context.method_inst;
- if (inst)
- shared_context.method_inst = get_shared_inst (inst, shared_context.method_inst, method_container, all_vt, gsharedvt);
-
- partial = TRUE;
- }
-
- res = mono_class_inflate_generic_method_checked (declaring_method, &shared_context, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
-
- if (!partial) {
- /* The result should be an inflated method whose parent is not inflated */
- g_assert (!res->klass->is_inflated);
- }
- return res;
-}
-
-MonoMethod*
-mini_get_shared_method (MonoMethod *method)
-{
- return mini_get_shared_method_full (method, FALSE, FALSE);
+ return (t->type == MONO_TYPE_VAR || t->type == MONO_TYPE_MVAR) && t->data.generic_param->gshared_constraint == MONO_TYPE_VALUETYPE;
}
void
for (i = 0; i < inst->type_argc; ++i) {
MonoType *type = inst->type_argv [i];
- if ((type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && type->data.generic_param->serial == 1)
+ if (is_gsharedvt_type (type))
gsctx->var_is_vt [i] = TRUE;
}
}
for (i = 0; i < inst->type_argc; ++i) {
MonoType *type = inst->type_argv [i];
- if ((type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && type->data.generic_param->serial == 1)
+ if (is_gsharedvt_type (type))
gsctx->mvar_is_vt [i] = TRUE;
}
}
};
int
-mono_hw_reg_to_dwarf_reg (int reg) MONO_INTERNAL;
+mono_hw_reg_to_dwarf_reg (int reg);
int
-mono_dwarf_reg_to_hw_reg (int reg) MONO_INTERNAL;
+mono_dwarf_reg_to_hw_reg (int reg);
int
-mono_unwind_get_dwarf_data_align (void) MONO_INTERNAL;
+mono_unwind_get_dwarf_data_align (void);
int
-mono_unwind_get_dwarf_pc_reg (void) MONO_INTERNAL;
+mono_unwind_get_dwarf_pc_reg (void);
guint8*
-mono_unwind_ops_encode (GSList *unwind_ops, guint32 *out_len) MONO_INTERNAL;
+mono_unwind_ops_encode (GSList *unwind_ops, guint32 *out_len);
void
mono_unwind_frame (guint8 *unwind_info, guint32 unwind_info_len,
guint8 *start_ip, guint8 *end_ip, guint8 *ip, guint8 **mark_locations,
mgreg_t *regs, int nregs,
mgreg_t **save_locations, int save_locations_len,
- guint8 **out_cfa) MONO_INTERNAL;
+ guint8 **out_cfa);
-void mono_unwind_init (void) MONO_INTERNAL;
+void mono_unwind_init (void);
-void mono_unwind_cleanup (void) MONO_INTERNAL;
+void mono_unwind_cleanup (void);
-guint32 mono_cache_unwind_info (guint8 *unwind_info, guint32 unwind_info_len) MONO_INTERNAL;
+guint32 mono_cache_unwind_info (guint8 *unwind_info, guint32 unwind_info_len);
-guint8* mono_get_cached_unwind_info (guint32 index, guint32 *unwind_info_len) MONO_INTERNAL;
+guint8* mono_get_cached_unwind_info (guint32 index, guint32 *unwind_info_len);
guint8* mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJitExceptionInfo **ex_info, guint32 *ex_info_len, gpointer **type_info, int *this_reg, int *this_offset) MONO_LLVM_INTERNAL;
} MonoLLVMFDEInfo;
void
-mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8 *code, MonoLLVMFDEInfo *res) MONO_INTERNAL;
+mono_unwind_decode_llvm_mono_fde (guint8 *fde, int fde_len, guint8 *cie, guint8 *code, MonoLLVMFDEInfo *res);
-GSList* mono_unwind_get_cie_program (void) MONO_INTERNAL;
+GSList* mono_unwind_get_cie_program (void);
void mono_print_unwind_info (guint8 *unwind_info, int unwind_info_len) MONO_LLVM_INTERNAL;
{
ret_type = mini_type_get_underlying_type (gsctx, sig->ret);
switch (ret_type->type) {
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
case MONO_TYPE_I4:
case MONO_TYPE_U4:
case MONO_TYPE_I:
}
ptype = mini_type_get_underlying_type (gsctx, sig->params [i]);
switch (ptype->type) {
- case MONO_TYPE_BOOLEAN:
case MONO_TYPE_I1:
case MONO_TYPE_U1:
add_general (&gr, param_regs, &stack_size, ainfo);
break;
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
add_general (&gr, param_regs, &stack_size, ainfo);
break;
case MONO_TYPE_I4:
#define MONO_ARCH_HAVE_DECOMPOSE_LONG_OPTS 1
-#ifndef TARGET_WIN32
#define MONO_ARCH_AOT_SUPPORTED 1
-#endif
#define MONO_ARCH_GSHARED_SUPPORTED 1
#define MONO_ARCH_HAVE_LLVM_IMT_TRAMPOLINE 1
} GSharedVtCallInfo;
guint8*
-mono_x86_emit_tls_get (guint8* code, int dreg, int tls_offset) MONO_INTERNAL;
+mono_x86_emit_tls_get (guint8* code, int dreg, int tls_offset);
guint8*
-mono_x86_emit_tls_get_reg (guint8* code, int dreg, int offset_reg) MONO_INTERNAL;
+mono_x86_emit_tls_get_reg (guint8* code, int dreg, int offset_reg);
guint32
-mono_x86_get_this_arg_offset (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig) MONO_INTERNAL;
+mono_x86_get_this_arg_offset (MonoGenericSharingContext *gsctx, MonoMethodSignature *sig);
gboolean
-mono_x86_have_tls_get (void) MONO_INTERNAL;
+mono_x86_have_tls_get (void);
void
mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc,
- mgreg_t eip, gboolean rethrow) MONO_INTERNAL;
+ mgreg_t eip, gboolean rethrow);
void
mono_x86_throw_corlib_exception (mgreg_t *regs, guint32 ex_token_index,
- mgreg_t eip, gint32 pc_offset) MONO_INTERNAL;
+ mgreg_t eip, gint32 pc_offset);
void
-mono_x86_patch (unsigned char* code, gpointer target) MONO_INTERNAL;
+mono_x86_patch (unsigned char* code, gpointer target);
gpointer
-mono_x86_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg) MONO_INTERNAL;
+mono_x86_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg);
#endif /* __MONO_MINI_X86_H__ */
switch (type->type) {
case MONO_TYPE_I1:
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
return OP_STOREI1_MEMBASE_REG;
case MONO_TYPE_I2:
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
return OP_STOREI2_MEMBASE_REG;
case MONO_TYPE_I4:
case MONO_TYPE_U4:
case MONO_TYPE_I1:
return OP_LOADI1_MEMBASE;
case MONO_TYPE_U1:
- case MONO_TYPE_BOOLEAN:
return OP_LOADU1_MEMBASE;
case MONO_TYPE_I2:
return OP_LOADI2_MEMBASE;
case MONO_TYPE_U2:
- case MONO_TYPE_CHAR:
return OP_LOADU2_MEMBASE;
case MONO_TYPE_I4:
return OP_LOADI4_MEMBASE;
if (cfg->disable_reuse_stack_slots)
reuse_slot = FALSE;
+ t = mini_get_underlying_type (cfg, t);
switch (t->type) {
case MONO_TYPE_GENERICINST:
if (!mono_type_generic_inst_is_valuetype (t)) {
if (cfg->disable_reuse_stack_slots)
reuse_slot = FALSE;
- if (t->byref) {
- slot_info = &scalar_stack_slots [MONO_TYPE_I];
- } else {
- switch (t->type) {
- case MONO_TYPE_GENERICINST:
- if (!mono_type_generic_inst_is_valuetype (t)) {
- slot_info = &scalar_stack_slots [t->type];
- break;
- }
- /* Fall through */
- case MONO_TYPE_VALUETYPE:
- if (!vtype_stack_slots)
- vtype_stack_slots = mono_mempool_alloc0 (cfg->mempool, sizeof (StackSlotInfo) * 256);
- for (i = 0; i < nvtypes; ++i)
- if (t->data.klass == vtype_stack_slots [i].vtype)
- break;
- if (i < nvtypes)
- slot_info = &vtype_stack_slots [i];
- else {
- g_assert (nvtypes < 256);
- vtype_stack_slots [nvtypes].vtype = t->data.klass;
- slot_info = &vtype_stack_slots [nvtypes];
- nvtypes ++;
- }
- if (cfg->disable_reuse_ref_stack_slots)
- reuse_slot = FALSE;
+ t = mini_get_underlying_type (cfg, t);
+ switch (t->type) {
+ case MONO_TYPE_GENERICINST:
+ if (!mono_type_generic_inst_is_valuetype (t)) {
+ slot_info = &scalar_stack_slots [t->type];
break;
+ }
+ /* Fall through */
+ case MONO_TYPE_VALUETYPE:
+ if (!vtype_stack_slots)
+ vtype_stack_slots = mono_mempool_alloc0 (cfg->mempool, sizeof (StackSlotInfo) * 256);
+ for (i = 0; i < nvtypes; ++i)
+ if (t->data.klass == vtype_stack_slots [i].vtype)
+ break;
+ if (i < nvtypes)
+ slot_info = &vtype_stack_slots [i];
+ else {
+ g_assert (nvtypes < 256);
+ vtype_stack_slots [nvtypes].vtype = t->data.klass;
+ slot_info = &vtype_stack_slots [nvtypes];
+ nvtypes ++;
+ }
+ if (cfg->disable_reuse_ref_stack_slots)
+ reuse_slot = FALSE;
+ break;
- case MONO_TYPE_PTR:
- case MONO_TYPE_I:
- case MONO_TYPE_U:
+ case MONO_TYPE_PTR:
+ case MONO_TYPE_I:
+ case MONO_TYPE_U:
#if SIZEOF_VOID_P == 4
- case MONO_TYPE_I4:
+ case MONO_TYPE_I4:
#else
- case MONO_TYPE_I8:
+ case MONO_TYPE_I8:
#endif
- if (cfg->disable_ref_noref_stack_slot_share) {
- slot_info = &scalar_stack_slots [MONO_TYPE_I];
- break;
- }
- /* Fall through */
-
- case MONO_TYPE_CLASS:
- case MONO_TYPE_OBJECT:
- case MONO_TYPE_ARRAY:
- case MONO_TYPE_SZARRAY:
- case MONO_TYPE_STRING:
- /* Share non-float stack slots of the same size */
- slot_info = &scalar_stack_slots [MONO_TYPE_CLASS];
- if (cfg->disable_reuse_ref_stack_slots)
- reuse_slot = FALSE;
- break;
- case MONO_TYPE_VAR:
- case MONO_TYPE_MVAR:
- slot_info = &scalar_stack_slots [t->type];
- break;
- default:
- slot_info = &scalar_stack_slots [t->type];
+ if (cfg->disable_ref_noref_stack_slot_share) {
+ slot_info = &scalar_stack_slots [MONO_TYPE_I];
break;
}
+ /* Fall through */
+
+ case MONO_TYPE_CLASS:
+ case MONO_TYPE_OBJECT:
+ case MONO_TYPE_ARRAY:
+ case MONO_TYPE_SZARRAY:
+ case MONO_TYPE_STRING:
+ /* Share non-float stack slots of the same size */
+ slot_info = &scalar_stack_slots [MONO_TYPE_CLASS];
+ if (cfg->disable_reuse_ref_stack_slots)
+ reuse_slot = FALSE;
+ break;
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ slot_info = &scalar_stack_slots [t->type];
+ break;
+ default:
+ slot_info = &scalar_stack_slots [t->type];
+ break;
}
slot = 0xffffff;
emul_opcode_hit_cache [opcode >> (EMUL_HIT_SHIFT + 3)] |= (1 << (opcode & EMUL_HIT_MASK));
}
-/*
- * For JIT icalls implemented in C.
- * NAME should be the same as the name of the C function whose address is FUNC.
- * If SAVE is TRUE, no wrapper is generated. This is for perf critical icalls which
- * can't throw exceptions.
- */
-static void
-register_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
-{
- MonoMethodSignature *sig;
-
- if (sigstr)
- sig = mono_create_icall_signature (sigstr);
- else
- sig = NULL;
-
- mono_register_jit_icall_full (func, name, sig, save, FALSE, save ? name : NULL);
-}
-
-/* Register a jit icall which doesn't throw exceptions through mono_raise_exception () */
-static void
-register_icall_noraise (gpointer func, const char *name, const char *sigstr)
-{
- MonoMethodSignature *sig;
-
- if (sigstr)
- sig = mono_create_icall_signature (sigstr);
- else
- sig = NULL;
-
- mono_register_jit_icall_full (func, name, sig, TRUE, TRUE, name);
-}
-
-static void
-register_dyn_icall (gpointer func, const char *name, const char *sigstr, gboolean save)
-{
- MonoMethodSignature *sig;
-
- if (sigstr)
- sig = mono_create_icall_signature (sigstr);
- else
- sig = NULL;
-
- mono_register_jit_icall (func, name, sig, save);
-}
-
static void
print_dfn (MonoCompile *cfg) {
int i, j;
#endif /* !DISABLE_JIT */
-static gboolean
-mini_tls_key_supported (MonoTlsKey key)
-{
- if (!MONO_ARCH_HAVE_TLS_GET)
- return FALSE;
-
- return mini_get_tls_offset (key) != -1;
-}
-
void
mono_add_patch_info (MonoCompile *cfg, int ip, MonoJumpInfoType type, gconstpointer target)
{
}
#endif
-static MonoType*
-get_gsharedvt_type (MonoType *t)
-{
- MonoGenericParam *par = t->data.generic_param;
- MonoGenericParam *copy;
- MonoType *res;
- MonoImage *image = NULL;
-
- /*
- * Create an anonymous gparam with a different serial so normal gshared and gsharedvt methods have
- * a different instantiation.
- */
- g_assert (mono_generic_param_info (par));
- if (par->owner) {
- image = par->owner->image;
-
- mono_image_lock (image);
- if (!image->gsharedvt_types)
- image->gsharedvt_types = g_hash_table_new (NULL, NULL);
- res = g_hash_table_lookup (image->gsharedvt_types, par);
- mono_image_unlock (image);
- if (res)
- return res;
- copy = mono_image_alloc0 (image, sizeof (MonoGenericParamFull));
- memcpy (copy, par, sizeof (MonoGenericParamFull));
- } else {
- copy = g_memdup (par, sizeof (MonoGenericParam));
- }
- copy->owner = NULL;
- // FIXME:
- copy->image = mono_defaults.corlib;
- copy->serial = 1;
- res = mono_metadata_type_dup (NULL, t);
- res->data.generic_param = copy;
-
- if (par->owner) {
- mono_image_lock (image);
- /* Duplicates are ok */
- g_hash_table_insert (image->gsharedvt_types, par, res);
- mono_image_unlock (image);
- }
-
- return res;
-}
-
static gboolean
is_gsharedvt_type (MonoType *t)
{
- return (t->type == MONO_TYPE_VAR || t->type == MONO_TYPE_MVAR) && t->data.generic_param->serial == 1;
+ return (t->type == MONO_TYPE_VAR || t->type == MONO_TYPE_MVAR) && t->data.generic_param->gshared_constraint == MONO_TYPE_VALUETYPE;
}
/* Return whenever METHOD is a gsharedvt method */
MonoMethodHeader *header;
MonoMethodSignature *sig;
MonoError err;
- guint8 *ip;
MonoCompile *cfg;
int dfn, i, code_size_ratio;
-#ifndef DISABLE_SSA
- gboolean deadce_has_run = FALSE;
-#endif
gboolean try_generic_shared, try_llvm = FALSE;
MonoMethod *method_to_compile, *method_to_register;
gboolean method_is_gshared = FALSE;
gboolean run_cctors = (flags & JIT_FLAG_RUN_CCTORS) ? 1 : 0;
gboolean compile_aot = (flags & JIT_FLAG_AOT) ? 1 : 0;
gboolean full_aot = (flags & JIT_FLAG_FULL_AOT) ? 1 : 0;
+ gboolean gsharedvt_method = FALSE;
#ifdef ENABLE_LLVM
gboolean llvm = (flags & JIT_FLAG_LLVM) ? 1 : 0;
#endif
if (MONO_METHOD_COMPILE_BEGIN_ENABLED ())
MONO_PROBE_METHOD_COMPILE_BEGIN (method);
+ /*
+ * In AOT mode, method can be the following:
+ * - the generic method definition. In this case, we are compiling the fully shared
+ * version of the method, i.e. the version where all the type parameters are
+ * reference types.
+ * - a gsharedvt method.
+ * - a method inflated with type parameters. This is for partial sharing.
+ * - a method inflated with concrete types.
+ */
if (compile_aot)
- /*
- * We might get passed the original generic method definition or
- * instances with type parameters.
- * FIXME: Remove the method->klass->generic_class limitation.
- */
try_generic_shared = mono_class_generic_sharing_enabled (method->klass) &&
(opts & MONO_OPT_GSHARED) && ((method->is_generic || method->klass->generic_container) || (!method->klass->generic_class && mono_method_is_generic_sharable_full (method, TRUE, FALSE, FALSE)));
else
try_generic_shared = mono_class_generic_sharing_enabled (method->klass) &&
(opts & MONO_OPT_GSHARED) && mono_method_is_generic_sharable (method, FALSE);
+ /*
+ if (try_generic_shared && !mono_debug_count ())
+ try_generic_shared = FALSE;
+ */
+
if (opts & MONO_OPT_GSHARED) {
if (try_generic_shared)
mono_stats.generics_sharable_methods++;
try_generic_shared = FALSE;
}
- if (is_gsharedvt_method (method) || (compile_aot && is_open_method (method))) {
+ gsharedvt_method = is_gsharedvt_method (method);
+ if (gsharedvt_method || (compile_aot && is_open_method (method))) {
/* We are AOTing a gshared method directly */
method_is_gshared = TRUE;
g_assert (compile_aot);
return cfg;
}
- if (cfg->generic_sharing_context && (mini_is_gsharedvt_sharable_method (method) || method_is_gshared)) {
+ if (cfg->generic_sharing_context && (gsharedvt_method || mini_is_gsharedvt_sharable_method (method))) {
MonoMethodInflated *inflated;
MonoGenericContext *context;
- if (method_is_gshared) {
+ if (gsharedvt_method) {
g_assert (method->is_inflated);
inflated = (MonoMethodInflated*)method;
context = &inflated->context;
}
}
- ip = (guint8 *)header->code;
-
cfg->intvars = mono_mempool_alloc0 (cfg->mempool, sizeof (guint16) * STACK_MAX * header->max_stack);
if (cfg->verbose_level > 0) {
//mono_local_cprop (cfg);
}
- if (cfg->opt & MONO_OPT_DEADCE) {
+ if (cfg->opt & MONO_OPT_DEADCE)
mono_ssa_deadce (cfg);
- deadce_has_run = TRUE;
- }
if ((cfg->flags & (MONO_CFG_HAS_LDELEMA|MONO_CFG_HAS_CHECK_THIS)) && (cfg->opt & MONO_OPT_ABCREM))
mono_perform_abc_removal (cfg);
#endif
/* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 108
+#define MONO_AOT_FILE_VERSION 109
//TODO: This is x86/amd64 specific.
#define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
typedef enum {
MONO_RGCTX_INFO_STATIC_DATA,
MONO_RGCTX_INFO_KLASS,
+ MONO_RGCTX_INFO_ELEMENT_KLASS,
MONO_RGCTX_INFO_VTABLE,
MONO_RGCTX_INFO_TYPE,
MONO_RGCTX_INFO_REFLECTION_TYPE,
extern guint8 mono_burg_arity [];
#endif
-extern const char MONO_ARCH_CPU_SPEC [] MONO_INTERNAL;
+extern const char MONO_ARCH_CPU_SPEC [];
#define MONO_ARCH_CPU_SPEC_IDX_COMBINE(a) a ## _idx
#define MONO_ARCH_CPU_SPEC_IDX(a) MONO_ARCH_CPU_SPEC_IDX_COMBINE(a)
-extern const guint16 MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC) [] MONO_INTERNAL;
+extern const guint16 MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC) [];
#define ins_get_spec(op) ((const char*)&MONO_ARCH_CPU_SPEC + MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC)[(op) - OP_LOAD])
enum {
/* main function */
MONO_API int mono_main (int argc, char* argv[]);
MONO_API void mono_set_defaults (int verbose_level, guint32 opts);
-MonoDomain* mini_init (const char *filename, const char *runtime_version) MONO_INTERNAL;
-void mini_cleanup (MonoDomain *domain) MONO_INTERNAL;
+MonoDomain* mini_init (const char *filename, const char *runtime_version);
+void mini_cleanup (MonoDomain *domain);
MONO_API MonoDebugOptions *mini_get_debug_options (void);
/* helper methods */
-void mini_jit_init (void) MONO_INTERNAL;
-void mini_jit_cleanup (void) MONO_INTERNAL;
-void mono_disable_optimizations (guint32 opts) MONO_INTERNAL;
-void mono_set_optimizations (guint32 opts) MONO_INTERNAL;
-guint32 mono_get_optimizations_for_method (MonoMethod *method, guint32 default_opt) MONO_INTERNAL;
-void mono_set_verbose_level (guint32 level) MONO_INTERNAL;
-MonoJumpInfoToken* mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token) MONO_INTERNAL;
-MonoJumpInfoToken* mono_jump_info_token_new2 (MonoMemPool *mp, MonoImage *image, guint32 token, MonoGenericContext *context) MONO_INTERNAL;
-MonoInst* mono_find_spvar_for_region (MonoCompile *cfg, int region) MONO_INTERNAL;
-MonoInst* mono_find_exvar_for_offset (MonoCompile *cfg, int offset) MONO_INTERNAL;
+void mini_jit_init (void);
+void mini_jit_cleanup (void);
+void mono_disable_optimizations (guint32 opts);
+void mono_set_optimizations (guint32 opts);
+guint32 mono_get_optimizations_for_method (MonoMethod *method, guint32 default_opt);
+void mono_set_verbose_level (guint32 level);
+MonoJumpInfoToken* mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token);
+MonoJumpInfoToken* mono_jump_info_token_new2 (MonoMemPool *mp, MonoImage *image, guint32 token, MonoGenericContext *context);
+MonoInst* mono_find_spvar_for_region (MonoCompile *cfg, int region);
+MonoInst* mono_find_exvar_for_offset (MonoCompile *cfg, int offset);
int mono_get_block_region_notry (MonoCompile *cfg, int region) MONO_LLVM_INTERNAL;
-void mono_precompile_assemblies (void) MONO_INTERNAL;
+void mono_precompile_assemblies (void);
MONO_API int mono_parse_default_optimizations (const char* p);
void mono_bblock_add_inst (MonoBasicBlock *bb, MonoInst *inst) MONO_LLVM_INTERNAL;
-void mono_bblock_insert_after_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst *ins_to_insert) MONO_INTERNAL;
-void mono_bblock_insert_before_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst *ins_to_insert) MONO_INTERNAL;
-void mono_verify_bblock (MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_verify_cfg (MonoCompile *cfg) MONO_INTERNAL;
-void mono_constant_fold (MonoCompile *cfg) MONO_INTERNAL;
-MonoInst* mono_constant_fold_ins (MonoCompile *cfg, MonoInst *ins, MonoInst *arg1, MonoInst *arg2, gboolean overwrite) MONO_INTERNAL;
-int mono_eval_cond_branch (MonoInst *branch) MONO_INTERNAL;
+void mono_bblock_insert_after_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst *ins_to_insert);
+void mono_bblock_insert_before_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst *ins_to_insert);
+void mono_verify_bblock (MonoBasicBlock *bb);
+void mono_verify_cfg (MonoCompile *cfg);
+void mono_constant_fold (MonoCompile *cfg);
+MonoInst* mono_constant_fold_ins (MonoCompile *cfg, MonoInst *ins, MonoInst *arg1, MonoInst *arg2, gboolean overwrite);
+int mono_eval_cond_branch (MonoInst *branch);
int mono_is_power_of_two (guint32 val) MONO_LLVM_INTERNAL;
-void mono_cprop_local (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **acp, int acp_size) MONO_INTERNAL;
-MonoInst* mono_compile_create_var (MonoCompile *cfg, MonoType *type, int opcode) MONO_INTERNAL;
-MonoInst* mono_compile_create_var_for_vreg (MonoCompile *cfg, MonoType *type, int opcode, int vreg) MONO_INTERNAL;
-void mono_compile_make_var_load (MonoCompile *cfg, MonoInst *dest, gssize var_index) MONO_INTERNAL;
-MonoInst* mono_compile_create_var_load (MonoCompile *cfg, gssize var_index) MONO_INTERNAL;
-MonoInst* mono_compile_create_var_store (MonoCompile *cfg, gssize var_index, MonoInst *value) MONO_INTERNAL;
-MonoInst* mini_get_int_to_float_spill_area (MonoCompile *cfg) MONO_INTERNAL;
-MonoType* mono_type_from_stack_type (MonoInst *ins) MONO_INTERNAL;
+void mono_cprop_local (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **acp, int acp_size);
+MonoInst* mono_compile_create_var (MonoCompile *cfg, MonoType *type, int opcode);
+MonoInst* mono_compile_create_var_for_vreg (MonoCompile *cfg, MonoType *type, int opcode, int vreg);
+void mono_compile_make_var_load (MonoCompile *cfg, MonoInst *dest, gssize var_index);
+MonoInst* mono_compile_create_var_load (MonoCompile *cfg, gssize var_index);
+MonoInst* mono_compile_create_var_store (MonoCompile *cfg, gssize var_index, MonoInst *value);
+MonoInst* mini_get_int_to_float_spill_area (MonoCompile *cfg);
+MonoType* mono_type_from_stack_type (MonoInst *ins);
guint32 mono_alloc_ireg (MonoCompile *cfg) MONO_LLVM_INTERNAL;
guint32 mono_alloc_lreg (MonoCompile *cfg) MONO_LLVM_INTERNAL;
guint32 mono_alloc_freg (MonoCompile *cfg) MONO_LLVM_INTERNAL;
guint32 mono_alloc_preg (MonoCompile *cfg) MONO_LLVM_INTERNAL;
-guint32 mono_alloc_dreg (MonoCompile *cfg, MonoStackType stack_type) MONO_INTERNAL;
+guint32 mono_alloc_dreg (MonoCompile *cfg, MonoStackType stack_type);
guint32 mono_alloc_ireg_ref (MonoCompile *cfg) MONO_LLVM_INTERNAL;
guint32 mono_alloc_ireg_mp (MonoCompile *cfg) MONO_LLVM_INTERNAL;
guint32 mono_alloc_ireg_copy (MonoCompile *cfg, guint32 vreg) MONO_LLVM_INTERNAL;
-void mono_mark_vreg_as_ref (MonoCompile *cfg, int vreg) MONO_INTERNAL;
-void mono_mark_vreg_as_mp (MonoCompile *cfg, int vreg) MONO_INTERNAL;
-
-void mono_link_bblock (MonoCompile *cfg, MonoBasicBlock *from, MonoBasicBlock* to) MONO_INTERNAL;
-void mono_unlink_bblock (MonoCompile *cfg, MonoBasicBlock *from, MonoBasicBlock* to) MONO_INTERNAL;
-gboolean mono_bblocks_linked (MonoBasicBlock *bb1, MonoBasicBlock *bb2) MONO_INTERNAL;
-void mono_remove_bblock (MonoCompile *cfg, MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_nullify_basic_block (MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_merge_basic_blocks (MonoCompile *cfg, MonoBasicBlock *bb, MonoBasicBlock *bbn) MONO_INTERNAL;
-void mono_optimize_branches (MonoCompile *cfg) MONO_INTERNAL;
-
-void mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom) MONO_INTERNAL;
-void mono_print_ji (const MonoJumpInfo *ji) MONO_INTERNAL;
-void mono_print_ins_index (int i, MonoInst *ins) MONO_INTERNAL;
-void mono_print_ins (MonoInst *ins) MONO_INTERNAL;
-void mono_print_bb (MonoBasicBlock *bb, const char *msg) MONO_INTERNAL;
-void mono_print_code (MonoCompile *cfg, const char *msg) MONO_INTERNAL;
+void mono_mark_vreg_as_ref (MonoCompile *cfg, int vreg);
+void mono_mark_vreg_as_mp (MonoCompile *cfg, int vreg);
+
+void mono_link_bblock (MonoCompile *cfg, MonoBasicBlock *from, MonoBasicBlock* to);
+void mono_unlink_bblock (MonoCompile *cfg, MonoBasicBlock *from, MonoBasicBlock* to);
+gboolean mono_bblocks_linked (MonoBasicBlock *bb1, MonoBasicBlock *bb2);
+void mono_remove_bblock (MonoCompile *cfg, MonoBasicBlock *bb);
+void mono_nullify_basic_block (MonoBasicBlock *bb);
+void mono_merge_basic_blocks (MonoCompile *cfg, MonoBasicBlock *bb, MonoBasicBlock *bbn);
+void mono_optimize_branches (MonoCompile *cfg);
+
+void mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom);
+void mono_print_ji (const MonoJumpInfo *ji);
+void mono_print_ins_index (int i, MonoInst *ins);
+void mono_print_ins (MonoInst *ins);
+void mono_print_bb (MonoBasicBlock *bb, const char *msg);
+void mono_print_code (MonoCompile *cfg, const char *msg);
MONO_API void mono_print_method_from_ip (void *ip);
MONO_API char *mono_pmip (void *ip);
-gboolean mono_debug_count (void) MONO_INTERNAL;
+gboolean mono_debug_count (void);
MONO_API const char* mono_inst_name (int op);
-int mono_op_to_op_imm (int opcode) MONO_INTERNAL;
-int mono_op_imm_to_op (int opcode) MONO_INTERNAL;
-int mono_load_membase_to_load_mem (int opcode) MONO_INTERNAL;
-guint mono_type_to_load_membase (MonoCompile *cfg, MonoType *type) MONO_INTERNAL;
-guint mono_type_to_store_membase (MonoCompile *cfg, MonoType *type) MONO_INTERNAL;
-guint mini_type_to_stind (MonoCompile* cfg, MonoType *type) MONO_INTERNAL;
-MonoJitInfo* mini_lookup_method (MonoDomain *domain, MonoMethod *method, MonoMethod *shared) MONO_INTERNAL;
-guint32 mono_reverse_branch_op (guint32 opcode) MONO_INTERNAL;
-void mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id) MONO_INTERNAL;
+int mono_op_to_op_imm (int opcode);
+int mono_op_imm_to_op (int opcode);
+int mono_load_membase_to_load_mem (int opcode);
+guint mono_type_to_load_membase (MonoCompile *cfg, MonoType *type);
+guint mono_type_to_store_membase (MonoCompile *cfg, MonoType *type);
+guint mini_type_to_stind (MonoCompile* cfg, MonoType *type);
+MonoJitInfo* mini_lookup_method (MonoDomain *domain, MonoMethod *method, MonoMethod *shared);
+guint32 mono_reverse_branch_op (guint32 opcode);
+void mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id);
void mono_add_patch_info (MonoCompile *cfg, int ip, MonoJumpInfoType type, gconstpointer target) MONO_LLVM_INTERNAL;
void mono_add_patch_info_rel (MonoCompile *cfg, int ip, MonoJumpInfoType type, gconstpointer target, int relocation) MONO_LLVM_INTERNAL;
-void mono_remove_patch_info (MonoCompile *cfg, int ip) MONO_INTERNAL;
-MonoJumpInfo* mono_patch_info_dup_mp (MonoMemPool *mp, MonoJumpInfo *patch_info) MONO_INTERNAL;
-guint mono_patch_info_hash (gconstpointer data) MONO_INTERNAL;
-gint mono_patch_info_equal (gconstpointer ka, gconstpointer kb) MONO_INTERNAL;
-MonoJumpInfo *mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJumpInfoType type, gconstpointer target) MONO_INTERNAL;
+void mono_remove_patch_info (MonoCompile *cfg, int ip);
+MonoJumpInfo* mono_patch_info_dup_mp (MonoMemPool *mp, MonoJumpInfo *patch_info);
+guint mono_patch_info_hash (gconstpointer data);
+gint mono_patch_info_equal (gconstpointer ka, gconstpointer kb);
+MonoJumpInfo *mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJumpInfoType type, gconstpointer target);
gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors) MONO_LLVM_INTERNAL;
-gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji) MONO_INTERNAL;
-gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
-gpointer mono_jit_compile_method (MonoMethod *method) MONO_INTERNAL;
-gpointer mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoException **jit_ex) MONO_INTERNAL;
-MonoLMF * mono_get_lmf (void) MONO_INTERNAL;
-MonoLMF** mono_get_lmf_addr (void) MONO_INTERNAL;
-void mono_set_lmf (MonoLMF *lmf) MONO_INTERNAL;
-MonoJitTlsData* mono_get_jit_tls (void) MONO_INTERNAL;
+gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji);
+gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method);
+gpointer mono_jit_compile_method (MonoMethod *method);
+gpointer mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoException **jit_ex);
+MonoLMF * mono_get_lmf (void);
+MonoLMF** mono_get_lmf_addr (void);
+void mono_set_lmf (MonoLMF *lmf);
+MonoJitTlsData* mono_get_jit_tls (void);
MONO_API MonoDomain *mono_jit_thread_attach (MonoDomain *domain);
MONO_API void mono_jit_set_domain (MonoDomain *domain);
-gint32 mono_get_jit_tls_offset (void) MONO_INTERNAL;
-gint32 mono_get_lmf_tls_offset (void) MONO_INTERNAL;
-gint32 mono_get_lmf_addr_tls_offset (void) MONO_INTERNAL;
-int mini_get_tls_offset (MonoTlsKey key) MONO_INTERNAL;
-gboolean mini_tls_get_supported (MonoCompile *cfg, MonoTlsKey key) MONO_INTERNAL;
-MonoInst* mono_create_tls_get (MonoCompile *cfg, MonoTlsKey key) MONO_INTERNAL;
-MonoInst* mono_get_jit_tls_intrinsic (MonoCompile *cfg) MONO_INTERNAL;
-MonoInst* mono_get_domain_intrinsic (MonoCompile* cfg) MONO_INTERNAL;
-MonoInst* mono_get_thread_intrinsic (MonoCompile* cfg) MONO_INTERNAL;
-MonoInst* mono_get_lmf_intrinsic (MonoCompile* cfg) MONO_INTERNAL;
-MonoInst* mono_get_lmf_addr_intrinsic (MonoCompile* cfg) MONO_INTERNAL;
-GList *mono_varlist_insert_sorted (MonoCompile *cfg, GList *list, MonoMethodVar *mv, int sort_type) MONO_INTERNAL;
-GList *mono_varlist_sort (MonoCompile *cfg, GList *list, int sort_type) MONO_INTERNAL;
-void mono_analyze_liveness (MonoCompile *cfg) MONO_INTERNAL;
-void mono_analyze_liveness_gc (MonoCompile *cfg) MONO_INTERNAL;
-void mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_mask) MONO_INTERNAL;
-void mono_global_regalloc (MonoCompile *cfg) MONO_INTERNAL;
-void mono_create_jump_table (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks) MONO_INTERNAL;
-int mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options) MONO_INTERNAL;
-MonoCompile *mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts) MONO_INTERNAL;
-void mono_destroy_compile (MonoCompile *cfg) MONO_INTERNAL;
-MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode) MONO_INTERNAL;
-void mono_print_ins_index (int i, MonoInst *ins) MONO_INTERNAL;
-void mono_print_ins (MonoInst *ins) MONO_INTERNAL;
-gboolean mini_assembly_can_skip_verification (MonoDomain *domain, MonoMethod *method) MONO_INTERNAL;
-gboolean mono_compile_is_broken (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile) MONO_INTERNAL;
-MonoInst *mono_get_got_var (MonoCompile *cfg) MONO_INTERNAL;
-void mono_add_seq_point (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, int native_offset) MONO_INTERNAL;
-void mono_add_var_location (MonoCompile *cfg, MonoInst *var, gboolean is_reg, int reg, int offset, int from, int to) MONO_INTERNAL;
-MonoInst* mono_emit_jit_icall (MonoCompile *cfg, gconstpointer func, MonoInst **args) MONO_INTERNAL;
-MonoInst* mono_emit_jit_icall_by_info (MonoCompile *cfg, MonoJitICallInfo *info, MonoInst **args, MonoBasicBlock **out_cbb) MONO_INTERNAL;
-MonoInst* mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this) MONO_INTERNAL;
-void mono_create_helper_signatures (void) MONO_INTERNAL;
-
-gboolean mini_class_is_system_array (MonoClass *klass) MONO_INTERNAL;
-MonoMethodSignature *mono_get_element_address_signature (int arity) MONO_INTERNAL;
-MonoJitICallInfo *mono_get_element_address_icall (int rank) MONO_INTERNAL;
-MonoJitICallInfo *mono_get_array_new_va_icall (int rank) MONO_INTERNAL;
-
-void mono_linterval_add_range (MonoCompile *cfg, MonoLiveInterval *interval, int from, int to) MONO_INTERNAL;
-void mono_linterval_print (MonoLiveInterval *interval) MONO_INTERNAL;
-void mono_linterval_print_nl (MonoLiveInterval *interval) MONO_INTERNAL;
-gboolean mono_linterval_covers (MonoLiveInterval *interval, int pos) MONO_INTERNAL;
-gint32 mono_linterval_get_intersect_pos (MonoLiveInterval *i1, MonoLiveInterval *i2) MONO_INTERNAL;
-void mono_linterval_split (MonoCompile *cfg, MonoLiveInterval *interval, MonoLiveInterval **i1, MonoLiveInterval **i2, int pos) MONO_INTERNAL;
-void mono_liveness_handle_exception_clauses (MonoCompile *cfg) MONO_INTERNAL;
+gint32 mono_get_jit_tls_offset (void);
+gint32 mono_get_lmf_tls_offset (void);
+gint32 mono_get_lmf_addr_tls_offset (void);
+int mini_get_tls_offset (MonoTlsKey key);
+gboolean mini_tls_get_supported (MonoCompile *cfg, MonoTlsKey key);
+MonoInst* mono_create_tls_get (MonoCompile *cfg, MonoTlsKey key);
+MonoInst* mono_get_jit_tls_intrinsic (MonoCompile *cfg);
+MonoInst* mono_get_domain_intrinsic (MonoCompile* cfg);
+MonoInst* mono_get_thread_intrinsic (MonoCompile* cfg);
+MonoInst* mono_get_lmf_intrinsic (MonoCompile* cfg);
+MonoInst* mono_get_lmf_addr_intrinsic (MonoCompile* cfg);
+GList *mono_varlist_insert_sorted (MonoCompile *cfg, GList *list, MonoMethodVar *mv, int sort_type);
+GList *mono_varlist_sort (MonoCompile *cfg, GList *list, int sort_type);
+void mono_analyze_liveness (MonoCompile *cfg);
+void mono_analyze_liveness_gc (MonoCompile *cfg);
+void mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_mask);
+void mono_global_regalloc (MonoCompile *cfg);
+void mono_create_jump_table (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
+int mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options);
+MonoCompile *mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFlags flags, int parts);
+void mono_destroy_compile (MonoCompile *cfg);
+MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode);
+void mono_print_ins_index (int i, MonoInst *ins);
+void mono_print_ins (MonoInst *ins);
+gboolean mini_assembly_can_skip_verification (MonoDomain *domain, MonoMethod *method);
+gboolean mono_compile_is_broken (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile);
+MonoInst *mono_get_got_var (MonoCompile *cfg);
+void mono_add_seq_point (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, int native_offset);
+void mono_add_var_location (MonoCompile *cfg, MonoInst *var, gboolean is_reg, int reg, int offset, int from, int to);
+MonoInst* mono_emit_jit_icall (MonoCompile *cfg, gconstpointer func, MonoInst **args);
+MonoInst* mono_emit_jit_icall_by_info (MonoCompile *cfg, MonoJitICallInfo *info, MonoInst **args, MonoBasicBlock **out_cbb);
+MonoInst* mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this);
+void mono_create_helper_signatures (void);
+
+gboolean mini_class_is_system_array (MonoClass *klass);
+MonoMethodSignature *mono_get_element_address_signature (int arity);
+MonoJitICallInfo *mono_get_element_address_icall (int rank);
+MonoJitICallInfo *mono_get_array_new_va_icall (int rank);
+
+void mono_linterval_add_range (MonoCompile *cfg, MonoLiveInterval *interval, int from, int to);
+void mono_linterval_print (MonoLiveInterval *interval);
+void mono_linterval_print_nl (MonoLiveInterval *interval);
+gboolean mono_linterval_covers (MonoLiveInterval *interval, int pos);
+gint32 mono_linterval_get_intersect_pos (MonoLiveInterval *i1, MonoLiveInterval *i2);
+void mono_linterval_split (MonoCompile *cfg, MonoLiveInterval *interval, MonoLiveInterval **i1, MonoLiveInterval **i2, int pos);
+void mono_liveness_handle_exception_clauses (MonoCompile *cfg);
/* Native Client functions */
gpointer mono_realloc_native_code(MonoCompile *cfg);
}
/* AOT */
-void mono_aot_init (void) MONO_INTERNAL;
-void mono_aot_cleanup (void) MONO_INTERNAL;
+void mono_aot_init (void);
+void mono_aot_cleanup (void);
gpointer mono_aot_get_method (MonoDomain *domain,
- MonoMethod *method) MONO_INTERNAL;
-gpointer mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 token) MONO_INTERNAL;
-gboolean mono_aot_is_got_entry (guint8 *code, guint8 *addr) MONO_INTERNAL;
-guint8* mono_aot_get_plt_entry (guint8 *code) MONO_INTERNAL;
-guint32 mono_aot_get_plt_info_offset (mgreg_t *regs, guint8 *code) MONO_INTERNAL;
-gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res) MONO_INTERNAL;
-gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass) MONO_INTERNAL;
-MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr) MONO_INTERNAL;
-gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code) MONO_INTERNAL;
-void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr) MONO_INTERNAL;
-gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot) MONO_INTERNAL;
-gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) MONO_INTERNAL;
-gpointer mono_aot_get_trampoline (const char *name) MONO_INTERNAL;
-gpointer mono_aot_get_trampoline_full (const char *name, MonoTrampInfo **out_tinfo) MONO_INTERNAL;
-gpointer mono_aot_get_unbox_trampoline (MonoMethod *method) MONO_INTERNAL;
-gpointer mono_aot_get_lazy_fetch_trampoline (guint32 slot) MONO_INTERNAL;
-gpointer mono_aot_get_static_rgctx_trampoline (gpointer ctx, gpointer addr) MONO_INTERNAL;
-gpointer mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp) MONO_INTERNAL;
-gpointer mono_aot_get_gsharedvt_arg_trampoline(gpointer arg, gpointer addr) MONO_INTERNAL;
-guint8* mono_aot_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len) MONO_INTERNAL;
-guint32 mono_aot_method_hash (MonoMethod *method) MONO_INTERNAL;
-MonoMethod* mono_aot_get_array_helper_from_wrapper (MonoMethod *method) MONO_INTERNAL;
+ MonoMethod *method);
+gpointer mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 token);
+gboolean mono_aot_is_got_entry (guint8 *code, guint8 *addr);
+guint8* mono_aot_get_plt_entry (guint8 *code);
+guint32 mono_aot_get_plt_info_offset (mgreg_t *regs, guint8 *code);
+gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
+gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass);
+MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr);
+gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code);
+void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr);
+gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot);
+gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
+gpointer mono_aot_get_trampoline (const char *name);
+gpointer mono_aot_get_trampoline_full (const char *name, MonoTrampInfo **out_tinfo);
+gpointer mono_aot_get_unbox_trampoline (MonoMethod *method);
+gpointer mono_aot_get_lazy_fetch_trampoline (guint32 slot);
+gpointer mono_aot_get_static_rgctx_trampoline (gpointer ctx, gpointer addr);
+gpointer mono_aot_get_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp);
+gpointer mono_aot_get_gsharedvt_arg_trampoline(gpointer arg, gpointer addr);
+guint8* mono_aot_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len);
+guint32 mono_aot_method_hash (MonoMethod *method);
+MonoMethod* mono_aot_get_array_helper_from_wrapper (MonoMethod *method);
guint32 mono_aot_get_got_offset (MonoJumpInfo *ji) MONO_LLVM_INTERNAL;
char* mono_aot_get_method_name (MonoCompile *cfg) MONO_LLVM_INTERNAL;
gboolean mono_aot_is_direct_callable (MonoJumpInfo *patch_info) MONO_LLVM_INTERNAL;
char* mono_aot_get_plt_symbol (MonoJumpInfoType type, gconstpointer data) MONO_LLVM_INTERNAL;
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) MONO_INTERNAL;
-gboolean mono_aot_is_pagefault (void *ptr) MONO_INTERNAL;
-void mono_aot_handle_pagefault (void *ptr) MONO_INTERNAL;
-void mono_aot_register_jit_icall (const char *name, gpointer addr) MONO_INTERNAL;
-void* mono_aot_readonly_field_override (MonoClassField *field) MONO_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);
/* 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) MONO_INTERNAL;
-void mono_save_xdebug_info (MonoCompile *cfg) MONO_INTERNAL;
-void mono_save_trampoline_xdebug_info (MonoTrampInfo *info) MONO_INTERNAL;
+void mono_xdebug_init (const char *xdebug_opts);
+void mono_save_xdebug_info (MonoCompile *cfg);
+void mono_save_trampoline_xdebug_info (MonoTrampInfo *info);
/* This is an exported function */
void mono_xdebug_flush (void);
void mono_llvm_check_method_supported (MonoCompile *cfg) MONO_LLVM_INTERNAL;
void mono_llvm_free_domain_info (MonoDomain *domain) MONO_LLVM_INTERNAL;
MONO_API void mono_personality (void);
-int mono_llvm_load (const char* bpath) MONO_INTERNAL;
+int mono_llvm_load (const char* bpath);
gboolean mini_llvm_init (void);
-gboolean mono_method_blittable (MonoMethod *method) MONO_INTERNAL;
-gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee) MONO_INTERNAL;
+gboolean mono_method_blittable (MonoMethod *method);
+gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee);
-void mono_register_opcode_emulation (int opcode, const char* name, const char *sigstr, gpointer func, gboolean no_throw) MONO_INTERNAL;
-void mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options) MONO_INTERNAL;
-void mono_add_ins_to_end (MonoBasicBlock *bb, MonoInst *inst) MONO_INTERNAL;
-gpointer mono_create_ftnptr (MonoDomain *domain, gpointer addr) MONO_INTERNAL;
+void mono_register_opcode_emulation (int opcode, const char* name, const char *sigstr, gpointer func, gboolean no_throw);
+void mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options);
+void mono_add_ins_to_end (MonoBasicBlock *bb, MonoInst *inst);
+gpointer mono_create_ftnptr (MonoDomain *domain, gpointer addr);
MONO_API void mono_replace_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins, MonoInst **prev, MonoBasicBlock *first_bb, MonoBasicBlock *last_bb);
-int mono_find_method_opcode (MonoMethod *method) MONO_INTERNAL;
-MonoJitICallInfo *mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save) MONO_INTERNAL;
+int mono_find_method_opcode (MonoMethod *method);
+MonoJitICallInfo *mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
gconstpointer mono_icall_get_wrapper (MonoJitICallInfo* callinfo) MONO_LLVM_INTERNAL;
-gconstpointer mono_icall_get_wrapper_full (MonoJitICallInfo* callinfo, gboolean do_compile) MONO_INTERNAL;
-void mini_register_opcode_emulation (int opcode, const char *name, const char *sigstr, gpointer func, const char *symbol, gboolean no_throw) MONO_INTERNAL;
+gconstpointer mono_icall_get_wrapper_full (MonoJitICallInfo* callinfo, gboolean do_compile);
+void mini_register_opcode_emulation (int opcode, const char *name, const char *sigstr, gpointer func, const char *symbol, gboolean no_throw);
-void mono_trampolines_init (void) MONO_INTERNAL;
-void mono_trampolines_cleanup (void) MONO_INTERNAL;
-guint8 * mono_get_trampoline_code (MonoTrampolineType tramp_type) MONO_INTERNAL;
-gpointer mono_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) MONO_INTERNAL;
+void mono_trampolines_init (void);
+void mono_trampolines_cleanup (void);
+guint8 * mono_get_trampoline_code (MonoTrampolineType tramp_type);
+gpointer mono_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
gpointer mono_create_jump_trampoline (MonoDomain *domain,
MonoMethod *method,
- gboolean add_sync_wrapper) MONO_INTERNAL;
-gpointer mono_create_class_init_trampoline (MonoVTable *vtable) MONO_INTERNAL;
-gpointer mono_create_generic_class_init_trampoline (void) MONO_INTERNAL;
-gpointer mono_create_jit_trampoline (MonoMethod *method) MONO_INTERNAL;
-gpointer mono_create_jit_trampoline_from_token (MonoImage *image, guint32 token) MONO_INTERNAL;
+ gboolean add_sync_wrapper);
+gpointer mono_create_class_init_trampoline (MonoVTable *vtable);
+gpointer mono_create_generic_class_init_trampoline (void);
+gpointer mono_create_jit_trampoline (MonoMethod *method);
+gpointer mono_create_jit_trampoline_from_token (MonoImage *image, guint32 token);
gpointer mono_create_jit_trampoline_in_domain (MonoDomain *domain, MonoMethod *method) MONO_LLVM_INTERNAL;
-gpointer mono_create_delegate_trampoline (MonoDomain *domain, MonoClass *klass) MONO_INTERNAL;
-MonoDelegateTrampInfo* mono_create_delegate_trampoline_info (MonoDomain *domain, MonoClass *klass, MonoMethod *method) MONO_INTERNAL;
-gpointer mono_create_delegate_virtual_trampoline (MonoDomain *domain, MonoClass *klass, MonoMethod *method) MONO_INTERNAL;
-gpointer mono_create_rgctx_lazy_fetch_trampoline (guint32 offset) MONO_INTERNAL;
-gpointer mono_create_monitor_enter_trampoline (void) MONO_INTERNAL;
-gpointer mono_create_monitor_enter_v4_trampoline (void) MONO_INTERNAL;
-gpointer mono_create_monitor_exit_trampoline (void) MONO_INTERNAL;
-gpointer mono_create_static_rgctx_trampoline (MonoMethod *m, gpointer addr) MONO_INTERNAL;
+gpointer mono_create_delegate_trampoline (MonoDomain *domain, MonoClass *klass);
+MonoDelegateTrampInfo* mono_create_delegate_trampoline_info (MonoDomain *domain, MonoClass *klass, MonoMethod *method);
+gpointer mono_create_delegate_virtual_trampoline (MonoDomain *domain, MonoClass *klass, MonoMethod *method);
+gpointer mono_create_rgctx_lazy_fetch_trampoline (guint32 offset);
+gpointer mono_create_monitor_enter_trampoline (void);
+gpointer mono_create_monitor_enter_v4_trampoline (void);
+gpointer mono_create_monitor_exit_trampoline (void);
+gpointer mono_create_static_rgctx_trampoline (MonoMethod *m, gpointer addr);
gpointer mono_create_llvm_imt_trampoline (MonoDomain *domain, MonoMethod *m, int vt_offset) MONO_LLVM_INTERNAL;
-MonoVTable* mono_find_class_init_trampoline_by_addr (gconstpointer addr) MONO_INTERNAL;
-guint32 mono_find_rgctx_lazy_fetch_trampoline_by_addr (gconstpointer addr) MONO_INTERNAL;
-gpointer mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp) MONO_INTERNAL;
+MonoVTable* mono_find_class_init_trampoline_by_addr (gconstpointer addr);
+guint32 mono_find_rgctx_lazy_fetch_trampoline_by_addr (gconstpointer addr);
+gpointer mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp);
#ifndef DISABLE_REMOTING
-gpointer mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp) MONO_INTERNAL;
+gpointer mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, guint8 *tramp);
#endif
-gpointer mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp) MONO_INTERNAL;
+gpointer mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp);
gpointer mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info,
- guint8* tramp) MONO_INTERNAL;
+ guint8* tramp);
gpointer mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info,
- guint8* tramp) MONO_INTERNAL;
-void mono_class_init_trampoline (mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp) MONO_INTERNAL;
-void mono_generic_class_init_trampoline (mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp) MONO_INTERNAL;
-void mono_monitor_enter_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp) MONO_INTERNAL;
-void mono_monitor_enter_v4_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp) MONO_INTERNAL;
-void mono_monitor_exit_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp) MONO_INTERNAL;
+ guint8* tramp);
+void mono_class_init_trampoline (mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp);
+void mono_generic_class_init_trampoline (mgreg_t *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp);
+void mono_monitor_enter_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp);
+void mono_monitor_enter_v4_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp);
+void mono_monitor_exit_trampoline (mgreg_t *regs, guint8 *code, MonoObject *obj, guint8 *tramp);
gconstpointer mono_get_trampoline_func (MonoTrampolineType tramp_type);
-gpointer mini_get_vtable_trampoline (int slot_index) MONO_INTERNAL;
-const char* mono_get_generic_trampoline_simple_name (MonoTrampolineType tramp_type) MONO_INTERNAL;
-char* mono_get_generic_trampoline_name (MonoTrampolineType tramp_type) MONO_INTERNAL;
-char* mono_get_rgctx_fetch_trampoline_name (int slot) MONO_INTERNAL;
-gpointer mini_get_nullified_class_init_trampoline (void) MONO_INTERNAL;
-gpointer mini_add_method_trampoline (MonoMethod *orig_method, MonoMethod *m, gpointer compiled_method, gboolean add_static_rgctx_tramp, gboolean add_unbox_tramp) MONO_INTERNAL;
-gboolean mini_jit_info_is_gsharedvt (MonoJitInfo *ji) MONO_INTERNAL;
-
-gboolean mono_running_on_valgrind (void) MONO_INTERNAL;
-void* mono_global_codeman_reserve (int size) MONO_INTERNAL;
-void* nacl_global_codeman_get_dest(void *data) MONO_INTERNAL;
-void mono_global_codeman_commit(void *data, int size, int newsize) MONO_INTERNAL;
-void nacl_global_codeman_validate(guint8 **buf_base, int buf_size, guint8 **code_end) MONO_INTERNAL;
-const char *mono_regname_full (int reg, int bank) MONO_INTERNAL;
-gint32* mono_allocate_stack_slots (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align) MONO_INTERNAL;
-void mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb) MONO_INTERNAL;
-MonoInst *mono_branch_optimize_exception_target (MonoCompile *cfg, MonoBasicBlock *bb, const char * exname) MONO_INTERNAL;
-void mono_remove_critical_edges (MonoCompile *cfg) MONO_INTERNAL;
-gboolean mono_is_regsize_var (MonoType *t) MONO_INTERNAL;
-void mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset, int srcreg, int soffset, int size, int align) MONO_INTERNAL;
-void mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *klass, gboolean native) MONO_INTERNAL;
-void mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, MonoClass *klass) MONO_INTERNAL;
+gpointer mini_get_vtable_trampoline (int slot_index);
+const char* mono_get_generic_trampoline_simple_name (MonoTrampolineType tramp_type);
+char* mono_get_generic_trampoline_name (MonoTrampolineType tramp_type);
+char* mono_get_rgctx_fetch_trampoline_name (int slot);
+gpointer mini_get_nullified_class_init_trampoline (void);
+gpointer mini_add_method_trampoline (MonoMethod *orig_method, MonoMethod *m, gpointer compiled_method, gboolean add_static_rgctx_tramp, gboolean add_unbox_tramp);
+gboolean mini_jit_info_is_gsharedvt (MonoJitInfo *ji);
+
+gboolean mono_running_on_valgrind (void);
+void* mono_global_codeman_reserve (int size);
+void* nacl_global_codeman_get_dest(void *data);
+void mono_global_codeman_commit(void *data, int size, int newsize);
+void nacl_global_codeman_validate(guint8 **buf_base, int buf_size, guint8 **code_end);
+const char *mono_regname_full (int reg, int bank);
+gint32* mono_allocate_stack_slots (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align);
+void mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb);
+MonoInst *mono_branch_optimize_exception_target (MonoCompile *cfg, MonoBasicBlock *bb, const char * exname);
+void mono_remove_critical_edges (MonoCompile *cfg);
+gboolean mono_is_regsize_var (MonoType *t);
+void mini_emit_memcpy (MonoCompile *cfg, int destreg, int doffset, int srcreg, int soffset, int size, int align);
+void mini_emit_stobj (MonoCompile *cfg, MonoInst *dest, MonoInst *src, MonoClass *klass, gboolean native);
+void mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, MonoClass *klass);
CompRelation mono_opcode_to_cond (int opcode) MONO_LLVM_INTERNAL;
-CompType mono_opcode_to_type (int opcode, int cmp_opcode) MONO_INTERNAL;
-CompRelation mono_negate_cond (CompRelation cond) MONO_INTERNAL;
-int mono_op_imm_to_op (int opcode) MONO_INTERNAL;
-void mono_decompose_op_imm (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins) MONO_INTERNAL;
-void mono_peephole_ins (MonoBasicBlock *bb, MonoInst *ins) MONO_INTERNAL;
+CompType mono_opcode_to_type (int opcode, int cmp_opcode);
+CompRelation mono_negate_cond (CompRelation cond);
+int mono_op_imm_to_op (int opcode);
+void mono_decompose_op_imm (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst *ins);
+void mono_peephole_ins (MonoBasicBlock *bb, MonoInst *ins);
MonoUnwindOp *mono_create_unwind_op (int when,
int tag, int reg,
- int val) MONO_INTERNAL;
+ int val);
void mono_emit_unwind_op (MonoCompile *cfg, int when,
int tag, int reg,
- int val) MONO_INTERNAL;
-MonoTrampInfo* mono_tramp_info_create (const char *name, guint8 *code, guint32 code_size, MonoJumpInfo *ji, GSList *unwind_ops) MONO_INTERNAL;
-void mono_tramp_info_free (MonoTrampInfo *info) MONO_INTERNAL;
-void mono_tramp_info_register (MonoTrampInfo *info) MONO_INTERNAL;
-int mini_exception_id_by_name (const char *name) MONO_INTERNAL;
+ int val);
+MonoTrampInfo* mono_tramp_info_create (const char *name, guint8 *code, guint32 code_size, MonoJumpInfo *ji, GSList *unwind_ops);
+void mono_tramp_info_free (MonoTrampInfo *info);
+void mono_tramp_info_register (MonoTrampInfo *info);
+int mini_exception_id_by_name (const char *name);
gboolean mini_type_is_hfa (MonoType *t, int *out_nfields, int *out_esize) MONO_LLVM_INTERNAL;
int mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_bblock, MonoBasicBlock *end_bblock,
MonoInst *return_var, MonoInst **inline_args,
- guint inline_offset, gboolean is_virtual_call) MONO_INTERNAL;
-
-MonoInst *mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins, MonoBasicBlock **out_cbb) MONO_INTERNAL;
-void mono_decompose_long_opts (MonoCompile *cfg) MONO_INTERNAL;
-void mono_decompose_vtype_opts (MonoCompile *cfg) MONO_INTERNAL;
-void mono_decompose_vtype_opts_llvm (MonoCompile *cfg) MONO_INTERNAL;
-void mono_decompose_array_access_opts (MonoCompile *cfg) MONO_INTERNAL;
-void mono_decompose_soft_float (MonoCompile *cfg) MONO_INTERNAL;
-void mono_handle_global_vregs (MonoCompile *cfg) MONO_INTERNAL;
-void mono_spill_global_vars (MonoCompile *cfg, gboolean *need_local_opts) MONO_INTERNAL;
-void mono_if_conversion (MonoCompile *cfg) MONO_INTERNAL;
+ guint inline_offset, gboolean is_virtual_call);
+
+MonoInst *mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins, MonoBasicBlock **out_cbb);
+void mono_decompose_long_opts (MonoCompile *cfg);
+void mono_decompose_vtype_opts (MonoCompile *cfg);
+void mono_decompose_vtype_opts_llvm (MonoCompile *cfg);
+void mono_decompose_array_access_opts (MonoCompile *cfg);
+void mono_decompose_soft_float (MonoCompile *cfg);
+void mono_handle_global_vregs (MonoCompile *cfg);
+void mono_spill_global_vars (MonoCompile *cfg, gboolean *need_local_opts);
+void mono_if_conversion (MonoCompile *cfg);
/* virtual function delegate */
-gpointer mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method) MONO_INTERNAL;
+gpointer mono_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method);
/* methods that must be provided by the arch-specific port */
-void mono_arch_init (void) MONO_INTERNAL;
-void mono_arch_finish_init (void) MONO_INTERNAL;
-void mono_arch_cleanup (void) MONO_INTERNAL;
-void mono_arch_cpu_init (void) MONO_INTERNAL;
-guint32 mono_arch_cpu_optimizations (guint32 *exclude_mask) MONO_INTERNAL;
-void mono_arch_instrument_mem_needs (MonoMethod *method, int *stack, int *code) MONO_INTERNAL;
-void *mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments) MONO_INTERNAL;
-void *mono_arch_instrument_epilog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments) MONO_INTERNAL;
-void *mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments, gboolean preserve_argument_registers) MONO_INTERNAL;
-void mono_codegen (MonoCompile *cfg) MONO_INTERNAL;
+void mono_arch_init (void);
+void mono_arch_finish_init (void);
+void mono_arch_cleanup (void);
+void mono_arch_cpu_init (void);
+guint32 mono_arch_cpu_optimizations (guint32 *exclude_mask);
+void mono_arch_instrument_mem_needs (MonoMethod *method, int *stack, int *code);
+void *mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments);
+void *mono_arch_instrument_epilog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments);
+void *mono_arch_instrument_epilog_full (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments, gboolean preserve_argument_registers);
+void mono_codegen (MonoCompile *cfg);
void mono_call_inst_add_outarg_reg (MonoCompile *cfg, MonoCallInst *call, int vreg, int hreg, int bank) MONO_LLVM_INTERNAL;
-void mono_call_inst_add_outarg_vt (MonoCompile *cfg, MonoCallInst *call, MonoInst *outarg_vt) MONO_INTERNAL;
-const char *mono_arch_regname (int reg) MONO_INTERNAL;
-const char *mono_arch_fregname (int reg) MONO_INTERNAL;
-void mono_arch_exceptions_init (void) MONO_INTERNAL;
-guchar* mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_create_generic_class_init_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info) MONO_INTERNAL;
-gpointer mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean is_v4, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
+void mono_call_inst_add_outarg_vt (MonoCompile *cfg, MonoCallInst *call, MonoInst *outarg_vt);
+const char *mono_arch_regname (int reg);
+const char *mono_arch_fregname (int reg);
+void mono_arch_exceptions_init (void);
+guchar* mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_create_rgctx_lazy_fetch_trampoline (guint32 slot, MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_create_general_rgctx_lazy_fetch_trampoline (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_create_generic_class_init_trampoline (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info);
+gpointer mono_arch_create_monitor_enter_trampoline (MonoTrampInfo **info, gboolean is_v4, gboolean aot);
+gpointer mono_arch_create_monitor_exit_trampoline (MonoTrampInfo **info, gboolean aot);
guint8 *mono_arch_create_llvm_native_thunk (MonoDomain *domain, guint8* addr) MONO_LLVM_INTERNAL;
-GList *mono_arch_get_allocatable_int_vars (MonoCompile *cfg) MONO_INTERNAL;
-GList *mono_arch_get_global_int_regs (MonoCompile *cfg) MONO_INTERNAL;
-GList *mono_arch_get_global_fp_regs (MonoCompile *cfg) MONO_INTERNAL;
-GList *mono_arch_get_iregs_clobbered_by_call (MonoCallInst *call) MONO_INTERNAL;
-GList *mono_arch_get_fregs_clobbered_by_call (MonoCallInst *call) MONO_INTERNAL;
-guint32 mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv) MONO_INTERNAL;
-void mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors) MONO_INTERNAL;
-void mono_arch_flush_icache (guint8 *code, gint size) MONO_INTERNAL;
-int mono_arch_max_epilog_size (MonoCompile *cfg) MONO_INTERNAL;
-guint8 *mono_arch_emit_prolog (MonoCompile *cfg) MONO_INTERNAL;
-void mono_arch_emit_epilog (MonoCompile *cfg) MONO_INTERNAL;
-void mono_arch_emit_exceptions (MonoCompile *cfg) MONO_INTERNAL;
-void mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_arch_peephole_pass_1 (MonoCompile *cfg, MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) MONO_INTERNAL;
-void mono_arch_free_jit_tls_data (MonoJitTlsData *tls) MONO_INTERNAL;
-void mono_arch_fill_argument_info (MonoCompile *cfg) MONO_INTERNAL;
-void mono_arch_allocate_vars (MonoCompile *m) MONO_INTERNAL;
-int mono_arch_get_argument_info (MonoGenericSharingContext *gsctx, MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info) MONO_INTERNAL;
-gboolean mono_arch_print_tree (MonoInst *tree, int arity) MONO_INTERNAL;
-void mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call) MONO_INTERNAL;
-void mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src) MONO_INTERNAL;
-void mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val) MONO_INTERNAL;
-MonoDynCallInfo *mono_arch_dyn_call_prepare (MonoMethodSignature *sig) MONO_INTERNAL;
-void mono_arch_dyn_call_free (MonoDynCallInfo *info) MONO_INTERNAL;
-void mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, guint8 *buf, int buf_len) MONO_INTERNAL;
-void mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf) MONO_INTERNAL;
-MonoInst *mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) MONO_INTERNAL;
-void mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins) MONO_INTERNAL;
-void mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins) MONO_INTERNAL;
-GSList* mono_arch_get_delegate_invoke_impls (void) MONO_INTERNAL;
+GList *mono_arch_get_allocatable_int_vars (MonoCompile *cfg);
+GList *mono_arch_get_global_int_regs (MonoCompile *cfg);
+GList *mono_arch_get_global_fp_regs (MonoCompile *cfg);
+GList *mono_arch_get_iregs_clobbered_by_call (MonoCallInst *call);
+GList *mono_arch_get_fregs_clobbered_by_call (MonoCallInst *call);
+guint32 mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv);
+void mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors);
+void mono_arch_flush_icache (guint8 *code, gint size);
+int mono_arch_max_epilog_size (MonoCompile *cfg);
+guint8 *mono_arch_emit_prolog (MonoCompile *cfg);
+void mono_arch_emit_epilog (MonoCompile *cfg);
+void mono_arch_emit_exceptions (MonoCompile *cfg);
+void mono_arch_lowering_pass (MonoCompile *cfg, MonoBasicBlock *bb);
+void mono_arch_peephole_pass_1 (MonoCompile *cfg, MonoBasicBlock *bb);
+void mono_arch_peephole_pass_2 (MonoCompile *cfg, MonoBasicBlock *bb);
+void mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb);
+void mono_arch_free_jit_tls_data (MonoJitTlsData *tls);
+void mono_arch_fill_argument_info (MonoCompile *cfg);
+void mono_arch_allocate_vars (MonoCompile *m);
+int mono_arch_get_argument_info (MonoGenericSharingContext *gsctx, MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info);
+gboolean mono_arch_print_tree (MonoInst *tree, int arity);
+void mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call);
+void mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src);
+void mono_arch_emit_setret (MonoCompile *cfg, MonoMethod *method, MonoInst *val);
+MonoDynCallInfo *mono_arch_dyn_call_prepare (MonoMethodSignature *sig);
+void mono_arch_dyn_call_free (MonoDynCallInfo *info);
+void mono_arch_start_dyn_call (MonoDynCallInfo *info, gpointer **args, guint8 *ret, guint8 *buf, int buf_len);
+void mono_arch_finish_dyn_call (MonoDynCallInfo *info, guint8 *buf);
+MonoInst *mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
+void mono_arch_decompose_opts (MonoCompile *cfg, MonoInst *ins);
+void mono_arch_decompose_long_opts (MonoCompile *cfg, MonoInst *ins);
+GSList* mono_arch_get_delegate_invoke_impls (void);
LLVMCallInfo* mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) MONO_LLVM_INTERNAL;
-guint8* mono_arch_emit_load_got_addr (guint8 *start, guint8 *code, MonoCompile *cfg, MonoJumpInfo **ji) MONO_INTERNAL;
-guint8* mono_arch_emit_load_aotconst (guint8 *start, guint8 *code, MonoJumpInfo **ji, int tramp_type, gconstpointer target) MONO_INTERNAL;
-GSList* mono_arch_get_cie_program (void) MONO_INTERNAL;
-void mono_arch_set_target (char *mtriple) MONO_INTERNAL;
-gboolean mono_arch_gsharedvt_sig_supported (MonoMethodSignature *sig) MONO_INTERNAL;
-gpointer mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_sig, MonoMethodSignature *gsharedvt_sig, MonoGenericSharingContext *gsctx, gboolean gsharedvt_in, gint32 vcall_offset, gboolean calli) MONO_INTERNAL;
-gboolean mono_arch_opcode_needs_emulation (MonoCompile *cfg, int opcode) MONO_INTERNAL;
-gboolean mono_arch_tail_call_supported (MonoCompile *cfg, MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
-int mono_arch_translate_tls_offset (int offset) MONO_INTERNAL;
-gboolean mono_arch_opcode_supported (int opcode) MONO_INTERNAL;
+guint8* mono_arch_emit_load_got_addr (guint8 *start, guint8 *code, MonoCompile *cfg, MonoJumpInfo **ji);
+guint8* mono_arch_emit_load_aotconst (guint8 *start, guint8 *code, MonoJumpInfo **ji, int tramp_type, gconstpointer target);
+GSList* mono_arch_get_cie_program (void);
+void mono_arch_set_target (char *mtriple);
+gboolean mono_arch_gsharedvt_sig_supported (MonoMethodSignature *sig);
+gpointer mono_arch_get_gsharedvt_trampoline (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_gsharedvt_call_info (gpointer addr, MonoMethodSignature *normal_sig, MonoMethodSignature *gsharedvt_sig, MonoGenericSharingContext *gsctx, gboolean gsharedvt_in, gint32 vcall_offset, gboolean calli);
+gboolean mono_arch_opcode_needs_emulation (MonoCompile *cfg, int opcode);
+gboolean mono_arch_tail_call_supported (MonoCompile *cfg, MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig);
+int mono_arch_translate_tls_offset (int offset);
+gboolean mono_arch_opcode_supported (int opcode);
#ifdef MONO_ARCH_SOFT_FLOAT_FALLBACK
-gboolean mono_arch_is_soft_float (void) MONO_INTERNAL;
+gboolean mono_arch_is_soft_float (void);
#else
static inline MONO_ALWAYS_INLINE gboolean
mono_arch_is_soft_float (void)
/* Soft Debug support */
#ifdef MONO_ARCH_SOFT_DEBUG_SUPPORTED
-void mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip) MONO_INTERNAL;
-void mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip) MONO_INTERNAL;
-void mono_arch_start_single_stepping (void) MONO_INTERNAL;
-void mono_arch_stop_single_stepping (void) MONO_INTERNAL;
-gboolean mono_arch_is_single_step_event (void *info, void *sigctx) MONO_INTERNAL;
-gboolean mono_arch_is_breakpoint_event (void *info, void *sigctx) MONO_INTERNAL;
-void mono_arch_skip_breakpoint (MonoContext *ctx, MonoJitInfo *ji) MONO_INTERNAL;
-void mono_arch_skip_single_step (MonoContext *ctx) MONO_INTERNAL;
-gpointer mono_arch_get_seq_point_info (MonoDomain *domain, guint8 *code) MONO_INTERNAL;
-void mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func) MONO_INTERNAL;
-void mono_arch_init_lmf_ext (MonoLMFExt *ext, gpointer prev_lmf) MONO_INTERNAL;
+void mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip);
+void mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip);
+void mono_arch_start_single_stepping (void);
+void mono_arch_stop_single_stepping (void);
+gboolean mono_arch_is_single_step_event (void *info, void *sigctx);
+gboolean mono_arch_is_breakpoint_event (void *info, void *sigctx);
+void mono_arch_skip_breakpoint (MonoContext *ctx, MonoJitInfo *ji);
+void mono_arch_skip_single_step (MonoContext *ctx);
+gpointer mono_arch_get_seq_point_info (MonoDomain *domain, guint8 *code);
+void mono_arch_setup_resume_sighandler_ctx (MonoContext *ctx, gpointer func);
+void mono_arch_init_lmf_ext (MonoLMFExt *ext, gpointer prev_lmf);
#endif
#ifdef USE_JUMP_TABLES
void
-mono_jumptable_init (void) MONO_INTERNAL;
+mono_jumptable_init (void);
gpointer*
-mono_jumptable_add_entry (void) MONO_INTERNAL;
+mono_jumptable_add_entry (void);
gpointer*
-mono_jumptable_add_entries (guint32 entries) MONO_INTERNAL;
+mono_jumptable_add_entries (guint32 entries);
void
-mono_jumptable_cleanup (void) MONO_INTERNAL;
+mono_jumptable_cleanup (void);
gpointer*
mono_arch_jumptable_entry_from_code (guint8 *code);
gpointer*
MonoJitInfo *ji, MonoContext *ctx,
MonoContext *new_ctx, MonoLMF **lmf,
mgreg_t **save_locations,
- StackFrameInfo *frame_info) MONO_INTERNAL;
-gpointer mono_arch_get_throw_exception_by_name (void) MONO_INTERNAL;
-gpointer mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_arch_get_throw_pending_exception (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gboolean mono_arch_handle_exception (void *sigctx, gpointer obj) MONO_INTERNAL;
-void mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, gpointer fault_addr, gboolean stack_ovf) MONO_INTERNAL;
-gboolean mono_handle_soft_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, guint8* fault_addr) MONO_INTERNAL;
-void mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr) MONO_INTERNAL;
-gpointer mono_arch_ip_from_context (void *sigctx) MONO_INTERNAL;
-mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg) MONO_INTERNAL;
-void mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val) MONO_INTERNAL;
-void mono_arch_flush_register_windows (void) MONO_INTERNAL;
-gboolean mono_arch_is_inst_imm (gint64 imm) MONO_INTERNAL;
-gboolean mono_arch_is_int_overflow (void *sigctx, void *info) MONO_INTERNAL;
-void mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg) MONO_INTERNAL;
-guint32 mono_arch_get_patch_offset (guint8 *code) MONO_INTERNAL;
-gpointer*mono_arch_get_delegate_method_ptr_addr (guint8* code, mgreg_t *regs) MONO_INTERNAL;
-void mono_arch_create_vars (MonoCompile *cfg) MONO_INTERNAL;
-void mono_arch_save_unwind_info (MonoCompile *cfg) MONO_INTERNAL;
-void mono_arch_register_lowlevel_calls (void) MONO_INTERNAL;
-gpointer mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr) MONO_INTERNAL;
-gpointer mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr) MONO_INTERNAL;
-gpointer mono_arch_get_llvm_imt_trampoline (MonoDomain *domain, MonoMethod *method, int vt_offset) MONO_INTERNAL;
-gpointer mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr) MONO_INTERNAL;
-void mono_arch_patch_callsite (guint8 *method_start, guint8 *code, guint8 *addr) MONO_INTERNAL;
-void mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr) MONO_INTERNAL;
-void mono_arch_nullify_class_init_trampoline(guint8 *code, mgreg_t *regs) MONO_INTERNAL;
-int mono_arch_get_this_arg_reg (guint8 *code) MONO_INTERNAL;
-gpointer mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code) MONO_INTERNAL;
-gpointer mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target) MONO_INTERNAL;
-gpointer mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method, int offset, gboolean load_imt_reg) MONO_INTERNAL;
-gpointer mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len) MONO_INTERNAL;
-void mono_arch_emit_imt_argument (MonoCompile *cfg, MonoCallInst *call, MonoInst *imt_arg) MONO_INTERNAL;
-MonoMethod* mono_arch_find_imt_method (mgreg_t *regs, guint8 *code) MONO_INTERNAL;
-MonoVTable* mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code) MONO_INTERNAL;
-gpointer mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp) MONO_INTERNAL;
-void mono_arch_notify_pending_exc (MonoThreadInfo *info) MONO_INTERNAL;
-guint8* mono_arch_get_call_target (guint8 *code) MONO_INTERNAL;
-guint32 mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code) MONO_INTERNAL;
-GSList *mono_arch_get_trampolines (gboolean aot) MONO_INTERNAL;
+ StackFrameInfo *frame_info);
+gpointer mono_arch_get_throw_exception_by_name (void);
+gpointer mono_arch_get_call_filter (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_restore_context (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_throw_exception (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_rethrow_exception (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_throw_corlib_exception (MonoTrampInfo **info, gboolean aot);
+gpointer mono_arch_get_throw_pending_exception (MonoTrampInfo **info, gboolean aot);
+gboolean mono_arch_handle_exception (void *sigctx, gpointer obj);
+void mono_arch_handle_altstack_exception (void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, gpointer fault_addr, gboolean stack_ovf);
+gboolean mono_handle_soft_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo, guint8* fault_addr);
+void mono_handle_hard_stack_ovf (MonoJitTlsData *jit_tls, MonoJitInfo *ji, void *ctx, guint8* fault_addr);
+gpointer mono_arch_ip_from_context (void *sigctx);
+mgreg_t mono_arch_context_get_int_reg (MonoContext *ctx, int reg);
+void mono_arch_context_set_int_reg (MonoContext *ctx, int reg, mgreg_t val);
+void mono_arch_flush_register_windows (void);
+gboolean mono_arch_is_inst_imm (gint64 imm);
+gboolean mono_arch_is_int_overflow (void *sigctx, void *info);
+void mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg);
+guint32 mono_arch_get_patch_offset (guint8 *code);
+gpointer*mono_arch_get_delegate_method_ptr_addr (guint8* code, mgreg_t *regs);
+void mono_arch_create_vars (MonoCompile *cfg);
+void mono_arch_save_unwind_info (MonoCompile *cfg);
+void mono_arch_register_lowlevel_calls (void);
+gpointer mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr);
+gpointer mono_arch_get_static_rgctx_trampoline (MonoMethod *m, MonoMethodRuntimeGenericContext *mrgctx, gpointer addr);
+gpointer mono_arch_get_llvm_imt_trampoline (MonoDomain *domain, MonoMethod *method, int vt_offset);
+gpointer mono_arch_get_gsharedvt_arg_trampoline (MonoDomain *domain, gpointer arg, gpointer addr);
+void mono_arch_patch_callsite (guint8 *method_start, guint8 *code, guint8 *addr);
+void mono_arch_patch_plt_entry (guint8 *code, gpointer *got, mgreg_t *regs, guint8 *addr);
+void mono_arch_nullify_class_init_trampoline(guint8 *code, mgreg_t *regs);
+int mono_arch_get_this_arg_reg (guint8 *code);
+gpointer mono_arch_get_this_arg_from_call (mgreg_t *regs, guint8 *code);
+gpointer mono_arch_get_delegate_invoke_impl (MonoMethodSignature *sig, gboolean has_target);
+gpointer mono_arch_get_delegate_virtual_invoke_impl (MonoMethodSignature *sig, MonoMethod *method, int offset, gboolean load_imt_reg);
+gpointer mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
+void mono_arch_emit_imt_argument (MonoCompile *cfg, MonoCallInst *call, MonoInst *imt_arg);
+MonoMethod* mono_arch_find_imt_method (mgreg_t *regs, guint8 *code);
+MonoVTable* mono_arch_find_static_call_vtable (mgreg_t *regs, guint8 *code);
+gpointer mono_arch_build_imt_thunk (MonoVTable *vtable, MonoDomain *domain, MonoIMTCheckItem **imt_entries, int count, gpointer fail_tramp);
+void mono_arch_notify_pending_exc (MonoThreadInfo *info);
+guint8* mono_arch_get_call_target (guint8 *code);
+guint32 mono_arch_get_plt_info_offset (guint8 *plt_entry, mgreg_t *regs, guint8 *code);
+GSList *mono_arch_get_trampolines (gboolean aot);
/* Handle block guard */
-gpointer mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value) MONO_INTERNAL;
-gpointer mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot) MONO_INTERNAL;
-gpointer mono_create_handler_block_trampoline (void) MONO_INTERNAL;
-gboolean mono_install_handler_block_guard (MonoThreadUnwindState *ctx) MONO_INTERNAL;
+gpointer mono_arch_install_handler_block_guard (MonoJitInfo *ji, MonoJitExceptionInfo *clause, MonoContext *ctx, gpointer new_value);
+gpointer mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot);
+gpointer mono_create_handler_block_trampoline (void);
+gboolean mono_install_handler_block_guard (MonoThreadUnwindState *ctx);
/*New interruption machinery */
void
-mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) MONO_INTERNAL;
+mono_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data);
void
-mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data) MONO_INTERNAL;
+mono_arch_setup_async_callback (MonoContext *ctx, void (*async_cb)(void *fun), gpointer user_data);
gboolean
-mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info) MONO_INTERNAL;
+mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info);
/* Exception handling */
typedef gboolean (*MonoJitStackWalk) (StackFrameInfo *frame, MonoContext *ctx, gpointer data);
-void mono_exceptions_init (void) MONO_INTERNAL;
-gboolean mono_handle_exception (MonoContext *ctx, gpointer obj) MONO_INTERNAL;
-void mono_handle_native_sigsegv (int signal, void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo) MONO_INTERNAL;
+void mono_exceptions_init (void);
+gboolean mono_handle_exception (MonoContext *ctx, gpointer obj);
+void mono_handle_native_sigsegv (int signal, void *sigctx, MONO_SIG_HANDLER_INFO_TYPE *siginfo);
MONO_API void mono_print_thread_dump (void *sigctx);
MONO_API void mono_print_thread_dump_from_ctx (MonoContext *ctx);
-void mono_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data) MONO_INTERNAL;
-void mono_walk_stack_with_state (MonoJitStackWalk func, MonoThreadUnwindState *state, MonoUnwindOptions unwind_options, void *user_data) MONO_INTERNAL;
-void mono_walk_stack (MonoJitStackWalk func, MonoUnwindOptions options, void *user_data) MONO_INTERNAL;
-gboolean mono_thread_state_init_from_sigctx (MonoThreadUnwindState *ctx, void *sigctx) MONO_INTERNAL;
-gboolean mono_thread_state_init_from_current (MonoThreadUnwindState *ctx) MONO_INTERNAL;
-gboolean mono_thread_state_init_from_monoctx (MonoThreadUnwindState *ctx, MonoContext *mctx) MONO_INTERNAL;
-
-void mono_setup_altstack (MonoJitTlsData *tls) MONO_INTERNAL;
-void mono_free_altstack (MonoJitTlsData *tls) MONO_INTERNAL;
-gpointer mono_altstack_restore_prot (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp) MONO_INTERNAL;
-MonoJitInfo* mini_jit_info_table_find (MonoDomain *domain, char *addr, MonoDomain **out_domain) MONO_INTERNAL;
+void mono_walk_stack_with_ctx (MonoJitStackWalk func, MonoContext *start_ctx, MonoUnwindOptions unwind_options, void *user_data);
+void mono_walk_stack_with_state (MonoJitStackWalk func, MonoThreadUnwindState *state, MonoUnwindOptions unwind_options, void *user_data);
+void mono_walk_stack (MonoJitStackWalk func, MonoUnwindOptions options, void *user_data);
+gboolean mono_thread_state_init_from_sigctx (MonoThreadUnwindState *ctx, void *sigctx);
+gboolean mono_thread_state_init_from_current (MonoThreadUnwindState *ctx);
+gboolean mono_thread_state_init_from_monoctx (MonoThreadUnwindState *ctx, MonoContext *mctx);
+
+void mono_setup_altstack (MonoJitTlsData *tls);
+void mono_free_altstack (MonoJitTlsData *tls);
+gpointer mono_altstack_restore_prot (mgreg_t *regs, guint8 *code, gpointer *tramp_data, guint8* tramp);
+MonoJitInfo* mini_jit_info_table_find (MonoDomain *domain, char *addr, MonoDomain **out_domain);
void mono_resume_unwind (MonoContext *ctx) MONO_LLVM_INTERNAL;
-MonoJitInfo * mono_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx, MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset, gboolean *managed) MONO_INTERNAL;
+MonoJitInfo * mono_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoJitInfo *prev_ji, MonoContext *ctx, MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset, gboolean *managed);
typedef gboolean (*MonoExceptionFrameWalk) (MonoMethod *method, gpointer ip, size_t native_offset, gboolean managed, gpointer user_data);
MONO_API gboolean mono_exception_walk_trace (MonoException *ex, MonoExceptionFrameWalk func, gpointer user_data);
-void mono_restore_context (MonoContext *ctx) MONO_INTERNAL;
-guint8* mono_jinfo_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len) MONO_INTERNAL;
-int mono_jinfo_get_epilog_size (MonoJitInfo *ji) MONO_INTERNAL;
+void mono_restore_context (MonoContext *ctx);
+guint8* mono_jinfo_get_unwind_info (MonoJitInfo *ji, guint32 *unwind_info_len);
+int mono_jinfo_get_epilog_size (MonoJitInfo *ji);
gboolean
mono_find_jit_info_ext (MonoDomain *domain, MonoJitTlsData *jit_tls,
MonoJitInfo *prev_ji, MonoContext *ctx,
MonoContext *new_ctx, char **trace, MonoLMF **lmf,
mgreg_t **save_locations,
- StackFrameInfo *frame) MONO_INTERNAL;
+ StackFrameInfo *frame);
-gpointer mono_get_throw_exception (void) MONO_INTERNAL;
-gpointer mono_get_rethrow_exception (void) MONO_INTERNAL;
-gpointer mono_get_call_filter (void) MONO_INTERNAL;
-gpointer mono_get_restore_context (void) MONO_INTERNAL;
-gpointer mono_get_throw_exception_by_name (void) MONO_INTERNAL;
-gpointer mono_get_throw_corlib_exception (void) MONO_INTERNAL;
+gpointer mono_get_throw_exception (void);
+gpointer mono_get_rethrow_exception (void);
+gpointer mono_get_call_filter (void);
+gpointer mono_get_restore_context (void);
+gpointer mono_get_throw_exception_by_name (void);
+gpointer mono_get_throw_corlib_exception (void);
-MonoArray *ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info) MONO_INTERNAL;
+MonoArray *ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info);
MonoBoolean ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info,
MonoReflectionMethod **method,
gint32 *iloffset, gint32 *native_offset,
- MonoString **file, gint32 *line, gint32 *column) MONO_INTERNAL;
-MonoString *ves_icall_System_Exception_get_trace (MonoException *exc) MONO_INTERNAL;
-void mono_set_cast_details (MonoClass *from, MonoClass *to) MONO_INTERNAL;
+ MonoString **file, gint32 *line, gint32 *column);
+MonoString *ves_icall_System_Exception_get_trace (MonoException *exc);
+void mono_set_cast_details (MonoClass *from, MonoClass *to);
/* Installs a function which is called when the runtime encounters an unhandled exception.
* This hook isn't expected to return.
void mono_invoke_unhandled_exception_hook (MonoObject *exc);
/* Dominator/SSA methods */
-void mono_compile_dominator_info (MonoCompile *cfg, int dom_flags) MONO_INTERNAL;
-void mono_compute_natural_loops (MonoCompile *cfg) MONO_INTERNAL;
-MonoBitSet* mono_compile_iterated_dfrontier (MonoCompile *cfg, MonoBitSet *set) MONO_INTERNAL;
-void mono_ssa_compute (MonoCompile *cfg) MONO_INTERNAL;
-void mono_ssa_remove (MonoCompile *cfg) MONO_INTERNAL;
-void mono_ssa_cprop (MonoCompile *cfg) MONO_INTERNAL;
-void mono_ssa_deadce (MonoCompile *cfg) MONO_INTERNAL;
-void mono_ssa_strength_reduction (MonoCompile *cfg) MONO_INTERNAL;
-void mono_free_loop_info (MonoCompile *cfg) MONO_INTERNAL;
-void mono_ssa_loop_invariant_code_motion (MonoCompile *cfg) MONO_INTERNAL;
+void mono_compile_dominator_info (MonoCompile *cfg, int dom_flags);
+void mono_compute_natural_loops (MonoCompile *cfg);
+MonoBitSet* mono_compile_iterated_dfrontier (MonoCompile *cfg, MonoBitSet *set);
+void mono_ssa_compute (MonoCompile *cfg);
+void mono_ssa_remove (MonoCompile *cfg);
+void mono_ssa_cprop (MonoCompile *cfg);
+void mono_ssa_deadce (MonoCompile *cfg);
+void mono_ssa_strength_reduction (MonoCompile *cfg);
+void mono_free_loop_info (MonoCompile *cfg);
+void mono_ssa_loop_invariant_code_motion (MonoCompile *cfg);
void mono_ssa_compute2 (MonoCompile *cfg);
void mono_ssa_remove2 (MonoCompile *cfg);
/* debugging support */
void mono_debug_init_method (MonoCompile *cfg, MonoBasicBlock *start_block,
- guint32 breakpoint_id) MONO_INTERNAL;
-void mono_debug_open_method (MonoCompile *cfg) MONO_INTERNAL;
-void mono_debug_close_method (MonoCompile *cfg) MONO_INTERNAL;
-void mono_debug_free_method (MonoCompile *cfg) MONO_INTERNAL;
-void mono_debug_open_block (MonoCompile *cfg, MonoBasicBlock *bb, guint32 address) MONO_INTERNAL;
-void mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address) MONO_INTERNAL;
-void mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *buf_len) MONO_INTERNAL;
+ guint32 breakpoint_id);
+void mono_debug_open_method (MonoCompile *cfg);
+void mono_debug_close_method (MonoCompile *cfg);
+void mono_debug_free_method (MonoCompile *cfg);
+void mono_debug_open_block (MonoCompile *cfg, MonoBasicBlock *bb, guint32 address);
+void mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address);
+void mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *buf_len);
void mono_debug_add_aot_method (MonoDomain *domain,
MonoMethod *method, guint8 *code_start,
- guint8 *debug_info, guint32 debug_info_len) MONO_INTERNAL;
+ guint8 *debug_info, guint32 debug_info_len);
MONO_API void mono_debug_print_vars (gpointer ip, gboolean only_arguments);
MONO_API void mono_debugger_run_finally (MonoContext *start_ctx);
MONO_API gboolean mono_breakpoint_clean_code (guint8 *method_start, guint8 *code, int offset, guint8 *buf, int size);
/* Tracing */
-MonoTraceSpec *mono_trace_parse_options (const char *options) MONO_INTERNAL;
-void mono_trace_set_assembly (MonoAssembly *assembly) MONO_INTERNAL;
-gboolean mono_trace_eval (MonoMethod *method) MONO_INTERNAL;
+MonoTraceSpec *mono_trace_parse_options (const char *options);
+void mono_trace_set_assembly (MonoAssembly *assembly);
+gboolean mono_trace_eval (MonoMethod *method);
extern void
-mono_perform_abc_removal (MonoCompile *cfg) MONO_INTERNAL;
+mono_perform_abc_removal (MonoCompile *cfg);
extern void
-mono_perform_abc_removal (MonoCompile *cfg) MONO_INTERNAL;
+mono_perform_abc_removal (MonoCompile *cfg);
extern void
-mono_perform_ssapre (MonoCompile *cfg) MONO_INTERNAL;
+mono_perform_ssapre (MonoCompile *cfg);
extern void
-mono_local_cprop (MonoCompile *cfg) MONO_INTERNAL;
+mono_local_cprop (MonoCompile *cfg);
extern void
mono_local_cprop (MonoCompile *cfg);
extern void
mono_local_deadce (MonoCompile *cfg);
void
-mono_local_alias_analysis (MonoCompile *cfg) MONO_INTERNAL;
+mono_local_alias_analysis (MonoCompile *cfg);
/* CAS - stack walk */
-MonoSecurityFrame* ves_icall_System_Security_SecurityFrame_GetSecurityFrame (gint32 skip) MONO_INTERNAL;
-MonoArray* ves_icall_System_Security_SecurityFrame_GetSecurityStack (gint32 skip) MONO_INTERNAL;
+MonoSecurityFrame* ves_icall_System_Security_SecurityFrame_GetSecurityFrame (gint32 skip);
+MonoArray* ves_icall_System_Security_SecurityFrame_GetSecurityStack (gint32 skip);
/* Generic sharing */
void
-mono_set_generic_sharing_supported (gboolean supported) MONO_INTERNAL;
+mono_set_generic_sharing_supported (gboolean supported);
void
-mono_set_generic_sharing_vt_supported (gboolean supported) MONO_INTERNAL;
+mono_set_generic_sharing_vt_supported (gboolean supported);
void
-mono_set_partial_sharing_supported (gboolean supported) MONO_INTERNAL;
+mono_set_partial_sharing_supported (gboolean supported);
gboolean
-mono_class_generic_sharing_enabled (MonoClass *class) MONO_INTERNAL;
+mono_class_generic_sharing_enabled (MonoClass *class);
gpointer
-mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint8 *caller, guint32 slot) MONO_INTERNAL;
+mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint8 *caller, guint32 slot);
gpointer
-mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint8 *caller, guint32 slot) MONO_INTERNAL;
+mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint8 *caller, guint32 slot);
MonoMethodRuntimeGenericContext*
-mono_method_lookup_rgctx (MonoVTable *class_vtable, MonoGenericInst *method_inst) MONO_INTERNAL;
+mono_method_lookup_rgctx (MonoVTable *class_vtable, MonoGenericInst *method_inst);
const char*
-mono_rgctx_info_type_to_str (MonoRgctxInfoType type) MONO_INTERNAL;
+mono_rgctx_info_type_to_str (MonoRgctxInfoType type);
MonoJumpInfoType
-mini_rgctx_info_type_to_patch_info_type (MonoRgctxInfoType info_type) MONO_INTERNAL;
+mini_rgctx_info_type_to_patch_info_type (MonoRgctxInfoType info_type);
gboolean
-mono_method_needs_static_rgctx_invoke (MonoMethod *method, gboolean allow_type_vars) MONO_INTERNAL;
+mono_method_needs_static_rgctx_invoke (MonoMethod *method, gboolean allow_type_vars);
int
-mono_class_rgctx_get_array_size (int n, gboolean mrgctx) MONO_INTERNAL;
+mono_class_rgctx_get_array_size (int n, gboolean mrgctx);
guint32
mono_method_lookup_or_register_info (MonoMethod *method, gboolean in_mrgctx, gpointer data,
- MonoRgctxInfoType info_type, MonoGenericContext *generic_context) MONO_INTERNAL;
+ MonoRgctxInfoType info_type, MonoGenericContext *generic_context);
MonoGenericContext
-mono_method_construct_object_context (MonoMethod *method) MONO_INTERNAL;
+mono_method_construct_object_context (MonoMethod *method);
MonoMethod*
-mono_method_get_declaring_generic_method (MonoMethod *method) MONO_INTERNAL;
+mono_method_get_declaring_generic_method (MonoMethod *method);
int
-mono_generic_context_check_used (MonoGenericContext *context) MONO_INTERNAL;
+mono_generic_context_check_used (MonoGenericContext *context);
int
-mono_class_check_context_used (MonoClass *class) MONO_INTERNAL;
+mono_class_check_context_used (MonoClass *class);
gboolean
-mono_generic_context_is_sharable (MonoGenericContext *context, gboolean allow_type_vars) MONO_INTERNAL;
+mono_generic_context_is_sharable (MonoGenericContext *context, gboolean allow_type_vars);
gboolean
-mono_generic_context_is_sharable_full (MonoGenericContext *context, gboolean allow_type_vars, gboolean allow_partial) MONO_INTERNAL;
+mono_generic_context_is_sharable_full (MonoGenericContext *context, gboolean allow_type_vars, gboolean allow_partial);
gboolean
-mono_method_is_generic_impl (MonoMethod *method) MONO_INTERNAL;
+mono_method_is_generic_impl (MonoMethod *method);
gboolean
-mono_method_is_generic_sharable (MonoMethod *method, gboolean allow_type_vars) MONO_INTERNAL;
+mono_method_is_generic_sharable (MonoMethod *method, gboolean allow_type_vars);
gboolean
-mono_method_is_generic_sharable_full (MonoMethod *method, gboolean allow_type_vars, gboolean allow_partial, gboolean allow_gsharedvt) MONO_INTERNAL;
+mono_method_is_generic_sharable_full (MonoMethod *method, gboolean allow_type_vars, gboolean allow_partial, gboolean allow_gsharedvt);
gboolean
-mini_class_is_generic_sharable (MonoClass *klass) MONO_INTERNAL;
+mini_class_is_generic_sharable (MonoClass *klass);
gboolean
-mono_is_partially_sharable_inst (MonoGenericInst *inst) MONO_INTERNAL;
+mono_is_partially_sharable_inst (MonoGenericInst *inst);
-MonoGenericSharingContext* mono_get_generic_context_from_code (guint8 *code) MONO_INTERNAL;
+MonoGenericSharingContext* mono_get_generic_context_from_code (guint8 *code);
-MonoGenericContext* mini_method_get_context (MonoMethod *method) MONO_INTERNAL;
+MonoGenericContext* mini_method_get_context (MonoMethod *method);
-int mono_method_check_context_used (MonoMethod *method) MONO_INTERNAL;
+int mono_method_check_context_used (MonoMethod *method);
-gboolean mono_generic_context_equal_deep (MonoGenericContext *context1, MonoGenericContext *context2) MONO_INTERNAL;
+gboolean mono_generic_context_equal_deep (MonoGenericContext *context1, MonoGenericContext *context2);
gpointer mono_helper_get_rgctx_other_ptr (MonoClass *caller_class, MonoVTable *vtable,
guint32 token, guint32 token_source, guint32 rgctx_type,
- gint32 rgctx_index) MONO_INTERNAL;
+ gint32 rgctx_index);
-void mono_generic_sharing_init (void) MONO_INTERNAL;
-void mono_generic_sharing_cleanup (void) MONO_INTERNAL;
+void mono_generic_sharing_init (void);
+void mono_generic_sharing_cleanup (void);
-MonoClass* mini_class_get_container_class (MonoClass *class) MONO_INTERNAL;
-MonoGenericContext* mini_class_get_context (MonoClass *class) MONO_INTERNAL;
+MonoClass* mini_class_get_container_class (MonoClass *class);
+MonoGenericContext* mini_class_get_context (MonoClass *class);
MonoType* mini_replace_type (MonoType *type) MONO_LLVM_INTERNAL;
MonoType* mini_get_underlying_type (MonoCompile *cfg, MonoType *type) MONO_LLVM_INTERNAL;
-MonoType* mini_get_basic_type_from_generic (MonoGenericSharingContext *gsctx, MonoType *type) MONO_INTERNAL;
-MonoType* mini_type_get_underlying_type (MonoGenericSharingContext *gsctx, MonoType *type) MONO_INTERNAL;
-MonoMethod* mini_get_shared_method (MonoMethod *method) MONO_INTERNAL;
-MonoMethod* mini_get_shared_method_to_register (MonoMethod *method) MONO_INTERNAL;
-MonoMethod* mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gsharedvt) MONO_INTERNAL;
-
-int mini_type_stack_size (MonoGenericSharingContext *gsctx, MonoType *t, int *align) MONO_INTERNAL;
-int mini_type_stack_size_full (MonoGenericSharingContext *gsctx, MonoType *t, guint32 *align, gboolean pinvoke) MONO_INTERNAL;
-void type_to_eval_stack_type (MonoCompile *cfg, MonoType *type, MonoInst *inst) MONO_INTERNAL;
+MonoType* mini_get_basic_type_from_generic (MonoGenericSharingContext *gsctx, MonoType *type);
+MonoType* mini_type_get_underlying_type (MonoGenericSharingContext *gsctx, MonoType *type);
+MonoMethod* mini_get_shared_method (MonoMethod *method);
+MonoMethod* mini_get_shared_method_to_register (MonoMethod *method);
+MonoMethod* mini_get_shared_method_full (MonoMethod *method, gboolean all_vt, gboolean is_gsharedvt);
+
+int mini_type_stack_size (MonoGenericSharingContext *gsctx, MonoType *t, int *align);
+int mini_type_stack_size_full (MonoGenericSharingContext *gsctx, MonoType *t, guint32 *align, gboolean pinvoke);
+void type_to_eval_stack_type (MonoCompile *cfg, MonoType *type, MonoInst *inst);
guint mono_type_to_regmove (MonoCompile *cfg, MonoType *type) MONO_LLVM_INTERNAL;
-void mono_cfg_add_try_hole (MonoCompile *cfg, MonoExceptionClause *clause, guint8 *start, MonoBasicBlock *bb) MONO_INTERNAL;
+void mono_cfg_add_try_hole (MonoCompile *cfg, MonoExceptionClause *clause, guint8 *start, MonoBasicBlock *bb);
-void mono_cfg_set_exception (MonoCompile *cfg, int type) MONO_INTERNAL;
-gboolean mini_type_is_reference (MonoCompile *cfg, MonoType *type) MONO_INTERNAL;
+void mono_cfg_set_exception (MonoCompile *cfg, int type);
+gboolean mini_type_is_reference (MonoCompile *cfg, MonoType *type);
gboolean mini_type_is_vtype (MonoCompile *cfg, MonoType *t) MONO_LLVM_INTERNAL;
gboolean mini_type_var_is_vt (MonoCompile *cfg, MonoType *type) MONO_LLVM_INTERNAL;
gboolean mini_is_gsharedvt_klass (MonoCompile *cfg, MonoClass *klass) MONO_LLVM_INTERNAL;
-gboolean mini_is_gsharedvt_type (MonoCompile *cfg, MonoType *t) MONO_INTERNAL;
-gboolean mini_is_gsharedvt_signature (MonoCompile *cfg, MonoMethodSignature *sig) MONO_INTERNAL;
-gboolean mini_is_gsharedvt_type_gsctx (MonoGenericSharingContext *gsctx, MonoType *t) MONO_INTERNAL;
+gboolean mini_is_gsharedvt_type (MonoCompile *cfg, MonoType *t);
+gboolean mini_is_gsharedvt_signature (MonoCompile *cfg, MonoMethodSignature *sig);
+gboolean mini_is_gsharedvt_type_gsctx (MonoGenericSharingContext *gsctx, MonoType *t);
gboolean mini_is_gsharedvt_variable_type (MonoCompile *cfg, MonoType *t) MONO_LLVM_INTERNAL;
gboolean mini_is_gsharedvt_variable_klass (MonoCompile *cfg, MonoClass *klass) MONO_LLVM_INTERNAL;
-gboolean mini_is_gsharedvt_sharable_method (MonoMethod *method) MONO_INTERNAL;
-gboolean mini_is_gsharedvt_variable_signature (MonoMethodSignature *sig) MONO_INTERNAL;
-gboolean mini_is_gsharedvt_sharable_inst (MonoGenericInst *inst) MONO_INTERNAL;
-gpointer mini_method_get_rgctx (MonoMethod *m) MONO_INTERNAL;
-void mini_init_gsctx (MonoDomain *domain, MonoMemPool *mp, MonoGenericContext *context, MonoGenericSharingContext *gsctx) MONO_INTERNAL;
+gboolean mini_is_gsharedvt_sharable_method (MonoMethod *method);
+gboolean mini_is_gsharedvt_variable_signature (MonoMethodSignature *sig);
+gboolean mini_is_gsharedvt_sharable_inst (MonoGenericInst *inst);
+gpointer mini_method_get_rgctx (MonoMethod *m);
+void mini_init_gsctx (MonoDomain *domain, MonoMemPool *mp, MonoGenericContext *context, MonoGenericSharingContext *gsctx);
gpointer mini_get_gsharedvt_wrapper (gboolean gsharedvt_in, gpointer addr, MonoMethodSignature *normal_sig, MonoMethodSignature *gsharedvt_sig, MonoGenericSharingContext *gsctx,
- gint32 vcall_offset, gboolean calli) MONO_INTERNAL;
+ gint32 vcall_offset, gboolean calli);
/* wapihandles.c */
-int mini_wapi_hps (int argc, char **argv) MONO_INTERNAL;
+int mini_wapi_hps (int argc, char **argv);
-int mini_wapi_semdel (int argc, char **argv) MONO_INTERNAL;
+int mini_wapi_semdel (int argc, char **argv);
-int mini_wapi_seminfo (int argc, char **argv) MONO_INTERNAL;
+int mini_wapi_seminfo (int argc, char **argv);
/* SIMD support */
SIMD_PREFETCH_MODE_2,
};
-const char *mono_arch_xregname (int reg) MONO_INTERNAL;
-void mono_simd_simplify_indirection (MonoCompile *cfg) MONO_INTERNAL;
-MonoInst* mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) MONO_INTERNAL;
-guint32 mono_arch_cpu_enumerate_simd_versions (void) MONO_INTERNAL;
-void mono_simd_intrinsics_init (void) MONO_INTERNAL;
+const char *mono_arch_xregname (int reg);
+void mono_simd_simplify_indirection (MonoCompile *cfg);
+MonoInst* mono_emit_simd_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
+guint32 mono_arch_cpu_enumerate_simd_versions (void);
+void mono_simd_intrinsics_init (void);
-MonoInst* mono_emit_native_types_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args) MONO_INTERNAL;
+MonoInst* mono_emit_native_types_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
MonoType* mini_native_type_replace_type (MonoType *type) MONO_LLVM_INTERNAL;
#ifdef __linux__
/* maybe enable also for other systems? */
#define ENABLE_JIT_MAP 1
-void mono_enable_jit_map (void) MONO_INTERNAL;
-void mono_emit_jit_map (MonoJitInfo *jinfo) MONO_INTERNAL;
-void mono_emit_jit_tramp (void *start, int size, const char *desc) MONO_INTERNAL;
-gboolean mono_jit_map_is_enabled (void) MONO_INTERNAL;
+void mono_enable_jit_map (void);
+void mono_emit_jit_map (MonoJitInfo *jinfo);
+void mono_emit_jit_tramp (void *start, int size, const char *desc);
+gboolean mono_jit_map_is_enabled (void);
#else
#define mono_enable_jit_map()
#define mono_emit_jit_map(ji)
/*
* Per-OS implementation functions.
*/
-void mono_runtime_install_handlers (void) MONO_INTERNAL;
-void mono_runtime_cleanup_handlers (void) MONO_INTERNAL;
-void mono_runtime_setup_stat_profiler (void) MONO_INTERNAL;
-void mono_runtime_shutdown_stat_profiler (void) MONO_INTERNAL;
-void mono_runtime_posix_install_handlers (void) MONO_INTERNAL;
-pid_t mono_runtime_syscall_fork (void) MONO_INTERNAL;
-void mono_gdb_render_native_backtraces (pid_t crashed_pid) MONO_INTERNAL;
+void mono_runtime_install_handlers (void);
+void mono_runtime_cleanup_handlers (void);
+void mono_runtime_setup_stat_profiler (void);
+void mono_runtime_shutdown_stat_profiler (void);
+void mono_runtime_posix_install_handlers (void);
+pid_t mono_runtime_syscall_fork (void);
+void mono_gdb_render_native_backtraces (pid_t crashed_pid);
-void mono_cross_helpers_run (void) MONO_INTERNAL;
+void mono_cross_helpers_run (void);
/*
* Signal handling
*/
-void MONO_SIG_HANDLER_SIGNATURE (mono_sigfpe_signal_handler) MONO_INTERNAL;
-void MONO_SIG_HANDLER_SIGNATURE (mono_sigill_signal_handler) MONO_INTERNAL;
-void MONO_SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler) MONO_INTERNAL;
-void MONO_SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler) MONO_INTERNAL;
-gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal) MONO_INTERNAL;
+void MONO_SIG_HANDLER_SIGNATURE (mono_sigfpe_signal_handler) ;
+void MONO_SIG_HANDLER_SIGNATURE (mono_sigill_signal_handler) ;
+void MONO_SIG_HANDLER_SIGNATURE (mono_sigsegv_signal_handler);
+void MONO_SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler) ;
+gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal);
#ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
#define ARCH_HAVE_DELEGATE_TRAMPOLINES 1
int vassign_size;
} MonoRegState;
-MonoRegState* mono_regstate_new (void) MONO_INTERNAL;
+MonoRegState* mono_regstate_new (void);
-void mono_regstate_free (MonoRegState *rs) MONO_INTERNAL;
+void mono_regstate_free (MonoRegState *rs);
#include "mini.h"
#include "seq-points.h"
-typedef struct {
- guint8 *data;
- int len;
- /* When has_debug_data is set to false only il and native deltas are saved */
- gboolean has_debug_data;
- /* When alloc_data is set to true data allocation/deallocation is managed by this structure */
- gboolean alloc_data;
-} SeqPointInfoInflated;
-
-static int
-encode_var_int (guint8 *buf, guint8 **out_buf, int val)
-{
- guint8 size = 0;
-
- do {
- guint8 byte = val & 0x7f;
- g_assert (size < 4 && "value has more than 28 bits");
- val >>= 7;
- if(val) byte |= 0x80;
- *(buf++) = byte;
- size++;
- } while (val);
-
- if (out_buf)
- *out_buf = buf;
-
- return size;
-}
-
-static int
-decode_var_int (guint8* buf, guint8 **out_buf)
-{
- guint8* p = buf;
-
- int low;
- int b;
- b = *(p++); low = (b & 0x7f) ; if(!(b & 0x80)) goto done;
- b = *(p++); low |= (b & 0x7f) << 7; if(!(b & 0x80)) goto done;
- b = *(p++); low |= (b & 0x7f) << 14; if(!(b & 0x80)) goto done;
- b = *(p++); low |= (b & 0x7f) << 21; if(!(b & 0x80)) goto done;
-
- g_assert (FALSE && "value has more than 28 bits");
-
-done:
-
- if (out_buf)
- *out_buf = p;
-
- return low;
-}
-
-static guint32
-encode_zig_zag (int val)
-{
- return (val << 1) ^ (val >> 31);
-}
-
-static int
-decode_zig_zag (guint32 val)
-{
- int n = val;
- return (n >> 1) ^ (-(n & 1));
-}
-
-static SeqPointInfoInflated
-seq_point_info_inflate (MonoSeqPointInfo *info)
-{
- SeqPointInfoInflated info_inflated;
- guint8 *ptr = (guint8*) info;
- int value;
-
- value = decode_var_int (ptr, &ptr);
-
- info_inflated.len = value >> 2;
- info_inflated.has_debug_data = (value & 1) != 0;
- info_inflated.alloc_data = (value & 2) != 0;
-
- if (info_inflated.alloc_data)
- info_inflated.data = ptr;
- else
- memcpy (&info_inflated.data, ptr, sizeof (guint8*));
-
- return info_inflated;
-}
-
-static MonoSeqPointInfo*
-seq_point_info_new (int len, gboolean alloc_data, guint8 *data, gboolean has_debug_data)
-{
- MonoSeqPointInfo *info;
- guint8 *info_ptr;
- guint8 buffer[4];
- int buffer_len;
- int value;
- int data_size;
-
- value = len << 2;
- if (has_debug_data)
- value |= 1;
- if (alloc_data)
- value |= 2;
-
- buffer_len = encode_var_int (buffer, NULL, value);
-
- data_size = buffer_len + (alloc_data? len : sizeof (guint8*));
- info_ptr = g_new0 (guint8, data_size);
- info = (MonoSeqPointInfo*) info_ptr;
-
- memcpy (info_ptr, buffer, buffer_len);
- info_ptr += buffer_len;
-
- if (alloc_data)
- memcpy (info_ptr, data, len);
- else
- memcpy (info_ptr, &data, sizeof (guint8*));
-
- mono_jit_stats.allocated_seq_points_size += data_size;
-
- return info;
-}
-
-void
-seq_point_info_free (gpointer ptr)
-{
- MonoSeqPointInfo* info = (MonoSeqPointInfo*) ptr;
- g_free (info);
-}
-
-static int
-seq_point_read (SeqPoint* seq_point, guint8* ptr, guint8* buffer_ptr, gboolean has_debug_data)
-{
- int value, i;
- guint8* ptr0 = ptr;
-
- value = decode_var_int (ptr, &ptr);
- seq_point->il_offset += decode_zig_zag (value);
-
- value = decode_var_int (ptr, &ptr);
- seq_point->native_offset += decode_zig_zag (value);
-
- if (has_debug_data) {
- value = decode_var_int (ptr, &ptr);
- seq_point->flags = value;
-
- if (seq_point->flags & MONO_SEQ_POINT_FLAG_EXIT_IL)
- seq_point->il_offset = METHOD_EXIT_IL_OFFSET;
-
- value = decode_var_int (ptr, &ptr);
- seq_point->next_len = value;
-
- if (seq_point->next_len) {
- // store next offset and skip it
- seq_point->next_offset = ptr - buffer_ptr;
- for (i = 0; i < seq_point->next_len; ++i)
- decode_var_int (ptr, &ptr);
- }
- }
-
- return ptr - ptr0;
-}
-
-static gboolean
-seq_point_info_add_seq_point (GByteArray* array, SeqPoint *sp, SeqPoint *last_seq_point, GSList *next, gboolean has_debug_data)
-{
- int il_delta, native_delta;
- GSList *l;
- guint8 buffer[4];
- guint8 len;
- int flags;
-
- if (!has_debug_data &&
- (sp->il_offset == METHOD_ENTRY_IL_OFFSET || sp->il_offset == METHOD_EXIT_IL_OFFSET))
- return FALSE;
-
- il_delta = sp->il_offset - last_seq_point->il_offset;
- native_delta = sp->native_offset - last_seq_point->native_offset;
-
- flags = sp->flags;
-
- if (has_debug_data && sp->il_offset == METHOD_EXIT_IL_OFFSET) {
- il_delta = 0;
- flags |= MONO_SEQ_POINT_FLAG_EXIT_IL;
- }
-
- len = encode_var_int (buffer, NULL, encode_zig_zag (il_delta));
- g_byte_array_append (array, buffer, len);
-
- len = encode_var_int (buffer, NULL, encode_zig_zag (native_delta));
- g_byte_array_append (array, buffer, len);
-
- if (has_debug_data) {
- sp->next_offset = array->len;
- sp->next_len = g_slist_length (next);
-
- len = encode_var_int (buffer, NULL, flags);
- g_byte_array_append (array, buffer, len);
-
- len = encode_var_int (buffer, NULL, sp->next_len);
- g_byte_array_append (array, buffer, len);
-
- for (l = next; l; l = l->next) {
- int next_index = GPOINTER_TO_UINT (l->data);
- guint8 buffer[4];
- int len = encode_var_int (buffer, NULL, next_index);
- g_byte_array_append (array, buffer, len);
- }
- }
-
- return TRUE;
-}
-
static void
collect_pred_seq_points (MonoBasicBlock *bb, MonoInst *ins, GSList **next, int depth)
{
GSList *bb_seq_points, *l;
MonoInst *last;
MonoDomain *domain = cfg->domain;
- int i;
+ int i, seq_info_size;
GSList **next = NULL;
SeqPoint* seq_points;
GByteArray* array;
if (has_debug_data)
g_free (next);
- cfg->seq_point_info = seq_point_info_new (array->len, TRUE, array->data, has_debug_data);
+ cfg->seq_point_info = seq_point_info_new (array->len, TRUE, array->data, has_debug_data, &seq_info_size);
+ mono_jit_stats.allocated_seq_points_size += seq_info_size;
g_byte_array_free (array, TRUE);
return seq_points;
}
-static gboolean
-seq_point_find_next_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point)
-{
- SeqPointIterator it;
- seq_point_iterator_init (&it, info);
- while (seq_point_iterator_next (&it)) {
- if (it.seq_point.native_offset >= native_offset) {
- memcpy (seq_point, &it.seq_point, sizeof (SeqPoint));
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-seq_point_find_prev_by_native_offset (MonoSeqPointInfo* info, int native_offset, SeqPoint* seq_point)
-{
- SeqPoint prev_seq_point;
- gboolean is_first = TRUE;
- SeqPointIterator it;
- seq_point_iterator_init (&it, info);
- while (seq_point_iterator_next (&it) && it.seq_point.native_offset <= native_offset) {
- memcpy (&prev_seq_point, &it.seq_point, sizeof (SeqPoint));
- is_first = FALSE;
- }
-
- if (!is_first && prev_seq_point.native_offset <= native_offset) {
- memcpy (seq_point, &prev_seq_point, sizeof (SeqPoint));
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gboolean
-seq_point_find_by_il_offset (MonoSeqPointInfo* info, int il_offset, SeqPoint* seq_point)
-{
- SeqPointIterator it;
- seq_point_iterator_init (&it, info);
- while (seq_point_iterator_next (&it)) {
- if (it.seq_point.il_offset == il_offset) {
- memcpy (seq_point, &it.seq_point, sizeof (SeqPoint));
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
/*
* find_next_seq_point_for_native_offset:
*
return seq_point_find_by_il_offset (seq_points, il_offset, seq_point);
}
-void
-seq_point_init_next (MonoSeqPointInfo* info, SeqPoint sp, SeqPoint* next)
-{
- int i;
- guint8* ptr;
- SeqPointIterator it;
- GArray* seq_points = g_array_new (FALSE, TRUE, sizeof (SeqPoint));
- SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
-
- g_assert (info_inflated.has_debug_data);
-
- seq_point_iterator_init (&it, info);
- while (seq_point_iterator_next (&it))
- g_array_append_vals (seq_points, &it.seq_point, 1);
-
- ptr = info_inflated.data + sp.next_offset;
- for (i = 0; i < sp.next_len; i++) {
- int next_index;
- next_index = decode_var_int (ptr, &ptr);
- g_assert (next_index < seq_points->len);
- memcpy (&next[i], seq_points->data + next_index * sizeof (SeqPoint), sizeof (SeqPoint));
- }
-
- g_array_free (seq_points, TRUE);
-}
-
-gboolean
-seq_point_iterator_next (SeqPointIterator* it)
-{
- if (it->ptr >= it->end)
- return FALSE;
-
- it->ptr += seq_point_read (&it->seq_point, it->ptr, it->begin, it->has_debug_data);
-
- return TRUE;
-}
-
-void
-seq_point_iterator_init (SeqPointIterator* it, MonoSeqPointInfo* info)
-{
- SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
- it->ptr = info_inflated.data;
- it->begin = info_inflated.data;
- it->end = it->begin + info_inflated.len;
- it->has_debug_data = info_inflated.has_debug_data;
- memset(&it->seq_point, 0, sizeof(SeqPoint));
-}
-
-int
-seq_point_info_write (MonoSeqPointInfo* info, guint8* buffer)
-{
- guint8* buffer0 = buffer;
- SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
-
- memcpy (buffer, &info_inflated.has_debug_data, 1);
- buffer++;
-
- //Write sequence points
- encode_var_int (buffer, &buffer, info_inflated.len);
- memcpy (buffer, info_inflated.data, info_inflated.len);
- buffer += info_inflated.len;
-
- return buffer - buffer0;
-}
-
-int
-seq_point_info_read (MonoSeqPointInfo** info, guint8* buffer, gboolean copy)
-{
- guint8* buffer0 = buffer;
- int size;
- gboolean has_debug_data;
-
- memcpy (&has_debug_data, buffer, 1);
- buffer++;
-
- size = decode_var_int (buffer, &buffer);
- (*info) = seq_point_info_new (size, copy, buffer, has_debug_data);
- buffer += size;
-
- return buffer - buffer0;
-}
-
-/*
- * Returns the maximum size of mono_seq_point_info_write.
- */
-int
-seq_point_info_get_write_size (MonoSeqPointInfo* info)
-{
- SeqPointInfoInflated info_inflated = seq_point_info_inflate (info);
-
- //4 is the maximum size required to store the size of the data.
- //1 is the byte used to store has_debug_data.
- int size = 4 + 1 + info_inflated.len;
-
- return size;
-}
-
void
bb_deduplicate_op_il_seq_points (MonoCompile *cfg, MonoBasicBlock *bb)
{
MONO_REMOVE_INS (bb, prev);
};
}
+
+void
+mono_image_get_aot_seq_point_path (MonoImage *image, char **str)
+{
+ int size = strlen (image->name) + strlen (SEQ_POINT_AOT_EXT) + 1;
+ *str = g_malloc (size);
+ g_sprintf (*str, "%s%s", image->name, SEQ_POINT_AOT_EXT);
+}
#ifndef __MONO_SEQ_POINTS_H__
#define __MONO_SEQ_POINTS_H__
-#define MONO_SEQ_POINT_FLAG_NONEMPTY_STACK 1
-#define MONO_SEQ_POINT_FLAG_EXIT_IL 2
-
-/* IL offsets used to mark the sequence points belonging to method entry/exit events */
-#define METHOD_ENTRY_IL_OFFSET -1
-#define METHOD_EXIT_IL_OFFSET 0xffffff
-
-/* Native offset used to mark seq points in dead code */
-#define SEQ_POINT_NATIVE_OFFSET_DEAD_CODE -1
-
-typedef struct {
- int il_offset, native_offset, flags;
- /* Offset of indexes of successor sequence points on the compressed buffer */
- int next_offset;
- /* Number of entries in next */
- int next_len;
-} SeqPoint;
-
-typedef struct MonoSeqPointInfo {
- int dummy[0];
-} MonoSeqPointInfo;
-
-typedef struct {
- SeqPoint seq_point;
- guint8* ptr;
- guint8* begin;
- guint8* end;
- gboolean has_debug_data;
-} SeqPointIterator;
-
-void
-seq_point_info_free (gpointer info);
+#include <mono/metadata/seq-points-data.h>
void
mono_save_seq_point_info (MonoCompile *cfg);
gboolean
find_seq_point (MonoDomain *domain, MonoMethod *method, gint32 il_offset, MonoSeqPointInfo **info, SeqPoint *seq_point);
-gboolean
-seq_point_iterator_next (SeqPointIterator* it);
-
-void
-seq_point_iterator_init (SeqPointIterator* it, MonoSeqPointInfo* info);
-
void
-seq_point_init_next (MonoSeqPointInfo* info, SeqPoint sp, SeqPoint* next);
-
-int
-seq_point_info_write (MonoSeqPointInfo* info, guint8* buffer);
-
-int
-seq_point_info_read (MonoSeqPointInfo** info, guint8* buffer, gboolean copy);
-
-int
-seq_point_info_get_write_size (MonoSeqPointInfo* info);
+bb_deduplicate_op_il_seq_points (MonoCompile *cfg, MonoBasicBlock *bb);
void
-bb_deduplicate_op_il_seq_points (MonoCompile *cfg, MonoBasicBlock *bb);
+mono_image_get_aot_seq_point_path (MonoImage *image, char **str);
#endif /* __MONO_SEQ_POINTS_H__ */
\ No newline at end of file
typedef void (*MonoContinuationRestore) (MonoContinuation *cont, int state, MonoLMF **lmf_addr);
-void mono_tasklets_init (void) MONO_INTERNAL;
-void mono_tasklets_cleanup (void) MONO_INTERNAL;
+void mono_tasklets_init (void);
+void mono_tasklets_cleanup (void);
-MonoContinuationRestore mono_tasklets_arch_restore (void) MONO_INTERNAL;
+MonoContinuationRestore mono_tasklets_arch_restore (void);
#endif /* __MONO_TASKLETS_H__ */
G_BEGIN_DECLS
void
-mono_trace_enter_method (MonoMethod *method, char *ebp) MONO_INTERNAL;
+mono_trace_enter_method (MonoMethod *method, char *ebp);
void
-mono_trace_leave_method (MonoMethod *method, ...) MONO_INTERNAL;
+mono_trace_leave_method (MonoMethod *method, ...);
-void mono_trace_enable (gboolean enable) MONO_INTERNAL;
-gboolean mono_trace_is_enabled (void) MONO_INTERNAL;
-gboolean mono_trace_eval_exception (MonoClass *klass) MONO_INTERNAL;
+void mono_trace_enable (gboolean enable);
+gboolean mono_trace_is_enabled (void);
+gboolean mono_trace_eval_exception (MonoClass *klass);
G_END_DECLS
{
guint8 *tramp;
guint8 *code, *buf;
- guint8 *jump_obj_null, *jump_have_waiters, *jump_sync_null, *jump_not_owned, *jump_cmpxchg_failed, *jump_sync_thin_hash = NULL;
+ guint8 *jump_obj_null, *jump_have_waiters, *jump_sync_null, *jump_not_owned, *jump_cmpxchg_failed;
guint8 *jump_next;
int tramp_size;
int status_offset, nest_offset;
/*if bit zero is set it's a thin hash*/
/*FIXME use testb encoding*/
amd64_test_reg_imm (code, sync_reg, 0x01);
- jump_sync_thin_hash = code;
amd64_branch8 (code, X86_CC_NE, -1, 1);
/*clear bits used by the gc*/
i = cached_info_next;
if (cached_info_next >= cached_info_size) {
- MonoUnwindInfo **old_table, **new_table;
+ MonoUnwindInfo **new_table;
/*
* Avoid freeing the old table so mono_get_cached_unwind_info ()
* doesn't need locks/hazard pointers.
*/
- old_table = cached_info;
new_table = g_new0 (MonoUnwindInfo*, cached_info_size * 2);
memcpy (new_table, cached_info, cached_info_size * sizeof (MonoUnwindInfo*));
mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJitExceptionInfo **ex_info, guint32 *ex_info_len, gpointer **type_info, int *this_reg, int *this_offset)
{
guint8 *p, *cie, *fde_current, *fde_aug = NULL, *code, *fde_cfi, *cie_cfi;
- gint32 fde_len, cie_offset, pc_begin, pc_range, aug_len, fde_data_len;
+ gint32 fde_len, cie_offset, pc_begin, pc_range, aug_len;
gint32 cie_len, cie_id, cie_version, code_align, data_align, return_reg;
gint32 i, cie_aug_len, buf_len;
char *cie_aug_str;
aug_len = 0;
}
fde_cfi = p;
- fde_data_len = fde + 4 + fde_len - p;
if (code_len)
*code_len = pc_range;
emit_time (LogBuffer *logbuffer, uint64_t value)
{
uint64_t tdiff = value - logbuffer->last_time;
- unsigned char *p;
if (value < logbuffer->last_time)
printf ("time went backwards\n");
//if (tdiff > 1000000)
// printf ("large time offset: %llu\n", tdiff);
- p = logbuffer->data;
encode_uleb128 (tdiff, logbuffer->data, &logbuffer->data);
/*if (tdiff != decode_uleb128 (p, &p))
printf ("incorrect encoding: %llu\n", tdiff);*/
int fd = strtol (nf + 1, NULL, 10);
prof->file = fdopen (fd, "a");
} else {
- FILE *f;
if (force_delete)
unlink (nf);
prof->file = fopen (nf, "wb");
block_guard_restore_aligment_on_exit.cs \
thread_static_gc_layout.cs \
sleep.cs \
+ bug-27147.cs \
bug-17537.cs
TEST_CS_SRC_DIST= \
--- /dev/null
+using System;
+using System.Threading;
+
+class Referee
+{
+ public Referee ()
+ {
+ }
+}
+
+class LotsaRefs
+{
+ public Referee referee;
+ public object ref1;
+ public object ref2;
+ public object ref3;
+ public object ref4;
+ public object ref5;
+ public object ref6;
+ public object ref7;
+ public object ref8;
+ public object ref9;
+ public object ref10;
+ public object ref11;
+ public object ref12;
+ public object ref13;
+ public object ref14;
+ public object ref15;
+ public object ref16;
+ public object ref17;
+ public object ref18;
+ public object ref19;
+ public object ref20;
+ public object ref21;
+ public object ref22;
+ public object ref23;
+ public object ref24;
+ public object ref25;
+ public object ref26;
+ public object ref27;
+ public object ref28;
+ public object ref29;
+ public object ref30;
+ public object ref31;
+ public object ref32;
+ public object ref33;
+ public object ref34;
+ public object ref35;
+ public object ref36;
+ public object ref37;
+ public object ref38;
+ public object ref39;
+ public object ref40;
+ public object ref41;
+ public object ref42;
+ public object ref43;
+ public object ref44;
+ public object ref45;
+ public object ref46;
+ public object ref47;
+ public object ref48;
+ public object ref49;
+ public object ref50;
+ public object ref51;
+ public object ref52;
+ public object ref53;
+ public object ref54;
+ public object ref55;
+ public object ref56;
+ public object ref57;
+ public object ref58;
+ public object ref59;
+ public object ref60;
+ public object ref61;
+ public object ref62;
+ public object ref63;
+ public object ref64;
+ public object ref65;
+ public object ref66;
+ public object ref67;
+ public object ref68;
+ public object ref69;
+ public object ref70;
+ public object ref71;
+ public object ref72;
+ public object ref73;
+ public object ref74;
+ public object ref75;
+ public object ref76;
+ public object ref77;
+ public object ref78;
+ public object ref79;
+ public object ref80;
+ public object ref81;
+ public object ref82;
+ public object ref83;
+ public object ref84;
+ public object ref85;
+ public object ref86;
+ public object ref87;
+ public object ref88;
+ public object ref89;
+ public object ref90;
+ public object ref91;
+ public object ref92;
+ public object ref93;
+ public object ref94;
+ public object ref95;
+ public object ref96;
+ public object ref97;
+ public object ref98;
+ public object ref99;
+ public object ref100;
+ public object ref101;
+ public object ref102;
+ public object ref103;
+ public object ref104;
+ public object ref105;
+ public object ref106;
+ public object ref107;
+ public object ref108;
+ public object ref109;
+ public object ref110;
+ public object ref111;
+ public object ref112;
+ public object ref113;
+ public object ref114;
+ public object ref115;
+ public object ref116;
+ public object ref117;
+ public object ref118;
+ public object ref119;
+ public object ref120;
+ public object ref121;
+ public object ref122;
+ public object ref123;
+ public object ref124;
+ public object ref125;
+ public object ref126;
+ public object ref127;
+ public object ref128;
+ public object ref129;
+ public object ref130;
+ public object ref131;
+ public object ref132;
+ public object ref133;
+ public object ref134;
+ public object ref135;
+ public object ref136;
+ public object ref137;
+ public object ref138;
+ public object ref139;
+ public object ref140;
+ public object ref141;
+ public object ref142;
+ public object ref143;
+ public object ref144;
+ public object ref145;
+ public object ref146;
+ public object ref147;
+ public object ref148;
+ public object ref149;
+ public object ref150;
+ public object ref151;
+ public object ref152;
+ public object ref153;
+ public object ref154;
+ public object ref155;
+ public object ref156;
+ public object ref157;
+ public object ref158;
+ public object ref159;
+ public object ref160;
+ public object ref161;
+ public object ref162;
+ public object ref163;
+ public object ref164;
+ public object ref165;
+ public object ref166;
+ public object ref167;
+ public object ref168;
+ public object ref169;
+ public object ref170;
+ public object ref171;
+ public object ref172;
+ public object ref173;
+ public object ref174;
+ public object ref175;
+ public object ref176;
+ public object ref177;
+ public object ref178;
+ public object ref179;
+ public object ref180;
+ public object ref181;
+ public object ref182;
+ public object ref183;
+ public object ref184;
+ public object ref185;
+ public object ref186;
+ public object ref187;
+ public object ref188;
+ public object ref189;
+ public object ref190;
+ public object ref191;
+ public object ref192;
+ public object ref193;
+ public object ref194;
+ public object ref195;
+ public object ref196;
+ public object ref197;
+ public object ref198;
+ public object ref199;
+ public object ref200;
+ public object ref201;
+ public object ref202;
+ public object ref203;
+ public object ref204;
+ public object ref205;
+ public object ref206;
+ public object ref207;
+ public object ref208;
+ public object ref209;
+ public object ref210;
+ public object ref211;
+ public object ref212;
+ public object ref213;
+ public object ref214;
+ public object ref215;
+ public object ref216;
+ public object ref217;
+ public object ref218;
+ public object ref219;
+ public object ref220;
+ public object ref221;
+ public object ref222;
+ public object ref223;
+ public object ref224;
+ public object ref225;
+ public object ref226;
+ public object ref227;
+ public object ref228;
+ public object ref229;
+ public object ref230;
+ public object ref231;
+ public object ref232;
+ public object ref233;
+ public object ref234;
+ public object ref235;
+ public object ref236;
+ public object ref237;
+ public object ref238;
+ public object ref239;
+ public object ref240;
+ public object ref241;
+ public object ref242;
+ public object ref243;
+ public object ref244;
+ public object ref245;
+ public object ref246;
+ public object ref247;
+ public object ref248;
+ public object ref249;
+ public object ref250;
+ public object ref251;
+ public object ref252;
+ public object ref253;
+ public object ref254;
+ public object ref255;
+ public object ref256;
+ public object ref257;
+ public object ref258;
+ public object ref259;
+ public object ref260;
+ public object ref261;
+ public object ref262;
+ public object ref263;
+ public object ref264;
+ public object ref265;
+ public object ref266;
+ public object ref267;
+ public object ref268;
+ public object ref269;
+ public object ref270;
+ public object ref271;
+ public object ref272;
+ public object ref273;
+ public object ref274;
+ public object ref275;
+ public object ref276;
+ public object ref277;
+ public object ref278;
+ public object ref279;
+ public object ref280;
+ public object ref281;
+ public object ref282;
+ public object ref283;
+ public object ref284;
+ public object ref285;
+ public object ref286;
+ public object ref287;
+ public object ref288;
+ public object ref289;
+ public object ref290;
+ public object ref291;
+ public object ref292;
+ public object ref293;
+ public object ref294;
+ public object ref295;
+ public object ref296;
+ public object ref297;
+ public object ref298;
+ public object ref299;
+ public object ref300;
+ public object ref301;
+ public object ref302;
+ public object ref303;
+ public object ref304;
+ public object ref305;
+ public object ref306;
+ public object ref307;
+ public object ref308;
+ public object ref309;
+ public object ref310;
+ public object ref311;
+ public object ref312;
+ public object ref313;
+ public object ref314;
+ public object ref315;
+ public object ref316;
+ public object ref317;
+ public object ref318;
+ public object ref319;
+ public object ref320;
+ public object ref321;
+ public object ref322;
+ public object ref323;
+ public object ref324;
+ public object ref325;
+ public object ref326;
+ public object ref327;
+ public object ref328;
+ public object ref329;
+ public object ref330;
+ public object ref331;
+ public object ref332;
+ public object ref333;
+ public object ref334;
+ public object ref335;
+ public object ref336;
+ public object ref337;
+ public object ref338;
+ public object ref339;
+ public object ref340;
+ public object ref341;
+ public object ref342;
+ public object ref343;
+ public object ref344;
+ public object ref345;
+ public object ref346;
+ public object ref347;
+ public object ref348;
+ public object ref349;
+ public object ref350;
+ public object ref351;
+ public object ref352;
+ public object ref353;
+ public object ref354;
+ public object ref355;
+ public object ref356;
+ public object ref357;
+ public object ref358;
+ public object ref359;
+ public object ref360;
+ public object ref361;
+ public object ref362;
+ public object ref363;
+ public object ref364;
+ public object ref365;
+ public object ref366;
+ public object ref367;
+ public object ref368;
+ public object ref369;
+ public object ref370;
+ public object ref371;
+ public object ref372;
+ public object ref373;
+ public object ref374;
+ public object ref375;
+ public object ref376;
+ public object ref377;
+ public object ref378;
+ public object ref379;
+ public object ref380;
+ public object ref381;
+ public object ref382;
+ public object ref383;
+ public object ref384;
+ public object ref385;
+ public object ref386;
+ public object ref387;
+ public object ref388;
+ public object ref389;
+ public object ref390;
+ public object ref391;
+ public object ref392;
+ public object ref393;
+ public object ref394;
+ public object ref395;
+ public object ref396;
+ public object ref397;
+ public object ref398;
+ public object ref399;
+ public object ref400;
+ public object ref401;
+ public object ref402;
+ public object ref403;
+ public object ref404;
+ public object ref405;
+ public object ref406;
+ public object ref407;
+ public object ref408;
+ public object ref409;
+ public object ref410;
+ public object ref411;
+ public object ref412;
+ public object ref413;
+ public object ref414;
+ public object ref415;
+ public object ref416;
+ public object ref417;
+ public object ref418;
+ public object ref419;
+ public object ref420;
+ public object ref421;
+ public object ref422;
+ public object ref423;
+ public object ref424;
+ public object ref425;
+ public object ref426;
+ public object ref427;
+ public object ref428;
+ public object ref429;
+ public object ref430;
+ public object ref431;
+ public object ref432;
+ public object ref433;
+ public object ref434;
+ public object ref435;
+ public object ref436;
+ public object ref437;
+ public object ref438;
+ public object ref439;
+ public object ref440;
+ public object ref441;
+ public object ref442;
+ public object ref443;
+ public object ref444;
+ public object ref445;
+ public object ref446;
+ public object ref447;
+ public object ref448;
+ public object ref449;
+ public object ref450;
+ public object ref451;
+ public object ref452;
+ public object ref453;
+ public object ref454;
+ public object ref455;
+ public object ref456;
+ public object ref457;
+ public object ref458;
+ public object ref459;
+ public object ref460;
+ public object ref461;
+ public object ref462;
+ public object ref463;
+ public object ref464;
+ public object ref465;
+ public object ref466;
+ public object ref467;
+ public object ref468;
+ public object ref469;
+ public object ref470;
+ public object ref471;
+ public object ref472;
+ public object ref473;
+ public object ref474;
+ public object ref475;
+ public object ref476;
+ public object ref477;
+ public object ref478;
+ public object ref479;
+ public object ref480;
+ public object ref481;
+ public object ref482;
+ public object ref483;
+ public object ref484;
+ public object ref485;
+ public object ref486;
+ public object ref487;
+ public object ref488;
+ public object ref489;
+ public object ref490;
+ public object ref491;
+ public object ref492;
+ public object ref493;
+ public object ref494;
+ public object ref495;
+ public object ref496;
+ public object ref497;
+ public object ref498;
+ public object ref499;
+ public object ref500;
+ public object ref501;
+ public object ref502;
+ public object ref503;
+ public object ref504;
+ public object ref505;
+ public object ref506;
+ public object ref507;
+ public object ref508;
+ public object ref509;
+ public object ref510;
+ public object ref511;
+ public object ref512;
+ public object ref513;
+ public object ref514;
+ public object ref515;
+ public object ref516;
+ public object ref517;
+ public object ref518;
+ public object ref519;
+ public object ref520;
+ public object ref521;
+ public object ref522;
+ public object ref523;
+ public object ref524;
+ public object ref525;
+ public object ref526;
+ public object ref527;
+ public object ref528;
+ public object ref529;
+ public object ref530;
+ public object ref531;
+ public object ref532;
+ public object ref533;
+ public object ref534;
+ public object ref535;
+ public object ref536;
+ public object ref537;
+ public object ref538;
+ public object ref539;
+ public object ref540;
+ public object ref541;
+ public object ref542;
+ public object ref543;
+ public object ref544;
+ public object ref545;
+ public object ref546;
+ public object ref547;
+ public object ref548;
+ public object ref549;
+ public object ref550;
+ public object ref551;
+ public object ref552;
+ public object ref553;
+ public object ref554;
+ public object ref555;
+ public object ref556;
+ public object ref557;
+ public object ref558;
+ public object ref559;
+ public object ref560;
+ public object ref561;
+ public object ref562;
+ public object ref563;
+ public object ref564;
+ public object ref565;
+ public object ref566;
+ public object ref567;
+ public object ref568;
+ public object ref569;
+ public object ref570;
+ public object ref571;
+ public object ref572;
+ public object ref573;
+ public object ref574;
+ public object ref575;
+ public object ref576;
+ public object ref577;
+ public object ref578;
+ public object ref579;
+ public object ref580;
+ public object ref581;
+ public object ref582;
+ public object ref583;
+ public object ref584;
+ public object ref585;
+ public object ref586;
+ public object ref587;
+ public object ref588;
+ public object ref589;
+ public object ref590;
+ public object ref591;
+ public object ref592;
+ public object ref593;
+ public object ref594;
+ public object ref595;
+ public object ref596;
+ public object ref597;
+ public object ref598;
+ public object ref599;
+ public object ref600;
+ public object ref601;
+ public object ref602;
+ public object ref603;
+ public object ref604;
+ public object ref605;
+ public object ref606;
+ public object ref607;
+ public object ref608;
+ public object ref609;
+ public object ref610;
+ public object ref611;
+ public object ref612;
+ public object ref613;
+ public object ref614;
+ public object ref615;
+ public object ref616;
+ public object ref617;
+ public object ref618;
+ public object ref619;
+ public object ref620;
+ public object ref621;
+ public object ref622;
+ public object ref623;
+ public object ref624;
+ public object ref625;
+ public object ref626;
+ public object ref627;
+ public object ref628;
+ public object ref629;
+ public object ref630;
+ public object ref631;
+ public object ref632;
+ public object ref633;
+ public object ref634;
+ public object ref635;
+ public object ref636;
+ public object ref637;
+ public object ref638;
+ public object ref639;
+ public object ref640;
+ public object ref641;
+ public object ref642;
+ public object ref643;
+ public object ref644;
+ public object ref645;
+ public object ref646;
+ public object ref647;
+ public object ref648;
+ public object ref649;
+ public object ref650;
+ public object ref651;
+ public object ref652;
+ public object ref653;
+ public object ref654;
+ public object ref655;
+ public object ref656;
+ public object ref657;
+ public object ref658;
+ public object ref659;
+ public object ref660;
+ public object ref661;
+ public object ref662;
+ public object ref663;
+ public object ref664;
+ public object ref665;
+ public object ref666;
+ public object ref667;
+ public object ref668;
+ public object ref669;
+ public object ref670;
+ public object ref671;
+ public object ref672;
+ public object ref673;
+ public object ref674;
+ public object ref675;
+ public object ref676;
+ public object ref677;
+ public object ref678;
+ public object ref679;
+ public object ref680;
+ public object ref681;
+ public object ref682;
+ public object ref683;
+ public object ref684;
+ public object ref685;
+ public object ref686;
+ public object ref687;
+ public object ref688;
+ public object ref689;
+ public object ref690;
+ public object ref691;
+ public object ref692;
+ public object ref693;
+ public object ref694;
+ public object ref695;
+ public object ref696;
+ public object ref697;
+ public object ref698;
+ public object ref699;
+ public object ref700;
+ public object ref701;
+ public object ref702;
+ public object ref703;
+ public object ref704;
+ public object ref705;
+ public object ref706;
+ public object ref707;
+ public object ref708;
+ public object ref709;
+ public object ref710;
+ public object ref711;
+ public object ref712;
+ public object ref713;
+ public object ref714;
+ public object ref715;
+ public object ref716;
+ public object ref717;
+ public object ref718;
+ public object ref719;
+ public object ref720;
+ public object ref721;
+ public object ref722;
+ public object ref723;
+ public object ref724;
+ public object ref725;
+ public object ref726;
+ public object ref727;
+ public object ref728;
+ public object ref729;
+ public object ref730;
+ public object ref731;
+ public object ref732;
+ public object ref733;
+ public object ref734;
+ public object ref735;
+ public object ref736;
+ public object ref737;
+ public object ref738;
+ public object ref739;
+ public object ref740;
+ public object ref741;
+ public object ref742;
+ public object ref743;
+ public object ref744;
+ public object ref745;
+ public object ref746;
+ public object ref747;
+ public object ref748;
+ public object ref749;
+ public object ref750;
+ public object ref751;
+ public object ref752;
+ public object ref753;
+ public object ref754;
+ public object ref755;
+ public object ref756;
+ public object ref757;
+ public object ref758;
+ public object ref759;
+ public object ref760;
+ public object ref761;
+ public object ref762;
+ public object ref763;
+ public object ref764;
+ public object ref765;
+ public object ref766;
+ public object ref767;
+ public object ref768;
+ public object ref769;
+ public object ref770;
+ public object ref771;
+ public object ref772;
+ public object ref773;
+ public object ref774;
+ public object ref775;
+ public object ref776;
+ public object ref777;
+ public object ref778;
+ public object ref779;
+ public object ref780;
+ public object ref781;
+ public object ref782;
+ public object ref783;
+ public object ref784;
+ public object ref785;
+ public object ref786;
+ public object ref787;
+ public object ref788;
+ public object ref789;
+ public object ref790;
+ public object ref791;
+ public object ref792;
+ public object ref793;
+ public object ref794;
+ public object ref795;
+ public object ref796;
+ public object ref797;
+ public object ref798;
+ public object ref799;
+ public object ref800;
+ public object ref801;
+ public object ref802;
+ public object ref803;
+ public object ref804;
+ public object ref805;
+ public object ref806;
+ public object ref807;
+ public object ref808;
+ public object ref809;
+ public object ref810;
+ public object ref811;
+ public object ref812;
+ public object ref813;
+ public object ref814;
+ public object ref815;
+ public object ref816;
+ public object ref817;
+ public object ref818;
+ public object ref819;
+ public object ref820;
+ public object ref821;
+ public object ref822;
+ public object ref823;
+ public object ref824;
+ public object ref825;
+ public object ref826;
+ public object ref827;
+ public object ref828;
+ public object ref829;
+ public object ref830;
+ public object ref831;
+ public object ref832;
+ public object ref833;
+ public object ref834;
+ public object ref835;
+ public object ref836;
+ public object ref837;
+ public object ref838;
+ public object ref839;
+ public object ref840;
+ public object ref841;
+ public object ref842;
+ public object ref843;
+ public object ref844;
+ public object ref845;
+ public object ref846;
+ public object ref847;
+ public object ref848;
+ public object ref849;
+ public object ref850;
+ public object ref851;
+ public object ref852;
+ public object ref853;
+ public object ref854;
+ public object ref855;
+ public object ref856;
+ public object ref857;
+ public object ref858;
+ public object ref859;
+ public object ref860;
+ public object ref861;
+ public object ref862;
+ public object ref863;
+ public object ref864;
+ public object ref865;
+ public object ref866;
+ public object ref867;
+ public object ref868;
+ public object ref869;
+ public object ref870;
+ public object ref871;
+ public object ref872;
+ public object ref873;
+ public object ref874;
+ public object ref875;
+ public object ref876;
+ public object ref877;
+ public object ref878;
+ public object ref879;
+ public object ref880;
+ public object ref881;
+ public object ref882;
+ public object ref883;
+ public object ref884;
+ public object ref885;
+ public object ref886;
+ public object ref887;
+ public object ref888;
+ public object ref889;
+ public object ref890;
+ public object ref891;
+ public object ref892;
+ public object ref893;
+ public object ref894;
+ public object ref895;
+ public object ref896;
+ public object ref897;
+ public object ref898;
+ public object ref899;
+ public object ref900;
+ public object ref901;
+ public object ref902;
+ public object ref903;
+ public object ref904;
+ public object ref905;
+ public object ref906;
+ public object ref907;
+ public object ref908;
+ public object ref909;
+ public object ref910;
+ public object ref911;
+ public object ref912;
+ public object ref913;
+ public object ref914;
+ public object ref915;
+ public object ref916;
+ public object ref917;
+ public object ref918;
+ public object ref919;
+ public object ref920;
+ public object ref921;
+ public object ref922;
+ public object ref923;
+ public object ref924;
+ public object ref925;
+ public object ref926;
+ public object ref927;
+ public object ref928;
+ public object ref929;
+ public object ref930;
+ public object ref931;
+ public object ref932;
+ public object ref933;
+ public object ref934;
+ public object ref935;
+ public object ref936;
+ public object ref937;
+ public object ref938;
+ public object ref939;
+ public object ref940;
+ public object ref941;
+ public object ref942;
+ public object ref943;
+ public object ref944;
+ public object ref945;
+ public object ref946;
+ public object ref947;
+ public object ref948;
+ public object ref949;
+ public object ref950;
+ public object ref951;
+ public object ref952;
+ public object ref953;
+ public object ref954;
+ public object ref955;
+ public object ref956;
+ public object ref957;
+ public object ref958;
+ public object ref959;
+ public object ref960;
+ public object ref961;
+ public object ref962;
+ public object ref963;
+ public object ref964;
+ public object ref965;
+ public object ref966;
+ public object ref967;
+ public object ref968;
+ public object ref969;
+ public object ref970;
+ public object ref971;
+ public object ref972;
+ public object ref973;
+ public object ref974;
+ public object ref975;
+ public object ref976;
+ public object ref977;
+ public object ref978;
+ public object ref979;
+ public object ref980;
+ public object ref981;
+ public object ref982;
+ public object ref983;
+ public object ref984;
+ public object ref985;
+ public object ref986;
+ public object ref987;
+ public object ref988;
+ public object ref989;
+ public object ref990;
+ public object ref991;
+ public object ref992;
+ public object ref993;
+ public object ref994;
+ public object ref995;
+ public object ref996;
+ public object ref997;
+ public object ref998;
+}
+
+public class Test
+{
+ static LotsaRefs refs;
+
+ public static int Main()
+ {
+ var t = new Thread (() =>
+ {
+ refs = new LotsaRefs();
+ refs.referee = new Referee();
+ });
+ t.Start ();
+ t.Join ();
+ for (var i = 0; i < 100000000; ++i)
+ {
+ var o = new object();
+ }
+ if (refs.referee.GetType() != typeof(Referee))
+ {
+ Console.WriteLine ("wrong type: {0}", refs.referee.GetType());
+ return 1;
+ }
+ Console.WriteLine ("all good");
+ return 0;
+ }
+}
return 0;
}
-
LIBTEST_API int STDCALL
mono_test_empty_pinvoke (int i)
{
return 0;
}
+LIBTEST_API int STDCALL
+mono_test_marshal_out_byref_array_out_size_param (int **out_arr, int *out_len)
+{
+ int *arr;
+ int i, len;
+
+ len = 4;
+ arr = marshal_alloc (sizeof (gint32) * len);
+ for (i = 0; i < len; ++i)
+ arr [i] = i;
+ *out_arr = arr;
+ *out_len = len;
+
+ return 0;
+}
+
LIBTEST_API int STDCALL
mono_test_marshal_inout_nonblittable_array (gunichar2 *a1)
{
LIBTEST_API int STDCALL
mono_test_marshal_delegate6 (SimpleDelegate5 delegate)
{
- int res;
-
- res = delegate (NULL);
-
+ delegate (NULL);
return 0;
}
[DllImport ("libtest", EntryPoint="mono_test_marshal_out_array")]
public static extern int mono_test_marshal_out_array ([Out] [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int [] a1, int n);
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_out_byref_array_out_size_param")]
+ public static extern int mono_test_marshal_out_byref_array_out_size_param ([Out] [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] out int [] a1, out int n);
+
[DllImport ("libtest", EntryPoint="mono_test_marshal_inout_nonblittable_array", CharSet = CharSet.Unicode)]
public static extern int mono_test_marshal_inout_nonblittable_array ([In, Out] char [] a1);
return 0;
}
+ public static int test_0_marshal_out_byref_array_out_size_param () {
+ int [] a1 = null;
+ int len;
+
+ int res = mono_test_marshal_out_byref_array_out_size_param (out a1, out len);
+ if (len != 4)
+ return 1;
+ for (int i = 0; i < len; i++)
+ if (a1 [i] != i)
+ return 2;
+ return 0;
+ }
+
public static int test_0_marshal_inout_nonblittable_array () {
char [] a1 = new char [10];
for (int i = 0; i < 10; i++)
return res;
}
-static void
+static void G_GNUC_UNUSED
benchmark_conc (void)
{
mono_mutex_t mutex;
}
-static void
+static void G_GNUC_UNUSED
benchmark_glib (void)
{
GHashTable *h;
res += parallel_writer_parallel_reader ();
return res;
-}
\ No newline at end of file
+}
mono-linked-list-set.c \
mono-linked-list-set.h \
mono-threads.c \
+ mono-threads-state-machine.c \
mono-threads-posix.c \
mono-threads-mach.c \
mono-threads-mach-helper.c \
typedef void (*MonoHazardousFreeFunc) (gpointer p);
void mono_thread_hazardous_free_or_queue (gpointer p, MonoHazardousFreeFunc free_func,
- gboolean free_func_might_lock, gboolean lock_free_context) MONO_INTERNAL;
-void mono_thread_hazardous_try_free_all (void) MONO_INTERNAL;
-void mono_thread_hazardous_try_free_some (void) MONO_INTERNAL;
-MonoThreadHazardPointers* mono_hazard_pointer_get (void) MONO_INTERNAL;
-gpointer get_hazardous_pointer (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index) MONO_INTERNAL;
+ gboolean free_func_might_lock, gboolean lock_free_context);
+void mono_thread_hazardous_try_free_all (void);
+void mono_thread_hazardous_try_free_some (void);
+MonoThreadHazardPointers* mono_hazard_pointer_get (void);
+gpointer get_hazardous_pointer (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index);
#define mono_hazard_pointer_set(hp,i,v) \
do { g_assert ((i) >= 0 && (i) < HAZARD_POINTER_COUNT); \
} while (0)
-void mono_thread_small_id_free (int id) MONO_INTERNAL;
-int mono_thread_small_id_alloc (void) MONO_INTERNAL;
+void mono_thread_small_id_free (int id);
+int mono_thread_small_id_alloc (void);
-int mono_hazard_pointer_save_for_signal_handler (void) MONO_INTERNAL;
-void mono_hazard_pointer_restore_for_signal_handler (int small_id) MONO_INTERNAL;
+int mono_hazard_pointer_save_for_signal_handler (void);
+void mono_hazard_pointer_restore_for_signal_handler (int small_id);
-void mono_thread_smr_init (void) MONO_INTERNAL;
-void mono_thread_smr_cleanup (void) MONO_INTERNAL;
+void mono_thread_smr_init (void);
+void mono_thread_smr_cleanup (void);
#endif /*__MONO_HAZARD_POINTER_H__*/
#define LOCK_FREE_ALLOC_SB_HEADER_SIZE (sizeof (MonoLockFreeAllocator))
#define LOCK_FREE_ALLOC_SB_USABLE_SIZE(block_size) ((block_size) - LOCK_FREE_ALLOC_SB_HEADER_SIZE)
-void mono_lock_free_allocator_init_size_class (MonoLockFreeAllocSizeClass *sc, unsigned int slot_size, unsigned int block_size) MONO_INTERNAL;
-void mono_lock_free_allocator_init_allocator (MonoLockFreeAllocator *heap, MonoLockFreeAllocSizeClass *sc) MONO_INTERNAL;
+void mono_lock_free_allocator_init_size_class (MonoLockFreeAllocSizeClass *sc, unsigned int slot_size, unsigned int block_size);
+void mono_lock_free_allocator_init_allocator (MonoLockFreeAllocator *heap, MonoLockFreeAllocSizeClass *sc);
-gpointer mono_lock_free_alloc (MonoLockFreeAllocator *heap) MONO_INTERNAL;
-void mono_lock_free_free (gpointer ptr, size_t block_size) MONO_INTERNAL;
+gpointer mono_lock_free_alloc (MonoLockFreeAllocator *heap);
+void mono_lock_free_free (gpointer ptr, size_t block_size);
-gboolean mono_lock_free_allocator_check_consistency (MonoLockFreeAllocator *heap) MONO_INTERNAL;
+gboolean mono_lock_free_allocator_check_consistency (MonoLockFreeAllocator *heap);
#endif
#define MONO_LOCK_FREE_ARRAY_INIT(entry_size) { (entry_size), NULL }
#define MONO_LOCK_FREE_ARRAY_QUEUE_INIT(entry_size) { MONO_LOCK_FREE_ARRAY_INIT ((entry_size) + sizeof (gpointer)), 0 }
-gpointer mono_lock_free_array_nth (MonoLockFreeArray *arr, int index) MONO_INTERNAL;
+gpointer mono_lock_free_array_nth (MonoLockFreeArray *arr, int index);
typedef gpointer (*MonoLockFreeArrayIterateFunc) (int index, gpointer entry_ptr, gpointer user_data);
-gpointer mono_lock_free_array_iterate (MonoLockFreeArray *arr, MonoLockFreeArrayIterateFunc func, gpointer user_data) MONO_INTERNAL;
+gpointer mono_lock_free_array_iterate (MonoLockFreeArray *arr, MonoLockFreeArrayIterateFunc func, gpointer user_data);
-void mono_lock_free_array_cleanup (MonoLockFreeArray *arr) MONO_INTERNAL;
+void mono_lock_free_array_cleanup (MonoLockFreeArray *arr);
-void mono_lock_free_array_queue_push (MonoLockFreeArrayQueue *q, gpointer entry_data_ptr) MONO_INTERNAL;
-gboolean mono_lock_free_array_queue_pop (MonoLockFreeArrayQueue *q, gpointer entry_data_ptr) MONO_INTERNAL;
+void mono_lock_free_array_queue_push (MonoLockFreeArrayQueue *q, gpointer entry_data_ptr);
+gboolean mono_lock_free_array_queue_pop (MonoLockFreeArrayQueue *q, gpointer entry_data_ptr);
-void mono_lock_free_array_queue_cleanup (MonoLockFreeArrayQueue *q) MONO_INTERNAL;
+void mono_lock_free_array_queue_cleanup (MonoLockFreeArrayQueue *q);
#endif
volatile gint32 has_dummy;
} MonoLockFreeQueue;
-void mono_lock_free_queue_init (MonoLockFreeQueue *q) MONO_INTERNAL;
+void mono_lock_free_queue_init (MonoLockFreeQueue *q);
-void mono_lock_free_queue_node_init (MonoLockFreeQueueNode *node, gboolean to_be_freed) MONO_INTERNAL;
-void mono_lock_free_queue_node_free (MonoLockFreeQueueNode *node) MONO_INTERNAL;
+void mono_lock_free_queue_node_init (MonoLockFreeQueueNode *node, gboolean to_be_freed);
+void mono_lock_free_queue_node_free (MonoLockFreeQueueNode *node);
-void mono_lock_free_queue_enqueue (MonoLockFreeQueue *q, MonoLockFreeQueueNode *node) MONO_INTERNAL;
+void mono_lock_free_queue_enqueue (MonoLockFreeQueue *q, MonoLockFreeQueueNode *node);
-MonoLockFreeQueueNode* mono_lock_free_queue_dequeue (MonoLockFreeQueue *q) MONO_INTERNAL;
+MonoLockFreeQueueNode* mono_lock_free_queue_dequeue (MonoLockFreeQueue *q);
#endif
// and the pthread header guards against this
extern pthread_t pthread_from_mach_thread_np(mach_port_t);
-void *mono_mach_arch_get_ip (thread_state_t state) MONO_INTERNAL;
-void *mono_mach_arch_get_sp (thread_state_t state) MONO_INTERNAL;
-void mono_mach_init (pthread_key_t key) MONO_INTERNAL;
+void *mono_mach_arch_get_ip (thread_state_t state);
+void *mono_mach_arch_get_sp (thread_state_t state);
+void mono_mach_init (pthread_key_t key);
-int mono_mach_arch_get_mcontext_size (void) MONO_INTERNAL;
-void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context) MONO_INTERNAL;
-void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state) MONO_INTERNAL;
+int mono_mach_arch_get_mcontext_size (void);
+void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context);
+void mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state);
-int mono_mach_arch_get_thread_state_size (void) MONO_INTERNAL;
-kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count) MONO_INTERNAL;
-kern_return_t mono_mach_free_threads (thread_act_array_t threads, guint32 count) MONO_INTERNAL;
-kern_return_t mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count) MONO_INTERNAL;
-kern_return_t mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count) MONO_INTERNAL;
-void *mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key) MONO_INTERNAL;
-void *mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key) MONO_INTERNAL;
+int mono_mach_arch_get_thread_state_size (void);
+kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count);
+kern_return_t mono_mach_free_threads (thread_act_array_t threads, guint32 count);
+kern_return_t mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count);
+kern_return_t mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count);
+void *mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key);
+void *mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key);
#endif
#endif /* __MONO_MACH_SUPPORT_H__ */
#endif /* _MSC_VER */
#if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
-#define MONO_INTERNAL __attribute__ ((visibility ("hidden")))
#if MONO_LLVM_LOADED
#define MONO_LLVM_INTERNAL MONO_API
#else
-#define MONO_LLVM_INTERNAL MONO_INTERNAL
+#define MONO_LLVM_INTERNAL
#endif
#else
-#define MONO_INTERNAL
#define MONO_LLVM_INTERNAL
#endif
typedef struct _MonoConcurrentHashTable MonoConcurrentHashTable;
-MonoConcurrentHashTable* mono_conc_hashtable_new (mono_mutex_t *mutex, GHashFunc hash_func, GEqualFunc key_equal_func) MONO_INTERNAL;
-MonoConcurrentHashTable* mono_conc_hashtable_new_full (mono_mutex_t *mutex, GHashFunc hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func) MONO_INTERNAL;
-void mono_conc_hashtable_destroy (MonoConcurrentHashTable *hash_table) MONO_INTERNAL;
-gpointer mono_conc_hashtable_lookup (MonoConcurrentHashTable *hash_table, gpointer key) MONO_INTERNAL;
-gpointer mono_conc_hashtable_insert (MonoConcurrentHashTable *hash_table, gpointer key, gpointer value) MONO_INTERNAL;
-gpointer mono_conc_hashtable_remove (MonoConcurrentHashTable *hash_table, gpointer key) MONO_INTERNAL;
+MonoConcurrentHashTable* mono_conc_hashtable_new (mono_mutex_t *mutex, GHashFunc hash_func, GEqualFunc key_equal_func);
+MonoConcurrentHashTable* mono_conc_hashtable_new_full (mono_mutex_t *mutex, GHashFunc hash_func, GEqualFunc key_equal_func, GDestroyNotify key_destroy_func, GDestroyNotify value_destroy_func);
+void mono_conc_hashtable_destroy (MonoConcurrentHashTable *hash_table);
+gpointer mono_conc_hashtable_lookup (MonoConcurrentHashTable *hash_table, gpointer key);
+gpointer mono_conc_hashtable_insert (MonoConcurrentHashTable *hash_table, gpointer key, gpointer value);
+gpointer mono_conc_hashtable_remove (MonoConcurrentHashTable *hash_table, gpointer key);
#endif
* The naming is misleading, the SIGCTX argument should be the platform's context
* structure (ucontext_c on posix, CONTEXT on windows).
*/
-void mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx) MONO_INTERNAL;
+void mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx);
/*
* This will not completely initialize SIGCTX since MonoContext contains less
* the system, and use this function to override the parts of it which are
* also in MonoContext.
*/
-void mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx) MONO_INTERNAL;
+void mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx);
#endif /* __MONO_MONO_CONTEXT_H__ */
char* mono_dl_symbol (MonoDl *module, const char *name, void **symbol) MONO_LLVM_INTERNAL;
void mono_dl_close (MonoDl *module) MONO_LLVM_INTERNAL;
-char* mono_dl_build_path (const char *directory, const char *name, void **iter) MONO_INTERNAL;
+char* mono_dl_build_path (const char *directory, const char *name, void **iter);
-MonoDl* mono_dl_open_runtime_lib (const char *lib_name, int flags, char **error_msg) MONO_INTERNAL;
+MonoDl* mono_dl_open_runtime_lib (const char *lib_name, int flags, char **error_msg);
//Platform API for mono_dl
-const char* mono_dl_get_so_prefix (void) MONO_INTERNAL;
-const char** mono_dl_get_so_suffixes (void) MONO_INTERNAL;
-void* mono_dl_open_file (const char *file, int flags) MONO_INTERNAL;
-void mono_dl_close_handle (MonoDl *module) MONO_INTERNAL;
-void* mono_dl_lookup_symbol (MonoDl *module, const char *name) MONO_INTERNAL;
-int mono_dl_convert_flags (int flags) MONO_INTERNAL;
-char* mono_dl_current_error_string (void) MONO_INTERNAL;
-int mono_dl_get_executable_path (char *buf, int buflen) MONO_INTERNAL;
+const char* mono_dl_get_so_prefix (void);
+const char** mono_dl_get_so_suffixes (void);
+void* mono_dl_open_file (const char *file, int flags);
+void mono_dl_close_handle (MonoDl *module);
+void* mono_dl_lookup_symbol (MonoDl *module, const char *name);
+int mono_dl_convert_flags (int flags);
+char* mono_dl_current_error_string (void);
+int mono_dl_get_executable_path (char *buf, int buflen);
#endif /* __MONO_UTILS_DL_H__ */
const char *exception_name;
MonoClass *klass;
const char *full_message;
+ const char *full_message_with_fields;
- void *padding [5];
+ void *padding [4];
char message [128];
} MonoErrorInternal;
void
-mono_error_dup_strings (MonoError *error, gboolean dup_strings) MONO_INTERNAL;
+mono_error_dup_strings (MonoError *error, gboolean dup_strings);
/* This function is not very useful as you can't provide any details beyond the message.*/
void
-mono_error_set_error (MonoError *error, int error_code, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_error (MonoError *error, int error_code, const char *msg_format, ...);
void
-mono_error_set_assembly_load (MonoError *error, const char *assembly_name, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_assembly_load (MonoError *error, const char *assembly_name, const char *msg_format, ...);
void
-mono_error_set_assembly_load_simple (MonoError *error, const char *assembly_name, gboolean refection_only) MONO_INTERNAL;
+mono_error_set_assembly_load_simple (MonoError *error, const char *assembly_name, gboolean refection_only);
void
-mono_error_set_type_load_class (MonoError *error, MonoClass *klass, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_type_load_class (MonoError *error, MonoClass *klass, const char *msg_format, ...);
void
-mono_error_set_type_load_name (MonoError *error, const char *type_name, const char *assembly_name, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_type_load_name (MonoError *error, const char *type_name, const char *assembly_name, const char *msg_format, ...);
void
-mono_error_set_method_load (MonoError *error, MonoClass *klass, const char *method_name, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_method_load (MonoError *error, MonoClass *klass, const char *method_name, const char *msg_format, ...);
void
-mono_error_set_field_load (MonoError *error, MonoClass *klass, const char *field_name, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_field_load (MonoError *error, MonoClass *klass, const char *field_name, const char *msg_format, ...);
void
-mono_error_set_bad_image (MonoError *error, MonoImage *image, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_bad_image (MonoError *error, MonoImage *image, const char *msg_format, ...);
void
-mono_error_set_bad_image_name (MonoError *error, const char *file_name, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_bad_image_name (MonoError *error, const char *file_name, const char *msg_format, ...);
void
-mono_error_set_out_of_memory (MonoError *error, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_out_of_memory (MonoError *error, const char *msg_format, ...);
void
-mono_error_set_argument (MonoError *error, const char *argument, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_argument (MonoError *error, const char *argument, const char *msg_format, ...);
void
-mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_not_verifiable (MonoError *oerror, MonoMethod *method, const char *msg_format, ...);
void
-mono_error_set_generic_error (MonoError *error, const char * name_space, const char *name, const char *msg_format, ...) MONO_INTERNAL;
+mono_error_set_generic_error (MonoError *error, const char * name_space, const char *name, const char *msg_format, ...);
void
-mono_error_set_from_loader_error (MonoError *error) MONO_INTERNAL;
+mono_error_set_from_loader_error (MonoError *error);
MonoException*
-mono_error_prepare_exception (MonoError *error, MonoError *error_out) MONO_INTERNAL;
+mono_error_prepare_exception (MonoError *error, MonoError *error_out);
MonoException*
-mono_error_convert_to_exception (MonoError *error) MONO_INTERNAL;
+mono_error_convert_to_exception (MonoError *error);
void
-mono_error_raise_exception (MonoError *error) MONO_INTERNAL;
+mono_error_raise_exception (MonoError *error);
void
-mono_loader_set_error_from_mono_error (MonoError *oerror) MONO_INTERNAL;
+mono_loader_set_error_from_mono_error (MonoError *oerror);
#endif
if (error->error_code != MONO_ERROR_NONE)
return;
- error->type_name = error->assembly_name = error->member_name = error->full_message = error->exception_name_space = error->exception_name = NULL;
+ error->type_name = error->assembly_name = error->member_name = error->full_message = error->exception_name_space = error->exception_name = error->full_message_with_fields = NULL;
error->klass = NULL;
error->message [0] = 0;
}
+static const char*
+get_type_name (MonoErrorInternal *error)
+{
+ if (error->type_name)
+ return error->type_name;
+ if (error->klass)
+ return error->klass->name;
+ return "<unknown type>";
+}
+
+static const char*
+get_assembly_name (MonoErrorInternal *error)
+{
+ if (error->assembly_name)
+ return error->assembly_name;
+ if (error->klass && error->klass->image)
+ return error->klass->image->name;
+ return "<unknown assembly>";
+}
+
void
mono_error_init_flags (MonoError *oerror, unsigned short flags)
{
return;
g_free ((char*)error->full_message);
+ g_free ((char*)error->full_message_with_fields);
if (!(error->flags & MONO_ERROR_FREE_STRINGS)) //no memory was allocated
return;
MonoErrorInternal *error = (MonoErrorInternal*)oerror;
if (error->error_code == MONO_ERROR_NONE)
return NULL;
- return mono_internal_error_get_message (error);
+ if (error->full_message_with_fields)
+ return error->full_message_with_fields;
+
+ error->full_message_with_fields = g_strdup_printf ("%s assembly:%s type:%s member:%s",
+ mono_internal_error_get_message (error),
+ get_assembly_name (error),
+ get_type_name (error),
+ error->member_name ? error->member_name : "<none>");
+
+ return error->full_message_with_fields ? error->full_message_with_fields : mono_internal_error_get_message (error);
}
/*
mono_loader_clear_error ();
}
-static const char*
-get_type_name (MonoErrorInternal *error)
-{
- if (error->type_name)
- return error->type_name;
- if (error->klass)
- return error->klass->name;
- return "<unknown type>";
-}
-
-static const char*
-get_assembly_name (MonoErrorInternal *error)
-{
- if (error->assembly_name)
- return error->assembly_name;
- if (error->klass && error->klass->image)
- return error->klass->image->name;
- return "<unknown assembly>";
-}
-
void
mono_loader_set_error_from_mono_error (MonoError *oerror)
{
* To get at feature variables, include the appropriate header,
* e.g. mono-hwcap-x86.h for x86(-64).
*/
-void mono_hwcap_init (void) MONO_INTERNAL;
+void mono_hwcap_init (void);
/* Implemented in mono-hwcap-$TARGET.c. Do not call. */
-void mono_hwcap_arch_init (void) MONO_INTERNAL;
+void mono_hwcap_arch_init (void);
/* Print detected features to the given file. */
-void mono_hwcap_print (FILE *f) MONO_INTERNAL;
+void mono_hwcap_print (FILE *f);
/* Please note: If you're going to use the Linux auxiliary vector
* to detect CPU features, don't use any of the constant names in
mono_internal_hash_table_init (MonoInternalHashTable *table,
GHashFunc hash_func,
MonoInternalHashKeyExtractFunc key_extract,
- MonoInternalHashNextValueFunc next_value) MONO_INTERNAL;
+ MonoInternalHashNextValueFunc next_value);
void
-mono_internal_hash_table_destroy (MonoInternalHashTable *table) MONO_INTERNAL;
+mono_internal_hash_table_destroy (MonoInternalHashTable *table);
gpointer
-mono_internal_hash_table_lookup (MonoInternalHashTable *table, gpointer key) MONO_INTERNAL;
+mono_internal_hash_table_lookup (MonoInternalHashTable *table, gpointer key);
/* mono_internal_hash_table_insert requires that there is no entry for
key in the hash table. If you want to change the value for a key
assertion and to make the API look more familiar. */
void
mono_internal_hash_table_insert (MonoInternalHashTable *table,
- gpointer key, gpointer value) MONO_INTERNAL;
+ gpointer key, gpointer value);
void
-mono_internal_hash_table_remove (MonoInternalHashTable *table, gpointer key) MONO_INTERNAL;
+mono_internal_hash_table_remove (MonoInternalHashTable *table, gpointer key);
#endif
#else
-void mono_portability_helpers_init (void) MONO_INTERNAL;
-gchar *mono_portability_find_file (const gchar *pathname, gboolean last_exists) MONO_INTERNAL;
+void mono_portability_helpers_init (void);
+gchar *mono_portability_find_file (const gchar *pathname, gboolean last_exists);
-extern int __mono_io_portability_helpers MONO_INTERNAL;
+extern int __mono_io_portability_helpers;
#define IS_PORTABILITY_NONE (__mono_io_portability_helpers & PORTABILITY_NONE)
#define IS_PORTABILITY_UNKNOWN (__mono_io_portability_helpers & PORTABILITY_UNKNOWN)
mono_lls_init (MonoLinkedListSet *list, void (*free_node_func)(void *));
gboolean
-mono_lls_find (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, uintptr_t key) MONO_INTERNAL;
+mono_lls_find (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, uintptr_t key);
gboolean
-mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value) MONO_INTERNAL;
+mono_lls_insert (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value);
gboolean
-mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value) MONO_INTERNAL;
+mono_lls_remove (MonoLinkedListSet *list, MonoThreadHazardPointers *hp, MonoLinkedListSetNode *value);
gpointer
-get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index) MONO_INTERNAL;
+get_hazardous_pointer_with_mask (gpointer volatile *pp, MonoThreadHazardPointers *hp, int hazard_index);
/*
Requires the world to be stoped
} MonoTraceMask;
void
-mono_trace_cleanup (void) MONO_INTERNAL;
+mono_trace_cleanup (void);
void
-mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...) MONO_INTERNAL;
+mono_trace (GLogLevelFlags level, MonoTraceMask mask, const char *format, ...);
void
-mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args) MONO_INTERNAL;
+mono_tracev (GLogLevelFlags level, MonoTraceMask mask, const char *format, va_list args);
void
-mono_trace_set_level (GLogLevelFlags level) MONO_INTERNAL;
+mono_trace_set_level (GLogLevelFlags level);
void
-mono_trace_set_mask (MonoTraceMask mask) MONO_INTERNAL;
+mono_trace_set_mask (MonoTraceMask mask);
void
-mono_trace_push (GLogLevelFlags level, MonoTraceMask mask) MONO_INTERNAL;
+mono_trace_push (GLogLevelFlags level, MonoTraceMask mask);
void
-mono_trace_pop (void) MONO_INTERNAL;
+mono_trace_pop (void);
gboolean
-mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask) MONO_INTERNAL;
+mono_trace_is_traced (GLogLevelFlags level, MonoTraceMask mask);
#ifdef G_HAVE_ISO_VARARGS
#define mono_trace_error(...) mono_trace(G_LOG_LEVEL_ERROR, \
#include "mono-compiler.h"
-int mono_pages_not_faulted (void *addr, size_t length) MONO_INTERNAL;
+int mono_pages_not_faulted (void *addr, size_t length);
#endif /* __MONO_UTILS_MMAP_INTERNAL_H__ */
int npages = (size + pagesize - 1) / pagesize;
char *faulted = g_malloc0 (sizeof (char*) * npages);
- if (mincore (addr, size, faulted) != 0) {
+ /*
+ * We cast `faulted` to void* because Linux wants an unsigned
+ * char* while BSD wants a char*.
+ */
+ if (mincore (addr, size, (void*)faulted) != 0) {
count = -1;
} else {
count = 0;
MONO_NETWORK_ERROR_OTHER
} MonoNetworkError;
-gpointer *mono_networkinterface_list (int *size) MONO_INTERNAL;
-gint64 mono_network_get_data (char* name, MonoNetworkData data, MonoNetworkError *error) MONO_INTERNAL;
+gpointer *mono_networkinterface_list (int *size);
+gint64 mono_network_get_data (char* name, MonoNetworkData data, MonoNetworkError *error);
#endif /* __MONO_NETWORK_INTERFACES_H__ */
if (res)
return NULL;
processes = malloc (data_len);
- res = sysctl (mib, 4, NULL, &data_len, NULL, 0);
+ res = sysctl (mib, 4, processes, &data_len, NULL, 0);
if (res < 0) {
free (processes);
if (errno != ENOMEM)
MONO_PROCESS_ERROR_OTHER
} MonoProcessError;
-gpointer* mono_process_list (int *size) MONO_INTERNAL;
+gpointer* mono_process_list (int *size);
-char* mono_process_get_name (gpointer pid, char *buf, int len) MONO_INTERNAL;
+char* mono_process_get_name (gpointer pid, char *buf, int len);
-gint64 mono_process_get_data (gpointer pid, MonoProcessData data) MONO_INTERNAL;
-gint64 mono_process_get_data_with_error (gpointer pid, MonoProcessData data, MonoProcessError *error) MONO_INTERNAL;
+gint64 mono_process_get_data (gpointer pid, MonoProcessData data);
+gint64 mono_process_get_data_with_error (gpointer pid, MonoProcessData data, MonoProcessError *error);
-int mono_process_current_pid (void) MONO_INTERNAL;
+int mono_process_current_pid (void);
-int mono_cpu_count (void) MONO_INTERNAL;
-gint64 mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error) MONO_INTERNAL;
+int mono_cpu_count (void);
+gint64 mono_cpu_get_data (int cpu_id, MonoCpuData data, MonoProcessError *error);
-int mono_atexit (void (*func)(void)) MONO_INTERNAL;
+int mono_atexit (void (*func)(void));
#endif /* __MONO_PROC_LIB_H__ */
* which conflicts with objc.
* Hence the hack here.
*/
-void mono_threads_init_dead_letter (void) MONO_INTERNAL;
-void mono_threads_install_dead_letter (void) MONO_INTERNAL;
-void mono_thread_info_detach (void) MONO_INTERNAL;
+void mono_threads_init_dead_letter (void);
+void mono_threads_install_dead_letter (void);
+void mono_thread_info_detach (void);
static Class nsobject, nsthread, mono_dead_letter_class;
static SEL dealloc, release, currentThread, threadDictionary, init, alloc, objectForKey, setObjectForKey;
#include "config.h"
-#if defined(__MACH__)
-
/* For pthread_main_np, pthread_get_stackaddr_np and pthread_get_stacksize_np */
+#if defined (__MACH__)
#define _DARWIN_C_SOURCE 1
+#endif
+
+#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-mmap.h>
+
+#if defined (USE_MACH_BACKEND)
#include <mono/utils/mach-support.h>
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-semaphore.h>
#include <mono/utils/mono-threads.h>
#include <mono/utils/hazard-pointer.h>
-#include <mono/utils/mono-mmap.h>
void
mono_threads_init_platform (void)
void
mono_threads_core_abort_syscall (MonoThreadInfo *info)
{
+ kern_return_t ret;
+ ret = thread_suspend (info->native_handle);
+ if (ret != KERN_SUCCESS)
+ return;
+
+ thread_abort_safely (info->native_handle);
+ thread_resume (info->native_handle);
}
gboolean
mono_threads_core_needs_abort_syscall (void)
{
- return FALSE;
+ return TRUE;
}
gboolean
-mono_threads_core_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
{
kern_return_t ret;
gboolean res;
g_assert (info);
ret = thread_suspend (info->native_handle);
+ THREADS_SUSPEND_DEBUG ("SUSPEND %p -> %d\n", (void*)info->native_handle, ret);
if (ret != KERN_SUCCESS)
return FALSE;
+
+ /* We're in the middle of a self-suspend, resume and register */
+ if (!mono_threads_transition_finish_async_suspend (info)) {
+ mono_threads_add_to_pending_operation_set (info);
+ g_assert (thread_resume (info->native_handle) == KERN_SUCCESS);
+ THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/1 %p -> %d\n", (void*)info->native_handle, 0);
+ //XXX interrupt_kernel doesn't make sense in this case as the target is not in a syscall
+ return TRUE;
+ }
res = mono_threads_get_runtime_callbacks ()->
- thread_state_init_from_handle (&info->suspend_state, info);
- if (!res)
- thread_resume (info->native_handle);
+ thread_state_init_from_handle (&info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX], info);
+ THREADS_SUSPEND_DEBUG ("thread state %p -> %d\n", (void*)info->native_handle, res);
+ if (res) {
+ if (interrupt_kernel)
+ thread_abort (info->native_handle);
+ } else {
+ mono_threads_transition_async_suspend_compensation (info);
+ g_assert (thread_resume (info->native_handle) == KERN_SUCCESS);
+ THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/2 %p -> %d\n", (void*)info->native_handle, 0);
+ }
return res;
}
gboolean
-mono_threads_core_resume (MonoThreadInfo *info)
+mono_threads_core_check_suspend_result (MonoThreadInfo *info)
+{
+ return TRUE;
+}
+
+gboolean
+mono_threads_core_begin_async_resume (MonoThreadInfo *info)
{
kern_return_t ret;
if (info->async_target) {
- MonoContext tmp = info->suspend_state.ctx;
+ MonoContext tmp = info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx;
mach_msg_type_number_t num_state;
thread_state_t state;
ucontext_t uctx;
return FALSE;
}
-
ret = thread_resume (info->native_handle);
+ THREADS_SUSPEND_DEBUG ("RESUME %p -> %d\n", (void*)info->native_handle, ret);
+
return ret == KERN_SUCCESS;
}
{
/* pthread_setnmae_np() on Mac is not documented and doesn't receive thread id. */
}
+#endif /* USE_MACH_BACKEND */
+#ifdef __MACH__
void
mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
{
#include <config.h>
+/* For pthread_main_np, pthread_get_stackaddr_np and pthread_get_stacksize_np */
+#if defined (__MACH__)
+#define _DARWIN_C_SOURCE 1
+#endif
+
#include <mono/utils/mono-compiler.h>
#include <mono/utils/mono-semaphore.h>
#include <mono/utils/mono-threads.h>
HANDLE handle;
} StartInfo;
-#ifdef PLATFORM_ANDROID
-static int no_interrupt_signo;
-#endif
-
static void*
inner_start_thread (void *arg)
{
int
mono_threads_pthread_kill (MonoThreadInfo *info, int signum)
{
+ THREADS_SUSPEND_DEBUG ("sending signal %d to %p[%p]\n", signum, info, mono_thread_info_get_tid (info));
#ifdef USE_TKILL_ON_ANDROID
int result, old_errno = errno;
result = tkill (info->native_handle, signum);
}
-#if !defined (__MACH__)
+#if defined (USE_POSIX_BACKEND)
+
+static int suspend_signal_num;
+static int restart_signal_num;
+static int abort_signal_num;
+static sigset_t suspend_signal_mask;
+static sigset_t suspend_ack_signal_mask;
+
+
+#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#define DEFAULT_SUSPEND_SIGNAL SIGXFSZ
+#else
+#define DEFAULT_SUSPEND_SIGNAL SIGPWR
+#endif
+#define DEFAULT_RESTART_SIGNAL SIGXCPU
+#define DEFAULT_ABORT_SIGNAL SIGWINCH
+
+static int
+mono_thread_search_alt_signal (int min_signal)
+{
+#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) {
+ struct sigaction sinfo;
+ sigaction (i, NULL, &sinfo);
+ if (sinfo.sa_handler == SIG_DFL && (void*)sinfo.sa_sigaction == (void*)SIG_DFL) {
+ return i;
+ }
+ }
+ g_error ("Could not find an available signal");
+#endif
+}
+
+static int
+mono_thread_get_alt_suspend_signal (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 = mono_thread_search_alt_signal (-1);
+ return suspend_signum;
+#endif /* SIGRTMIN */
+}
+
+static int
+mono_thread_get_alt_resume_signal (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 = mono_thread_search_alt_signal (mono_thread_get_alt_suspend_signal () + 1);
+ return resume_signum;
+#endif /* SIGRTMIN */
+}
+
#if !defined(__native_client__)
+static void
+restart_signal_handler (int _dummy, siginfo_t *_info, void *context)
+{
+ MonoThreadInfo *info;
+ int old_errno = errno;
+
+ info = mono_thread_info_current ();
+ info->signal = restart_signal_num;
+ errno = old_errno;
+}
+
static void
suspend_signal_handler (int _dummy, siginfo_t *info, void *context)
{
+ int old_errno = errno;
+ int hp_save_index = mono_hazard_pointer_save_for_signal_handler ();
+
+
MonoThreadInfo *current = mono_thread_info_current ();
gboolean ret;
-
+
+ THREADS_SUSPEND_DEBUG ("SIGNAL HANDLER FOR %p [%p]\n", current, (void*)current->native_handle);
if (current->syscall_break_signal) {
current->syscall_break_signal = FALSE;
- return;
+ THREADS_SUSPEND_DEBUG ("\tsyscall break for %p\n", current);
+ goto done;
+ }
+
+ /* Have we raced with self suspend? */
+ if (!mono_threads_transition_finish_async_suspend (current)) {
+ current->suspend_can_continue = TRUE;
+ THREADS_SUSPEND_DEBUG ("\tlost race with self suspend %p\n", current);
+ goto done;
}
- ret = mono_threads_get_runtime_callbacks ()->thread_state_init_from_sigctx (¤t->suspend_state, context);
+ ret = mono_threads_get_runtime_callbacks ()->thread_state_init_from_sigctx (¤t->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX], context);
/* thread_state_init_from_sigctx return FALSE if the current thread is detaching and suspend can't continue. */
current->suspend_can_continue = ret;
- MONO_SEM_POST (¤t->begin_suspend_semaphore);
+
+ /*
+ 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);
+
+ /* We're done suspending */
+ mono_threads_notify_initiator_of_suspend (current);
/* This thread is doomed, all we can do is give up and let the suspender recover. */
- if (!ret)
- return;
+ if (!ret) {
+ THREADS_SUSPEND_DEBUG ("\tThread is dying, failed to capture state %p\n", current);
+ mono_threads_transition_async_suspend_compensation (current);
+ /* Unblock the restart signal. */
+ pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
- while (MONO_SEM_WAIT (¤t->resume_semaphore) != 0) {
- /*if (EINTR != errno) ABORT("sem_wait failed"); */
+ goto done;
}
+ do {
+ current->signal = 0;
+ sigsuspend (&suspend_signal_mask);
+ } while (current->signal != restart_signal_num);
+
+ /* Unblock the restart signal. */
+ pthread_sigmask (SIG_UNBLOCK, &suspend_ack_signal_mask, NULL);
+
if (current->async_target) {
#if MONO_ARCH_HAS_MONO_CONTEXT
- MonoContext tmp = current->suspend_state.ctx;
+ MonoContext tmp = current->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx;
mono_threads_get_runtime_callbacks ()->setup_async_callback (&tmp, current->async_target, current->user_data);
current->async_target = current->user_data = NULL;
mono_monoctx_to_sigctx (&tmp, context);
#endif
}
- MONO_SEM_POST (¤t->finish_resume_semaphore);
+ /* We're done resuming */
+ mono_threads_notify_initiator_of_resume (current);
+
+done:
+ mono_hazard_pointer_restore_for_signal_handler (hp_save_index);
+ errno = old_errno;
+}
+
+static void
+abort_signal_handler (int _dummy, siginfo_t *info, void *context)
+{
+ suspend_signal_handler (_dummy, info, context);
}
+
#endif
static void
int ret;
sa.sa_sigaction = handler;
- sigemptyset (&sa.sa_mask);
+ sigfillset (&sa.sa_mask);
+
sa.sa_flags = SA_SIGINFO | flags;
ret = sigaction (signo, &sa, &previous_sa);
void
mono_threads_init_platform (void)
{
-#if !defined(__native_client__)
- int abort_signo;
+ sigset_t signal_set;
- /*
- FIXME we should use all macros from mini to make this more portable
- FIXME it would be very sweet if sgen could end up using this too.
- */
- if (!mono_thread_info_new_interrupt_enabled ())
- return;
- abort_signo = mono_thread_get_abort_signal ();
- mono_posix_add_signal_handler (abort_signo, suspend_signal_handler, 0);
+ abort_signal_num = DEFAULT_ABORT_SIGNAL;
+ if (mono_thread_info_unified_management_enabled ()) {
+ suspend_signal_num = DEFAULT_SUSPEND_SIGNAL;
+ restart_signal_num = DEFAULT_RESTART_SIGNAL;
+ } else {
+ suspend_signal_num = mono_thread_get_alt_suspend_signal ();
+ restart_signal_num = mono_thread_get_alt_resume_signal ();
+ }
-#ifdef PLATFORM_ANDROID
- /*
- * Lots of android native code can't handle the EINTR caused by
- * the normal abort signal, so use a different signal for the
- * no interruption case, which is used by sdb.
- * FIXME: Use this on all platforms.
- * SIGUSR1 is used by dalvik/art.
- */
- no_interrupt_signo = SIGWINCH;
- g_assert (abort_signo != no_interrupt_signo);
- mono_posix_add_signal_handler (no_interrupt_signo, suspend_signal_handler, SA_RESTART);
-#endif
-#endif
-}
+ sigfillset (&suspend_signal_mask);
+ sigdelset (&suspend_signal_mask, restart_signal_num);
-void
-mono_threads_core_interrupt (MonoThreadInfo *info)
-{
- /* Handled in mono_threads_core_suspend () */
+ sigemptyset (&suspend_ack_signal_mask);
+ sigaddset (&suspend_ack_signal_mask, restart_signal_num);
+
+ mono_posix_add_signal_handler (suspend_signal_num, suspend_signal_handler, SA_RESTART);
+ mono_posix_add_signal_handler (restart_signal_num, restart_signal_handler, SA_RESTART);
+ mono_posix_add_signal_handler (abort_signal_num, abort_signal_handler, 0);
+
+ /* ensure all the new signals are unblocked */
+ sigemptyset (&signal_set);
+ sigaddset (&signal_set, suspend_signal_num);
+ sigaddset (&signal_set, restart_signal_num);
+ sigaddset (&signal_set, abort_signal_num);
+ sigprocmask (SIG_UNBLOCK, &signal_set, NULL);
}
void
This signal should not be interpreted as a suspend request.
*/
info->syscall_break_signal = TRUE;
- mono_threads_pthread_kill (info, mono_thread_get_abort_signal ());
+ mono_threads_pthread_kill (info, abort_signal_num);
}
gboolean
}
gboolean
-mono_threads_core_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
{
- /*FIXME, check return value*/
-#ifdef PLATFORM_ANDROID
- if (!interrupt_kernel)
- mono_threads_pthread_kill (info, no_interrupt_signo);
- else
- mono_threads_pthread_kill (info, mono_thread_get_abort_signal ());
-#else
- mono_threads_pthread_kill (info, mono_thread_get_abort_signal ());
-#endif
- while (MONO_SEM_WAIT (&info->begin_suspend_semaphore) != 0) {
- /* g_assert (errno == EINTR); */
+ int sig = interrupt_kernel ? abort_signal_num : suspend_signal_num;
+
+ if (!mono_threads_pthread_kill (info, sig)) {
+ mono_threads_add_to_pending_operation_set (info);
+ return TRUE;
}
- return info->suspend_can_continue;
+ return FALSE;
}
gboolean
-mono_threads_core_resume (MonoThreadInfo *info)
+mono_threads_core_check_suspend_result (MonoThreadInfo *info)
{
- MONO_SEM_POST (&info->resume_semaphore);
- while (MONO_SEM_WAIT (&info->finish_resume_semaphore) != 0) {
- /* g_assert (errno == EINTR); */
- }
+ return info->suspend_can_continue;
+}
- return TRUE;
+/*
+This begins async resume. This function must do the following:
+
+- Install an async target if one was requested.
+- Notify the target to resume.
+*/
+gboolean
+mono_threads_core_begin_async_resume (MonoThreadInfo *info)
+{
+ mono_threads_add_to_pending_operation_set (info);
+ return mono_threads_pthread_kill (info, restart_signal_num) == 0;
}
void
mono_threads_platform_register (MonoThreadInfo *info)
{
- MONO_SEM_INIT (&info->begin_suspend_semaphore, 0);
-
#if defined (PLATFORM_ANDROID)
info->native_handle = gettid ();
#endif
void
mono_threads_platform_free (MonoThreadInfo *info)
{
- MONO_SEM_DESTROY (&info->begin_suspend_semaphore);
}
MonoNativeThreadId
void
mono_threads_core_set_name (MonoNativeThreadId tid, const char *name)
{
-#ifdef HAVE_PTHREAD_SETNAME_NP
+#if defined (HAVE_PTHREAD_SETNAME_NP) && !defined (__MACH__)
if (!name) {
pthread_setname_np (tid, "");
} else {
#endif
}
-#endif /*!defined (__MACH__)*/
+#endif /*defined (USE_POSIX_BACKEND)*/
#endif
--- /dev/null
+#include <config.h>
+
+#include <mono/utils/mono-compiler.h>
+#include <mono/utils/mono-threads.h>
+#include <mono/utils/mono-tls.h>
+#include <mono/utils/mono-memory-model.h>
+#include <mono/utils/atomic.h>
+
+#include <errno.h>
+
+/*thread state helpers*/
+static inline int
+get_thread_state (int thread_state)
+{
+ return thread_state & THREAD_STATE_MASK;
+}
+
+static inline int
+get_thread_suspend_count (int thread_state)
+{
+ return (thread_state & THREAD_SUSPEND_COUNT_MASK) >> THREAD_SUSPEND_COUNT_SHIFT;
+}
+
+static inline int
+build_thread_state (int thread_state, int suspend_count)
+{
+ g_assert (suspend_count >= 0 && suspend_count <= THREAD_SUSPEND_COUNT_MAX);
+ g_assert (thread_state >= 0 && thread_state <= STATE_MAX);
+
+ return thread_state | (suspend_count << THREAD_SUSPEND_COUNT_SHIFT);
+}
+
+static const char*
+state_name (int state)
+{
+ static const char *state_names [] = {
+ "STARTING",
+ "RUNNING",
+ "DETACHED",
+ "ASYNC_SUSPENDED",
+ "SELF_SUSPENDED",
+ "ASYNC_SUSPEND_REQUESTED",
+ "SELF_SUSPEND_REQUESTED",
+ };
+ return state_names [get_thread_state (state)];
+}
+
+#define UNWRAP_THREAD_STATE(RAW,CUR,COUNT,INFO) do { \
+ RAW = (INFO)->thread_state; \
+ CUR = get_thread_state (RAW); \
+ COUNT = get_thread_suspend_count (RAW); \
+} while (0)
+
+static void
+check_thread_state (MonoThreadInfo* info)
+{
+ int raw_state, cur_state, suspend_count;
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+ case STATE_STARTING:
+ case STATE_RUNNING:
+ case STATE_DETACHED:
+ g_assert (suspend_count == 0);
+ break;
+ case STATE_ASYNC_SUSPENDED:
+ case STATE_SELF_SUSPENDED:
+ case STATE_ASYNC_SUSPEND_REQUESTED:
+ case STATE_SELF_SUSPEND_REQUESTED:
+ g_assert (suspend_count > 0);
+ break;
+ default:
+ g_error ("Invalid state %d", cur_state);
+ }
+}
+
+static inline void
+trace_state_change (const char *transition, MonoThreadInfo *info, int cur_raw_state, int next_state, int suspend_count_delta)
+{
+ check_thread_state (info);
+ THREADS_STATE_MACHINE_DEBUG ("[%s][%p] %s -> %s (%d -> %d)\n",
+ transition,
+ mono_thread_info_get_tid (info),
+ state_name (get_thread_state (cur_raw_state)),
+ state_name (next_state),
+ get_thread_suspend_count (cur_raw_state),
+ get_thread_suspend_count (cur_raw_state) + suspend_count_delta);
+}
+
+/*
+This is the transition that signals that a thread is functioning.
+Its main goal is to catch threads been witnessed before been fully registered.
+*/
+void
+mono_threads_transition_attach (MonoThreadInfo* info)
+{
+ int raw_state, cur_state, suspend_count;
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+ case STATE_STARTING:
+ g_assert (suspend_count == 0);
+ if (InterlockedCompareExchange (&info->thread_state, STATE_RUNNING, raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("ATTACH", info, raw_state, STATE_RUNNING, 0);
+ break;
+ default:
+ g_error ("Cannot transition current thread from %s with ATTACH", state_name (cur_state));
+ }
+}
+
+/*
+This is the transition that signals that a thread is no longer registered with the runtime.
+Its main goal is to catch threads been witnessed after they detach.
+
+This returns TRUE is the transition succeeded.
+If it returns false it means that there's a pending suspend that should be acted upon.
+*/
+gboolean
+mono_threads_transition_detach (MonoThreadInfo *info)
+{
+ int raw_state, cur_state, suspend_count;
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+ case STATE_RUNNING:
+ g_assert (suspend_count == 0);
+ if (InterlockedCompareExchange (&info->thread_state, STATE_DETACHED, raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("DETACH", info, raw_state, STATE_DETACHED, 0);
+ return TRUE;
+ case STATE_ASYNC_SUSPEND_REQUESTED: //Can't detach until whoever asked us to suspend to be happy with us
+ return FALSE;
+/*
+STATE_ASYNC_SUSPENDED: Code should not be running while suspended.
+STATE_SELF_SUSPENDED: Code should not be running while suspended.
+STATE_SELF_SUSPEND_REQUESTED: This is a bug in the self suspend code that didn't execute the second part of it
+*/
+ default:
+ g_error ("Cannot transition current thread %p from %s with DETACH", info, state_name (cur_state));
+ }
+}
+
+/*
+This transition initiates the suspension of the current thread.
+*/
+void
+mono_threads_transition_request_self_suspension (MonoThreadInfo *info)
+{
+ int raw_state, cur_state, suspend_count;
+ g_assert (info == mono_thread_info_current ());
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+
+ switch (cur_state) {
+ case STATE_RUNNING: //Post a self suspend request
+ g_assert (suspend_count == 0);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_SELF_SUSPEND_REQUESTED, 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("SELF_SUSPEND_REQUEST", info, raw_state, STATE_SELF_SUSPEND_REQUESTED, 1);
+ break;
+
+ case STATE_ASYNC_SUSPEND_REQUESTED: //Bump the suspend count but don't change the request type as async takes preference
+ g_assert (suspend_count > 0 && suspend_count < THREAD_SUSPEND_COUNT_MAX);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (cur_state, suspend_count + 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("SUSPEND_REQUEST", info, raw_state, cur_state, 1);
+ break;
+/*
+Other states:
+STATE_ASYNC_SUSPENDED: Code should not be running while suspended.
+STATE_SELF_SUSPENDED: Code should not be running while suspended.
+STATE_SELF_SUSPEND_REQUESTED: Self suspends should not nest as begin/end should be paired. [1]
+
+[1] This won't trap this sequence of requests: self suspend, async suspend and self suspend.
+If this turns to be an issue we can introduce a new suspend request state for when both have been requested.
+*/
+ default:
+ g_error ("Cannot transition thread %p from %s with SUSPEND_REQUEST", info, state_name (cur_state));
+ }
+}
+
+/*
+This transition initiates the suspension of another thread.
+
+Returns one of the following values:
+
+- AsyncSuspendInitSuspend: Thread suspend requested, async suspend needs to be done.
+- AsyncSuspendAlreadySuspended: Thread already suspended, nothing to do.
+- AsyncSuspendWait: Self suspend in progress, asked it to notify us. Caller must add target to the notification set.
+*/
+MonoRequestAsyncSuspendResult
+mono_threads_transition_request_async_suspension (MonoThreadInfo *info)
+{
+ int raw_state, cur_state, suspend_count;
+ g_assert (info != mono_thread_info_current ());
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+
+ switch (cur_state) {
+ case STATE_RUNNING: //Post an async suspend request
+ g_assert (suspend_count == 0);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_ASYNC_SUSPEND_REQUESTED, 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("ASYNC_SUSPEND_REQUESTED", info, raw_state, STATE_ASYNC_SUSPEND_REQUESTED, 1);
+ return AsyncSuspendInitSuspend; //This is the first async suspend request against the target
+
+ case STATE_ASYNC_SUSPENDED:
+ case STATE_SELF_SUSPENDED: //Async suspend can suspend the same thread multiple times as it starts from the outside
+ g_assert (suspend_count > 0 && suspend_count < THREAD_SUSPEND_COUNT_MAX);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (cur_state, suspend_count + 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("ASYNC_SUSPEND_REQUESTED", info, raw_state, cur_state, 1);
+ return AsyncSuspendAlreadySuspended; //Thread is already suspended so we don't need to wait it to suspend
+
+ case STATE_SELF_SUSPEND_REQUESTED: //This suspend needs to notify the initiator, so we need to promote the suspend to async
+ g_assert (suspend_count > 0 && suspend_count < THREAD_SUSPEND_COUNT_MAX);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_ASYNC_SUSPEND_REQUESTED, suspend_count + 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("ASYNC_SUSPEND_REQUESTED", info, raw_state, STATE_ASYNC_SUSPEND_REQUESTED, 1);
+ return AsyncSuspendWait; //This is the first async suspend request, change the thread and let it notify us [1]
+/*
+
+[1] It's questionable on what to do if we hit the beginning of a self suspend.
+The expected behavior is that the target should poll its state very soon so the the suspend latency should be minimal.
+
+STATE_ASYNC_SUSPEND_REQUESTED: Since there can only be one async suspend in progress and it must finish, it should not be possible to witness this.
+*/
+ default:
+ g_error ("Cannot transition thread %p from %s with ASYNC_SUSPEND_REQUESTED", info, state_name (cur_state));
+ }
+ return FALSE;
+}
+
+/*
+Check the current state of the thread and try to init a self suspend.
+This must be called with self state saved.
+
+Returns one of the following values:
+
+- Resumed: Async resume happened and current thread should keep running
+- Suspend: Caller should wait for a resume signal
+- SelfSuspendNotifyAndWait: Notify the suspend initiator and wait for a resume signals
+ suspend should start.
+
+*/
+MonoSelfSupendResult
+mono_threads_transition_state_poll (MonoThreadInfo *info)
+{
+ int raw_state, cur_state, suspend_count;
+ g_assert (info == mono_thread_info_current ());
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+ case STATE_RUNNING:
+ g_assert (suspend_count == 0);
+ trace_state_change ("STATE_POLL", info, raw_state, cur_state, 0);
+ return SelfSuspendResumed; //We're fine, don't suspend
+
+ case STATE_ASYNC_SUSPEND_REQUESTED: //Async suspend requested, service it with a self suspend
+ case STATE_SELF_SUSPEND_REQUESTED: //Start the self suspend process
+ g_assert (suspend_count > 0);
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_SELF_SUSPENDED, suspend_count), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("STATE_POLL", info, raw_state, STATE_SELF_SUSPENDED, 0);
+ if (cur_state == STATE_SELF_SUSPEND_REQUESTED)
+ return SelfSuspendWait; //Caller should wait for resume
+ else
+ return SelfSuspendNotifyAndWait; //Caller should notify suspend initiator and wait for resume
+
+/*
+STATE_ASYNC_SUSPENDED: Code should not be running while suspended.
+STATE_SELF_SUSPENDED: Code should not be running while suspended.
+*/
+ default:
+ g_error ("Cannot transition thread %p from %s with STATE_POLL", info, state_name (cur_state));
+ }
+}
+
+/*
+Try to resume a suspended thread.
+
+Returns one of the following values:
+- Sucess: The thread was resumed.
+- Error: The thread was not suspended in the first place. [2]
+- InitSelfResume: The thread is blocked on self suspend and should be resumed
+- InitAsycResume: The thread is blocked on async suspend and should be resumed
+
+[2] This threading system uses an unsigned suspend count. Which means a resume cannot be
+used as a suspend permit and cancel each other.
+
+Suspend permits are really useful to implement managed synchronization structures that
+don't consume native resources. The downside is that they further complicate the design of this
+system as the RUNNING state now has a non zero suspend counter.
+
+It can be implemented in the future if we find resume/suspend races that cannot be (efficiently) fixed by other means.
+
+One major issue with suspend permits is runtime facilities (GC, debugger) that must have the target suspended when requested.
+This would make permits really harder to add.
+*/
+MonoResumeResult
+mono_threads_transition_request_resume (MonoThreadInfo* info)
+{
+ int raw_state, cur_state, suspend_count;
+ g_assert (info != mono_thread_info_current ()); //One can't self resume [3]
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+ case STATE_RUNNING: //Thread already running.
+ trace_state_change ("RESUME", info, raw_state, cur_state, 0);
+ return ResumeError; //Resume failed because thread was not blocked
+
+ case STATE_ASYNC_SUSPENDED:
+ case STATE_SELF_SUSPENDED: //Decrease the suspend_count and maybe resume
+ g_assert (suspend_count > 0);
+ if (suspend_count > 1) {
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (cur_state, suspend_count - 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("RESUME", info, raw_state, cur_state, -1);
+
+ return ResumeOk; //Resume worked and there's nothing for the caller to do.
+ } else {
+ if (InterlockedCompareExchange (&info->thread_state, STATE_RUNNING, raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("RESUME", info, raw_state, STATE_RUNNING, -1);
+
+ if (cur_state == STATE_ASYNC_SUSPENDED)
+ return ResumeInitAsyncResume; //Resume worked and caller must do async resume
+ else
+ return ResumeInitSelfResume; //Resume worked and caller must do self resume
+ }
+
+ case STATE_SELF_SUSPEND_REQUESTED: //Self suspend was requested but another thread decided to resume it.
+ // case STATE_SUSPEND_IN_PROGRESS: //Self suspend is in progress but another thread decided to resume it. [4]
+ g_assert (suspend_count > 0);
+ if (suspend_count > 1) {
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (cur_state, suspend_count - 1), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("RESUME", info, raw_state, cur_state, -1);
+ } else {
+ if (InterlockedCompareExchange (&info->thread_state, STATE_RUNNING, raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("RESUME", info, raw_state, STATE_RUNNING, -1);
+ }
+ return ResumeOk; //Resume worked and there's nothing for the caller to do (the target never actually suspend).
+
+/*
+
+STATE_ASYNC_SUSPEND_REQUESTED: Only one async suspend/resume operation can be in flight, so a resume cannot witness an internal state of suspend
+STATE_SUSPEND_PROMOTED_TO_ASYNC: Only one async suspend/resume operation can be in flight, so a resume cannot witness an internal state of suspend
+
+[3] A self-resume makes no sense given it requires the thread to be running, which means its suspend count must be zero. A self resume would make
+sense as a suspend permit, but as explained in [2] we don't support it so this is a bug.
+
+[4] It's questionable on whether a resume (an async operation) should be able to cancel a self suspend. The scenario where this would happen
+is similar to the one described in [2] when this is used for as a synchronization primitive.
+
+If this turns to be a problem we should either implement [2] or make this an invalid transition.
+
+*/
+ default:
+ g_error ("Cannot transition thread %p from %s with REQUEST_RESUME", info, state_name (cur_state));
+ }
+}
+
+/*
+This performs the last step of async suspend.
+
+Returns TRUE if the caller should wait for resume.
+*/
+gboolean
+mono_threads_transition_finish_async_suspend (MonoThreadInfo* info)
+{
+ int raw_state, cur_state, suspend_count;
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+
+ case STATE_SELF_SUSPENDED: //async suspend raced with self suspend and lost
+ trace_state_change ("FINISH_ASYNC_SUSPEND", info, raw_state, cur_state, 0);
+ return FALSE; //let self suspend wait
+
+ case STATE_ASYNC_SUSPEND_REQUESTED:
+ if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_ASYNC_SUSPENDED, suspend_count), raw_state) != raw_state)
+ goto retry_state_change;
+ trace_state_change ("FINISH_ASYNC_SUSPEND", info, raw_state, STATE_ASYNC_SUSPENDED, 0);
+ return TRUE; //Async suspend worked, now wait for resume
+ //
+ // case STATE_SUSPEND_IN_PROGRESS:
+ // if (InterlockedCompareExchange (&info->thread_state, build_thread_state (STATE_SUSPEND_PROMOTED_TO_ASYNC, suspend_count), raw_state) != raw_state)
+ // goto retry_state_change;
+ // trace_state_change ("FINISH_ASYNC_SUSPEND", info, raw_state, STATE_SUSPEND_PROMOTED_TO_ASYNC, 0);
+ // return FALSE; //async suspend race with self suspend and lost, let the other finish it
+/*
+STATE_RUNNING: A thread cannot escape suspension once requested.
+STATE_ASYNC_SUSPENDED: There can be only one suspend initiator at a given time, meaning this state should have been visible on the first stage of suspend.
+STATE_SELF_SUSPEND_REQUESTED: When self suspend and async suspend happen together, they converge to async suspend so this state should not be visible.
+STATE_SUSPEND_PROMOTED_TO_ASYNC: Given there's a single initiator this cannot happen.
+*/
+ default:
+ g_error ("Cannot transition thread %p from %s with FINISH_ASYNC_SUSPEND", info, state_name (cur_state));
+
+ }
+}
+
+/*
+This the compensatory transition for failed async suspend.
+
+Async suspend can land on a thread as it began cleaning up and is no longer
+functional. This happens as cleanup is a racy process from the async suspend
+perspective. The thread could have cleaned up its domain or jit_tls, for example.
+
+It can only transition the state as left by a sucessfull finish async suspend transition.
+
+*/
+void
+mono_threads_transition_async_suspend_compensation (MonoThreadInfo* info)
+{
+ int raw_state, cur_state, suspend_count;
+
+retry_state_change:
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+
+ case STATE_ASYNC_SUSPENDED:
+ /*
+ Must be one since if a self suspend is in progress the thread should still be async suspendable.
+ If count > 1 and no self suspend is in progress then it means one of the following two.
+ - 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 (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);
+ break;
+/*
+STATE_RUNNING
+STATE_SELF_SUSPENDED
+STATE_ASYNC_SUSPEND_REQUESTED
+STATE_SELF_SUSPEND_REQUESTED
+STATE_SUSPEND_PROMOTED_TO_ASYNC:
+STATE_SUSPEND_IN_PROGRESS: All those are invalid end states of a sucessfull finish async suspend
+*/
+ default:
+ g_error ("Cannot transition thread %p from %s with COMPENSATE_FINISH_ASYNC_SUSPEND", info, state_name (cur_state));
+
+ }
+}
+
+MonoThreadUnwindState*
+mono_thread_info_get_suspend_state (MonoThreadInfo *info)
+{
+ int raw_state, cur_state, suspend_count G_GNUC_UNUSED;
+ UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
+ switch (cur_state) {
+ case STATE_ASYNC_SUSPENDED:
+ return &info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX];
+ case STATE_SELF_SUSPENDED:
+ return &info->thread_saved_state [SELF_SUSPEND_STATE_INDEX];
+ default:
+ g_error ("Cannot read suspend state when the target is in the %s state", state_name (cur_state));
+ }
+}
+
+
+
+// State checking code
+/**
+ * Return TRUE is the thread is in a runnable state.
+*/
+gboolean
+mono_thread_info_is_running (MonoThreadInfo *info)
+{
+ switch (get_thread_state (info->thread_state)) {
+ case STATE_RUNNING:
+ case STATE_ASYNC_SUSPEND_REQUESTED:
+ case STATE_SELF_SUSPEND_REQUESTED:
+ return TRUE;
+ }
+ return FALSE;
+}
+
+/**
+ * Return TRUE is the thread is in an usable (suspendable) state
+ */
+gboolean
+mono_thread_info_is_live (MonoThreadInfo *info)
+{
+ switch (get_thread_state (info->thread_state)) {
+ case STATE_STARTING:
+ case STATE_DETACHED:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int
+mono_thread_info_suspend_count (MonoThreadInfo *info)
+{
+ return get_thread_suspend_count (info->thread_state);
+}
}
void
-mono_threads_core_interrupt (MonoThreadInfo *info)
+mono_threads_core_abort_syscall (MonoThreadInfo *info)
{
DWORD id = mono_thread_info_get_tid (info);
HANDLE handle;
void
mono_threads_core_abort_syscall (MonoThreadInfo *info)
{
+ mono_threads_core_interrupt (info);
}
gboolean
mono_threads_core_needs_abort_syscall (void)
{
- return FALSE;
-}
-
-void
-mono_threads_core_self_suspend (MonoThreadInfo *info)
-{
- g_assert_not_reached ();
+ return TRUE;
}
gboolean
-mono_threads_core_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
+mono_threads_core_begin_async_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
{
DWORD id = mono_thread_info_get_tid (info);
HANDLE handle;
DWORD result;
gboolean res;
- g_assert (id != GetCurrentThreadId ());
-
handle = OpenThread (THREAD_ALL_ACCESS, FALSE, id);
g_assert (handle);
result = SuspendThread (handle);
+ THREADS_SUSPEND_DEBUG ("SUSPEND %p -> %d\n", (void*)id, ret);
if (result == (DWORD)-1) {
- fprintf (stderr, "could not suspend thread %x (handle %p): %d\n", id, handle, GetLastError ()); fflush (stderr);
CloseHandle (handle);
return FALSE;
}
- CloseHandle (handle);
+ /* We're in the middle of a self-suspend, resume and register */
+ if (!mono_threads_transition_finish_async_suspend (info)) {
+ mono_threads_add_to_pending_operation_set (info);
+ g_assert (ResumeThread (handle) == KERN_SUCCESS);
+ CloseHandle (handle);
+ THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/1 %p -> %d\n", (void*)id, 0);
+ //XXX interrupt_kernel doesn't make sense in this case as the target is not in a syscall
+ return TRUE;
+ }
+ res = mono_threads_get_runtime_callbacks ()->thread_state_init_from_handle (&info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX], info);
+ THREADS_SUSPEND_DEBUG ("thread state %p -> %d\n", (void*)id, res);
+ if (res) {
+ //FIXME do we need to QueueUserAPC on this case?
+ if (interrupt_kernel)
+ QueueUserAPC ((PAPCFUNC)interrupt_apc, handle, (ULONG_PTR)NULL);
+ } else {
+ mono_threads_transition_async_suspend_compensation (info);
+ g_assert (ResumeThread (handle) == KERN_SUCCESS);
+ THREADS_SUSPEND_DEBUG ("FAILSAFE RESUME/2 %p -> %d\n", (void*)info->native_handle, 0);
+ }
- res = mono_threads_get_runtime_callbacks ()->thread_state_init_from_handle (&info->suspend_state, info);
- g_assert (res);
+ CloseHandle (handle);
+ return res;
+}
+gboolean
+mono_threads_core_check_suspend_result (MonoThreadInfo *info)
+{
return TRUE;
}
gboolean
-mono_threads_core_resume (MonoThreadInfo *info)
+mono_threads_core_begin_async_resume (MonoThreadInfo *info)
{
DWORD id = mono_thread_info_get_tid (info);
HANDLE handle;
CONTEXT context;
gboolean res;
- ctx = info->suspend_state.ctx;
+ ctx = info->thread_saved_state [ASYNC_SUSPEND_STATE_INDEX].ctx;
mono_threads_get_runtime_callbacks ()->setup_async_callback (&ctx, info->async_target, info->user_data);
info->async_target = info->user_data = NULL;
context.ContextFlags = CONTEXT_INTEGER | CONTEXT_CONTROL;
res = SetThreadContext (handle, &context);
- g_assert (res);
+ if (!res) {
+ CloseHandle (handle);
+ return FALSE;
+ }
}
result = ResumeThread (handle);
- g_assert (result != (DWORD)-1);
-
CloseHandle (handle);
return result != (DWORD)-1;
}
+
void
mono_threads_platform_register (MonoThreadInfo *info)
{
mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize)
{
MEMORY_BASIC_INFORMATION meminfo;
-#ifdef TARGET_AMD64
+#ifdef _WIN64
/* win7 apis */
NT_TIB* tib = (NT_TIB*)NtCurrentTeb();
guint8 *stackTop = (guint8*)tib->StackBase;
#include <mono/utils/mono-memory-model.h>
#include <mono/utils/mono-mmap.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/mono-time.h>
+
#include <errno.h>
#include <mono/utils/mach-support.h>
#endif
-#define THREADS_DEBUG(...)
-//#define THREADS_DEBUG(...) g_message(__VA_ARGS__)
-
/*
Mutex that makes sure only a single thread can be suspending others.
Suspend is a very racy operation since it requires restarting until
static gboolean disable_new_interrupt = FALSE;
static gboolean mono_threads_inited = FALSE;
-static void mono_threads_unregister_current_thread (MonoThreadInfo *info);
+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)
+
+/*warn at 50 ms*/
+#define SLEEP_DURATION_BEFORE_WARNING (50)
+/*abort at 1 sec*/
+#define SLEEP_DURATION_BEFORE_ABORT 1000
+
+static void
+wait_for_resume (MonoThreadInfo* info)
+{
+ MONO_SEM_WAIT_UNITERRUPTIBLE (&info->resume_semaphore);
+}
+
+void
+mono_threads_notify_initiator_of_suspend (MonoThreadInfo* info)
+{
+ THREADS_SUSPEND_DEBUG ("[INITIATOR-NOTIFY-SUSPEND] %p\n", info);
+ MONO_SEM_POST (&suspend_semaphore);
+}
+
+void
+mono_threads_notify_initiator_of_resume (MonoThreadInfo* info)
+{
+ THREADS_SUSPEND_DEBUG ("[INITIATOR-NOTIFY-RESUME] %p\n", info);
+ MONO_SEM_POST (&suspend_semaphore);
+}
+
+static void
+resume_self_suspended (MonoThreadInfo* info)
+{
+ THREADS_SUSPEND_DEBUG ("begin self-resume %p\n", info);
+ MONO_SEM_POST (&info->resume_semaphore);
+}
+
+static void
+resume_async_suspended (MonoThreadInfo *info)
+{
+ g_assert (mono_threads_core_begin_async_resume (info));
+}
-#define mono_thread_info_run_state(info) (((MonoThreadInfo*)info)->thread_state & RUN_STATE_MASK)
-#define mono_thread_info_suspend_state(info) (((MonoThreadInfo*)info)->thread_state & SUSPEND_STATE_MASK)
+void
+mono_threads_add_to_pending_operation_set (MonoThreadInfo* info)
+{
+ THREADS_SUSPEND_DEBUG ("added %p to pending suspend\n", info);
+ ++pending_suspends;
+}
+
+void
+mono_threads_begin_global_suspend (void)
+{
+ g_assert (pending_suspends == 0);
+ THREADS_SUSPEND_DEBUG ("------ BEGIN GLOBAL OP\n");
+}
+
+void
+mono_threads_end_global_suspend (void)
+{
+ g_assert (pending_suspends == 0);
+ THREADS_SUSPEND_DEBUG ("------ END GLOBAL OP\n");
+}
+
+static void
+dump_threads (void)
+{
+ MonoThreadInfo *info;
+ FOREACH_THREAD_SAFE (info) {
+ THREADS_SUSPEND_DEBUG ("--thread %p id %p state %x\n", info, mono_thread_info_get_tid (info), info->thread_state);
+ } END_FOREACH_THREAD_SAFE
+}
+
+gboolean
+mono_threads_wait_pending_operations (void)
+{
+ int i;
+ int c = pending_suspends;
+
+ /* Wait threads to park */
+ if (pending_suspends) {
+ MonoStopwatch suspension_time;
+ mono_stopwatch_start (&suspension_time);
+ THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-COUNT] %d\n", c);
+ for (i = 0; i < pending_suspends; ++i) {
+ THREADS_SUSPEND_DEBUG ("[INITIATOR-WAIT-WAITING]\n");
+ if (!MONO_SEM_TIMEDWAIT (&suspend_semaphore, SLEEP_DURATION_BEFORE_ABORT))
+ continue;
+ mono_stopwatch_stop (&suspension_time);
+
+ dump_threads ();
+
+ THREADS_SUSPEND_DEBUG ("WAITING for %d threads, got %d suspended\n", (int)pending_suspends, i);
+ THREADS_SUSPEND_DEBUG ("cur thread is %p\n", pthread_self ());
+ g_error ("suspend_thread suspend took %d ms, which is more than the allowed %d ms", (int)mono_stopwatch_elapsed_ms (&suspension_time), SLEEP_DURATION_BEFORE_ABORT);
+ }
+ mono_stopwatch_stop (&suspension_time);
+ THREADS_SUSPEND_DEBUG ("Suspending %d threads took %d ms.\n", (int)pending_suspends, (int)mono_stopwatch_elapsed_ms (&suspension_time));
+
+ }
+
+ pending_suspends = 0;
+
+ return c > 0;
+}
+//Thread initialization code
+
+static void mono_threads_unregister_current_thread (MonoThreadInfo *info);
+
static inline void
mono_hazard_pointer_clear_all (MonoThreadHazardPointers *hp, int retain)
{
{
MonoThreadInfo *info = mem;
- MONO_SEM_DESTROY (&info->suspend_semaphore);
MONO_SEM_DESTROY (&info->resume_semaphore);
- MONO_SEM_DESTROY (&info->finish_resume_semaphore);
mono_threads_platform_free (info);
g_free (info);
mono_thread_info_set_tid (info, mono_native_thread_id_get ());
info->small_id = small_id;
- MONO_SEM_INIT (&info->suspend_semaphore, 1);
MONO_SEM_INIT (&info->resume_semaphore, 0);
- MONO_SEM_INIT (&info->finish_resume_semaphore, 0);
/*set TLS early so SMR works */
mono_native_tls_set_value (thread_info_key, info);
info->stack_end = staddr + stsize;
mono_threads_platform_register (info);
- info->thread_state = STATE_RUNNING;
+
+ /*
+ Transition it before taking any locks or publishing itself to reduce the chance
+ of others witnessing a detached thread.
+ We can reasonably expect that until this thread gets published, no other thread will
+ try to manipulate it.
+ */
+ mono_threads_transition_attach (info);
mono_thread_info_suspend_lock ();
/*If this fail it means a given thread has been registered twice, which doesn't make sense. */
result = mono_thread_info_insert (info);
mono_native_tls_set_value (small_id_key, GUINT_TO_POINTER (info->small_id + 1));
#endif
- info->thread_state = STATE_SHUTTING_DOWN;
-
/*
First perform the callback that requires no locks.
This callback has the potential of taking other locks, so we do it before.
if (threads_callbacks.thread_unregister)
threads_callbacks.thread_unregister (info);
mono_threads_unregister_current_thread (info);
+ mono_threads_transition_detach (info);
- info->thread_state = STATE_DEAD;
mono_thread_info_suspend_unlock ();
/*now it's safe to free the thread info.*/
g_assert (result);
}
+static inline MonoThreadInfo*
+mono_thread_info_current_unchecked (void)
+{
+ return (MonoThreadInfo*)mono_native_tls_get_value (thread_info_key);
+}
+
+
MonoThreadInfo*
mono_thread_info_current (void)
{
#endif
g_assert (res);
+ unified_suspend_enabled = g_getenv ("MONO_ENABLE_UNIFIED_SUSPEND") != NULL;
+
MONO_SEM_INIT (&global_suspend_semaphore, 1);
+ MONO_SEM_INIT (&suspend_semaphore, 0);
mono_lls_init (&thread_list, NULL);
mono_thread_smr_init ();
return NULL;
}
- MONO_SEM_WAIT_UNITERRUPTIBLE (&info->suspend_semaphore);
-
- /*thread is on the process of detaching*/
- if (mono_thread_info_run_state (info) > STATE_RUNNING) {
- mono_hazard_pointer_clear (hp, 1);
- *error_condition = "Thread is detaching";
- return NULL;
+ switch (mono_threads_transition_request_async_suspension (info)) {
+ case AsyncSuspendAlreadySuspended:
+ mono_hazard_pointer_clear (hp, 1); //XXX this is questionable we got to clean the suspend/resume nonsense of critical sections
+ return info;
+ case AsyncSuspendWait:
+ mono_threads_add_to_pending_operation_set (info);
+ break;
+ case AsyncSuspendInitSuspend:
+ if (!mono_threads_core_begin_async_suspend (info, interrupt_kernel)) {
+ mono_hazard_pointer_clear (hp, 1);
+ *error_condition = "Could not suspend thread";
+ return NULL;
+ }
}
- THREADS_DEBUG ("suspend %x IN COUNT %d\n", tid, info->suspend_count);
+ //Wait for the pending suspend to finish
+ mono_threads_wait_pending_operations ();
- if (info->suspend_count) {
- ++info->suspend_count;
- mono_hazard_pointer_clear (hp, 1);
- MONO_SEM_POST (&info->suspend_semaphore);
- return info;
- }
+ if (!mono_threads_core_check_suspend_result (info)) {
- if (!mono_threads_core_suspend (info, interrupt_kernel)) {
- MONO_SEM_POST (&info->suspend_semaphore);
mono_hazard_pointer_clear (hp, 1);
- *error_condition = "Could not suspend thread";
+ *error_condition = "Post suspend failed";
return NULL;
}
-
- if (interrupt_kernel)
- mono_threads_core_interrupt (info);
-
- ++info->suspend_count;
- info->thread_state |= STATE_SUSPENDED;
- MONO_SEM_POST (&info->suspend_semaphore);
-
return info;
}
+/*
+Signal that the current thread wants to be suspended.
+This function can be called without holding the suspend lock held.
+To finish suspending, call mono_suspend_check.
+*/
void
-mono_thread_info_self_suspend (void)
+mono_thread_info_begin_self_suspend (void)
{
- gboolean ret;
- MonoThreadInfo *info = mono_thread_info_current ();
+ MonoThreadInfo *info = mono_thread_info_current_unchecked ();
if (!info)
return;
- MONO_SEM_WAIT_UNITERRUPTIBLE (&info->suspend_semaphore);
-
- THREADS_DEBUG ("self suspend IN COUNT %d\n", info->suspend_count);
-
- g_assert (info->suspend_count == 0);
- ++info->suspend_count;
-
- info->thread_state |= STATE_SELF_SUSPENDED;
+ THREADS_SUSPEND_DEBUG ("BEGIN SELF SUSPEND OF %p\n", info);
+ mono_threads_transition_request_self_suspension (info);
+}
- ret = mono_threads_get_runtime_callbacks ()->thread_state_init_from_sigctx (&info->suspend_state, NULL);
- g_assert (ret);
+void
+mono_thread_info_end_self_suspend (void)
+{
+ MonoThreadInfo *info;
- MONO_SEM_POST (&info->suspend_semaphore);
+ info = mono_thread_info_current ();
+ if (!info)
+ return;
+ THREADS_SUSPEND_DEBUG ("FINISH SELF SUSPEND OF %p\n", info);
- MONO_SEM_WAIT_UNITERRUPTIBLE (&info->resume_semaphore);
+ g_assert (mono_threads_get_runtime_callbacks ()->thread_state_init_from_sigctx (&info->thread_saved_state [SELF_SUSPEND_STATE_INDEX], NULL));
- g_assert (!info->async_target); /*FIXME this should happen normally for suspend. */
- MONO_SEM_POST (&info->finish_resume_semaphore);
+ /* commit the saved state and notify others if needed */
+ switch (mono_threads_transition_state_poll (info)) {
+ case SelfSuspendResumed:
+ return;
+ case SelfSuspendWait:
+ wait_for_resume (info);
+ break;
+ case SelfSuspendNotifyAndWait:
+ mono_threads_notify_initiator_of_suspend (info);
+ wait_for_resume (info);
+ mono_threads_notify_initiator_of_resume (info);
+ break;
+ }
}
static gboolean
mono_thread_info_core_resume (MonoThreadInfo *info)
{
- gboolean result;
- MonoNativeThreadId tid = mono_thread_info_get_tid (info);
+ gboolean res = FALSE;
if (info->create_suspended) {
+ MonoNativeThreadId tid = mono_thread_info_get_tid (info);
/* Have to special case this, as the normal suspend/resume pair are racy, they don't work if he resume is received before the suspend */
info->create_suspended = FALSE;
mono_threads_core_resume_created (info, tid);
return TRUE;
}
- MONO_SEM_WAIT_UNITERRUPTIBLE (&info->suspend_semaphore);
-
- THREADS_DEBUG ("resume %x IN COUNT %d\n", tid, info->suspend_count);
-
- if (info->suspend_count <= 0) {
- MONO_SEM_POST (&info->suspend_semaphore);
- return FALSE;
- }
-
- /*
- * The theory here is that if we manage to suspend the thread it means it did not
- * start cleanup since it take the same lock.
- */
- g_assert (mono_thread_info_get_tid (info));
-
- if (--info->suspend_count == 0) {
- if (mono_thread_info_suspend_state (info) == STATE_SELF_SUSPENDED) {
- MONO_SEM_POST (&info->resume_semaphore);
- MONO_SEM_WAIT_UNITERRUPTIBLE (&info->finish_resume_semaphore);
- result = TRUE;
- } else {
- result = mono_threads_core_resume (info);
- }
- info->thread_state &= ~SUSPEND_STATE_MASK;
- } else {
- result = TRUE;
+ switch (mono_threads_transition_request_resume (info)) {
+ case ResumeError:
+ res = FALSE;
+ break;
+ case ResumeOk:
+ res = TRUE;
+ break;
+ case ResumeInitSelfResume:
+ resume_self_suspended (info);
+ res = TRUE;
+ break;
+ case ResumeInitAsyncResume:
+ resume_async_suspended (info);
+ res = TRUE;
+ break;
}
- MONO_SEM_POST (&info->suspend_semaphore);
- return result;
+ return res;
}
gboolean
{
gboolean result; /* don't initialize it so the compiler can catch unitilized paths. */
MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
- MonoThreadInfo *info = mono_thread_info_lookup (tid); /*info on HP1*/
+ MonoThreadInfo *info;
+
+ THREADS_SUSPEND_DEBUG ("RESUMING tid %p\n", (void*)tid);
+ mono_thread_info_suspend_lock ();
+
+ info = mono_thread_info_lookup (tid); /*info on HP1*/
if (!info) {
result = FALSE;
goto cleanup;
}
+
result = mono_thread_info_core_resume (info);
+ //Wait for the pending resume to finish
+ mono_threads_wait_pending_operations ();
+
cleanup:
+ mono_thread_info_suspend_unlock ();
mono_hazard_pointer_clear (hp, 1);
return result;
}
-void
-mono_thread_info_finish_suspend (MonoThreadInfo *info)
+gboolean
+mono_thread_info_begin_suspend (MonoThreadInfo *info, gboolean interrupt_kernel)
{
- mono_atomic_store_release (&mono_thread_info_current ()->inside_critical_region, FALSE);
+ switch (mono_threads_transition_request_async_suspension (info)) {
+ case AsyncSuspendAlreadySuspended:
+ return TRUE;
+ case AsyncSuspendWait:
+ mono_threads_add_to_pending_operation_set (info);
+ return TRUE;
+ case AsyncSuspendInitSuspend:
+ return mono_threads_core_begin_async_suspend (info, interrupt_kernel);
+ default:
+ g_assert_not_reached ();
+ }
}
-void
-mono_thread_info_finish_suspend_and_resume (MonoThreadInfo *info)
+gboolean
+mono_thread_info_begin_resume (MonoThreadInfo *info)
{
- MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
-
- /*Resume can access info after the target has resumed, so we must ensure it won't touch freed memory. */
- mono_hazard_pointer_set (hp, 1, info);
- mono_thread_info_core_resume (info);
- mono_hazard_pointer_clear (hp, 1);
-
- mono_atomic_store_release (&mono_thread_info_current ()->inside_critical_region, FALSE);
+ return mono_thread_info_core_resume (info);
}
/*
MonoMethod *method;
MonoJitInfo *ji;
gpointer stack_start;
+ MonoThreadUnwindState *state;
/* Are we inside a system critical region? */
if (info->inside_critical_region)
return TRUE;
+ if (threads_callbacks.mono_thread_in_critical_region && threads_callbacks.mono_thread_in_critical_region (info)) {
+ return TRUE;
+ }
+
/* Are we inside a GC critical region? */
if (threads_callbacks.mono_thread_in_critical_region && threads_callbacks.mono_thread_in_critical_region (info)) {
return TRUE;
}
/* The target thread might be shutting down and the domain might be null, which means no managed code left to run. */
- if (!info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN])
+ state = mono_thread_info_get_suspend_state (info);
+ if (!state->unwind_data [MONO_UNWIND_DATA_DOMAIN])
return FALSE;
- stack_start = MONO_CONTEXT_GET_SP (&info->suspend_state.ctx);
+ stack_start = MONO_CONTEXT_GET_SP (&state->ctx);
/* altstack signal handler, sgen can't handle them, so we treat them as critical */
if (stack_start < info->stack_start_limit || stack_start >= info->stack_end)
return TRUE;
ji = mono_jit_info_table_find (
- info->suspend_state.unwind_data [MONO_UNWIND_DATA_DOMAIN],
- MONO_CONTEXT_GET_IP (&info->suspend_state.ctx));
+ state->unwind_data [MONO_UNWIND_DATA_DOMAIN],
+ MONO_CONTEXT_GET_IP (&state->ctx));
if (!ji)
return FALSE;
return threads_callbacks.mono_method_is_critical (method);
}
-/*
-WARNING:
-If we are trying to suspend a target that is on a critical region
-and running a syscall we risk looping forever if @interrupt_kernel is FALSE.
-So, be VERY carefull in calling this with @interrupt_kernel == FALSE.
-
-Info is not put on a hazard pointer as a suspended thread cannot exit and be freed.
+gboolean
+mono_thread_info_in_critical_location (MonoThreadInfo *info)
+{
+ return is_thread_in_critical_region (info);
+}
-This function MUST be matched with mono_thread_info_finish_suspend or mono_thread_info_finish_suspend_and_resume
-*/
-MonoThreadInfo*
-mono_thread_info_safe_suspend_sync (MonoNativeThreadId id, gboolean interrupt_kernel)
+static MonoThreadInfo*
+suspend_sync_nolock (MonoNativeThreadId id, gboolean interrupt_kernel)
{
MonoThreadInfo *info = NULL;
int sleep_duration = 0;
-
- /*FIXME: unify this with self-suspend*/
- g_assert (id != mono_native_thread_id_get ());
-
- mono_thread_info_suspend_lock ();
-
for (;;) {
const char *suspend_error = "Unknown error";
if (!(info = mono_thread_info_suspend_sync (id, interrupt_kernel, &suspend_error))) {
- // g_warning ("failed to suspend thread %p due to %s, hopefully it is dead", (gpointer)id, suspend_error);
- mono_thread_info_suspend_unlock ();
+ mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
return NULL;
}
+
/*WARNING: We now are in interrupt context until we resume the thread. */
if (!is_thread_in_critical_region (info))
break;
if (!mono_thread_info_core_resume (info)) {
- // g_warning ("failed to resume thread %p, hopefully it is dead", (gpointer)id);
mono_hazard_pointer_clear (mono_hazard_pointer_get (), 1);
- mono_thread_info_suspend_unlock ();
return NULL;
}
- THREADS_DEBUG ("restarted thread %p\n", (gpointer)id);
+ THREADS_SUSPEND_DEBUG ("RESTARTED thread tid %p\n", (void*)id);
+
+ /* Wait for the pending resume to finish */
+ mono_threads_wait_pending_operations ();
if (!sleep_duration) {
#ifdef HOST_WIN32
}
sleep_duration += 10;
}
+ return info;
+}
+
+void
+mono_thread_info_safe_suspend_and_run (MonoNativeThreadId id, gboolean interrupt_kernel, MonoSuspendThreadCallback callback, gpointer user_data)
+{
+ int result;
+ MonoThreadInfo *info = NULL;
+ MonoThreadHazardPointers *hp = mono_hazard_pointer_get ();
+
+ THREADS_SUSPEND_DEBUG ("SUSPENDING tid %p\n", (void*)id);
+ /*FIXME: unify this with self-suspend*/
+ g_assert (id != mono_native_thread_id_get ());
+
+ mono_thread_info_suspend_lock ();
+ mono_threads_begin_global_suspend ();
+
+ info = suspend_sync_nolock (id, interrupt_kernel);
+ if (!info)
+ goto done;
+
+ switch (result = callback (info, user_data)) {
+ case ResumeThread:
+ mono_hazard_pointer_set (hp, 1, info);
+ mono_thread_info_core_resume (info);
+ mono_threads_wait_pending_operations ();
+ break;
+ case KeepSuspended:
+ break;
+ default:
+ g_error ("Invalid suspend_and_run callback return value %d", result);
+ }
+
+done:
+ mono_hazard_pointer_clear (hp, 1);
+ mono_threads_end_global_suspend ();
+ mono_thread_info_suspend_unlock ();
+}
+
+/*
+WARNING:
+If we are trying to suspend a target that is on a critical region
+and running a syscall we risk looping forever if @interrupt_kernel is FALSE.
+So, be VERY carefull in calling this with @interrupt_kernel == FALSE.
+
+Info is not put on a hazard pointer as a suspended thread cannot exit and be freed.
+
+This function MUST be matched with mono_thread_info_finish_suspend or mono_thread_info_finish_suspend_and_resume
+*/
+MonoThreadInfo*
+mono_thread_info_safe_suspend_sync (MonoNativeThreadId id, gboolean interrupt_kernel)
+{
+ MonoThreadInfo *info = NULL;
+
+ THREADS_SUSPEND_DEBUG ("SUSPENDING tid %p\n", (void*)id);
+ /*FIXME: unify this with self-suspend*/
+ g_assert (id != mono_native_thread_id_get ());
+
+ mono_thread_info_suspend_lock ();
+ mono_threads_begin_global_suspend ();
+
+ info = suspend_sync_nolock (id, interrupt_kernel);
/* XXX this clears HP 1, so we restated it again */
- mono_atomic_store_release (&mono_thread_info_current ()->inside_critical_region, TRUE);
+ // mono_atomic_store_release (&mono_thread_info_current ()->inside_critical_region, TRUE);
+ mono_threads_end_global_suspend ();
mono_thread_info_suspend_unlock ();
return info;
void
mono_thread_info_setup_async_call (MonoThreadInfo *info, void (*target_func)(void*), void *user_data)
{
- g_assert (info->suspend_count);
+ /* An async call can only be setup on an async suspended thread */
+ g_assert (mono_thread_info_run_state (info) == STATE_ASYNC_SUSPENDED);
/*FIXME this is a bad assert, we probably should do proper locking and fail if one is already set*/
g_assert (!info->async_target);
info->async_target = target_func;
mono_thread_info_suspend_unlock ();
}
+gboolean
+mono_thread_info_unified_management_enabled (void)
+{
+ return unified_suspend_enabled;
+}
+
/*
Disabled by default for now.
To enable this we need mini to implement the callbacks by MonoThreadInfoRuntimeCallbacks
return InterlockedExchange (&info->service_requests, 0);
}
-
-
-/**
- * Return TRUE is the thread is in an usable (suspendable) state
- */
-gboolean
-mono_thread_info_is_live (MonoThreadInfo *info)
-{
- return mono_thread_info_run_state (info) == STATE_RUNNING;
-}
#define THREAD_INFO_TYPE MonoThreadInfo
#endif
+/* Mono Threads internal configuration knows*/
+
+/* Logging - enable them below if you need specific logging for the category you need */
+#define MOSTLY_ASYNC_SAFE_PRINTF(...) do { \
+ char __buff[1024]; __buff [0] = '\0'; \
+ snprintf (__buff, sizeof (__buff), __VA_ARGS__); \
+ write (1, __buff, strlen (__buff)); \
+} while (0)
+
+
+#if 1
+#define THREADS_DEBUG(...)
+#else
+#define THREADS_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_STW_DEBUG(...)
+#else
+#define THREADS_STW_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_SUSPEND_DEBUG(...)
+#else
+#define THREADS_SUSPEND_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+#if 1
+#define THREADS_STATE_MACHINE_DEBUG(...)
+#else
+#define THREADS_STATE_MACHINE_DEBUG MOSTLY_ASYNC_SAFE_PRINTF
+#endif
+
+/* If this is defined, use the signals backed on Mach. Debug only as signals can't be made usable on OSX. */
+// #define USE_SIGNALS_ON_MACH
+
+#if defined (_POSIX_VERSION) || defined (__native_client__)
+#if defined (__MACH__) && !defined (USE_SIGNALS_ON_MACH)
+#define USE_MACH_BACKEND
+#else
+#define USE_POSIX_BACKEND
+#endif
+#endif
+
+
enum {
- STATE_STARTING = 0x00,
- STATE_RUNNING = 0x01,
- STATE_SHUTTING_DOWN = 0x02,
- STATE_DEAD = 0x03,
- RUN_STATE_MASK = 0x0F,
-
- STATE_SUSPENDED = 0x10,
- STATE_SELF_SUSPENDED = 0x20,
- SUSPEND_STATE_MASK = 0xF0,
+ STATE_STARTING = 0x00,
+ STATE_RUNNING = 0x01,
+ STATE_DETACHED = 0x02,
+
+ STATE_ASYNC_SUSPENDED = 0x03,
+ STATE_SELF_SUSPENDED = 0x04,
+ STATE_ASYNC_SUSPEND_REQUESTED = 0x05,
+ STATE_SELF_SUSPEND_REQUESTED = 0x06,
+ // STATE_SUSPEND_IN_PROGRESS = 0x07,
+ // STATE_SUSPEND_PROMOTED_TO_ASYNC = 0x08,
+ STATE_MAX = 0x06,
+
+ THREAD_STATE_MASK = 0x00FF,
+ THREAD_SUSPEND_COUNT_MASK = 0xFF00,
+ THREAD_SUSPEND_COUNT_SHIFT = 8,
+ THREAD_SUSPEND_COUNT_MAX = 0xFF,
+
+ SELF_SUSPEND_STATE_INDEX = 0,
+ ASYNC_SUSPEND_STATE_INDEX = 1,
};
/*
MonoSemType suspend_semaphore;
int suspend_count;
- MonoSemType finish_resume_semaphore;
- MonoSemType resume_semaphore;
+ // MonoSemType suspend_semaphore;
+ MonoSemType resume_semaphore;
/* only needed by the posix backend */
-#if (defined(_POSIX_VERSION) || defined(__native_client__)) && !defined (__MACH__)
- MonoSemType begin_suspend_semaphore;
+#if defined(USE_POSIX_BACKEND)
+ MonoSemType finish_resume_semaphore;
gboolean syscall_break_signal;
gboolean suspend_can_continue;
+ int signal;
+
#endif
/*In theory, only the posix backend needs this, but having it on mach/win32 simplifies things a lot.*/
- MonoThreadUnwindState suspend_state;
+ MonoThreadUnwindState thread_saved_state [2]; //0 is self suspend, 1 is async suspend.
/*async call machinery, thread MUST be suspended before accessing those fields*/
void (*async_target)(void*);
gboolean (*thread_state_init_from_handle) (MonoThreadUnwindState *tctx, MonoThreadInfo *info);
} MonoThreadInfoRuntimeCallbacks;
+//Not using 0 and 1 to ensure callbacks are not returning bad data
+typedef enum {
+ ResumeThread = 0x1234,
+ KeepSuspended = 0x4321,
+} SuspendThreadResult;
+
+typedef SuspendThreadResult (*MonoSuspendThreadCallback) (THREAD_INFO_TYPE *info, gpointer user_data);
+
static inline gboolean
mono_threads_filter_tools_threads (THREAD_INFO_TYPE *info)
{
* a single block with info from both camps.
*/
void
-mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t thread_info_size) MONO_INTERNAL;
+mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t thread_info_size);
void
-mono_threads_runtime_init (MonoThreadInfoRuntimeCallbacks *callbacks) MONO_INTERNAL;
+mono_threads_runtime_init (MonoThreadInfoRuntimeCallbacks *callbacks);
MonoThreadInfoCallbacks *
-mono_threads_get_callbacks (void) MONO_INTERNAL;
+mono_threads_get_callbacks (void);
MonoThreadInfoRuntimeCallbacks *
-mono_threads_get_runtime_callbacks (void) MONO_INTERNAL;
+mono_threads_get_runtime_callbacks (void);
int
-mono_thread_info_register_small_id (void) MONO_INTERNAL;
+mono_thread_info_register_small_id (void);
THREAD_INFO_TYPE *
-mono_thread_info_attach (void *baseptr) MONO_INTERNAL;
+mono_thread_info_attach (void *baseptr);
void
-mono_thread_info_detach (void) MONO_INTERNAL;
+mono_thread_info_detach (void);
gboolean
-mono_thread_info_is_exiting (void) MONO_INTERNAL;
+mono_thread_info_is_exiting (void);
THREAD_INFO_TYPE *
-mono_thread_info_current (void) MONO_INTERNAL;
+mono_thread_info_current (void);
int
-mono_thread_info_get_small_id (void) MONO_INTERNAL;
+mono_thread_info_get_small_id (void);
MonoLinkedListSet*
-mono_thread_info_list_head (void) MONO_INTERNAL;
+mono_thread_info_list_head (void);
THREAD_INFO_TYPE*
-mono_thread_info_lookup (MonoNativeThreadId id) MONO_INTERNAL;
+mono_thread_info_lookup (MonoNativeThreadId id);
THREAD_INFO_TYPE*
-mono_thread_info_safe_suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel) MONO_INTERNAL;
+mono_thread_info_safe_suspend_sync (MonoNativeThreadId tid, gboolean interrupt_kernel);
gboolean
-mono_thread_info_resume (MonoNativeThreadId tid) MONO_INTERNAL;
+mono_thread_info_resume (MonoNativeThreadId tid);
void
-mono_thread_info_set_name (MonoNativeThreadId tid, const char *name) MONO_INTERNAL;
+mono_thread_info_set_name (MonoNativeThreadId tid, const char *name);
void
-mono_thread_info_finish_suspend (MonoThreadInfo *info) MONO_INTERNAL;
+mono_thread_info_safe_suspend_and_run (MonoNativeThreadId id, gboolean interrupt_kernel, MonoSuspendThreadCallback callback, gpointer user_data);
+//XXX new API, fix the world
void
-mono_thread_info_finish_suspend_and_resume (MonoThreadInfo *info) MONO_INTERNAL;
+mono_thread_info_begin_self_suspend (void);
void
-mono_thread_info_self_suspend (void) MONO_INTERNAL;
+mono_thread_info_end_self_suspend (void);
+
+//END of new API
+
+gboolean
+mono_thread_info_new_interrupt_enabled (void);
gboolean
-mono_thread_info_new_interrupt_enabled (void) MONO_INTERNAL;
+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) MONO_INTERNAL;
+mono_thread_info_setup_async_call (THREAD_INFO_TYPE *info, void (*target_func)(void*), void *user_data);
void
-mono_thread_info_suspend_lock (void) MONO_INTERNAL;
+mono_thread_info_suspend_lock (void);
void
-mono_thread_info_suspend_unlock (void) MONO_INTERNAL;
+mono_thread_info_suspend_unlock (void);
void
-mono_thread_info_disable_new_interrupt (gboolean disable) MONO_INTERNAL;
+mono_thread_info_disable_new_interrupt (gboolean disable);
void
-mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid) MONO_INTERNAL;
+mono_thread_info_abort_socket_syscall_for_close (MonoNativeThreadId tid);
void
-mono_thread_info_set_is_async_context (gboolean async_context) MONO_INTERNAL;
+mono_thread_info_set_is_async_context (gboolean async_context);
gboolean
-mono_thread_info_is_async_context (void) MONO_INTERNAL;
+mono_thread_info_is_async_context (void);
void
mono_thread_info_get_stack_bounds (guint8 **staddr, size_t *stsize);
gboolean
-mono_thread_info_yield (void) MONO_INTERNAL;
+mono_thread_info_yield (void);
gpointer
mono_thread_info_tls_get (THREAD_INFO_TYPE *info, MonoTlsKey key);
mono_thread_info_clear_interruption (void);
gboolean
-mono_thread_info_is_live (THREAD_INFO_TYPE *info) MONO_INTERNAL;
+mono_thread_info_is_live (THREAD_INFO_TYPE *info);
HANDLE
mono_threads_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, guint32 stack_size, guint32 creation_flags, MonoNativeThreadId *out_tid);
int
-mono_threads_get_max_stack_size (void) MONO_INTERNAL;
+mono_threads_get_max_stack_size (void);
HANDLE
-mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid) MONO_INTERNAL;
+mono_threads_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
/*
This is the async job submission/consumption API.
If you want to use/extend it anywhere else, understand that you'll have to do some API design work to better fit this puppy.
*/
gboolean
-mono_threads_add_async_job (THREAD_INFO_TYPE *info, MonoAsyncJob job) MONO_INTERNAL;
+mono_threads_add_async_job (THREAD_INFO_TYPE *info, MonoAsyncJob job);
MonoAsyncJob
-mono_threads_consume_async_jobs (void) MONO_INTERNAL;
+mono_threads_consume_async_jobs (void);
MONO_API void
mono_threads_attach_tools_thread (void);
/*Use this instead of pthread_kill */
int
-mono_threads_pthread_kill (THREAD_INFO_TYPE *info, int signum) MONO_INTERNAL;
+mono_threads_pthread_kill (THREAD_INFO_TYPE *info, int signum);
#endif /* !defined(HOST_WIN32) */
/* Plartform specific functions DON'T use them */
-void mono_threads_init_platform (void) MONO_INTERNAL; //ok
-gboolean mono_threads_core_suspend (THREAD_INFO_TYPE *info, gboolean interrupt_kernel) MONO_INTERNAL;
-gboolean mono_threads_core_resume (THREAD_INFO_TYPE *info) MONO_INTERNAL;
-void mono_threads_platform_register (THREAD_INFO_TYPE *info) MONO_INTERNAL; //ok
-void mono_threads_platform_free (THREAD_INFO_TYPE *info) MONO_INTERNAL;
-void mono_threads_core_interrupt (THREAD_INFO_TYPE *info) MONO_INTERNAL;
-void mono_threads_core_abort_syscall (THREAD_INFO_TYPE *info) MONO_INTERNAL;
-gboolean mono_threads_core_needs_abort_syscall (void) MONO_INTERNAL;
-HANDLE mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, guint32 stack_size, guint32 creation_flags, MonoNativeThreadId *out_tid) MONO_INTERNAL;
-void mono_threads_core_resume_created (THREAD_INFO_TYPE *info, MonoNativeThreadId tid) MONO_INTERNAL;
-void mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize) MONO_INTERNAL;
-gboolean mono_threads_core_yield (void) MONO_INTERNAL;
-void mono_threads_core_exit (int exit_code) MONO_INTERNAL;
-void mono_threads_core_unregister (THREAD_INFO_TYPE *info) MONO_INTERNAL;
-HANDLE mono_threads_core_open_handle (void) MONO_INTERNAL;
-HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid) MONO_INTERNAL;
-void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name) MONO_INTERNAL;
+void mono_threads_init_platform (void); //ok
+gboolean mono_threads_core_suspend (THREAD_INFO_TYPE *info, gboolean interrupt_kernel);
+gboolean mono_threads_core_resume (THREAD_INFO_TYPE *info);
+void mono_threads_platform_register (THREAD_INFO_TYPE *info); //ok
+void mono_threads_platform_free (THREAD_INFO_TYPE *info);
+void mono_threads_core_interrupt (THREAD_INFO_TYPE *info);
+void mono_threads_core_abort_syscall (THREAD_INFO_TYPE *info);
+gboolean mono_threads_core_needs_abort_syscall (void);
+HANDLE mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, guint32 stack_size, guint32 creation_flags, MonoNativeThreadId *out_tid);
+void mono_threads_core_resume_created (THREAD_INFO_TYPE *info, MonoNativeThreadId tid);
+void mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize);
+gboolean mono_threads_core_yield (void);
+void mono_threads_core_exit (int exit_code);
+void mono_threads_core_unregister (THREAD_INFO_TYPE *info);
+HANDLE mono_threads_core_open_handle (void);
+HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
+void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name);
+
+/* Internal API between mono-threads and its backends. */
+
+/* Backend functions - a backend must implement all of the following */
+/*
+This is called very early in the runtime, it cannot access any runtime facilities.
+
+*/
+void mono_threads_init_platform (void); //ok
+
+/*
+This begins async suspend. This function must do the following:
+
+-Ensure the target will EINTR any syscalls if @interrupt_kernel is true
+-Call mono_threads_transition_finish_async_suspend as part of its async suspend.
+-Register the thread for pending suspend with mono_threads_add_to_pending_operation_set if needed.
+
+If begin suspend fails the thread must be left uninterrupted and resumed.
+*/
+gboolean mono_threads_core_begin_async_suspend (THREAD_INFO_TYPE *info, gboolean interrupt_kernel);
+
+/*
+This verifies the outcome of an async suspend operation.
+
+Some targets, such as posix, verify suspend results assynchronously. Suspend results must be
+available (in a non blocking way) after mono_threads_wait_pending_operations completes.
+*/
+gboolean mono_threads_core_check_suspend_result (THREAD_INFO_TYPE *info);
+
+/*
+This begins async resume. This function must do the following:
+
+- Install an async target if one was requested.
+- Notify the target to resume.
+- Register the thread for pending ack with mono_threads_add_to_pending_operation_set if needed.
+*/
+gboolean mono_threads_core_begin_async_resume (THREAD_INFO_TYPE *info);
+
+void mono_threads_platform_register (THREAD_INFO_TYPE *info); //ok
+void mono_threads_platform_free (THREAD_INFO_TYPE *info);
+void mono_threads_core_abort_syscall (THREAD_INFO_TYPE *info);
+gboolean mono_threads_core_needs_abort_syscall (void);
+HANDLE mono_threads_core_create_thread (LPTHREAD_START_ROUTINE start, gpointer arg, guint32 stack_size, guint32 creation_flags, MonoNativeThreadId *out_tid);
+void mono_threads_core_resume_created (THREAD_INFO_TYPE *info, MonoNativeThreadId tid);
+void mono_threads_core_get_stack_bounds (guint8 **staddr, size_t *stsize);
+gboolean mono_threads_core_yield (void);
+void mono_threads_core_exit (int exit_code);
+void mono_threads_core_unregister (THREAD_INFO_TYPE *info);
+HANDLE mono_threads_core_open_handle (void);
+HANDLE mono_threads_core_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
+void mono_threads_core_set_name (MonoNativeThreadId tid, const char *name);
gpointer mono_threads_core_prepare_interrupt (HANDLE thread_handle);
void mono_threads_core_finish_interrupt (gpointer wait_handle);
void mono_threads_core_self_interrupt (void);
void mono_threads_core_clear_interruption (void);
-MonoNativeThreadId mono_native_thread_id_get (void) MONO_INTERNAL;
+MonoNativeThreadId mono_native_thread_id_get (void);
-gboolean mono_native_thread_id_equals (MonoNativeThreadId id1, MonoNativeThreadId id2) MONO_INTERNAL;
+gboolean mono_native_thread_id_equals (MonoNativeThreadId id1, MonoNativeThreadId id2);
gboolean
-mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg) MONO_INTERNAL;
+mono_native_thread_create (MonoNativeThreadId *tid, gpointer func, gpointer arg);
/*Mach specific internals */
-void mono_threads_init_dead_letter (void) MONO_INTERNAL;
-void mono_threads_install_dead_letter (void) MONO_INTERNAL;
+void mono_threads_init_dead_letter (void);
+void mono_threads_install_dead_letter (void);
+
+/* mono-threads internal API used by the backends. */
+/*
+This tells the suspend initiator that we completed suspend and will now be waiting for resume.
+*/
+void mono_threads_notify_initiator_of_suspend (THREAD_INFO_TYPE* info);
+/*
+This tells the resume initiator that we completed resume duties and will return to runnable state.
+*/
+void mono_threads_notify_initiator_of_resume (THREAD_INFO_TYPE* info);
+
+/* Thread state machine functions */
+
+typedef enum {
+ ResumeError,
+ ResumeOk,
+ ResumeInitSelfResume,
+ ResumeInitAsyncResume,
+} MonoResumeResult;
+
+typedef enum {
+ SelfSuspendResumed,
+ SelfSuspendWait,
+ SelfSuspendNotifyAndWait,
+} MonoSelfSupendResult;
+
+typedef enum {
+ AsyncSuspendAlreadySuspended,
+ AsyncSuspendWait,
+ AsyncSuspendInitSuspend,
+} MonoRequestAsyncSuspendResult;
+
+void mono_threads_transition_attach (THREAD_INFO_TYPE* info);
+gboolean mono_threads_transition_detach (THREAD_INFO_TYPE *info);
+void mono_threads_transition_request_self_suspension (THREAD_INFO_TYPE *info);
+MonoRequestAsyncSuspendResult mono_threads_transition_request_async_suspension (THREAD_INFO_TYPE *info);
+MonoSelfSupendResult mono_threads_transition_state_poll (THREAD_INFO_TYPE *info);
+MonoResumeResult mono_threads_transition_request_resume (THREAD_INFO_TYPE* info);
+gboolean mono_threads_transition_finish_async_suspend (THREAD_INFO_TYPE* info);
+void mono_threads_transition_async_suspend_compensation (THREAD_INFO_TYPE* info);
+
+MonoThreadUnwindState* mono_thread_info_get_suspend_state (THREAD_INFO_TYPE *info);
+
+/* Advanced suspend API, used for suspending multiple threads as once. */
+gboolean mono_thread_info_is_running (THREAD_INFO_TYPE *info);
+gboolean mono_thread_info_is_live (THREAD_INFO_TYPE *info);
+int mono_thread_info_suspend_count (THREAD_INFO_TYPE *info);
+gboolean mono_thread_info_in_critical_location (THREAD_INFO_TYPE *info);
+gboolean mono_thread_info_begin_suspend (THREAD_INFO_TYPE *info, gboolean interrupt_kernel);
+gboolean mono_thread_info_begin_resume (THREAD_INFO_TYPE *info);
+
+
+void mono_threads_add_to_pending_operation_set (THREAD_INFO_TYPE* info); //XXX rename to something to reflect the fact that this is used for both suspend and resume
+gboolean mono_threads_wait_pending_operations (void);
+void mono_threads_begin_global_suspend (void);
+void mono_threads_end_global_suspend (void);
#endif /* __MONO_THREADS_H__ */
#include <glib.h>
/* Returns the number of milliseconds from boot time: this should be monotonic */
-guint32 mono_msec_ticks (void) MONO_INTERNAL;
+guint32 mono_msec_ticks (void);
/* Returns the number of 100ns ticks from unspecified time: this should be monotonic */
-gint64 mono_100ns_ticks (void) MONO_INTERNAL;
+gint64 mono_100ns_ticks (void);
/* Returns the number of 100ns ticks since 1/1/1, UTC timezone */
-gint64 mono_100ns_datetime (void) MONO_INTERNAL;
+gint64 mono_100ns_datetime (void);
/* Stopwatch class for internal runtime use */
typedef struct {
MonoValueHashTable* mono_value_hash_table_new (GHashFunc hash_func,
GEqualFunc key_equal_func,
- MonoValueHashKeyExtractFunc key_extract) MONO_INTERNAL;
+ MonoValueHashKeyExtractFunc key_extract);
void
-mono_value_hash_table_destroy (MonoValueHashTable *table) MONO_INTERNAL;
+mono_value_hash_table_destroy (MonoValueHashTable *table);
gpointer
-mono_value_hash_table_lookup (MonoValueHashTable *table, gconstpointer key) MONO_INTERNAL;
+mono_value_hash_table_lookup (MonoValueHashTable *table, gconstpointer key);
/* The key pointer is actually only passed here to check a debugging
assertion and to make the API look more familiar. */
void
mono_value_hash_table_insert (MonoValueHashTable *table,
- gpointer key, gpointer value) MONO_INTERNAL;
+ gpointer key, gpointer value);
G_END_DECLS
} MonoAddress;
/* This only supports IPV4 / IPV6 and tcp */
-int mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInfo **res) MONO_INTERNAL;
+int mono_get_address_info (const char *hostname, int port, int flags, MonoAddressInfo **res);
-void mono_free_address_info (MonoAddressInfo *ai) MONO_INTERNAL;
+void mono_free_address_info (MonoAddressInfo *ai);
-void mono_socket_address_init (MonoSocketAddress *sa, socklen_t *len, int family, const void *address, int port) MONO_INTERNAL;
+void mono_socket_address_init (MonoSocketAddress *sa, socklen_t *len, int family, const void *address, int port);
-void *mono_get_local_interfaces (int family, int *interface_count) MONO_INTERNAL;
+void *mono_get_local_interfaces (int family, int *interface_count);
#ifndef HAVE_INET_PTON
-int inet_pton (int family, const char *address, void *inaddrp) MONO_INTERNAL;
+int inet_pton (int family, const char *address, void *inaddrp);
#endif
-void mono_address_init (MonoAddress *out_addr, int family, void *in_addr) MONO_INTERNAL;
-int mono_address_size_for_family (int family) MONO_INTERNAL;
-gboolean mono_networking_addr_to_str (MonoAddress *address, char *buffer, socklen_t buflen) MONO_INTERNAL;
+void mono_address_init (MonoAddress *out_addr, int family, void *in_addr);
+int mono_address_size_for_family (int family);
+gboolean mono_networking_addr_to_str (MonoAddress *address, char *buffer, socklen_t buflen);
-int mono_networking_get_tcp_protocol (void) MONO_INTERNAL;
-int mono_networking_get_ip_protocol (void) MONO_INTERNAL;
-int mono_networking_get_ipv6_protocol (void) MONO_INTERNAL;
+int mono_networking_get_tcp_protocol (void);
+int mono_networking_get_ip_protocol (void);
+int mono_networking_get_ipv6_protocol (void);
-void mono_networking_init (void) MONO_INTERNAL;
-void mono_networking_shutdown (void) MONO_INTERNAL;
+void mono_networking_init (void);
+void mono_networking_shutdown (void);
#endif
#include "mono-compiler.h"
-double mono_strtod (const char *s00, char **se) MONO_INTERNAL;
+double mono_strtod (const char *s00, char **se);
#endif
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v110</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<UseOfMfc>false</UseOfMfc>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>false</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>false</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>false</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>false</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>true</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>false</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>StaticLibrary</ConfigurationType>\r
<UseDebugLibraries>false</UseDebugLibraries>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
mono_debug_free_method_jit_info
mono_debug_free_source_location
mono_debug_il_offset_from_address
+mono_debug_image_has_debug_info
mono_debug_init
mono_debug_lookup_locals
mono_debug_lookup_method
mono_debugger_insert_breakpoint
mono_debugger_method_has_breakpoint
mono_debugger_run_finally
+mono_decimal_addsub
+mono_decimal_divide
+mono_decimal_from_number
mono_declsec_flags_from_assembly
mono_declsec_flags_from_class
mono_declsec_flags_from_method
mono_module_file_get_object
mono_module_get_object
mono_monitor_enter
+mono_monitor_enter_v4
mono_monitor_exit
mono_monitor_try_enter
mono_mprotect
mono_runtime_run_main
mono_runtime_set_main_args
mono_runtime_set_shutting_down
+mono_save_seq_point_info
mono_security_core_clr_get_options
mono_security_core_clr_require_elevated_permissions
mono_security_core_clr_set_options
mono_unhandled_exception
mono_unicode_from_external
mono_unicode_to_external
+mono_upgrade_remote_class_wrapper
mono_utf8_from_external
mono_utf8_validate_and_len
mono_utf8_validate_and_len_with_bounds
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_SGen|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_SGen|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<ClCompile>\r
<Optimization>MinSpace</Optimization>\r
<AdditionalIncludeDirectories>..\eglib\src;..\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
- <PreprocessorDefinitions>NDEBUG;__i386__;TARGET_X86;i386;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+ <PreprocessorDefinitions>NDEBUG;__i386__;TARGET_X86;i386;_WIN32_WINNT=0x0502;WIN32;_WIN32;__WIN32__;_WINDOWS;WINDOWS;HOST_WIN32;TARGET_WIN32;_CRT_SECURE_NO_DEPRECATE;HAVE_CONFIG_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>\r
<PrecompiledHeader>\r
</PrecompiledHeader>\r
mono_debug_free_method_jit_info
mono_debug_free_source_location
mono_debug_il_offset_from_address
+mono_debug_image_has_debug_info
mono_debug_init
mono_debug_lookup_locals
mono_debug_lookup_method
mono_debugger_insert_breakpoint
mono_debugger_method_has_breakpoint
mono_debugger_run_finally
+mono_decimal_addsub
+mono_decimal_divide
+mono_decimal_from_number
mono_declsec_flags_from_assembly
mono_declsec_flags_from_class
mono_declsec_flags_from_method
mono_module_file_get_object
mono_module_get_object
mono_monitor_enter
+mono_monitor_enter_v4
mono_monitor_exit
mono_monitor_try_enter
mono_mprotect
mono_runtime_run_main
mono_runtime_set_main_args
mono_runtime_set_shutting_down
+mono_save_seq_point_info
mono_security_core_clr_get_options
mono_security_core_clr_require_elevated_permissions
mono_security_core_clr_set_options
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>Application</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">\r
<ConfigurationType>DynamicLibrary</ConfigurationType>\r
<CharacterSet>Unicode</CharacterSet>\r
- <PlatformToolset>v120</PlatformToolset>\r
+ <PlatformToolset>v120_xp</PlatformToolset>\r
</PropertyGroup>\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />\r
<ImportGroup Label="ExtensionSettings">\r
ccrewrite$(SCRIPT_SUFFIX) \
cccheck$(SCRIPT_SUFFIX) \
mdbrebase$(SCRIPT_SUFFIX) \
- ikdasm$(SCRIPT_SUFFIX)
+ ikdasm$(SCRIPT_SUFFIX) \
+ mono-symbolicate$(SCRIPT_SUFFIX)
MDOC_SUBCOMMANDS = \
mdoc-assemble \
--- /dev/null
+#!/bin/sh
+exec @bindir@/mono $MONO_OPTIONS @mono_instdir@/4.5/mono-symbolicate.exe "$@"
/* #undef USE_MONO_MUTEX */
/* Version number of package */
-#define VERSION "3.12.1"
+#define VERSION "4.1.0"
#endif