Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / metadata / profiler-private.h
index e087be07eb604fbfa0dc320637dfec8bd333998c..e8d9a61569a8fbcae6d821cc1b4b3edfa70bd029 100644 (file)
@@ -7,15 +7,17 @@
 #ifndef __MONO_PROFILER_PRIVATE_H__
 #define __MONO_PROFILER_PRIVATE_H__
 
+#include <mono/metadata/class-internals.h>
 #define MONO_PROFILER_UNSTABLE_GC_ROOTS
 #include <mono/metadata/profiler.h>
-#include <mono/utils/mono-lazy-init.h>
+#include <mono/utils/mono-context.h>
 #include <mono/utils/mono-os-mutex.h>
 #include <mono/utils/mono-os-semaphore.h>
 
 struct _MonoProfilerDesc {
        MonoProfilerHandle next;
        MonoProfiler *prof;
+       volatile gpointer cleanup_callback;
        volatile gpointer coverage_filter;
        volatile gpointer call_instrumentation_filter;
 
@@ -42,16 +44,28 @@ struct _MonoProfilerDesc {
 
 typedef struct {
        gboolean startup_done;
+
        MonoProfilerHandle profilers;
-       mono_lazy_init_t coverage_status;
+
+       gboolean code_coverage;
        mono_mutex_t coverage_mutex;
        GHashTable *coverage_hash;
+
        MonoProfilerHandle sampling_owner;
        MonoSemType sampling_semaphore;
        MonoProfilerSampleMode sample_mode;
        guint32 sample_freq;
+
        gboolean allocations;
 
+       gboolean call_contexts;
+       void (*context_enable) (void);
+       gpointer (*context_get_this) (MonoProfilerCallContext *);
+       gpointer (*context_get_argument) (MonoProfilerCallContext *, guint32);
+       gpointer (*context_get_local) (MonoProfilerCallContext *, guint32);
+       gpointer (*context_get_result) (MonoProfilerCallContext *);
+       void (*context_free_buffer) (gpointer);
+
 #define _MONO_PROFILER_EVENT(name) \
        volatile gint32 name ## _count;
 #define MONO_PROFILER_EVENT_0(name, type) \
@@ -93,9 +107,26 @@ mono_profiler_installed (void)
 }
 
 MonoProfilerCoverageInfo *mono_profiler_coverage_alloc (MonoMethod *method, guint32 entries);
-void mono_profiler_coverage_free (MonoMethod *method);
 
-gboolean mono_profiler_should_instrument_method (MonoMethod *method, gboolean entry);
+struct _MonoProfilerCallContext {
+       /*
+        * Must be the first field (the JIT relies on it). Only filled out if this
+        * is a JIT frame; otherwise, zeroed.
+        */
+       MonoContext context;
+       /*
+        * A non-NULL MonoInterpFrameHandle if this is an interpreter frame.
+        */
+       gpointer interp_frame;
+       MonoMethod *method;
+       /*
+        * Points to the return value for an epilogue context. For a prologue, this
+        * is set to NULL.
+        */
+       gpointer return_value;
+};
+
+MonoProfilerCallInstrumentationFlags mono_profiler_get_call_instrumentation_flags (MonoMethod *method);
 
 gboolean mono_profiler_sampling_enabled (void);
 void mono_profiler_sampling_thread_post (void);
@@ -108,7 +139,7 @@ mono_profiler_allocations_enabled (void)
 }
 
 #define _MONO_PROFILER_EVENT(name, ...) \
-       void mono_profiler_raise_ ## name (__VA_ARGS__);
+       ICALL_DECL_EXPORT void mono_profiler_raise_ ## name (__VA_ARGS__);
 #define MONO_PROFILER_EVENT_0(name, type) \
        _MONO_PROFILER_EVENT(name, void)
 #define MONO_PROFILER_EVENT_1(name, type, arg1_type, arg1_name) \