Merge pull request #5714 from alexischr/update_bockbuild
[mono.git] / mono / mini / mini-mips.c
index 4e961dd3cd68c89135718ffc7099e7f719daf266..0a489649c86dc3eae078a1a0342647d73ca8a5f8 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * mini-mips.c: MIPS backend for the Mono code generator
+/**
+ * \file
+ * MIPS backend for the Mono code generator
  *
  * Authors:
  *   Mark Mason (mason@broadcom.com)
@@ -20,6 +21,7 @@
 #include <mono/metadata/debug-helpers.h>
 #include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-hwcap.h>
+#include <mono/utils/unlocked.h>
 
 #include <mono/arch/mips/mips-codegen.h>
 
@@ -697,6 +699,12 @@ mono_arch_cleanup (void)
        mono_os_mutex_destroy (&mini_arch_mutex);
 }
 
+gboolean
+mono_arch_have_fast_tls (void)
+{
+       return FALSE;
+}
+
 /*
  * This function returns the optimizations supported on this cpu.
  */
@@ -1107,7 +1115,6 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
                DEBUG(printf("param %d: ", i));
                simpletype = mini_get_underlying_type (sig->params [i]);
                switch (simpletype->type) {
-               case MONO_TYPE_BOOLEAN:
                case MONO_TYPE_I1:
                case MONO_TYPE_U1:
                        DEBUG(printf("1 byte\n"));
@@ -1115,7 +1122,6 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
                        add_int32_arg (cinfo, &cinfo->args[n]);
                        n++;
                        break;
-               case MONO_TYPE_CHAR:
                case MONO_TYPE_I2:
                case MONO_TYPE_U2:
                        DEBUG(printf("2 bytes\n"));
@@ -1134,11 +1140,7 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
                case MONO_TYPE_U:
                case MONO_TYPE_PTR:
                case MONO_TYPE_FNPTR:
-               case MONO_TYPE_CLASS:
                case MONO_TYPE_OBJECT:
-               case MONO_TYPE_STRING:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_ARRAY:
                        cinfo->args [n].size = sizeof (gpointer);
                        add_int32_arg (cinfo, &cinfo->args[n]);
                        n++;
@@ -1254,23 +1256,17 @@ get_call_info (MonoMemPool *mp, MonoMethodSignature *sig)
        {
                simpletype = mini_get_underlying_type (sig->ret);
                switch (simpletype->type) {
-               case MONO_TYPE_BOOLEAN:
                case MONO_TYPE_I1:
                case MONO_TYPE_U1:
                case MONO_TYPE_I2:
                case MONO_TYPE_U2:
-               case MONO_TYPE_CHAR:
                case MONO_TYPE_I4:
                case MONO_TYPE_U4:
                case MONO_TYPE_I:
                case MONO_TYPE_U:
                case MONO_TYPE_PTR:
                case MONO_TYPE_FNPTR:
-               case MONO_TYPE_CLASS:
                case MONO_TYPE_OBJECT:
-               case MONO_TYPE_SZARRAY:
-               case MONO_TYPE_ARRAY:
-               case MONO_TYPE_STRING:
                        cinfo->ret.reg = mips_v0;
                        break;
                case MONO_TYPE_U8:
@@ -1317,8 +1313,7 @@ debug_omit_fp (void)
 
 /**
  * mono_arch_compute_omit_fp:
- *
- *   Determine whenever the frame pointer can be eliminated.
+ * Determine whether the frame pointer can be eliminated.
  */
 static void
 mono_arch_compute_omit_fp (MonoCompile *cfg)
@@ -1357,8 +1352,7 @@ mono_arch_compute_omit_fp (MonoCompile *cfg)
                cfg->arch.omit_fp = FALSE;
        if (!sig->pinvoke && (sig->call_convention == MONO_CALL_VARARG))
                cfg->arch.omit_fp = FALSE;
-       if ((mono_jit_trace_calls != NULL && mono_trace_eval (cfg->method)) ||
-               (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE))
+       if ((mono_jit_trace_calls != NULL && mono_trace_eval (cfg->method)))
                cfg->arch.omit_fp = FALSE;
        /*
         * On MIPS, fp points to the bottom of the frame, so it can be eliminated even if
@@ -1887,7 +1881,7 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                        soffset += SIZEOF_REGISTER;
                }
                if (ovf_size != 0) {
-                       mini_emit_memcpy (cfg, mips_sp, doffset, src->dreg, soffset, ovf_size * sizeof (gpointer), 0);
+                       mini_emit_memcpy (cfg, mips_sp, doffset, src->dreg, soffset, ovf_size * sizeof (gpointer), SIZEOF_VOID_P);
                }
        } else if (ainfo->storage == ArgInFReg) {
                int tmpr = mono_alloc_freg (cfg);
@@ -1915,7 +1909,7 @@ mono_arch_emit_outarg_vt (MonoCompile *cfg, MonoInst *ins, MonoInst *src)
                        g_assert (ovf_size > 0);
 
                EMIT_NEW_VARLOADA (cfg, load, vtcopy, vtcopy->inst_vtype);
-               mini_emit_memcpy (cfg, load->dreg, 0, src->dreg, 0, size, 0);
+               mini_emit_memcpy (cfg, load->dreg, 0, src->dreg, 0, size, SIZEOF_VOID_P);
 
                if (ainfo->offset)
                        MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, mips_at, ainfo->offset, load->dreg);
@@ -3223,21 +3217,6 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
 
        cpos = bb->max_offset;
 
-#if 0
-       if (cfg->prof_options & MONO_PROFILE_COVERAGE) {
-               MonoCoverageInfo *cov = mono_get_coverage_info (cfg->method);
-               g_assert (!mono_compile_aot);
-               cpos += 20;
-               if (bb->cil_code)
-                       cov->data [bb->dfn].iloffset = bb->cil_code - cfg->cil_code;
-               /* this is not thread save, but good enough */
-               /* fixme: howto handle overflows? */
-               mips_load_const (code, mips_at, &cov->data [bb->dfn].count);
-               mips_lw (code, mips_temp, mips_at, 0);
-               mips_addiu (code, mips_temp, mips_temp, 1);
-               mips_sw (code, mips_temp, mips_at, 0);
-       }
-#endif
        MONO_BB_FOR_EACH_INS (bb, ins) {
                offset = code - cfg->native_code;
 
@@ -4533,7 +4512,7 @@ mono_arch_patch_code (MonoCompile *cfg, MonoMethod *method, MonoDomain *domain,
 {
        MonoJumpInfo *patch_info;
 
-       mono_error_init (error);
+       error_init (error);
 
        for (patch_info = ji; patch_info; patch_info = patch_info->next) {
                unsigned char *ip = patch_info->ip.i + code;
@@ -4838,9 +4817,6 @@ mono_arch_emit_prolog (MonoCompile *cfg)
                MonoInst *ins = bb->code;
                bb->max_offset = max_offset;
 
-               if (cfg->prof_options & MONO_PROFILE_COVERAGE)
-                       max_offset += 6; 
-
                MONO_BB_FOR_EACH_INS (bb, ins)
                        max_offset += ((guint8 *)ins_get_spec (ins->opcode))[MONO_INST_LEN];
        }
@@ -5316,9 +5292,6 @@ mono_arch_emit_epilog_sub (MonoCompile *cfg, guint8 *code)
        if (mono_jit_trace_calls != NULL)
                max_epilog_size += 50;
 
-       if (cfg->prof_options & MONO_PROFILE_ENTER_LEAVE)
-               max_epilog_size += 50;
-
        if (code)
                pos = code - cfg->native_code;
        while (cfg->code_len + max_epilog_size > (cfg->code_size - 16)) {
@@ -5589,12 +5562,6 @@ mono_arch_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMetho
        return NULL;
 }
 
-gboolean
-mono_arch_print_tree (MonoInst *tree, int arity)
-{
-       return 0;
-}
-
 mgreg_t
 mono_arch_context_get_int_reg (MonoContext *ctx, int reg)
 {
@@ -5743,7 +5710,7 @@ mono_arch_build_imt_trampoline (MonoVTable *vtable, MonoDomain *domain, MonoIMTC
        }
 
        if (!fail_tramp)
-               mono_stats.imt_trampolines_size += code - start;
+               UnlockedAdd (&mono_stats.imt_trampolines_size, code - start);
        g_assert (code - start <= size);
        mono_arch_flush_icache (start, size);