Merge pull request #5190 from alexrp/profiler-roots-deprecation
authorAlex Rønne Petersen <alex@alexrp.com>
Tue, 11 Jul 2017 16:52:59 +0000 (18:52 +0200)
committerGitHub <noreply@github.com>
Tue, 11 Jul 2017 16:52:59 +0000 (18:52 +0200)
[profiler] Hide the GC roots callback behind a macro and mark it obsolete.

mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEnums.cs
mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogEvents.cs
mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogProcessor.cs
mcs/class/System.Drawing/System.Drawing.dll.sources
mono/btls/btls-util.c
mono/mini/exceptions.cs
mono/mini/gshared.cs
mono/profiler/log.c
mono/profiler/log.h
mono/profiler/mprof-report.c
msvc/masm.fixed.props

index f9a125b5d16a8d011774c600d22bab15ed8ae0fb..f34cafe07e0965869ac7281573b6059d65f37f14 100644 (file)
@@ -138,16 +138,6 @@ namespace Mono.Profiler.Log {
                ExceptionHandling = 10,
        }
 
-       // mono/profiler/log.h : SAMPLE_*
-       public enum LogSampleHitType {
-               Cycles = 1,
-               Instructions = 2,
-               CacheMisses = 3,
-               CacheHits = 4,
-               Branches = 5,
-               BranchMisses = 6,
-       }
-
        // mono/metadata/profiler.h : MonoProfilerGCRootType
        [Flags]
        public enum LogHeapRootAttributes {
index 248863e60669758cb5d36ddb708d43279b80df0f..8bdd5d7ab59b9adfd721ec97bb574b9c3ec42379 100644 (file)
@@ -443,8 +443,6 @@ namespace Mono.Profiler.Log {
 
        public sealed class SampleHitEvent : LogEvent {
 
-               public LogSampleHitType Type { get; internal set; }
-
                public long ThreadId { get; internal set; }
 
                public IReadOnlyList<long> UnmanagedBacktrace { get; internal set; }
index f57d4ef651d750244af8ce418588cccbd87fa8ed..09e5dca088f15ab973b868a24e8ff1e795f7dccb 100644 (file)
@@ -380,7 +380,6 @@ namespace Mono.Profiler.Log {
                                switch (extType) {
                                case LogEventType.SampleHit:
                                        return new SampleHitEvent {
-                                               Type = (LogSampleHitType) Reader.ReadByte (),
                                                ThreadId = ReadPointer (),
                                                UnmanagedBacktrace = ReadBacktrace (true, false),
                                                ManagedBacktrace = ReadBacktrace (true),
index 582cdc47bf597623b782f41849539d07641de38f..281ba3ef64ccc1b518e5a4eae055072cc9221135 100755 (executable)
@@ -95,7 +95,7 @@ System.Drawing/ToolboxBitmapAttribute.cs
 ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxComponentsCreatingEventHandler.cs
 ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCreatorCallback.cs
 System.Drawing.Design/ToolboxItem.cs
-       ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs
+../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditor.cs
 ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/ToolboxItemCollection.cs
 ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/AdjustableArrowCap.cs
 ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/Blend.cs
index 955b8c85aec4fa4eea5ae2bc972c0b88bdaa23e4..57fa0fa7813138b5db9ff7422763aa48ac8810d7 100644 (file)
@@ -27,13 +27,19 @@ mono_btls_util_asn1_time_to_ticks (ASN1_TIME *time)
        ASN1_GENERALIZEDTIME *gtime;
        struct tm tm;
        int64_t epoch;
+       int ret;
        
        memset (&tm, 0, sizeof (tm));
 
        gtime = ASN1_TIME_to_generalizedtime (time, NULL);
-       /* FIXME: check return value of  asn1_generalizedtime_to_tm () */
-       asn1_generalizedtime_to_tm (&tm, gtime);
+       ret = asn1_generalizedtime_to_tm (&tm, gtime);
        ASN1_GENERALIZEDTIME_free (gtime);
+
+       /* FIXME: check the return value in managed code */
+       if (ret == 0) {
+               return 0;
+       }
+
        epoch = btls_timegm64 (&tm);
 
        return epoch;
index 3251985e4d702f02e7b58499dc727b99bc4949f2..aa5ca277ac544e5e57bdeffbbfd454a0c95de9ab 100644 (file)
@@ -2869,6 +2869,7 @@ class Tests
                }
        }
 
+       [Category ("!BITCODE")]
        public static int test_1_basic_filter_catch () {
                try {
                        MyException e = new MyException ("");
@@ -2880,6 +2881,7 @@ class Tests
                return 0;
        }
 
+       [Category ("!BITCODE")]
        public static int test_1234_complicated_filter_catch () {
                string res = "init";
                try {
@@ -2921,6 +2923,7 @@ class Tests
     [MethodImpl( MethodImplOptions.NoInlining )]
     private static bool ExceptionFilter( byte x, FooStruct item ) => true;
 
+       [Category ("!BITCODE")]
        public static int test_0_filter_caller_area () {
         try {
             throw new Exception();
index 61402f7a4eca4f0314d21eb7918cf5e16ae02a00..6b5bc95f134ca449ac6306ed403d3ee321c920ef 100644 (file)
@@ -1992,8 +1992,10 @@ public class Tests
 
        public static int test_0_isreference_intrins () {
                IFaceIsRef iface = new ClassIsRef ();
-               Console.WriteLine ("X: " + iface.is_ref<AStruct3<int, int, int>> ());
-               Console.WriteLine ("X: " + iface.is_ref<AStruct3<string, int, int>> ());
+               if (iface.is_ref<AStruct3<int, int, int>> ())
+                       return 1;
+               if (!iface.is_ref<AStruct3<string, int, int>> ())
+                       return 2;
                return 0;
        }
 }
index 66271de51436b28e64fb26af81afa98f8bd2fc70..9793f8392d851cfa69a0e0048ae5f0605919855a 100644 (file)
@@ -4384,7 +4384,6 @@ handle_dumper_queue_entry (MonoProfiler *prof)
                );
 
                emit_event_time (logbuffer, TYPE_SAMPLE | TYPE_SAMPLE_HIT, sample->time);
-               emit_byte (logbuffer, SAMPLE_CYCLES);
                emit_ptr (logbuffer, (void *) sample->tid);
                emit_value (logbuffer, 1);
 
index 2f14b018a421046264045e15d945ac5db6d9eb44..f972489ffd4d4a7f45d6fa85221b6f77d5a0faf6 100644 (file)
@@ -68,6 +68,7 @@
                added an image pointer field to assembly load events
                added an exception object field to TYPE_CLAUSE
                class unload events no longer exist (they were never emitted)
+               removed type field from TYPE_SAMPLE_HIT
  */
 
 enum {
@@ -162,19 +163,6 @@ enum {
        MONO_PROFILER_GC_HANDLE_DESTROYED,
 };
 
-// Sampling sources
-// Unless you have compiled with --enable-perf-events, only SAMPLE_CYCLES is available
-enum {
-       SAMPLE_CYCLES = 1,
-       SAMPLE_INSTRUCTIONS,
-       SAMPLE_CACHE_MISSES,
-       SAMPLE_CACHE_REFS,
-       SAMPLE_BRANCHES,
-       SAMPLE_BRANCH_MISSES,
-       SAMPLE_LAST
-};
-
-
 // If you alter MAX_FRAMES, you may need to alter SAMPLE_BLOCK_SIZE too.
 #define MAX_FRAMES 32
 
index 5d93db9746644b73109dca08b0f5b9c8da49cc54..1c63e9abde7fda14b8887b2e29a2ba9ba8c1a037 100644 (file)
@@ -896,6 +896,16 @@ lookup_unmanaged_binary (uintptr_t addr)
        return NULL;
 }
 
+// For backwards compatibility.
+enum {
+       SAMPLE_CYCLES = 1,
+       SAMPLE_INSTRUCTIONS,
+       SAMPLE_CACHE_MISSES,
+       SAMPLE_CACHE_REFS,
+       SAMPLE_BRANCHES,
+       SAMPLE_BRANCH_MISSES,
+};
+
 static const char*
 sample_type_name (int type)
 {
@@ -2895,7 +2905,10 @@ decode_buffer (ProfContext *ctx)
                                        uint64_t tdiff = decode_uleb128 (p + 1, &p);
                                        LOG_TIME (time_base, tdiff);
                                        time_base += tdiff;
-                                       sample_type = *p++;
+                                       if (ctx->data_version < 14)
+                                               sample_type = *p++;
+                                       else
+                                               sample_type = SAMPLE_CYCLES;
                                        tstamp = time_base;
                                } else {
                                        sample_type = decode_uleb128 (p + 1, &p);
index 8088a22fba0a01b869db13e3f2ce17023d2ac609..5c41659bb5de692620bb4bb31dca06b45945a462 100644 (file)
@@ -15,8 +15,8 @@
       <PackAlignmentBoundary>0</PackAlignmentBoundary>
       <CallingConvention>0</CallingConvention>
       <ErrorReporting>0</ErrorReporting>
-      <CommandLineTemplate Condition="'$(Platform)' == 'Win32'">"$(VCInstallDir)bin\ml.exe" /c [AllOptions] [AdditionalOptions] /Ta[Inputs]</CommandLineTemplate>
-      <CommandLineTemplate Condition="'$(Platform)' == 'X64'">"$(VCInstallDir)bin\amd64\ml64.exe" /c [AllOptions] [AdditionalOptions] /Ta[Inputs]</CommandLineTemplate>
+      <CommandLineTemplate Condition="'$(Platform)' == 'Win32'">"ml.exe" /c [AllOptions] [AdditionalOptions] /Ta[Inputs]</CommandLineTemplate>
+      <CommandLineTemplate Condition="'$(Platform)' == 'X64'">"ml64.exe" /c [AllOptions] [AdditionalOptions] /Ta[Inputs]</CommandLineTemplate>
       <CommandLineTemplate Condition="'$(Platform)' != 'Win32' and '$(Platform)' != 'X64'">echo MASM not supported on this platform</CommandLineTemplate>
       <ExecutionDescription>Assembling %(Identity)...</ExecutionDescription>
     </MASM>