mcs/mcs @marek-safar
mcs/tests @marek-safar
mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
+mcs/class/Mono.Btls.Interface @baulig
+mcs/class/Mono.Data.Tds @egorbo
mcs/class/Mono.Debugger.Soft @vargaz
mcs/class/Mono.Options @jonpryor
mcs/class/Mono.Profiler.Log @alexrp
-mono/metadata/profiler* @alexrp
+mcs/class/Mono.Security/Mono.Security/Interface @baulig
+mcs/class/System/Mono.AppleTls @baulig
+mcs/class/System/Mono.Btls @baulig
+mcs/class/System/Mono.Net.Security @baulig
+mcs/class/System/Mono.Security.Interface @baulig
+mcs/class/System.Data @egorbo
+mono/metadata/*profiler* @alexrp
+mono/metadata/monitor* @brzvlad
+mono/metadata/sgen* @brzvlad
mono/metadata/threads* @luhenry @kumpera
mono/metadata/threadpool* @luhenry
mono/metadata/w32* @luhenry
-mono/mini/profiler* @alexrp
+mono/mini/*profiler* @alexrp
mono/profiler @alexrp
+mono/sgen @brzvlad
mono/utils/atomic* @alexrp
mono/utils/mono-hwcap* @alexrp
mono/utils/mono-mem* @alexrp
mono/utils/mono-threads* @luhenry @kumpera
msvc/*profiler* @alexrp
+msvc/scripts @akoeplinger
packaging/Windows @akoeplinger
samples/profiler @alexrp
samples/size @alexrp
-Subproject commit 1d7d43603791e0236b56d076578657bee44fef6b
+Subproject commit 3aef9cdd6013fc0620a1817f0b11d8fb90ed2e0f
return PKCS8.PrivateKeyInfo.DecodeRSA (bytes);
}
set {
+ if (nativePrivateKey != null)
+ nativePrivateKey.Dispose ();
nativePrivateKey = null;
FallbackImpl.PrivateKey = value;
}
x509 = null;
}
if (nativePrivateKey != null) {
+ nativePrivateKey.Dispose ();
nativePrivateKey = null;
}
subjectName = null;
internal override Type InternalResolve ()
{
if (mbuilder != null)
- return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal).GetGenericArguments () [index];
+ return MethodBase.GetMethodFromHandle (mbuilder.MethodHandleInternal, mbuilder.TypeBuilder.InternalResolve ().TypeHandle).GetGenericArguments () [index];
return tbuilder.InternalResolve ().GetGenericArguments () [index];
}
public override int GetHashCode ()
{
- /* same implementation as CoreCLR */
- return GetType ().GetHashCode ();
+ MethodInfo m;
+
+ m = Method;
+
+ return (m != null ? m.GetHashCode () : GetType ().GetHashCode ()) ^ (m_target != null ? m_target.GetHashCode () : 0);
}
protected virtual MethodInfo GetMethodImpl ()
Assert.AreEqual (TypeAttributes.Public, gparam.Attributes, "#1");
}
+
+ [Test]
+ public void ActionConstructorInfoTest ()
+ {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58454
+ //
+ // Need to check that GenericTypeParameterBuilderTest:InternalResolve() passes the declaring type to GetMethodFromHandle()
+ //
+ /* Want to generate:
+
+ public class Store<TState> {
+ public Action<TSelection> Subscribe<TSelection> (TState state) {
+ return new Action<TSelection> (Foo<TSelection>);
+ }
+ public static void Foo<X> (X x) { }
+ }
+
+ ... and then: new Store<string>().Subscribe<int>("x");
+ */
+
+ SetUp (AssemblyBuilderAccess.Run);
+
+ var tb = module.DefineType ("Store");
+ var tparsStore = tb.DefineGenericParameters ("TState");
+
+ tb.DefineDefaultConstructor (MethodAttributes.Public);
+
+ var methFoo = tb.DefineMethod ("Foo", MethodAttributes.Public | MethodAttributes.Static);
+ var tparsFoo = methFoo.DefineGenericParameters ("X");
+ methFoo.SetReturnType (typeof(void));
+ methFoo.SetParameters (tparsFoo[0]);
+ methFoo.GetILGenerator().Emit (OpCodes.Ret);
+
+ var methSub = tb.DefineMethod ("Subscribe", MethodAttributes.Public | MethodAttributes.Static);
+ var tparsSub = methSub.DefineGenericParameters ("TSelection");
+ var actOfSel = typeof(Action<>).MakeGenericType (tparsSub[0]); // Action<TSelection>
+ methSub.SetReturnType (actOfSel);
+ methSub.SetParameters (tparsStore[0]); // TState
+ var ilg = methSub.GetILGenerator ();
+ ilg.Emit (OpCodes.Ldnull); // instance == null
+ ilg.Emit (OpCodes.Ldftn, methFoo.MakeGenericMethod (tparsSub[0])); // ldftn void class Store`1<!TState>::Foo<!!0> (!!0)
+ var aaa = TypeBuilder.GetConstructor (actOfSel, typeof(Action<>).GetConstructors()[0]);
+ ilg.Emit (OpCodes.Newobj, aaa); // new Action<TSelection> (Foo<TSelection>);
+ ilg.Emit (OpCodes.Ret);
+
+ var tgen = tb.CreateType (); // TState`1
+
+ var t = tgen.MakeGenericType(typeof(string));
+ var x = t.GetConstructor(Type.EmptyTypes).Invoke (null); // x = new Store<string> ()
+ var mgen = t.GetMethod("Subscribe");
+ var m = mgen.MakeGenericMethod (typeof (int)); // Action<int> Store<string>.Subscribe<int> (string)
+ var y = m.Invoke (x, new object[] {"hello"}); // x.Subscribte<int> ("hello")
+ Assert.IsNotNull (y);
+ }
+
}
}
{
GetFieldExpression (ec).EmitAssign (ec, source, leave_copy, false);
}
+
+ public void EmitAssignFromStack (EmitContext ec)
+ {
+ GetFieldExpression (ec).EmitAssignFromStack (ec);
+ }
}
public class HoistedParameter : HoistedVariable
var tupleLiteralElements = (source as TupleLiteral)?.Elements;
for (int i = 0; i < targetType.Arity; ++i) {
- var elementType = srcTypeArgument [i];
-
if (tupleLiteralElements != null) {
if (!ImplicitStandardConversionExists (tupleLiteralElements[i].Expr, targetTypeArgument [i])) {
return false;
public override void FlowAnalysis (FlowAnalysisContext fc)
{
- expr.FlowAnalysis (fc);
+ orig_expr.FlowAnalysis (fc);
+ }
+
+ public override void FlowAnalysisConditional (FlowAnalysisContext fc)
+ {
+ orig_expr.FlowAnalysisConditional (fc);
}
public override SLE.Expression MakeExpression (BuilderContext ctx)
ec.Emit (OpCodes.Dup);
no_value_label = ec.DefineLabel ();
ec.Emit (OpCodes.Brfalse_S, no_value_label);
+
+ if (Variable.HoistedVariant != null)
+ ec.EmitThis ();
+
expr_unwrap.Emit (ec);
} else {
+ if (Variable?.HoistedVariant != null)
+ ec.EmitThis ();
+
expr.Emit (ec);
// Only to make verifier happy
value_on_stack = false;
}
- //
- // It's ok to have variable builder create out of order. It simplified emit
- // of statements like while (condition) { }
- //
- if (!Variable.Created)
- Variable.CreateBuilder (ec);
-
- Variable.EmitAssign (ec);
+ if (Variable.HoistedVariant != null) {
+ Variable.HoistedVariant.EmitAssignFromStack (ec);
- if (expr_unwrap != null) {
- ec.MarkLabel (no_value_label);
- } else if (!value_on_stack) {
- Variable.Emit (ec);
+ if (expr_unwrap != null) {
+ ec.MarkLabel (no_value_label);
+ } else if (!value_on_stack) {
+ Variable.HoistedVariant.Emit (ec);
+ }
+ } else {
+ //
+ // It's ok to have variable builder created out of order. It simplifies emit
+ // of statements like while (condition) { }
+ //
+ if (!Variable.Created)
+ Variable.CreateBuilder (ec);
+
+ Variable.EmitAssign (ec);
+
+ if (expr_unwrap != null) {
+ ec.MarkLabel (no_value_label);
+ } else if (!value_on_stack) {
+ Variable.Emit (ec);
+ }
}
}
}
if (new_implementation) {
MemberFilter filter;
- if (mi.Parameters.Count > 1) {
- var indexer_params = mi.Name [0] == 'g' ? mi.Parameters : IndexerSpec.CreateParametersFromSetter (mi, mi.Parameters.Count - 1);
- filter = new MemberFilter (MemberCache.IndexerNameAlias, 0, MemberKind.Indexer, indexer_params, null);
+ bool getter = mi.Name [0] == 'g';
+ if (mi.Parameters.Count > (getter ? 0 : 1)) {
+ var indexer_params = getter ? mi.Parameters : IndexerSpec.CreateParametersFromSetter (mi, mi.Parameters.Count - 1);
+ var ptype = getter ? mi.ReturnType : mi.Parameters.Types [mi.Parameters.Count - 1];
+ filter = new MemberFilter (MemberCache.IndexerNameAlias, 0, MemberKind.Indexer, indexer_params, ptype);
} else {
var pname = mi.Name.Substring (4);
- filter = MemberFilter.Property (pname, null);
+ var ptype = getter ? mi.ReturnType : mi.Parameters.Types [0];
+ filter = MemberFilter.Property (pname, ptype);
}
var prop = MemberCache.FindMember (container.CurrentType, filter, BindingRestriction.DeclaredOnly | BindingRestriction.InstanceOnly);
--- /dev/null
+interface IA
+{
+ int Prop { get; }
+ int this [int arg] { get; }
+}
+
+abstract class B : IA
+{
+ public long Prop => 4;
+
+ int IA.Prop => 1;
+
+ public long this [int arg] => 2;
+
+ int IA.this [int arg] => 4;
+}
+
+class C : B, IA
+{
+ public static void Main ()
+ {
+ }
+
+ public new string Prop {
+ get { return ""; }
+ }
+
+ public new string this [int arg] => "2";
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+class Expr
+{
+ public int Field;
+ public Expr Next;
+}
+
+static class X
+{
+ public static IEnumerable<int> Test (this Expr expr)
+ {
+ var exprCur = expr;
+ while (exprCur != null)
+ {
+ if (exprCur is Expr list)
+ {
+ yield return list.Field;
+ exprCur = list.Next;
+ }
+ else
+ {
+ yield return 2;
+ yield break;
+ }
+ }
+ }
+
+ public static void Main ()
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+using System.Collections.Generic;
+
+class Expr
+{
+ public int Field;
+}
+
+static class X
+{
+ public static IEnumerable<int> Test (Expr expr)
+ {
+ object exprCur = expr;
+ if (exprCur is Expr list) {
+ yield return list.Field;
+ }
+ }
+
+ public static IEnumerable<string> Test2 (int? expr)
+ {
+ int? exprCur = expr;
+ while (exprCur != null) {
+ if (exprCur is int list) {
+ yield return list.ToString ();
+ }
+ }
+ }
+
+ public static void Main ()
+ {
+ Test (null);
+ Test2 (3);
+ }
+}
\ No newline at end of file
</method>
</type>
</test>
+ <test name="test-947.cs">
+ <type name="B">
+ <method name="Int64 get_Prop()" attrs="2182">
+ <size>10</size>
+ </method>
+ <method name="Int32 IA.get_Prop()" attrs="2529">
+ <size>9</size>
+ </method>
+ <method name="Int64 get_Item(Int32)" attrs="2182">
+ <size>10</size>
+ </method>
+ <method name="Int32 IA.get_Item(Int32)" attrs="2529">
+ <size>9</size>
+ </method>
+ <method name="Void .ctor()" attrs="6276">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="C">
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ <method name="System.String get_Prop()" attrs="2182">
+ <size>14</size>
+ </method>
+ <method name="System.String get_Item(Int32)" attrs="2182">
+ <size>13</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-95.cs">
<type name="X">
<method name="Int32 Main()" attrs="150">
</method>
</type>
</test>
+ <test name="test-pattern-08.cs">
+ <type name="Expr">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Expr)" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>2</size>
+ </method>
+ </type>
+ <type name="X+<Test>c__Iterator0">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>184</size>
+ </method>
+ <method name="Int32 System.Collections.Generic.IEnumerator<int>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>19</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
+ <test name="test-pattern-09.cs">
+ <type name="Expr">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X">
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Expr)" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] Test2(System.Nullable`1[System.Int32])" attrs="150">
+ <size>30</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>21</size>
+ </method>
+ </type>
+ <type name="X+<Test>c__Iterator0">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>124</size>
+ </method>
+ <method name="Int32 System.Collections.Generic.IEnumerator<int>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>19</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X+<Test2>c__Iterator1">
+ <method name="Boolean MoveNext()" attrs="486">
+ <size>161</size>
+ </method>
+ <method name="System.String System.Collections.Generic.IEnumerator<string>.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">
+ <size>14</size>
+ </method>
+ <method name="Void Dispose()" attrs="486">
+ <size>15</size>
+ </method>
+ <method name="Void Reset()" attrs="486">
+ <size>6</size>
+ </method>
+ <method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
+ <size>14</size>
+ </method>
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">
+ <size>40</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-pragma-unrecognized.cs">
<type name="C">
<method name="Void Main()" attrs="150">
change.Append (paramSourceType);
}
change.Append (" ");
- if (paramSourceName != paramTargetName) {
+ if (!State.IgnoreParameterNameChanges && paramSourceName != paramTargetName) {
change.AppendModified (paramSourceName, paramTargetName, true);
} else {
change.Append (paramSourceName);
}
change.Append (")");
-
- // Ignore any parameter name changes if requested.
- if (State.IgnoreParameterNameChanges && !change.Breaking) {
- change.AnyChange = false;
- change.HasIgnoredChanges = true;
- }
}
void RenderVTable (MethodAttributes source, MethodAttributes target, ApiChange change)
set (CMAKE_MACOSX_RPATH 1)
set (MONO_BTLS 1)
+set(BUILD_SHARED_LIBS_SAVED "${BUILD_SHARED_LIBS}")
+set(BUILD_SHARED_LIBS OFF)
add_subdirectory (${BTLS_ROOT} boringssl)
+set(BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS_SAVED}")
include_directories (
${SRC_DIR}
w32process-internals.h \
profiler.c \
profiler-events.h \
- profiler-legacy.c \
profiler-private.h \
rand.h \
rand.c \
*/
struct _MonoGenericInst {
#ifndef MONO_SMALL_CONFIG
- guint id; /* unique ID for debugging */
+ gint32 id; /* unique ID for debugging */
#endif
guint type_argc : 22; /* number of type arguments */
guint is_open : 1; /* if this is an open type */
#include <mono/metadata/class-internals.h>
#include <mono/metadata/object-internals.h>
+#include <mono/metadata/profiler-private.h>
#include <mono/metadata/monitor.h>
#include <mono/metadata/handle.h>
#ifdef HAVE_SGEN_GC
#define NBUILTIN_TYPES() (sizeof (builtin_types) / sizeof (builtin_types [0]))
static GHashTable *type_cache = NULL;
-static int next_generic_inst_id = 0;
+static gint32 next_generic_inst_id = 0;
/* Protected by image_sets_mutex */
static MonoImageSet *mscorlib_image_set;
int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *);
ginst = (MonoGenericInst *)mono_image_set_alloc0 (set, size);
#ifndef MONO_SMALL_CONFIG
- ginst->id = ++next_generic_inst_id;
+ ginst->id = InterlockedIncrement (&next_generic_inst_id);
#endif
ginst->is_open = is_open;
ginst->type_argc = type_argc;
DECL_OFFSET(MonoThreadsSync, status)
DECL_OFFSET(MonoThreadsSync, nest)
+DECL_OFFSET(MonoProfilerCallContext, method)
+
#ifdef HAVE_SGEN_GC
DECL_OFFSET(SgenClientThreadInfo, in_critical_region)
DECL_OFFSET(SgenThreadInfo, tlab_next)
+++ /dev/null
-/*
- * Licensed to the .NET Foundation under one or more agreements.
- * The .NET Foundation licenses this file to you under the MIT license.
- * See the LICENSE file in the project root for more information.
- */
-
-#include <mono/metadata/profiler-private.h>
-
-/*
- * The point of this file is to maintain compatibility with a few profiler API
- * functions used by Xamarin.{Android,iOS,Mac} so that they keep working
- * regardless of which system Mono version is used.
- *
- * TODO: Remove this some day if we're OK with breaking compatibility.
- */
-
-typedef void *MonoLegacyProfiler;
-
-typedef void (*MonoProfileFunc) (MonoLegacyProfiler *prof);
-typedef void (*MonoProfileThreadFunc) (MonoLegacyProfiler *prof, uintptr_t tid);
-typedef void (*MonoProfileGCFunc) (MonoLegacyProfiler *prof, MonoProfilerGCEvent event, int generation);
-typedef void (*MonoProfileGCResizeFunc) (MonoLegacyProfiler *prof, int64_t new_size);
-typedef void (*MonoProfileJitResult) (MonoLegacyProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
-
-struct _MonoProfiler {
- MonoProfilerHandle handle;
- MonoLegacyProfiler *profiler;
- MonoProfileFunc shutdown_callback;
- MonoProfileThreadFunc thread_start, thread_end;
- MonoProfileGCFunc gc_event;
- MonoProfileGCResizeFunc gc_heap_resize;
- MonoProfileJitResult jit_end2;
-};
-
-static MonoProfiler *current;
-
-MONO_API void mono_profiler_install (MonoLegacyProfiler *prof, MonoProfileFunc callback);
-MONO_API void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end);
-MONO_API void mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback);
-MONO_API void mono_profiler_install_jit_end (MonoProfileJitResult end);
-MONO_API void mono_profiler_set_events (int flags);
-
-static void
-shutdown_cb (MonoProfiler *prof)
-{
- prof->shutdown_callback (prof->profiler);
-}
-
-void
-mono_profiler_install (MonoLegacyProfiler *prof, MonoProfileFunc callback)
-{
- current = g_new0 (MonoProfiler, 1);
- current->handle = mono_profiler_create (current);
- current->profiler = prof;
- current->shutdown_callback = callback;
-
- if (callback)
- mono_profiler_set_runtime_shutdown_end_callback (current->handle, shutdown_cb);
-}
-
-static void
-thread_start_cb (MonoProfiler *prof, uintptr_t tid)
-{
- prof->thread_start (prof->profiler, tid);
-}
-
-static void
-thread_stop_cb (MonoProfiler *prof, uintptr_t tid)
-{
- prof->thread_end (prof->profiler, tid);
-}
-
-void
-mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end)
-{
- current->thread_start = start;
- current->thread_end = end;
-
- if (start)
- mono_profiler_set_thread_started_callback (current->handle, thread_start_cb);
-
- if (end)
- mono_profiler_set_thread_stopped_callback (current->handle, thread_stop_cb);
-}
-
-static void
-gc_event_cb (MonoProfiler *prof, MonoProfilerGCEvent event, uint32_t generation)
-{
- prof->gc_event (prof->profiler, event, generation);
-}
-
-static void
-gc_resize_cb (MonoProfiler *prof, uintptr_t size)
-{
- prof->gc_heap_resize (prof->profiler, size);
-}
-
-void
-mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback)
-{
- current->gc_event = callback;
- current->gc_heap_resize = heap_resize_callback;
-
- if (callback)
- mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
-
- if (heap_resize_callback)
- mono_profiler_set_gc_resize_callback (current->handle, gc_resize_cb);
-}
-
-static void
-jit_done_cb (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
-{
- prof->jit_end2 (prof->profiler, method, jinfo, 0);
-}
-
-static void
-jit_failed_cb (MonoProfiler *prof, MonoMethod *method)
-{
- prof->jit_end2 (prof->profiler, method, NULL, 1);
-}
-
-void
-mono_profiler_install_jit_end (MonoProfileJitResult end)
-{
- current->jit_end2 = end;
-
- if (end) {
- mono_profiler_set_jit_done_callback (current->handle, jit_done_cb);
- mono_profiler_set_jit_failed_callback (current->handle, jit_failed_cb);
- }
-}
-
-void
-mono_profiler_set_events (int flags)
-{
- /* Do nothing. */
-}
gpointer (*context_get_argument) (MonoProfilerCallContext *, guint32);
gpointer (*context_get_local) (MonoProfilerCallContext *, guint32);
gpointer (*context_get_result) (MonoProfilerCallContext *);
- gpointer (*context_free_buffer) (gpointer);
+ void (*context_free_buffer) (gpointer);
#define _MONO_PROFILER_EVENT(name) \
volatile gint32 name ## _count;
#undef MONO_PROFILER_EVENT_3
#undef MONO_PROFILER_EVENT_4
#undef _MONO_PROFILER_EVENT
+
+/*
+ * The following code is here to maintain compatibility with a few profiler API
+ * functions used by Xamarin.{Android,iOS,Mac} so that they keep working
+ * regardless of which system Mono version is used.
+ *
+ * TODO: Remove this some day if we're OK with breaking compatibility.
+ */
+
+typedef void *MonoLegacyProfiler;
+
+typedef void (*MonoLegacyProfileFunc) (MonoLegacyProfiler *prof);
+typedef void (*MonoLegacyProfileThreadFunc) (MonoLegacyProfiler *prof, uintptr_t tid);
+typedef void (*MonoLegacyProfileGCFunc) (MonoLegacyProfiler *prof, MonoProfilerGCEvent event, int generation);
+typedef void (*MonoLegacyProfileGCResizeFunc) (MonoLegacyProfiler *prof, int64_t new_size);
+typedef void (*MonoLegacyProfileJitResult) (MonoLegacyProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
+
+struct _MonoProfiler {
+ MonoProfilerHandle handle;
+ MonoLegacyProfiler *profiler;
+ MonoLegacyProfileFunc shutdown_callback;
+ MonoLegacyProfileThreadFunc thread_start, thread_end;
+ MonoLegacyProfileGCFunc gc_event;
+ MonoLegacyProfileGCResizeFunc gc_heap_resize;
+ MonoLegacyProfileJitResult jit_end2;
+};
+
+static MonoProfiler *current;
+
+MONO_API void mono_profiler_install (MonoLegacyProfiler *prof, MonoLegacyProfileFunc callback);
+MONO_API void mono_profiler_install_thread (MonoLegacyProfileThreadFunc start, MonoLegacyProfileThreadFunc end);
+MONO_API void mono_profiler_install_gc (MonoLegacyProfileGCFunc callback, MonoLegacyProfileGCResizeFunc heap_resize_callback);
+MONO_API void mono_profiler_install_jit_end (MonoLegacyProfileJitResult end);
+MONO_API void mono_profiler_set_events (int flags);
+
+static void
+shutdown_cb (MonoProfiler *prof)
+{
+ prof->shutdown_callback (prof->profiler);
+}
+
+void
+mono_profiler_install (MonoLegacyProfiler *prof, MonoLegacyProfileFunc callback)
+{
+ current = g_new0 (MonoProfiler, 1);
+ current->handle = mono_profiler_create (current);
+ current->profiler = prof;
+ current->shutdown_callback = callback;
+
+ if (callback)
+ mono_profiler_set_runtime_shutdown_end_callback (current->handle, shutdown_cb);
+}
+
+static void
+thread_start_cb (MonoProfiler *prof, uintptr_t tid)
+{
+ prof->thread_start (prof->profiler, tid);
+}
+
+static void
+thread_stop_cb (MonoProfiler *prof, uintptr_t tid)
+{
+ prof->thread_end (prof->profiler, tid);
+}
+
+void
+mono_profiler_install_thread (MonoLegacyProfileThreadFunc start, MonoLegacyProfileThreadFunc end)
+{
+ current->thread_start = start;
+ current->thread_end = end;
+
+ if (start)
+ mono_profiler_set_thread_started_callback (current->handle, thread_start_cb);
+
+ if (end)
+ mono_profiler_set_thread_stopped_callback (current->handle, thread_stop_cb);
+}
+
+static void
+gc_event_cb (MonoProfiler *prof, MonoProfilerGCEvent event, uint32_t generation)
+{
+ prof->gc_event (prof->profiler, event, generation);
+}
+
+static void
+gc_resize_cb (MonoProfiler *prof, uintptr_t size)
+{
+ prof->gc_heap_resize (prof->profiler, size);
+}
+
+void
+mono_profiler_install_gc (MonoLegacyProfileGCFunc callback, MonoLegacyProfileGCResizeFunc heap_resize_callback)
+{
+ current->gc_event = callback;
+ current->gc_heap_resize = heap_resize_callback;
+
+ if (callback)
+ mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
+
+ if (heap_resize_callback)
+ mono_profiler_set_gc_resize_callback (current->handle, gc_resize_cb);
+}
+
+static void
+jit_done_cb (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
+{
+ prof->jit_end2 (prof->profiler, method, jinfo, 0);
+}
+
+static void
+jit_failed_cb (MonoProfiler *prof, MonoMethod *method)
+{
+ prof->jit_end2 (prof->profiler, method, NULL, 1);
+}
+
+void
+mono_profiler_install_jit_end (MonoLegacyProfileJitResult end)
+{
+ current->jit_end2 = end;
+
+ if (end) {
+ mono_profiler_set_jit_done_callback (current->handle, jit_done_cb);
+ mono_profiler_set_jit_failed_callback (current->handle, jit_failed_cb);
+ }
+}
+
+void
+mono_profiler_set_events (int flags)
+{
+ /* Do nothing. */
+}
return code;
}
-/*
- * mono_aot_get_method:
- *
- * Return a pointer to the AOTed native code for METHOD if it can be found,
- * NULL otherwise.
- * On platforms with function pointers, this doesn't return a function pointer.
- */
-gpointer
-mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
-{
- MonoError error;
-
- gpointer res = mono_aot_get_method_checked (domain, method, &error);
- /* This is external only, so its ok to raise here */
- mono_error_raise_exception (&error); /* OK to throw, external only without a good alternative */
- return res;
-}
-
/**
* Same as mono_aot_get_method, but we try to avoid loading any metadata from the
* method.
* See the LICENSE file in the project root for more information.
*/
+#include <config.h>
+
#include <mono/metadata/abi-details.h>
#include <mono/metadata/mono-debug.h>
#include "ir-emit.h"
#include "mini.h"
+#ifndef DISABLE_JIT
+
void
mini_profiler_emit_instrumentation_call (MonoCompile *cfg, void *func, gboolean entry, MonoInst **ret, MonoType *rtype)
{
mono_emit_jit_icall (cfg, func, iargs);
}
+#endif
+
void
mini_profiler_context_enable (void)
{
return ji;
}
-MonoJitInfo *
-mono_get_jit_info_from_method (MonoDomain *domain, MonoMethod *method)
-{
- return lookup_method (domain, method);
-}
-
MonoClass*
mini_get_class (MonoMethod *method, guint32 token, MonoGenericContext *context)
{
# appdomain-threadpool-unload.exe creates 100 appdomains, takes too long with llvm
LLVM_DISABLED_TESTS = \
+ finally_block_ending_in_dead_bb.exe \
appdomain-threadpool-unload.exe
LLVM = $(filter --llvm, $(MONO_ENV_OPTIONS))
<ClCompile Include="..\mono\metadata\number-ms.c" />\r
<ClCompile Include="..\mono\metadata\object.c" />\r
<ClCompile Include="..\mono\metadata\opcodes.c" />\r
- <ClCompile Include="..\mono\metadata\profiler-legacy.c" />\r
<ClCompile Include="..\mono\metadata\profiler.c" />\r
<ClCompile Include="..\mono\metadata\rand.c" />\r
<ClCompile Include="..\mono\metadata\reflection.c" />\r
<ClCompile Include="..\mono\metadata\w32process-win32.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
- <ClCompile Include="..\mono\metadata\profiler-legacy.c">\r
- <Filter>Source Files</Filter>\r
- </ClCompile>\r
<ClCompile Include="..\mono\metadata\profiler.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
EXPORTS
MonoFixupCorEE
mono_add_internal_call
-mono_aot_get_method
mono_aot_register_module
mono_array_addr_with_size
mono_array_class_get
mono_get_int32_class
mono_get_int64_class
mono_get_intptr_class
-mono_get_jit_info_from_method
mono_get_machine_config
mono_get_method
mono_get_method_constrained
EXPORTS
MonoFixupCorEE
mono_add_internal_call
-mono_aot_get_method
mono_aot_register_module
mono_array_addr_with_size
mono_array_class_get
mono_get_int32_class
mono_get_int64_class
mono_get_intptr_class
-mono_get_jit_info_from_method
mono_get_machine_config
mono_get_method
mono_get_method_constrained
}
}
- static bool dump_asm, dump_ver;
+ static bool dump_asm, dump_ver, dump_guids_for_msbuild;
static void Main (string[] args) {
if (args.Length > 1) {
dump_asm = args [1].Equals ("asm");
dump_ver = args [1].Equals ("ver");
+ dump_guids_for_msbuild = args [1].Equals ("guids_for_msbuild");
} else {
dump_asm = true;
}
var data = StreamToArray (entry.Open ());
AppDomain ad = AppDomain.CreateDomain ("parse_" + ++domain_id);
DoParse p = (DoParse)ad.CreateInstanceAndUnwrap (typeof (DoParse).Assembly.FullName, typeof (DoParse).FullName);
- p.ParseAssembly (data, version, entry.Name, entry.FullName, dump_asm, dump_ver);
+ p.ParseAssembly (data, version, entry.Name, entry.FullName, dump_asm, dump_ver, dump_guids_for_msbuild);
AppDomain.Unload (ad);
}
}
return parts[parts.Length - 2];
}
- public void ParseAssembly (byte[] data, string version, string name, string fullname, bool dump_asm, bool dump_ver) {
+ public void ParseAssembly (byte[] data, string version, string name, string fullname, bool dump_asm, bool dump_ver, bool dump_guids_for_msbuild) {
var a = Assembly.ReflectionOnlyLoad (data);
var m = a.GetModules ()[0];
var id = m.ModuleVersionId.ToString ().ToUpper ();
//IGNORED_ASM_VER (SYS_IO_COMPRESSION, 4, 1, 2, 0),
var ver = a.GetName ().Version;
- if (dump_ver)
+ if (dump_ver) {
Console.WriteLine ($"IGNORED_ASM_VER ({str}, {ver.Major}, {ver.Minor}, {ver.Build}, {ver.Revision}),");
+ } else if (dump_guids_for_msbuild) {
+ // This needs to be kept in sync with FilterDeniedAssemblies msbuild task in msbuild
+ Console.WriteLine ($"{name},{id},{ver.Major},{ver.Minor},{ver.Build},{ver.Revision}");
+ }
}
-}
\ No newline at end of file
+}
"MonoTypedRef",
"MonoThreadsSync",
"SgenThreadInfo",
- "SgenClientThreadInfo"
+ "SgenClientThreadInfo",
+ "MonoProfilerCallContext"
};
DumpClasses(writer, ctx, types);