1 #ifndef __MONO_MINI_H__
2 #define __MONO_MINI_H__
7 #include <mono/metadata/loader.h>
8 #include <mono/metadata/mempool.h>
9 #include <mono/utils/monobitset.h>
10 #include <mono/metadata/class.h>
11 #include <mono/metadata/object.h>
12 #include <mono/metadata/opcodes.h>
13 #include <mono/metadata/tabledefs.h>
14 #include <mono/metadata/domain-internals.h>
15 #include "mono/metadata/class-internals.h"
16 #include "mono/metadata/object-internals.h"
17 #include <mono/metadata/profiler-private.h>
19 #include "mini-arch.h"
23 #define MONO_USE_AOT_COMPILER
25 /* for 32 bit systems */
26 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
27 #define MINI_LS_WORD_OFFSET 0
28 #define MINI_MS_WORD_OFFSET 4
29 #define inst_ls_word data.op[0].const_val
30 #define inst_ms_word data.op[1].const_val
32 #define MINI_LS_WORD_OFFSET 4
33 #define MINI_MS_WORD_OFFSET 0
34 #define inst_ls_word data.op[1].const_val
35 #define inst_ms_word data.op[0].const_val
38 /* Version number of the AOT file format */
39 #define MONO_AOT_FILE_VERSION "9"
42 #define mono_bitset_test_fast(set,n) (((guint32*)set)[2+(n)/32] & (1 << ((n) % 32)))
44 #define mono_bitset_test_fast(set,n) mono_bitset_test(set,n)
48 #define mono_bitset_foreach_bit(set,b,n) \
49 for (b = 0; b < n; b++)\
50 if (mono_bitset_test_fast(set,b))
51 #define mono_bitset_foreach_bit_rev(set,b,n) \
52 for (b = n - 1; b >= 0; b--)\
53 if (mono_bitset_test_fast(set,b))
55 #define mono_bitset_foreach_bit(set,b,n) \
56 for (b = mono_bitset_find_first (set, -1); b < n && b >= 0; b = mono_bitset_find_first (set, b))
57 #define mono_bitset_foreach_bit_rev(set,b,n) \
58 for (b = mono_bitset_find_last (set, n - 1); b >= 0; b = b ? mono_bitset_find_last (set, b) : -1)
63 * Pull the list of opcodes
65 #define OPDEF(a,b,c,d,e,f,g,h,i,j) \
69 #include "mono/cil/opcode.def"
74 #define MONO_VARINFO(cfg,varnum) ((cfg)->vars [varnum])
76 #define MONO_INST_NEW(cfg,dest,op) do { \
77 (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoInst)); \
78 (dest)->opcode = (op); \
81 #define MONO_INST_NEW_CALL(cfg,dest,op) do { \
82 (dest) = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoCallInst)); \
83 (dest)->inst.opcode = (op); \
86 #define MONO_ADD_INS(b,inst) do { \
87 if ((b)->last_ins) { \
88 (b)->last_ins->next = (inst); \
89 (b)->last_ins = (inst); \
91 (b)->code = (b)->last_ins = (inst); \
95 typedef struct MonoInst MonoInst;
96 typedef struct MonoCallInst MonoCallInst;
97 typedef struct MonoEdge MonoEdge;
98 typedef struct MonoMethodVar MonoMethodVar;
99 typedef struct MonoBasicBlock MonoBasicBlock;
100 typedef struct MonoLMF MonoLMF;
101 typedef struct MonoSpillInfo MonoSpillInfo;
102 typedef struct MonoTraceSpec MonoTraceSpec;
104 extern guint32 mono_jit_tls_id;
105 extern MonoTraceSpec *mono_jit_trace_calls;
106 extern gboolean mono_break_on_exc;
107 extern int mono_exc_esp_offset;
108 extern gboolean mono_compile_aot;
116 struct MonoSpillInfo {
122 * The IR-level basic block.
124 * A basic block can have multiple exits just fine, as long as the point of
125 * 'departure' is the last instruction in the basic block. Extended basic
126 * blocks, on the other hand, may have instructions that leave the block
127 * midstream. The important thing is that they cannot be _entered_
128 * midstream, ie, execution of a basic block (or extened bb) always start
129 * at the beginning of the block, never in the middle.
131 struct MonoBasicBlock {
134 /* Points to the start of the CIL code that initiated this BB */
135 unsigned char* cil_code;
137 /* Length of the CIL block */
140 /* The address of the generated code, used for fixups */
146 /* unique block number identification */
149 /* Visited and reachable flags */
152 /* Basic blocks: incoming and outgoing counts and pointers */
153 gint16 out_count, in_count;
154 MonoBasicBlock **in_bb;
155 MonoBasicBlock **out_bb;
157 /* the next basic block in the order it appears in IL */
158 MonoBasicBlock *next_bb;
161 * Before instruction selection it is the first tree in the
162 * forest and the first item in the list of trees. After
163 * instruction selection it is the first instruction and the
164 * first item in the list of instructions.
169 * SSA and loop based flags
171 MonoBitSet *dominators;
172 MonoBitSet *dfrontier;
173 MonoBasicBlock *idom;
175 /* fast dominator algorithm */
176 MonoBasicBlock *df_parent, *ancestor, *child, *label;
178 int size, sdom, idomn;
180 /* loop nesting and recognition */
183 gint8 loop_body_start;
185 /* use for liveness analysis */
187 MonoBitSet *kill_set;
188 MonoBitSet *live_in_set;
189 MonoBitSet *live_out_set;
191 /* fields to deal with non-empty stack slots at bb boundary */
192 guint16 out_scount, in_scount;
193 MonoInst **out_stack;
196 /* we use that to prevent merging of bblock covered by different clauses*/
200 * The region encodes whether the basic block is inside
201 * a finally, catch, filter or none of thoese.
203 * If the value is -1, then it is neither finally, catch nor filter
205 * Otherwise the format is:
207 * Bits: | 0-3 | 4-7 | 8-31
209 * | clause-flags | MONO_REGION | clause-index
214 /* The current symbolic register number, used in local register allocation. */
215 guint32 max_ireg, max_freg;
220 #define BB_REACHABLE 2
230 MonoMethodSignature *signature;
231 MonoBasicBlock **many_blocks;
232 MonoBasicBlock *target_block;
242 guint8 type; /* stack type */
246 /* used by the register allocator */
247 gint32 dreg, sreg1, sreg2, unused;
251 const unsigned char* cil_code; /* for debugging and bblock splitting */
254 struct MonoCallInst {
256 MonoMethodSignature *signature;
263 regmask_t used_iregs;
264 regmask_t used_fregs;
266 GSList *out_ireg_args;
267 GSList *out_freg_args;
273 * Note: some of the values overlap, because they can't appear
274 * in the same MonoInst.
277 MONO_INST_HAS_METHOD = 1,
278 /* temp local created by a DUP: used only within a BB */
279 MONO_INST_IS_TEMP = 1,
280 MONO_INST_INIT = 1, /* in localloc */
281 MONO_INST_IS_DEAD = 2,
282 MONO_INST_TAILCALL = 4,
283 MONO_INST_VOLATILE = 4,
284 MONO_INST_BRLABEL = 4,
285 MONO_INST_NOTYPECHECK = 4,
286 MONO_INST_UNALIGNED = 8,
287 /* the address of the variable has been taken */
288 MONO_INST_INDIRECT = 16,
289 MONO_INST_NORANGECHECK = 16
292 #define inst_c0 data.op[0].const_val
293 #define inst_c1 data.op[1].const_val
294 #define inst_i0 data.op[0].src
295 #define inst_i1 data.op[1].src
296 #define inst_p0 data.op[0].p
297 #define inst_p1 data.op[1].p
298 #define inst_l data.i8const
299 #define inst_r data.r8const
300 #define inst_left data.op[0].src
301 #define inst_right data.op[1].src
303 #define inst_newa_len data.op[0].src
304 #define inst_newa_class data.op[1].klass
306 #define inst_var data.op[0].var
307 #define inst_vtype data.op[1].vtype
308 /* in branch instructions */
309 #define inst_many_bb data.op[1].many_blocks
310 #define inst_target_bb data.op[0].target_block
311 #define inst_true_bb data.op[1].many_blocks[0]
312 #define inst_false_bb data.op[1].many_blocks[1]
314 #define inst_basereg sreg1
315 #define inst_indexreg sreg2
316 #define inst_destbasereg dreg
317 #define inst_offset data.op[0].const_val
318 #define inst_imm data.op[1].const_val
320 #define inst_phi_args data.op[1].phi_args
322 /* instruction description for use in regalloc/scheduling */
338 guint16 tid; /* tree number */
339 guint16 bid; /* block number */
345 MonoPosition first_use, last_use;
349 * Additional information about a variable
351 struct MonoMethodVar {
352 guint idx; /* inside cfg->varinfo, cfg->vars */
354 MonoBitSet *dfrontier;
355 MonoLiveRange range; /* generated by liveness analysis */
356 int reg; /* != -1 if allocated into a register */
358 MonoBitSet *def_in; /* used by SSA */
359 MonoInst *def; /* used by SSA */
360 MonoBasicBlock *def_bb; /* used by SSA */
361 GList *uses; /* used by SSA */
362 char cpstate; /* used by SSA conditional constant propagation */
366 gpointer end_of_stack;
370 gpointer signal_stack;
371 guint32 signal_stack_size;
372 void (*abort_func) (MonoObject *object);
378 MONO_PATCH_INFO_LABEL,
379 MONO_PATCH_INFO_METHOD,
380 MONO_PATCH_INFO_METHOD_JUMP,
381 MONO_PATCH_INFO_METHOD_REL,
382 MONO_PATCH_INFO_METHODCONST,
383 MONO_PATCH_INFO_INTERNAL_METHOD,
384 MONO_PATCH_INFO_SWITCH,
386 MONO_PATCH_INFO_EXC_NAME,
387 MONO_PATCH_INFO_CLASS,
388 MONO_PATCH_INFO_IMAGE,
389 MONO_PATCH_INFO_FIELD,
390 MONO_PATCH_INFO_VTABLE,
391 MONO_PATCH_INFO_CLASS_INIT,
392 MONO_PATCH_INFO_SFLDA,
393 MONO_PATCH_INFO_LDSTR,
394 MONO_PATCH_INFO_LDTOKEN,
395 MONO_PATCH_INFO_TYPE_FROM_HANDLE,
400 MONO_PATCH_INFO_BB_OVF,
401 MONO_PATCH_INFO_EXC_OVF,
402 MONO_PATCH_INFO_WRAPPER
406 * We need to store the image which the token refers to along with the token,
407 * since the image might not be the same as the image of the method which
408 * contains the relocation, because of inlining.
410 typedef struct MonoJumpInfoToken {
415 typedef struct MonoJumpInfo MonoJumpInfo;
416 struct MonoJumpInfo {
424 MonoJumpInfoType type;
426 gconstpointer target;
427 #if SIZEOF_VOID_P == 8
433 MonoBasicBlock **table;
437 MonoClassField *field;
441 MonoJumpInfoToken *token;
444 int table_size; /* use by switch */
447 /* optimization flags: keep up to date with the name array in driver.c */
449 MONO_OPT_PEEPHOLE = 1 << 0,
450 MONO_OPT_BRANCH = 1 << 1,
451 MONO_OPT_INLINE = 1 << 2,
452 MONO_OPT_CFOLD = 1 << 3,
453 MONO_OPT_CONSPROP = 1 << 4,
454 MONO_OPT_COPYPROP = 1 << 5,
455 MONO_OPT_DEADCE = 1 << 6,
456 MONO_OPT_LINEARS = 1 << 7,
457 MONO_OPT_CMOV = 1 << 8,
458 MONO_OPT_SHARED = 1 << 9,
459 MONO_OPT_SCHED = 1 << 10,
460 MONO_OPT_INTRINS = 1 << 11,
461 MONO_OPT_TAILC = 1 << 12,
462 MONO_OPT_LOOP = 1 << 13,
463 MONO_OPT_FCMOV = 1 << 14,
464 MONO_OPT_LEAF = 1 << 15,
465 MONO_OPT_AOT = 1 << 16,
466 MONO_OPT_PRECOMP = 1 << 17,
467 MONO_OPT_ABCREM = 1 << 18
470 /* Bit-fields in the MonoBasicBlock.region */
471 #define MONO_REGION_FINALLY 16
472 #define MONO_REGION_CATCH 32
473 #define MONO_REGION_FAULT 64 /* Currently unused */
474 #define MONO_REGION_FILTER 128
477 * Control Flow Graph and compilation unit information
481 MonoMemPool *mempool;
483 MonoMethodVar **vars;
485 MonoBasicBlock *bb_entry;
486 MonoBasicBlock *bb_exit;
487 MonoBasicBlock *bb_init;
488 MonoBasicBlock **bblocks;
490 MonoMemPool *state_pool; /* used by instruction selection */
491 MonoBasicBlock *cbb; /* used by instruction selection */
492 MonoInst *prev_ins; /* in decompose */
493 MonoJumpInfo *patch_info;
494 MonoJitInfo *jit_info;
495 MonoJitDynamicMethodInfo *dynamic_info;
498 guint num_varinfo; /* used items in varinfo */
499 guint varinfo_count; /* total storage in varinfo */
503 MonoSpillInfo *spill_info; /* machine register spills */
504 MonoSpillInfo *spill_info_float; /* fp register spills */
506 /* unsigned char *cil_code; */
507 MonoMethod *inlined_method; /* the method which is currently inlined */
509 /* the exception object passed to catch/filter blocks */
512 MonoInst *domainvar; /* a cache for the current domain */
514 /* A hashtable of region ID-> SP var mappings */
515 /* An SP var is a place to store the stack pointer (used by handlers)*/
518 GList *ldstr_list; /* used by AOT */
522 unsigned char *native_code;
527 regmask_t used_int_regs;
529 guint32 prof_options;
532 guint32 verbose_level;
537 gboolean disable_aot;
538 gboolean disable_ssa;
540 gboolean need_lmf_area;
544 MonoProfileCoverageInfo *coverage_info;
545 MonoCompileArch arch;
547 guint8 ins, locals, outs; /* reg stack region sizes */
552 MONO_CFG_HAS_ALLOCA = 1 << 0,
553 MONO_CFG_HAS_CALLS = 1 << 1,
554 MONO_CFG_HAS_LDELEMA = 1 << 2,
555 MONO_CFG_HAS_VARARGS = 1 << 3,
556 MONO_CFG_HAS_TAIL = 1 << 4
560 gulong methods_compiled;
562 gulong methods_lookups;
563 gulong method_trampolines;
565 gulong analyze_stack_repeat;
566 gulong cil_code_size;
567 gulong native_code_size;
568 gulong code_reallocs;
569 gulong max_code_size_ratio;
570 gulong biggest_method_size;
571 gulong allocated_code_size;
572 gulong inlineable_methods;
573 gulong inlined_methods;
575 gulong max_basic_blocks;
576 MonoMethod *max_ratio_method;
577 MonoMethod *biggest_method;
581 extern MonoJitStats mono_jit_stats;
583 /* values for MonoInst.ssa_op */
592 #define OP_CEQ (256+CEE_CEQ)
593 #define OP_CLT (256+CEE_CLT)
594 #define OP_CLT_UN (256+CEE_CLT_UN)
595 #define OP_CGT (256+CEE_CGT)
596 #define OP_CGT_UN (256+CEE_CGT_UN)
597 #define OP_LOCALLOC (256+CEE_LOCALLOC)
599 /* opcodes: value assigned after all the CIL opcodes */
603 #define MINI_OP(a,b) a,
605 OP_START = MONO_CEE_LAST,
606 #include "mini-ops.h"
611 #if SIZEOF_VOID_P == 8
612 #define OP_PADD OP_LADD
613 #define OP_PNEG OP_LNEG
614 #define OP_PCONV_TO_U2 OP_LCONV_TO_U2
615 #define OP_PCONV_TO_OVF_I1_UN OP_LCONV_TO_OVF_I1_UN
616 #define OP_PCONV_TO_OVF_I1 OP_LCONV_TO_OVF_I1
617 #define OP_PCEQ CEE_CEQ
618 #define OP_STOREP_MEMBASE_REG OP_STOREI8_MEMBASE_REG
619 #define OP_STOREP_MEMBASE_IMM OP_STOREI8_MEMBASE_IMM
621 #define OP_PADD CEE_ADD
622 #define OP_PNEG CEE_NEG
623 #define OP_PCONV_TO_U2 CEE_CONV_U2
624 #define OP_PCONV_TO_OVF_I1_UN CEE_CONV_OVF_I1_UN
625 #define OP_PCONV_TO_OVF_I1 CEE_CONV_OVF_I1
626 #define OP_PCEQ CEE_CEQ
627 #define OP_STOREP_MEMBASE_REG OP_STOREI4_MEMBASE_REG
628 #define OP_STOREP_MEMBASE_IMM OP_STOREI4_MEMBASE_IMM
657 MONO_COMP_DFRONTIER = 4,
658 MONO_COMP_DOM_REV = 8,
659 MONO_COMP_LIVENESS = 16,
661 MONO_COMP_SSA_DEF_USE = 64,
662 MONO_COMP_REACHABILITY = 128,
663 MONO_COMP_LOOPS = 256
668 MONO_GRAPH_DTREE = 2,
669 MONO_GRAPH_CFG_CODE = 4,
670 MONO_GRAPH_CFG_SSA = 8,
671 MONO_GRAPH_CFG_OPTCODE = 16
678 } MonoJitArgumentInfo;
680 typedef void (*MonoInstFunc) (MonoInst *tree, gpointer data);
683 int mono_main (int argc, char* argv[]);
684 void mono_set_defaults (int verbose_level, guint32 opts);
685 MonoDomain* mini_init (const char *filename);
686 void mini_cleanup (MonoDomain *domain);
689 MonoJumpInfoToken * mono_jump_info_token_new (MonoMemPool *mp, MonoImage *image, guint32 token);
690 MonoInst* mono_find_spvar_for_region (MonoCompile *cfg, int region);
691 void mono_precompile_assemblies (void);
692 int mono_parse_default_optimizations (const char* p);
693 void mono_bblock_add_inst (MonoBasicBlock *bb, MonoInst *inst);
694 void mono_constant_fold (MonoCompile *cfg);
695 void mono_constant_fold_inst (MonoInst *inst, gpointer data);
696 int mono_is_power_of_two (guint32 val);
697 void mono_cprop_local (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **acp, int acp_size);
698 MonoInst* mono_compile_create_var (MonoCompile *cfg, MonoType *type, int opcode);
699 void mono_blockset_print (MonoCompile *cfg, MonoBitSet *set, const char *name, guint idom);
700 void mono_print_tree (MonoInst *tree);
701 void mono_print_tree_nl (MonoInst *tree);
702 void mono_print_code (MonoCompile *cfg);
703 void mono_print_method_from_ip (void *ip);
704 void mono_select_instructions (MonoCompile *cfg);
705 const char* mono_inst_name (int op);
706 void mono_inst_foreach (MonoInst *tree, MonoInstFunc func, gpointer data);
707 void mono_disassemble_code (guint8 *code, int size, char *id);
708 guint mono_type_to_ldind (MonoType *t);
709 guint mono_type_to_stind (MonoType *t);
710 void mono_add_patch_info (MonoCompile *cfg, int ip, MonoJumpInfoType type, gconstpointer target);
711 void mono_remove_patch_info (MonoCompile *cfg, int ip);
712 gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors);
713 MonoLMF** mono_get_lmf_addr (void);
714 GList *mono_varlist_insert_sorted (MonoCompile *cfg, GList *list, MonoMethodVar *mv, gboolean sort_end);
715 GList *mono_varlist_sort (MonoCompile *cfg, GList *list, int sort_type);
716 void mono_analyze_liveness (MonoCompile *cfg);
717 void mono_linear_scan (MonoCompile *cfg, GList *vars, GList *regs, regmask_t *used_mask);
718 void mono_create_jump_table (MonoCompile *cfg, MonoInst *label, MonoBasicBlock **bbs, int num_blocks);
719 int mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options);
720 MonoCompile *mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, gboolean run_cctors, int parts);
721 void mono_destroy_compile (MonoCompile *cfg);
722 void mono_aot_init (void);
723 MonoJitInfo* mono_aot_get_method (MonoDomain *domain,
725 gboolean mono_method_blittable (MonoMethod *method);
726 gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee);
727 void mono_register_opcode_emulation (int opcode, const char* name, MonoMethodSignature *sig, gpointer func, gboolean no_throw);
728 void mono_arch_register_lowlevel_calls (void);
729 void mono_draw_graph (MonoCompile *cfg, MonoGraphOptions draw_options);
730 void mono_add_varcopy_to_end (MonoCompile *cfg, MonoBasicBlock *bb, int src, int dest);
732 int mono_find_method_opcode (MonoMethod *method);
733 MonoJitICallInfo *mono_find_jit_icall_by_name (const char *name);
734 MonoJitICallInfo *mono_find_jit_icall_by_addr (gconstpointer addr);
735 MonoJitICallInfo *mono_register_jit_icall (gconstpointer func, const char *name, MonoMethodSignature *sig, gboolean is_save);
736 gconstpointer mono_icall_get_wrapper (MonoJitICallInfo* callinfo);
738 gpointer mono_create_jump_trampoline (MonoDomain *domain,
740 gboolean add_sync_wrapper);
741 gpointer mono_create_class_init_trampoline (MonoVTable *vtable);
742 gpointer mono_create_jit_trampoline (MonoMethod *method);
743 MonoVTable* mono_find_class_init_trampoline_by_addr (gconstpointer addr);
744 gboolean mono_running_on_valgrind (void);
746 /* methods that must be provided by the arch-specific port */
747 void mono_arch_cpu_init (void);
748 guint32 mono_arch_cpu_optimizazions (guint32 *exclude_mask);
749 void mono_arch_instrument_mem_needs (MonoMethod *method, int *stack, int *code);
750 void *mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments);
751 void *mono_arch_instrument_epilog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments);
752 MonoCallInst *mono_arch_call_opcode (MonoCompile *cfg, MonoBasicBlock* bb, MonoCallInst *call, int is_virtual);
753 gint mono_arch_get_opcode_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args);
754 void mono_codegen (MonoCompile *cfg);
755 const char *mono_arch_regname (int reg);
756 gpointer mono_arch_get_throw_exception (void);
757 gpointer mono_arch_get_rethrow_exception (void);
758 gpointer mono_arch_get_throw_exception_by_name (void);
759 gpointer mono_arch_create_jit_trampoline (MonoMethod *method);
760 MonoJitInfo *mono_arch_create_jump_trampoline (MonoMethod *method);
761 gpointer mono_arch_create_class_init_trampoline(MonoVTable *vtable);
762 GList *mono_arch_get_allocatable_int_vars (MonoCompile *cfg);
763 GList *mono_arch_get_global_int_regs (MonoCompile *cfg);
764 guint32 mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv);
765 void mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors);
766 void mono_arch_flush_icache (guint8 *code, gint size);
767 int mono_arch_max_epilog_size (MonoCompile *cfg);
768 guint8 *mono_arch_emit_prolog (MonoCompile *cfg);
769 void mono_arch_emit_epilog (MonoCompile *cfg);
770 void mono_arch_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb);
771 void mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb);
772 gboolean mono_arch_has_unwind_info (gconstpointer addr);
773 void mono_arch_setup_jit_tls_data (MonoJitTlsData *tls);
774 void mono_arch_free_jit_tls_data (MonoJitTlsData *tls);
775 void mono_arch_emit_this_vret_args (MonoCompile *cfg, MonoCallInst *inst, int this_reg, int this_type, int vt_reg);
776 void mono_arch_allocate_vars (MonoCompile *m);
777 int mono_arch_get_argument_info (MonoMethodSignature *csig, int param_count, MonoJitArgumentInfo *arg_info);
778 gboolean mono_arch_print_tree (MonoInst *tree, int arity);
779 MonoJitInfo *mono_arch_find_jit_info (MonoDomain *domain,
780 MonoJitTlsData *jit_tls,
782 MonoJitInfo *prev_ji,
784 MonoContext *new_ctx,
789 gpointer mono_arch_get_call_filter (void);
790 gpointer mono_arch_get_restore_context (void);
791 gboolean mono_arch_handle_exception (void *sigctx, gpointer obj, gboolean test_only);
792 gpointer mono_arch_ip_from_context (void *sigctx);
793 void mono_arch_flush_register_windows (void);
794 gboolean mono_arch_is_inst_imm (gint64 imm);
795 MonoInst* mono_arch_get_domain_intrinsic (MonoCompile* cfg);
796 MonoInst* mono_arch_get_thread_intrinsic (MonoCompile* cfg);
797 gboolean mono_arch_is_int_overflow (void *sigctx, void *info);
798 void mono_arch_invalidate_method (MonoJitInfo *ji, void *func, gpointer func_arg);
800 /* Exception handling */
801 gboolean mono_handle_exception (MonoContext *ctx, gpointer obj,
802 gpointer original_ip, gboolean test_only);
803 void mono_jit_walk_stack (MonoStackWalk func, gboolean do_il_offset, gpointer user_data);
804 MonoArray *ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info);
805 MonoBoolean ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info,
806 MonoReflectionMethod **method,
807 gint32 *iloffset, gint32 *native_offset,
808 MonoString **file, gint32 *line, gint32 *column);
810 /* Dominator/SSA methods */
811 void mono_compile_dominator_info (MonoCompile *cfg, int dom_flags);
812 void mono_compute_natural_loops (MonoCompile *cfg);
813 MonoBitSet* mono_compile_iterated_dfrontier (MonoCompile *cfg, MonoBitSet *set);
814 void mono_ssa_compute (MonoCompile *cfg);
815 void mono_ssa_remove (MonoCompile *cfg);
816 void mono_ssa_cprop (MonoCompile *cfg);
817 void mono_ssa_deadce (MonoCompile *cfg);
818 void mono_ssa_strength_reduction (MonoCompile *cfg);
819 void mono_free_loop_info (MonoCompile *cfg);
821 /* debugging support */
822 void mono_debug_init_method (MonoCompile *cfg, MonoBasicBlock *start_block,
823 guint32 breakpoint_id);
824 void mono_debug_open_method (MonoCompile *cfg);
825 void mono_debug_close_method (MonoCompile *cfg);
826 void mono_debug_open_block (MonoCompile *cfg, MonoBasicBlock *bb, guint32 address);
827 void mono_debug_record_line_number (MonoCompile *cfg, MonoInst *ins, guint32 address);
828 void mono_debug_serialize_debug_info (MonoCompile *cfg, guint8 **out_buf, guint32 *buf_len);
829 void mono_debug_add_aot_method (MonoDomain *domain,
830 MonoMethod *method, guint8 *code_start,
831 guint8 *debug_info, guint32 debug_info_len);
832 void mono_debug_add_icall_wrapper (MonoMethod *method, MonoJitICallInfo* info);
836 MonoTraceSpec *mono_trace_parse_options (char *options);
837 void mono_trace_set_assembly (MonoAssembly *assembly);
838 gboolean mono_trace_eval (MonoMethod *method);
841 mono_perform_abc_removal (MonoCompile *cfg);
843 #endif /* __MONO_MINI_H__ */