X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fmini.h;h=81d75262b92c817fd572ce94c3488cace20b75dc;hb=824e66edd228b294f297e1d2257342db834a423b;hp=cabe93f454155193b3abd63bff0a29ccddd8fc2d;hpb=aa53e6c5ce8131fef2566519abb2fb3afc42d96a;p=mono.git diff --git a/mono/mini/mini.h b/mono/mini/mini.h index cabe93f4541..81d75262b92 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -21,10 +21,15 @@ #include "regalloc.h" #include "declsec.h" +#ifndef G_LIKELY +#define G_LIKELY(a) (a) +#define G_UNLIKELY(a) (a) +#endif + #if DISABLE_LOGGING #define MINI_DEBUG(level,limit,code) #else -#define MINI_DEBUG(level,limit,code) do {if ((level) >= (limit)) code} while (0) +#define MINI_DEBUG(level,limit,code) do {if (G_UNLIKELY ((level) >= (limit))) code} while (0) #endif #ifndef DISABLE_AOT @@ -45,7 +50,7 @@ #endif /* Version number of the AOT file format */ -#define MONO_AOT_FILE_VERSION "25" +#define MONO_AOT_FILE_VERSION "27" #if 0 #define mono_bitset_foreach_bit(set,b,n) \ @@ -56,7 +61,7 @@ if (mono_bitset_test_fast(set,b)) #else #define mono_bitset_foreach_bit(set,b,n) \ - for (b = mono_bitset_find_first (set, -1); b < n && b >= 0; b = mono_bitset_find_first (set, b)) + for (b = mono_bitset_find_start (set); b < n && b >= 0; b = mono_bitset_find_first (set, b)) #define mono_bitset_foreach_bit_rev(set,b,n) \ for (b = mono_bitset_find_last (set, n - 1); b >= 0; b = b ? mono_bitset_find_last (set, b) : -1) @@ -128,7 +133,9 @@ struct MonoEdge { }; struct MonoSpillInfo { +#ifndef MONO_ARCH_HAS_XP_REGALLOC MonoSpillInfo *next; +#endif int offset; }; @@ -145,6 +152,28 @@ struct MonoSpillInfo { struct MonoBasicBlock { MonoInst *last_ins; + /* the next basic block in the order it appears in IL */ + MonoBasicBlock *next_bb; + + /* + * Before instruction selection it is the first tree in the + * forest and the first item in the list of trees. After + * instruction selection it is the first instruction and the + * first item in the list of instructions. + */ + MonoInst *code; + + /* unique block number identification */ + gint32 block_num; + + gint32 dfn; + + /* Basic blocks: incoming and outgoing counts and pointers */ + /* Each bb should only appear once in each array */ + gint16 out_count, in_count; + MonoBasicBlock **in_bb; + MonoBasicBlock **out_bb; + /* Points to the start of the CIL code that initiated this BB */ unsigned char* cil_code; @@ -154,31 +183,10 @@ struct MonoBasicBlock { /* The address of the generated code, used for fixups */ int native_offset; int max_offset; - - gint32 dfn; - - /* unique block number identification */ - gint32 block_num; /* Visited and reachable flags */ guint32 flags; - /* Basic blocks: incoming and outgoing counts and pointers */ - gint16 out_count, in_count; - MonoBasicBlock **in_bb; - MonoBasicBlock **out_bb; - - /* the next basic block in the order it appears in IL */ - MonoBasicBlock *next_bb; - - /* - * Before instruction selection it is the first tree in the - * forest and the first item in the list of trees. After - * instruction selection it is the first instruction and the - * first item in the list of instructions. - */ - MonoInst *code; - /* * SSA and loop based flags */ @@ -200,7 +208,9 @@ struct MonoBasicBlock { * Whenever the bblock is rarely executed so it should be emitted after * the function epilog. */ - gboolean out_of_line; + guint out_of_line : 1; + /* Caches the result of uselessness calculation during optimize_branches */ + guint not_useless : 1; /* use for liveness analysis */ MonoBitSet *gen_set; @@ -287,7 +297,7 @@ struct MonoCallInst { gboolean virtual; regmask_t used_iregs; regmask_t used_fregs; -#if defined(MONO_ARCH_HAS_XP_LOCAL_REGALLOC) || defined(__x86_64__) +#if defined(MONO_ARCH_HAS_XP_LOCAL_REGALLOC) GSList *out_ireg_args; GSList *out_freg_args; #endif @@ -429,6 +439,7 @@ typedef enum { MONO_PATCH_INFO_R8, MONO_PATCH_INFO_IP, MONO_PATCH_INFO_IID, + MONO_PATCH_INFO_ADJUSTED_IID, MONO_PATCH_INFO_BB_OVF, MONO_PATCH_INFO_EXC_OVF, MONO_PATCH_INFO_WRAPPER, @@ -487,6 +498,7 @@ typedef enum { MONO_TRAMPOLINE_JUMP, MONO_TRAMPOLINE_CLASS_INIT, MONO_TRAMPOLINE_AOT, + MONO_TRAMPOLINE_AOT_PLT, MONO_TRAMPOLINE_DELEGATE, MONO_TRAMPOLINE_NUM } MonoTrampolineType; @@ -514,7 +526,8 @@ enum { MONO_OPT_ABCREM = 1 << 18, MONO_OPT_SSAPRE = 1 << 19, MONO_OPT_EXCEPTION= 1 << 20, - MONO_OPT_SSA = 1 << 21 + MONO_OPT_SSA = 1 << 21, + MONO_OPT_TREEPROP = 1 << 22 }; /* Bit-fields in the MonoBasicBlock.region */ @@ -556,6 +569,7 @@ typedef struct { MonoSpillInfo *spill_info; /* machine register spills */ MonoSpillInfo *spill_info_float; /* fp register spills */ gint spill_count; + gint spill_info_len, spill_info_float_len; /* unsigned char *cil_code; */ MonoMethod *inlined_method; /* the method which is currently inlined */ MonoInst *domainvar; /* a cache for the current domain */ @@ -590,13 +604,13 @@ typedef struct { guint32 param_area; guint32 frame_reg; gint32 sig_cookie; - gboolean disable_aot; - gboolean disable_ssa; - gboolean run_cctors; - gboolean need_lmf_area; - gboolean compile_aot; - gboolean got_var_allocated; - gboolean ret_var_is_local; + guint disable_aot : 1; + guint disable_ssa : 1; + guint run_cctors : 1; + guint need_lmf_area : 1; + guint compile_aot : 1; + guint got_var_allocated : 1; + guint ret_var_is_local : 1; gpointer debug_info; guint32 lmf_offset; guint16 *intvars; @@ -605,9 +619,13 @@ typedef struct { guint32 exception_type; /* MONO_EXCEPTION_* */ guint32 exception_data; char* exception_message; -#ifdef __ia64 - guint8 ins, locals, outs; /* reg stack region sizes */ -#endif /* __ia64 */ + + /* Fields used by the local reg allocator */ + void* reginfo; + void* reginfof; + void* reverse_inst_list; + int reginfo_len, reginfof_len; + int reverse_inst_list_len; } MonoCompile; typedef enum { @@ -817,8 +835,6 @@ void mono_select_instructions (MonoCompile *cfg); const char* mono_inst_name (int op); void mono_inst_foreach (MonoInst *tree, MonoInstFunc func, gpointer data); void mono_disassemble_code (MonoCompile *cfg, guint8 *code, int size, char *id); -guint mono_type_to_ldind (MonoType *t); -guint mono_type_to_stind (MonoType *t); void mono_add_patch_info (MonoCompile *cfg, int ip, MonoJumpInfoType type, gconstpointer target); void mono_remove_patch_info (MonoCompile *cfg, int ip); gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors); @@ -834,12 +850,15 @@ void mono_create_jump_table (MonoCompile *cfg, MonoInst *label, int mono_compile_assembly (MonoAssembly *ass, guint32 opts, const char *aot_options); MonoCompile *mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, gboolean run_cctors, gboolean compile_aot, int parts); void mono_destroy_compile (MonoCompile *cfg); +MonoJitICallInfo *mono_find_jit_opcode_emulation (int opcode); + void mono_aot_init (void); MonoJitInfo* mono_aot_get_method (MonoDomain *domain, MonoMethod *method); gpointer mono_aot_get_method_from_token (MonoDomain *domain, MonoImage *image, guint32 token); gboolean mono_aot_is_got_entry (guint8 *code, guint8 *addr); +guint8* mono_aot_get_plt_entry (guint8 *code); gboolean mono_aot_init_vtable (MonoVTable *vtable); gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res); MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr); @@ -847,6 +866,7 @@ void mono_aot_set_make_unreadable (gboolean unreadable); gboolean mono_aot_is_pagefault (void *ptr); void mono_aot_handle_pagefault (void *ptr); guint32 mono_aot_get_n_pagefaults (void); +gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code); gboolean mono_method_blittable (MonoMethod *method); gboolean mono_method_same_domain (MonoJitInfo *caller, MonoJitInfo *callee); @@ -875,6 +895,8 @@ gpointer mono_magic_trampoline (gssize *regs, guint8 *code, MonoMethod gpointer mono_delegate_trampoline (gssize *regs, guint8 *code, MonoMethod *m, guint8* tramp); gpointer mono_aot_trampoline (gssize *regs, guint8 *code, guint8 *token_info, guint8* tramp); +gpointer mono_aot_plt_trampoline (gssize *regs, guint8 *code, guint8 *token_info, + guint8* tramp); void mono_class_init_trampoline (gssize *regs, guint8 *code, MonoVTable *vtable, guint8 *tramp); gboolean mono_running_on_valgrind (void); @@ -892,9 +914,9 @@ void mono_arch_instrument_mem_needs (MonoMethod *method, int *stack, void *mono_arch_instrument_prolog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments); void *mono_arch_instrument_epilog (MonoCompile *cfg, void *func, void *p, gboolean enable_arguments); MonoCallInst *mono_arch_call_opcode (MonoCompile *cfg, MonoBasicBlock* bb, MonoCallInst *call, int is_virtual); -MonoInst *mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); +MonoInst *mono_arch_get_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig, MonoInst **args); void mono_codegen (MonoCompile *cfg); -void mono_call_inst_add_outarg_reg (MonoCallInst *call, int vreg, int hreg, gboolean fp); +void mono_call_inst_add_outarg_reg (MonoCompile *cfg, MonoCallInst *call, int vreg, int hreg, gboolean fp); const char *mono_arch_regname (int reg); const char *mono_arch_fregname (int reg); gpointer mono_arch_get_throw_exception (void); @@ -905,7 +927,6 @@ guchar* mono_arch_create_trampoline_code (MonoTrampolineType tramp_type); gpointer mono_arch_create_jit_trampoline (MonoMethod *method); MonoJitInfo *mono_arch_create_jump_trampoline (MonoMethod *method); gpointer mono_arch_create_class_init_trampoline(MonoVTable *vtable); -gpointer mono_create_delegate_trampoline (MonoMethod *method, gpointer addr); GList *mono_arch_get_allocatable_int_vars (MonoCompile *cfg); GList *mono_arch_get_global_int_regs (MonoCompile *cfg); guint32 mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv); @@ -954,14 +975,16 @@ void mono_arch_save_unwind_info (MonoCompile *cfg); void mono_arch_register_lowlevel_calls (void); gpointer mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr); void mono_arch_patch_callsite (guint8 *code, guint8 *addr); +void mono_arch_patch_plt_entry (guint8 *code, guint8 *addr); void mono_arch_nullify_class_init_trampoline(guint8 *code, gssize *regs); +void mono_arch_nullify_plt_entry (guint8 *code); void mono_arch_patch_delegate_trampoline (guint8 *code, guint8 *tramp, gssize *regs, guint8 *addr); gpointer mono_arch_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len); /* Exception handling */ gboolean mono_handle_exception (MonoContext *ctx, gpointer obj, gpointer original_ip, gboolean test_only); -void mono_handle_native_sigsegv (void *sigctx); +void mono_handle_native_sigsegv (int signal, void *sigctx); void mono_print_thread_dump (void *sigctx); void mono_jit_walk_stack (MonoStackWalk func, gboolean do_il_offset, gpointer user_data); void mono_jit_walk_stack_from_ctx (MonoStackWalk func, MonoContext *ctx, gboolean do_il_offset, gpointer user_data); @@ -1018,6 +1041,8 @@ extern void mono_perform_abc_removal (MonoCompile *cfg); extern void mono_perform_ssapre (MonoCompile *cfg); +extern void +mono_local_cprop (MonoCompile *cfg); /* CAS - stack walk */ MonoSecurityFrame* ves_icall_System_Security_SecurityFrame_GetSecurityFrame (gint32 skip);