Fix the build.
[mono.git] / mono / mini / seq-points.c
index c0dcd6da7daabfcadb27011f09f7b51be9f9c60a..c9f74b8e170b68359225bbc6e8a1fba44da6598c 100644 (file)
@@ -98,7 +98,8 @@ mono_save_seq_point_info (MonoCompile *cfg)
                                last = ins;
                        }
 
-                       if (bb->last_ins && bb->last_ins->opcode == OP_ENDFINALLY && bb->seq_points) {
+                       /* The second case handles endfinally opcodes which are in a separate bb by themselves */
+                       if ((bb->last_ins && bb->last_ins->opcode == OP_ENDFINALLY && bb->seq_points) || (bb->out_count == 1 && bb->out_bb [0]->code && bb->out_bb [0]->code->opcode == OP_ENDFINALLY)) {
                                MonoBasicBlock *bb2;
                                MonoInst *endfinally_seq_point = NULL;
 
@@ -156,7 +157,7 @@ mono_save_seq_point_info (MonoCompile *cfg)
                        if (has_debug_data)
                                next_list = next[i];
 
-                       if (seq_point_info_add_seq_point (array, sp, last_seq_point, next_list, has_debug_data))
+                       if (mono_seq_point_info_add_seq_point (array, sp, last_seq_point, next_list, has_debug_data))
                                last_seq_point = sp;
 
                        if (has_debug_data)
@@ -167,7 +168,7 @@ mono_save_seq_point_info (MonoCompile *cfg)
        if (has_debug_data)
                g_free (next);
 
-       cfg->seq_point_info = seq_point_info_new (array->len, TRUE, array->data, has_debug_data, &seq_info_size);
+       cfg->seq_point_info = mono_seq_point_info_new (array->len, TRUE, array->data, has_debug_data, &seq_info_size);
        mono_jit_stats.allocated_seq_points_size += seq_info_size;
 
        g_byte_array_free (array, TRUE);
@@ -186,34 +187,40 @@ mono_save_seq_point_info (MonoCompile *cfg)
 }
 
 MonoSeqPointInfo*
-get_seq_points (MonoDomain *domain, MonoMethod *method)
+mono_get_seq_points (MonoDomain *domain, MonoMethod *method)
 {
        MonoSeqPointInfo *seq_points;
+       MonoMethod *declaring_generic_method = NULL, *shared_method = NULL;
 
-       mono_domain_lock (domain);
+       if (method->is_inflated) {
+               declaring_generic_method = mono_method_get_declaring_generic_method (method);
+               shared_method = mini_get_shared_method (method);
+       }
+
+       mono_loader_lock ();
        seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, method);
        if (!seq_points && method->is_inflated) {
                /* generic sharing + aot */
-               seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, mono_method_get_declaring_generic_method (method));
+               seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, declaring_generic_method);
                if (!seq_points)
-                       seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, mini_get_shared_method (method));
+                       seq_points = g_hash_table_lookup (domain_jit_info (domain)->seq_points, shared_method);
        }
-       mono_domain_unlock (domain);
+       mono_loader_unlock ();
 
        return seq_points;
 }
 
 /*
- * find_next_seq_point_for_native_offset:
+ * mono_find_next_seq_point_for_native_offset:
  *
  *   Find the first sequence point after NATIVE_OFFSET.
  */
 gboolean
-find_next_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset, MonoSeqPointInfo **info, SeqPoint* seq_point)
+mono_find_next_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset, MonoSeqPointInfo **info, SeqPoint* seq_point)
 {
        MonoSeqPointInfo *seq_points;
 
-       seq_points = get_seq_points (domain, method);
+       seq_points = mono_get_seq_points (domain, method);
        if (!seq_points) {
                if (info)
                        *info = NULL;
@@ -222,20 +229,20 @@ find_next_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, g
        if (info)
                *info = seq_points;
 
-       return seq_point_find_next_by_native_offset (seq_points, native_offset, seq_point);
+       return mono_seq_point_find_next_by_native_offset (seq_points, native_offset, seq_point);
 }
 
 /*
- * find_prev_seq_point_for_native_offset:
+ * mono_find_prev_seq_point_for_native_offset:
  *
  *   Find the first sequence point before NATIVE_OFFSET.
  */
 gboolean
-find_prev_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset, MonoSeqPointInfo **info, SeqPoint* seq_point)
+mono_find_prev_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset, MonoSeqPointInfo **info, SeqPoint* seq_point)
 {
        MonoSeqPointInfo *seq_points;
 
-       seq_points = get_seq_points (domain, method);
+       seq_points = mono_get_seq_points (domain, method);
        if (!seq_points) {
                if (info)
                        *info = NULL;
@@ -244,21 +251,21 @@ find_prev_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, g
        if (info)
                *info = seq_points;
 
-       return seq_point_find_prev_by_native_offset (seq_points, native_offset, seq_point);
+       return mono_seq_point_find_prev_by_native_offset (seq_points, native_offset, seq_point);
 }
 
 /*
- * find_seq_point:
+ * mono_find_seq_point:
  *
  *   Find the sequence point corresponding to the IL offset IL_OFFSET, which
  * should be the location of a sequence point.
  */
 gboolean
-find_seq_point (MonoDomain *domain, MonoMethod *method, gint32 il_offset, MonoSeqPointInfo **info, SeqPoint *seq_point)
+mono_find_seq_point (MonoDomain *domain, MonoMethod *method, gint32 il_offset, MonoSeqPointInfo **info, SeqPoint *seq_point)
 {
        MonoSeqPointInfo *seq_points;
 
-       seq_points = get_seq_points (domain, method);
+       seq_points = mono_get_seq_points (domain, method);
        if (!seq_points) {
                if (info)
                        *info = NULL;
@@ -267,11 +274,11 @@ find_seq_point (MonoDomain *domain, MonoMethod *method, gint32 il_offset, MonoSe
        if (info)
                *info = seq_points;
 
-       return seq_point_find_by_il_offset (seq_points, il_offset, seq_point);
+       return mono_seq_point_find_by_il_offset (seq_points, il_offset, seq_point);
 }
 
 void
-bb_deduplicate_op_il_seq_points (MonoCompile *cfg, MonoBasicBlock *bb)
+mono_bb_deduplicate_op_il_seq_points (MonoCompile *cfg, MonoBasicBlock *bb)
 {
        MonoInst *ins, *n, *prev;