[profiler] Implement call context introspection for enter/leave events.
[mono.git] / mono / mini / interp / interp-internals.h
index f26e4ff57b3badc3c7a3a9d5c9d91e1d9b3be89a..894747e23d0880ad15f6705c40a2dde3d49d6a84 100644 (file)
@@ -7,6 +7,7 @@
 #include <mono/metadata/object.h>
 #include <mono/metadata/domain-internals.h>
 #include <mono/metadata/class-internals.h>
+#include <mono/metadata/debug-internals.h>
 #include "config.h"
 
 enum {
@@ -38,6 +39,10 @@ typedef struct {
        union {
                gint32 i;
                gint64 l;
+               struct {
+                       gint32 lo;
+                       gint32 hi;
+               } pair;
                double f;
                /* native size integer and pointer types */
                gpointer p;
@@ -49,7 +54,7 @@ typedef struct {
 #endif
 } stackval;
 
-typedef struct _MonoInvocation MonoInvocation;
+typedef struct _InterpFrame InterpFrame;
 
 typedef void (*MonoFuncV) (void);
 typedef void (*MonoPIFunc) (MonoFuncV callme, void *margs);
@@ -58,14 +63,14 @@ typedef void (*MonoPIFunc) (MonoFuncV callme, void *margs);
  * Structure representing a method transformed for the interpreter 
  * This is domain specific
  */
-typedef struct _RuntimeMethod
+typedef struct _InterpMethod
 {
        /* NOTE: These first two elements (method and
           next_jit_code_hash) must be in the same order and at the
           same offset as in MonoJitInfo, because of the jit_code_hash
           internal hash table in MonoDomain. */
        MonoMethod *method;
-       struct _RuntimeMethod *next_jit_code_hash;
+       struct _InterpMethod *next_jit_code_hash;
        guint32 locals_size;
        guint32 args_size;
        guint32 stack_size;
@@ -80,19 +85,30 @@ typedef struct _RuntimeMethod
        int transformed;
        guint32 *arg_offsets;
        guint32 *local_offsets;
+       guint32 *exvar_offsets;
        unsigned int param_count;
        unsigned int hasthis;
-} RuntimeMethod;
+       gpointer jit_wrapper;
+       gpointer jit_addr;
+       MonoMethodSignature *jit_sig;
+       gpointer jit_entry;
+       MonoType *rtype;
+       MonoType **param_types;
+       MonoJitInfo *jinfo;
+       MonoDomain *domain;
+       MonoProfilerCallInstrumentationFlags prof_flags;
+} InterpMethod;
 
-struct _MonoInvocation {
-       MonoInvocation *parent; /* parent */
-       RuntimeMethod  *runtime_method; /* parent */
+struct _InterpFrame {
+       InterpFrame *parent; /* parent */
+       InterpMethod  *imethod; /* parent */
        MonoMethod     *method; /* parent */
        stackval       *retval; /* parent */
        char           *args;
        stackval       *stack_args; /* parent */
        stackval       *stack;
        stackval       *sp; /* For GC stack marking */
+       unsigned char  *locals;
        /* exception info */
        unsigned char  invoke_trap;
        const unsigned short  *ip;
@@ -101,24 +117,32 @@ struct _MonoInvocation {
 };
 
 typedef struct {
-       MonoDomain *domain;
-       MonoInvocation *base_frame;
-       MonoInvocation *current_frame;
-       MonoInvocation *env_frame;
+       MonoDomain *original_domain;
+       InterpFrame *base_frame;
+       InterpFrame *current_frame;
+       InterpFrame *env_frame;
        jmp_buf *current_env;
        unsigned char search_for_handler;
        unsigned char managed_code;
+
+       /* Resume state for resuming execution in mixed mode */
+       gboolean       has_resume_state;
+       /* Frame to resume execution at */
+       InterpFrame *handler_frame;
+       /* IP to resume execution at */
+       gpointer handler_ip;
 } ThreadContext;
 
 extern int mono_interp_traceopt;
+extern GSList *jit_classes;
 
 MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
+mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context);
 
 void
 mono_interp_transform_init (void);
 
-RuntimeMethod *
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error);
+InterpMethod *
+mono_interp_get_imethod (MonoDomain *domain, MonoMethod *method, MonoError *error);
 
 #endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */