Merge pull request #1439 from BrzVlad/feature-managed-allocator
[mono.git] / mono / mini / seq-points.h
1 /*
2  * Copyright 2014 Xamarin Inc
3  */
4  
5 #ifndef __MONO_SEQ_POINTS_H__
6 #define __MONO_SEQ_POINTS_H__
7
8 #define MONO_SEQ_POINT_FLAG_NONEMPTY_STACK 1
9 #define MONO_SEQ_POINT_FLAG_EXIT_IL 2
10
11 /* IL offsets used to mark the sequence points belonging to method entry/exit events */
12 #define METHOD_ENTRY_IL_OFFSET -1
13 #define METHOD_EXIT_IL_OFFSET 0xffffff
14
15 /* Native offset used to mark seq points in dead code */
16 #define SEQ_POINT_NATIVE_OFFSET_DEAD_CODE -1
17
18 typedef struct {
19         int il_offset, native_offset, flags;
20         /* Offset of indexes of successor sequence points on the compressed buffer */
21         int next_offset;
22         /* Number of entries in next */
23         int next_len;
24 } SeqPoint;
25
26 typedef struct MonoSeqPointInfo {
27         int dummy[0];
28 } MonoSeqPointInfo;
29
30 typedef struct {
31         SeqPoint seq_point;
32         guint8* ptr;
33         guint8* begin;
34         guint8* end;
35         gboolean has_debug_data;
36 } SeqPointIterator;
37
38 void
39 seq_point_info_free (gpointer info);
40
41 void
42 mono_save_seq_point_info (MonoCompile *cfg);
43
44 MonoSeqPointInfo*
45 get_seq_points (MonoDomain *domain, MonoMethod *method);
46
47 gboolean
48 find_next_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset, MonoSeqPointInfo **info, SeqPoint* seq_point);
49
50 gboolean
51 find_prev_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset, MonoSeqPointInfo **info, SeqPoint* seq_point);
52
53 gboolean
54 find_seq_point (MonoDomain *domain, MonoMethod *method, gint32 il_offset, MonoSeqPointInfo **info, SeqPoint *seq_point);
55
56 gboolean
57 seq_point_iterator_next (SeqPointIterator* it);
58
59 void
60 seq_point_iterator_init (SeqPointIterator* it, MonoSeqPointInfo* info);
61
62 void
63 seq_point_init_next (MonoSeqPointInfo* info, SeqPoint sp, SeqPoint* next);
64
65 int
66 seq_point_info_write (MonoSeqPointInfo* info, guint8* buffer);
67
68 int
69 seq_point_info_read (MonoSeqPointInfo** info, guint8* buffer, gboolean copy);
70
71 int
72 seq_point_info_get_write_size (MonoSeqPointInfo* info);
73
74 void
75 bb_deduplicate_op_il_seq_points (MonoCompile *cfg, MonoBasicBlock *bb);
76
77 #endif /* __MONO_SEQ_POINTS_H__ */