Merge pull request #1412 from esdrubal/stackframe
[mono.git] / mono / mini / ir-emit.h
index 07ca6378b89b6c15442b2be60c35efcbc39691e4..aac45186598af0c3295e282aca2433512024e1e9 100644 (file)
@@ -302,8 +302,6 @@ alloc_dreg (MonoCompile *cfg, MonoStackType stack_type)
 
 #define NEW_JIT_ICALL_ADDRCONST(cfg,dest,name) NEW_AOTCONST ((cfg), (dest), MONO_PATCH_INFO_JIT_ICALL_ADDR, (name))
 
-#define GET_VARINFO_INST(cfg,num) ((cfg)->varinfo [(num)]->inst)
-
 #define NEW_VARLOAD(cfg,dest,var,vartype) do { \
         MONO_INST_NEW ((cfg), (dest), OP_MOVE); \
                (dest)->opcode = mono_type_to_regmove ((cfg), (vartype));  \
@@ -407,7 +405,7 @@ handle_gsharedvt_ldaddr (MonoCompile *cfg)
        } while (0)
 
 #define NEW_SEQ_POINT(cfg,dest,il_offset,intr_loc) do {         \
-       MONO_INST_NEW ((cfg), (dest), OP_SEQ_POINT); \
+       MONO_INST_NEW ((cfg), (dest), cfg->gen_seq_points_debug_data ? OP_SEQ_POINT : OP_IL_SEQ_POINT); \
        (dest)->inst_imm = (il_offset); \
        (dest)->flags = intr_loc ? MONO_INST_SINGLE_STEP_LOC : 0; \
        } while (0)
@@ -487,7 +485,7 @@ handle_gsharedvt_ldaddr (MonoCompile *cfg)
                        MonoInst *iargs [2]; \
                        iargs [0] = (inst); \
                        EMIT_NEW_VARLOADA (cfg, iargs [1], (var), (vartype)); \
-                       mono_emit_jit_icall (cfg, mono_fstore_r4, iargs); \
+                       (dest) = mono_emit_jit_icall (cfg, mono_fstore_r4, iargs);      \
                } else { \
                        EMIT_NEW_VARSTORE ((cfg), (dest), (var), (vartype), (inst)); \
                } \
@@ -600,6 +598,13 @@ handle_gsharedvt_ldaddr (MonoCompile *cfg)
            MONO_ADD_INS ((cfg)->cbb, inst); \
        } while (0)
 
+#define MONO_EMIT_NEW_DUMMY_INIT(cfg,dr,op) do {                         \
+               MonoInst *inst;                                                                           \
+               MONO_INST_NEW ((cfg), (inst), (op));                              \
+               inst->dreg = dr;                                                                          \
+               MONO_ADD_INS ((cfg)->cbb, inst);                                          \
+       } while (0)
+
 #ifdef MONO_ARCH_NEED_GOT_VAR
 
 #define MONO_EMIT_NEW_AOTCONST(cfg,dr,cons,patch_type) do { \
@@ -862,8 +867,6 @@ static int ccount = 0;
                int __ins_flags = ins_flags; \
                if (__ins_flags & MONO_INST_FAULT) {                                                            \
                        MONO_EMIT_NULL_CHECK ((cfg), (base));                                           \
-                       if (cfg->explicit_null_checks)                                                          \
-                               __ins_flags &= ~MONO_INST_FAULT;                                                        \
                }                                                                                                                               \
                NEW_LOAD_MEMBASE ((cfg), (dest), (op), (dr), (base), (offset)); \
                (dest)->flags = (__ins_flags);                                                                  \
@@ -874,8 +877,6 @@ static int ccount = 0;
                int __ins_flags = ins_flags; \
            if (__ins_flags & MONO_INST_FAULT) {                                                                        \
                        MONO_EMIT_NULL_CHECK ((cfg), (base));                                           \
-                       if (cfg->explicit_null_checks)                                                          \
-                               __ins_flags &= ~MONO_INST_FAULT;                                                        \
                }                                                                                                                               \
                NEW_LOAD_MEMBASE ((cfg), (inst), (op), (dr), (base), (offset)); \
                inst->flags = (__ins_flags); \
@@ -930,15 +931,15 @@ static int ccount = 0;
                if (!(cfg->opt & MONO_OPT_ABCREM)) {                                                    \
                        MONO_EMIT_NULL_CHECK (cfg, array_reg);                                          \
                        if (COMPILE_LLVM (cfg)) \
-                               MONO_EMIT_DEFAULT_BOUNDS_CHECK ((cfg), (array_reg), G_STRUCT_OFFSET (array_type, array_length_field), (index_reg), TRUE); \
+                               MONO_EMIT_DEFAULT_BOUNDS_CHECK ((cfg), (array_reg), MONO_STRUCT_OFFSET (array_type, array_length_field), (index_reg), TRUE); \
                        else \
-                               MONO_ARCH_EMIT_BOUNDS_CHECK ((cfg), (array_reg), G_STRUCT_OFFSET (array_type, array_length_field), (index_reg)); \
+                               MONO_ARCH_EMIT_BOUNDS_CHECK ((cfg), (array_reg), MONO_STRUCT_OFFSET (array_type, array_length_field), (index_reg)); \
                } else {                                                                                                                \
                        MonoInst *ins;                                                                                          \
                        MONO_INST_NEW ((cfg), ins, OP_BOUNDS_CHECK);                            \
                        ins->sreg1 = array_reg;                                                                         \
                        ins->sreg2 = index_reg;                                                                         \
-                       ins->inst_imm = G_STRUCT_OFFSET (array_type, array_length_field); \
+                       ins->inst_imm = MONO_STRUCT_OFFSET (array_type, array_length_field); \
                        ins->flags |= MONO_INST_FAULT; \
                        MONO_ADD_INS ((cfg)->cbb, ins);                                                         \
                        (cfg)->flags |= MONO_CFG_HAS_ARRAY_ACCESS;                                      \