[xbuild] Evaluate Import with MSBuildThisFile* properties set.
[mono.git] / mono / mini / mini.c
index 541f67b16de7815530aca1baa5dd4c7060f1b4f5..45d34347c47070d0b31b194c60f83633eb6e9775 100644 (file)
@@ -1655,7 +1655,7 @@ compare_by_interval_start_pos_func (gconstpointer a, gconstpointer b)
 #endif
 
 static gint32*
-mono_allocate_stack_slots_full2 (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align)
+mono_allocate_stack_slots2 (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align)
 {
        int i, slot, offset, size;
        guint32 align;
@@ -1898,6 +1898,12 @@ mono_allocate_stack_slots_full2 (MonoCompile *cfg, gboolean backward, guint32 *s
 
                LSCAN_DEBUG (printf ("R%d %s -> 0x%x\n", inst->dreg, mono_type_full_name (t), slot));
 
+               if (inst->flags & MONO_INST_LMF) {
+                       size = sizeof (MonoLMF);
+                       align = sizeof (mgreg_t);
+                       reuse_slot = FALSE;
+               }
+
                if (!reuse_slot)
                        slot = 0xffffff;
 
@@ -1948,7 +1954,7 @@ mono_allocate_stack_slots_full2 (MonoCompile *cfg, gboolean backward, guint32 *s
 }
 
 /*
- *  mono_allocate_stack_slots_full:
+ *  mono_allocate_stack_slots:
  *
  *  Allocate stack slots for all non register allocated variables using a
  * linear scan algorithm.
@@ -1957,7 +1963,7 @@ mono_allocate_stack_slots_full2 (MonoCompile *cfg, gboolean backward, guint32 *s
  * STACK_ALIGN is set to the alignment needed by the locals area.
  */
 gint32*
-mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align)
+mono_allocate_stack_slots (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align)
 {
        int i, slot, offset, size;
        guint32 align;
@@ -1971,7 +1977,7 @@ mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *st
        gboolean reuse_slot;
 
        if ((cfg->num_varinfo > 0) && MONO_VARINFO (cfg, 0)->interval)
-               return mono_allocate_stack_slots_full2 (cfg, backward, stack_size, stack_align);
+               return mono_allocate_stack_slots2 (cfg, backward, stack_size, stack_align);
 
        scalar_stack_slots = mono_mempool_alloc0 (cfg->mempool, sizeof (StackSlotInfo) * MONO_TYPE_PINNED);
        vtype_stack_slots = NULL;
@@ -2126,6 +2132,16 @@ mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *st
                        */
                }
 
+               if (inst->flags & MONO_INST_LMF) {
+                       /*
+                        * This variable represents a MonoLMF structure, which has no corresponding
+                        * CLR type, so hard-code its size/alignment.
+                        */
+                       size = sizeof (MonoLMF);
+                       align = sizeof (mgreg_t);
+                       reuse_slot = FALSE;
+               }
+
                if (!reuse_slot)
                        slot = 0xffffff;
 
@@ -2182,7 +2198,7 @@ mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *st
 #else
 
 gint32*
-mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align)
+mono_allocate_stack_slots (MonoCompile *cfg, gboolean backward, guint32 *stack_size, guint32 *stack_align)
 {
        g_assert_not_reached ();
        return NULL;
@@ -2190,12 +2206,6 @@ mono_allocate_stack_slots_full (MonoCompile *cfg, gboolean backward, guint32 *st
 
 #endif /* DISABLE_JIT */
 
-gint32*
-mono_allocate_stack_slots (MonoCompile *m, guint32 *stack_size, guint32 *stack_align)
-{
-       return mono_allocate_stack_slots_full (m, TRUE, stack_size, stack_align);
-}
-
 #define EMUL_HIT_SHIFT 3
 #define EMUL_HIT_MASK ((1 << EMUL_HIT_SHIFT) - 1)
 /* small hit bitmap cache */
@@ -2572,10 +2582,14 @@ mono_jit_thread_attach (MonoDomain *domain)
 #ifdef MONO_HAVE_FAST_TLS
        if (!MONO_FAST_TLS_GET (mono_lmf_addr)) {
                mono_thread_attach (domain);
+               // #678164
+               mono_thread_set_state (mono_thread_internal_current (), ThreadState_Background);
        }
 #else
-       if (!TlsGetValue (mono_jit_tls_id))
+       if (!TlsGetValue (mono_jit_tls_id)) {
                mono_thread_attach (domain);
+               mono_thread_set_state (mono_thread_internal_current (), ThreadState_Background);
+       }
 #endif
        if (mono_domain_get () != domain)
                mono_domain_set (domain, TRUE);
@@ -6262,7 +6276,6 @@ mini_init (const char *filename, const char *runtime_version)
 #ifdef JIT_INVOKE_WORKS
        mono_install_runtime_invoke (mono_jit_runtime_invoke);
 #endif
-       mono_install_stack_walk (mono_jit_walk_stack);
        mono_install_get_cached_class_info (mono_aot_get_cached_class_info);
        mono_install_get_class_from_name (mono_aot_get_class_from_name);
        mono_install_jit_info_find_in_aot (mono_aot_find_jit_info);
@@ -6292,7 +6305,6 @@ mini_init (const char *filename, const char *runtime_version)
 
        /* This must come after mono_init () in the aot-only case */
        mono_exceptions_init ();
-       mono_install_handler (mono_get_throw_exception ());
 
        mono_icall_init ();