mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
Compare commits
60
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2be601b372 | ||
|
|
fc6d1c2516 | ||
|
|
3628ba1388 | ||
|
|
170474d513 | ||
|
|
179c475976 | ||
|
|
464a4459b1 | ||
|
|
9a4cdf8817 | ||
|
|
398083c7b2 | ||
|
|
98a869150c | ||
|
|
5191d1812e | ||
|
|
db6af8ade2 | ||
|
|
4d5e20fdaf | ||
|
|
fa97344114 | ||
|
|
5bf432f366 | ||
|
|
437e2da5ec | ||
|
|
3b27340223 | ||
|
|
76db142479 | ||
|
|
0d90e727e5 | ||
|
|
eb2f282d6f | ||
|
|
e94e9e4a35 | ||
|
|
6c80418313 | ||
|
|
6414856bf2 | ||
|
|
bec0257c97 | ||
|
|
73a79ac235 | ||
|
|
f5eeb5597a | ||
|
|
0fbda4c3bd | ||
|
|
2905ed96d1 | ||
|
|
90a8836c8d | ||
|
|
39cd3ee44f | ||
|
|
8fbc5ba484 | ||
|
|
0eb51843e2 | ||
|
|
0377d61060 | ||
|
|
48b95ec304 | ||
|
|
5348243102 | ||
|
|
c74c64718d | ||
|
|
2f91f15645 | ||
|
|
eeeb225f5e | ||
|
|
46ae4f7162 | ||
|
|
2c0574b136 | ||
|
|
78e6538665 | ||
|
|
08ad1b6c58 | ||
|
|
96c1285ae5 | ||
|
|
2a379285e6 | ||
|
|
05255cd094 | ||
|
|
89ff1067bf | ||
|
|
5f6f67ddb1 | ||
|
|
aa8a94891e | ||
|
|
3e93c004ed | ||
|
|
e8b8690a11 | ||
|
|
5ebbb4b813 | ||
|
|
009fd69def | ||
|
|
f4d67cef80 | ||
|
|
4df1f05181 | ||
|
|
5747973960 | ||
|
|
877cb94420 | ||
|
|
d6b048717f | ||
|
|
7a36028872 | ||
|
|
b4788b47ff | ||
|
|
29454e3179 | ||
|
|
9d2abd65f3 |
No files matched your search
@@ -1077,6 +1077,12 @@ AC_CHECK_FUNCS(sigaction)
|
||||
AC_CHECK_FUNCS(kill)
|
||||
AC_CHECK_FUNCS(signal)
|
||||
|
||||
# signal() is declared inline in Android headers
|
||||
# so we need to workaround it by overriding the check.
|
||||
if test x$platform_android = xyes; then
|
||||
AC_DEFINE(HAVE_SIGNAL,1)
|
||||
fi
|
||||
|
||||
if test x$host_win32 = xno; then
|
||||
|
||||
dnl hires monotonic clock support
|
||||
@@ -2562,6 +2568,13 @@ if test "x$enable_nacl_gc" = "xyes"; then
|
||||
fi
|
||||
AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
|
||||
|
||||
dnl **************************
|
||||
dnl *** AOT cross offsets ***
|
||||
dnl **************************
|
||||
|
||||
AC_ARG_WITH(cross-offsets, [ --with-cross-offsets=<offsets file path> Explicit AOT cross offsets file],
|
||||
AC_DEFINE_UNQUOTED(MONO_OFFSETS_FILE, "$withval", [AOT cross offsets file]))
|
||||
|
||||
dnl **************
|
||||
dnl *** LLVM ***
|
||||
dnl **************
|
||||
|
||||
+7
-2
@@ -74,13 +74,18 @@
|
||||
#define NO_INTR(var,cmd) do { (var) = (cmd); } while ((var) == -1 && errno == EINTR)
|
||||
#define CLOSE_PIPE(p) do { close (p [0]); close (p [1]); } while (0)
|
||||
|
||||
#if defined(__APPLE__) && !defined (__arm__) && !defined (__aarch64__)
|
||||
#if defined(__APPLE__)
|
||||
#if defined (TARGET_OSX)
|
||||
/* Apple defines this in crt_externs.h but doesn't provide that header for
|
||||
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
|
||||
* in fact exist on all implementations (so far)
|
||||
*/
|
||||
gchar ***_NSGetEnviron();
|
||||
gchar ***_NSGetEnviron(void);
|
||||
#define environ (*_NSGetEnviron())
|
||||
#else
|
||||
static char *mono_environ[1] = { NULL };
|
||||
#define environ mono_environ
|
||||
#endif /* defined (TARGET_OSX) */
|
||||
#elif defined(_MSC_VER)
|
||||
/* MS defines this in stdlib.h */
|
||||
#else
|
||||
|
||||
Vendored
+1
-1
Submodule external/referencesource updated: ba947d84c0...5f5ac0a87b.
@@ -35,7 +35,7 @@ net_4_x_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_S
|
||||
|
||||
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
|
||||
|
||||
xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
|
||||
xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
|
||||
xammac_net_4_5_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) $(reflection_PARALLEL_SUBDIRS)
|
||||
|
||||
monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
|
||||
|
||||
+2
-2
@@ -137,6 +137,8 @@ net_4_x_dirs := \
|
||||
System.Security \
|
||||
System.Configuration \
|
||||
$(resgen_dir) \
|
||||
System.IO.Compression \
|
||||
System.IO.Compression.FileSystem \
|
||||
System.Drawing \
|
||||
System.Transactions \
|
||||
System.EnterpriseServices \
|
||||
@@ -247,8 +249,6 @@ net_4_x_parallel_dirs := \
|
||||
System.Json.Microsoft \
|
||||
System.Threading.Tasks.Dataflow \
|
||||
System.ComponentModel.Composition.4.5 \
|
||||
System.IO.Compression \
|
||||
System.IO.Compression.FileSystem \
|
||||
System.Windows \
|
||||
System.Xml.Serialization \
|
||||
System.DirectoryServices.Protocols \
|
||||
|
||||
@@ -410,7 +410,6 @@ namespace MonoTests.Mono.Unix {
|
||||
const int StormCount = 100000;
|
||||
|
||||
[Test]
|
||||
[Category("NotOnMac")] // OSX signal storming will not deliver every one
|
||||
public void TestRaiseStorm ()
|
||||
{
|
||||
UnixSignal[] usignals = CreateSignals (signals);
|
||||
@@ -424,7 +423,7 @@ namespace MonoTests.Mono.Unix {
|
||||
t.Start ();
|
||||
foreach (Thread t in threads)
|
||||
t.Join ();
|
||||
AssertCount (usignals);
|
||||
AssertCountSet (usignals);
|
||||
CloseSignals (usignals);
|
||||
}
|
||||
|
||||
@@ -436,6 +435,13 @@ namespace MonoTests.Mono.Unix {
|
||||
Assert.AreEqual (sum, StormCount);
|
||||
}
|
||||
|
||||
static void AssertCountSet (UnixSignal[] usignals)
|
||||
{
|
||||
foreach (UnixSignal s in usignals) {
|
||||
Assert.IsTrue (s.Count > 0);
|
||||
}
|
||||
}
|
||||
|
||||
static UnixSignal[] CreateSignals (Signum[] signals)
|
||||
{
|
||||
UnixSignal[] s = new UnixSignal [signals.Length];
|
||||
@@ -462,7 +468,6 @@ namespace MonoTests.Mono.Unix {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotOnMac")] // OSX signal storming will not deliver every one
|
||||
public void TestAddRemove ()
|
||||
{
|
||||
UnixSignal[] usignals = CreateSignals (signals);
|
||||
@@ -477,7 +482,7 @@ namespace MonoTests.Mono.Unix {
|
||||
foreach (Thread t in threads)
|
||||
t.Join ();
|
||||
|
||||
AssertCount (usignals);
|
||||
AssertCountSet (usignals);
|
||||
CloseSignals (usignals);
|
||||
}
|
||||
|
||||
@@ -497,7 +502,6 @@ namespace MonoTests.Mono.Unix {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category("NotOnMac")] // OSX signal storming will not deliver every one
|
||||
public void TestWaitAny ()
|
||||
{
|
||||
UnixSignal[] usignals = CreateSignals (signals);
|
||||
@@ -515,7 +519,7 @@ namespace MonoTests.Mono.Unix {
|
||||
foreach (Thread t in threads)
|
||||
t.Join ();
|
||||
|
||||
AssertCount (usignals);
|
||||
AssertCountSet (usignals);
|
||||
CloseSignals (usignals);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,17 @@ RESOURCE_STRINGS = ../../../external/referencesource/System/System.txt
|
||||
ifeq (2.1, $(FRAMEWORK_VERSION))
|
||||
LIB_MCS_FLAGS += -d:INSIDE_SYSTEM
|
||||
endif
|
||||
|
||||
#
|
||||
# MOBILE_PROFILE needs SECURITY_DEP, except for XAMMAC
|
||||
#
|
||||
ifdef MOBILE_PROFILE
|
||||
ifneq ($(PROFILE),xammac)
|
||||
LIB_MCS_FLAGS += -d:SECURITY_DEP
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifndef MOBILE_PROFILE
|
||||
FINAL_MCS_FLAGS = -r:System.Configuration.dll -d:CONFIGURATION_DEP
|
||||
endif
|
||||
|
||||
@@ -3120,6 +3120,9 @@ namespace System.Net.Sockets
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal static extern void socket_pool_queue (SocketAsyncCallback d, SocketAsyncResult r);
|
||||
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal static extern bool SupportsPortReuse ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using System;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
@@ -3479,35 +3480,16 @@ namespace MonoTests.System.Net.Sockets
|
||||
s.Close ();
|
||||
}
|
||||
|
||||
static bool supportsTcpReuse = false;
|
||||
static bool supportsTcpReuseSet = false;
|
||||
|
||||
static bool SupportsTcpReuse ()
|
||||
static bool? supportsPortReuse;
|
||||
static bool SupportsPortReuse ()
|
||||
{
|
||||
if (supportsTcpReuseSet)
|
||||
return supportsTcpReuse;
|
||||
if (supportsPortReuse.HasValue)
|
||||
return supportsPortReuse.Value;
|
||||
|
||||
if (Path.DirectorySeparatorChar == '/') {
|
||||
/*
|
||||
* On UNIX OS
|
||||
* Multiple threads listening to the same address and port are not possible
|
||||
* before linux 3.9 kernel, where the socket option SO_REUSEPORT was introduced.
|
||||
*/
|
||||
Regex reg = new Regex(@"^#define\s*SO_REUSEPORT");
|
||||
foreach (string directory in Directory.GetDirectories ("/usr/include")) {
|
||||
var f = Directory.GetFiles (directory, "socket.h").SingleOrDefault ();
|
||||
if (f != null && File.ReadLines (f).Any (l => reg.Match (l).Success)) {
|
||||
supportsTcpReuse = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
supportsTcpReuse = true;
|
||||
}
|
||||
|
||||
supportsTcpReuseSet = true;
|
||||
|
||||
return supportsTcpReuse;
|
||||
supportsPortReuse = (bool) typeof (Socket).GetMethod ("SupportsPortReuse",
|
||||
BindingFlags.Static | BindingFlags.NonPublic)
|
||||
.Invoke (null, new object [] {});
|
||||
return supportsPortReuse.Value;
|
||||
}
|
||||
|
||||
// Test case for bug #31557
|
||||
@@ -3533,7 +3515,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
ex = e;
|
||||
}
|
||||
|
||||
Assert.AreEqual (SupportsTcpReuse (), ex == null);
|
||||
Assert.AreEqual (SupportsPortReuse (), ex == null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2333,7 +2333,7 @@ namespace MonoTests.System.Net
|
||||
byte[] readBuffer = new byte[int.MaxValue - near2GBStartPosition];
|
||||
Assert.AreEqual (webResponseStream.Read (readBuffer, 0, readBuffer.Length), readBuffer.Length, "#3");
|
||||
readyGetLastPortionEvent.Set ();
|
||||
Assert.Greater (webResponseStream.Read (readBuffer, 0, readBuffer.Length), 0, "#4");
|
||||
Assert.IsTrue (webResponseStream.Read (readBuffer, 0, readBuffer.Length) > 0);
|
||||
readyGetLastPortionEvent.Set ();
|
||||
|
||||
webResponse.Close();
|
||||
|
||||
@@ -32,7 +32,6 @@ using System;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Threading.Tasks;
|
||||
using MonoTests.System.Threading.Tasks;
|
||||
|
||||
namespace MonoTests.System.Threading
|
||||
{
|
||||
@@ -446,10 +445,11 @@ namespace MonoTests.System.Threading
|
||||
Assert.IsTrue (canceled, "#3");
|
||||
}
|
||||
|
||||
[Category ("NotWorking")] // why would linked token be imune to ObjectDisposedException on Cancel?
|
||||
[Test]
|
||||
public void ConcurrentCancelLinkedTokenSourceWhileDisposing ()
|
||||
{
|
||||
ParallelTestHelper.Repeat (delegate {
|
||||
for (int i = 0, total = 500; i < total; ++i) {
|
||||
var src = new CancellationTokenSource ();
|
||||
var linked = CancellationTokenSource.CreateLinkedTokenSource (src.Token);
|
||||
var cntd = new CountdownEvent (2);
|
||||
@@ -469,20 +469,19 @@ namespace MonoTests.System.Threading
|
||||
t2.Start ();
|
||||
t1.Join (500);
|
||||
t2.Join (500);
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
[Test]
|
||||
public void DisposeRace ()
|
||||
{
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
for (int i = 0, total = 1000; i < total; ++i) {
|
||||
var c1 = new CancellationTokenSource ();
|
||||
using (c1) {
|
||||
var wh = c1.Token.WaitHandle;
|
||||
c1.CancelAfter (1);
|
||||
Thread.Sleep (1);
|
||||
}
|
||||
var wh = c1.Token.WaitHandle;
|
||||
c1.CancelAfter (1);
|
||||
Thread.Sleep (1);
|
||||
c1.Dispose ();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -481,7 +481,6 @@ namespace MonoTests.System
|
||||
public void TestPow ()
|
||||
{
|
||||
double precision;
|
||||
int iTest = 1;
|
||||
#if MONODROID
|
||||
// It fails on Nexus 9 with
|
||||
//
|
||||
@@ -489,7 +488,7 @@ namespace MonoTests.System
|
||||
//
|
||||
// when using double_epsilon. Precision differs between different ARM CPUs, so we
|
||||
// will just use a more conservative value
|
||||
precision = double_epsilon * 10;
|
||||
precision = 1.3636094460602122 - 1.3636094460602119;
|
||||
#else
|
||||
precision = double_epsilon;
|
||||
#endif
|
||||
|
||||
@@ -129,15 +129,24 @@ namespace Mono.Linker.Steps {
|
||||
return new Regex (pattern.Replace(".", @"\.").Replace("*", "(.*)"));
|
||||
}
|
||||
|
||||
void MatchType (TypeDefinition type, Regex regex, XPathNavigator nav)
|
||||
{
|
||||
if (regex.Match (type.FullName).Success)
|
||||
ProcessType (type, nav);
|
||||
|
||||
if (!type.HasNestedTypes)
|
||||
return;
|
||||
|
||||
foreach (var nt in type.NestedTypes)
|
||||
MatchType (nt, regex, nav);
|
||||
}
|
||||
|
||||
void ProcessTypePattern (string fullname, AssemblyDefinition assembly, XPathNavigator nav)
|
||||
{
|
||||
Regex regex = CreateRegexFromPattern (fullname);
|
||||
|
||||
foreach (TypeDefinition type in assembly.MainModule.Types) {
|
||||
if (!regex.Match (type.FullName).Success)
|
||||
continue;
|
||||
|
||||
ProcessType (type, nav);
|
||||
MatchType (type, regex, nav);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -52,16 +52,22 @@ namespace Mono.Linker {
|
||||
|
||||
readonly Dictionary<object, Dictionary<IMetadataTokenProvider, object>> custom_annotations = new Dictionary<object, Dictionary<IMetadataTokenProvider, object>> ();
|
||||
|
||||
readonly Stack<object> dependency_stack = new Stack<object> ();
|
||||
Stack<object> dependency_stack;
|
||||
System.Xml.XmlWriter writer;
|
||||
GZipStream zipStream;
|
||||
|
||||
public void PrepareDependenciesDump ()
|
||||
{
|
||||
PrepareDependenciesDump ("linker-dependencies.xml.gz");
|
||||
}
|
||||
|
||||
public void PrepareDependenciesDump (string filename)
|
||||
{
|
||||
dependency_stack = new Stack<object> ();
|
||||
System.Xml.XmlWriterSettings settings = new System.Xml.XmlWriterSettings();
|
||||
settings.Indent = true;
|
||||
settings.IndentChars = "\t";
|
||||
var depsFile = File.OpenWrite ("linker-dependencies.xml.gz");
|
||||
var depsFile = File.OpenWrite (filename);
|
||||
zipStream = new GZipStream (depsFile, CompressionMode.Compress);
|
||||
|
||||
writer = System.Xml.XmlWriter.Create (zipStream, settings);
|
||||
@@ -317,6 +323,7 @@ namespace Mono.Linker {
|
||||
zipStream.Dispose ();
|
||||
writer = null;
|
||||
zipStream = null;
|
||||
dependency_stack = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,11 +37,8 @@ namespace Mono.Tuner {
|
||||
|
||||
public override void ProcessField (FieldDefinition field)
|
||||
{
|
||||
var attribute = GetPreserveAttribute (field);
|
||||
if (attribute == null)
|
||||
return;
|
||||
|
||||
Mark (field, attribute);
|
||||
foreach (var attribute in GetPreserveAttributes (field))
|
||||
Mark (field, attribute);
|
||||
}
|
||||
|
||||
public override void ProcessMethod (MethodDefinition method)
|
||||
@@ -51,32 +48,25 @@ namespace Mono.Tuner {
|
||||
|
||||
public override void ProcessProperty (PropertyDefinition property)
|
||||
{
|
||||
var attribute = GetPreserveAttribute (property);
|
||||
if (attribute == null)
|
||||
return;
|
||||
|
||||
MarkMethod (property.GetMethod, attribute);
|
||||
MarkMethod (property.SetMethod, attribute);
|
||||
foreach (var attribute in GetPreserveAttributes (property)) {
|
||||
MarkMethod (property.GetMethod, attribute);
|
||||
MarkMethod (property.SetMethod, attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ProcessEvent (EventDefinition @event)
|
||||
{
|
||||
var attribute = GetPreserveAttribute (@event);
|
||||
if (attribute == null)
|
||||
return;
|
||||
|
||||
MarkMethod (@event.AddMethod, attribute);
|
||||
MarkMethod (@event.InvokeMethod, attribute);
|
||||
MarkMethod (@event.RemoveMethod, attribute);
|
||||
foreach (var attribute in GetPreserveAttributes (@event)) {
|
||||
MarkMethod (@event.AddMethod, attribute);
|
||||
MarkMethod (@event.InvokeMethod, attribute);
|
||||
MarkMethod (@event.RemoveMethod, attribute);
|
||||
}
|
||||
}
|
||||
|
||||
void MarkMethodIfPreserved (MethodDefinition method)
|
||||
{
|
||||
var attribute = GetPreserveAttribute (method);
|
||||
if (attribute == null)
|
||||
return;
|
||||
|
||||
MarkMethod (method, attribute);
|
||||
foreach (var attribute in GetPreserveAttributes (method))
|
||||
MarkMethod (method, attribute);
|
||||
}
|
||||
|
||||
void MarkMethod (MethodDefinition method, CustomAttribute preserve_attribute)
|
||||
@@ -135,40 +125,40 @@ namespace Mono.Tuner {
|
||||
|
||||
void TryApplyPreserveAttribute (TypeDefinition type)
|
||||
{
|
||||
var attribute = GetPreserveAttribute (type);
|
||||
if (attribute == null)
|
||||
return;
|
||||
foreach (var attribute in GetPreserveAttributes (type)) {
|
||||
Annotations.Mark (type);
|
||||
|
||||
Annotations.Mark (type);
|
||||
|
||||
if (!attribute.HasFields)
|
||||
return;
|
||||
|
||||
foreach (var named_argument in attribute.Fields)
|
||||
if (named_argument.Name == "AllMembers" && (bool) named_argument.Argument.Value)
|
||||
Annotations.SetPreserve (type, TypePreserve.All);
|
||||
if (!attribute.HasFields)
|
||||
continue;
|
||||
|
||||
foreach (var named_argument in attribute.Fields)
|
||||
if (named_argument.Name == "AllMembers" && (bool)named_argument.Argument.Value)
|
||||
Annotations.SetPreserve (type, TypePreserve.All);
|
||||
}
|
||||
}
|
||||
|
||||
CustomAttribute GetPreserveAttribute (ICustomAttributeProvider provider)
|
||||
List<CustomAttribute> GetPreserveAttributes (ICustomAttributeProvider provider)
|
||||
{
|
||||
List<CustomAttribute> attrs = new List<CustomAttribute> ();
|
||||
|
||||
if (!provider.HasCustomAttributes)
|
||||
return null;
|
||||
return attrs;
|
||||
|
||||
var attributes = provider.CustomAttributes;
|
||||
|
||||
for (int i = 0; i < attributes.Count; i++) {
|
||||
for (int i = attributes.Count - 1; i >= 0; i--) {
|
||||
var attribute = attributes [i];
|
||||
|
||||
bool remote_attribute;
|
||||
if (!IsPreservedAttribute (provider, attribute, out remote_attribute))
|
||||
continue;
|
||||
|
||||
attrs.Add (attribute);
|
||||
if (remote_attribute)
|
||||
attributes.RemoveAt (i);
|
||||
return attribute;
|
||||
}
|
||||
|
||||
return null;
|
||||
return attrs;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,13 @@ namespace Mono.Tuner {
|
||||
AddPreserveInfo (corlib, "HMACSHA512", "SHA512Managed");
|
||||
|
||||
TryAddPreserveInfo (corlib, "Aes", "AesManaged");
|
||||
|
||||
var corlibAes = GetCryptoType (corlib, "Aes");
|
||||
Preserve (corlibAes, GetCryptoType (corlib, "AesManaged"));
|
||||
|
||||
AssemblyDefinition syscore;
|
||||
if (context.TryGetLinkedAssembly ("System.Core", out syscore))
|
||||
Preserve (corlibAes, GetCryptoType (syscore, "AesCryptoServiceProvider"));
|
||||
}
|
||||
|
||||
void ProcessSystemCore (LinkContext context)
|
||||
@@ -101,6 +108,8 @@ namespace Mono.Tuner {
|
||||
|
||||
void Preserve (TypeDefinition marker, TypeDefinition implementation)
|
||||
{
|
||||
if (marker == null || implementation == null)
|
||||
return;
|
||||
foreach (var constructor in implementation.GetConstructors ())
|
||||
annotations.AddPreservedMethod (marker, constructor);
|
||||
}
|
||||
|
||||
@@ -96,14 +96,19 @@
|
||||
#include <mono/utils/mono-proclib.h>
|
||||
|
||||
/* The process' environment strings */
|
||||
#if defined(__APPLE__) && !defined (__arm__) && !defined (__aarch64__)
|
||||
#if defined(__APPLE__)
|
||||
#if defined (TARGET_OSX)
|
||||
/* Apple defines this in crt_externs.h but doesn't provide that header for
|
||||
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
|
||||
* in fact exist on all implementations (so far)
|
||||
*/
|
||||
char ***_NSGetEnviron(void);
|
||||
gchar ***_NSGetEnviron(void);
|
||||
#define environ (*_NSGetEnviron())
|
||||
#else
|
||||
static char *mono_environ[1] = { NULL };
|
||||
#define environ mono_environ
|
||||
#endif /* defined (TARGET_OSX) */
|
||||
#else
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -2066,9 +2066,6 @@ mono_class_layout_fields (MonoClass *class)
|
||||
continue;
|
||||
if (mono_field_is_deleted (field))
|
||||
continue;
|
||||
// Special static fields do not need a domain-level static slot
|
||||
if (mono_class_field_is_special_static (field))
|
||||
continue;
|
||||
|
||||
if (mono_type_has_exceptions (field->type)) {
|
||||
mono_class_set_failure (class, MONO_EXCEPTION_TYPE_LOAD, NULL);
|
||||
|
||||
@@ -1040,9 +1040,6 @@ mono_class_describe_statics (MonoClass* klass)
|
||||
continue;
|
||||
if (!(field->type->attrs & (FIELD_ATTRIBUTE_STATIC | FIELD_ATTRIBUTE_HAS_FIELD_RVA)))
|
||||
continue;
|
||||
// Special static fields don't have a domain-level static slot
|
||||
if (mono_class_field_is_special_static (field))
|
||||
continue;
|
||||
|
||||
field_ptr = (const char*)addr + field->offset;
|
||||
|
||||
|
||||
@@ -440,6 +440,7 @@ ICALL(SOCK_17, "Send_internal(intptr,byte[],int,int,System.Net.Sockets.SocketFla
|
||||
ICALL(SOCK_18, "SetSocketOption_internal(intptr,System.Net.Sockets.SocketOptionLevel,System.Net.Sockets.SocketOptionName,object,byte[],int,int&)", ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal)
|
||||
ICALL(SOCK_19, "Shutdown_internal(intptr,System.Net.Sockets.SocketShutdown,int&)", ves_icall_System_Net_Sockets_Socket_Shutdown_internal)
|
||||
ICALL(SOCK_20, "Socket_internal(System.Net.Sockets.AddressFamily,System.Net.Sockets.SocketType,System.Net.Sockets.ProtocolType,int&)", ves_icall_System_Net_Sockets_Socket_Socket_internal)
|
||||
ICALL(SOCK_20a, "SupportsPortReuse", ves_icall_System_Net_Sockets_Socket_SupportPortReuse)
|
||||
ICALL(SOCK_21a, "cancel_blocking_socket_operation", icall_cancel_blocking_socket_operation)
|
||||
ICALL(SOCK_22, "socket_pool_queue", icall_append_io_job)
|
||||
|
||||
|
||||
@@ -5846,7 +5846,8 @@ ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
|
||||
*/
|
||||
#ifndef _MSC_VER
|
||||
#ifndef __MINGW32_VERSION
|
||||
#if defined(__APPLE__) && !defined (__arm__) && !defined (__aarch64__)
|
||||
#if defined(__APPLE__)
|
||||
#if defined (TARGET_OSX)
|
||||
/* Apple defines this in crt_externs.h but doesn't provide that header for
|
||||
* arm-apple-darwin9. We'll manually define the symbol on Apple as it does
|
||||
* in fact exist on all implementations (so far)
|
||||
@@ -5854,6 +5855,10 @@ ves_icall_System_Environment_GetEnvironmentVariable (MonoString *name)
|
||||
gchar ***_NSGetEnviron(void);
|
||||
#define environ (*_NSGetEnviron())
|
||||
#else
|
||||
static char *mono_environ[1] = { NULL };
|
||||
#define environ mono_environ
|
||||
#endif /* defined (TARGET_OSX) */
|
||||
#else
|
||||
extern
|
||||
char **environ;
|
||||
#endif
|
||||
|
||||
@@ -725,8 +725,8 @@ compute_class_bitmap (MonoClass *class, gsize *bitmap, int size, int offset, int
|
||||
if (field->type->byref)
|
||||
break;
|
||||
|
||||
// Special static fields do not have a domain-level static slot
|
||||
if (static_fields && mono_class_field_is_special_static (field))
|
||||
if (static_fields && field->offset == -1)
|
||||
/* special static */
|
||||
continue;
|
||||
|
||||
pos = field->offset / sizeof (gpointer);
|
||||
@@ -2419,8 +2419,6 @@ mono_class_field_is_special_static (MonoClassField *field)
|
||||
if (mono_field_is_deleted (field))
|
||||
return FALSE;
|
||||
if (!(field->type->attrs & FIELD_ATTRIBUTE_LITERAL)) {
|
||||
if (field->offset == -1)
|
||||
return TRUE;
|
||||
if (field_is_special_static (field->parent, field) != SPECIAL_STATIC_NONE)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -2540,6 +2540,16 @@ ves_icall_System_Net_Sockets_Socket_SendFile_internal (SOCKET sock, MonoString *
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
ves_icall_System_Net_Sockets_Socket_SupportPortReuse (void)
|
||||
{
|
||||
#if defined (SO_REUSEPORT) || defined (HOST_WIN32)
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_network_init(void)
|
||||
{
|
||||
|
||||
@@ -223,6 +223,7 @@ extern MonoBoolean ves_icall_System_Net_Sockets_Socket_Poll_internal (SOCKET soc
|
||||
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_internal (SOCKET sock, MonoString *filename, MonoArray *pre_buffer, MonoArray *post_buffer, gint flags);
|
||||
void icall_cancel_blocking_socket_operation (MonoThread *thread);
|
||||
extern gboolean ves_icall_System_Net_Sockets_Socket_SupportPortReuse (void);
|
||||
|
||||
extern void mono_network_init(void);
|
||||
extern void mono_network_cleanup(void);
|
||||
|
||||
@@ -7190,17 +7190,16 @@ mini_get_signature (MonoMethod *method, guint32 token, MonoGenericContext *conte
|
||||
MonoMethodSignature *fsig;
|
||||
|
||||
if (method->wrapper_type != MONO_WRAPPER_NONE) {
|
||||
MonoError error;
|
||||
|
||||
fsig = (MonoMethodSignature *)mono_method_get_wrapper_data (method, token);
|
||||
if (context) {
|
||||
fsig = mono_inflate_generic_signature (fsig, context, &error);
|
||||
// FIXME:
|
||||
g_assert (mono_error_ok (&error));
|
||||
}
|
||||
} else {
|
||||
fsig = mono_metadata_parse_signature (method->klass->image, token);
|
||||
}
|
||||
if (context) {
|
||||
MonoError error;
|
||||
fsig = mono_inflate_generic_signature(fsig, context, &error);
|
||||
// FIXME:
|
||||
g_assert(mono_error_ok(&error));
|
||||
}
|
||||
return fsig;
|
||||
}
|
||||
|
||||
|
||||
+65
-136
@@ -65,27 +65,12 @@ static gboolean optimize_for_xen = TRUE;
|
||||
#define mono_mini_arch_unlock() mono_mutex_unlock (&mini_arch_mutex)
|
||||
static mono_mutex_t mini_arch_mutex;
|
||||
|
||||
/*
|
||||
* The code generated for sequence points reads from this location, which is
|
||||
* made read-only when single stepping is enabled.
|
||||
*/
|
||||
static gpointer ss_trigger_page;
|
||||
|
||||
/* Enabled breakpoints read from this trigger page */
|
||||
static gpointer bp_trigger_page;
|
||||
|
||||
/* The size of the breakpoint sequence */
|
||||
static int breakpoint_size;
|
||||
|
||||
/* The size of the breakpoint instruction causing the actual fault */
|
||||
static int breakpoint_fault_size;
|
||||
|
||||
/* The size of the single step instruction causing the actual fault */
|
||||
static int single_step_fault_size;
|
||||
|
||||
/* The single step trampoline */
|
||||
static gpointer ss_trampoline;
|
||||
|
||||
/* The breakpoint trampoline */
|
||||
static gpointer bp_trampoline;
|
||||
|
||||
/* Offset between fp and the first argument in the callee */
|
||||
#define ARGS_OFFSET 16
|
||||
#define GP_SCRATCH_REG AMD64_R11
|
||||
@@ -1325,8 +1310,6 @@ mono_arch_cpu_init (void)
|
||||
void
|
||||
mono_arch_init (void)
|
||||
{
|
||||
int flags;
|
||||
|
||||
mono_mutex_init_recursive (&mini_arch_mutex);
|
||||
#if defined(__native_client_codegen__)
|
||||
mono_native_tls_alloc (&nacl_instruction_depth, NULL);
|
||||
@@ -1335,29 +1318,13 @@ mono_arch_init (void)
|
||||
mono_native_tls_alloc (&nacl_legacy_prefix_tag, NULL);
|
||||
#endif
|
||||
|
||||
#ifdef MONO_ARCH_NOMAP32BIT
|
||||
flags = MONO_MMAP_READ;
|
||||
/* amd64_mov_reg_imm () + amd64_mov_reg_membase () */
|
||||
breakpoint_size = 13;
|
||||
breakpoint_fault_size = 3;
|
||||
#else
|
||||
flags = MONO_MMAP_READ|MONO_MMAP_32BIT;
|
||||
/* amd64_mov_reg_mem () */
|
||||
breakpoint_size = 8;
|
||||
breakpoint_fault_size = 8;
|
||||
#endif
|
||||
|
||||
/* amd64_alu_membase_imm_size (code, X86_CMP, AMD64_R11, 0, 0, 4); */
|
||||
single_step_fault_size = 4;
|
||||
|
||||
ss_trigger_page = mono_valloc (NULL, mono_pagesize (), flags);
|
||||
bp_trigger_page = mono_valloc (NULL, mono_pagesize (), flags);
|
||||
mono_mprotect (bp_trigger_page, mono_pagesize (), 0);
|
||||
|
||||
mono_aot_register_jit_icall ("mono_amd64_throw_exception", mono_amd64_throw_exception);
|
||||
mono_aot_register_jit_icall ("mono_amd64_throw_corlib_exception", mono_amd64_throw_corlib_exception);
|
||||
mono_aot_register_jit_icall ("mono_amd64_resume_unwind", mono_amd64_resume_unwind);
|
||||
mono_aot_register_jit_icall ("mono_amd64_get_original_ip", mono_amd64_get_original_ip);
|
||||
|
||||
if (!mono_aot_only)
|
||||
bp_trampoline = mini_get_breakpoint_trampoline ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1992,15 +1959,14 @@ mono_arch_create_vars (MonoCompile *cfg)
|
||||
MonoInst *ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
|
||||
ins->flags |= MONO_INST_VOLATILE;
|
||||
cfg->arch.seq_point_info_var = ins;
|
||||
|
||||
ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
|
||||
ins->flags |= MONO_INST_VOLATILE;
|
||||
cfg->arch.ss_tramp_var = ins;
|
||||
}
|
||||
|
||||
ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
|
||||
ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
|
||||
ins->flags |= MONO_INST_VOLATILE;
|
||||
cfg->arch.ss_trigger_page_var = ins;
|
||||
cfg->arch.ss_tramp_var = ins;
|
||||
|
||||
ins = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
|
||||
ins->flags |= MONO_INST_VOLATILE;
|
||||
cfg->arch.bp_tramp_var = ins;
|
||||
}
|
||||
|
||||
if (cfg->method->save_lmf)
|
||||
@@ -4186,35 +4152,21 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
mono_add_seq_point (cfg, bb, ins, code - cfg->native_code);
|
||||
break;
|
||||
case OP_SEQ_POINT: {
|
||||
int i;
|
||||
|
||||
if (ins->flags & MONO_INST_SINGLE_STEP_LOC) {
|
||||
if (cfg->compile_aot) {
|
||||
MonoInst *var = cfg->arch.ss_tramp_var;
|
||||
guint8 *label;
|
||||
MonoInst *var = cfg->arch.ss_tramp_var;
|
||||
guint8 *label;
|
||||
|
||||
/* Load ss_tramp_var */
|
||||
amd64_mov_reg_membase (code, AMD64_R11, var->inst_basereg, var->inst_offset, 8);
|
||||
/* Load the trampoline address */
|
||||
amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, 8);
|
||||
/* Call it if it is non-null */
|
||||
amd64_test_reg_reg (code, AMD64_R11, AMD64_R11);
|
||||
label = code;
|
||||
amd64_branch8 (code, X86_CC_Z, 0, FALSE);
|
||||
amd64_call_reg (code, AMD64_R11);
|
||||
amd64_patch (label, code);
|
||||
} else {
|
||||
/*
|
||||
* Read from the single stepping trigger page. This will cause a
|
||||
* SIGSEGV when single stepping is enabled.
|
||||
* We do this _before_ the breakpoint, so single stepping after
|
||||
* a breakpoint is hit will step to the next IL offset.
|
||||
*/
|
||||
MonoInst *var = cfg->arch.ss_trigger_page_var;
|
||||
|
||||
amd64_mov_reg_membase (code, AMD64_R11, var->inst_basereg, var->inst_offset, 8);
|
||||
amd64_alu_membase_imm_size (code, X86_CMP, AMD64_R11, 0, 0, 4);
|
||||
}
|
||||
/* Load ss_tramp_var */
|
||||
/* This is equal to &ss_trampoline */
|
||||
amd64_mov_reg_membase (code, AMD64_R11, var->inst_basereg, var->inst_offset, 8);
|
||||
/* Load the trampoline address */
|
||||
amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, 8);
|
||||
/* Call it if it is non-null */
|
||||
amd64_test_reg_reg (code, AMD64_R11, AMD64_R11);
|
||||
label = code;
|
||||
amd64_branch8 (code, X86_CC_Z, 0, FALSE);
|
||||
amd64_call_reg (code, AMD64_R11);
|
||||
amd64_patch (label, code);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -4240,12 +4192,26 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
amd64_call_reg (code, AMD64_R11);
|
||||
amd64_patch (label, code);
|
||||
} else {
|
||||
/*
|
||||
* A placeholder for a possible breakpoint inserted by
|
||||
* mono_arch_set_breakpoint ().
|
||||
MonoInst *var = cfg->arch.bp_tramp_var;
|
||||
guint8 *label;
|
||||
|
||||
/*
|
||||
* Emit a test+branch against a constant, the constant will be overwritten
|
||||
* by mono_arch_set_breakpoint () to cause the test to fail.
|
||||
*/
|
||||
for (i = 0; i < breakpoint_size; ++i)
|
||||
x86_nop (code);
|
||||
amd64_mov_reg_imm (code, AMD64_R11, 0);
|
||||
amd64_test_reg_reg (code, AMD64_R11, AMD64_R11);
|
||||
label = code;
|
||||
amd64_branch8 (code, X86_CC_Z, 0, FALSE);
|
||||
|
||||
g_assert (var);
|
||||
g_assert (var->opcode == OP_REGOFFSET);
|
||||
/* Load bp_tramp_var */
|
||||
/* This is equal to &bp_trampoline */
|
||||
amd64_mov_reg_membase (code, AMD64_R11, var->inst_basereg, var->inst_offset, 8);
|
||||
/* Call the trampoline */
|
||||
amd64_call_membase (code, AMD64_R11, 0);
|
||||
amd64_patch (label, code);
|
||||
}
|
||||
/*
|
||||
* Add an additional nop so skipping the bp doesn't cause the ip to point
|
||||
@@ -7213,12 +7179,18 @@ mono_arch_emit_prolog (MonoCompile *cfg)
|
||||
amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, MONO_STRUCT_OFFSET (SeqPointInfo, ss_tramp_addr), 8);
|
||||
amd64_mov_membase_reg (code, ins->inst_basereg, ins->inst_offset, AMD64_R11, 8);
|
||||
} else {
|
||||
/* Initialize ss_trigger_page_var */
|
||||
ins = cfg->arch.ss_trigger_page_var;
|
||||
|
||||
/* Initialize ss_tramp_var */
|
||||
ins = cfg->arch.ss_tramp_var;
|
||||
g_assert (ins->opcode == OP_REGOFFSET);
|
||||
|
||||
amd64_mov_reg_imm (code, AMD64_R11, (guint64)ss_trigger_page);
|
||||
amd64_mov_reg_imm (code, AMD64_R11, (guint64)&ss_trampoline);
|
||||
amd64_mov_membase_reg (code, ins->inst_basereg, ins->inst_offset, AMD64_R11, 8);
|
||||
|
||||
/* Initialize bp_tramp_var */
|
||||
ins = cfg->arch.bp_tramp_var;
|
||||
g_assert (ins->opcode == OP_REGOFFSET);
|
||||
|
||||
amd64_mov_reg_imm (code, AMD64_R11, (guint64)&bp_trampoline);
|
||||
amd64_mov_membase_reg (code, ins->inst_basereg, ins->inst_offset, AMD64_R11, 8);
|
||||
}
|
||||
}
|
||||
@@ -8471,7 +8443,6 @@ void
|
||||
mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip)
|
||||
{
|
||||
guint8 *code = ip;
|
||||
guint8 *orig_code = code;
|
||||
|
||||
if (ji->from_aot) {
|
||||
guint32 native_offset = ip - (guint8*)ji->code_start;
|
||||
@@ -8480,20 +8451,10 @@ mono_arch_set_breakpoint (MonoJitInfo *ji, guint8 *ip)
|
||||
g_assert (info->bp_addrs [native_offset] == 0);
|
||||
info->bp_addrs [native_offset] = mini_get_breakpoint_trampoline ();
|
||||
} else {
|
||||
/*
|
||||
* In production, we will use int3 (has to fix the size in the md
|
||||
* file). But that could confuse gdb, so during development, we emit a SIGSEGV
|
||||
* instead.
|
||||
*/
|
||||
g_assert (code [0] == 0x90);
|
||||
if (breakpoint_size == 8) {
|
||||
amd64_mov_reg_mem (code, AMD64_R11, (guint64)bp_trigger_page, 4);
|
||||
} else {
|
||||
amd64_mov_reg_imm_size (code, AMD64_R11, (guint64)bp_trigger_page, 8);
|
||||
amd64_mov_reg_membase (code, AMD64_R11, AMD64_R11, 0, 4);
|
||||
}
|
||||
|
||||
g_assert (code - orig_code == breakpoint_size);
|
||||
/* ip points to a mov r11, 0 */
|
||||
g_assert (code [0] == 0x41);
|
||||
g_assert (code [1] == 0xbb);
|
||||
amd64_mov_reg_imm (code, AMD64_R11, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8506,7 +8467,6 @@ void
|
||||
mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip)
|
||||
{
|
||||
guint8 *code = ip;
|
||||
int i;
|
||||
|
||||
if (ji->from_aot) {
|
||||
guint32 native_offset = ip - (guint8*)ji->code_start;
|
||||
@@ -8514,28 +8474,15 @@ mono_arch_clear_breakpoint (MonoJitInfo *ji, guint8 *ip)
|
||||
|
||||
info->bp_addrs [native_offset] = NULL;
|
||||
} else {
|
||||
for (i = 0; i < breakpoint_size; ++i)
|
||||
x86_nop (code);
|
||||
amd64_mov_reg_imm (code, AMD64_R11, 0);
|
||||
}
|
||||
}
|
||||
|
||||
gboolean
|
||||
mono_arch_is_breakpoint_event (void *info, void *sigctx)
|
||||
{
|
||||
#ifdef HOST_WIN32
|
||||
EXCEPTION_RECORD* einfo = ((EXCEPTION_POINTERS*)info)->ExceptionRecord;
|
||||
if (einfo->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && (gpointer)einfo->ExceptionInformation [1] == bp_trigger_page)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
#else
|
||||
siginfo_t* sinfo = (siginfo_t*) info;
|
||||
/* Sometimes the address is off by 4 */
|
||||
if (sinfo->si_addr >= bp_trigger_page && (guint8*)sinfo->si_addr <= (guint8*)bp_trigger_page + 128)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
/* We use soft breakpoints on amd64 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8547,11 +8494,7 @@ mono_arch_is_breakpoint_event (void *info, void *sigctx)
|
||||
void
|
||||
mono_arch_skip_breakpoint (MonoContext *ctx, MonoJitInfo *ji)
|
||||
{
|
||||
if (ji->from_aot) {
|
||||
/* The breakpoint instruction is a call */
|
||||
} else {
|
||||
MONO_CONTEXT_SET_IP (ctx, (guint8*)MONO_CONTEXT_GET_IP (ctx) + breakpoint_fault_size);
|
||||
}
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8562,7 +8505,6 @@ mono_arch_skip_breakpoint (MonoContext *ctx, MonoJitInfo *ji)
|
||||
void
|
||||
mono_arch_start_single_stepping (void)
|
||||
{
|
||||
mono_mprotect (ss_trigger_page, mono_pagesize (), 0);
|
||||
ss_trampoline = mini_get_single_step_trampoline ();
|
||||
}
|
||||
|
||||
@@ -8574,7 +8516,6 @@ mono_arch_start_single_stepping (void)
|
||||
void
|
||||
mono_arch_stop_single_stepping (void)
|
||||
{
|
||||
mono_mprotect (ss_trigger_page, mono_pagesize (), MONO_MMAP_READ);
|
||||
ss_trampoline = NULL;
|
||||
}
|
||||
|
||||
@@ -8587,20 +8528,8 @@ mono_arch_stop_single_stepping (void)
|
||||
gboolean
|
||||
mono_arch_is_single_step_event (void *info, void *sigctx)
|
||||
{
|
||||
#ifdef HOST_WIN32
|
||||
EXCEPTION_RECORD* einfo = ((EXCEPTION_POINTERS*)info)->ExceptionRecord;
|
||||
if (einfo->ExceptionCode == EXCEPTION_ACCESS_VIOLATION && (gpointer)einfo->ExceptionInformation [1] == ss_trigger_page)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
#else
|
||||
siginfo_t* sinfo = (siginfo_t*) info;
|
||||
/* Sometimes the address is off by 4 */
|
||||
if (sinfo->si_addr >= ss_trigger_page && (guint8*)sinfo->si_addr <= (guint8*)ss_trigger_page + 128)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
#endif
|
||||
/* We use soft breakpoints on amd64 */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8612,7 +8541,7 @@ mono_arch_is_single_step_event (void *info, void *sigctx)
|
||||
void
|
||||
mono_arch_skip_single_step (MonoContext *ctx)
|
||||
{
|
||||
MONO_CONTEXT_SET_IP (ctx, (guint8*)MONO_CONTEXT_GET_IP (ctx) + single_step_fault_size);
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -209,11 +209,10 @@ typedef struct MonoCompileArch {
|
||||
gpointer seq_point_info_var;
|
||||
gpointer ss_trigger_page_var;
|
||||
gpointer ss_tramp_var;
|
||||
gpointer bp_tramp_var;
|
||||
gpointer lmf_var;
|
||||
} MonoCompileArch;
|
||||
|
||||
|
||||
|
||||
#ifdef TARGET_WIN32
|
||||
#define PARAM_REGS 4
|
||||
#else
|
||||
|
||||
+26
-19
@@ -103,6 +103,7 @@ static gboolean v5_supported = FALSE;
|
||||
static gboolean v6_supported = FALSE;
|
||||
static gboolean v7_supported = FALSE;
|
||||
static gboolean v7s_supported = FALSE;
|
||||
static gboolean v7k_supported = FALSE;
|
||||
static gboolean thumb_supported = FALSE;
|
||||
static gboolean thumb2_supported = FALSE;
|
||||
/*
|
||||
@@ -970,6 +971,7 @@ mono_arch_init (void)
|
||||
v6_supported = mono_hwcap_arm_is_v6;
|
||||
v7_supported = mono_hwcap_arm_is_v7;
|
||||
v7s_supported = mono_hwcap_arm_is_v7s;
|
||||
v7k_supported = mono_hwcap_arm_is_v7k;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
/* iOS is special-cased here because we don't yet
|
||||
@@ -991,6 +993,7 @@ mono_arch_init (void)
|
||||
v6_supported = cpu_arch [4] >= '6';
|
||||
v7_supported = cpu_arch [4] >= '7';
|
||||
v7s_supported = strncmp (cpu_arch, "armv7s", 6) == 0;
|
||||
v7k_supported = strncmp (cpu_arch, "armv7k", 6) == 0;
|
||||
}
|
||||
|
||||
thumb_supported = strstr (cpu_arch, "thumb") != NULL;
|
||||
@@ -1036,7 +1039,7 @@ mono_arch_cpu_enumerate_simd_versions (void)
|
||||
gboolean
|
||||
mono_arch_opcode_needs_emulation (MonoCompile *cfg, int opcode)
|
||||
{
|
||||
if (v7s_supported) {
|
||||
if (v7s_supported || v7k_supported) {
|
||||
switch (opcode) {
|
||||
case OP_IDIV:
|
||||
case OP_IREM:
|
||||
@@ -4884,20 +4887,20 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
ARM_AND_REG_IMM (code, ins->dreg, ins->sreg1, imm8, rot_amount);
|
||||
break;
|
||||
case OP_IDIV:
|
||||
g_assert (v7s_supported);
|
||||
g_assert (v7s_supported || v7k_supported);
|
||||
ARM_SDIV (code, ins->dreg, ins->sreg1, ins->sreg2);
|
||||
break;
|
||||
case OP_IDIV_UN:
|
||||
g_assert (v7s_supported);
|
||||
g_assert (v7s_supported || v7k_supported);
|
||||
ARM_UDIV (code, ins->dreg, ins->sreg1, ins->sreg2);
|
||||
break;
|
||||
case OP_IREM:
|
||||
g_assert (v7s_supported);
|
||||
g_assert (v7s_supported || v7k_supported);
|
||||
ARM_SDIV (code, ARMREG_LR, ins->sreg1, ins->sreg2);
|
||||
ARM_MLS (code, ins->dreg, ARMREG_LR, ins->sreg2, ins->sreg1);
|
||||
break;
|
||||
case OP_IREM_UN:
|
||||
g_assert (v7s_supported);
|
||||
g_assert (v7s_supported || v7k_supported);
|
||||
ARM_UDIV (code, ARMREG_LR, ins->sreg1, ins->sreg2);
|
||||
ARM_MLS (code, ins->dreg, ARMREG_LR, ins->sreg2, ins->sreg1);
|
||||
break;
|
||||
@@ -5214,8 +5217,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
}
|
||||
case OP_LOCALLOC: {
|
||||
/* round the size to 8 bytes */
|
||||
ARM_ADD_REG_IMM8 (code, ins->dreg, ins->sreg1, 7);
|
||||
ARM_BIC_REG_IMM8 (code, ins->dreg, ins->dreg, 7);
|
||||
ARM_ADD_REG_IMM8 (code, ins->dreg, ins->sreg1, (MONO_ARCH_FRAME_ALIGNMENT - 1));
|
||||
ARM_BIC_REG_IMM8 (code, ins->dreg, ins->dreg, (MONO_ARCH_FRAME_ALIGNMENT - 1));
|
||||
ARM_SUB_REG_REG (code, ARMREG_SP, ARMREG_SP, ins->dreg);
|
||||
/* memzero the area: dreg holds the size, sp is the pointer */
|
||||
if (ins->flags & MONO_INST_INIT) {
|
||||
@@ -5290,14 +5293,15 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
}
|
||||
case OP_START_HANDLER: {
|
||||
MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region);
|
||||
int param_area = ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT);
|
||||
int i, rot_amount;
|
||||
|
||||
/* Reserve a param area, see filter-stack.exe */
|
||||
if (cfg->param_area) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (cfg->param_area, &rot_amount)) >= 0) {
|
||||
if (param_area) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (param_area, &rot_amount)) >= 0) {
|
||||
ARM_SUB_REG_IMM (code, ARMREG_SP, ARMREG_SP, i, rot_amount);
|
||||
} else {
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_IP, cfg->param_area);
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_IP, param_area);
|
||||
ARM_SUB_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_IP);
|
||||
}
|
||||
}
|
||||
@@ -5312,14 +5316,15 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
}
|
||||
case OP_ENDFILTER: {
|
||||
MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region);
|
||||
int param_area = ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT);
|
||||
int i, rot_amount;
|
||||
|
||||
/* Free the param area */
|
||||
if (cfg->param_area) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (cfg->param_area, &rot_amount)) >= 0) {
|
||||
if (param_area) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (param_area, &rot_amount)) >= 0) {
|
||||
ARM_ADD_REG_IMM (code, ARMREG_SP, ARMREG_SP, i, rot_amount);
|
||||
} else {
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_IP, cfg->param_area);
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_IP, param_area);
|
||||
ARM_ADD_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_IP);
|
||||
}
|
||||
}
|
||||
@@ -5338,14 +5343,15 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
|
||||
}
|
||||
case OP_ENDFINALLY: {
|
||||
MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region);
|
||||
int param_area = ALIGN_TO (cfg->param_area, MONO_ARCH_FRAME_ALIGNMENT);
|
||||
int i, rot_amount;
|
||||
|
||||
/* Free the param area */
|
||||
if (cfg->param_area) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (cfg->param_area, &rot_amount)) >= 0) {
|
||||
if (param_area) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (param_area, &rot_amount)) >= 0) {
|
||||
ARM_ADD_REG_IMM (code, ARMREG_SP, ARMREG_SP, i, rot_amount);
|
||||
} else {
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_IP, cfg->param_area);
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_IP, param_area);
|
||||
ARM_ADD_REG_REG (code, ARMREG_SP, ARMREG_SP, ARMREG_IP);
|
||||
}
|
||||
}
|
||||
@@ -6262,8 +6268,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
|
||||
}
|
||||
|
||||
/* the stack used in the pushed regs */
|
||||
if (prev_sp_offset & 4)
|
||||
alloc_size += 4;
|
||||
alloc_size += ALIGN_TO (prev_sp_offset, MONO_ARCH_FRAME_ALIGNMENT) - prev_sp_offset;
|
||||
cfg->stack_usage = alloc_size;
|
||||
if (alloc_size) {
|
||||
if ((i = mono_arm_is_rotated_imm8 (alloc_size, &rot_amount)) >= 0) {
|
||||
@@ -6316,7 +6321,6 @@ mono_arch_emit_prolog (MonoCompile *cfg)
|
||||
code = mono_arm_emit_load_imm (code, ARMREG_R0, (guint32)cfg->method);
|
||||
mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_INTERNAL_METHOD, "mono_arm_unaligned_stack");
|
||||
code = emit_call_seq (cfg, code);
|
||||
code = emit_call_reg (code, ARMREG_LR);
|
||||
arm_patch (buf [0], code);
|
||||
}
|
||||
*/
|
||||
@@ -7678,6 +7682,9 @@ mono_arch_set_target (char *mtriple)
|
||||
if (strstr (mtriple, "armv7s")) {
|
||||
v7s_supported = TRUE;
|
||||
}
|
||||
if (strstr (mtriple, "armv7k")) {
|
||||
v7k_supported = TRUE;
|
||||
}
|
||||
if (strstr (mtriple, "thumbv7s")) {
|
||||
v5_supported = TRUE;
|
||||
v6_supported = TRUE;
|
||||
|
||||
@@ -118,7 +118,11 @@
|
||||
|
||||
#define MONO_ARCH_INST_REGPAIR_REG2(desc,hreg1) ((desc) == 'l' || (desc) == 'f' || (desc) == 'g' ? ARM_MSW_REG : -1)
|
||||
|
||||
#ifdef TARGET_WATCHOS
|
||||
#define MONO_ARCH_FRAME_ALIGNMENT 16
|
||||
#else
|
||||
#define MONO_ARCH_FRAME_ALIGNMENT 8
|
||||
#endif
|
||||
|
||||
/* fixme: align to 16byte instead of 32byte (we align to 32byte to get
|
||||
* reproduceable results for benchmarks */
|
||||
|
||||
@@ -658,6 +658,14 @@ register_opcode_emulation (int opcode, const char *name, const char *sigstr, gpo
|
||||
{
|
||||
#ifndef DISABLE_JIT
|
||||
mini_register_opcode_emulation (opcode, name, sigstr, func, symbol, no_throw);
|
||||
#else
|
||||
MonoMethodSignature *sig = mono_create_icall_signature (sigstr);
|
||||
|
||||
g_assert (!sig->hasthis);
|
||||
g_assert (sig->param_count < 3);
|
||||
|
||||
/* Opcode emulation functions are assumed to don't call mono_raise_exception () */
|
||||
mono_register_jit_icall_full (func, name, sig, no_throw, TRUE, symbol);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -972,18 +972,18 @@ mono_arch_create_sdb_trampoline (gboolean single_step, MonoTrampInfo **info, gbo
|
||||
code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_single_step_from_context");
|
||||
else
|
||||
code = mono_arch_emit_load_aotconst (buf, code, &ji, MONO_PATCH_INFO_JIT_ICALL_ADDR, "debugger_agent_breakpoint_from_context");
|
||||
amd64_call_reg (code, AMD64_R11);
|
||||
} else {
|
||||
if (single_step)
|
||||
amd64_call_code (code, debugger_agent_single_step_from_context);
|
||||
amd64_mov_reg_imm (code, AMD64_R11, debugger_agent_single_step_from_context);
|
||||
else
|
||||
amd64_call_code (code, debugger_agent_breakpoint_from_context);
|
||||
}
|
||||
amd64_mov_reg_imm (code, AMD64_R11, debugger_agent_breakpoint_from_context);
|
||||
}
|
||||
amd64_call_reg (code, AMD64_R11);
|
||||
|
||||
/* Restore registers from ctx */
|
||||
for (i = 0; i < AMD64_NREG; ++i) {
|
||||
if (i != AMD64_RIP && i != AMD64_RSP && i != AMD64_RBP)
|
||||
amd64_mov_reg_membase (code, AMD64_RSP, i, gregs_offset + (i * sizeof (mgreg_t)), sizeof (mgreg_t));
|
||||
amd64_mov_reg_membase (code, i, AMD64_RSP, gregs_offset + (i * sizeof (mgreg_t)), sizeof (mgreg_t));
|
||||
}
|
||||
amd64_mov_reg_membase (code, AMD64_R11, AMD64_RSP, gregs_offset + (AMD64_RBP * sizeof (mgreg_t)), sizeof (mgreg_t));
|
||||
amd64_mov_membase_reg (code, AMD64_RBP, 0, AMD64_R11, sizeof (mgreg_t));
|
||||
|
||||
@@ -34,10 +34,10 @@
|
||||
/* h indicates whether to hide or just tag.
|
||||
* (-!!h ^ p) is used instead of (h ? ~p : p) to avoid multiple mentions of p.
|
||||
*/
|
||||
#define MONO_GC_HIDE_POINTER(p,t,h) ((gpointer)(((-(size_t)!!(h) ^ (size_t)(p)) & ~3UL) | ((t) & 3UL)))
|
||||
#define MONO_GC_REVEAL_POINTER(p,h) ((gpointer)((-(size_t)!!(h) ^ (size_t)(p)) & ~3UL))
|
||||
#define MONO_GC_HIDE_POINTER(p,t,h) ((gpointer)(((-(size_t)!!(h) ^ (size_t)(p)) & ~(size_t)3) | ((t) & (size_t)3)))
|
||||
#define MONO_GC_REVEAL_POINTER(p,h) ((gpointer)((-(size_t)!!(h) ^ (size_t)(p)) & ~(size_t)3))
|
||||
|
||||
#define MONO_GC_POINTER_TAG(p) ((size_t)(p) & 3UL)
|
||||
#define MONO_GC_POINTER_TAG(p) ((size_t)(p) & (size_t)3)
|
||||
|
||||
#define MONO_GC_HANDLE_OCCUPIED_MASK (1)
|
||||
#define MONO_GC_HANDLE_VALID_MASK (2)
|
||||
|
||||
@@ -156,8 +156,7 @@ static HandleData gc_handles [] = {
|
||||
static HandleData *
|
||||
gc_handles_for_type (GCHandleType type)
|
||||
{
|
||||
g_assert (type < HANDLE_TYPE_MAX);
|
||||
return &gc_handles [type];
|
||||
return type < HANDLE_TYPE_MAX ? &gc_handles [type] : NULL;
|
||||
}
|
||||
|
||||
/* This assumes that the world is stopped. */
|
||||
@@ -439,6 +438,9 @@ mono_gchandle_get_target (guint32 gchandle)
|
||||
guint index = MONO_GC_HANDLE_SLOT (gchandle);
|
||||
guint type = MONO_GC_HANDLE_TYPE (gchandle);
|
||||
HandleData *handles = gc_handles_for_type (type);
|
||||
/* Invalid handles are possible; accessing one should produce NULL. (#34276) */
|
||||
if (!handles)
|
||||
return NULL;
|
||||
guint bucket, offset;
|
||||
g_assert (index < handles->capacity);
|
||||
bucketize (index, &bucket, &offset);
|
||||
@@ -451,6 +453,8 @@ sgen_gchandle_set_target (guint32 gchandle, GCObject *obj)
|
||||
guint index = MONO_GC_HANDLE_SLOT (gchandle);
|
||||
guint type = MONO_GC_HANDLE_TYPE (gchandle);
|
||||
HandleData *handles = gc_handles_for_type (type);
|
||||
if (!handles)
|
||||
return;
|
||||
guint bucket, offset;
|
||||
gpointer slot;
|
||||
|
||||
@@ -499,6 +503,8 @@ sgen_gchandle_get_metadata (guint32 gchandle)
|
||||
guint index = MONO_GC_HANDLE_SLOT (gchandle);
|
||||
guint type = MONO_GC_HANDLE_TYPE (gchandle);
|
||||
HandleData *handles = gc_handles_for_type (type);
|
||||
if (!handles)
|
||||
return NULL;
|
||||
guint bucket, offset;
|
||||
if (index >= handles->capacity)
|
||||
return NULL;
|
||||
@@ -520,6 +526,8 @@ mono_gchandle_free (guint32 gchandle)
|
||||
guint index = MONO_GC_HANDLE_SLOT (gchandle);
|
||||
guint type = MONO_GC_HANDLE_TYPE (gchandle);
|
||||
HandleData *handles = gc_handles_for_type (type);
|
||||
if (!handles)
|
||||
return;
|
||||
guint bucket, offset;
|
||||
gpointer slot;
|
||||
bucketize (index, &bucket, &offset);
|
||||
|
||||
@@ -611,6 +611,7 @@ TEST_IL_SRC= \
|
||||
cpblkTest.il \
|
||||
vbinterface.il \
|
||||
calliTest.il \
|
||||
calliGenericTest.il \
|
||||
ckfiniteTest.il \
|
||||
fault-handler.il \
|
||||
locallocTest.il \
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
//Tests ldftn and calli with generic return signature
|
||||
|
||||
.assembly extern mscorlib{}
|
||||
.assembly someTest{}
|
||||
.module someTest
|
||||
|
||||
.class public auto ansi beforefieldinit Test`1<T>
|
||||
extends [mscorlib]System.Object
|
||||
{
|
||||
// method line 1
|
||||
.method public hidebysig
|
||||
static default void test (native int ptr) cil managed
|
||||
{
|
||||
.maxstack 8
|
||||
ldarg ptr
|
||||
calli !T()
|
||||
call void class [mscorlib]System.Console::WriteLine(int32)
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
.class private auto ansi someTest
|
||||
extends [mscorlib]System.Object {
|
||||
|
||||
.method public static void go() cil managed {
|
||||
.entrypoint
|
||||
|
||||
ldftn int32 [mscorlib]System.Environment::get_ProcessorCount()
|
||||
call void class Test`1<int32>::test(native int)
|
||||
ret
|
||||
}
|
||||
}
|
||||
@@ -166,7 +166,7 @@ arch_sources += mach-support-arm.c
|
||||
endif
|
||||
|
||||
if ARM64
|
||||
arch_sources += mach-support-arm.c
|
||||
arch_sources += mach-support-arm64.c
|
||||
endif
|
||||
|
||||
else
|
||||
|
||||
@@ -18,6 +18,9 @@
|
||||
#include "utils/mono-sigcontext.h"
|
||||
#include "mach-support.h"
|
||||
|
||||
//For reg numbers
|
||||
#include <mono/arch/amd64/amd64-codegen.h>
|
||||
|
||||
/* Known offsets used for TLS storage*/
|
||||
|
||||
/* All OSX versions up to 10.8 */
|
||||
@@ -73,6 +76,28 @@ mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
|
||||
*arch_state = ctx->__ss;
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
|
||||
{
|
||||
x86_thread_state64_t *arch_state = (x86_thread_state64_t *) state;
|
||||
context->gregs [AMD64_RAX] = arch_state->__rax;
|
||||
context->gregs [AMD64_RBX] = arch_state->__rbx;
|
||||
context->gregs [AMD64_RCX] = arch_state->__rcx;
|
||||
context->gregs [AMD64_RDX] = arch_state->__rdx;
|
||||
context->gregs [AMD64_RDI] = arch_state->__rdi;
|
||||
context->gregs [AMD64_RBP] = arch_state->__rbp;
|
||||
context->gregs [AMD64_RSP] = arch_state->__rsp;
|
||||
context->gregs [AMD64_R8] = arch_state->__r8;
|
||||
context->gregs [AMD64_R9] = arch_state->__r9;
|
||||
context->gregs [AMD64_R10] = arch_state->__r10;
|
||||
context->gregs [AMD64_R11] = arch_state->__r11;
|
||||
context->gregs [AMD64_R12] = arch_state->__r12;
|
||||
context->gregs [AMD64_R13] = arch_state->__r13;
|
||||
context->gregs [AMD64_R14] = arch_state->__r14;
|
||||
context->gregs [AMD64_R15] = arch_state->__r15;
|
||||
context->gregs [AMD64_RIP] = arch_state->__rip;
|
||||
}
|
||||
|
||||
int
|
||||
mono_mach_arch_get_thread_state_size ()
|
||||
{
|
||||
|
||||
@@ -46,81 +46,61 @@ void *
|
||||
mono_mach_arch_get_ip (thread_state_t state)
|
||||
{
|
||||
/* Can't use unified_thread_state on !ARM64 since this has to compile on armv6 too */
|
||||
#ifdef TARGET_ARM64
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
|
||||
return (void *) arch_state->ts_64.__pc;
|
||||
#else
|
||||
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
|
||||
|
||||
return (void *) arch_state->__pc;
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
mono_mach_arch_get_sp (thread_state_t state)
|
||||
{
|
||||
#ifdef TARGET_ARM64
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
|
||||
return (void *) arch_state->ts_64.__sp;
|
||||
#else
|
||||
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
|
||||
|
||||
return (void *) arch_state->__sp;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
mono_mach_arch_get_mcontext_size ()
|
||||
{
|
||||
#ifdef TARGET_ARM64
|
||||
return sizeof (struct __darwin_mcontext64);
|
||||
#else
|
||||
return sizeof (struct __darwin_mcontext);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
|
||||
{
|
||||
#ifdef TARGET_ARM64
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
|
||||
|
||||
ctx->__ss = arch_state->ts_64;
|
||||
#else
|
||||
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
|
||||
struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
|
||||
|
||||
ctx->__ss = *arch_state;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
|
||||
{
|
||||
#ifdef TARGET_ARM64
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
|
||||
|
||||
arch_state->ts_64 = ctx->__ss;
|
||||
#else
|
||||
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
|
||||
struct __darwin_mcontext *ctx = (struct __darwin_mcontext *) context;
|
||||
|
||||
*arch_state = ctx->__ss;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
|
||||
{
|
||||
int i;
|
||||
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
|
||||
for (i = 0; i < 13; ++i)
|
||||
context->regs [i] = arch_state->__r [i];
|
||||
context->regs [ARMREG_R13] = arch_state->__sp;
|
||||
context->regs [ARMREG_R14] = arch_state->__lr;
|
||||
context->regs [ARMREG_R15] = arch_state->__pc;
|
||||
context->pc = arch_state->__pc;
|
||||
context->cpsr = arch_state->__cpsr;
|
||||
}
|
||||
|
||||
int
|
||||
mono_mach_arch_get_thread_state_size ()
|
||||
{
|
||||
#ifdef TARGET_ARM64
|
||||
return sizeof (arm_unified_thread_state_t);
|
||||
#else
|
||||
return sizeof (arm_thread_state_t);
|
||||
#endif
|
||||
}
|
||||
|
||||
kern_return_t
|
||||
@@ -129,21 +109,12 @@ mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mac
|
||||
#if defined(HOST_WATCHOS)
|
||||
g_error ("thread_get_state() is not supported by this platform");
|
||||
#else
|
||||
#ifdef TARGET_ARM64
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
kern_return_t ret;
|
||||
|
||||
*count = ARM_UNIFIED_THREAD_STATE_COUNT;
|
||||
|
||||
ret = thread_get_state (thread, ARM_UNIFIED_THREAD_STATE, (thread_state_t) arch_state, count);
|
||||
#else
|
||||
arm_thread_state_t *arch_state = (arm_thread_state_t *) state;
|
||||
kern_return_t ret;
|
||||
|
||||
*count = ARM_THREAD_STATE_COUNT;
|
||||
|
||||
ret = thread_get_state (thread, ARM_THREAD_STATE, (thread_state_t) arch_state, count);
|
||||
#endif
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
@@ -153,13 +124,9 @@ mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mac
|
||||
{
|
||||
#if defined(HOST_WATCHOS)
|
||||
g_error ("thread_set_state() is not supported by this platform");
|
||||
#else
|
||||
#ifdef TARGET_ARM64
|
||||
return thread_set_state (thread, ARM_UNIFIED_THREAD_STATE, state, count);
|
||||
#else
|
||||
return thread_set_state (thread, ARM_THREAD_STATE, state, count);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void *
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* mach-support-arm.c: mach support for ARM
|
||||
*
|
||||
* Authors:
|
||||
* Geoff Norton (gnorton@novell.com)
|
||||
* Rodrigo Kumpera (kumpera@gmail.com)
|
||||
*
|
||||
* (C) 2010 Novell, Inc.
|
||||
* (C) 2011 Xamarin, Inc.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if defined(__MACH__)
|
||||
#include <stdint.h>
|
||||
#include <glib.h>
|
||||
#include <pthread.h>
|
||||
#include "utils/mono-sigcontext.h"
|
||||
#include "utils/mono-compiler.h"
|
||||
#include "mach-support.h"
|
||||
|
||||
/* _mcontext.h now defines __darwin_mcontext32, not __darwin_mcontext, starting with Xcode 5.1 */
|
||||
#ifdef _STRUCT_MCONTEXT32
|
||||
#define __darwin_mcontext __darwin_mcontext32
|
||||
#endif
|
||||
|
||||
/* Known offsets used for TLS storage*/
|
||||
|
||||
|
||||
static const int known_tls_offsets[] = {
|
||||
0x48, /*Found on iOS 6 */
|
||||
0xA4,
|
||||
0xA8,
|
||||
};
|
||||
|
||||
#define TLS_PROBE_COUNT (sizeof (known_tls_offsets) / sizeof (int))
|
||||
|
||||
/* This is 2 slots less than the known low */
|
||||
#define TLS_PROBE_LOW_WATERMARK 0x40
|
||||
/* This is 24 slots above the know high, which is the same diff as the knowns high-low*/
|
||||
#define TLS_PROBE_HIGH_WATERMARK 0x108
|
||||
|
||||
static int tls_vector_offset;
|
||||
|
||||
void *
|
||||
mono_mach_arch_get_ip (thread_state_t state)
|
||||
{
|
||||
/* Can't use unified_thread_state on !ARM64 since this has to compile on armv6 too */
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
|
||||
return (void *) arch_state->ts_64.__pc;
|
||||
}
|
||||
|
||||
void *
|
||||
mono_mach_arch_get_sp (thread_state_t state)
|
||||
{
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
|
||||
return (void *) arch_state->ts_64.__sp;
|
||||
}
|
||||
|
||||
int
|
||||
mono_mach_arch_get_mcontext_size ()
|
||||
{
|
||||
return sizeof (struct __darwin_mcontext64);
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context)
|
||||
{
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
|
||||
|
||||
ctx->__ss = arch_state->ts_64;
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
|
||||
{
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
struct __darwin_mcontext64 *ctx = (struct __darwin_mcontext64 *) context;
|
||||
|
||||
arch_state->ts_64 = ctx->__ss;
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
|
||||
{
|
||||
int i;
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
for (i = 0; i < 29; ++i)
|
||||
context->regs [i] = arch_state->ts_64.__x [i];
|
||||
|
||||
context->regs [ARMREG_R29] = arch_state->ts_64.__fp;
|
||||
context->regs [ARMREG_R30] = arch_state->ts_64.__lr;
|
||||
context->regs [ARMREG_SP] = arch_state->ts_64.__sp;
|
||||
context->pc = arch_state->ts_64.__pc;
|
||||
}
|
||||
|
||||
int
|
||||
mono_mach_arch_get_thread_state_size ()
|
||||
{
|
||||
return sizeof (arm_unified_thread_state_t);
|
||||
}
|
||||
|
||||
kern_return_t
|
||||
mono_mach_arch_get_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t *count)
|
||||
{
|
||||
arm_unified_thread_state_t *arch_state = (arm_unified_thread_state_t *) state;
|
||||
kern_return_t ret;
|
||||
|
||||
*count = ARM_UNIFIED_THREAD_STATE_COUNT;
|
||||
|
||||
ret = thread_get_state (thread, ARM_UNIFIED_THREAD_STATE, (thread_state_t) arch_state, count);
|
||||
return ret;
|
||||
}
|
||||
|
||||
kern_return_t
|
||||
mono_mach_arch_set_thread_state (thread_port_t thread, thread_state_t state, mach_msg_type_number_t count)
|
||||
{
|
||||
return thread_set_state (thread, ARM_UNIFIED_THREAD_STATE, state, count);
|
||||
}
|
||||
|
||||
void *
|
||||
mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
|
||||
{
|
||||
/* Mach stores TLS values in a hidden array inside the pthread_t structure
|
||||
* They are keyed off a giant array from a known offset into the pointer. This value
|
||||
* is baked into their pthread_getspecific implementation
|
||||
*/
|
||||
intptr_t *p = (intptr_t *) thread;
|
||||
intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
|
||||
g_assert (tls_vector_offset != -1);
|
||||
|
||||
return (void *) &tsd [key];
|
||||
}
|
||||
|
||||
void *
|
||||
mono_mach_arch_get_tls_value_from_thread (pthread_t thread, guint32 key)
|
||||
{
|
||||
return *(void**)mono_mach_get_tls_address_from_thread (thread, key);
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_init (pthread_key_t key)
|
||||
{
|
||||
int i;
|
||||
void *old_value = pthread_getspecific (key);
|
||||
void *canary = (void*)0xDEADBEEFu;
|
||||
|
||||
pthread_key_create (&key, NULL);
|
||||
g_assert (old_value != canary);
|
||||
|
||||
pthread_setspecific (key, canary);
|
||||
|
||||
/*First we probe for cats*/
|
||||
for (i = 0; i < TLS_PROBE_COUNT; ++i) {
|
||||
tls_vector_offset = known_tls_offsets [i];
|
||||
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
|
||||
goto ok;
|
||||
}
|
||||
|
||||
/*Fallback to scanning a large range of offsets*/
|
||||
for (i = TLS_PROBE_LOW_WATERMARK; i <= TLS_PROBE_HIGH_WATERMARK; i += 4) {
|
||||
tls_vector_offset = i;
|
||||
if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary) {
|
||||
g_warning ("Found new TLS offset at %d", i);
|
||||
goto ok;
|
||||
}
|
||||
}
|
||||
|
||||
tls_vector_offset = -1;
|
||||
g_warning ("could not discover the mach TLS offset");
|
||||
ok:
|
||||
pthread_setspecific (key, old_value);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -46,6 +46,11 @@ mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
int
|
||||
mono_mach_arch_get_thread_state_size ()
|
||||
|
||||
@@ -72,6 +72,22 @@ mono_mach_arch_mcontext_to_thread_state (void *context, thread_state_t state)
|
||||
*arch_state = ctx->__ss;
|
||||
}
|
||||
|
||||
void
|
||||
mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context)
|
||||
{
|
||||
x86_thread_state32_t *arch_state = (x86_thread_state32_t *) state;
|
||||
context->eax = arch_state->__eax;
|
||||
context->ebx = arch_state->__ebx;
|
||||
context->ecx = arch_state->__ecx;
|
||||
context->edx = arch_state->__edx;
|
||||
context->ebp = arch_state->__ebp;
|
||||
context->esp = arch_state->__esp;
|
||||
context->esi = arch_state->__edi;
|
||||
context->edi = arch_state->__esi;
|
||||
context->eip = arch_state->__eip;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mono_mach_arch_get_thread_state_size ()
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <glib.h>
|
||||
#include <pthread.h>
|
||||
#include "mono/utils/mono-compiler.h"
|
||||
#include "mono/utils/mono-context.h"
|
||||
#include <mach/task.h>
|
||||
#include <mach/mach_port.h>
|
||||
#include <mach/mach_init.h>
|
||||
@@ -30,6 +31,7 @@ void mono_mach_init (pthread_key_t key);
|
||||
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);
|
||||
void mono_mach_arch_thread_state_to_mono_context (thread_state_t state, MonoContext *context);
|
||||
|
||||
int mono_mach_arch_get_thread_state_size (void);
|
||||
kern_return_t mono_mach_get_threads (thread_act_array_t *threads, guint32 *count);
|
||||
|
||||
+12
-40
@@ -45,6 +45,8 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
|
||||
mctx->esi = 0xDEADBEEF;
|
||||
mctx->edi = 0xDEADBEEF;
|
||||
mctx->eip = 0xDEADBEEF;
|
||||
#elif MONO_CROSS_COMPILE
|
||||
g_assert_not_reached ();
|
||||
#elif defined(MONO_SIGNAL_USE_SIGACTION)
|
||||
ucontext_t *ctx = (ucontext_t*)sigctx;
|
||||
|
||||
@@ -89,6 +91,8 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
|
||||
{
|
||||
#if defined(__native_client__) || defined(HOST_WATCHOS)
|
||||
printf("WARNING: mono_arch_monoctx_to_sigctx() called!\n");
|
||||
#elif MONO_CROSS_COMPILE
|
||||
g_assert_not_reached ();
|
||||
#elif defined(MONO_SIGNAL_USE_SIGACTION)
|
||||
ucontext_t *ctx = (ucontext_t*)sigctx;
|
||||
|
||||
@@ -143,7 +147,9 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
|
||||
printf("WARNING: mono_arch_sigctx_to_monoctx() called!\n");
|
||||
#endif
|
||||
|
||||
#if defined(MONO_SIGNAL_USE_SIGACTION)
|
||||
#ifdef MONO_CROSS_COMPILE
|
||||
g_assert_not_reached ();
|
||||
#elif defined(UCONTEXT_REG_RAX)
|
||||
ucontext_t *ctx = (ucontext_t*)sigctx;
|
||||
|
||||
mctx->gregs [AMD64_RAX] = UCONTEXT_REG_RAX (ctx);
|
||||
@@ -184,25 +190,7 @@ mono_sigctx_to_monoctx (void *sigctx, MonoContext *mctx)
|
||||
mctx->gregs [AMD64_R14] = context->R14;
|
||||
mctx->gregs [AMD64_R15] = context->R15;
|
||||
#else
|
||||
MonoContext *ctx = (MonoContext *)sigctx;
|
||||
|
||||
mctx->gregs [AMD64_RAX] = ctx->gregs [AMD64_RAX];
|
||||
mctx->gregs [AMD64_RBX] = ctx->gregs [AMD64_RBX];
|
||||
mctx->gregs [AMD64_RCX] = ctx->gregs [AMD64_RCX];
|
||||
mctx->gregs [AMD64_RDX] = ctx->gregs [AMD64_RDX];
|
||||
mctx->gregs [AMD64_RBP] = ctx->gregs [AMD64_RBP];
|
||||
mctx->gregs [AMD64_RSP] = ctx->gregs [AMD64_RSP];
|
||||
mctx->gregs [AMD64_RSI] = ctx->gregs [AMD64_RSI];
|
||||
mctx->gregs [AMD64_RDI] = ctx->gregs [AMD64_RDI];
|
||||
mctx->gregs [AMD64_R8] = ctx->gregs [AMD64_R8];
|
||||
mctx->gregs [AMD64_R9] = ctx->gregs [AMD64_R9];
|
||||
mctx->gregs [AMD64_R10] = ctx->gregs [AMD64_R10];
|
||||
mctx->gregs [AMD64_R11] = ctx->gregs [AMD64_R11];
|
||||
mctx->gregs [AMD64_R12] = ctx->gregs [AMD64_R12];
|
||||
mctx->gregs [AMD64_R13] = ctx->gregs [AMD64_R13];
|
||||
mctx->gregs [AMD64_R14] = ctx->gregs [AMD64_R14];
|
||||
mctx->gregs [AMD64_R15] = ctx->gregs [AMD64_R15];
|
||||
mctx->gregs [AMD64_RIP] = ctx->gregs [AMD64_RIP];
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -213,7 +201,9 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
|
||||
printf("WARNING: mono_arch_monoctx_to_sigctx() called!\n");
|
||||
#endif
|
||||
|
||||
#if defined(MONO_SIGNAL_USE_SIGACTION)
|
||||
#ifdef MONO_CROSS_COMPILE
|
||||
g_assert_not_reached ();
|
||||
#elif defined(UCONTEXT_REG_RAX)
|
||||
ucontext_t *ctx = (ucontext_t*)sigctx;
|
||||
|
||||
UCONTEXT_REG_RAX (ctx) = mctx->gregs [AMD64_RAX];
|
||||
@@ -254,25 +244,7 @@ mono_monoctx_to_sigctx (MonoContext *mctx, void *sigctx)
|
||||
context->R14 = mctx->gregs [AMD64_R14];
|
||||
context->R15 = mctx->gregs [AMD64_R15];
|
||||
#else
|
||||
MonoContext *ctx = (MonoContext *)sigctx;
|
||||
|
||||
ctx->gregs [AMD64_RAX] = mctx->gregs [AMD64_RAX];
|
||||
ctx->gregs [AMD64_RBX] = mctx->gregs [AMD64_RBX];
|
||||
ctx->gregs [AMD64_RCX] = mctx->gregs [AMD64_RCX];
|
||||
ctx->gregs [AMD64_RDX] = mctx->gregs [AMD64_RDX];
|
||||
ctx->gregs [AMD64_RBP] = mctx->gregs [AMD64_RBP];
|
||||
ctx->gregs [AMD64_RSP] = mctx->gregs [AMD64_RSP];
|
||||
ctx->gregs [AMD64_RSI] = mctx->gregs [AMD64_RSI];
|
||||
ctx->gregs [AMD64_RDI] = mctx->gregs [AMD64_RDI];
|
||||
ctx->gregs [AMD64_R8] = mctx->gregs [AMD64_R8];
|
||||
ctx->gregs [AMD64_R9] = mctx->gregs [AMD64_R9];
|
||||
ctx->gregs [AMD64_R10] = mctx->gregs [AMD64_R10];
|
||||
ctx->gregs [AMD64_R11] = mctx->gregs [AMD64_R11];
|
||||
ctx->gregs [AMD64_R12] = mctx->gregs [AMD64_R12];
|
||||
ctx->gregs [AMD64_R13] = mctx->gregs [AMD64_R13];
|
||||
ctx->gregs [AMD64_R14] = mctx->gregs [AMD64_R14];
|
||||
ctx->gregs [AMD64_R15] = mctx->gregs [AMD64_R15];
|
||||
ctx->gregs [AMD64_RIP] = mctx->gregs [AMD64_RIP];
|
||||
g_assert_not_reached ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -304,8 +304,14 @@ typedef struct {
|
||||
#if defined (HOST_APPLETVOS)
|
||||
|
||||
#define MONO_CONTEXT_GET_CURRENT(ctx) do { \
|
||||
fprintf (stderr, "MONO_CONTEXT_GET_CURRENT: Not implemented"); \
|
||||
g_error ("MONO_CONTEXT_GET_CURRENT: Not implemented"); \
|
||||
arm_unified_thread_state_t thread_state; \
|
||||
int state_flavor = ARM_UNIFIED_THREAD_STATE; \
|
||||
unsigned state_count = ARM_UNIFIED_THREAD_STATE_COUNT; \
|
||||
thread_port_t self = mach_thread_self (); \
|
||||
kern_return_t ret = thread_get_state (self, state_flavor, (thread_state_t) &thread_state, &state_count); \
|
||||
g_assert (ret == 0); \
|
||||
mono_mach_arch_thread_state_to_mono_context ((thread_state_t)&thread_state, &ctx); \
|
||||
mach_port_deallocate (current_task (), self); \
|
||||
} while (0);
|
||||
|
||||
#else
|
||||
|
||||
@@ -34,6 +34,7 @@ gboolean mono_hwcap_arm_is_v5 = FALSE;
|
||||
gboolean mono_hwcap_arm_is_v6 = FALSE;
|
||||
gboolean mono_hwcap_arm_is_v7 = FALSE;
|
||||
gboolean mono_hwcap_arm_is_v7s = FALSE;
|
||||
gboolean mono_hwcap_arm_is_v7k = FALSE;
|
||||
gboolean mono_hwcap_arm_has_vfp = FALSE;
|
||||
gboolean mono_hwcap_arm_has_vfp3 = FALSE;
|
||||
gboolean mono_hwcap_arm_has_vfp3_d16 = FALSE;
|
||||
@@ -162,6 +163,7 @@ mono_hwcap_print(FILE *f)
|
||||
g_fprintf (f, "mono_hwcap_arm_is_v6 = %i\n", mono_hwcap_arm_is_v6);
|
||||
g_fprintf (f, "mono_hwcap_arm_is_v7 = %i\n", mono_hwcap_arm_is_v7);
|
||||
g_fprintf (f, "mono_hwcap_arm_is_v7s = %i\n", mono_hwcap_arm_is_v7s);
|
||||
g_fprintf (f, "mono_hwcap_arm_is_v7k = %i\n", mono_hwcap_arm_is_v7k);
|
||||
g_fprintf (f, "mono_hwcap_arm_has_vfp = %i\n", mono_hwcap_arm_has_vfp);
|
||||
g_fprintf (f, "mono_hwcap_arm_has_vfp3 = %i\n", mono_hwcap_arm_has_vfp3);
|
||||
g_fprintf (f, "mono_hwcap_arm_has_vfp3_d16 = %i\n", mono_hwcap_arm_has_vfp3_d16);
|
||||
|
||||
@@ -7,6 +7,7 @@ extern gboolean mono_hwcap_arm_is_v5;
|
||||
extern gboolean mono_hwcap_arm_is_v6;
|
||||
extern gboolean mono_hwcap_arm_is_v7;
|
||||
extern gboolean mono_hwcap_arm_is_v7s;
|
||||
extern gboolean mono_hwcap_arm_is_v7k;
|
||||
extern gboolean mono_hwcap_arm_has_vfp;
|
||||
extern gboolean mono_hwcap_arm_has_vfp3;
|
||||
extern gboolean mono_hwcap_arm_has_vfp3_d16;
|
||||
|
||||
@@ -7,6 +7,13 @@
|
||||
* Copyright 2015 Xamarin, Inc (http://www.xamarin.com)
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* enable pthread extensions */
|
||||
#ifdef TARGET_MACH
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
|
||||
#include <mono/utils/mono-compiler.h>
|
||||
#include <mono/utils/mono-semaphore.h>
|
||||
#include <mono/utils/mono-threads.h>
|
||||
@@ -230,7 +237,7 @@ mono_threads_init_platform (void)
|
||||
void
|
||||
mono_threads_platform_free (MonoThreadInfo *info)
|
||||
{
|
||||
#ifdef TARGET_OSX
|
||||
#ifdef TARGET_MACH
|
||||
mach_port_deallocate (current_task (), info->native_handle);
|
||||
#endif
|
||||
|
||||
@@ -240,8 +247,12 @@ mono_threads_platform_free (MonoThreadInfo *info)
|
||||
void
|
||||
mono_threads_platform_register (MonoThreadInfo *info)
|
||||
{
|
||||
#ifdef TARGET_OSX
|
||||
#ifdef TARGET_MACH
|
||||
char thread_name [64];
|
||||
|
||||
info->native_handle = mach_thread_self ();
|
||||
snprintf (thread_name, 64, "tid_%x", (int)info->native_handle);
|
||||
pthread_setname_np (thread_name);
|
||||
#endif
|
||||
|
||||
//See the above for what's wrong here.
|
||||
|
||||
@@ -10,6 +10,11 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
/* enable pthread extensions */
|
||||
#ifdef TARGET_MACH
|
||||
#define _DARWIN_C_SOURCE
|
||||
#endif
|
||||
|
||||
#include <mono/utils/mono-compiler.h>
|
||||
#include <mono/utils/mono-semaphore.h>
|
||||
#include <mono/utils/mono-threads.h>
|
||||
@@ -163,7 +168,15 @@ dump_threads (void)
|
||||
MOSTLY_ASYNC_SAFE_PRINTF ("\t0x?08\t- blocking with pending suspend (GOOD)\n");
|
||||
|
||||
FOREACH_THREAD_SAFE (info) {
|
||||
#ifdef TARGET_MACH
|
||||
char thread_name [256] = { 0 };
|
||||
pthread_getname_np (mono_thread_info_get_tid (info), thread_name, 255);
|
||||
|
||||
MOSTLY_ASYNC_SAFE_PRINTF ("--thread %p id %p [%p] (%s) state %x %s\n", info, (void *) mono_thread_info_get_tid (info), (void*)(size_t)info->native_handle, thread_name, info->thread_state, info == cur ? "GC INITIATOR" : "" );
|
||||
#else
|
||||
MOSTLY_ASYNC_SAFE_PRINTF ("--thread %p id %p [%p] state %x %s\n", info, (void *) mono_thread_info_get_tid (info), (void*)(size_t)info->native_handle, info->thread_state, info == cur ? "GC INITIATOR" : "" );
|
||||
#endif
|
||||
|
||||
} END_FOREACH_THREAD_SAFE
|
||||
}
|
||||
|
||||
|
||||
@@ -51,12 +51,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "profiler-logging", "profile
|
||||
{158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "profiler-cov", "profiler-cov.vcxproj", "{83D4D926-2983-4770-BA92-EB9CB8828C95}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{CB0D9E92-293C-439C-9AC7-C5F59B6E0771} = {CB0D9E92-293C-439C-9AC7-C5F59B6E0771}
|
||||
{158073ED-99AE-4196-9EDC-DDB2344F8466} = {158073ED-99AE-4196-9EDC-DDB2344F8466}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jay", "..\mcs\jay\jay.vcxproj", "{5D485D32-3B9F-4287-AB24-C8DA5B89F537}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "profiler-codeanalyst", "profiler-codeanalyst.vcxproj", "{8FEF7F9E-F5F3-470E-91F4-404B7D6BC1BB}"
|
||||
@@ -273,21 +267,6 @@ Global
|
||||
{86663B87-4CD2-42B6-8D8E-C79DA1CCDEE6}.Release_SGen|x64.ActiveCfg = Release|x64
|
||||
{86663B87-4CD2-42B6-8D8E-C79DA1CCDEE6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{86663B87-4CD2-42B6-8D8E-C79DA1CCDEE6}.Release|x64.ActiveCfg = Release|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug_SGen|Win32.ActiveCfg = Debug|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug_SGen|x64.ActiveCfg = Debug|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug_SGen|x64.Build.0 = Debug|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Debug|x64.Build.0 = Debug|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release_SGen|Win32.ActiveCfg = Release|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release_SGen|Win32.Build.0 = Release|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release_SGen|x64.ActiveCfg = Release|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release_SGen|x64.Build.0 = Release|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release|Win32.Build.0 = Release|Win32
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release|x64.ActiveCfg = Release|x64
|
||||
{83D4D926-2983-4770-BA92-EB9CB8828C95}.Release|x64.Build.0 = Release|x64
|
||||
{5D485D32-3B9F-4287-AB24-C8DA5B89F537}.Debug_SGen|Win32.ActiveCfg = Debug|Win32
|
||||
{5D485D32-3B9F-4287-AB24-C8DA5B89F537}.Debug_SGen|Win32.Build.0 = Debug|Win32
|
||||
{5D485D32-3B9F-4287-AB24-C8DA5B89F537}.Debug_SGen|x64.ActiveCfg = Debug|Win32
|
||||
|
||||
Reference in new issue
Block a user